diff options
357 files changed, 15506 insertions, 1759 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-usb_host b/Documentation/ABI/testing/sysfs-class-uwb_rc-wusbhc index 46b66ad1f1b4..4e8106f7cfd9 100644 --- a/Documentation/ABI/testing/sysfs-class-usb_host +++ b/Documentation/ABI/testing/sysfs-class-uwb_rc-wusbhc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | What: /sys/class/usb_host/usb_hostN/wusb_chid | 1 | What: /sys/class/uwb_rc/uwbN/wusbhc/wusb_chid |
| 2 | Date: July 2008 | 2 | Date: July 2008 |
| 3 | KernelVersion: 2.6.27 | 3 | KernelVersion: 2.6.27 |
| 4 | Contact: David Vrabel <david.vrabel@csr.com> | 4 | Contact: David Vrabel <david.vrabel@csr.com> |
| @@ -9,7 +9,7 @@ Description: | |||
| 9 | 9 | ||
| 10 | Set an all zero CHID to stop the host controller. | 10 | Set an all zero CHID to stop the host controller. |
| 11 | 11 | ||
| 12 | What: /sys/class/usb_host/usb_hostN/wusb_trust_timeout | 12 | What: /sys/class/uwb_rc/uwbN/wusbhc/wusb_trust_timeout |
| 13 | Date: July 2008 | 13 | Date: July 2008 |
| 14 | KernelVersion: 2.6.27 | 14 | KernelVersion: 2.6.27 |
| 15 | Contact: David Vrabel <david.vrabel@csr.com> | 15 | Contact: David Vrabel <david.vrabel@csr.com> |
diff --git a/Documentation/debugging-via-ohci1394.txt b/Documentation/debugging-via-ohci1394.txt index 59a91e5c6909..611f5a5499b1 100644 --- a/Documentation/debugging-via-ohci1394.txt +++ b/Documentation/debugging-via-ohci1394.txt | |||
| @@ -64,14 +64,14 @@ be used to view the printk buffer of a remote machine, even with live update. | |||
| 64 | 64 | ||
| 65 | Bernhard Kaindl enhanced firescope to support accessing 64-bit machines | 65 | Bernhard Kaindl enhanced firescope to support accessing 64-bit machines |
| 66 | from 32-bit firescope and vice versa: | 66 | from 32-bit firescope and vice versa: |
| 67 | - ftp://ftp.suse.de/private/bk/firewire/tools/firescope-0.2.2.tar.bz2 | 67 | - http://halobates.de/firewire/firescope-0.2.2.tar.bz2 |
| 68 | 68 | ||
| 69 | and he implemented fast system dump (alpha version - read README.txt): | 69 | and he implemented fast system dump (alpha version - read README.txt): |
| 70 | - ftp://ftp.suse.de/private/bk/firewire/tools/firedump-0.1.tar.bz2 | 70 | - http://halobates.de/firewire/firedump-0.1.tar.bz2 |
| 71 | 71 | ||
| 72 | There is also a gdb proxy for firewire which allows to use gdb to access | 72 | There is also a gdb proxy for firewire which allows to use gdb to access |
| 73 | data which can be referenced from symbols found by gdb in vmlinux: | 73 | data which can be referenced from symbols found by gdb in vmlinux: |
| 74 | - ftp://ftp.suse.de/private/bk/firewire/tools/fireproxy-0.33.tar.bz2 | 74 | - http://halobates.de/firewire/fireproxy-0.33.tar.bz2 |
| 75 | 75 | ||
| 76 | The latest version of this gdb proxy (fireproxy-0.34) can communicate (not | 76 | The latest version of this gdb proxy (fireproxy-0.34) can communicate (not |
| 77 | yet stable) with kgdb over an memory-based communication module (kgdbom). | 77 | yet stable) with kgdb over an memory-based communication module (kgdbom). |
| @@ -178,7 +178,7 @@ Step-by-step instructions for using firescope with early OHCI initialization: | |||
| 178 | 178 | ||
| 179 | Notes | 179 | Notes |
| 180 | ----- | 180 | ----- |
| 181 | Documentation and specifications: ftp://ftp.suse.de/private/bk/firewire/docs | 181 | Documentation and specifications: http://halobates.de/firewire/ |
| 182 | 182 | ||
| 183 | FireWire is a trademark of Apple Inc. - for more information please refer to: | 183 | FireWire is a trademark of Apple Inc. - for more information please refer to: |
| 184 | http://en.wikipedia.org/wiki/FireWire | 184 | http://en.wikipedia.org/wiki/FireWire |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 89a47b5aff07..bc693fffabe0 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
| @@ -418,6 +418,14 @@ When: 2.6.33 | |||
| 418 | Why: Should be implemented in userspace, policy daemon. | 418 | Why: Should be implemented in userspace, policy daemon. |
| 419 | Who: Johannes Berg <johannes@sipsolutions.net> | 419 | Who: Johannes Berg <johannes@sipsolutions.net> |
| 420 | 420 | ||
| 421 | --------------------------- | ||
| 422 | |||
| 423 | What: CONFIG_INOTIFY | ||
| 424 | When: 2.6.33 | ||
| 425 | Why: last user (audit) will be converted to the newer more generic | ||
| 426 | and more easily maintained fsnotify subsystem | ||
| 427 | Who: Eric Paris <eparis@redhat.com> | ||
| 428 | |||
| 421 | ---------------------------- | 429 | ---------------------------- |
| 422 | 430 | ||
| 423 | What: lock_policy_rwsem_* and unlock_policy_rwsem_* will not be | 431 | What: lock_policy_rwsem_* and unlock_policy_rwsem_* will not be |
| @@ -451,3 +459,33 @@ Why: OSS sound_core grabs all legacy minors (0-255) of SOUND_MAJOR | |||
| 451 | will also allow making ALSA OSS emulation independent of | 459 | will also allow making ALSA OSS emulation independent of |
| 452 | sound_core. The dependency will be broken then too. | 460 | sound_core. The dependency will be broken then too. |
| 453 | Who: Tejun Heo <tj@kernel.org> | 461 | Who: Tejun Heo <tj@kernel.org> |
| 462 | |||
| 463 | ---------------------------- | ||
| 464 | |||
| 465 | What: Support for VMware's guest paravirtuliazation technique [VMI] will be | ||
| 466 | dropped. | ||
| 467 | When: 2.6.37 or earlier. | ||
| 468 | Why: With the recent innovations in CPU hardware acceleration technologies | ||
| 469 | from Intel and AMD, VMware ran a few experiments to compare these | ||
| 470 | techniques to guest paravirtualization technique on VMware's platform. | ||
| 471 | These hardware assisted virtualization techniques have outperformed the | ||
| 472 | performance benefits provided by VMI in most of the workloads. VMware | ||
| 473 | expects that these hardware features will be ubiquitous in a couple of | ||
| 474 | years, as a result, VMware has started a phased retirement of this | ||
| 475 | feature from the hypervisor. We will be removing this feature from the | ||
| 476 | Kernel too. Right now we are targeting 2.6.37 but can retire earlier if | ||
| 477 | technical reasons (read opportunity to remove major chunk of pvops) | ||
| 478 | arise. | ||
| 479 | |||
| 480 | Please note that VMI has always been an optimization and non-VMI kernels | ||
| 481 | still work fine on VMware's platform. | ||
| 482 | Latest versions of VMware's product which support VMI are, | ||
| 483 | Workstation 7.0 and VSphere 4.0 on ESX side, future maintainence | ||
| 484 | releases for these products will continue supporting VMI. | ||
| 485 | |||
| 486 | For more details about VMI retirement take a look at this, | ||
| 487 | http://blogs.vmware.com/guestosguide/2009/09/vmi-retirement.html | ||
| 488 | |||
| 489 | Who: Alok N Kataria <akataria@vmware.com> | ||
| 490 | |||
| 491 | ---------------------------- | ||
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt index 570f9bd9be2b..05d5cf1d743f 100644 --- a/Documentation/filesystems/ext3.txt +++ b/Documentation/filesystems/ext3.txt | |||
| @@ -123,10 +123,18 @@ resuid=n The user ID which may use the reserved blocks. | |||
| 123 | 123 | ||
| 124 | sb=n Use alternate superblock at this location. | 124 | sb=n Use alternate superblock at this location. |
| 125 | 125 | ||
| 126 | quota | 126 | quota These options are ignored by the filesystem. They |
| 127 | noquota | 127 | noquota are used only by quota tools to recognize volumes |
| 128 | grpquota | 128 | grpquota where quota should be turned on. See documentation |
| 129 | usrquota | 129 | usrquota in the quota-tools package for more details |
| 130 | (http://sourceforge.net/projects/linuxquota). | ||
| 131 | |||
| 132 | jqfmt=<quota type> These options tell filesystem details about quota | ||
| 133 | usrjquota=<file> so that quota information can be properly updated | ||
| 134 | grpjquota=<file> during journal replay. They replace the above | ||
| 135 | quota options. See documentation in the quota-tools | ||
| 136 | package for more details | ||
| 137 | (http://sourceforge.net/projects/linuxquota). | ||
| 130 | 138 | ||
| 131 | bh (*) ext3 associates buffer heads to data pages to | 139 | bh (*) ext3 associates buffer heads to data pages to |
| 132 | nobh (a) cache disk block mapping information | 140 | nobh (a) cache disk block mapping information |
diff --git a/Documentation/flexible-arrays.txt b/Documentation/flexible-arrays.txt index 84eb26808dee..cb8a3a00cc92 100644 --- a/Documentation/flexible-arrays.txt +++ b/Documentation/flexible-arrays.txt | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | Using flexible arrays in the kernel | 1 | Using flexible arrays in the kernel |
| 2 | Last updated for 2.6.31 | 2 | Last updated for 2.6.32 |
| 3 | Jonathan Corbet <corbet@lwn.net> | 3 | Jonathan Corbet <corbet@lwn.net> |
| 4 | 4 | ||
| 5 | Large contiguous memory allocations can be unreliable in the Linux kernel. | 5 | Large contiguous memory allocations can be unreliable in the Linux kernel. |
| @@ -40,6 +40,13 @@ argument is passed directly to the internal memory allocation calls. With | |||
| 40 | the current code, using flags to ask for high memory is likely to lead to | 40 | the current code, using flags to ask for high memory is likely to lead to |
| 41 | notably unpleasant side effects. | 41 | notably unpleasant side effects. |
| 42 | 42 | ||
| 43 | It is also possible to define flexible arrays at compile time with: | ||
| 44 | |||
| 45 | DEFINE_FLEX_ARRAY(name, element_size, total); | ||
| 46 | |||
| 47 | This macro will result in a definition of an array with the given name; the | ||
| 48 | element size and total will be checked for validity at compile time. | ||
| 49 | |||
| 43 | Storing data into a flexible array is accomplished with a call to: | 50 | Storing data into a flexible array is accomplished with a call to: |
| 44 | 51 | ||
| 45 | int flex_array_put(struct flex_array *array, unsigned int element_nr, | 52 | int flex_array_put(struct flex_array *array, unsigned int element_nr, |
| @@ -76,16 +83,30 @@ particular element has never been allocated. | |||
| 76 | Note that it is possible to get back a valid pointer for an element which | 83 | Note that it is possible to get back a valid pointer for an element which |
| 77 | has never been stored in the array. Memory for array elements is allocated | 84 | has never been stored in the array. Memory for array elements is allocated |
| 78 | one page at a time; a single allocation could provide memory for several | 85 | one page at a time; a single allocation could provide memory for several |
| 79 | adjacent elements. The flexible array code does not know if a specific | 86 | adjacent elements. Flexible array elements are normally initialized to the |
| 80 | element has been written; it only knows if the associated memory is | 87 | value FLEX_ARRAY_FREE (defined as 0x6c in <linux/poison.h>), so errors |
| 81 | present. So a flex_array_get() call on an element which was never stored | 88 | involving that number probably result from use of unstored array entries. |
| 82 | in the array has the potential to return a pointer to random data. If the | 89 | Note that, if array elements are allocated with __GFP_ZERO, they will be |
| 83 | caller does not have a separate way to know which elements were actually | 90 | initialized to zero and this poisoning will not happen. |
| 84 | stored, it might be wise, at least, to add GFP_ZERO to the flags argument | 91 | |
| 85 | to ensure that all elements are zeroed. | 92 | Individual elements in the array can be cleared with: |
| 86 | 93 | ||
| 87 | There is no way to remove a single element from the array. It is possible, | 94 | int flex_array_clear(struct flex_array *array, unsigned int element_nr); |
| 88 | though, to remove all elements with a call to: | 95 | |
| 96 | This function will set the given element to FLEX_ARRAY_FREE and return | ||
| 97 | zero. If storage for the indicated element is not allocated for the array, | ||
| 98 | flex_array_clear() will return -EINVAL instead. Note that clearing an | ||
| 99 | element does not release the storage associated with it; to reduce the | ||
| 100 | allocated size of an array, call: | ||
| 101 | |||
| 102 | int flex_array_shrink(struct flex_array *array); | ||
| 103 | |||
| 104 | The return value will be the number of pages of memory actually freed. | ||
| 105 | This function works by scanning the array for pages containing nothing but | ||
| 106 | FLEX_ARRAY_FREE bytes, so (1) it can be expensive, and (2) it will not work | ||
| 107 | if the array's pages are allocated with __GFP_ZERO. | ||
| 108 | |||
| 109 | It is possible to remove all elements of an array with a call to: | ||
| 89 | 110 | ||
| 90 | void flex_array_free_parts(struct flex_array *array); | 111 | void flex_array_free_parts(struct flex_array *array); |
| 91 | 112 | ||
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index ba9373f82ab5..098de5bce00a 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
| @@ -42,7 +42,6 @@ | |||
| 42 | #include <signal.h> | 42 | #include <signal.h> |
| 43 | #include "linux/lguest_launcher.h" | 43 | #include "linux/lguest_launcher.h" |
| 44 | #include "linux/virtio_config.h" | 44 | #include "linux/virtio_config.h" |
| 45 | #include <linux/virtio_ids.h> | ||
| 46 | #include "linux/virtio_net.h" | 45 | #include "linux/virtio_net.h" |
| 47 | #include "linux/virtio_blk.h" | 46 | #include "linux/virtio_blk.h" |
| 48 | #include "linux/virtio_console.h" | 47 | #include "linux/virtio_console.h" |
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 75fddb40f416..4c7f9aee5c4e 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt | |||
| @@ -359,6 +359,7 @@ STAC9227/9228/9229/927x | |||
| 359 | 5stack-no-fp D965 5stack without front panel | 359 | 5stack-no-fp D965 5stack without front panel |
| 360 | dell-3stack Dell Dimension E520 | 360 | dell-3stack Dell Dimension E520 |
| 361 | dell-bios Fixes with Dell BIOS setup | 361 | dell-bios Fixes with Dell BIOS setup |
| 362 | volknob Fixes with volume-knob widget 0x24 | ||
| 362 | auto BIOS setup (default) | 363 | auto BIOS setup (default) |
| 363 | 364 | ||
| 364 | STAC92HD71B* | 365 | STAC92HD71B* |
diff --git a/MAINTAINERS b/MAINTAINERS index 69e31aab1308..88241154f4ce 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -577,6 +577,11 @@ M: Mike Rapoport <mike@compulab.co.il> | |||
| 577 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 577 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 578 | S: Maintained | 578 | S: Maintained |
| 579 | 579 | ||
| 580 | ARM/CONTEC MICRO9 MACHINE SUPPORT | ||
| 581 | M: Hubert Feurstein <hubert.feurstein@contec.at> | ||
| 582 | S: Maintained | ||
| 583 | F: arch/arm/mach-ep93xx/micro9.c | ||
| 584 | |||
| 580 | ARM/CORGI MACHINE SUPPORT | 585 | ARM/CORGI MACHINE SUPPORT |
| 581 | M: Richard Purdie <rpurdie@rpsys.net> | 586 | M: Richard Purdie <rpurdie@rpsys.net> |
| 582 | S: Maintained | 587 | S: Maintained |
| @@ -2610,6 +2615,7 @@ L: linux1394-devel@lists.sourceforge.net | |||
| 2610 | W: http://www.linux1394.org/ | 2615 | W: http://www.linux1394.org/ |
| 2611 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git | 2616 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git |
| 2612 | S: Maintained | 2617 | S: Maintained |
| 2618 | F: Documentation/debugging-via-ohci1394.txt | ||
| 2613 | F: drivers/ieee1394/ | 2619 | F: drivers/ieee1394/ |
| 2614 | 2620 | ||
| 2615 | IEEE 1394 RAW I/O DRIVER | 2621 | IEEE 1394 RAW I/O DRIVER |
| @@ -3661,6 +3667,7 @@ NETWORKING [GENERAL] | |||
| 3661 | M: "David S. Miller" <davem@davemloft.net> | 3667 | M: "David S. Miller" <davem@davemloft.net> |
| 3662 | L: netdev@vger.kernel.org | 3668 | L: netdev@vger.kernel.org |
| 3663 | W: http://www.linuxfoundation.org/en/Net | 3669 | W: http://www.linuxfoundation.org/en/Net |
| 3670 | W: http://patchwork.ozlabs.org/project/netdev/list/ | ||
| 3664 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git | 3671 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git |
| 3665 | S: Maintained | 3672 | S: Maintained |
| 3666 | F: net/ | 3673 | F: net/ |
| @@ -4071,6 +4078,13 @@ M: Peter Zijlstra <a.p.zijlstra@chello.nl> | |||
| 4071 | M: Paul Mackerras <paulus@samba.org> | 4078 | M: Paul Mackerras <paulus@samba.org> |
| 4072 | M: Ingo Molnar <mingo@elte.hu> | 4079 | M: Ingo Molnar <mingo@elte.hu> |
| 4073 | S: Supported | 4080 | S: Supported |
| 4081 | F: kernel/perf_event.c | ||
| 4082 | F: include/linux/perf_event.h | ||
| 4083 | F: arch/*/*/kernel/perf_event.c | ||
| 4084 | F: arch/*/include/asm/perf_event.h | ||
| 4085 | F: arch/*/lib/perf_event.c | ||
| 4086 | F: arch/*/kernel/perf_callchain.c | ||
| 4087 | F: tools/perf/ | ||
| 4074 | 4088 | ||
| 4075 | PERSONALITY HANDLING | 4089 | PERSONALITY HANDLING |
| 4076 | M: Christoph Hellwig <hch@infradead.org> | 4090 | M: Christoph Hellwig <hch@infradead.org> |
| @@ -5651,6 +5665,13 @@ S: Maintained | |||
| 5651 | F: drivers/vlynq/vlynq.c | 5665 | F: drivers/vlynq/vlynq.c |
| 5652 | F: include/linux/vlynq.h | 5666 | F: include/linux/vlynq.h |
| 5653 | 5667 | ||
| 5668 | VMWARE VMXNET3 ETHERNET DRIVER | ||
| 5669 | M: Shreyas Bhatewara <sbhatewara@vmware.com> | ||
| 5670 | M: VMware, Inc. <pv-drivers@vmware.com> | ||
| 5671 | L: netdev@vger.kernel.org | ||
| 5672 | S: Maintained | ||
| 5673 | F: drivers/net/vmxnet3/ | ||
| 5674 | |||
| 5654 | VOLTAGE AND CURRENT REGULATOR FRAMEWORK | 5675 | VOLTAGE AND CURRENT REGULATOR FRAMEWORK |
| 5655 | M: Liam Girdwood <lrg@slimlogic.co.uk> | 5676 | M: Liam Girdwood <lrg@slimlogic.co.uk> |
| 5656 | M: Mark Brown <broonie@opensource.wolfsonmicro.com> | 5677 | M: Mark Brown <broonie@opensource.wolfsonmicro.com> |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 2 | 1 | VERSION = 2 |
| 2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
| 3 | SUBLEVEL = 32 | 3 | SUBLEVEL = 32 |
| 4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc5 |
| 5 | NAME = Man-Eating Seals of Antiquity | 5 | NAME = Man-Eating Seals of Antiquity |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
| @@ -179,46 +179,9 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | |||
| 179 | # Alternatively CROSS_COMPILE can be set in the environment. | 179 | # Alternatively CROSS_COMPILE can be set in the environment. |
| 180 | # Default value for CROSS_COMPILE is not to prefix executables | 180 | # Default value for CROSS_COMPILE is not to prefix executables |
| 181 | # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile | 181 | # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile |
| 182 | # | ||
| 183 | # To force ARCH and CROSS_COMPILE settings include kernel.* files | ||
| 184 | # in the kernel tree - do not patch this file. | ||
| 185 | export KBUILD_BUILDHOST := $(SUBARCH) | 182 | export KBUILD_BUILDHOST := $(SUBARCH) |
| 186 | 183 | ARCH ?= $(SUBARCH) | |
| 187 | # Kbuild save the ARCH and CROSS_COMPILE setting in kernel.* files. | 184 | CROSS_COMPILE ?= |
| 188 | # Restore these settings and check that user did not specify | ||
| 189 | # conflicting values. | ||
| 190 | |||
| 191 | saved_arch := $(shell cat include/generated/kernel.arch 2> /dev/null) | ||
| 192 | saved_cross := $(shell cat include/generated/kernel.cross 2> /dev/null) | ||
| 193 | |||
| 194 | ifneq ($(CROSS_COMPILE),) | ||
| 195 | ifneq ($(saved_cross),) | ||
| 196 | ifneq ($(CROSS_COMPILE),$(saved_cross)) | ||
| 197 | $(error CROSS_COMPILE changed from \ | ||
| 198 | "$(saved_cross)" to \ | ||
| 199 | to "$(CROSS_COMPILE)". \ | ||
| 200 | Use "make mrproper" to fix it up) | ||
| 201 | endif | ||
| 202 | endif | ||
| 203 | else | ||
| 204 | CROSS_COMPILE := $(saved_cross) | ||
| 205 | endif | ||
| 206 | |||
| 207 | ifneq ($(ARCH),) | ||
| 208 | ifneq ($(saved_arch),) | ||
| 209 | ifneq ($(saved_arch),$(ARCH)) | ||
| 210 | $(error ARCH changed from \ | ||
| 211 | "$(saved_arch)" to "$(ARCH)". \ | ||
| 212 | Use "make mrproper" to fix it up) | ||
| 213 | endif | ||
| 214 | endif | ||
| 215 | else | ||
| 216 | ifneq ($(saved_arch),) | ||
| 217 | ARCH := $(saved_arch) | ||
| 218 | else | ||
| 219 | ARCH := $(SUBARCH) | ||
| 220 | endif | ||
| 221 | endif | ||
| 222 | 185 | ||
| 223 | # Architecture as present in compile.h | 186 | # Architecture as present in compile.h |
| 224 | UTS_MACHINE := $(ARCH) | 187 | UTS_MACHINE := $(ARCH) |
| @@ -483,11 +446,6 @@ ifeq ($(config-targets),1) | |||
| 483 | include $(srctree)/arch/$(SRCARCH)/Makefile | 446 | include $(srctree)/arch/$(SRCARCH)/Makefile |
| 484 | export KBUILD_DEFCONFIG KBUILD_KCONFIG | 447 | export KBUILD_DEFCONFIG KBUILD_KCONFIG |
| 485 | 448 | ||
| 486 | # save ARCH & CROSS_COMPILE settings | ||
| 487 | $(shell mkdir -p include/generated && \ | ||
| 488 | echo $(ARCH) > include/generated/kernel.arch && \ | ||
| 489 | echo $(CROSS_COMPILE) > include/generated/kernel.cross) | ||
| 490 | |||
| 491 | config: scripts_basic outputmakefile FORCE | 449 | config: scripts_basic outputmakefile FORCE |
| 492 | $(Q)mkdir -p include/linux include/config | 450 | $(Q)mkdir -p include/linux include/config |
| 493 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 451 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
diff --git a/arch/arm/configs/omap3_beagle_defconfig b/arch/arm/configs/omap3_beagle_defconfig index 357d4021e2d0..b3c8cce0f8fb 100644 --- a/arch/arm/configs/omap3_beagle_defconfig +++ b/arch/arm/configs/omap3_beagle_defconfig | |||
| @@ -969,7 +969,6 @@ CONFIG_USB_ETH_RNDIS=y | |||
| 969 | # | 969 | # |
| 970 | CONFIG_USB_OTG_UTILS=y | 970 | CONFIG_USB_OTG_UTILS=y |
| 971 | # CONFIG_USB_GPIO_VBUS is not set | 971 | # CONFIG_USB_GPIO_VBUS is not set |
| 972 | # CONFIG_ISP1301_OMAP is not set | ||
| 973 | CONFIG_TWL4030_USB=y | 972 | CONFIG_TWL4030_USB=y |
| 974 | # CONFIG_NOP_USB_XCEIV is not set | 973 | # CONFIG_NOP_USB_XCEIV is not set |
| 975 | CONFIG_MMC=y | 974 | CONFIG_MMC=y |
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index 63a481fbbed4..338ff19ae447 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h | |||
| @@ -84,7 +84,7 @@ ____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p) | |||
| 84 | *p = res | mask; | 84 | *p = res | mask; |
| 85 | raw_local_irq_restore(flags); | 85 | raw_local_irq_restore(flags); |
| 86 | 86 | ||
| 87 | return res & mask; | 87 | return (res & mask) != 0; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | static inline int | 90 | static inline int |
| @@ -101,7 +101,7 @@ ____atomic_test_and_clear_bit(unsigned int bit, volatile unsigned long *p) | |||
| 101 | *p = res & ~mask; | 101 | *p = res & ~mask; |
| 102 | raw_local_irq_restore(flags); | 102 | raw_local_irq_restore(flags); |
| 103 | 103 | ||
| 104 | return res & mask; | 104 | return (res & mask) != 0; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | static inline int | 107 | static inline int |
| @@ -118,7 +118,7 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p) | |||
| 118 | *p = res ^ mask; | 118 | *p = res ^ mask; |
| 119 | raw_local_irq_restore(flags); | 119 | raw_local_irq_restore(flags); |
| 120 | 120 | ||
| 121 | return res & mask; | 121 | return (res & mask) != 0; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | #include <asm-generic/bitops/non-atomic.h> | 124 | #include <asm-generic/bitops/non-atomic.h> |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 467b69ed1021..f838f36eb702 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
| @@ -45,21 +45,21 @@ static int __init user_debug_setup(char *str) | |||
| 45 | __setup("user_debug=", user_debug_setup); | 45 | __setup("user_debug=", user_debug_setup); |
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| 48 | static void dump_mem(const char *str, unsigned long bottom, unsigned long top); | 48 | static void dump_mem(const char *, const char *, unsigned long, unsigned long); |
| 49 | 49 | ||
| 50 | void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame) | 50 | void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame) |
| 51 | { | 51 | { |
| 52 | #ifdef CONFIG_KALLSYMS | 52 | #ifdef CONFIG_KALLSYMS |
| 53 | printk("[<%08lx>] ", where); | 53 | char sym1[KSYM_SYMBOL_LEN], sym2[KSYM_SYMBOL_LEN]; |
| 54 | print_symbol("(%s) ", where); | 54 | sprint_symbol(sym1, where); |
| 55 | printk("from [<%08lx>] ", from); | 55 | sprint_symbol(sym2, from); |
| 56 | print_symbol("(%s)\n", from); | 56 | printk("[<%08lx>] (%s) from [<%08lx>] (%s)\n", where, sym1, from, sym2); |
| 57 | #else | 57 | #else |
| 58 | printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from); | 58 | printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from); |
| 59 | #endif | 59 | #endif |
| 60 | 60 | ||
| 61 | if (in_exception_text(where)) | 61 | if (in_exception_text(where)) |
| 62 | dump_mem("Exception stack", frame + 4, frame + 4 + sizeof(struct pt_regs)); | 62 | dump_mem("", "Exception stack", frame + 4, frame + 4 + sizeof(struct pt_regs)); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | #ifndef CONFIG_ARM_UNWIND | 65 | #ifndef CONFIG_ARM_UNWIND |
| @@ -81,9 +81,10 @@ static int verify_stack(unsigned long sp) | |||
| 81 | /* | 81 | /* |
| 82 | * Dump out the contents of some memory nicely... | 82 | * Dump out the contents of some memory nicely... |
| 83 | */ | 83 | */ |
| 84 | static void dump_mem(const char *str, unsigned long bottom, unsigned long top) | 84 | static void dump_mem(const char *lvl, const char *str, unsigned long bottom, |
| 85 | unsigned long top) | ||
| 85 | { | 86 | { |
| 86 | unsigned long p = bottom & ~31; | 87 | unsigned long first; |
| 87 | mm_segment_t fs; | 88 | mm_segment_t fs; |
| 88 | int i; | 89 | int i; |
| 89 | 90 | ||
| @@ -95,33 +96,37 @@ static void dump_mem(const char *str, unsigned long bottom, unsigned long top) | |||
| 95 | fs = get_fs(); | 96 | fs = get_fs(); |
| 96 | set_fs(KERNEL_DS); | 97 | set_fs(KERNEL_DS); |
| 97 | 98 | ||
| 98 | printk("%s(0x%08lx to 0x%08lx)\n", str, bottom, top); | 99 | printk("%s%s(0x%08lx to 0x%08lx)\n", lvl, str, bottom, top); |
| 99 | 100 | ||
| 100 | for (p = bottom & ~31; p < top;) { | 101 | for (first = bottom & ~31; first < top; first += 32) { |
| 101 | printk("%04lx: ", p & 0xffff); | 102 | unsigned long p; |
| 103 | char str[sizeof(" 12345678") * 8 + 1]; | ||
| 102 | 104 | ||
| 103 | for (i = 0; i < 8; i++, p += 4) { | 105 | memset(str, ' ', sizeof(str)); |
| 104 | unsigned int val; | 106 | str[sizeof(str) - 1] = '\0'; |
| 105 | 107 | ||
| 106 | if (p < bottom || p >= top) | 108 | for (p = first, i = 0; i < 8 && p < top; i++, p += 4) { |
| 107 | printk(" "); | 109 | if (p >= bottom && p < top) { |
| 108 | else { | 110 | unsigned long val; |
| 109 | __get_user(val, (unsigned long *)p); | 111 | if (__get_user(val, (unsigned long *)p) == 0) |
| 110 | printk("%08x ", val); | 112 | sprintf(str + i * 9, " %08lx", val); |
| 113 | else | ||
| 114 | sprintf(str + i * 9, " ????????"); | ||
| 111 | } | 115 | } |
| 112 | } | 116 | } |
| 113 | printk ("\n"); | 117 | printk("%s%04lx:%s\n", lvl, first & 0xffff, str); |
| 114 | } | 118 | } |
| 115 | 119 | ||
| 116 | set_fs(fs); | 120 | set_fs(fs); |
| 117 | } | 121 | } |
| 118 | 122 | ||
| 119 | static void dump_instr(struct pt_regs *regs) | 123 | static void dump_instr(const char *lvl, struct pt_regs *regs) |
| 120 | { | 124 | { |
| 121 | unsigned long addr = instruction_pointer(regs); | 125 | unsigned long addr = instruction_pointer(regs); |
| 122 | const int thumb = thumb_mode(regs); | 126 | const int thumb = thumb_mode(regs); |
| 123 | const int width = thumb ? 4 : 8; | 127 | const int width = thumb ? 4 : 8; |
| 124 | mm_segment_t fs; | 128 | mm_segment_t fs; |
| 129 | char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str; | ||
| 125 | int i; | 130 | int i; |
| 126 | 131 | ||
| 127 | /* | 132 | /* |
| @@ -132,7 +137,6 @@ static void dump_instr(struct pt_regs *regs) | |||
| 132 | fs = get_fs(); | 137 | fs = get_fs(); |
| 133 | set_fs(KERNEL_DS); | 138 | set_fs(KERNEL_DS); |
| 134 | 139 | ||
| 135 | printk("Code: "); | ||
| 136 | for (i = -4; i < 1; i++) { | 140 | for (i = -4; i < 1; i++) { |
| 137 | unsigned int val, bad; | 141 | unsigned int val, bad; |
| 138 | 142 | ||
| @@ -142,13 +146,14 @@ static void dump_instr(struct pt_regs *regs) | |||
| 142 | bad = __get_user(val, &((u32 *)addr)[i]); | 146 | bad = __get_user(val, &((u32 *)addr)[i]); |
| 143 | 147 | ||
| 144 | if (!bad) | 148 | if (!bad) |
| 145 | printk(i == 0 ? "(%0*x) " : "%0*x ", width, val); | 149 | p += sprintf(p, i == 0 ? "(%0*x) " : "%0*x ", |
| 150 | width, val); | ||
| 146 | else { | 151 | else { |
| 147 | printk("bad PC value."); | 152 | p += sprintf(p, "bad PC value"); |
| 148 | break; | 153 | break; |
| 149 | } | 154 | } |
| 150 | } | 155 | } |
| 151 | printk("\n"); | 156 | printk("%sCode: %s\n", lvl, str); |
| 152 | 157 | ||
| 153 | set_fs(fs); | 158 | set_fs(fs); |
| 154 | } | 159 | } |
| @@ -224,18 +229,19 @@ static void __die(const char *str, int err, struct thread_info *thread, struct p | |||
| 224 | struct task_struct *tsk = thread->task; | 229 | struct task_struct *tsk = thread->task; |
| 225 | static int die_counter; | 230 | static int die_counter; |
| 226 | 231 | ||
| 227 | printk("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n", | 232 | printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n", |
| 228 | str, err, ++die_counter); | 233 | str, err, ++die_counter); |
| 234 | sysfs_printk_last_file(); | ||
| 229 | print_modules(); | 235 | print_modules(); |
| 230 | __show_regs(regs); | 236 | __show_regs(regs); |
| 231 | printk("Process %s (pid: %d, stack limit = 0x%p)\n", | 237 | printk(KERN_EMERG "Process %.*s (pid: %d, stack limit = 0x%p)\n", |
| 232 | tsk->comm, task_pid_nr(tsk), thread + 1); | 238 | TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), thread + 1); |
| 233 | 239 | ||
| 234 | if (!user_mode(regs) || in_interrupt()) { | 240 | if (!user_mode(regs) || in_interrupt()) { |
| 235 | dump_mem("Stack: ", regs->ARM_sp, | 241 | dump_mem(KERN_EMERG, "Stack: ", regs->ARM_sp, |
| 236 | THREAD_SIZE + (unsigned long)task_stack_page(tsk)); | 242 | THREAD_SIZE + (unsigned long)task_stack_page(tsk)); |
| 237 | dump_backtrace(regs, tsk); | 243 | dump_backtrace(regs, tsk); |
| 238 | dump_instr(regs); | 244 | dump_instr(KERN_EMERG, regs); |
| 239 | } | 245 | } |
| 240 | } | 246 | } |
| 241 | 247 | ||
| @@ -250,13 +256,14 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err) | |||
| 250 | 256 | ||
| 251 | oops_enter(); | 257 | oops_enter(); |
| 252 | 258 | ||
| 253 | console_verbose(); | ||
| 254 | spin_lock_irq(&die_lock); | 259 | spin_lock_irq(&die_lock); |
| 260 | console_verbose(); | ||
| 255 | bust_spinlocks(1); | 261 | bust_spinlocks(1); |
| 256 | __die(str, err, thread, regs); | 262 | __die(str, err, thread, regs); |
| 257 | bust_spinlocks(0); | 263 | bust_spinlocks(0); |
| 258 | add_taint(TAINT_DIE); | 264 | add_taint(TAINT_DIE); |
| 259 | spin_unlock_irq(&die_lock); | 265 | spin_unlock_irq(&die_lock); |
| 266 | oops_exit(); | ||
| 260 | 267 | ||
| 261 | if (in_interrupt()) | 268 | if (in_interrupt()) |
| 262 | panic("Fatal exception in interrupt"); | 269 | panic("Fatal exception in interrupt"); |
| @@ -264,7 +271,6 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err) | |||
| 264 | if (panic_on_oops) | 271 | if (panic_on_oops) |
| 265 | panic("Fatal exception"); | 272 | panic("Fatal exception"); |
| 266 | 273 | ||
| 267 | oops_exit(); | ||
| 268 | do_exit(SIGSEGV); | 274 | do_exit(SIGSEGV); |
| 269 | } | 275 | } |
| 270 | 276 | ||
| @@ -349,7 +355,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) | |||
| 349 | if (user_debug & UDBG_UNDEFINED) { | 355 | if (user_debug & UDBG_UNDEFINED) { |
| 350 | printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", | 356 | printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", |
| 351 | current->comm, task_pid_nr(current), pc); | 357 | current->comm, task_pid_nr(current), pc); |
| 352 | dump_instr(regs); | 358 | dump_instr(KERN_INFO, regs); |
| 353 | } | 359 | } |
| 354 | #endif | 360 | #endif |
| 355 | 361 | ||
| @@ -400,7 +406,7 @@ static int bad_syscall(int n, struct pt_regs *regs) | |||
| 400 | if (user_debug & UDBG_SYSCALL) { | 406 | if (user_debug & UDBG_SYSCALL) { |
| 401 | printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n", | 407 | printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n", |
| 402 | task_pid_nr(current), current->comm, n); | 408 | task_pid_nr(current), current->comm, n); |
| 403 | dump_instr(regs); | 409 | dump_instr(KERN_ERR, regs); |
| 404 | } | 410 | } |
| 405 | #endif | 411 | #endif |
| 406 | 412 | ||
| @@ -579,7 +585,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) | |||
| 579 | if (user_debug & UDBG_SYSCALL) { | 585 | if (user_debug & UDBG_SYSCALL) { |
| 580 | printk("[%d] %s: arm syscall %d\n", | 586 | printk("[%d] %s: arm syscall %d\n", |
| 581 | task_pid_nr(current), current->comm, no); | 587 | task_pid_nr(current), current->comm, no); |
| 582 | dump_instr(regs); | 588 | dump_instr("", regs); |
| 583 | if (user_mode(regs)) { | 589 | if (user_mode(regs)) { |
| 584 | __show_regs(regs); | 590 | __show_regs(regs); |
| 585 | c_backtrace(regs->ARM_fp, processor_mode(regs)); | 591 | c_backtrace(regs->ARM_fp, processor_mode(regs)); |
| @@ -656,7 +662,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs) | |||
| 656 | if (user_debug & UDBG_BADABORT) { | 662 | if (user_debug & UDBG_BADABORT) { |
| 657 | printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n", | 663 | printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n", |
| 658 | task_pid_nr(current), current->comm, code, instr); | 664 | task_pid_nr(current), current->comm, code, instr); |
| 659 | dump_instr(regs); | 665 | dump_instr(KERN_ERR, regs); |
| 660 | show_pte(current->mm, addr); | 666 | show_pte(current->mm, addr); |
| 661 | } | 667 | } |
| 662 | #endif | 668 | #endif |
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c index 4b4f69251b31..e590bbe0a7b4 100644 --- a/arch/arm/mach-bcmring/core.c +++ b/arch/arm/mach-bcmring/core.c | |||
| @@ -271,12 +271,12 @@ static struct irqaction bcmring_timer_irq = { | |||
| 271 | .handler = bcmring_timer_interrupt, | 271 | .handler = bcmring_timer_interrupt, |
| 272 | }; | 272 | }; |
| 273 | 273 | ||
| 274 | static cycle_t bcmring_get_cycles_timer1(void) | 274 | static cycle_t bcmring_get_cycles_timer1(struct clocksource *cs) |
| 275 | { | 275 | { |
| 276 | return ~readl(TIMER1_VA_BASE + TIMER_VALUE); | 276 | return ~readl(TIMER1_VA_BASE + TIMER_VALUE); |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | static cycle_t bcmring_get_cycles_timer3(void) | 279 | static cycle_t bcmring_get_cycles_timer3(struct clocksource *cs) |
| 280 | { | 280 | { |
| 281 | return ~readl(TIMER3_VA_BASE + TIMER_VALUE); | 281 | return ~readl(TIMER3_VA_BASE + TIMER_VALUE); |
| 282 | } | 282 | } |
diff --git a/arch/arm/mach-bcmring/include/mach/system.h b/arch/arm/mach-bcmring/include/mach/system.h index cdbf93c694a6..38b37060d426 100644 --- a/arch/arm/mach-bcmring/include/mach/system.h +++ b/arch/arm/mach-bcmring/include/mach/system.h | |||
| @@ -29,7 +29,7 @@ static inline void arch_idle(void) | |||
| 29 | cpu_do_idle(); | 29 | cpu_do_idle(); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | static inline void arch_reset(char mode, char *cmd) | 32 | static inline void arch_reset(char mode, const char *cmd) |
| 33 | { | 33 | { |
| 34 | printk("arch_reset:%c %x\n", mode, bcmring_arch_warm_reboot); | 34 | printk("arch_reset:%c %x\n", mode, bcmring_arch_warm_reboot); |
| 35 | 35 | ||
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig index d7291c682a64..9167c3d2a5ed 100644 --- a/arch/arm/mach-ep93xx/Kconfig +++ b/arch/arm/mach-ep93xx/Kconfig | |||
| @@ -17,13 +17,31 @@ config EP93XX_SDCE3_SYNC_PHYS_OFFSET | |||
| 17 | bool "0x00000000 - SDCE3/SyncBoot" | 17 | bool "0x00000000 - SDCE3/SyncBoot" |
| 18 | help | 18 | help |
| 19 | Select this option if you want support for EP93xx boards with the | 19 | Select this option if you want support for EP93xx boards with the |
| 20 | first SDRAM bank at 0x00000000 | 20 | first SDRAM bank at 0x00000000. |
| 21 | 21 | ||
| 22 | config EP93XX_SDCE0_PHYS_OFFSET | 22 | config EP93XX_SDCE0_PHYS_OFFSET |
| 23 | bool "0xc0000000 - SDCEO" | 23 | bool "0xc0000000 - SDCEO" |
| 24 | help | 24 | help |
| 25 | Select this option if you want support for EP93xx boards with the | 25 | Select this option if you want support for EP93xx boards with the |
| 26 | first SDRAM bank at 0xc0000000 | 26 | first SDRAM bank at 0xc0000000. |
| 27 | |||
| 28 | config EP93XX_SDCE1_PHYS_OFFSET | ||
| 29 | bool "0xd0000000 - SDCE1" | ||
| 30 | help | ||
| 31 | Select this option if you want support for EP93xx boards with the | ||
| 32 | first SDRAM bank at 0xd0000000. | ||
| 33 | |||
| 34 | config EP93XX_SDCE2_PHYS_OFFSET | ||
| 35 | bool "0xe0000000 - SDCE2" | ||
| 36 | help | ||
| 37 | Select this option if you want support for EP93xx boards with the | ||
| 38 | first SDRAM bank at 0xe0000000. | ||
| 39 | |||
| 40 | config EP93XX_SDCE3_ASYNC_PHYS_OFFSET | ||
| 41 | bool "0xf0000000 - SDCE3/AsyncBoot" | ||
| 42 | help | ||
| 43 | Select this option if you want support for EP93xx boards with the | ||
| 44 | first SDRAM bank at 0xf0000000. | ||
| 27 | 45 | ||
| 28 | endchoice | 46 | endchoice |
| 29 | 47 | ||
| @@ -112,28 +130,36 @@ config MACH_MICRO9 | |||
| 112 | bool | 130 | bool |
| 113 | 131 | ||
| 114 | config MACH_MICRO9H | 132 | config MACH_MICRO9H |
| 115 | bool "Support Contec Hypercontrol Micro9-H" | 133 | bool "Support Contec Micro9-High" |
| 116 | depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET | 134 | depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET |
| 117 | select MACH_MICRO9 | 135 | select MACH_MICRO9 |
| 118 | help | 136 | help |
| 119 | Say 'Y' here if you want your kernel to support the | 137 | Say 'Y' here if you want your kernel to support the |
| 120 | Contec Hypercontrol Micro9-H board. | 138 | Contec Micro9-High board. |
| 121 | 139 | ||
| 122 | config MACH_MICRO9M | 140 | config MACH_MICRO9M |
| 123 | bool "Support Contec Hypercontrol Micro9-M" | 141 | bool "Support Contec Micro9-Mid" |
| 124 | depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET | 142 | depends on EP93XX_SDCE3_ASYNC_PHYS_OFFSET |
| 125 | select MACH_MICRO9 | 143 | select MACH_MICRO9 |
| 126 | help | 144 | help |
| 127 | Say 'Y' here if you want your kernel to support the | 145 | Say 'Y' here if you want your kernel to support the |
| 128 | Contec Hypercontrol Micro9-M board. | 146 | Contec Micro9-Mid board. |
| 129 | 147 | ||
| 130 | config MACH_MICRO9L | 148 | config MACH_MICRO9L |
| 131 | bool "Support Contec Hypercontrol Micro9-L" | 149 | bool "Support Contec Micro9-Lite" |
| 132 | depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET | 150 | depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET |
| 133 | select MACH_MICRO9 | 151 | select MACH_MICRO9 |
| 134 | help | 152 | help |
| 135 | Say 'Y' here if you want your kernel to support the | 153 | Say 'Y' here if you want your kernel to support the |
| 136 | Contec Hypercontrol Micro9-L board. | 154 | Contec Micro9-Lite board. |
| 155 | |||
| 156 | config MACH_MICRO9S | ||
| 157 | bool "Support Contec Micro9-Slim" | ||
| 158 | depends on EP93XX_SDCE3_ASYNC_PHYS_OFFSET | ||
| 159 | select MACH_MICRO9 | ||
| 160 | help | ||
| 161 | Say 'Y' here if you want your kernel to support the | ||
| 162 | Contec Micro9-Slim board. | ||
| 137 | 163 | ||
| 138 | config MACH_TS72XX | 164 | config MACH_TS72XX |
| 139 | bool "Support Technologic Systems TS-72xx SBC" | 165 | bool "Support Technologic Systems TS-72xx SBC" |
diff --git a/arch/arm/mach-ep93xx/Makefile.boot b/arch/arm/mach-ep93xx/Makefile.boot index 27a085a8f12a..0ad33f15c622 100644 --- a/arch/arm/mach-ep93xx/Makefile.boot +++ b/arch/arm/mach-ep93xx/Makefile.boot | |||
| @@ -3,3 +3,12 @@ params_phys-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) := 0x00000100 | |||
| 3 | 3 | ||
| 4 | zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0008000 | 4 | zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0008000 |
| 5 | params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100 | 5 | params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100 |
| 6 | |||
| 7 | zreladdr-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0008000 | ||
| 8 | params_phys-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0000100 | ||
| 9 | |||
| 10 | zreladdr-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0008000 | ||
| 11 | params_phys-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0000100 | ||
| 12 | |||
| 13 | zreladdr-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0008000 | ||
| 14 | params_phys-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0000100 | ||
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c index dda19cd76194..1d0f9d8aff2e 100644 --- a/arch/arm/mach-ep93xx/clock.c +++ b/arch/arm/mach-ep93xx/clock.c | |||
| @@ -16,13 +16,16 @@ | |||
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
| 18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
| 19 | #include <linux/spinlock.h> | ||
| 20 | |||
| 21 | #include <mach/hardware.h> | ||
| 19 | 22 | ||
| 20 | #include <asm/clkdev.h> | 23 | #include <asm/clkdev.h> |
| 21 | #include <asm/div64.h> | 24 | #include <asm/div64.h> |
| 22 | #include <mach/hardware.h> | ||
| 23 | 25 | ||
| 24 | 26 | ||
| 25 | struct clk { | 27 | struct clk { |
| 28 | struct clk *parent; | ||
| 26 | unsigned long rate; | 29 | unsigned long rate; |
| 27 | int users; | 30 | int users; |
| 28 | int sw_locked; | 31 | int sw_locked; |
| @@ -39,40 +42,60 @@ static unsigned long get_uart_rate(struct clk *clk); | |||
| 39 | static int set_keytchclk_rate(struct clk *clk, unsigned long rate); | 42 | static int set_keytchclk_rate(struct clk *clk, unsigned long rate); |
| 40 | static int set_div_rate(struct clk *clk, unsigned long rate); | 43 | static int set_div_rate(struct clk *clk, unsigned long rate); |
| 41 | 44 | ||
| 45 | |||
| 46 | static struct clk clk_xtali = { | ||
| 47 | .rate = EP93XX_EXT_CLK_RATE, | ||
| 48 | }; | ||
| 42 | static struct clk clk_uart1 = { | 49 | static struct clk clk_uart1 = { |
| 50 | .parent = &clk_xtali, | ||
| 43 | .sw_locked = 1, | 51 | .sw_locked = 1, |
| 44 | .enable_reg = EP93XX_SYSCON_DEVCFG, | 52 | .enable_reg = EP93XX_SYSCON_DEVCFG, |
| 45 | .enable_mask = EP93XX_SYSCON_DEVCFG_U1EN, | 53 | .enable_mask = EP93XX_SYSCON_DEVCFG_U1EN, |
| 46 | .get_rate = get_uart_rate, | 54 | .get_rate = get_uart_rate, |
| 47 | }; | 55 | }; |
| 48 | static struct clk clk_uart2 = { | 56 | static struct clk clk_uart2 = { |
| 57 | .parent = &clk_xtali, | ||
| 49 | .sw_locked = 1, | 58 | .sw_locked = 1, |
| 50 | .enable_reg = EP93XX_SYSCON_DEVCFG, | 59 | .enable_reg = EP93XX_SYSCON_DEVCFG, |
| 51 | .enable_mask = EP93XX_SYSCON_DEVCFG_U2EN, | 60 | .enable_mask = EP93XX_SYSCON_DEVCFG_U2EN, |
| 52 | .get_rate = get_uart_rate, | 61 | .get_rate = get_uart_rate, |
| 53 | }; | 62 | }; |
| 54 | static struct clk clk_uart3 = { | 63 | static struct clk clk_uart3 = { |
| 64 | .parent = &clk_xtali, | ||
| 55 | .sw_locked = 1, | 65 | .sw_locked = 1, |
| 56 | .enable_reg = EP93XX_SYSCON_DEVCFG, | 66 | .enable_reg = EP93XX_SYSCON_DEVCFG, |
| 57 | .enable_mask = EP93XX_SYSCON_DEVCFG_U3EN, | 67 | .enable_mask = EP93XX_SYSCON_DEVCFG_U3EN, |
| 58 | .get_rate = get_uart_rate, | 68 | .get_rate = get_uart_rate, |
| 59 | }; | 69 | }; |
| 60 | static struct clk clk_pll1; | 70 | static struct clk clk_pll1 = { |
| 61 | static struct clk clk_f; | 71 | .parent = &clk_xtali, |
| 62 | static struct clk clk_h; | 72 | }; |
| 63 | static struct clk clk_p; | 73 | static struct clk clk_f = { |
| 64 | static struct clk clk_pll2; | 74 | .parent = &clk_pll1, |
| 75 | }; | ||
| 76 | static struct clk clk_h = { | ||
| 77 | .parent = &clk_pll1, | ||
| 78 | }; | ||
| 79 | static struct clk clk_p = { | ||
| 80 | .parent = &clk_pll1, | ||
| 81 | }; | ||
| 82 | static struct clk clk_pll2 = { | ||
| 83 | .parent = &clk_xtali, | ||
| 84 | }; | ||
| 65 | static struct clk clk_usb_host = { | 85 | static struct clk clk_usb_host = { |
| 86 | .parent = &clk_pll2, | ||
| 66 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 87 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 67 | .enable_mask = EP93XX_SYSCON_PWRCNT_USH_EN, | 88 | .enable_mask = EP93XX_SYSCON_PWRCNT_USH_EN, |
| 68 | }; | 89 | }; |
| 69 | static struct clk clk_keypad = { | 90 | static struct clk clk_keypad = { |
| 91 | .parent = &clk_xtali, | ||
| 70 | .sw_locked = 1, | 92 | .sw_locked = 1, |
| 71 | .enable_reg = EP93XX_SYSCON_KEYTCHCLKDIV, | 93 | .enable_reg = EP93XX_SYSCON_KEYTCHCLKDIV, |
| 72 | .enable_mask = EP93XX_SYSCON_KEYTCHCLKDIV_KEN, | 94 | .enable_mask = EP93XX_SYSCON_KEYTCHCLKDIV_KEN, |
| 73 | .set_rate = set_keytchclk_rate, | 95 | .set_rate = set_keytchclk_rate, |
| 74 | }; | 96 | }; |
| 75 | static struct clk clk_pwm = { | 97 | static struct clk clk_pwm = { |
| 98 | .parent = &clk_xtali, | ||
| 76 | .rate = EP93XX_EXT_CLK_RATE, | 99 | .rate = EP93XX_EXT_CLK_RATE, |
| 77 | }; | 100 | }; |
| 78 | 101 | ||
| @@ -85,50 +108,62 @@ static struct clk clk_video = { | |||
| 85 | 108 | ||
| 86 | /* DMA Clocks */ | 109 | /* DMA Clocks */ |
| 87 | static struct clk clk_m2p0 = { | 110 | static struct clk clk_m2p0 = { |
| 111 | .parent = &clk_h, | ||
| 88 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 112 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 89 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P0, | 113 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P0, |
| 90 | }; | 114 | }; |
| 91 | static struct clk clk_m2p1 = { | 115 | static struct clk clk_m2p1 = { |
| 116 | .parent = &clk_h, | ||
| 92 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 117 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 93 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P1, | 118 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P1, |
| 94 | }; | 119 | }; |
| 95 | static struct clk clk_m2p2 = { | 120 | static struct clk clk_m2p2 = { |
| 121 | .parent = &clk_h, | ||
| 96 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 122 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 97 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P2, | 123 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P2, |
| 98 | }; | 124 | }; |
| 99 | static struct clk clk_m2p3 = { | 125 | static struct clk clk_m2p3 = { |
| 126 | .parent = &clk_h, | ||
| 100 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 127 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 101 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P3, | 128 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P3, |
| 102 | }; | 129 | }; |
| 103 | static struct clk clk_m2p4 = { | 130 | static struct clk clk_m2p4 = { |
| 131 | .parent = &clk_h, | ||
| 104 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 132 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 105 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P4, | 133 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P4, |
| 106 | }; | 134 | }; |
| 107 | static struct clk clk_m2p5 = { | 135 | static struct clk clk_m2p5 = { |
| 136 | .parent = &clk_h, | ||
| 108 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 137 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 109 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P5, | 138 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P5, |
| 110 | }; | 139 | }; |
| 111 | static struct clk clk_m2p6 = { | 140 | static struct clk clk_m2p6 = { |
| 141 | .parent = &clk_h, | ||
| 112 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 142 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 113 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P6, | 143 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P6, |
| 114 | }; | 144 | }; |
| 115 | static struct clk clk_m2p7 = { | 145 | static struct clk clk_m2p7 = { |
| 146 | .parent = &clk_h, | ||
| 116 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 147 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 117 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P7, | 148 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P7, |
| 118 | }; | 149 | }; |
| 119 | static struct clk clk_m2p8 = { | 150 | static struct clk clk_m2p8 = { |
| 151 | .parent = &clk_h, | ||
| 120 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 152 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 121 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P8, | 153 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P8, |
| 122 | }; | 154 | }; |
| 123 | static struct clk clk_m2p9 = { | 155 | static struct clk clk_m2p9 = { |
| 156 | .parent = &clk_h, | ||
| 124 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 157 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 125 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P9, | 158 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P9, |
| 126 | }; | 159 | }; |
| 127 | static struct clk clk_m2m0 = { | 160 | static struct clk clk_m2m0 = { |
| 161 | .parent = &clk_h, | ||
| 128 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 162 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 129 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M0, | 163 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M0, |
| 130 | }; | 164 | }; |
| 131 | static struct clk clk_m2m1 = { | 165 | static struct clk clk_m2m1 = { |
| 166 | .parent = &clk_h, | ||
| 132 | .enable_reg = EP93XX_SYSCON_PWRCNT, | 167 | .enable_reg = EP93XX_SYSCON_PWRCNT, |
| 133 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M1, | 168 | .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M1, |
| 134 | }; | 169 | }; |
| @@ -137,6 +172,7 @@ static struct clk clk_m2m1 = { | |||
| 137 | { .dev_id = dev, .con_id = con, .clk = ck } | 172 | { .dev_id = dev, .con_id = con, .clk = ck } |
| 138 | 173 | ||
| 139 | static struct clk_lookup clocks[] = { | 174 | static struct clk_lookup clocks[] = { |
| 175 | INIT_CK(NULL, "xtali", &clk_xtali), | ||
| 140 | INIT_CK("apb:uart1", NULL, &clk_uart1), | 176 | INIT_CK("apb:uart1", NULL, &clk_uart1), |
| 141 | INIT_CK("apb:uart2", NULL, &clk_uart2), | 177 | INIT_CK("apb:uart2", NULL, &clk_uart2), |
| 142 | INIT_CK("apb:uart3", NULL, &clk_uart3), | 178 | INIT_CK("apb:uart3", NULL, &clk_uart3), |
| @@ -163,48 +199,84 @@ static struct clk_lookup clocks[] = { | |||
| 163 | INIT_CK(NULL, "m2m1", &clk_m2m1), | 199 | INIT_CK(NULL, "m2m1", &clk_m2m1), |
| 164 | }; | 200 | }; |
| 165 | 201 | ||
| 202 | static DEFINE_SPINLOCK(clk_lock); | ||
| 203 | |||
| 204 | static void __clk_enable(struct clk *clk) | ||
| 205 | { | ||
| 206 | if (!clk->users++) { | ||
| 207 | if (clk->parent) | ||
| 208 | __clk_enable(clk->parent); | ||
| 209 | |||
| 210 | if (clk->enable_reg) { | ||
| 211 | u32 v; | ||
| 212 | |||
| 213 | v = __raw_readl(clk->enable_reg); | ||
| 214 | v |= clk->enable_mask; | ||
| 215 | if (clk->sw_locked) | ||
| 216 | ep93xx_syscon_swlocked_write(v, clk->enable_reg); | ||
| 217 | else | ||
| 218 | __raw_writel(v, clk->enable_reg); | ||
| 219 | } | ||
| 220 | } | ||
| 221 | } | ||
| 166 | 222 | ||
| 167 | int clk_enable(struct clk *clk) | 223 | int clk_enable(struct clk *clk) |
| 168 | { | 224 | { |
| 169 | if (!clk->users++ && clk->enable_reg) { | 225 | unsigned long flags; |
| 170 | u32 value; | ||
| 171 | 226 | ||
| 172 | value = __raw_readl(clk->enable_reg); | 227 | if (!clk) |
| 173 | value |= clk->enable_mask; | 228 | return -EINVAL; |
| 174 | if (clk->sw_locked) | 229 | |
| 175 | ep93xx_syscon_swlocked_write(value, clk->enable_reg); | 230 | spin_lock_irqsave(&clk_lock, flags); |
| 176 | else | 231 | __clk_enable(clk); |
| 177 | __raw_writel(value, clk->enable_reg); | 232 | spin_unlock_irqrestore(&clk_lock, flags); |
| 178 | } | ||
| 179 | 233 | ||
| 180 | return 0; | 234 | return 0; |
| 181 | } | 235 | } |
| 182 | EXPORT_SYMBOL(clk_enable); | 236 | EXPORT_SYMBOL(clk_enable); |
| 183 | 237 | ||
| 184 | void clk_disable(struct clk *clk) | 238 | static void __clk_disable(struct clk *clk) |
| 185 | { | 239 | { |
| 186 | if (!--clk->users && clk->enable_reg) { | 240 | if (!--clk->users) { |
| 187 | u32 value; | 241 | if (clk->enable_reg) { |
| 242 | u32 v; | ||
| 243 | |||
| 244 | v = __raw_readl(clk->enable_reg); | ||
| 245 | v &= ~clk->enable_mask; | ||
| 246 | if (clk->sw_locked) | ||
| 247 | ep93xx_syscon_swlocked_write(v, clk->enable_reg); | ||
| 248 | else | ||
| 249 | __raw_writel(v, clk->enable_reg); | ||
| 250 | } | ||
| 188 | 251 | ||
| 189 | value = __raw_readl(clk->enable_reg); | 252 | if (clk->parent) |
| 190 | value &= ~clk->enable_mask; | 253 | __clk_disable(clk->parent); |
| 191 | if (clk->sw_locked) | ||
| 192 | ep93xx_syscon_swlocked_write(value, clk->enable_reg); | ||
| 193 | else | ||
| 194 | __raw_writel(value, clk->enable_reg); | ||
| 195 | } | 254 | } |
| 196 | } | 255 | } |
| 256 | |||
| 257 | void clk_disable(struct clk *clk) | ||
| 258 | { | ||
| 259 | unsigned long flags; | ||
| 260 | |||
| 261 | if (!clk) | ||
| 262 | return; | ||
| 263 | |||
| 264 | spin_lock_irqsave(&clk_lock, flags); | ||
| 265 | __clk_disable(clk); | ||
| 266 | spin_unlock_irqrestore(&clk_lock, flags); | ||
| 267 | } | ||
| 197 | EXPORT_SYMBOL(clk_disable); | 268 | EXPORT_SYMBOL(clk_disable); |
| 198 | 269 | ||
| 199 | static unsigned long get_uart_rate(struct clk *clk) | 270 | static unsigned long get_uart_rate(struct clk *clk) |
| 200 | { | 271 | { |
| 272 | unsigned long rate = clk_get_rate(clk->parent); | ||
| 201 | u32 value; | 273 | u32 value; |
| 202 | 274 | ||
| 203 | value = __raw_readl(EP93XX_SYSCON_PWRCNT); | 275 | value = __raw_readl(EP93XX_SYSCON_PWRCNT); |
| 204 | if (value & EP93XX_SYSCON_PWRCNT_UARTBAUD) | 276 | if (value & EP93XX_SYSCON_PWRCNT_UARTBAUD) |
| 205 | return EP93XX_EXT_CLK_RATE; | 277 | return rate; |
| 206 | else | 278 | else |
| 207 | return EP93XX_EXT_CLK_RATE / 2; | 279 | return rate / 2; |
| 208 | } | 280 | } |
| 209 | 281 | ||
| 210 | unsigned long clk_get_rate(struct clk *clk) | 282 | unsigned long clk_get_rate(struct clk *clk) |
| @@ -244,16 +316,16 @@ static int set_keytchclk_rate(struct clk *clk, unsigned long rate) | |||
| 244 | return 0; | 316 | return 0; |
| 245 | } | 317 | } |
| 246 | 318 | ||
| 247 | static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | 319 | static int calc_clk_div(struct clk *clk, unsigned long rate, |
| 248 | int *pdiv, int *div) | 320 | int *psel, int *esel, int *pdiv, int *div) |
| 249 | { | 321 | { |
| 250 | unsigned long max_rate, best_rate = 0, | 322 | struct clk *mclk; |
| 251 | actual_rate = 0, mclk_rate = 0, rate_err = -1; | 323 | unsigned long max_rate, actual_rate, mclk_rate, rate_err = -1; |
| 252 | int i, found = 0, __div = 0, __pdiv = 0; | 324 | int i, found = 0, __div = 0, __pdiv = 0; |
| 253 | 325 | ||
| 254 | /* Don't exceed the maximum rate */ | 326 | /* Don't exceed the maximum rate */ |
| 255 | max_rate = max(max(clk_pll1.rate / 4, clk_pll2.rate / 4), | 327 | max_rate = max(max(clk_pll1.rate / 4, clk_pll2.rate / 4), |
| 256 | (unsigned long)EP93XX_EXT_CLK_RATE / 4); | 328 | clk_xtali.rate / 4); |
| 257 | rate = min(rate, max_rate); | 329 | rate = min(rate, max_rate); |
| 258 | 330 | ||
| 259 | /* | 331 | /* |
| @@ -267,11 +339,12 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | |||
| 267 | */ | 339 | */ |
| 268 | for (i = 0; i < 3; i++) { | 340 | for (i = 0; i < 3; i++) { |
| 269 | if (i == 0) | 341 | if (i == 0) |
| 270 | mclk_rate = EP93XX_EXT_CLK_RATE * 2; | 342 | mclk = &clk_xtali; |
| 271 | else if (i == 1) | 343 | else if (i == 1) |
| 272 | mclk_rate = clk_pll1.rate * 2; | 344 | mclk = &clk_pll1; |
| 273 | else if (i == 2) | 345 | else |
| 274 | mclk_rate = clk_pll2.rate * 2; | 346 | mclk = &clk_pll2; |
| 347 | mclk_rate = mclk->rate * 2; | ||
| 275 | 348 | ||
| 276 | /* Try each predivider value */ | 349 | /* Try each predivider value */ |
| 277 | for (__pdiv = 4; __pdiv <= 6; __pdiv++) { | 350 | for (__pdiv = 4; __pdiv <= 6; __pdiv++) { |
| @@ -286,7 +359,8 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | |||
| 286 | *div = __div; | 359 | *div = __div; |
| 287 | *psel = (i == 2); | 360 | *psel = (i == 2); |
| 288 | *esel = (i != 0); | 361 | *esel = (i != 0); |
| 289 | best_rate = actual_rate; | 362 | clk->parent = mclk; |
| 363 | clk->rate = actual_rate; | ||
| 290 | rate_err = abs(actual_rate - rate); | 364 | rate_err = abs(actual_rate - rate); |
| 291 | found = 1; | 365 | found = 1; |
| 292 | } | 366 | } |
| @@ -294,21 +368,19 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, | |||
| 294 | } | 368 | } |
| 295 | 369 | ||
| 296 | if (!found) | 370 | if (!found) |
| 297 | return 0; | 371 | return -EINVAL; |
| 298 | 372 | ||
| 299 | return best_rate; | 373 | return 0; |
| 300 | } | 374 | } |
| 301 | 375 | ||
| 302 | static int set_div_rate(struct clk *clk, unsigned long rate) | 376 | static int set_div_rate(struct clk *clk, unsigned long rate) |
| 303 | { | 377 | { |
| 304 | unsigned long actual_rate; | 378 | int err, psel = 0, esel = 0, pdiv = 0, div = 0; |
| 305 | int psel = 0, esel = 0, pdiv = 0, div = 0; | ||
| 306 | u32 val; | 379 | u32 val; |
| 307 | 380 | ||
| 308 | actual_rate = calc_clk_div(rate, &psel, &esel, &pdiv, &div); | 381 | err = calc_clk_div(clk, rate, &psel, &esel, &pdiv, &div); |
| 309 | if (actual_rate == 0) | 382 | if (err) |
| 310 | return -EINVAL; | 383 | return err; |
| 311 | clk->rate = actual_rate; | ||
| 312 | 384 | ||
| 313 | /* Clear the esel, psel, pdiv and div bits */ | 385 | /* Clear the esel, psel, pdiv and div bits */ |
| 314 | val = __raw_readl(clk->enable_reg); | 386 | val = __raw_readl(clk->enable_reg); |
| @@ -344,7 +416,7 @@ static unsigned long calc_pll_rate(u32 config_word) | |||
| 344 | unsigned long long rate; | 416 | unsigned long long rate; |
| 345 | int i; | 417 | int i; |
| 346 | 418 | ||
| 347 | rate = EP93XX_EXT_CLK_RATE; | 419 | rate = clk_xtali.rate; |
| 348 | rate *= ((config_word >> 11) & 0x1f) + 1; /* X1FBD */ | 420 | rate *= ((config_word >> 11) & 0x1f) + 1; /* X1FBD */ |
| 349 | rate *= ((config_word >> 5) & 0x3f) + 1; /* X2FBD */ | 421 | rate *= ((config_word >> 5) & 0x3f) + 1; /* X2FBD */ |
| 350 | do_div(rate, (config_word & 0x1f) + 1); /* X2IPD */ | 422 | do_div(rate, (config_word & 0x1f) + 1); /* X2IPD */ |
| @@ -377,7 +449,7 @@ static int __init ep93xx_clock_init(void) | |||
| 377 | 449 | ||
| 378 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); | 450 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); |
| 379 | if (!(value & 0x00800000)) { /* PLL1 bypassed? */ | 451 | if (!(value & 0x00800000)) { /* PLL1 bypassed? */ |
| 380 | clk_pll1.rate = EP93XX_EXT_CLK_RATE; | 452 | clk_pll1.rate = clk_xtali.rate; |
| 381 | } else { | 453 | } else { |
| 382 | clk_pll1.rate = calc_pll_rate(value); | 454 | clk_pll1.rate = calc_pll_rate(value); |
| 383 | } | 455 | } |
| @@ -388,7 +460,7 @@ static int __init ep93xx_clock_init(void) | |||
| 388 | 460 | ||
| 389 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2); | 461 | value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2); |
| 390 | if (!(value & 0x00080000)) { /* PLL2 bypassed? */ | 462 | if (!(value & 0x00080000)) { /* PLL2 bypassed? */ |
| 391 | clk_pll2.rate = EP93XX_EXT_CLK_RATE; | 463 | clk_pll2.rate = clk_xtali.rate; |
| 392 | } else if (value & 0x00040000) { /* PLL2 enabled? */ | 464 | } else if (value & 0x00040000) { /* PLL2 enabled? */ |
| 393 | clk_pll2.rate = calc_pll_rate(value); | 465 | clk_pll2.rate = calc_pll_rate(value); |
| 394 | } else { | 466 | } else { |
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c index f7ebed942f66..f95dc160c34b 100644 --- a/arch/arm/mach-ep93xx/core.c +++ b/arch/arm/mach-ep93xx/core.c | |||
| @@ -550,13 +550,11 @@ void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr) | |||
| 550 | platform_device_register(&ep93xx_eth_device); | 550 | platform_device_register(&ep93xx_eth_device); |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | static struct i2c_gpio_platform_data ep93xx_i2c_data = { | 553 | |
| 554 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, | 554 | /************************************************************************* |
| 555 | .sda_is_open_drain = 0, | 555 | * EP93xx i2c peripheral handling |
| 556 | .scl_pin = EP93XX_GPIO_LINE_EECLK, | 556 | *************************************************************************/ |
| 557 | .scl_is_open_drain = 0, | 557 | static struct i2c_gpio_platform_data ep93xx_i2c_data; |
| 558 | .udelay = 2, | ||
| 559 | }; | ||
| 560 | 558 | ||
| 561 | static struct platform_device ep93xx_i2c_device = { | 559 | static struct platform_device ep93xx_i2c_device = { |
| 562 | .name = "i2c-gpio", | 560 | .name = "i2c-gpio", |
| @@ -564,8 +562,25 @@ static struct platform_device ep93xx_i2c_device = { | |||
| 564 | .dev.platform_data = &ep93xx_i2c_data, | 562 | .dev.platform_data = &ep93xx_i2c_data, |
| 565 | }; | 563 | }; |
| 566 | 564 | ||
| 567 | void __init ep93xx_register_i2c(struct i2c_board_info *devices, int num) | 565 | void __init ep93xx_register_i2c(struct i2c_gpio_platform_data *data, |
| 566 | struct i2c_board_info *devices, int num) | ||
| 568 | { | 567 | { |
| 568 | /* | ||
| 569 | * Set the EEPROM interface pin drive type control. | ||
| 570 | * Defines the driver type for the EECLK and EEDAT pins as either | ||
| 571 | * open drain, which will require an external pull-up, or a normal | ||
| 572 | * CMOS driver. | ||
| 573 | */ | ||
| 574 | if (data->sda_is_open_drain && data->sda_pin != EP93XX_GPIO_LINE_EEDAT) | ||
| 575 | pr_warning("ep93xx: sda != EEDAT, open drain has no effect\n"); | ||
| 576 | if (data->scl_is_open_drain && data->scl_pin != EP93XX_GPIO_LINE_EECLK) | ||
| 577 | pr_warning("ep93xx: scl != EECLK, open drain has no effect\n"); | ||
| 578 | |||
| 579 | __raw_writel((data->sda_is_open_drain << 1) | | ||
| 580 | (data->scl_is_open_drain << 0), | ||
| 581 | EP93XX_GPIO_EEDRIVE); | ||
| 582 | |||
| 583 | ep93xx_i2c_data = *data; | ||
| 569 | i2c_register_board_info(0, devices, num); | 584 | i2c_register_board_info(0, devices, num); |
| 570 | platform_device_register(&ep93xx_i2c_device); | 585 | platform_device_register(&ep93xx_i2c_device); |
| 571 | } | 586 | } |
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c index 73145ae5d3fa..ca71cf1a72a0 100644 --- a/arch/arm/mach-ep93xx/edb93xx.c +++ b/arch/arm/mach-ep93xx/edb93xx.c | |||
| @@ -27,8 +27,10 @@ | |||
| 27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| 28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
| 29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
| 30 | #include <linux/i2c.h> | ||
| 31 | #include <linux/mtd/physmap.h> | 30 | #include <linux/mtd/physmap.h> |
| 31 | #include <linux/gpio.h> | ||
| 32 | #include <linux/i2c.h> | ||
| 33 | #include <linux/i2c-gpio.h> | ||
| 32 | 34 | ||
| 33 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
| 34 | 36 | ||
| @@ -76,13 +78,26 @@ static struct ep93xx_eth_data edb93xx_eth_data = { | |||
| 76 | .phy_id = 1, | 78 | .phy_id = 1, |
| 77 | }; | 79 | }; |
| 78 | 80 | ||
| 79 | static struct i2c_board_info __initdata edb93xxa_i2c_data[] = { | 81 | |
| 82 | /************************************************************************* | ||
| 83 | * EDB93xx i2c peripheral handling | ||
| 84 | *************************************************************************/ | ||
| 85 | static struct i2c_gpio_platform_data edb93xx_i2c_gpio_data = { | ||
| 86 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, | ||
| 87 | .sda_is_open_drain = 0, | ||
| 88 | .scl_pin = EP93XX_GPIO_LINE_EECLK, | ||
| 89 | .scl_is_open_drain = 0, | ||
| 90 | .udelay = 0, /* default to 100 kHz */ | ||
| 91 | .timeout = 0, /* default to 100 ms */ | ||
| 92 | }; | ||
| 93 | |||
| 94 | static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = { | ||
| 80 | { | 95 | { |
| 81 | I2C_BOARD_INFO("isl1208", 0x6f), | 96 | I2C_BOARD_INFO("isl1208", 0x6f), |
| 82 | }, | 97 | }, |
| 83 | }; | 98 | }; |
| 84 | 99 | ||
| 85 | static struct i2c_board_info __initdata edb93xx_i2c_data[] = { | 100 | static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = { |
| 86 | { | 101 | { |
| 87 | I2C_BOARD_INFO("ds1337", 0x68), | 102 | I2C_BOARD_INFO("ds1337", 0x68), |
| 88 | }, | 103 | }, |
| @@ -92,12 +107,14 @@ static void __init edb93xx_register_i2c(void) | |||
| 92 | { | 107 | { |
| 93 | if (machine_is_edb9302a() || machine_is_edb9307a() || | 108 | if (machine_is_edb9302a() || machine_is_edb9307a() || |
| 94 | machine_is_edb9315a()) { | 109 | machine_is_edb9315a()) { |
| 95 | ep93xx_register_i2c(edb93xxa_i2c_data, | 110 | ep93xx_register_i2c(&edb93xx_i2c_gpio_data, |
| 96 | ARRAY_SIZE(edb93xxa_i2c_data)); | 111 | edb93xxa_i2c_board_info, |
| 112 | ARRAY_SIZE(edb93xxa_i2c_board_info)); | ||
| 97 | } else if (machine_is_edb9307() || machine_is_edb9312() || | 113 | } else if (machine_is_edb9307() || machine_is_edb9312() || |
| 98 | machine_is_edb9315()) { | 114 | machine_is_edb9315()) { |
| 99 | ep93xx_register_i2c(edb93xx_i2c_data, | 115 | ep93xx_register_i2c(&edb93xx_i2c_gpio_data |
| 100 | ARRAY_SIZE(edb93xx_i2c_data)); | 116 | edb93xx_i2c_board_info, |
| 117 | ARRAY_SIZE(edb93xx_i2c_board_info)); | ||
| 101 | } | 118 | } |
| 102 | } | 119 | } |
| 103 | 120 | ||
diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h index 0fbf87b16338..b1f937eda29c 100644 --- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | |||
| @@ -52,25 +52,27 @@ | |||
| 52 | #define EP93XX_AHB_VIRT_BASE 0xfef00000 | 52 | #define EP93XX_AHB_VIRT_BASE 0xfef00000 |
| 53 | #define EP93XX_AHB_SIZE 0x00100000 | 53 | #define EP93XX_AHB_SIZE 0x00100000 |
| 54 | 54 | ||
| 55 | #define EP93XX_AHB_PHYS(x) (EP93XX_AHB_PHYS_BASE + (x)) | ||
| 55 | #define EP93XX_AHB_IOMEM(x) IOMEM(EP93XX_AHB_VIRT_BASE + (x)) | 56 | #define EP93XX_AHB_IOMEM(x) IOMEM(EP93XX_AHB_VIRT_BASE + (x)) |
| 56 | 57 | ||
| 57 | #define EP93XX_APB_PHYS_BASE 0x80800000 | 58 | #define EP93XX_APB_PHYS_BASE 0x80800000 |
| 58 | #define EP93XX_APB_VIRT_BASE 0xfed00000 | 59 | #define EP93XX_APB_VIRT_BASE 0xfed00000 |
| 59 | #define EP93XX_APB_SIZE 0x00200000 | 60 | #define EP93XX_APB_SIZE 0x00200000 |
| 60 | 61 | ||
| 62 | #define EP93XX_APB_PHYS(x) (EP93XX_APB_PHYS_BASE + (x)) | ||
| 61 | #define EP93XX_APB_IOMEM(x) IOMEM(EP93XX_APB_VIRT_BASE + (x)) | 63 | #define EP93XX_APB_IOMEM(x) IOMEM(EP93XX_APB_VIRT_BASE + (x)) |
| 62 | 64 | ||
| 63 | 65 | ||
| 64 | /* AHB peripherals */ | 66 | /* AHB peripherals */ |
| 65 | #define EP93XX_DMA_BASE EP93XX_AHB_IOMEM(0x00000000) | 67 | #define EP93XX_DMA_BASE EP93XX_AHB_IOMEM(0x00000000) |
| 66 | 68 | ||
| 67 | #define EP93XX_ETHERNET_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00010000) | 69 | #define EP93XX_ETHERNET_PHYS_BASE EP93XX_AHB_PHYS(0x00010000) |
| 68 | #define EP93XX_ETHERNET_BASE EP93XX_AHB_IOMEM(0x00010000) | 70 | #define EP93XX_ETHERNET_BASE EP93XX_AHB_IOMEM(0x00010000) |
| 69 | 71 | ||
| 70 | #define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000) | 72 | #define EP93XX_USB_PHYS_BASE EP93XX_AHB_PHYS(0x00020000) |
| 71 | #define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000) | 73 | #define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000) |
| 72 | 74 | ||
| 73 | #define EP93XX_RASTER_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00030000) | 75 | #define EP93XX_RASTER_PHYS_BASE EP93XX_AHB_PHYS(0x00030000) |
| 74 | #define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000) | 76 | #define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000) |
| 75 | 77 | ||
| 76 | #define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000) | 78 | #define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000) |
| @@ -112,21 +114,10 @@ | |||
| 112 | 114 | ||
| 113 | #define EP93XX_GPIO_BASE EP93XX_APB_IOMEM(0x00040000) | 115 | #define EP93XX_GPIO_BASE EP93XX_APB_IOMEM(0x00040000) |
| 114 | #define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x)) | 116 | #define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x)) |
| 115 | #define EP93XX_GPIO_F_INT_TYPE1 EP93XX_GPIO_REG(0x4c) | ||
| 116 | #define EP93XX_GPIO_F_INT_TYPE2 EP93XX_GPIO_REG(0x50) | ||
| 117 | #define EP93XX_GPIO_F_INT_ACK EP93XX_GPIO_REG(0x54) | ||
| 118 | #define EP93XX_GPIO_F_INT_ENABLE EP93XX_GPIO_REG(0x58) | ||
| 119 | #define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c) | 117 | #define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c) |
| 120 | #define EP93XX_GPIO_A_INT_TYPE1 EP93XX_GPIO_REG(0x90) | ||
| 121 | #define EP93XX_GPIO_A_INT_TYPE2 EP93XX_GPIO_REG(0x94) | ||
| 122 | #define EP93XX_GPIO_A_INT_ACK EP93XX_GPIO_REG(0x98) | ||
| 123 | #define EP93XX_GPIO_A_INT_ENABLE EP93XX_GPIO_REG(0x9c) | ||
| 124 | #define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0) | 118 | #define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0) |
| 125 | #define EP93XX_GPIO_B_INT_TYPE1 EP93XX_GPIO_REG(0xac) | ||
| 126 | #define EP93XX_GPIO_B_INT_TYPE2 EP93XX_GPIO_REG(0xb0) | ||
| 127 | #define EP93XX_GPIO_B_INT_ACK EP93XX_GPIO_REG(0xb4) | ||
| 128 | #define EP93XX_GPIO_B_INT_ENABLE EP93XX_GPIO_REG(0xb8) | ||
| 129 | #define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc) | 119 | #define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc) |
| 120 | #define EP93XX_GPIO_EEDRIVE EP93XX_GPIO_REG(0xc8) | ||
| 130 | 121 | ||
| 131 | #define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000) | 122 | #define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000) |
| 132 | 123 | ||
| @@ -134,13 +125,13 @@ | |||
| 134 | 125 | ||
| 135 | #define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000) | 126 | #define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000) |
| 136 | 127 | ||
| 137 | #define EP93XX_UART1_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000c0000) | 128 | #define EP93XX_UART1_PHYS_BASE EP93XX_APB_PHYS(0x000c0000) |
| 138 | #define EP93XX_UART1_BASE EP93XX_APB_IOMEM(0x000c0000) | 129 | #define EP93XX_UART1_BASE EP93XX_APB_IOMEM(0x000c0000) |
| 139 | 130 | ||
| 140 | #define EP93XX_UART2_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000d0000) | 131 | #define EP93XX_UART2_PHYS_BASE EP93XX_APB_PHYS(0x000d0000) |
| 141 | #define EP93XX_UART2_BASE EP93XX_APB_IOMEM(0x000d0000) | 132 | #define EP93XX_UART2_BASE EP93XX_APB_IOMEM(0x000d0000) |
| 142 | 133 | ||
| 143 | #define EP93XX_UART3_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000e0000) | 134 | #define EP93XX_UART3_PHYS_BASE EP93XX_APB_PHYS(0x000e0000) |
| 144 | #define EP93XX_UART3_BASE EP93XX_APB_IOMEM(0x000e0000) | 135 | #define EP93XX_UART3_BASE EP93XX_APB_IOMEM(0x000e0000) |
| 145 | 136 | ||
| 146 | #define EP93XX_KEY_MATRIX_BASE EP93XX_APB_IOMEM(0x000f0000) | 137 | #define EP93XX_KEY_MATRIX_BASE EP93XX_APB_IOMEM(0x000f0000) |
| @@ -148,10 +139,10 @@ | |||
| 148 | #define EP93XX_ADC_BASE EP93XX_APB_IOMEM(0x00100000) | 139 | #define EP93XX_ADC_BASE EP93XX_APB_IOMEM(0x00100000) |
| 149 | #define EP93XX_TOUCHSCREEN_BASE EP93XX_APB_IOMEM(0x00100000) | 140 | #define EP93XX_TOUCHSCREEN_BASE EP93XX_APB_IOMEM(0x00100000) |
| 150 | 141 | ||
| 151 | #define EP93XX_PWM_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x00110000) | 142 | #define EP93XX_PWM_PHYS_BASE EP93XX_APB_PHYS(0x00110000) |
| 152 | #define EP93XX_PWM_BASE EP93XX_APB_IOMEM(0x00110000) | 143 | #define EP93XX_PWM_BASE EP93XX_APB_IOMEM(0x00110000) |
| 153 | 144 | ||
| 154 | #define EP93XX_RTC_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x00120000) | 145 | #define EP93XX_RTC_PHYS_BASE EP93XX_APB_PHYS(0x00120000) |
| 155 | #define EP93XX_RTC_BASE EP93XX_APB_IOMEM(0x00120000) | 146 | #define EP93XX_RTC_BASE EP93XX_APB_IOMEM(0x00120000) |
| 156 | 147 | ||
| 157 | #define EP93XX_SYSCON_BASE EP93XX_APB_IOMEM(0x00130000) | 148 | #define EP93XX_SYSCON_BASE EP93XX_APB_IOMEM(0x00130000) |
| @@ -218,6 +209,17 @@ | |||
| 218 | #define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16) | 209 | #define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16) |
| 219 | #define EP93XX_SYSCON_KEYTCHCLKDIV_KEN (1<<15) | 210 | #define EP93XX_SYSCON_KEYTCHCLKDIV_KEN (1<<15) |
| 220 | #define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV (1<<0) | 211 | #define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV (1<<0) |
| 212 | #define EP93XX_SYSCON_SYSCFG EP93XX_SYSCON_REG(0x9c) | ||
| 213 | #define EP93XX_SYSCON_SYSCFG_REV_MASK (0xf0000000) | ||
| 214 | #define EP93XX_SYSCON_SYSCFG_REV_SHIFT (28) | ||
| 215 | #define EP93XX_SYSCON_SYSCFG_SBOOT (1<<8) | ||
| 216 | #define EP93XX_SYSCON_SYSCFG_LCSN7 (1<<7) | ||
| 217 | #define EP93XX_SYSCON_SYSCFG_LCSN6 (1<<6) | ||
| 218 | #define EP93XX_SYSCON_SYSCFG_LASDO (1<<5) | ||
| 219 | #define EP93XX_SYSCON_SYSCFG_LEEDA (1<<4) | ||
| 220 | #define EP93XX_SYSCON_SYSCFG_LEECLK (1<<3) | ||
| 221 | #define EP93XX_SYSCON_SYSCFG_LCSN2 (1<<1) | ||
| 222 | #define EP93XX_SYSCON_SYSCFG_LCSN1 (1<<0) | ||
| 221 | #define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) | 223 | #define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) |
| 222 | 224 | ||
| 223 | #define EP93XX_WATCHDOG_BASE EP93XX_APB_IOMEM(0x00140000) | 225 | #define EP93XX_WATCHDOG_BASE EP93XX_APB_IOMEM(0x00140000) |
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio.h index 0a1498ae899a..c991b149bdf2 100644 --- a/arch/arm/mach-ep93xx/include/mach/gpio.h +++ b/arch/arm/mach-ep93xx/include/mach/gpio.h | |||
| @@ -114,17 +114,9 @@ extern void ep93xx_gpio_int_debounce(unsigned int irq, int enable); | |||
| 114 | * B0..B7 (7..15) to irq 72..79, and | 114 | * B0..B7 (7..15) to irq 72..79, and |
| 115 | * F0..F7 (16..24) to irq 80..87. | 115 | * F0..F7 (16..24) to irq 80..87. |
| 116 | */ | 116 | */ |
| 117 | static inline int gpio_to_irq(unsigned gpio) | 117 | #define gpio_to_irq(gpio) \ |
| 118 | { | 118 | (((gpio) <= EP93XX_GPIO_LINE_MAX_IRQ) ? (64 + (gpio)) : -EINVAL) |
| 119 | if (gpio <= EP93XX_GPIO_LINE_MAX_IRQ) | 119 | |
| 120 | return 64 + gpio; | 120 | #define irq_to_gpio(irq) ((irq) - gpio_to_irq(0)) |
| 121 | |||
| 122 | return -EINVAL; | ||
| 123 | } | ||
| 124 | |||
| 125 | static inline int irq_to_gpio(unsigned irq) | ||
| 126 | { | ||
| 127 | return irq - gpio_to_irq(0); | ||
| 128 | } | ||
| 129 | 121 | ||
| 130 | #endif | 122 | #endif |
diff --git a/arch/arm/mach-ep93xx/include/mach/memory.h b/arch/arm/mach-ep93xx/include/mach/memory.h index 925b12ea0990..554064e90307 100644 --- a/arch/arm/mach-ep93xx/include/mach/memory.h +++ b/arch/arm/mach-ep93xx/include/mach/memory.h | |||
| @@ -9,6 +9,12 @@ | |||
| 9 | #define PHYS_OFFSET UL(0x00000000) | 9 | #define PHYS_OFFSET UL(0x00000000) |
| 10 | #elif defined(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) | 10 | #elif defined(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) |
| 11 | #define PHYS_OFFSET UL(0xc0000000) | 11 | #define PHYS_OFFSET UL(0xc0000000) |
| 12 | #elif defined(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) | ||
| 13 | #define PHYS_OFFSET UL(0xd0000000) | ||
| 14 | #elif defined(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) | ||
| 15 | #define PHYS_OFFSET UL(0xe0000000) | ||
| 16 | #elif defined(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) | ||
| 17 | #define PHYS_OFFSET UL(0xf0000000) | ||
| 12 | #else | 18 | #else |
| 13 | #error "Kconfig bug: No EP93xx PHYS_OFFSET set" | 19 | #error "Kconfig bug: No EP93xx PHYS_OFFSET set" |
| 14 | #endif | 20 | #endif |
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h index 01a0f0838e5b..a3ec33fd79d4 100644 --- a/arch/arm/mach-ep93xx/include/mach/platform.h +++ b/arch/arm/mach-ep93xx/include/mach/platform.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #ifndef __ASSEMBLY__ | 5 | #ifndef __ASSEMBLY__ |
| 6 | 6 | ||
| 7 | struct i2c_gpio_platform_data; | ||
| 7 | struct i2c_board_info; | 8 | struct i2c_board_info; |
| 8 | struct platform_device; | 9 | struct platform_device; |
| 9 | struct ep93xxfb_mach_info; | 10 | struct ep93xxfb_mach_info; |
| @@ -33,7 +34,8 @@ static inline void ep93xx_devcfg_clear_bits(unsigned int bits) | |||
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); | 36 | void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); |
| 36 | void ep93xx_register_i2c(struct i2c_board_info *devices, int num); | 37 | void ep93xx_register_i2c(struct i2c_gpio_platform_data *data, |
| 38 | struct i2c_board_info *devices, int num); | ||
| 37 | void ep93xx_register_fb(struct ep93xxfb_mach_info *data); | 39 | void ep93xx_register_fb(struct ep93xxfb_mach_info *data); |
| 38 | void ep93xx_register_pwm(int pwm0, int pwm1); | 40 | void ep93xx_register_pwm(int pwm0, int pwm1); |
| 39 | int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); | 41 | int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); |
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c index 0a313e82fb74..d83b80478b09 100644 --- a/arch/arm/mach-ep93xx/micro9.c +++ b/arch/arm/mach-ep93xx/micro9.c | |||
| @@ -2,7 +2,9 @@ | |||
| 2 | * linux/arch/arm/mach-ep93xx/micro9.c | 2 | * linux/arch/arm/mach-ep93xx/micro9.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH | 4 | * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH |
| 5 | * Manfred Gruber <manfred.gruber@contec.at> | 5 | * Manfred Gruber <m.gruber@tirol.com> |
| 6 | * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH | ||
| 7 | * Hubert Feurstein <hubert.feurstein@contec.at> | ||
| 6 | * | 8 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
| @@ -20,104 +22,124 @@ | |||
| 20 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
| 21 | 23 | ||
| 22 | 24 | ||
| 23 | static struct ep93xx_eth_data micro9_eth_data = { | 25 | /************************************************************************* |
| 24 | .phy_id = 0x1f, | 26 | * Micro9 NOR Flash |
| 25 | }; | 27 | * |
| 26 | 28 | * Micro9-High has up to 64MB of 32-bit flash on CS1 | |
| 27 | static void __init micro9_init(void) | 29 | * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1 |
| 28 | { | 30 | * Micro9-Lite uses a seperate MTD map driver for flash support |
| 29 | ep93xx_register_eth(µ9_eth_data, 1); | 31 | * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1 |
| 30 | } | 32 | *************************************************************************/ |
| 31 | 33 | static struct physmap_flash_data micro9_flash_data; | |
| 32 | /* | 34 | |
| 33 | * Micro9-H | 35 | static struct resource micro9_flash_resource = { |
| 34 | */ | ||
| 35 | #ifdef CONFIG_MACH_MICRO9H | ||
| 36 | static struct physmap_flash_data micro9h_flash_data = { | ||
| 37 | .width = 4, | ||
| 38 | }; | ||
| 39 | |||
| 40 | static struct resource micro9h_flash_resource = { | ||
| 41 | .start = EP93XX_CS1_PHYS_BASE, | 36 | .start = EP93XX_CS1_PHYS_BASE, |
| 42 | .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1, | 37 | .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1, |
| 43 | .flags = IORESOURCE_MEM, | 38 | .flags = IORESOURCE_MEM, |
| 44 | }; | 39 | }; |
| 45 | 40 | ||
| 46 | static struct platform_device micro9h_flash = { | 41 | static struct platform_device micro9_flash = { |
| 47 | .name = "physmap-flash", | 42 | .name = "physmap-flash", |
| 48 | .id = 0, | 43 | .id = 0, |
| 49 | .dev = { | 44 | .dev = { |
| 50 | .platform_data = µ9h_flash_data, | 45 | .platform_data = µ9_flash_data, |
| 51 | }, | 46 | }, |
| 52 | .num_resources = 1, | 47 | .num_resources = 1, |
| 53 | .resource = µ9h_flash_resource, | 48 | .resource = µ9_flash_resource, |
| 54 | }; | 49 | }; |
| 55 | 50 | ||
| 56 | static void __init micro9h_init(void) | 51 | static void __init __micro9_register_flash(unsigned int width) |
| 52 | { | ||
| 53 | micro9_flash_data.width = width; | ||
| 54 | |||
| 55 | platform_device_register(µ9_flash); | ||
| 56 | } | ||
| 57 | |||
| 58 | static unsigned int __init micro9_detect_bootwidth(void) | ||
| 59 | { | ||
| 60 | u32 v; | ||
| 61 | |||
| 62 | /* Detect the bus width of the external flash memory */ | ||
| 63 | v = __raw_readl(EP93XX_SYSCON_SYSCFG); | ||
| 64 | if (v & EP93XX_SYSCON_SYSCFG_LCSN7) | ||
| 65 | return 4; /* 32-bit */ | ||
| 66 | else | ||
| 67 | return 2; /* 16-bit */ | ||
| 68 | } | ||
| 69 | |||
| 70 | static void __init micro9_register_flash(void) | ||
| 57 | { | 71 | { |
| 58 | platform_device_register(µ9h_flash); | 72 | if (machine_is_micro9()) |
| 73 | __micro9_register_flash(4); | ||
| 74 | else if (machine_is_micro9m() || machine_is_micro9s()) | ||
| 75 | __micro9_register_flash(micro9_detect_bootwidth()); | ||
| 59 | } | 76 | } |
| 60 | 77 | ||
| 61 | static void __init micro9h_init_machine(void) | 78 | |
| 79 | /************************************************************************* | ||
| 80 | * Micro9 Ethernet | ||
| 81 | *************************************************************************/ | ||
| 82 | static struct ep93xx_eth_data micro9_eth_data = { | ||
| 83 | .phy_id = 0x1f, | ||
| 84 | }; | ||
| 85 | |||
| 86 | |||
| 87 | static void __init micro9_init_machine(void) | ||
| 62 | { | 88 | { |
| 63 | ep93xx_init_devices(); | 89 | ep93xx_init_devices(); |
| 64 | micro9_init(); | 90 | ep93xx_register_eth(µ9_eth_data, 1); |
| 65 | micro9h_init(); | 91 | micro9_register_flash(); |
| 66 | } | 92 | } |
| 67 | 93 | ||
| 68 | MACHINE_START(MICRO9, "Contec Hypercontrol Micro9-H") | 94 | |
| 69 | /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ | 95 | #ifdef CONFIG_MACH_MICRO9H |
| 96 | MACHINE_START(MICRO9, "Contec Micro9-High") | ||
| 97 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ | ||
| 70 | .phys_io = EP93XX_APB_PHYS_BASE, | 98 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 71 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, | 99 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 72 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, | 100 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 73 | .map_io = ep93xx_map_io, | 101 | .map_io = ep93xx_map_io, |
| 74 | .init_irq = ep93xx_init_irq, | 102 | .init_irq = ep93xx_init_irq, |
| 75 | .timer = &ep93xx_timer, | 103 | .timer = &ep93xx_timer, |
| 76 | .init_machine = micro9h_init_machine, | 104 | .init_machine = micro9_init_machine, |
| 77 | MACHINE_END | 105 | MACHINE_END |
| 78 | #endif | 106 | #endif |
| 79 | 107 | ||
| 80 | /* | ||
| 81 | * Micro9-M | ||
| 82 | */ | ||
| 83 | #ifdef CONFIG_MACH_MICRO9M | 108 | #ifdef CONFIG_MACH_MICRO9M |
| 84 | static void __init micro9m_init_machine(void) | 109 | MACHINE_START(MICRO9M, "Contec Micro9-Mid") |
| 85 | { | 110 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
| 86 | ep93xx_init_devices(); | ||
| 87 | micro9_init(); | ||
| 88 | } | ||
| 89 | |||
| 90 | MACHINE_START(MICRO9M, "Contec Hypercontrol Micro9-M") | ||
| 91 | /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ | ||
| 92 | .phys_io = EP93XX_APB_PHYS_BASE, | 111 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 93 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, | 112 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 94 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, | 113 | .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100, |
| 95 | .map_io = ep93xx_map_io, | 114 | .map_io = ep93xx_map_io, |
| 96 | .init_irq = ep93xx_init_irq, | 115 | .init_irq = ep93xx_init_irq, |
| 97 | .timer = &ep93xx_timer, | 116 | .timer = &ep93xx_timer, |
| 98 | .init_machine = micro9m_init_machine, | 117 | .init_machine = micro9_init_machine, |
| 99 | MACHINE_END | 118 | MACHINE_END |
| 100 | #endif | 119 | #endif |
| 101 | 120 | ||
| 102 | /* | ||
| 103 | * Micro9-L | ||
| 104 | */ | ||
| 105 | #ifdef CONFIG_MACH_MICRO9L | 121 | #ifdef CONFIG_MACH_MICRO9L |
| 106 | static void __init micro9l_init_machine(void) | 122 | MACHINE_START(MICRO9L, "Contec Micro9-Lite") |
| 107 | { | 123 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ |
| 108 | ep93xx_init_devices(); | ||
| 109 | micro9_init(); | ||
| 110 | } | ||
| 111 | |||
| 112 | MACHINE_START(MICRO9L, "Contec Hypercontrol Micro9-L") | ||
| 113 | /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ | ||
| 114 | .phys_io = EP93XX_APB_PHYS_BASE, | 124 | .phys_io = EP93XX_APB_PHYS_BASE, |
| 115 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, | 125 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, |
| 116 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, | 126 | .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, |
| 117 | .map_io = ep93xx_map_io, | 127 | .map_io = ep93xx_map_io, |
| 118 | .init_irq = ep93xx_init_irq, | 128 | .init_irq = ep93xx_init_irq, |
| 119 | .timer = &ep93xx_timer, | 129 | .timer = &ep93xx_timer, |
| 120 | .init_machine = micro9l_init_machine, | 130 | .init_machine = micro9_init_machine, |
| 121 | MACHINE_END | 131 | MACHINE_END |
| 122 | #endif | 132 | #endif |
| 123 | 133 | ||
| 134 | #ifdef CONFIG_MACH_MICRO9S | ||
| 135 | MACHINE_START(MICRO9S, "Contec Micro9-Slim") | ||
| 136 | /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */ | ||
| 137 | .phys_io = EP93XX_APB_PHYS_BASE, | ||
| 138 | .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, | ||
| 139 | .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100, | ||
| 140 | .map_io = ep93xx_map_io, | ||
| 141 | .init_irq = ep93xx_init_irq, | ||
| 142 | .timer = &ep93xx_timer, | ||
| 143 | .init_machine = micro9_init_machine, | ||
| 144 | MACHINE_END | ||
| 145 | #endif | ||
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index c1af5326e92f..2b0eb1ba5d7f 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
| @@ -444,7 +444,7 @@ static int __init rx51_i2c_init(void) | |||
| 444 | rx51_twldata.vaux3 = &rx51_vaux3_cam; | 444 | rx51_twldata.vaux3 = &rx51_vaux3_cam; |
| 445 | rx51_twldata.vmmc2 = &rx51_vmmc2; | 445 | rx51_twldata.vmmc2 = &rx51_vmmc2; |
| 446 | } | 446 | } |
| 447 | omap_register_i2c_bus(1, 2600, rx51_peripherals_i2c_board_info_1, | 447 | omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1, |
| 448 | ARRAY_SIZE(rx51_peripherals_i2c_board_info_1)); | 448 | ARRAY_SIZE(rx51_peripherals_i2c_board_info_1)); |
| 449 | omap_register_i2c_bus(2, 100, NULL, 0); | 449 | omap_register_i2c_bus(2, 100, NULL, 0); |
| 450 | omap_register_i2c_bus(3, 400, NULL, 0); | 450 | omap_register_i2c_bus(3, 400, NULL, 0); |
diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c index b7b32208ced7..fd3369d5e5cb 100644 --- a/arch/arm/mach-omap2/board-zoom2.c +++ b/arch/arm/mach-omap2/board-zoom2.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <mach/keypad.h> | 25 | #include <mach/keypad.h> |
| 26 | 26 | ||
| 27 | #include "mmc-twl4030.h" | 27 | #include "mmc-twl4030.h" |
| 28 | #include "sdram-micron-mt46h32m32lf-6.h" | ||
| 28 | 29 | ||
| 29 | /* Zoom2 has Qwerty keyboard*/ | 30 | /* Zoom2 has Qwerty keyboard*/ |
| 30 | static int board_keymap[] = { | 31 | static int board_keymap[] = { |
| @@ -213,7 +214,8 @@ static void __init omap_zoom2_init_irq(void) | |||
| 213 | { | 214 | { |
| 214 | omap_board_config = zoom2_config; | 215 | omap_board_config = zoom2_config; |
| 215 | omap_board_config_size = ARRAY_SIZE(zoom2_config); | 216 | omap_board_config_size = ARRAY_SIZE(zoom2_config); |
| 216 | omap2_init_common_hw(NULL, NULL); | 217 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, |
| 218 | mt46h32m32lf6_sdrc_params); | ||
| 217 | omap_init_irq(); | 219 | omap_init_irq(); |
| 218 | omap_gpio_init(); | 220 | omap_gpio_init(); |
| 219 | } | 221 | } |
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c index bc5d3ac66611..e2dbedd581e8 100644 --- a/arch/arm/mach-omap2/clock24xx.c +++ b/arch/arm/mach-omap2/clock24xx.c | |||
| @@ -769,6 +769,7 @@ int __init omap2_clk_init(void) | |||
| 769 | if (c->cpu & cpu_mask) { | 769 | if (c->cpu & cpu_mask) { |
| 770 | clkdev_add(&c->lk); | 770 | clkdev_add(&c->lk); |
| 771 | clk_register(c->lk.clk); | 771 | clk_register(c->lk.clk); |
| 772 | omap2_init_clk_clkdm(c->lk.clk); | ||
| 772 | } | 773 | } |
| 773 | 774 | ||
| 774 | /* Check the MPU rate set by bootloader */ | 775 | /* Check the MPU rate set by bootloader */ |
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 4ef7b4f5474e..58aff8485df9 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c | |||
| @@ -137,6 +137,36 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm) | |||
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | /* | ||
| 141 | * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit | ||
| 142 | * @clkdm: struct clockdomain * | ||
| 143 | * @enable: int 0 to disable, 1 to enable | ||
| 144 | * | ||
| 145 | * Internal helper for actually switching the bit that controls hwsup | ||
| 146 | * idle transitions for clkdm. | ||
| 147 | */ | ||
| 148 | static void _omap2_clkdm_set_hwsup(struct clockdomain *clkdm, int enable) | ||
| 149 | { | ||
| 150 | u32 v; | ||
| 151 | |||
| 152 | if (cpu_is_omap24xx()) { | ||
| 153 | if (enable) | ||
| 154 | v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO; | ||
| 155 | else | ||
| 156 | v = OMAP24XX_CLKSTCTRL_DISABLE_AUTO; | ||
| 157 | } else if (cpu_is_omap34xx()) { | ||
| 158 | if (enable) | ||
| 159 | v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO; | ||
| 160 | else | ||
| 161 | v = OMAP34XX_CLKSTCTRL_DISABLE_AUTO; | ||
| 162 | } else { | ||
| 163 | BUG(); | ||
| 164 | } | ||
| 165 | |||
| 166 | cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask, | ||
| 167 | v << __ffs(clkdm->clktrctrl_mask), | ||
| 168 | clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL); | ||
| 169 | } | ||
| 140 | 170 | ||
| 141 | static struct clockdomain *_clkdm_lookup(const char *name) | 171 | static struct clockdomain *_clkdm_lookup(const char *name) |
| 142 | { | 172 | { |
| @@ -456,8 +486,6 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm) | |||
| 456 | */ | 486 | */ |
| 457 | void omap2_clkdm_allow_idle(struct clockdomain *clkdm) | 487 | void omap2_clkdm_allow_idle(struct clockdomain *clkdm) |
| 458 | { | 488 | { |
| 459 | u32 v; | ||
| 460 | |||
| 461 | if (!clkdm) | 489 | if (!clkdm) |
| 462 | return; | 490 | return; |
| 463 | 491 | ||
| @@ -473,18 +501,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm) | |||
| 473 | if (atomic_read(&clkdm->usecount) > 0) | 501 | if (atomic_read(&clkdm->usecount) > 0) |
| 474 | _clkdm_add_autodeps(clkdm); | 502 | _clkdm_add_autodeps(clkdm); |
| 475 | 503 | ||
| 476 | if (cpu_is_omap24xx()) | 504 | _omap2_clkdm_set_hwsup(clkdm, 1); |
| 477 | v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO; | ||
| 478 | else if (cpu_is_omap34xx()) | ||
| 479 | v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO; | ||
| 480 | else | ||
| 481 | BUG(); | ||
| 482 | |||
| 483 | |||
| 484 | cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask, | ||
| 485 | v << __ffs(clkdm->clktrctrl_mask), | ||
| 486 | clkdm->pwrdm.ptr->prcm_offs, | ||
| 487 | CM_CLKSTCTRL); | ||
| 488 | 505 | ||
| 489 | pwrdm_clkdm_state_switch(clkdm); | 506 | pwrdm_clkdm_state_switch(clkdm); |
| 490 | } | 507 | } |
| @@ -500,8 +517,6 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm) | |||
| 500 | */ | 517 | */ |
| 501 | void omap2_clkdm_deny_idle(struct clockdomain *clkdm) | 518 | void omap2_clkdm_deny_idle(struct clockdomain *clkdm) |
| 502 | { | 519 | { |
| 503 | u32 v; | ||
| 504 | |||
| 505 | if (!clkdm) | 520 | if (!clkdm) |
| 506 | return; | 521 | return; |
| 507 | 522 | ||
| @@ -514,16 +529,7 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm) | |||
| 514 | pr_debug("clockdomain: disabling automatic idle transitions for %s\n", | 529 | pr_debug("clockdomain: disabling automatic idle transitions for %s\n", |
| 515 | clkdm->name); | 530 | clkdm->name); |
| 516 | 531 | ||
| 517 | if (cpu_is_omap24xx()) | 532 | _omap2_clkdm_set_hwsup(clkdm, 0); |
| 518 | v = OMAP24XX_CLKSTCTRL_DISABLE_AUTO; | ||
| 519 | else if (cpu_is_omap34xx()) | ||
| 520 | v = OMAP34XX_CLKSTCTRL_DISABLE_AUTO; | ||
| 521 | else | ||
| 522 | BUG(); | ||
| 523 | |||
| 524 | cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask, | ||
| 525 | v << __ffs(clkdm->clktrctrl_mask), | ||
| 526 | clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL); | ||
| 527 | 533 | ||
| 528 | if (atomic_read(&clkdm->usecount) > 0) | 534 | if (atomic_read(&clkdm->usecount) > 0) |
| 529 | _clkdm_del_autodeps(clkdm); | 535 | _clkdm_del_autodeps(clkdm); |
| @@ -569,10 +575,14 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) | |||
| 569 | v = omap2_clkdm_clktrctrl_read(clkdm); | 575 | v = omap2_clkdm_clktrctrl_read(clkdm); |
| 570 | 576 | ||
| 571 | if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || | 577 | if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || |
| 572 | (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) | 578 | (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) { |
| 579 | /* Disable HW transitions when we are changing deps */ | ||
| 580 | _omap2_clkdm_set_hwsup(clkdm, 0); | ||
| 573 | _clkdm_add_autodeps(clkdm); | 581 | _clkdm_add_autodeps(clkdm); |
| 574 | else | 582 | _omap2_clkdm_set_hwsup(clkdm, 1); |
| 583 | } else { | ||
| 575 | omap2_clkdm_wakeup(clkdm); | 584 | omap2_clkdm_wakeup(clkdm); |
| 585 | } | ||
| 576 | 586 | ||
| 577 | pwrdm_wait_transition(clkdm->pwrdm.ptr); | 587 | pwrdm_wait_transition(clkdm->pwrdm.ptr); |
| 578 | pwrdm_clkdm_state_switch(clkdm); | 588 | pwrdm_clkdm_state_switch(clkdm); |
| @@ -623,10 +633,14 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) | |||
| 623 | v = omap2_clkdm_clktrctrl_read(clkdm); | 633 | v = omap2_clkdm_clktrctrl_read(clkdm); |
| 624 | 634 | ||
| 625 | if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || | 635 | if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) || |
| 626 | (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) | 636 | (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) { |
| 637 | /* Disable HW transitions when we are changing deps */ | ||
| 638 | _omap2_clkdm_set_hwsup(clkdm, 0); | ||
| 627 | _clkdm_del_autodeps(clkdm); | 639 | _clkdm_del_autodeps(clkdm); |
| 628 | else | 640 | _omap2_clkdm_set_hwsup(clkdm, 1); |
| 641 | } else { | ||
| 629 | omap2_clkdm_sleep(clkdm); | 642 | omap2_clkdm_sleep(clkdm); |
| 643 | } | ||
| 630 | 644 | ||
| 631 | pwrdm_clkdm_state_switch(clkdm); | 645 | pwrdm_clkdm_state_switch(clkdm); |
| 632 | 646 | ||
diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c index 3a8ee2272add..983cc8c20081 100644 --- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c +++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c | |||
| @@ -155,7 +155,7 @@ MODULE_PARM_DESC(pxa255_turbo_table, "Selects the frequency table (0 = run table | |||
| 155 | 155 | ||
| 156 | static pxa_freqs_t pxa27x_freqs[] = { | 156 | static pxa_freqs_t pxa27x_freqs[] = { |
| 157 | {104000, 104000, PXA27x_CCCR(1, 8, 2), 0, CCLKCFG2(1, 0, 1), 900000, 1705000 }, | 157 | {104000, 104000, PXA27x_CCCR(1, 8, 2), 0, CCLKCFG2(1, 0, 1), 900000, 1705000 }, |
| 158 | {156000, 104000, PXA27x_CCCR(1, 8, 6), 0, CCLKCFG2(1, 1, 1), 1000000, 1705000 }, | 158 | {156000, 104000, PXA27x_CCCR(1, 8, 3), 0, CCLKCFG2(1, 0, 1), 1000000, 1705000 }, |
| 159 | {208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1), 1180000, 1705000 }, | 159 | {208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1), 1180000, 1705000 }, |
| 160 | {312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1), 1250000, 1705000 }, | 160 | {312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1), 1250000, 1705000 }, |
| 161 | {416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1), 1350000, 1705000 }, | 161 | {416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1), 1350000, 1705000 }, |
diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c index 79141f862728..965480eb4fe6 100644 --- a/arch/arm/mach-pxa/csb726.c +++ b/arch/arm/mach-pxa/csb726.c | |||
| @@ -238,7 +238,7 @@ static struct resource csb726_lan_resources[] = { | |||
| 238 | }; | 238 | }; |
| 239 | 239 | ||
| 240 | struct smsc911x_platform_config csb726_lan_config = { | 240 | struct smsc911x_platform_config csb726_lan_config = { |
| 241 | .irq_type = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | 241 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 242 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | 242 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, |
| 243 | .flags = SMSC911X_USE_32BIT, | 243 | .flags = SMSC911X_USE_32BIT, |
| 244 | .phy_interface = PHY_INTERFACE_MODE_MII, | 244 | .phy_interface = PHY_INTERFACE_MODE_MII, |
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile index 8a5546e6d547..bb7b8198d0c4 100644 --- a/arch/arm/mach-sa1100/Makefile +++ b/arch/arm/mach-sa1100/Makefile | |||
| @@ -25,6 +25,7 @@ led-$(CONFIG_SA1100_CERF) += leds-cerf.o | |||
| 25 | 25 | ||
| 26 | obj-$(CONFIG_SA1100_COLLIE) += collie.o | 26 | obj-$(CONFIG_SA1100_COLLIE) += collie.o |
| 27 | 27 | ||
| 28 | obj-$(CONFIG_SA1100_H3100) += h3600.o | ||
| 28 | obj-$(CONFIG_SA1100_H3600) += h3600.o | 29 | obj-$(CONFIG_SA1100_H3600) += h3600.o |
| 29 | 30 | ||
| 30 | obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o | 31 | obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o |
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S index 8f5c13f4c936..295e25dd6381 100644 --- a/arch/arm/mm/cache-v6.S +++ b/arch/arm/mm/cache-v6.S | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/linkage.h> | 12 | #include <linux/linkage.h> |
| 13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 14 | #include <asm/assembler.h> | 14 | #include <asm/assembler.h> |
| 15 | #include <asm/unwind.h> | ||
| 15 | 16 | ||
| 16 | #include "proc-macros.S" | 17 | #include "proc-macros.S" |
| 17 | 18 | ||
| @@ -121,11 +122,13 @@ ENTRY(v6_coherent_kern_range) | |||
| 121 | * - the Icache does not read data from the write buffer | 122 | * - the Icache does not read data from the write buffer |
| 122 | */ | 123 | */ |
| 123 | ENTRY(v6_coherent_user_range) | 124 | ENTRY(v6_coherent_user_range) |
| 124 | 125 | UNWIND(.fnstart ) | |
| 125 | #ifdef HARVARD_CACHE | 126 | #ifdef HARVARD_CACHE |
| 126 | bic r0, r0, #CACHE_LINE_SIZE - 1 | 127 | bic r0, r0, #CACHE_LINE_SIZE - 1 |
| 127 | 1: mcr p15, 0, r0, c7, c10, 1 @ clean D line | 128 | 1: |
| 129 | USER( mcr p15, 0, r0, c7, c10, 1 ) @ clean D line | ||
| 128 | add r0, r0, #CACHE_LINE_SIZE | 130 | add r0, r0, #CACHE_LINE_SIZE |
| 131 | 2: | ||
| 129 | cmp r0, r1 | 132 | cmp r0, r1 |
| 130 | blo 1b | 133 | blo 1b |
| 131 | #endif | 134 | #endif |
| @@ -143,6 +146,19 @@ ENTRY(v6_coherent_user_range) | |||
| 143 | mov pc, lr | 146 | mov pc, lr |
| 144 | 147 | ||
| 145 | /* | 148 | /* |
| 149 | * Fault handling for the cache operation above. If the virtual address in r0 | ||
| 150 | * isn't mapped, just try the next page. | ||
| 151 | */ | ||
| 152 | 9001: | ||
| 153 | mov r0, r0, lsr #12 | ||
| 154 | mov r0, r0, lsl #12 | ||
| 155 | add r0, r0, #4096 | ||
| 156 | b 2b | ||
| 157 | UNWIND(.fnend ) | ||
| 158 | ENDPROC(v6_coherent_user_range) | ||
| 159 | ENDPROC(v6_coherent_kern_range) | ||
| 160 | |||
| 161 | /* | ||
| 146 | * v6_flush_kern_dcache_page(kaddr) | 162 | * v6_flush_kern_dcache_page(kaddr) |
| 147 | * | 163 | * |
| 148 | * Ensure that the data held in the page kaddr is written back | 164 | * Ensure that the data held in the page kaddr is written back |
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S index bda0ec31a4e2..e1bd9759617f 100644 --- a/arch/arm/mm/cache-v7.S +++ b/arch/arm/mm/cache-v7.S | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/linkage.h> | 13 | #include <linux/linkage.h> |
| 14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 15 | #include <asm/assembler.h> | 15 | #include <asm/assembler.h> |
| 16 | #include <asm/unwind.h> | ||
| 16 | 17 | ||
| 17 | #include "proc-macros.S" | 18 | #include "proc-macros.S" |
| 18 | 19 | ||
| @@ -153,13 +154,16 @@ ENTRY(v7_coherent_kern_range) | |||
| 153 | * - the Icache does not read data from the write buffer | 154 | * - the Icache does not read data from the write buffer |
| 154 | */ | 155 | */ |
| 155 | ENTRY(v7_coherent_user_range) | 156 | ENTRY(v7_coherent_user_range) |
| 157 | UNWIND(.fnstart ) | ||
| 156 | dcache_line_size r2, r3 | 158 | dcache_line_size r2, r3 |
| 157 | sub r3, r2, #1 | 159 | sub r3, r2, #1 |
| 158 | bic r0, r0, r3 | 160 | bic r0, r0, r3 |
| 159 | 1: mcr p15, 0, r0, c7, c11, 1 @ clean D line to the point of unification | 161 | 1: |
| 162 | USER( mcr p15, 0, r0, c7, c11, 1 ) @ clean D line to the point of unification | ||
| 160 | dsb | 163 | dsb |
| 161 | mcr p15, 0, r0, c7, c5, 1 @ invalidate I line | 164 | USER( mcr p15, 0, r0, c7, c5, 1 ) @ invalidate I line |
| 162 | add r0, r0, r2 | 165 | add r0, r0, r2 |
| 166 | 2: | ||
| 163 | cmp r0, r1 | 167 | cmp r0, r1 |
| 164 | blo 1b | 168 | blo 1b |
| 165 | mov r0, #0 | 169 | mov r0, #0 |
| @@ -167,6 +171,17 @@ ENTRY(v7_coherent_user_range) | |||
| 167 | dsb | 171 | dsb |
| 168 | isb | 172 | isb |
| 169 | mov pc, lr | 173 | mov pc, lr |
| 174 | |||
| 175 | /* | ||
| 176 | * Fault handling for the cache operation above. If the virtual address in r0 | ||
| 177 | * isn't mapped, just try the next page. | ||
| 178 | */ | ||
| 179 | 9001: | ||
| 180 | mov r0, r0, lsr #12 | ||
| 181 | mov r0, r0, lsl #12 | ||
| 182 | add r0, r0, #4096 | ||
| 183 | b 2b | ||
| 184 | UNWIND(.fnend ) | ||
| 170 | ENDPROC(v7_coherent_kern_range) | 185 | ENDPROC(v7_coherent_kern_range) |
| 171 | ENDPROC(v7_coherent_user_range) | 186 | ENDPROC(v7_coherent_user_range) |
| 172 | 187 | ||
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c index bc0099d5ae85..d0d17b6a3703 100644 --- a/arch/arm/mm/fault-armv.c +++ b/arch/arm/mm/fault-armv.c | |||
| @@ -153,14 +153,11 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte) | |||
| 153 | 153 | ||
| 154 | page = pfn_to_page(pfn); | 154 | page = pfn_to_page(pfn); |
| 155 | mapping = page_mapping(page); | 155 | mapping = page_mapping(page); |
| 156 | if (mapping) { | ||
| 157 | #ifndef CONFIG_SMP | 156 | #ifndef CONFIG_SMP |
| 158 | int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); | 157 | if (test_and_clear_bit(PG_dcache_dirty, &page->flags)) |
| 159 | 158 | __flush_dcache_page(mapping, page); | |
| 160 | if (dirty) | ||
| 161 | __flush_dcache_page(mapping, page); | ||
| 162 | #endif | 159 | #endif |
| 163 | 160 | if (mapping) { | |
| 164 | if (cache_is_vivt()) | 161 | if (cache_is_vivt()) |
| 165 | make_coherent(mapping, vma, addr, pfn); | 162 | make_coherent(mapping, vma, addr, pfn); |
| 166 | else if (vma->vm_flags & VM_EXEC) | 163 | else if (vma->vm_flags & VM_EXEC) |
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index ae0e25f5a70e..10e06801afb3 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
| @@ -292,6 +292,11 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | |||
| 292 | * down_read() | 292 | * down_read() |
| 293 | */ | 293 | */ |
| 294 | might_sleep(); | 294 | might_sleep(); |
| 295 | #ifdef CONFIG_DEBUG_VM | ||
| 296 | if (!user_mode(regs) && | ||
| 297 | !search_exception_tables(regs->ARM_pc)) | ||
| 298 | goto no_context; | ||
| 299 | #endif | ||
| 295 | } | 300 | } |
| 296 | 301 | ||
| 297 | fault = __do_page_fault(mm, addr, fsr, tsk); | 302 | fault = __do_page_fault(mm, addr, fsr, tsk); |
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c index 73cae57fa707..30f82fb5918c 100644 --- a/arch/arm/mm/highmem.c +++ b/arch/arm/mm/highmem.c | |||
| @@ -46,6 +46,8 @@ void *kmap_atomic(struct page *page, enum km_type type) | |||
| 46 | if (!PageHighMem(page)) | 46 | if (!PageHighMem(page)) |
| 47 | return page_address(page); | 47 | return page_address(page); |
| 48 | 48 | ||
| 49 | debug_kmap_atomic(type); | ||
| 50 | |||
| 49 | kmap = kmap_high_get(page); | 51 | kmap = kmap_high_get(page); |
| 50 | if (kmap) | 52 | if (kmap) |
| 51 | return kmap; | 53 | return kmap; |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 877c492f8e10..40940d7ce4ff 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
| @@ -483,7 +483,7 @@ free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn) | |||
| 483 | /* | 483 | /* |
| 484 | * Convert start_pfn/end_pfn to a struct page pointer. | 484 | * Convert start_pfn/end_pfn to a struct page pointer. |
| 485 | */ | 485 | */ |
| 486 | start_pg = pfn_to_page(start_pfn); | 486 | start_pg = pfn_to_page(start_pfn - 1) + 1; |
| 487 | end_pg = pfn_to_page(end_pfn); | 487 | end_pg = pfn_to_page(end_pfn); |
| 488 | 488 | ||
| 489 | /* | 489 | /* |
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index fd3154ae69b1..0eb676d7e807 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
| @@ -829,10 +829,10 @@ EXPORT_SYMBOL(omap_free_dma); | |||
| 829 | * | 829 | * |
| 830 | * @param arb_rate | 830 | * @param arb_rate |
| 831 | * @param max_fifo_depth | 831 | * @param max_fifo_depth |
| 832 | * @param tparams - Number of thereads to reserve : DMA_THREAD_RESERVE_NORM | 832 | * @param tparams - Number of threads to reserve : DMA_THREAD_RESERVE_NORM |
| 833 | * DMA_THREAD_RESERVE_ONET | 833 | * DMA_THREAD_RESERVE_ONET |
| 834 | * DMA_THREAD_RESERVE_TWOT | 834 | * DMA_THREAD_RESERVE_TWOT |
| 835 | * DMA_THREAD_RESERVE_THREET | 835 | * DMA_THREAD_RESERVE_THREET |
| 836 | */ | 836 | */ |
| 837 | void | 837 | void |
| 838 | omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams) | 838 | omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams) |
| @@ -844,11 +844,14 @@ omap_dma_set_global_params(int arb_rate, int max_fifo_depth, int tparams) | |||
| 844 | return; | 844 | return; |
| 845 | } | 845 | } |
| 846 | 846 | ||
| 847 | if (max_fifo_depth == 0) | ||
| 848 | max_fifo_depth = 1; | ||
| 847 | if (arb_rate == 0) | 849 | if (arb_rate == 0) |
| 848 | arb_rate = 1; | 850 | arb_rate = 1; |
| 849 | 851 | ||
| 850 | reg = (arb_rate & 0xff) << 16; | 852 | reg = 0xff & max_fifo_depth; |
| 851 | reg |= (0xff & max_fifo_depth); | 853 | reg |= (0x3 & tparams) << 12; |
| 854 | reg |= (arb_rate & 0xff) << 16; | ||
| 852 | 855 | ||
| 853 | dma_write(reg, GCR); | 856 | dma_write(reg, GCR); |
| 854 | } | 857 | } |
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index 88ac9768f1c1..e664b912d7bb 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c | |||
| @@ -595,7 +595,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx) | |||
| 595 | rx &= 1; | 595 | rx &= 1; |
| 596 | if (cpu_is_omap2430() || cpu_is_omap34xx()) { | 596 | if (cpu_is_omap2430() || cpu_is_omap34xx()) { |
| 597 | w = OMAP_MCBSP_READ(io_base, RCCR); | 597 | w = OMAP_MCBSP_READ(io_base, RCCR); |
| 598 | w |= (tx ? RDISABLE : 0); | 598 | w |= (rx ? RDISABLE : 0); |
| 599 | OMAP_MCBSP_WRITE(io_base, RCCR, w); | 599 | OMAP_MCBSP_WRITE(io_base, RCCR, w); |
| 600 | } | 600 | } |
| 601 | w = OMAP_MCBSP_READ(io_base, SPCR1); | 601 | w = OMAP_MCBSP_READ(io_base, SPCR1); |
diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig new file mode 100644 index 000000000000..18af46036258 --- /dev/null +++ b/arch/powerpc/configs/ppc64e_defconfig | |||
| @@ -0,0 +1,2199 @@ | |||
| 1 | # | ||
| 2 | # Automatically generated make config: don't edit | ||
| 3 | # Linux kernel version: 2.6.32-rc5 | ||
| 4 | # Fri Oct 16 11:37:15 2009 | ||
| 5 | # | ||
| 6 | CONFIG_PPC64=y | ||
| 7 | |||
| 8 | # | ||
| 9 | # Processor support | ||
| 10 | # | ||
| 11 | # CONFIG_PPC_BOOK3S_64 is not set | ||
| 12 | CONFIG_PPC_BOOK3E_64=y | ||
| 13 | CONFIG_PPC_BOOK3E=y | ||
| 14 | CONFIG_PPC_FPU=y | ||
| 15 | CONFIG_BOOKE=y | ||
| 16 | CONFIG_PPC_MMU_NOHASH=y | ||
| 17 | CONFIG_PPC_MMU_NOHASH_64=y | ||
| 18 | CONFIG_PPC_BOOK3E_MMU=y | ||
| 19 | # CONFIG_PPC_MM_SLICES is not set | ||
| 20 | CONFIG_VIRT_CPU_ACCOUNTING=y | ||
| 21 | CONFIG_PPC_HAVE_PMU_SUPPORT=y | ||
| 22 | CONFIG_PPC_PERF_CTRS=y | ||
| 23 | CONFIG_SMP=y | ||
| 24 | CONFIG_NR_CPUS=32 | ||
| 25 | CONFIG_64BIT=y | ||
| 26 | CONFIG_WORD_SIZE=64 | ||
| 27 | CONFIG_ARCH_PHYS_ADDR_T_64BIT=y | ||
| 28 | CONFIG_MMU=y | ||
| 29 | CONFIG_GENERIC_CMOS_UPDATE=y | ||
| 30 | CONFIG_GENERIC_TIME=y | ||
| 31 | CONFIG_GENERIC_TIME_VSYSCALL=y | ||
| 32 | CONFIG_GENERIC_CLOCKEVENTS=y | ||
| 33 | CONFIG_GENERIC_HARDIRQS=y | ||
| 34 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y | ||
| 35 | CONFIG_HAVE_SETUP_PER_CPU_AREA=y | ||
| 36 | CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y | ||
| 37 | CONFIG_IRQ_PER_CPU=y | ||
| 38 | CONFIG_STACKTRACE_SUPPORT=y | ||
| 39 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y | ||
| 40 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | ||
| 41 | CONFIG_LOCKDEP_SUPPORT=y | ||
| 42 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | ||
| 43 | CONFIG_ARCH_HAS_ILOG2_U32=y | ||
| 44 | CONFIG_ARCH_HAS_ILOG2_U64=y | ||
| 45 | CONFIG_GENERIC_HWEIGHT=y | ||
| 46 | CONFIG_GENERIC_FIND_NEXT_BIT=y | ||
| 47 | CONFIG_ARCH_NO_VIRT_TO_BUS=y | ||
| 48 | CONFIG_PPC=y | ||
| 49 | CONFIG_EARLY_PRINTK=y | ||
| 50 | CONFIG_COMPAT=y | ||
| 51 | CONFIG_SYSVIPC_COMPAT=y | ||
| 52 | CONFIG_SCHED_OMIT_FRAME_POINTER=y | ||
| 53 | CONFIG_ARCH_MAY_HAVE_PC_FDC=y | ||
| 54 | CONFIG_PPC_OF=y | ||
| 55 | CONFIG_OF=y | ||
| 56 | # CONFIG_PPC_UDBG_16550 is not set | ||
| 57 | # CONFIG_GENERIC_TBSYNC is not set | ||
| 58 | CONFIG_AUDIT_ARCH=y | ||
| 59 | CONFIG_GENERIC_BUG=y | ||
| 60 | CONFIG_DTC=y | ||
| 61 | # CONFIG_DEFAULT_UIMAGE is not set | ||
| 62 | # CONFIG_PPC_DCR_NATIVE is not set | ||
| 63 | # CONFIG_PPC_DCR_MMIO is not set | ||
| 64 | # CONFIG_PPC_OF_PLATFORM_PCI is not set | ||
| 65 | CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y | ||
| 66 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
| 67 | CONFIG_CONSTRUCTORS=y | ||
| 68 | |||
| 69 | # | ||
| 70 | # General setup | ||
| 71 | # | ||
| 72 | CONFIG_EXPERIMENTAL=y | ||
| 73 | CONFIG_LOCK_KERNEL=y | ||
| 74 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
| 75 | CONFIG_LOCALVERSION="" | ||
| 76 | CONFIG_LOCALVERSION_AUTO=y | ||
| 77 | CONFIG_SWAP=y | ||
| 78 | CONFIG_SYSVIPC=y | ||
| 79 | CONFIG_SYSVIPC_SYSCTL=y | ||
| 80 | CONFIG_POSIX_MQUEUE=y | ||
| 81 | CONFIG_POSIX_MQUEUE_SYSCTL=y | ||
| 82 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
| 83 | CONFIG_TASKSTATS=y | ||
| 84 | CONFIG_TASK_DELAY_ACCT=y | ||
| 85 | # CONFIG_TASK_XACCT is not set | ||
| 86 | # CONFIG_AUDIT is not set | ||
| 87 | |||
| 88 | # | ||
| 89 | # RCU Subsystem | ||
| 90 | # | ||
| 91 | CONFIG_TREE_RCU=y | ||
| 92 | # CONFIG_TREE_PREEMPT_RCU is not set | ||
| 93 | # CONFIG_RCU_TRACE is not set | ||
| 94 | CONFIG_RCU_FANOUT=64 | ||
| 95 | # CONFIG_RCU_FANOUT_EXACT is not set | ||
| 96 | # CONFIG_TREE_RCU_TRACE is not set | ||
| 97 | CONFIG_IKCONFIG=y | ||
| 98 | CONFIG_IKCONFIG_PROC=y | ||
| 99 | CONFIG_LOG_BUF_SHIFT=17 | ||
| 100 | # CONFIG_GROUP_SCHED is not set | ||
| 101 | CONFIG_CGROUPS=y | ||
| 102 | # CONFIG_CGROUP_DEBUG is not set | ||
| 103 | # CONFIG_CGROUP_NS is not set | ||
| 104 | # CONFIG_CGROUP_FREEZER is not set | ||
| 105 | # CONFIG_CGROUP_DEVICE is not set | ||
| 106 | CONFIG_CPUSETS=y | ||
| 107 | CONFIG_PROC_PID_CPUSET=y | ||
| 108 | # CONFIG_CGROUP_CPUACCT is not set | ||
| 109 | # CONFIG_RESOURCE_COUNTERS is not set | ||
| 110 | CONFIG_SYSFS_DEPRECATED=y | ||
| 111 | CONFIG_SYSFS_DEPRECATED_V2=y | ||
| 112 | CONFIG_RELAY=y | ||
| 113 | CONFIG_NAMESPACES=y | ||
| 114 | # CONFIG_UTS_NS is not set | ||
| 115 | # CONFIG_IPC_NS is not set | ||
| 116 | # CONFIG_USER_NS is not set | ||
| 117 | # CONFIG_PID_NS is not set | ||
| 118 | # CONFIG_NET_NS is not set | ||
| 119 | CONFIG_BLK_DEV_INITRD=y | ||
| 120 | CONFIG_INITRAMFS_SOURCE="" | ||
| 121 | CONFIG_RD_GZIP=y | ||
| 122 | CONFIG_RD_BZIP2=y | ||
| 123 | CONFIG_RD_LZMA=y | ||
| 124 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
| 125 | CONFIG_SYSCTL=y | ||
| 126 | CONFIG_ANON_INODES=y | ||
| 127 | # CONFIG_EMBEDDED is not set | ||
| 128 | CONFIG_SYSCTL_SYSCALL=y | ||
| 129 | CONFIG_KALLSYMS=y | ||
| 130 | CONFIG_KALLSYMS_ALL=y | ||
| 131 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | ||
| 132 | CONFIG_HOTPLUG=y | ||
| 133 | CONFIG_PRINTK=y | ||
| 134 | CONFIG_BUG=y | ||
| 135 | CONFIG_ELF_CORE=y | ||
| 136 | CONFIG_BASE_FULL=y | ||
| 137 | CONFIG_FUTEX=y | ||
| 138 | CONFIG_EPOLL=y | ||
| 139 | CONFIG_SIGNALFD=y | ||
| 140 | CONFIG_TIMERFD=y | ||
| 141 | CONFIG_EVENTFD=y | ||
| 142 | CONFIG_SHMEM=y | ||
| 143 | CONFIG_AIO=y | ||
| 144 | CONFIG_HAVE_PERF_EVENTS=y | ||
| 145 | |||
| 146 | # | ||
| 147 | # Kernel Performance Events And Counters | ||
| 148 | # | ||
| 149 | CONFIG_PERF_EVENTS=y | ||
| 150 | CONFIG_EVENT_PROFILE=y | ||
| 151 | # CONFIG_PERF_COUNTERS is not set | ||
| 152 | # CONFIG_DEBUG_PERF_USE_VMALLOC is not set | ||
| 153 | CONFIG_VM_EVENT_COUNTERS=y | ||
| 154 | CONFIG_PCI_QUIRKS=y | ||
| 155 | CONFIG_SLUB_DEBUG=y | ||
| 156 | # CONFIG_COMPAT_BRK is not set | ||
| 157 | # CONFIG_SLAB is not set | ||
| 158 | CONFIG_SLUB=y | ||
| 159 | # CONFIG_SLOB is not set | ||
| 160 | CONFIG_PROFILING=y | ||
| 161 | CONFIG_TRACEPOINTS=y | ||
| 162 | CONFIG_OPROFILE=y | ||
| 163 | CONFIG_HAVE_OPROFILE=y | ||
| 164 | # CONFIG_KPROBES is not set | ||
| 165 | CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y | ||
| 166 | CONFIG_HAVE_SYSCALL_WRAPPERS=y | ||
| 167 | CONFIG_HAVE_IOREMAP_PROT=y | ||
| 168 | CONFIG_HAVE_KPROBES=y | ||
| 169 | CONFIG_HAVE_KRETPROBES=y | ||
| 170 | CONFIG_HAVE_ARCH_TRACEHOOK=y | ||
| 171 | CONFIG_HAVE_DMA_ATTRS=y | ||
| 172 | CONFIG_USE_GENERIC_SMP_HELPERS=y | ||
| 173 | CONFIG_HAVE_DMA_API_DEBUG=y | ||
| 174 | |||
| 175 | # | ||
| 176 | # GCOV-based kernel profiling | ||
| 177 | # | ||
| 178 | # CONFIG_GCOV_KERNEL is not set | ||
| 179 | CONFIG_SLOW_WORK=y | ||
| 180 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | ||
| 181 | CONFIG_SLABINFO=y | ||
| 182 | CONFIG_RT_MUTEXES=y | ||
| 183 | CONFIG_BASE_SMALL=0 | ||
| 184 | CONFIG_MODULES=y | ||
| 185 | # CONFIG_MODULE_FORCE_LOAD is not set | ||
| 186 | CONFIG_MODULE_UNLOAD=y | ||
| 187 | # CONFIG_MODULE_FORCE_UNLOAD is not set | ||
| 188 | CONFIG_MODVERSIONS=y | ||
| 189 | CONFIG_MODULE_SRCVERSION_ALL=y | ||
| 190 | CONFIG_STOP_MACHINE=y | ||
| 191 | CONFIG_BLOCK=y | ||
| 192 | CONFIG_BLK_DEV_BSG=y | ||
| 193 | # CONFIG_BLK_DEV_INTEGRITY is not set | ||
| 194 | CONFIG_BLOCK_COMPAT=y | ||
| 195 | |||
| 196 | # | ||
| 197 | # IO Schedulers | ||
| 198 | # | ||
| 199 | CONFIG_IOSCHED_NOOP=y | ||
| 200 | CONFIG_IOSCHED_AS=y | ||
| 201 | CONFIG_IOSCHED_DEADLINE=y | ||
| 202 | CONFIG_IOSCHED_CFQ=y | ||
| 203 | CONFIG_DEFAULT_AS=y | ||
| 204 | # CONFIG_DEFAULT_DEADLINE is not set | ||
| 205 | # CONFIG_DEFAULT_CFQ is not set | ||
| 206 | # CONFIG_DEFAULT_NOOP is not set | ||
| 207 | CONFIG_DEFAULT_IOSCHED="anticipatory" | ||
| 208 | # CONFIG_FREEZER is not set | ||
| 209 | |||
| 210 | # | ||
| 211 | # Platform support | ||
| 212 | # | ||
| 213 | # CONFIG_PPC_CELL is not set | ||
| 214 | # CONFIG_PPC_CELL_NATIVE is not set | ||
| 215 | # CONFIG_PQ2ADS is not set | ||
| 216 | CONFIG_PPC_OF_BOOT_TRAMPOLINE=y | ||
| 217 | # CONFIG_IPIC is not set | ||
| 218 | # CONFIG_MPIC is not set | ||
| 219 | # CONFIG_MPIC_WEIRD is not set | ||
| 220 | # CONFIG_PPC_I8259 is not set | ||
| 221 | # CONFIG_U3_DART is not set | ||
| 222 | # CONFIG_PPC_RTAS is not set | ||
| 223 | # CONFIG_MMIO_NVRAM is not set | ||
| 224 | # CONFIG_PPC_MPC106 is not set | ||
| 225 | # CONFIG_PPC_970_NAP is not set | ||
| 226 | # CONFIG_PPC_INDIRECT_IO is not set | ||
| 227 | # CONFIG_GENERIC_IOMAP is not set | ||
| 228 | CONFIG_CPU_FREQ=y | ||
| 229 | CONFIG_CPU_FREQ_TABLE=y | ||
| 230 | # CONFIG_CPU_FREQ_DEBUG is not set | ||
| 231 | CONFIG_CPU_FREQ_STAT=y | ||
| 232 | # CONFIG_CPU_FREQ_STAT_DETAILS is not set | ||
| 233 | CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y | ||
| 234 | # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set | ||
| 235 | # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set | ||
| 236 | # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set | ||
| 237 | # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set | ||
| 238 | CONFIG_CPU_FREQ_GOV_PERFORMANCE=y | ||
| 239 | CONFIG_CPU_FREQ_GOV_POWERSAVE=y | ||
| 240 | CONFIG_CPU_FREQ_GOV_USERSPACE=y | ||
| 241 | # CONFIG_CPU_FREQ_GOV_ONDEMAND is not set | ||
| 242 | # CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set | ||
| 243 | |||
| 244 | # | ||
| 245 | # CPU Frequency drivers | ||
| 246 | # | ||
| 247 | # CONFIG_FSL_ULI1575 is not set | ||
| 248 | # CONFIG_SIMPLE_GPIO is not set | ||
| 249 | |||
| 250 | # | ||
| 251 | # Kernel options | ||
| 252 | # | ||
| 253 | CONFIG_TICK_ONESHOT=y | ||
| 254 | CONFIG_NO_HZ=y | ||
| 255 | CONFIG_HIGH_RES_TIMERS=y | ||
| 256 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y | ||
| 257 | # CONFIG_HZ_100 is not set | ||
| 258 | CONFIG_HZ_250=y | ||
| 259 | # CONFIG_HZ_300 is not set | ||
| 260 | # CONFIG_HZ_1000 is not set | ||
| 261 | CONFIG_HZ=250 | ||
| 262 | CONFIG_SCHED_HRTICK=y | ||
| 263 | CONFIG_PREEMPT_NONE=y | ||
| 264 | # CONFIG_PREEMPT_VOLUNTARY is not set | ||
| 265 | # CONFIG_PREEMPT is not set | ||
| 266 | CONFIG_BINFMT_ELF=y | ||
| 267 | CONFIG_COMPAT_BINFMT_ELF=y | ||
| 268 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
| 269 | # CONFIG_HAVE_AOUT is not set | ||
| 270 | CONFIG_BINFMT_MISC=m | ||
| 271 | CONFIG_IOMMU_VMERGE=y | ||
| 272 | CONFIG_IOMMU_HELPER=y | ||
| 273 | # CONFIG_SWIOTLB is not set | ||
| 274 | CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y | ||
| 275 | CONFIG_ARCH_HAS_WALK_MEMORY=y | ||
| 276 | CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y | ||
| 277 | # CONFIG_CRASH_DUMP is not set | ||
| 278 | CONFIG_IRQ_ALL_CPUS=y | ||
| 279 | # CONFIG_NUMA is not set | ||
| 280 | CONFIG_MAX_ACTIVE_REGIONS=256 | ||
| 281 | CONFIG_ARCH_SELECT_MEMORY_MODEL=y | ||
| 282 | CONFIG_ARCH_FLATMEM_ENABLE=y | ||
| 283 | CONFIG_ARCH_SPARSEMEM_ENABLE=y | ||
| 284 | CONFIG_ARCH_POPULATES_NODE_MAP=y | ||
| 285 | CONFIG_SELECT_MEMORY_MODEL=y | ||
| 286 | # CONFIG_FLATMEM_MANUAL is not set | ||
| 287 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
| 288 | CONFIG_SPARSEMEM_MANUAL=y | ||
| 289 | CONFIG_SPARSEMEM=y | ||
| 290 | CONFIG_HAVE_MEMORY_PRESENT=y | ||
| 291 | CONFIG_SPARSEMEM_EXTREME=y | ||
| 292 | CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y | ||
| 293 | CONFIG_SPARSEMEM_VMEMMAP=y | ||
| 294 | # CONFIG_MEMORY_HOTPLUG is not set | ||
| 295 | CONFIG_PAGEFLAGS_EXTENDED=y | ||
| 296 | CONFIG_SPLIT_PTLOCK_CPUS=4 | ||
| 297 | CONFIG_MIGRATION=y | ||
| 298 | CONFIG_PHYS_ADDR_T_64BIT=y | ||
| 299 | CONFIG_ZONE_DMA_FLAG=1 | ||
| 300 | CONFIG_BOUNCE=y | ||
| 301 | CONFIG_HAVE_MLOCK=y | ||
| 302 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y | ||
| 303 | # CONFIG_KSM is not set | ||
| 304 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 | ||
| 305 | # CONFIG_PPC_HAS_HASH_64K is not set | ||
| 306 | CONFIG_PPC_4K_PAGES=y | ||
| 307 | # CONFIG_PPC_16K_PAGES is not set | ||
| 308 | # CONFIG_PPC_64K_PAGES is not set | ||
| 309 | # CONFIG_PPC_256K_PAGES is not set | ||
| 310 | CONFIG_FORCE_MAX_ZONEORDER=13 | ||
| 311 | # CONFIG_SCHED_SMT is not set | ||
| 312 | CONFIG_PROC_DEVICETREE=y | ||
| 313 | # CONFIG_CMDLINE_BOOL is not set | ||
| 314 | CONFIG_EXTRA_TARGETS="" | ||
| 315 | # CONFIG_PM is not set | ||
| 316 | CONFIG_SECCOMP=y | ||
| 317 | CONFIG_ISA_DMA_API=y | ||
| 318 | |||
| 319 | # | ||
| 320 | # Bus options | ||
| 321 | # | ||
| 322 | CONFIG_ZONE_DMA=y | ||
| 323 | CONFIG_GENERIC_ISA_DMA=y | ||
| 324 | # CONFIG_PPC_INDIRECT_PCI is not set | ||
| 325 | CONFIG_PCI=y | ||
| 326 | CONFIG_PCI_DOMAINS=y | ||
| 327 | CONFIG_PCI_SYSCALL=y | ||
| 328 | # CONFIG_PCIEPORTBUS is not set | ||
| 329 | CONFIG_ARCH_SUPPORTS_MSI=y | ||
| 330 | CONFIG_PCI_MSI=y | ||
| 331 | # CONFIG_PCI_LEGACY is not set | ||
| 332 | # CONFIG_PCI_DEBUG is not set | ||
| 333 | # CONFIG_PCI_STUB is not set | ||
| 334 | # CONFIG_PCI_IOV is not set | ||
| 335 | CONFIG_PCCARD=y | ||
| 336 | # CONFIG_PCMCIA_DEBUG is not set | ||
| 337 | CONFIG_PCMCIA=y | ||
| 338 | CONFIG_PCMCIA_LOAD_CIS=y | ||
| 339 | CONFIG_PCMCIA_IOCTL=y | ||
| 340 | CONFIG_CARDBUS=y | ||
| 341 | |||
| 342 | # | ||
| 343 | # PC-card bridges | ||
| 344 | # | ||
| 345 | # CONFIG_YENTA is not set | ||
| 346 | # CONFIG_PD6729 is not set | ||
| 347 | # CONFIG_I82092 is not set | ||
| 348 | CONFIG_HOTPLUG_PCI=m | ||
| 349 | # CONFIG_HOTPLUG_PCI_FAKE is not set | ||
| 350 | # CONFIG_HOTPLUG_PCI_CPCI is not set | ||
| 351 | # CONFIG_HOTPLUG_PCI_SHPC is not set | ||
| 352 | # CONFIG_HAS_RAPIDIO is not set | ||
| 353 | # CONFIG_RELOCATABLE is not set | ||
| 354 | CONFIG_PAGE_OFFSET=0xc000000000000000 | ||
| 355 | CONFIG_KERNEL_START=0xc000000000000000 | ||
| 356 | CONFIG_PHYSICAL_START=0x00000000 | ||
| 357 | CONFIG_NET=y | ||
| 358 | CONFIG_COMPAT_NETLINK_MESSAGES=y | ||
| 359 | |||
| 360 | # | ||
| 361 | # Networking options | ||
| 362 | # | ||
| 363 | CONFIG_PACKET=y | ||
| 364 | # CONFIG_PACKET_MMAP is not set | ||
| 365 | CONFIG_UNIX=y | ||
| 366 | CONFIG_XFRM=y | ||
| 367 | CONFIG_XFRM_USER=m | ||
| 368 | # CONFIG_XFRM_SUB_POLICY is not set | ||
| 369 | # CONFIG_XFRM_MIGRATE is not set | ||
| 370 | # CONFIG_XFRM_STATISTICS is not set | ||
| 371 | CONFIG_XFRM_IPCOMP=m | ||
| 372 | CONFIG_NET_KEY=m | ||
| 373 | # CONFIG_NET_KEY_MIGRATE is not set | ||
| 374 | CONFIG_INET=y | ||
| 375 | CONFIG_IP_MULTICAST=y | ||
| 376 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
| 377 | CONFIG_IP_FIB_HASH=y | ||
| 378 | CONFIG_IP_PNP=y | ||
| 379 | CONFIG_IP_PNP_DHCP=y | ||
| 380 | CONFIG_IP_PNP_BOOTP=y | ||
| 381 | # CONFIG_IP_PNP_RARP is not set | ||
| 382 | CONFIG_NET_IPIP=y | ||
| 383 | # CONFIG_NET_IPGRE is not set | ||
| 384 | # CONFIG_IP_MROUTE is not set | ||
| 385 | # CONFIG_ARPD is not set | ||
| 386 | CONFIG_SYN_COOKIES=y | ||
| 387 | CONFIG_INET_AH=m | ||
| 388 | CONFIG_INET_ESP=m | ||
| 389 | CONFIG_INET_IPCOMP=m | ||
| 390 | CONFIG_INET_XFRM_TUNNEL=m | ||
| 391 | CONFIG_INET_TUNNEL=y | ||
| 392 | CONFIG_INET_XFRM_MODE_TRANSPORT=y | ||
| 393 | CONFIG_INET_XFRM_MODE_TUNNEL=y | ||
| 394 | CONFIG_INET_XFRM_MODE_BEET=y | ||
| 395 | CONFIG_INET_LRO=y | ||
| 396 | CONFIG_INET_DIAG=y | ||
| 397 | CONFIG_INET_TCP_DIAG=y | ||
| 398 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
| 399 | CONFIG_TCP_CONG_CUBIC=y | ||
| 400 | CONFIG_DEFAULT_TCP_CONG="cubic" | ||
| 401 | # CONFIG_TCP_MD5SIG is not set | ||
| 402 | # CONFIG_IPV6 is not set | ||
| 403 | # CONFIG_NETWORK_SECMARK is not set | ||
| 404 | CONFIG_NETFILTER=y | ||
| 405 | # CONFIG_NETFILTER_DEBUG is not set | ||
| 406 | CONFIG_NETFILTER_ADVANCED=y | ||
| 407 | |||
| 408 | # | ||
| 409 | # Core Netfilter Configuration | ||
| 410 | # | ||
| 411 | CONFIG_NETFILTER_NETLINK=m | ||
| 412 | CONFIG_NETFILTER_NETLINK_QUEUE=m | ||
| 413 | CONFIG_NETFILTER_NETLINK_LOG=m | ||
| 414 | CONFIG_NF_CONNTRACK=m | ||
| 415 | CONFIG_NF_CT_ACCT=y | ||
| 416 | CONFIG_NF_CONNTRACK_MARK=y | ||
| 417 | CONFIG_NF_CONNTRACK_EVENTS=y | ||
| 418 | # CONFIG_NF_CT_PROTO_DCCP is not set | ||
| 419 | CONFIG_NF_CT_PROTO_GRE=m | ||
| 420 | CONFIG_NF_CT_PROTO_SCTP=m | ||
| 421 | # CONFIG_NF_CT_PROTO_UDPLITE is not set | ||
| 422 | CONFIG_NF_CONNTRACK_AMANDA=m | ||
| 423 | CONFIG_NF_CONNTRACK_FTP=m | ||
| 424 | CONFIG_NF_CONNTRACK_H323=m | ||
| 425 | CONFIG_NF_CONNTRACK_IRC=m | ||
| 426 | CONFIG_NF_CONNTRACK_NETBIOS_NS=m | ||
| 427 | CONFIG_NF_CONNTRACK_PPTP=m | ||
| 428 | # CONFIG_NF_CONNTRACK_SANE is not set | ||
| 429 | CONFIG_NF_CONNTRACK_SIP=m | ||
| 430 | CONFIG_NF_CONNTRACK_TFTP=m | ||
| 431 | CONFIG_NF_CT_NETLINK=m | ||
| 432 | CONFIG_NETFILTER_TPROXY=m | ||
| 433 | CONFIG_NETFILTER_XTABLES=m | ||
| 434 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m | ||
| 435 | CONFIG_NETFILTER_XT_TARGET_CONNMARK=m | ||
| 436 | CONFIG_NETFILTER_XT_TARGET_DSCP=m | ||
| 437 | CONFIG_NETFILTER_XT_TARGET_HL=m | ||
| 438 | CONFIG_NETFILTER_XT_TARGET_MARK=m | ||
| 439 | CONFIG_NETFILTER_XT_TARGET_NFLOG=m | ||
| 440 | CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m | ||
| 441 | CONFIG_NETFILTER_XT_TARGET_NOTRACK=m | ||
| 442 | CONFIG_NETFILTER_XT_TARGET_RATEEST=m | ||
| 443 | CONFIG_NETFILTER_XT_TARGET_TPROXY=m | ||
| 444 | CONFIG_NETFILTER_XT_TARGET_TRACE=m | ||
| 445 | CONFIG_NETFILTER_XT_TARGET_TCPMSS=m | ||
| 446 | CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m | ||
| 447 | # CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set | ||
| 448 | CONFIG_NETFILTER_XT_MATCH_COMMENT=m | ||
| 449 | CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m | ||
| 450 | CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m | ||
| 451 | CONFIG_NETFILTER_XT_MATCH_CONNMARK=m | ||
| 452 | CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m | ||
| 453 | CONFIG_NETFILTER_XT_MATCH_DCCP=m | ||
| 454 | CONFIG_NETFILTER_XT_MATCH_DSCP=m | ||
| 455 | CONFIG_NETFILTER_XT_MATCH_ESP=m | ||
| 456 | CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m | ||
| 457 | CONFIG_NETFILTER_XT_MATCH_HELPER=m | ||
| 458 | CONFIG_NETFILTER_XT_MATCH_HL=m | ||
| 459 | CONFIG_NETFILTER_XT_MATCH_IPRANGE=m | ||
| 460 | CONFIG_NETFILTER_XT_MATCH_LENGTH=m | ||
| 461 | CONFIG_NETFILTER_XT_MATCH_LIMIT=m | ||
| 462 | CONFIG_NETFILTER_XT_MATCH_MAC=m | ||
| 463 | CONFIG_NETFILTER_XT_MATCH_MARK=m | ||
| 464 | CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m | ||
| 465 | CONFIG_NETFILTER_XT_MATCH_OWNER=m | ||
| 466 | CONFIG_NETFILTER_XT_MATCH_POLICY=m | ||
| 467 | CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m | ||
| 468 | CONFIG_NETFILTER_XT_MATCH_QUOTA=m | ||
| 469 | CONFIG_NETFILTER_XT_MATCH_RATEEST=m | ||
| 470 | CONFIG_NETFILTER_XT_MATCH_REALM=m | ||
| 471 | CONFIG_NETFILTER_XT_MATCH_RECENT=m | ||
| 472 | # CONFIG_NETFILTER_XT_MATCH_RECENT_PROC_COMPAT is not set | ||
| 473 | CONFIG_NETFILTER_XT_MATCH_SCTP=m | ||
| 474 | CONFIG_NETFILTER_XT_MATCH_SOCKET=m | ||
| 475 | CONFIG_NETFILTER_XT_MATCH_STATE=m | ||
| 476 | CONFIG_NETFILTER_XT_MATCH_STATISTIC=m | ||
| 477 | CONFIG_NETFILTER_XT_MATCH_STRING=m | ||
| 478 | CONFIG_NETFILTER_XT_MATCH_TCPMSS=m | ||
| 479 | # CONFIG_NETFILTER_XT_MATCH_TIME is not set | ||
| 480 | CONFIG_NETFILTER_XT_MATCH_U32=m | ||
| 481 | # CONFIG_NETFILTER_XT_MATCH_OSF is not set | ||
| 482 | # CONFIG_IP_VS is not set | ||
| 483 | |||
| 484 | # | ||
| 485 | # IP: Netfilter Configuration | ||
| 486 | # | ||
| 487 | CONFIG_NF_DEFRAG_IPV4=m | ||
| 488 | CONFIG_NF_CONNTRACK_IPV4=m | ||
| 489 | CONFIG_NF_CONNTRACK_PROC_COMPAT=y | ||
| 490 | CONFIG_IP_NF_QUEUE=m | ||
| 491 | CONFIG_IP_NF_IPTABLES=m | ||
| 492 | CONFIG_IP_NF_MATCH_ADDRTYPE=m | ||
| 493 | CONFIG_IP_NF_MATCH_AH=m | ||
| 494 | CONFIG_IP_NF_MATCH_ECN=m | ||
| 495 | CONFIG_IP_NF_MATCH_TTL=m | ||
| 496 | CONFIG_IP_NF_FILTER=m | ||
| 497 | CONFIG_IP_NF_TARGET_REJECT=m | ||
| 498 | CONFIG_IP_NF_TARGET_LOG=m | ||
| 499 | CONFIG_IP_NF_TARGET_ULOG=m | ||
| 500 | CONFIG_NF_NAT=m | ||
| 501 | CONFIG_NF_NAT_NEEDED=y | ||
| 502 | CONFIG_IP_NF_TARGET_MASQUERADE=m | ||
| 503 | CONFIG_IP_NF_TARGET_NETMAP=m | ||
| 504 | CONFIG_IP_NF_TARGET_REDIRECT=m | ||
| 505 | CONFIG_NF_NAT_SNMP_BASIC=m | ||
| 506 | CONFIG_NF_NAT_PROTO_GRE=m | ||
| 507 | CONFIG_NF_NAT_PROTO_SCTP=m | ||
| 508 | CONFIG_NF_NAT_FTP=m | ||
| 509 | CONFIG_NF_NAT_IRC=m | ||
| 510 | CONFIG_NF_NAT_TFTP=m | ||
| 511 | CONFIG_NF_NAT_AMANDA=m | ||
| 512 | CONFIG_NF_NAT_PPTP=m | ||
| 513 | CONFIG_NF_NAT_H323=m | ||
| 514 | CONFIG_NF_NAT_SIP=m | ||
| 515 | CONFIG_IP_NF_MANGLE=m | ||
| 516 | CONFIG_IP_NF_TARGET_CLUSTERIP=m | ||
| 517 | CONFIG_IP_NF_TARGET_ECN=m | ||
| 518 | CONFIG_IP_NF_TARGET_TTL=m | ||
| 519 | CONFIG_IP_NF_RAW=m | ||
| 520 | CONFIG_IP_NF_ARPTABLES=m | ||
| 521 | CONFIG_IP_NF_ARPFILTER=m | ||
| 522 | CONFIG_IP_NF_ARP_MANGLE=m | ||
| 523 | # CONFIG_IP_DCCP is not set | ||
| 524 | # CONFIG_IP_SCTP is not set | ||
| 525 | # CONFIG_RDS is not set | ||
| 526 | # CONFIG_TIPC is not set | ||
| 527 | # CONFIG_ATM is not set | ||
| 528 | # CONFIG_BRIDGE is not set | ||
| 529 | # CONFIG_NET_DSA is not set | ||
| 530 | # CONFIG_VLAN_8021Q is not set | ||
| 531 | # CONFIG_DECNET is not set | ||
| 532 | CONFIG_LLC=y | ||
| 533 | # CONFIG_LLC2 is not set | ||
| 534 | # CONFIG_IPX is not set | ||
| 535 | # CONFIG_ATALK is not set | ||
| 536 | # CONFIG_X25 is not set | ||
| 537 | # CONFIG_LAPB is not set | ||
| 538 | # CONFIG_ECONET is not set | ||
| 539 | # CONFIG_WAN_ROUTER is not set | ||
| 540 | # CONFIG_PHONET is not set | ||
| 541 | # CONFIG_IEEE802154 is not set | ||
| 542 | # CONFIG_NET_SCHED is not set | ||
| 543 | CONFIG_NET_CLS_ROUTE=y | ||
| 544 | # CONFIG_DCB is not set | ||
| 545 | |||
| 546 | # | ||
| 547 | # Network testing | ||
| 548 | # | ||
| 549 | # CONFIG_NET_PKTGEN is not set | ||
| 550 | # CONFIG_NET_DROP_MONITOR is not set | ||
| 551 | # CONFIG_HAMRADIO is not set | ||
| 552 | # CONFIG_CAN is not set | ||
| 553 | # CONFIG_IRDA is not set | ||
| 554 | # CONFIG_BT is not set | ||
| 555 | # CONFIG_AF_RXRPC is not set | ||
| 556 | CONFIG_WIRELESS=y | ||
| 557 | # CONFIG_CFG80211 is not set | ||
| 558 | CONFIG_CFG80211_DEFAULT_PS_VALUE=0 | ||
| 559 | CONFIG_WIRELESS_OLD_REGULATORY=y | ||
| 560 | CONFIG_WIRELESS_EXT=y | ||
| 561 | CONFIG_WIRELESS_EXT_SYSFS=y | ||
| 562 | # CONFIG_LIB80211 is not set | ||
| 563 | |||
| 564 | # | ||
| 565 | # CFG80211 needs to be enabled for MAC80211 | ||
| 566 | # | ||
| 567 | # CONFIG_WIMAX is not set | ||
| 568 | # CONFIG_RFKILL is not set | ||
| 569 | # CONFIG_NET_9P is not set | ||
| 570 | |||
| 571 | # | ||
| 572 | # Device Drivers | ||
| 573 | # | ||
| 574 | |||
| 575 | # | ||
| 576 | # Generic Driver Options | ||
| 577 | # | ||
| 578 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
| 579 | # CONFIG_DEVTMPFS is not set | ||
| 580 | CONFIG_STANDALONE=y | ||
| 581 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
| 582 | CONFIG_FW_LOADER=y | ||
| 583 | CONFIG_FIRMWARE_IN_KERNEL=y | ||
| 584 | CONFIG_EXTRA_FIRMWARE="" | ||
| 585 | # CONFIG_DEBUG_DRIVER is not set | ||
| 586 | # CONFIG_DEBUG_DEVRES is not set | ||
| 587 | # CONFIG_SYS_HYPERVISOR is not set | ||
| 588 | # CONFIG_CONNECTOR is not set | ||
| 589 | # CONFIG_MTD is not set | ||
| 590 | CONFIG_OF_DEVICE=y | ||
| 591 | CONFIG_OF_I2C=y | ||
| 592 | CONFIG_OF_MDIO=y | ||
| 593 | # CONFIG_PARPORT is not set | ||
| 594 | CONFIG_BLK_DEV=y | ||
| 595 | CONFIG_BLK_DEV_FD=y | ||
| 596 | # CONFIG_BLK_CPQ_CISS_DA is not set | ||
| 597 | # CONFIG_BLK_DEV_DAC960 is not set | ||
| 598 | # CONFIG_BLK_DEV_UMEM is not set | ||
| 599 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
| 600 | CONFIG_BLK_DEV_LOOP=y | ||
| 601 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | ||
| 602 | CONFIG_BLK_DEV_NBD=m | ||
| 603 | # CONFIG_BLK_DEV_SX8 is not set | ||
| 604 | # CONFIG_BLK_DEV_UB is not set | ||
| 605 | CONFIG_BLK_DEV_RAM=y | ||
| 606 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
| 607 | CONFIG_BLK_DEV_RAM_SIZE=65536 | ||
| 608 | # CONFIG_BLK_DEV_XIP is not set | ||
| 609 | # CONFIG_CDROM_PKTCDVD is not set | ||
| 610 | # CONFIG_ATA_OVER_ETH is not set | ||
| 611 | # CONFIG_BLK_DEV_HD is not set | ||
| 612 | CONFIG_MISC_DEVICES=y | ||
| 613 | # CONFIG_PHANTOM is not set | ||
| 614 | # CONFIG_SGI_IOC4 is not set | ||
| 615 | # CONFIG_TIFM_CORE is not set | ||
| 616 | # CONFIG_ICS932S401 is not set | ||
| 617 | # CONFIG_ENCLOSURE_SERVICES is not set | ||
| 618 | # CONFIG_HP_ILO is not set | ||
| 619 | # CONFIG_ISL29003 is not set | ||
| 620 | # CONFIG_C2PORT is not set | ||
| 621 | |||
| 622 | # | ||
| 623 | # EEPROM support | ||
| 624 | # | ||
| 625 | # CONFIG_EEPROM_AT24 is not set | ||
| 626 | # CONFIG_EEPROM_LEGACY is not set | ||
| 627 | # CONFIG_EEPROM_MAX6875 is not set | ||
| 628 | # CONFIG_EEPROM_93CX6 is not set | ||
| 629 | # CONFIG_CB710_CORE is not set | ||
| 630 | CONFIG_HAVE_IDE=y | ||
| 631 | CONFIG_IDE=y | ||
| 632 | |||
| 633 | # | ||
| 634 | # Please see Documentation/ide/ide.txt for help/info on IDE drives | ||
| 635 | # | ||
| 636 | CONFIG_IDE_XFER_MODE=y | ||
| 637 | CONFIG_IDE_TIMINGS=y | ||
| 638 | CONFIG_IDE_ATAPI=y | ||
| 639 | # CONFIG_BLK_DEV_IDE_SATA is not set | ||
| 640 | CONFIG_IDE_GD=y | ||
| 641 | CONFIG_IDE_GD_ATA=y | ||
| 642 | # CONFIG_IDE_GD_ATAPI is not set | ||
| 643 | # CONFIG_BLK_DEV_IDECS is not set | ||
| 644 | # CONFIG_BLK_DEV_DELKIN is not set | ||
| 645 | CONFIG_BLK_DEV_IDECD=y | ||
| 646 | CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y | ||
| 647 | # CONFIG_BLK_DEV_IDETAPE is not set | ||
| 648 | # CONFIG_IDE_TASK_IOCTL is not set | ||
| 649 | CONFIG_IDE_PROC_FS=y | ||
| 650 | |||
| 651 | # | ||
| 652 | # IDE chipset support/bugfixes | ||
| 653 | # | ||
| 654 | # CONFIG_BLK_DEV_PLATFORM is not set | ||
| 655 | CONFIG_BLK_DEV_IDEDMA_SFF=y | ||
| 656 | |||
| 657 | # | ||
| 658 | # PCI IDE chipsets support | ||
| 659 | # | ||
| 660 | CONFIG_BLK_DEV_IDEPCI=y | ||
| 661 | CONFIG_IDEPCI_PCIBUS_ORDER=y | ||
| 662 | # CONFIG_BLK_DEV_OFFBOARD is not set | ||
| 663 | CONFIG_BLK_DEV_GENERIC=y | ||
| 664 | # CONFIG_BLK_DEV_OPTI621 is not set | ||
| 665 | CONFIG_BLK_DEV_IDEDMA_PCI=y | ||
| 666 | # CONFIG_BLK_DEV_AEC62XX is not set | ||
| 667 | # CONFIG_BLK_DEV_ALI15X3 is not set | ||
| 668 | CONFIG_BLK_DEV_AMD74XX=y | ||
| 669 | # CONFIG_BLK_DEV_CMD64X is not set | ||
| 670 | # CONFIG_BLK_DEV_TRIFLEX is not set | ||
| 671 | # CONFIG_BLK_DEV_CS5520 is not set | ||
| 672 | # CONFIG_BLK_DEV_CS5530 is not set | ||
| 673 | # CONFIG_BLK_DEV_HPT366 is not set | ||
| 674 | # CONFIG_BLK_DEV_JMICRON is not set | ||
| 675 | # CONFIG_BLK_DEV_SC1200 is not set | ||
| 676 | # CONFIG_BLK_DEV_PIIX is not set | ||
| 677 | # CONFIG_BLK_DEV_IT8172 is not set | ||
| 678 | # CONFIG_BLK_DEV_IT8213 is not set | ||
| 679 | # CONFIG_BLK_DEV_IT821X is not set | ||
| 680 | # CONFIG_BLK_DEV_NS87415 is not set | ||
| 681 | # CONFIG_BLK_DEV_PDC202XX_OLD is not set | ||
| 682 | # CONFIG_BLK_DEV_PDC202XX_NEW is not set | ||
| 683 | # CONFIG_BLK_DEV_SVWKS is not set | ||
| 684 | # CONFIG_BLK_DEV_SIIMAGE is not set | ||
| 685 | # CONFIG_BLK_DEV_SL82C105 is not set | ||
| 686 | # CONFIG_BLK_DEV_SLC90E66 is not set | ||
| 687 | # CONFIG_BLK_DEV_TRM290 is not set | ||
| 688 | # CONFIG_BLK_DEV_VIA82CXXX is not set | ||
| 689 | # CONFIG_BLK_DEV_TC86C001 is not set | ||
| 690 | CONFIG_BLK_DEV_IDEDMA=y | ||
| 691 | |||
| 692 | # | ||
| 693 | # SCSI device support | ||
| 694 | # | ||
| 695 | # CONFIG_RAID_ATTRS is not set | ||
| 696 | CONFIG_SCSI=y | ||
| 697 | CONFIG_SCSI_DMA=y | ||
| 698 | # CONFIG_SCSI_TGT is not set | ||
| 699 | CONFIG_SCSI_NETLINK=y | ||
| 700 | CONFIG_SCSI_PROC_FS=y | ||
| 701 | |||
| 702 | # | ||
| 703 | # SCSI support type (disk, tape, CD-ROM) | ||
| 704 | # | ||
| 705 | CONFIG_BLK_DEV_SD=y | ||
| 706 | CONFIG_CHR_DEV_ST=y | ||
| 707 | # CONFIG_CHR_DEV_OSST is not set | ||
| 708 | CONFIG_BLK_DEV_SR=y | ||
| 709 | CONFIG_BLK_DEV_SR_VENDOR=y | ||
| 710 | CONFIG_CHR_DEV_SG=y | ||
| 711 | # CONFIG_CHR_DEV_SCH is not set | ||
| 712 | CONFIG_SCSI_MULTI_LUN=y | ||
| 713 | CONFIG_SCSI_CONSTANTS=y | ||
| 714 | # CONFIG_SCSI_LOGGING is not set | ||
| 715 | # CONFIG_SCSI_SCAN_ASYNC is not set | ||
| 716 | CONFIG_SCSI_WAIT_SCAN=m | ||
| 717 | |||
| 718 | # | ||
| 719 | # SCSI Transports | ||
| 720 | # | ||
| 721 | CONFIG_SCSI_SPI_ATTRS=y | ||
| 722 | CONFIG_SCSI_FC_ATTRS=y | ||
| 723 | CONFIG_SCSI_ISCSI_ATTRS=m | ||
| 724 | # CONFIG_SCSI_SAS_ATTRS is not set | ||
| 725 | # CONFIG_SCSI_SAS_LIBSAS is not set | ||
| 726 | CONFIG_SCSI_SRP_ATTRS=y | ||
| 727 | CONFIG_SCSI_LOWLEVEL=y | ||
| 728 | # CONFIG_ISCSI_TCP is not set | ||
| 729 | # CONFIG_SCSI_CXGB3_ISCSI is not set | ||
| 730 | # CONFIG_SCSI_BNX2_ISCSI is not set | ||
| 731 | # CONFIG_BE2ISCSI is not set | ||
| 732 | # CONFIG_BLK_DEV_3W_XXXX_RAID is not set | ||
| 733 | # CONFIG_SCSI_3W_9XXX is not set | ||
| 734 | # CONFIG_SCSI_ACARD is not set | ||
| 735 | # CONFIG_SCSI_AACRAID is not set | ||
| 736 | # CONFIG_SCSI_AIC7XXX is not set | ||
| 737 | # CONFIG_SCSI_AIC7XXX_OLD is not set | ||
| 738 | # CONFIG_SCSI_AIC79XX is not set | ||
| 739 | # CONFIG_SCSI_AIC94XX is not set | ||
| 740 | # CONFIG_SCSI_MVSAS is not set | ||
| 741 | # CONFIG_SCSI_ARCMSR is not set | ||
| 742 | # CONFIG_MEGARAID_NEWGEN is not set | ||
| 743 | # CONFIG_MEGARAID_LEGACY is not set | ||
| 744 | # CONFIG_MEGARAID_SAS is not set | ||
| 745 | # CONFIG_SCSI_MPT2SAS is not set | ||
| 746 | # CONFIG_SCSI_HPTIOP is not set | ||
| 747 | # CONFIG_LIBFC is not set | ||
| 748 | # CONFIG_LIBFCOE is not set | ||
| 749 | # CONFIG_FCOE is not set | ||
| 750 | # CONFIG_SCSI_DMX3191D is not set | ||
| 751 | # CONFIG_SCSI_EATA is not set | ||
| 752 | # CONFIG_SCSI_FUTURE_DOMAIN is not set | ||
| 753 | # CONFIG_SCSI_GDTH is not set | ||
| 754 | # CONFIG_SCSI_IPS is not set | ||
| 755 | # CONFIG_SCSI_INITIO is not set | ||
| 756 | # CONFIG_SCSI_INIA100 is not set | ||
| 757 | # CONFIG_SCSI_STEX is not set | ||
| 758 | CONFIG_SCSI_SYM53C8XX_2=y | ||
| 759 | CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 | ||
| 760 | CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 | ||
| 761 | CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 | ||
| 762 | CONFIG_SCSI_SYM53C8XX_MMIO=y | ||
| 763 | CONFIG_SCSI_IPR=y | ||
| 764 | CONFIG_SCSI_IPR_TRACE=y | ||
| 765 | CONFIG_SCSI_IPR_DUMP=y | ||
| 766 | # CONFIG_SCSI_QLOGIC_1280 is not set | ||
| 767 | # CONFIG_SCSI_QLA_FC is not set | ||
| 768 | # CONFIG_SCSI_QLA_ISCSI is not set | ||
| 769 | CONFIG_SCSI_LPFC=m | ||
| 770 | # CONFIG_SCSI_LPFC_DEBUG_FS is not set | ||
| 771 | # CONFIG_SCSI_DC395x is not set | ||
| 772 | # CONFIG_SCSI_DC390T is not set | ||
| 773 | CONFIG_SCSI_DEBUG=m | ||
| 774 | # CONFIG_SCSI_PMCRAID is not set | ||
| 775 | # CONFIG_SCSI_SRP is not set | ||
| 776 | # CONFIG_SCSI_BFA_FC is not set | ||
| 777 | # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set | ||
| 778 | # CONFIG_SCSI_DH is not set | ||
| 779 | # CONFIG_SCSI_OSD_INITIATOR is not set | ||
| 780 | CONFIG_ATA=y | ||
| 781 | # CONFIG_ATA_NONSTANDARD is not set | ||
| 782 | CONFIG_ATA_VERBOSE_ERROR=y | ||
| 783 | CONFIG_SATA_PMP=y | ||
| 784 | # CONFIG_SATA_AHCI is not set | ||
| 785 | CONFIG_SATA_SIL24=y | ||
| 786 | CONFIG_ATA_SFF=y | ||
| 787 | CONFIG_SATA_SVW=y | ||
| 788 | # CONFIG_ATA_PIIX is not set | ||
| 789 | # CONFIG_SATA_MV is not set | ||
| 790 | # CONFIG_SATA_NV is not set | ||
| 791 | # CONFIG_PDC_ADMA is not set | ||
| 792 | # CONFIG_SATA_QSTOR is not set | ||
| 793 | # CONFIG_SATA_PROMISE is not set | ||
| 794 | # CONFIG_SATA_SX4 is not set | ||
| 795 | # CONFIG_SATA_SIL is not set | ||
| 796 | # CONFIG_SATA_SIS is not set | ||
| 797 | # CONFIG_SATA_ULI is not set | ||
| 798 | # CONFIG_SATA_VIA is not set | ||
| 799 | # CONFIG_SATA_VITESSE is not set | ||
| 800 | # CONFIG_SATA_INIC162X is not set | ||
| 801 | # CONFIG_PATA_ALI is not set | ||
| 802 | # CONFIG_PATA_AMD is not set | ||
| 803 | # CONFIG_PATA_ARTOP is not set | ||
| 804 | # CONFIG_PATA_ATP867X is not set | ||
| 805 | # CONFIG_PATA_ATIIXP is not set | ||
| 806 | # CONFIG_PATA_CMD640_PCI is not set | ||
| 807 | # CONFIG_PATA_CMD64X is not set | ||
| 808 | # CONFIG_PATA_CS5520 is not set | ||
| 809 | # CONFIG_PATA_CS5530 is not set | ||
| 810 | # CONFIG_PATA_CYPRESS is not set | ||
| 811 | # CONFIG_PATA_EFAR is not set | ||
| 812 | # CONFIG_ATA_GENERIC is not set | ||
| 813 | # CONFIG_PATA_HPT366 is not set | ||
| 814 | # CONFIG_PATA_HPT37X is not set | ||
| 815 | # CONFIG_PATA_HPT3X2N is not set | ||
| 816 | # CONFIG_PATA_HPT3X3 is not set | ||
| 817 | # CONFIG_PATA_IT821X is not set | ||
| 818 | # CONFIG_PATA_IT8213 is not set | ||
| 819 | # CONFIG_PATA_JMICRON is not set | ||
| 820 | # CONFIG_PATA_TRIFLEX is not set | ||
| 821 | # CONFIG_PATA_MARVELL is not set | ||
| 822 | # CONFIG_PATA_MPIIX is not set | ||
| 823 | # CONFIG_PATA_OLDPIIX is not set | ||
| 824 | # CONFIG_PATA_NETCELL is not set | ||
| 825 | # CONFIG_PATA_NINJA32 is not set | ||
| 826 | # CONFIG_PATA_NS87410 is not set | ||
| 827 | # CONFIG_PATA_NS87415 is not set | ||
| 828 | # CONFIG_PATA_OPTI is not set | ||
| 829 | # CONFIG_PATA_OPTIDMA is not set | ||
| 830 | # CONFIG_PATA_PCMCIA is not set | ||
| 831 | # CONFIG_PATA_PDC_OLD is not set | ||
| 832 | # CONFIG_PATA_RADISYS is not set | ||
| 833 | # CONFIG_PATA_RDC is not set | ||
| 834 | # CONFIG_PATA_RZ1000 is not set | ||
| 835 | # CONFIG_PATA_SC1200 is not set | ||
| 836 | # CONFIG_PATA_SERVERWORKS is not set | ||
| 837 | # CONFIG_PATA_PDC2027X is not set | ||
| 838 | # CONFIG_PATA_SIL680 is not set | ||
| 839 | # CONFIG_PATA_SIS is not set | ||
| 840 | # CONFIG_PATA_VIA is not set | ||
| 841 | # CONFIG_PATA_WINBOND is not set | ||
| 842 | # CONFIG_PATA_PLATFORM is not set | ||
| 843 | # CONFIG_PATA_SCH is not set | ||
| 844 | CONFIG_MD=y | ||
| 845 | CONFIG_BLK_DEV_MD=y | ||
| 846 | CONFIG_MD_AUTODETECT=y | ||
| 847 | CONFIG_MD_LINEAR=y | ||
| 848 | CONFIG_MD_RAID0=y | ||
| 849 | CONFIG_MD_RAID1=y | ||
| 850 | CONFIG_MD_RAID10=y | ||
| 851 | CONFIG_MD_RAID456=y | ||
| 852 | # CONFIG_MULTICORE_RAID456 is not set | ||
| 853 | CONFIG_MD_RAID6_PQ=y | ||
| 854 | # CONFIG_ASYNC_RAID6_TEST is not set | ||
| 855 | CONFIG_MD_MULTIPATH=m | ||
| 856 | CONFIG_MD_FAULTY=m | ||
| 857 | CONFIG_BLK_DEV_DM=y | ||
| 858 | # CONFIG_DM_DEBUG is not set | ||
| 859 | CONFIG_DM_CRYPT=m | ||
| 860 | CONFIG_DM_SNAPSHOT=m | ||
| 861 | CONFIG_DM_MIRROR=m | ||
| 862 | # CONFIG_DM_LOG_USERSPACE is not set | ||
| 863 | CONFIG_DM_ZERO=m | ||
| 864 | CONFIG_DM_MULTIPATH=m | ||
| 865 | # CONFIG_DM_MULTIPATH_QL is not set | ||
| 866 | # CONFIG_DM_MULTIPATH_ST is not set | ||
| 867 | # CONFIG_DM_DELAY is not set | ||
| 868 | # CONFIG_DM_UEVENT is not set | ||
| 869 | # CONFIG_FUSION is not set | ||
| 870 | |||
| 871 | # | ||
| 872 | # IEEE 1394 (FireWire) support | ||
| 873 | # | ||
| 874 | |||
| 875 | # | ||
| 876 | # You can enable one or both FireWire driver stacks. | ||
| 877 | # | ||
| 878 | |||
| 879 | # | ||
| 880 | # See the help texts for more information. | ||
| 881 | # | ||
| 882 | # CONFIG_FIREWIRE is not set | ||
| 883 | CONFIG_IEEE1394=y | ||
| 884 | CONFIG_IEEE1394_OHCI1394=y | ||
| 885 | # CONFIG_IEEE1394_PCILYNX is not set | ||
| 886 | CONFIG_IEEE1394_SBP2=m | ||
| 887 | CONFIG_IEEE1394_ETH1394_ROM_ENTRY=y | ||
| 888 | CONFIG_IEEE1394_ETH1394=m | ||
| 889 | CONFIG_IEEE1394_RAWIO=y | ||
| 890 | CONFIG_IEEE1394_VIDEO1394=m | ||
| 891 | CONFIG_IEEE1394_DV1394=m | ||
| 892 | # CONFIG_IEEE1394_VERBOSEDEBUG is not set | ||
| 893 | # CONFIG_I2O is not set | ||
| 894 | CONFIG_MACINTOSH_DRIVERS=y | ||
| 895 | # CONFIG_MAC_EMUMOUSEBTN is not set | ||
| 896 | CONFIG_WINDFARM=y | ||
| 897 | CONFIG_NETDEVICES=y | ||
| 898 | CONFIG_DUMMY=m | ||
| 899 | CONFIG_BONDING=m | ||
| 900 | # CONFIG_MACVLAN is not set | ||
| 901 | # CONFIG_EQUALIZER is not set | ||
| 902 | CONFIG_TUN=m | ||
| 903 | # CONFIG_VETH is not set | ||
| 904 | # CONFIG_ARCNET is not set | ||
| 905 | CONFIG_PHYLIB=y | ||
| 906 | |||
| 907 | # | ||
| 908 | # MII PHY device drivers | ||
| 909 | # | ||
| 910 | CONFIG_MARVELL_PHY=y | ||
| 911 | # CONFIG_DAVICOM_PHY is not set | ||
| 912 | # CONFIG_QSEMI_PHY is not set | ||
| 913 | # CONFIG_LXT_PHY is not set | ||
| 914 | # CONFIG_CICADA_PHY is not set | ||
| 915 | # CONFIG_VITESSE_PHY is not set | ||
| 916 | # CONFIG_SMSC_PHY is not set | ||
| 917 | CONFIG_BROADCOM_PHY=m | ||
| 918 | # CONFIG_ICPLUS_PHY is not set | ||
| 919 | # CONFIG_REALTEK_PHY is not set | ||
| 920 | # CONFIG_NATIONAL_PHY is not set | ||
| 921 | # CONFIG_STE10XP is not set | ||
| 922 | # CONFIG_LSI_ET1011C_PHY is not set | ||
| 923 | # CONFIG_FIXED_PHY is not set | ||
| 924 | # CONFIG_MDIO_BITBANG is not set | ||
| 925 | CONFIG_NET_ETHERNET=y | ||
| 926 | CONFIG_MII=y | ||
| 927 | # CONFIG_HAPPYMEAL is not set | ||
| 928 | CONFIG_SUNGEM=y | ||
| 929 | # CONFIG_CASSINI is not set | ||
| 930 | CONFIG_NET_VENDOR_3COM=y | ||
| 931 | CONFIG_VORTEX=y | ||
| 932 | # CONFIG_TYPHOON is not set | ||
| 933 | # CONFIG_ETHOC is not set | ||
| 934 | # CONFIG_DNET is not set | ||
| 935 | # CONFIG_NET_TULIP is not set | ||
| 936 | # CONFIG_HP100 is not set | ||
| 937 | # CONFIG_IBM_NEW_EMAC_ZMII is not set | ||
| 938 | # CONFIG_IBM_NEW_EMAC_RGMII is not set | ||
| 939 | # CONFIG_IBM_NEW_EMAC_TAH is not set | ||
| 940 | # CONFIG_IBM_NEW_EMAC_EMAC4 is not set | ||
| 941 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set | ||
| 942 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set | ||
| 943 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | ||
| 944 | CONFIG_NET_PCI=y | ||
| 945 | CONFIG_PCNET32=y | ||
| 946 | # CONFIG_AMD8111_ETH is not set | ||
| 947 | # CONFIG_ADAPTEC_STARFIRE is not set | ||
| 948 | # CONFIG_B44 is not set | ||
| 949 | # CONFIG_FORCEDETH is not set | ||
| 950 | CONFIG_E100=y | ||
| 951 | # CONFIG_FEALNX is not set | ||
| 952 | # CONFIG_NATSEMI is not set | ||
| 953 | # CONFIG_NE2K_PCI is not set | ||
| 954 | # CONFIG_8139CP is not set | ||
| 955 | # CONFIG_8139TOO is not set | ||
| 956 | # CONFIG_R6040 is not set | ||
| 957 | # CONFIG_SIS900 is not set | ||
| 958 | # CONFIG_EPIC100 is not set | ||
| 959 | # CONFIG_SMSC9420 is not set | ||
| 960 | # CONFIG_SUNDANCE is not set | ||
| 961 | # CONFIG_TLAN is not set | ||
| 962 | # CONFIG_KS8842 is not set | ||
| 963 | # CONFIG_KS8851_MLL is not set | ||
| 964 | # CONFIG_VIA_RHINE is not set | ||
| 965 | # CONFIG_SC92031 is not set | ||
| 966 | # CONFIG_ATL2 is not set | ||
| 967 | CONFIG_NETDEV_1000=y | ||
| 968 | CONFIG_ACENIC=y | ||
| 969 | CONFIG_ACENIC_OMIT_TIGON_I=y | ||
| 970 | # CONFIG_DL2K is not set | ||
| 971 | CONFIG_E1000=y | ||
| 972 | # CONFIG_E1000E is not set | ||
| 973 | # CONFIG_IP1000 is not set | ||
| 974 | # CONFIG_IGB is not set | ||
| 975 | # CONFIG_IGBVF is not set | ||
| 976 | # CONFIG_NS83820 is not set | ||
| 977 | # CONFIG_HAMACHI is not set | ||
| 978 | # CONFIG_YELLOWFIN is not set | ||
| 979 | # CONFIG_R8169 is not set | ||
| 980 | # CONFIG_SIS190 is not set | ||
| 981 | # CONFIG_SKGE is not set | ||
| 982 | # CONFIG_SKY2 is not set | ||
| 983 | # CONFIG_VIA_VELOCITY is not set | ||
| 984 | CONFIG_TIGON3=y | ||
| 985 | # CONFIG_BNX2 is not set | ||
| 986 | # CONFIG_CNIC is not set | ||
| 987 | # CONFIG_QLA3XXX is not set | ||
| 988 | # CONFIG_ATL1 is not set | ||
| 989 | # CONFIG_ATL1E is not set | ||
| 990 | # CONFIG_ATL1C is not set | ||
| 991 | # CONFIG_JME is not set | ||
| 992 | CONFIG_NETDEV_10000=y | ||
| 993 | # CONFIG_CHELSIO_T1 is not set | ||
| 994 | CONFIG_CHELSIO_T3_DEPENDS=y | ||
| 995 | # CONFIG_CHELSIO_T3 is not set | ||
| 996 | # CONFIG_ENIC is not set | ||
| 997 | # CONFIG_IXGBE is not set | ||
| 998 | CONFIG_IXGB=m | ||
| 999 | # CONFIG_S2IO is not set | ||
| 1000 | # CONFIG_VXGE is not set | ||
| 1001 | # CONFIG_MYRI10GE is not set | ||
| 1002 | # CONFIG_NETXEN_NIC is not set | ||
| 1003 | # CONFIG_NIU is not set | ||
| 1004 | # CONFIG_MLX4_EN is not set | ||
| 1005 | # CONFIG_MLX4_CORE is not set | ||
| 1006 | # CONFIG_TEHUTI is not set | ||
| 1007 | # CONFIG_BNX2X is not set | ||
| 1008 | # CONFIG_QLGE is not set | ||
| 1009 | # CONFIG_SFC is not set | ||
| 1010 | # CONFIG_BE2NET is not set | ||
| 1011 | CONFIG_TR=y | ||
| 1012 | CONFIG_IBMOL=y | ||
| 1013 | # CONFIG_3C359 is not set | ||
| 1014 | # CONFIG_TMS380TR is not set | ||
| 1015 | CONFIG_WLAN=y | ||
| 1016 | # CONFIG_WLAN_PRE80211 is not set | ||
| 1017 | # CONFIG_WLAN_80211 is not set | ||
| 1018 | |||
| 1019 | # | ||
| 1020 | # Enable WiMAX (Networking options) to see the WiMAX drivers | ||
| 1021 | # | ||
| 1022 | |||
| 1023 | # | ||
| 1024 | # USB Network Adapters | ||
| 1025 | # | ||
| 1026 | # CONFIG_USB_CATC is not set | ||
| 1027 | # CONFIG_USB_KAWETH is not set | ||
| 1028 | # CONFIG_USB_PEGASUS is not set | ||
| 1029 | # CONFIG_USB_RTL8150 is not set | ||
| 1030 | # CONFIG_USB_USBNET is not set | ||
| 1031 | # CONFIG_NET_PCMCIA is not set | ||
| 1032 | # CONFIG_WAN is not set | ||
| 1033 | # CONFIG_FDDI is not set | ||
| 1034 | # CONFIG_HIPPI is not set | ||
| 1035 | CONFIG_PPP=m | ||
| 1036 | # CONFIG_PPP_MULTILINK is not set | ||
| 1037 | # CONFIG_PPP_FILTER is not set | ||
| 1038 | CONFIG_PPP_ASYNC=m | ||
| 1039 | CONFIG_PPP_SYNC_TTY=m | ||
| 1040 | CONFIG_PPP_DEFLATE=m | ||
| 1041 | CONFIG_PPP_BSDCOMP=m | ||
| 1042 | # CONFIG_PPP_MPPE is not set | ||
| 1043 | CONFIG_PPPOE=m | ||
| 1044 | # CONFIG_PPPOL2TP is not set | ||
| 1045 | # CONFIG_SLIP is not set | ||
| 1046 | CONFIG_SLHC=m | ||
| 1047 | # CONFIG_NET_FC is not set | ||
| 1048 | CONFIG_NETCONSOLE=y | ||
| 1049 | # CONFIG_NETCONSOLE_DYNAMIC is not set | ||
| 1050 | CONFIG_NETPOLL=y | ||
| 1051 | CONFIG_NETPOLL_TRAP=y | ||
| 1052 | CONFIG_NET_POLL_CONTROLLER=y | ||
| 1053 | # CONFIG_ISDN is not set | ||
| 1054 | # CONFIG_PHONE is not set | ||
| 1055 | |||
| 1056 | # | ||
| 1057 | # Input device support | ||
| 1058 | # | ||
| 1059 | CONFIG_INPUT=y | ||
| 1060 | # CONFIG_INPUT_FF_MEMLESS is not set | ||
| 1061 | # CONFIG_INPUT_POLLDEV is not set | ||
| 1062 | |||
| 1063 | # | ||
| 1064 | # Userland interfaces | ||
| 1065 | # | ||
| 1066 | CONFIG_INPUT_MOUSEDEV=y | ||
| 1067 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | ||
| 1068 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 | ||
| 1069 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 | ||
| 1070 | # CONFIG_INPUT_JOYDEV is not set | ||
| 1071 | CONFIG_INPUT_EVDEV=m | ||
| 1072 | # CONFIG_INPUT_EVBUG is not set | ||
| 1073 | |||
| 1074 | # | ||
| 1075 | # Input Device Drivers | ||
| 1076 | # | ||
| 1077 | CONFIG_INPUT_KEYBOARD=y | ||
| 1078 | # CONFIG_KEYBOARD_ADP5588 is not set | ||
| 1079 | CONFIG_KEYBOARD_ATKBD=y | ||
| 1080 | # CONFIG_QT2160 is not set | ||
| 1081 | # CONFIG_KEYBOARD_LKKBD is not set | ||
| 1082 | # CONFIG_KEYBOARD_MAX7359 is not set | ||
| 1083 | # CONFIG_KEYBOARD_NEWTON is not set | ||
| 1084 | # CONFIG_KEYBOARD_OPENCORES is not set | ||
| 1085 | # CONFIG_KEYBOARD_STOWAWAY is not set | ||
| 1086 | # CONFIG_KEYBOARD_SUNKBD is not set | ||
| 1087 | # CONFIG_KEYBOARD_XTKBD is not set | ||
| 1088 | CONFIG_INPUT_MOUSE=y | ||
| 1089 | CONFIG_MOUSE_PS2=y | ||
| 1090 | CONFIG_MOUSE_PS2_ALPS=y | ||
| 1091 | CONFIG_MOUSE_PS2_LOGIPS2PP=y | ||
| 1092 | CONFIG_MOUSE_PS2_SYNAPTICS=y | ||
| 1093 | CONFIG_MOUSE_PS2_TRACKPOINT=y | ||
| 1094 | # CONFIG_MOUSE_PS2_ELANTECH is not set | ||
| 1095 | # CONFIG_MOUSE_PS2_SENTELIC is not set | ||
| 1096 | # CONFIG_MOUSE_PS2_TOUCHKIT is not set | ||
| 1097 | # CONFIG_MOUSE_SERIAL is not set | ||
| 1098 | # CONFIG_MOUSE_APPLETOUCH is not set | ||
| 1099 | # CONFIG_MOUSE_BCM5974 is not set | ||
| 1100 | # CONFIG_MOUSE_VSXXXAA is not set | ||
| 1101 | # CONFIG_MOUSE_SYNAPTICS_I2C is not set | ||
| 1102 | # CONFIG_INPUT_JOYSTICK is not set | ||
| 1103 | # CONFIG_INPUT_TABLET is not set | ||
| 1104 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
| 1105 | CONFIG_INPUT_MISC=y | ||
| 1106 | # CONFIG_INPUT_ATI_REMOTE is not set | ||
| 1107 | # CONFIG_INPUT_ATI_REMOTE2 is not set | ||
| 1108 | # CONFIG_INPUT_KEYSPAN_REMOTE is not set | ||
| 1109 | # CONFIG_INPUT_POWERMATE is not set | ||
| 1110 | # CONFIG_INPUT_YEALINK is not set | ||
| 1111 | # CONFIG_INPUT_CM109 is not set | ||
| 1112 | # CONFIG_INPUT_UINPUT is not set | ||
| 1113 | |||
| 1114 | # | ||
| 1115 | # Hardware I/O ports | ||
| 1116 | # | ||
| 1117 | CONFIG_SERIO=y | ||
| 1118 | CONFIG_SERIO_I8042=y | ||
| 1119 | # CONFIG_SERIO_SERPORT is not set | ||
| 1120 | # CONFIG_SERIO_PCIPS2 is not set | ||
| 1121 | CONFIG_SERIO_LIBPS2=y | ||
| 1122 | # CONFIG_SERIO_RAW is not set | ||
| 1123 | # CONFIG_SERIO_XILINX_XPS_PS2 is not set | ||
| 1124 | # CONFIG_GAMEPORT is not set | ||
| 1125 | |||
| 1126 | # | ||
| 1127 | # Character devices | ||
| 1128 | # | ||
| 1129 | CONFIG_VT=y | ||
| 1130 | CONFIG_CONSOLE_TRANSLATIONS=y | ||
| 1131 | CONFIG_VT_CONSOLE=y | ||
| 1132 | CONFIG_HW_CONSOLE=y | ||
| 1133 | CONFIG_VT_HW_CONSOLE_BINDING=y | ||
| 1134 | CONFIG_DEVKMEM=y | ||
| 1135 | # CONFIG_SERIAL_NONSTANDARD is not set | ||
| 1136 | # CONFIG_NOZOMI is not set | ||
| 1137 | |||
| 1138 | # | ||
| 1139 | # Serial drivers | ||
| 1140 | # | ||
| 1141 | CONFIG_SERIAL_8250=y | ||
| 1142 | CONFIG_SERIAL_8250_CONSOLE=y | ||
| 1143 | CONFIG_SERIAL_8250_PCI=y | ||
| 1144 | # CONFIG_SERIAL_8250_CS is not set | ||
| 1145 | CONFIG_SERIAL_8250_NR_UARTS=4 | ||
| 1146 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | ||
| 1147 | # CONFIG_SERIAL_8250_EXTENDED is not set | ||
| 1148 | |||
| 1149 | # | ||
| 1150 | # Non-8250 serial port support | ||
| 1151 | # | ||
| 1152 | CONFIG_SERIAL_CORE=y | ||
| 1153 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
| 1154 | # CONFIG_SERIAL_JSM is not set | ||
| 1155 | # CONFIG_SERIAL_OF_PLATFORM is not set | ||
| 1156 | CONFIG_UNIX98_PTYS=y | ||
| 1157 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set | ||
| 1158 | CONFIG_LEGACY_PTYS=y | ||
| 1159 | CONFIG_LEGACY_PTY_COUNT=256 | ||
| 1160 | # CONFIG_HVC_UDBG is not set | ||
| 1161 | # CONFIG_IPMI_HANDLER is not set | ||
| 1162 | # CONFIG_HW_RANDOM is not set | ||
| 1163 | # CONFIG_R3964 is not set | ||
| 1164 | # CONFIG_APPLICOM is not set | ||
| 1165 | |||
| 1166 | # | ||
| 1167 | # PCMCIA character devices | ||
| 1168 | # | ||
| 1169 | # CONFIG_SYNCLINK_CS is not set | ||
| 1170 | # CONFIG_CARDMAN_4000 is not set | ||
| 1171 | # CONFIG_CARDMAN_4040 is not set | ||
| 1172 | # CONFIG_IPWIRELESS is not set | ||
| 1173 | CONFIG_RAW_DRIVER=y | ||
| 1174 | CONFIG_MAX_RAW_DEVS=256 | ||
| 1175 | # CONFIG_HANGCHECK_TIMER is not set | ||
| 1176 | # CONFIG_TCG_TPM is not set | ||
| 1177 | CONFIG_DEVPORT=y | ||
| 1178 | CONFIG_I2C=y | ||
| 1179 | CONFIG_I2C_BOARDINFO=y | ||
| 1180 | CONFIG_I2C_COMPAT=y | ||
| 1181 | CONFIG_I2C_CHARDEV=y | ||
| 1182 | CONFIG_I2C_HELPER_AUTO=y | ||
| 1183 | CONFIG_I2C_ALGOBIT=y | ||
| 1184 | |||
| 1185 | # | ||
| 1186 | # I2C Hardware Bus support | ||
| 1187 | # | ||
| 1188 | |||
| 1189 | # | ||
| 1190 | # PC SMBus host controller drivers | ||
| 1191 | # | ||
| 1192 | # CONFIG_I2C_ALI1535 is not set | ||
| 1193 | # CONFIG_I2C_ALI1563 is not set | ||
| 1194 | # CONFIG_I2C_ALI15X3 is not set | ||
| 1195 | # CONFIG_I2C_AMD756 is not set | ||
| 1196 | CONFIG_I2C_AMD8111=y | ||
| 1197 | # CONFIG_I2C_I801 is not set | ||
| 1198 | # CONFIG_I2C_ISCH is not set | ||
| 1199 | # CONFIG_I2C_PIIX4 is not set | ||
| 1200 | # CONFIG_I2C_NFORCE2 is not set | ||
| 1201 | # CONFIG_I2C_SIS5595 is not set | ||
| 1202 | # CONFIG_I2C_SIS630 is not set | ||
| 1203 | # CONFIG_I2C_SIS96X is not set | ||
| 1204 | # CONFIG_I2C_VIA is not set | ||
| 1205 | # CONFIG_I2C_VIAPRO is not set | ||
| 1206 | |||
| 1207 | # | ||
| 1208 | # I2C system bus drivers (mostly embedded / system-on-chip) | ||
| 1209 | # | ||
| 1210 | # CONFIG_I2C_OCORES is not set | ||
| 1211 | # CONFIG_I2C_SIMTEC is not set | ||
| 1212 | |||
| 1213 | # | ||
| 1214 | # External I2C/SMBus adapter drivers | ||
| 1215 | # | ||
| 1216 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
| 1217 | # CONFIG_I2C_TAOS_EVM is not set | ||
| 1218 | # CONFIG_I2C_TINY_USB is not set | ||
| 1219 | |||
| 1220 | # | ||
| 1221 | # Graphics adapter I2C/DDC channel drivers | ||
| 1222 | # | ||
| 1223 | # CONFIG_I2C_VOODOO3 is not set | ||
| 1224 | |||
| 1225 | # | ||
| 1226 | # Other I2C/SMBus bus drivers | ||
| 1227 | # | ||
| 1228 | # CONFIG_I2C_PCA_PLATFORM is not set | ||
| 1229 | # CONFIG_I2C_STUB is not set | ||
| 1230 | |||
| 1231 | # | ||
| 1232 | # Miscellaneous I2C Chip support | ||
| 1233 | # | ||
| 1234 | # CONFIG_DS1682 is not set | ||
| 1235 | # CONFIG_SENSORS_TSL2550 is not set | ||
| 1236 | # CONFIG_I2C_DEBUG_CORE is not set | ||
| 1237 | # CONFIG_I2C_DEBUG_ALGO is not set | ||
| 1238 | # CONFIG_I2C_DEBUG_BUS is not set | ||
| 1239 | # CONFIG_I2C_DEBUG_CHIP is not set | ||
| 1240 | # CONFIG_SPI is not set | ||
| 1241 | |||
| 1242 | # | ||
| 1243 | # PPS support | ||
| 1244 | # | ||
| 1245 | # CONFIG_PPS is not set | ||
| 1246 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | ||
| 1247 | # CONFIG_GPIOLIB is not set | ||
| 1248 | # CONFIG_W1 is not set | ||
| 1249 | # CONFIG_POWER_SUPPLY is not set | ||
| 1250 | # CONFIG_HWMON is not set | ||
| 1251 | # CONFIG_THERMAL is not set | ||
| 1252 | # CONFIG_WATCHDOG is not set | ||
| 1253 | CONFIG_SSB_POSSIBLE=y | ||
| 1254 | |||
| 1255 | # | ||
| 1256 | # Sonics Silicon Backplane | ||
| 1257 | # | ||
| 1258 | # CONFIG_SSB is not set | ||
| 1259 | |||
| 1260 | # | ||
| 1261 | # Multifunction device drivers | ||
| 1262 | # | ||
| 1263 | # CONFIG_MFD_CORE is not set | ||
| 1264 | # CONFIG_MFD_SM501 is not set | ||
| 1265 | # CONFIG_HTC_PASIC3 is not set | ||
| 1266 | # CONFIG_TWL4030_CORE is not set | ||
| 1267 | # CONFIG_MFD_TMIO is not set | ||
| 1268 | # CONFIG_PMIC_DA903X is not set | ||
| 1269 | # CONFIG_MFD_WM8400 is not set | ||
| 1270 | # CONFIG_MFD_WM831X is not set | ||
| 1271 | # CONFIG_MFD_WM8350_I2C is not set | ||
| 1272 | # CONFIG_MFD_PCF50633 is not set | ||
| 1273 | # CONFIG_AB3100_CORE is not set | ||
| 1274 | # CONFIG_REGULATOR is not set | ||
| 1275 | # CONFIG_MEDIA_SUPPORT is not set | ||
| 1276 | |||
| 1277 | # | ||
| 1278 | # Graphics support | ||
| 1279 | # | ||
| 1280 | # CONFIG_AGP is not set | ||
| 1281 | CONFIG_VGA_ARB=y | ||
| 1282 | # CONFIG_DRM is not set | ||
| 1283 | # CONFIG_VGASTATE is not set | ||
| 1284 | CONFIG_VIDEO_OUTPUT_CONTROL=m | ||
| 1285 | CONFIG_FB=y | ||
| 1286 | CONFIG_FIRMWARE_EDID=y | ||
| 1287 | CONFIG_FB_DDC=y | ||
| 1288 | # CONFIG_FB_BOOT_VESA_SUPPORT is not set | ||
| 1289 | CONFIG_FB_CFB_FILLRECT=y | ||
| 1290 | CONFIG_FB_CFB_COPYAREA=y | ||
| 1291 | CONFIG_FB_CFB_IMAGEBLIT=y | ||
| 1292 | # CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set | ||
| 1293 | # CONFIG_FB_SYS_FILLRECT is not set | ||
| 1294 | # CONFIG_FB_SYS_COPYAREA is not set | ||
| 1295 | # CONFIG_FB_SYS_IMAGEBLIT is not set | ||
| 1296 | # CONFIG_FB_FOREIGN_ENDIAN is not set | ||
| 1297 | # CONFIG_FB_SYS_FOPS is not set | ||
| 1298 | # CONFIG_FB_SVGALIB is not set | ||
| 1299 | CONFIG_FB_MACMODES=y | ||
| 1300 | CONFIG_FB_BACKLIGHT=y | ||
| 1301 | CONFIG_FB_MODE_HELPERS=y | ||
| 1302 | CONFIG_FB_TILEBLITTING=y | ||
| 1303 | |||
| 1304 | # | ||
| 1305 | # Frame buffer hardware drivers | ||
| 1306 | # | ||
| 1307 | # CONFIG_FB_CIRRUS is not set | ||
| 1308 | # CONFIG_FB_PM2 is not set | ||
| 1309 | # CONFIG_FB_CYBER2000 is not set | ||
| 1310 | CONFIG_FB_OF=y | ||
| 1311 | # CONFIG_FB_ASILIANT is not set | ||
| 1312 | # CONFIG_FB_IMSTT is not set | ||
| 1313 | # CONFIG_FB_VGA16 is not set | ||
| 1314 | # CONFIG_FB_S1D13XXX is not set | ||
| 1315 | # CONFIG_FB_NVIDIA is not set | ||
| 1316 | # CONFIG_FB_RIVA is not set | ||
| 1317 | CONFIG_FB_MATROX=y | ||
| 1318 | CONFIG_FB_MATROX_MILLENIUM=y | ||
| 1319 | CONFIG_FB_MATROX_MYSTIQUE=y | ||
| 1320 | CONFIG_FB_MATROX_G=y | ||
| 1321 | CONFIG_FB_MATROX_I2C=m | ||
| 1322 | CONFIG_FB_MATROX_MAVEN=m | ||
| 1323 | CONFIG_FB_RADEON=y | ||
| 1324 | CONFIG_FB_RADEON_I2C=y | ||
| 1325 | CONFIG_FB_RADEON_BACKLIGHT=y | ||
| 1326 | # CONFIG_FB_RADEON_DEBUG is not set | ||
| 1327 | # CONFIG_FB_ATY128 is not set | ||
| 1328 | # CONFIG_FB_ATY is not set | ||
| 1329 | # CONFIG_FB_S3 is not set | ||
| 1330 | # CONFIG_FB_SAVAGE is not set | ||
| 1331 | # CONFIG_FB_SIS is not set | ||
| 1332 | # CONFIG_FB_VIA is not set | ||
| 1333 | # CONFIG_FB_NEOMAGIC is not set | ||
| 1334 | # CONFIG_FB_KYRO is not set | ||
| 1335 | # CONFIG_FB_3DFX is not set | ||
| 1336 | # CONFIG_FB_VOODOO1 is not set | ||
| 1337 | # CONFIG_FB_VT8623 is not set | ||
| 1338 | # CONFIG_FB_TRIDENT is not set | ||
| 1339 | # CONFIG_FB_ARK is not set | ||
| 1340 | # CONFIG_FB_PM3 is not set | ||
| 1341 | # CONFIG_FB_CARMINE is not set | ||
| 1342 | CONFIG_FB_IBM_GXT4500=y | ||
| 1343 | # CONFIG_FB_VIRTUAL is not set | ||
| 1344 | # CONFIG_FB_METRONOME is not set | ||
| 1345 | # CONFIG_FB_MB862XX is not set | ||
| 1346 | # CONFIG_FB_BROADSHEET is not set | ||
| 1347 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | ||
| 1348 | CONFIG_LCD_CLASS_DEVICE=y | ||
| 1349 | # CONFIG_LCD_ILI9320 is not set | ||
| 1350 | # CONFIG_LCD_PLATFORM is not set | ||
| 1351 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | ||
| 1352 | CONFIG_BACKLIGHT_GENERIC=y | ||
| 1353 | |||
| 1354 | # | ||
| 1355 | # Display device support | ||
| 1356 | # | ||
| 1357 | CONFIG_DISPLAY_SUPPORT=y | ||
| 1358 | |||
| 1359 | # | ||
| 1360 | # Display hardware drivers | ||
| 1361 | # | ||
| 1362 | |||
| 1363 | # | ||
| 1364 | # Console display driver support | ||
| 1365 | # | ||
| 1366 | # CONFIG_VGA_CONSOLE is not set | ||
| 1367 | CONFIG_DUMMY_CONSOLE=y | ||
| 1368 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
| 1369 | # CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set | ||
| 1370 | # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set | ||
| 1371 | # CONFIG_FONTS is not set | ||
| 1372 | CONFIG_FONT_8x8=y | ||
| 1373 | CONFIG_FONT_8x16=y | ||
| 1374 | CONFIG_LOGO=y | ||
| 1375 | CONFIG_LOGO_LINUX_MONO=y | ||
| 1376 | CONFIG_LOGO_LINUX_VGA16=y | ||
| 1377 | CONFIG_LOGO_LINUX_CLUT224=y | ||
| 1378 | CONFIG_SOUND=m | ||
| 1379 | CONFIG_SOUND_OSS_CORE=y | ||
| 1380 | CONFIG_SOUND_OSS_CORE_PRECLAIM=y | ||
| 1381 | CONFIG_SND=m | ||
| 1382 | CONFIG_SND_TIMER=m | ||
| 1383 | CONFIG_SND_PCM=m | ||
| 1384 | CONFIG_SND_SEQUENCER=m | ||
| 1385 | CONFIG_SND_SEQ_DUMMY=m | ||
| 1386 | CONFIG_SND_OSSEMUL=y | ||
| 1387 | CONFIG_SND_MIXER_OSS=m | ||
| 1388 | CONFIG_SND_PCM_OSS=m | ||
| 1389 | CONFIG_SND_PCM_OSS_PLUGINS=y | ||
| 1390 | CONFIG_SND_SEQUENCER_OSS=y | ||
| 1391 | # CONFIG_SND_HRTIMER is not set | ||
| 1392 | # CONFIG_SND_DYNAMIC_MINORS is not set | ||
| 1393 | CONFIG_SND_SUPPORT_OLD_API=y | ||
| 1394 | CONFIG_SND_VERBOSE_PROCFS=y | ||
| 1395 | # CONFIG_SND_VERBOSE_PRINTK is not set | ||
| 1396 | # CONFIG_SND_DEBUG is not set | ||
| 1397 | # CONFIG_SND_RAWMIDI_SEQ is not set | ||
| 1398 | # CONFIG_SND_OPL3_LIB_SEQ is not set | ||
| 1399 | # CONFIG_SND_OPL4_LIB_SEQ is not set | ||
| 1400 | # CONFIG_SND_SBAWE_SEQ is not set | ||
| 1401 | # CONFIG_SND_EMU10K1_SEQ is not set | ||
| 1402 | CONFIG_SND_DRIVERS=y | ||
| 1403 | # CONFIG_SND_DUMMY is not set | ||
| 1404 | # CONFIG_SND_VIRMIDI is not set | ||
| 1405 | # CONFIG_SND_MTPAV is not set | ||
| 1406 | # CONFIG_SND_SERIAL_U16550 is not set | ||
| 1407 | # CONFIG_SND_MPU401 is not set | ||
| 1408 | CONFIG_SND_PCI=y | ||
| 1409 | # CONFIG_SND_AD1889 is not set | ||
| 1410 | # CONFIG_SND_ALS300 is not set | ||
| 1411 | # CONFIG_SND_ALS4000 is not set | ||
| 1412 | # CONFIG_SND_ALI5451 is not set | ||
| 1413 | # CONFIG_SND_ATIIXP is not set | ||
| 1414 | # CONFIG_SND_ATIIXP_MODEM is not set | ||
| 1415 | # CONFIG_SND_AU8810 is not set | ||
| 1416 | # CONFIG_SND_AU8820 is not set | ||
| 1417 | # CONFIG_SND_AU8830 is not set | ||
| 1418 | # CONFIG_SND_AW2 is not set | ||
| 1419 | # CONFIG_SND_AZT3328 is not set | ||
| 1420 | # CONFIG_SND_BT87X is not set | ||
| 1421 | # CONFIG_SND_CA0106 is not set | ||
| 1422 | # CONFIG_SND_CMIPCI is not set | ||
| 1423 | # CONFIG_SND_OXYGEN is not set | ||
| 1424 | # CONFIG_SND_CS4281 is not set | ||
| 1425 | # CONFIG_SND_CS46XX is not set | ||
| 1426 | # CONFIG_SND_CS5530 is not set | ||
| 1427 | # CONFIG_SND_CTXFI is not set | ||
| 1428 | # CONFIG_SND_DARLA20 is not set | ||
| 1429 | # CONFIG_SND_GINA20 is not set | ||
| 1430 | # CONFIG_SND_LAYLA20 is not set | ||
| 1431 | # CONFIG_SND_DARLA24 is not set | ||
| 1432 | # CONFIG_SND_GINA24 is not set | ||
| 1433 | # CONFIG_SND_LAYLA24 is not set | ||
| 1434 | # CONFIG_SND_MONA is not set | ||
| 1435 | # CONFIG_SND_MIA is not set | ||
| 1436 | # CONFIG_SND_ECHO3G is not set | ||
| 1437 | # CONFIG_SND_INDIGO is not set | ||
| 1438 | # CONFIG_SND_INDIGOIO is not set | ||
| 1439 | # CONFIG_SND_INDIGODJ is not set | ||
| 1440 | # CONFIG_SND_INDIGOIOX is not set | ||
| 1441 | # CONFIG_SND_INDIGODJX is not set | ||
| 1442 | # CONFIG_SND_EMU10K1 is not set | ||
| 1443 | # CONFIG_SND_EMU10K1X is not set | ||
| 1444 | # CONFIG_SND_ENS1370 is not set | ||
| 1445 | # CONFIG_SND_ENS1371 is not set | ||
| 1446 | # CONFIG_SND_ES1938 is not set | ||
| 1447 | # CONFIG_SND_ES1968 is not set | ||
| 1448 | # CONFIG_SND_FM801 is not set | ||
| 1449 | # CONFIG_SND_HDA_INTEL is not set | ||
| 1450 | # CONFIG_SND_HDSP is not set | ||
| 1451 | # CONFIG_SND_HDSPM is not set | ||
| 1452 | # CONFIG_SND_HIFIER is not set | ||
| 1453 | # CONFIG_SND_ICE1712 is not set | ||
| 1454 | # CONFIG_SND_ICE1724 is not set | ||
| 1455 | # CONFIG_SND_INTEL8X0 is not set | ||
| 1456 | # CONFIG_SND_INTEL8X0M is not set | ||
| 1457 | # CONFIG_SND_KORG1212 is not set | ||
| 1458 | # CONFIG_SND_LX6464ES is not set | ||
| 1459 | # CONFIG_SND_MAESTRO3 is not set | ||
| 1460 | # CONFIG_SND_MIXART is not set | ||
| 1461 | # CONFIG_SND_NM256 is not set | ||
| 1462 | # CONFIG_SND_PCXHR is not set | ||
| 1463 | # CONFIG_SND_RIPTIDE is not set | ||
| 1464 | # CONFIG_SND_RME32 is not set | ||
| 1465 | # CONFIG_SND_RME96 is not set | ||
| 1466 | # CONFIG_SND_RME9652 is not set | ||
| 1467 | # CONFIG_SND_SONICVIBES is not set | ||
| 1468 | # CONFIG_SND_TRIDENT is not set | ||
| 1469 | # CONFIG_SND_VIA82XX is not set | ||
| 1470 | # CONFIG_SND_VIA82XX_MODEM is not set | ||
| 1471 | # CONFIG_SND_VIRTUOSO is not set | ||
| 1472 | # CONFIG_SND_VX222 is not set | ||
| 1473 | # CONFIG_SND_YMFPCI is not set | ||
| 1474 | CONFIG_SND_PPC=y | ||
| 1475 | CONFIG_SND_USB=y | ||
| 1476 | # CONFIG_SND_USB_AUDIO is not set | ||
| 1477 | # CONFIG_SND_USB_USX2Y is not set | ||
| 1478 | # CONFIG_SND_USB_CAIAQ is not set | ||
| 1479 | CONFIG_SND_PCMCIA=y | ||
| 1480 | # CONFIG_SND_VXPOCKET is not set | ||
| 1481 | # CONFIG_SND_PDAUDIOCF is not set | ||
| 1482 | # CONFIG_SND_SOC is not set | ||
| 1483 | # CONFIG_SOUND_PRIME is not set | ||
| 1484 | CONFIG_HID_SUPPORT=y | ||
| 1485 | CONFIG_HID=y | ||
| 1486 | # CONFIG_HIDRAW is not set | ||
| 1487 | |||
| 1488 | # | ||
| 1489 | # USB Input Devices | ||
| 1490 | # | ||
| 1491 | CONFIG_USB_HID=y | ||
| 1492 | # CONFIG_HID_PID is not set | ||
| 1493 | CONFIG_USB_HIDDEV=y | ||
| 1494 | |||
| 1495 | # | ||
| 1496 | # Special HID drivers | ||
| 1497 | # | ||
| 1498 | CONFIG_HID_A4TECH=y | ||
| 1499 | CONFIG_HID_APPLE=y | ||
| 1500 | CONFIG_HID_BELKIN=y | ||
| 1501 | CONFIG_HID_CHERRY=y | ||
| 1502 | CONFIG_HID_CHICONY=y | ||
| 1503 | CONFIG_HID_CYPRESS=y | ||
| 1504 | CONFIG_HID_DRAGONRISE=y | ||
| 1505 | # CONFIG_DRAGONRISE_FF is not set | ||
| 1506 | CONFIG_HID_EZKEY=y | ||
| 1507 | CONFIG_HID_KYE=y | ||
| 1508 | CONFIG_HID_GYRATION=y | ||
| 1509 | CONFIG_HID_TWINHAN=y | ||
| 1510 | CONFIG_HID_KENSINGTON=y | ||
| 1511 | CONFIG_HID_LOGITECH=y | ||
| 1512 | # CONFIG_LOGITECH_FF is not set | ||
| 1513 | # CONFIG_LOGIRUMBLEPAD2_FF is not set | ||
| 1514 | CONFIG_HID_MICROSOFT=y | ||
| 1515 | CONFIG_HID_MONTEREY=y | ||
| 1516 | CONFIG_HID_NTRIG=y | ||
| 1517 | CONFIG_HID_PANTHERLORD=y | ||
| 1518 | # CONFIG_PANTHERLORD_FF is not set | ||
| 1519 | CONFIG_HID_PETALYNX=y | ||
| 1520 | CONFIG_HID_SAMSUNG=y | ||
| 1521 | CONFIG_HID_SONY=y | ||
| 1522 | CONFIG_HID_SUNPLUS=y | ||
| 1523 | CONFIG_HID_GREENASIA=y | ||
| 1524 | # CONFIG_GREENASIA_FF is not set | ||
| 1525 | CONFIG_HID_SMARTJOYPLUS=y | ||
| 1526 | # CONFIG_SMARTJOYPLUS_FF is not set | ||
| 1527 | CONFIG_HID_TOPSEED=y | ||
| 1528 | CONFIG_HID_THRUSTMASTER=y | ||
| 1529 | # CONFIG_THRUSTMASTER_FF is not set | ||
| 1530 | CONFIG_HID_ZEROPLUS=y | ||
| 1531 | # CONFIG_ZEROPLUS_FF is not set | ||
| 1532 | CONFIG_USB_SUPPORT=y | ||
| 1533 | CONFIG_USB_ARCH_HAS_HCD=y | ||
| 1534 | CONFIG_USB_ARCH_HAS_OHCI=y | ||
| 1535 | CONFIG_USB_ARCH_HAS_EHCI=y | ||
| 1536 | CONFIG_USB=y | ||
| 1537 | # CONFIG_USB_DEBUG is not set | ||
| 1538 | # CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set | ||
| 1539 | |||
| 1540 | # | ||
| 1541 | # Miscellaneous USB options | ||
| 1542 | # | ||
| 1543 | CONFIG_USB_DEVICEFS=y | ||
| 1544 | CONFIG_USB_DEVICE_CLASS=y | ||
| 1545 | # CONFIG_USB_DYNAMIC_MINORS is not set | ||
| 1546 | # CONFIG_USB_OTG is not set | ||
| 1547 | # CONFIG_USB_MON is not set | ||
| 1548 | # CONFIG_USB_WUSB is not set | ||
| 1549 | # CONFIG_USB_WUSB_CBAF is not set | ||
| 1550 | |||
| 1551 | # | ||
| 1552 | # USB Host Controller Drivers | ||
| 1553 | # | ||
| 1554 | # CONFIG_USB_C67X00_HCD is not set | ||
| 1555 | # CONFIG_USB_XHCI_HCD is not set | ||
| 1556 | CONFIG_USB_EHCI_HCD=y | ||
| 1557 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set | ||
| 1558 | CONFIG_USB_EHCI_TT_NEWSCHED=y | ||
| 1559 | # CONFIG_USB_EHCI_HCD_PPC_OF is not set | ||
| 1560 | # CONFIG_USB_OXU210HP_HCD is not set | ||
| 1561 | # CONFIG_USB_ISP116X_HCD is not set | ||
| 1562 | # CONFIG_USB_ISP1760_HCD is not set | ||
| 1563 | # CONFIG_USB_ISP1362_HCD is not set | ||
| 1564 | CONFIG_USB_OHCI_HCD=y | ||
| 1565 | # CONFIG_USB_OHCI_HCD_PPC_OF_BE is not set | ||
| 1566 | # CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set | ||
| 1567 | # CONFIG_USB_OHCI_HCD_PPC_OF is not set | ||
| 1568 | # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set | ||
| 1569 | # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set | ||
| 1570 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y | ||
| 1571 | # CONFIG_USB_UHCI_HCD is not set | ||
| 1572 | # CONFIG_USB_SL811_HCD is not set | ||
| 1573 | # CONFIG_USB_R8A66597_HCD is not set | ||
| 1574 | # CONFIG_USB_WHCI_HCD is not set | ||
| 1575 | # CONFIG_USB_HWA_HCD is not set | ||
| 1576 | |||
| 1577 | # | ||
| 1578 | # USB Device Class drivers | ||
| 1579 | # | ||
| 1580 | # CONFIG_USB_ACM is not set | ||
| 1581 | # CONFIG_USB_PRINTER is not set | ||
| 1582 | # CONFIG_USB_WDM is not set | ||
| 1583 | # CONFIG_USB_TMC is not set | ||
| 1584 | |||
| 1585 | # | ||
| 1586 | # NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may | ||
| 1587 | # | ||
| 1588 | |||
| 1589 | # | ||
| 1590 | # also be needed; see USB_STORAGE Help for more info | ||
| 1591 | # | ||
| 1592 | CONFIG_USB_STORAGE=m | ||
| 1593 | # CONFIG_USB_STORAGE_DEBUG is not set | ||
| 1594 | # CONFIG_USB_STORAGE_DATAFAB is not set | ||
| 1595 | # CONFIG_USB_STORAGE_FREECOM is not set | ||
| 1596 | # CONFIG_USB_STORAGE_ISD200 is not set | ||
| 1597 | # CONFIG_USB_STORAGE_USBAT is not set | ||
| 1598 | # CONFIG_USB_STORAGE_SDDR09 is not set | ||
| 1599 | # CONFIG_USB_STORAGE_SDDR55 is not set | ||
| 1600 | # CONFIG_USB_STORAGE_JUMPSHOT is not set | ||
| 1601 | # CONFIG_USB_STORAGE_ALAUDA is not set | ||
| 1602 | # CONFIG_USB_STORAGE_ONETOUCH is not set | ||
| 1603 | # CONFIG_USB_STORAGE_KARMA is not set | ||
| 1604 | # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set | ||
| 1605 | # CONFIG_USB_LIBUSUAL is not set | ||
| 1606 | |||
| 1607 | # | ||
| 1608 | # USB Imaging devices | ||
| 1609 | # | ||
| 1610 | # CONFIG_USB_MDC800 is not set | ||
| 1611 | # CONFIG_USB_MICROTEK is not set | ||
| 1612 | |||
| 1613 | # | ||
| 1614 | # USB port drivers | ||
| 1615 | # | ||
| 1616 | # CONFIG_USB_SERIAL is not set | ||
| 1617 | |||
| 1618 | # | ||
| 1619 | # USB Miscellaneous drivers | ||
| 1620 | # | ||
| 1621 | # CONFIG_USB_EMI62 is not set | ||
| 1622 | # CONFIG_USB_EMI26 is not set | ||
| 1623 | # CONFIG_USB_ADUTUX is not set | ||
| 1624 | # CONFIG_USB_SEVSEG is not set | ||
| 1625 | # CONFIG_USB_RIO500 is not set | ||
| 1626 | # CONFIG_USB_LEGOTOWER is not set | ||
| 1627 | # CONFIG_USB_LCD is not set | ||
| 1628 | # CONFIG_USB_BERRY_CHARGE is not set | ||
| 1629 | # CONFIG_USB_LED is not set | ||
| 1630 | # CONFIG_USB_CYPRESS_CY7C63 is not set | ||
| 1631 | # CONFIG_USB_CYTHERM is not set | ||
| 1632 | # CONFIG_USB_IDMOUSE is not set | ||
| 1633 | # CONFIG_USB_FTDI_ELAN is not set | ||
| 1634 | CONFIG_USB_APPLEDISPLAY=m | ||
| 1635 | # CONFIG_USB_SISUSBVGA is not set | ||
| 1636 | # CONFIG_USB_LD is not set | ||
| 1637 | # CONFIG_USB_TRANCEVIBRATOR is not set | ||
| 1638 | # CONFIG_USB_IOWARRIOR is not set | ||
| 1639 | # CONFIG_USB_TEST is not set | ||
| 1640 | # CONFIG_USB_ISIGHTFW is not set | ||
| 1641 | # CONFIG_USB_VST is not set | ||
| 1642 | # CONFIG_USB_GADGET is not set | ||
| 1643 | |||
| 1644 | # | ||
| 1645 | # OTG and related infrastructure | ||
| 1646 | # | ||
| 1647 | # CONFIG_NOP_USB_XCEIV is not set | ||
| 1648 | # CONFIG_UWB is not set | ||
| 1649 | # CONFIG_MMC is not set | ||
| 1650 | # CONFIG_MEMSTICK is not set | ||
| 1651 | # CONFIG_NEW_LEDS is not set | ||
| 1652 | # CONFIG_ACCESSIBILITY is not set | ||
| 1653 | CONFIG_INFINIBAND=m | ||
| 1654 | # CONFIG_INFINIBAND_USER_MAD is not set | ||
| 1655 | # CONFIG_INFINIBAND_USER_ACCESS is not set | ||
| 1656 | CONFIG_INFINIBAND_ADDR_TRANS=y | ||
| 1657 | CONFIG_INFINIBAND_MTHCA=m | ||
| 1658 | CONFIG_INFINIBAND_MTHCA_DEBUG=y | ||
| 1659 | # CONFIG_INFINIBAND_IPATH is not set | ||
| 1660 | # CONFIG_INFINIBAND_AMSO1100 is not set | ||
| 1661 | # CONFIG_MLX4_INFINIBAND is not set | ||
| 1662 | # CONFIG_INFINIBAND_NES is not set | ||
| 1663 | CONFIG_INFINIBAND_IPOIB=m | ||
| 1664 | # CONFIG_INFINIBAND_IPOIB_CM is not set | ||
| 1665 | CONFIG_INFINIBAND_IPOIB_DEBUG=y | ||
| 1666 | # CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set | ||
| 1667 | # CONFIG_INFINIBAND_SRP is not set | ||
| 1668 | CONFIG_INFINIBAND_ISER=m | ||
| 1669 | CONFIG_EDAC=y | ||
| 1670 | |||
| 1671 | # | ||
| 1672 | # Reporting subsystems | ||
| 1673 | # | ||
| 1674 | # CONFIG_EDAC_DEBUG is not set | ||
| 1675 | CONFIG_EDAC_MM_EDAC=y | ||
| 1676 | # CONFIG_EDAC_CPC925 is not set | ||
| 1677 | CONFIG_RTC_LIB=y | ||
| 1678 | CONFIG_RTC_CLASS=y | ||
| 1679 | CONFIG_RTC_HCTOSYS=y | ||
| 1680 | CONFIG_RTC_HCTOSYS_DEVICE="rtc0" | ||
| 1681 | # CONFIG_RTC_DEBUG is not set | ||
| 1682 | |||
| 1683 | # | ||
| 1684 | # RTC interfaces | ||
| 1685 | # | ||
| 1686 | CONFIG_RTC_INTF_SYSFS=y | ||
| 1687 | CONFIG_RTC_INTF_PROC=y | ||
| 1688 | CONFIG_RTC_INTF_DEV=y | ||
| 1689 | # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set | ||
| 1690 | # CONFIG_RTC_DRV_TEST is not set | ||
| 1691 | |||
| 1692 | # | ||
| 1693 | # I2C RTC drivers | ||
| 1694 | # | ||
| 1695 | CONFIG_RTC_DRV_DS1307=y | ||
| 1696 | # CONFIG_RTC_DRV_DS1374 is not set | ||
| 1697 | # CONFIG_RTC_DRV_DS1672 is not set | ||
| 1698 | # CONFIG_RTC_DRV_MAX6900 is not set | ||
| 1699 | # CONFIG_RTC_DRV_RS5C372 is not set | ||
| 1700 | # CONFIG_RTC_DRV_ISL1208 is not set | ||
| 1701 | # CONFIG_RTC_DRV_X1205 is not set | ||
| 1702 | # CONFIG_RTC_DRV_PCF8563 is not set | ||
| 1703 | # CONFIG_RTC_DRV_PCF8583 is not set | ||
| 1704 | # CONFIG_RTC_DRV_M41T80 is not set | ||
| 1705 | # CONFIG_RTC_DRV_S35390A is not set | ||
| 1706 | # CONFIG_RTC_DRV_FM3130 is not set | ||
| 1707 | # CONFIG_RTC_DRV_RX8581 is not set | ||
| 1708 | # CONFIG_RTC_DRV_RX8025 is not set | ||
| 1709 | |||
| 1710 | # | ||
| 1711 | # SPI RTC drivers | ||
| 1712 | # | ||
| 1713 | |||
| 1714 | # | ||
| 1715 | # Platform RTC drivers | ||
| 1716 | # | ||
| 1717 | # CONFIG_RTC_DRV_CMOS is not set | ||
| 1718 | # CONFIG_RTC_DRV_DS1286 is not set | ||
| 1719 | # CONFIG_RTC_DRV_DS1511 is not set | ||
| 1720 | # CONFIG_RTC_DRV_DS1553 is not set | ||
| 1721 | # CONFIG_RTC_DRV_DS1742 is not set | ||
| 1722 | # CONFIG_RTC_DRV_STK17TA8 is not set | ||
| 1723 | # CONFIG_RTC_DRV_M48T86 is not set | ||
| 1724 | # CONFIG_RTC_DRV_M48T35 is not set | ||
| 1725 | # CONFIG_RTC_DRV_M48T59 is not set | ||
| 1726 | # CONFIG_RTC_DRV_BQ4802 is not set | ||
| 1727 | # CONFIG_RTC_DRV_V3020 is not set | ||
| 1728 | |||
| 1729 | # | ||
| 1730 | # on-CPU RTC drivers | ||
| 1731 | # | ||
| 1732 | # CONFIG_RTC_DRV_GENERIC is not set | ||
| 1733 | # CONFIG_DMADEVICES is not set | ||
| 1734 | # CONFIG_AUXDISPLAY is not set | ||
| 1735 | # CONFIG_UIO is not set | ||
| 1736 | |||
| 1737 | # | ||
| 1738 | # TI VLYNQ | ||
| 1739 | # | ||
| 1740 | # CONFIG_STAGING is not set | ||
| 1741 | |||
| 1742 | # | ||
| 1743 | # File systems | ||
| 1744 | # | ||
| 1745 | CONFIG_EXT2_FS=y | ||
| 1746 | CONFIG_EXT2_FS_XATTR=y | ||
| 1747 | CONFIG_EXT2_FS_POSIX_ACL=y | ||
| 1748 | CONFIG_EXT2_FS_SECURITY=y | ||
| 1749 | CONFIG_EXT2_FS_XIP=y | ||
| 1750 | CONFIG_EXT3_FS=y | ||
| 1751 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | ||
| 1752 | CONFIG_EXT3_FS_XATTR=y | ||
| 1753 | CONFIG_EXT3_FS_POSIX_ACL=y | ||
| 1754 | CONFIG_EXT3_FS_SECURITY=y | ||
| 1755 | CONFIG_EXT4_FS=y | ||
| 1756 | CONFIG_EXT4_FS_XATTR=y | ||
| 1757 | CONFIG_EXT4_FS_POSIX_ACL=y | ||
| 1758 | CONFIG_EXT4_FS_SECURITY=y | ||
| 1759 | # CONFIG_EXT4_DEBUG is not set | ||
| 1760 | CONFIG_FS_XIP=y | ||
| 1761 | CONFIG_JBD=y | ||
| 1762 | # CONFIG_JBD_DEBUG is not set | ||
| 1763 | CONFIG_JBD2=y | ||
| 1764 | # CONFIG_JBD2_DEBUG is not set | ||
| 1765 | CONFIG_FS_MBCACHE=y | ||
| 1766 | CONFIG_REISERFS_FS=y | ||
| 1767 | # CONFIG_REISERFS_CHECK is not set | ||
| 1768 | # CONFIG_REISERFS_PROC_INFO is not set | ||
| 1769 | CONFIG_REISERFS_FS_XATTR=y | ||
| 1770 | CONFIG_REISERFS_FS_POSIX_ACL=y | ||
| 1771 | CONFIG_REISERFS_FS_SECURITY=y | ||
| 1772 | CONFIG_JFS_FS=y | ||
| 1773 | CONFIG_JFS_POSIX_ACL=y | ||
| 1774 | CONFIG_JFS_SECURITY=y | ||
| 1775 | # CONFIG_JFS_DEBUG is not set | ||
| 1776 | # CONFIG_JFS_STATISTICS is not set | ||
| 1777 | CONFIG_FS_POSIX_ACL=y | ||
| 1778 | CONFIG_XFS_FS=m | ||
| 1779 | # CONFIG_XFS_QUOTA is not set | ||
| 1780 | CONFIG_XFS_POSIX_ACL=y | ||
| 1781 | # CONFIG_XFS_RT is not set | ||
| 1782 | # CONFIG_XFS_DEBUG is not set | ||
| 1783 | # CONFIG_GFS2_FS is not set | ||
| 1784 | # CONFIG_OCFS2_FS is not set | ||
| 1785 | # CONFIG_BTRFS_FS is not set | ||
| 1786 | # CONFIG_NILFS2_FS is not set | ||
| 1787 | CONFIG_FILE_LOCKING=y | ||
| 1788 | CONFIG_FSNOTIFY=y | ||
| 1789 | CONFIG_DNOTIFY=y | ||
| 1790 | CONFIG_INOTIFY=y | ||
| 1791 | CONFIG_INOTIFY_USER=y | ||
| 1792 | # CONFIG_QUOTA is not set | ||
| 1793 | # CONFIG_AUTOFS_FS is not set | ||
| 1794 | CONFIG_AUTOFS4_FS=m | ||
| 1795 | # CONFIG_FUSE_FS is not set | ||
| 1796 | |||
| 1797 | # | ||
| 1798 | # Caches | ||
| 1799 | # | ||
| 1800 | # CONFIG_FSCACHE is not set | ||
| 1801 | |||
| 1802 | # | ||
| 1803 | # CD-ROM/DVD Filesystems | ||
| 1804 | # | ||
| 1805 | CONFIG_ISO9660_FS=y | ||
| 1806 | # CONFIG_JOLIET is not set | ||
| 1807 | # CONFIG_ZISOFS is not set | ||
| 1808 | CONFIG_UDF_FS=m | ||
| 1809 | CONFIG_UDF_NLS=y | ||
| 1810 | |||
| 1811 | # | ||
| 1812 | # DOS/FAT/NT Filesystems | ||
| 1813 | # | ||
| 1814 | CONFIG_FAT_FS=y | ||
| 1815 | CONFIG_MSDOS_FS=y | ||
| 1816 | CONFIG_VFAT_FS=y | ||
| 1817 | CONFIG_FAT_DEFAULT_CODEPAGE=437 | ||
| 1818 | CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" | ||
| 1819 | # CONFIG_NTFS_FS is not set | ||
| 1820 | |||
| 1821 | # | ||
| 1822 | # Pseudo filesystems | ||
| 1823 | # | ||
| 1824 | CONFIG_PROC_FS=y | ||
| 1825 | CONFIG_PROC_KCORE=y | ||
| 1826 | CONFIG_PROC_SYSCTL=y | ||
| 1827 | CONFIG_PROC_PAGE_MONITOR=y | ||
| 1828 | CONFIG_SYSFS=y | ||
| 1829 | CONFIG_TMPFS=y | ||
| 1830 | # CONFIG_TMPFS_POSIX_ACL is not set | ||
| 1831 | # CONFIG_HUGETLBFS is not set | ||
| 1832 | # CONFIG_HUGETLB_PAGE is not set | ||
| 1833 | # CONFIG_CONFIGFS_FS is not set | ||
| 1834 | CONFIG_MISC_FILESYSTEMS=y | ||
| 1835 | # CONFIG_ADFS_FS is not set | ||
| 1836 | # CONFIG_AFFS_FS is not set | ||
| 1837 | CONFIG_HFS_FS=m | ||
| 1838 | CONFIG_HFSPLUS_FS=m | ||
| 1839 | # CONFIG_BEFS_FS is not set | ||
| 1840 | # CONFIG_BFS_FS is not set | ||
| 1841 | # CONFIG_EFS_FS is not set | ||
| 1842 | CONFIG_CRAMFS=y | ||
| 1843 | # CONFIG_SQUASHFS is not set | ||
| 1844 | # CONFIG_VXFS_FS is not set | ||
| 1845 | # CONFIG_MINIX_FS is not set | ||
| 1846 | # CONFIG_OMFS_FS is not set | ||
| 1847 | # CONFIG_HPFS_FS is not set | ||
| 1848 | # CONFIG_QNX4FS_FS is not set | ||
| 1849 | # CONFIG_ROMFS_FS is not set | ||
| 1850 | # CONFIG_SYSV_FS is not set | ||
| 1851 | # CONFIG_UFS_FS is not set | ||
| 1852 | CONFIG_NETWORK_FILESYSTEMS=y | ||
| 1853 | CONFIG_NFS_FS=y | ||
| 1854 | CONFIG_NFS_V3=y | ||
| 1855 | CONFIG_NFS_V3_ACL=y | ||
| 1856 | CONFIG_NFS_V4=y | ||
| 1857 | # CONFIG_NFS_V4_1 is not set | ||
| 1858 | CONFIG_ROOT_NFS=y | ||
| 1859 | CONFIG_NFSD=m | ||
| 1860 | CONFIG_NFSD_V2_ACL=y | ||
| 1861 | CONFIG_NFSD_V3=y | ||
| 1862 | CONFIG_NFSD_V3_ACL=y | ||
| 1863 | CONFIG_NFSD_V4=y | ||
| 1864 | CONFIG_LOCKD=y | ||
| 1865 | CONFIG_LOCKD_V4=y | ||
| 1866 | CONFIG_EXPORTFS=m | ||
| 1867 | CONFIG_NFS_ACL_SUPPORT=y | ||
| 1868 | CONFIG_NFS_COMMON=y | ||
| 1869 | CONFIG_SUNRPC=y | ||
| 1870 | CONFIG_SUNRPC_GSS=y | ||
| 1871 | CONFIG_SUNRPC_XPRT_RDMA=m | ||
| 1872 | CONFIG_RPCSEC_GSS_KRB5=y | ||
| 1873 | CONFIG_RPCSEC_GSS_SPKM3=m | ||
| 1874 | # CONFIG_SMB_FS is not set | ||
| 1875 | CONFIG_CIFS=m | ||
| 1876 | # CONFIG_CIFS_STATS is not set | ||
| 1877 | # CONFIG_CIFS_WEAK_PW_HASH is not set | ||
| 1878 | CONFIG_CIFS_XATTR=y | ||
| 1879 | CONFIG_CIFS_POSIX=y | ||
| 1880 | # CONFIG_CIFS_DEBUG2 is not set | ||
| 1881 | # CONFIG_CIFS_EXPERIMENTAL is not set | ||
| 1882 | # CONFIG_NCP_FS is not set | ||
| 1883 | # CONFIG_CODA_FS is not set | ||
| 1884 | # CONFIG_AFS_FS is not set | ||
| 1885 | |||
| 1886 | # | ||
| 1887 | # Partition Types | ||
| 1888 | # | ||
| 1889 | CONFIG_PARTITION_ADVANCED=y | ||
| 1890 | # CONFIG_ACORN_PARTITION is not set | ||
| 1891 | # CONFIG_OSF_PARTITION is not set | ||
| 1892 | # CONFIG_AMIGA_PARTITION is not set | ||
| 1893 | # CONFIG_ATARI_PARTITION is not set | ||
| 1894 | CONFIG_MAC_PARTITION=y | ||
| 1895 | CONFIG_MSDOS_PARTITION=y | ||
| 1896 | # CONFIG_BSD_DISKLABEL is not set | ||
| 1897 | # CONFIG_MINIX_SUBPARTITION is not set | ||
| 1898 | # CONFIG_SOLARIS_X86_PARTITION is not set | ||
| 1899 | # CONFIG_UNIXWARE_DISKLABEL is not set | ||
| 1900 | # CONFIG_LDM_PARTITION is not set | ||
| 1901 | # CONFIG_SGI_PARTITION is not set | ||
| 1902 | # CONFIG_ULTRIX_PARTITION is not set | ||
| 1903 | # CONFIG_SUN_PARTITION is not set | ||
| 1904 | # CONFIG_KARMA_PARTITION is not set | ||
| 1905 | # CONFIG_EFI_PARTITION is not set | ||
| 1906 | # CONFIG_SYSV68_PARTITION is not set | ||
| 1907 | CONFIG_NLS=y | ||
| 1908 | CONFIG_NLS_DEFAULT="iso8859-1" | ||
| 1909 | CONFIG_NLS_CODEPAGE_437=y | ||
| 1910 | CONFIG_NLS_CODEPAGE_737=m | ||
| 1911 | CONFIG_NLS_CODEPAGE_775=m | ||
| 1912 | CONFIG_NLS_CODEPAGE_850=m | ||
| 1913 | CONFIG_NLS_CODEPAGE_852=m | ||
| 1914 | CONFIG_NLS_CODEPAGE_855=m | ||
| 1915 | CONFIG_NLS_CODEPAGE_857=m | ||
| 1916 | CONFIG_NLS_CODEPAGE_860=m | ||
| 1917 | CONFIG_NLS_CODEPAGE_861=m | ||
| 1918 | CONFIG_NLS_CODEPAGE_862=m | ||
| 1919 | CONFIG_NLS_CODEPAGE_863=m | ||
| 1920 | CONFIG_NLS_CODEPAGE_864=m | ||
| 1921 | CONFIG_NLS_CODEPAGE_865=m | ||
| 1922 | CONFIG_NLS_CODEPAGE_866=m | ||
| 1923 | CONFIG_NLS_CODEPAGE_869=m | ||
| 1924 | CONFIG_NLS_CODEPAGE_936=m | ||
| 1925 | CONFIG_NLS_CODEPAGE_950=m | ||
| 1926 | CONFIG_NLS_CODEPAGE_932=m | ||
| 1927 | CONFIG_NLS_CODEPAGE_949=m | ||
| 1928 | CONFIG_NLS_CODEPAGE_874=m | ||
| 1929 | CONFIG_NLS_ISO8859_8=m | ||
| 1930 | CONFIG_NLS_CODEPAGE_1250=m | ||
| 1931 | CONFIG_NLS_CODEPAGE_1251=m | ||
| 1932 | CONFIG_NLS_ASCII=m | ||
| 1933 | CONFIG_NLS_ISO8859_1=y | ||
| 1934 | CONFIG_NLS_ISO8859_2=m | ||
| 1935 | CONFIG_NLS_ISO8859_3=m | ||
| 1936 | CONFIG_NLS_ISO8859_4=m | ||
| 1937 | CONFIG_NLS_ISO8859_5=m | ||
| 1938 | CONFIG_NLS_ISO8859_6=m | ||
| 1939 | CONFIG_NLS_ISO8859_7=m | ||
| 1940 | CONFIG_NLS_ISO8859_9=m | ||
| 1941 | CONFIG_NLS_ISO8859_13=m | ||
| 1942 | CONFIG_NLS_ISO8859_14=m | ||
| 1943 | CONFIG_NLS_ISO8859_15=m | ||
| 1944 | CONFIG_NLS_KOI8_R=m | ||
| 1945 | CONFIG_NLS_KOI8_U=m | ||
| 1946 | CONFIG_NLS_UTF8=m | ||
| 1947 | # CONFIG_DLM is not set | ||
| 1948 | CONFIG_BINARY_PRINTF=y | ||
| 1949 | |||
| 1950 | # | ||
| 1951 | # Library routines | ||
| 1952 | # | ||
| 1953 | CONFIG_BITREVERSE=y | ||
| 1954 | CONFIG_GENERIC_FIND_LAST_BIT=y | ||
| 1955 | CONFIG_CRC_CCITT=m | ||
| 1956 | CONFIG_CRC16=y | ||
| 1957 | CONFIG_CRC_T10DIF=y | ||
| 1958 | CONFIG_CRC_ITU_T=m | ||
| 1959 | CONFIG_CRC32=y | ||
| 1960 | # CONFIG_CRC7 is not set | ||
| 1961 | CONFIG_LIBCRC32C=m | ||
| 1962 | CONFIG_ZLIB_INFLATE=y | ||
| 1963 | CONFIG_ZLIB_DEFLATE=m | ||
| 1964 | CONFIG_LZO_COMPRESS=m | ||
| 1965 | CONFIG_LZO_DECOMPRESS=m | ||
| 1966 | CONFIG_DECOMPRESS_GZIP=y | ||
| 1967 | CONFIG_DECOMPRESS_BZIP2=y | ||
| 1968 | CONFIG_DECOMPRESS_LZMA=y | ||
| 1969 | CONFIG_TEXTSEARCH=y | ||
| 1970 | CONFIG_TEXTSEARCH_KMP=m | ||
| 1971 | CONFIG_TEXTSEARCH_BM=m | ||
| 1972 | CONFIG_TEXTSEARCH_FSM=m | ||
| 1973 | CONFIG_HAS_IOMEM=y | ||
| 1974 | CONFIG_HAS_IOPORT=y | ||
| 1975 | CONFIG_HAS_DMA=y | ||
| 1976 | CONFIG_HAVE_LMB=y | ||
| 1977 | CONFIG_NLATTR=y | ||
| 1978 | |||
| 1979 | # | ||
| 1980 | # Kernel hacking | ||
| 1981 | # | ||
| 1982 | # CONFIG_PRINTK_TIME is not set | ||
| 1983 | CONFIG_ENABLE_WARN_DEPRECATED=y | ||
| 1984 | CONFIG_ENABLE_MUST_CHECK=y | ||
| 1985 | CONFIG_FRAME_WARN=2048 | ||
| 1986 | CONFIG_MAGIC_SYSRQ=y | ||
| 1987 | # CONFIG_STRIP_ASM_SYMS is not set | ||
| 1988 | # CONFIG_UNUSED_SYMBOLS is not set | ||
| 1989 | CONFIG_DEBUG_FS=y | ||
| 1990 | # CONFIG_HEADERS_CHECK is not set | ||
| 1991 | CONFIG_DEBUG_KERNEL=y | ||
| 1992 | # CONFIG_DEBUG_SHIRQ is not set | ||
| 1993 | CONFIG_DETECT_SOFTLOCKUP=y | ||
| 1994 | # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set | ||
| 1995 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 | ||
| 1996 | CONFIG_DETECT_HUNG_TASK=y | ||
| 1997 | # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set | ||
| 1998 | CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 | ||
| 1999 | CONFIG_SCHED_DEBUG=y | ||
| 2000 | CONFIG_SCHEDSTATS=y | ||
| 2001 | # CONFIG_TIMER_STATS is not set | ||
| 2002 | # CONFIG_DEBUG_OBJECTS is not set | ||
| 2003 | # CONFIG_SLUB_DEBUG_ON is not set | ||
| 2004 | # CONFIG_SLUB_STATS is not set | ||
| 2005 | # CONFIG_DEBUG_KMEMLEAK is not set | ||
| 2006 | # CONFIG_DEBUG_RT_MUTEXES is not set | ||
| 2007 | # CONFIG_RT_MUTEX_TESTER is not set | ||
| 2008 | # CONFIG_DEBUG_SPINLOCK is not set | ||
| 2009 | CONFIG_DEBUG_MUTEXES=y | ||
| 2010 | # CONFIG_DEBUG_LOCK_ALLOC is not set | ||
| 2011 | # CONFIG_PROVE_LOCKING is not set | ||
| 2012 | # CONFIG_LOCK_STAT is not set | ||
| 2013 | CONFIG_TRACE_IRQFLAGS=y | ||
| 2014 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | ||
| 2015 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | ||
| 2016 | CONFIG_STACKTRACE=y | ||
| 2017 | # CONFIG_DEBUG_KOBJECT is not set | ||
| 2018 | CONFIG_DEBUG_BUGVERBOSE=y | ||
| 2019 | # CONFIG_DEBUG_INFO is not set | ||
| 2020 | # CONFIG_DEBUG_VM is not set | ||
| 2021 | # CONFIG_DEBUG_WRITECOUNT is not set | ||
| 2022 | CONFIG_DEBUG_MEMORY_INIT=y | ||
| 2023 | # CONFIG_DEBUG_LIST is not set | ||
| 2024 | # CONFIG_DEBUG_SG is not set | ||
| 2025 | # CONFIG_DEBUG_NOTIFIERS is not set | ||
| 2026 | # CONFIG_DEBUG_CREDENTIALS is not set | ||
| 2027 | # CONFIG_RCU_TORTURE_TEST is not set | ||
| 2028 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
| 2029 | # CONFIG_BACKTRACE_SELF_TEST is not set | ||
| 2030 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set | ||
| 2031 | # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set | ||
| 2032 | # CONFIG_FAULT_INJECTION is not set | ||
| 2033 | CONFIG_LATENCYTOP=y | ||
| 2034 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
| 2035 | # CONFIG_DEBUG_PAGEALLOC is not set | ||
| 2036 | CONFIG_NOP_TRACER=y | ||
| 2037 | CONFIG_HAVE_FUNCTION_TRACER=y | ||
| 2038 | CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y | ||
| 2039 | CONFIG_HAVE_DYNAMIC_FTRACE=y | ||
| 2040 | CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y | ||
| 2041 | CONFIG_TRACER_MAX_TRACE=y | ||
| 2042 | CONFIG_RING_BUFFER=y | ||
| 2043 | CONFIG_EVENT_TRACING=y | ||
| 2044 | CONFIG_CONTEXT_SWITCH_TRACER=y | ||
| 2045 | CONFIG_RING_BUFFER_ALLOW_SWAP=y | ||
| 2046 | CONFIG_TRACING=y | ||
| 2047 | CONFIG_GENERIC_TRACER=y | ||
| 2048 | CONFIG_TRACING_SUPPORT=y | ||
| 2049 | CONFIG_FTRACE=y | ||
| 2050 | # CONFIG_FUNCTION_TRACER is not set | ||
| 2051 | CONFIG_IRQSOFF_TRACER=y | ||
| 2052 | CONFIG_SCHED_TRACER=y | ||
| 2053 | # CONFIG_BOOT_TRACER is not set | ||
| 2054 | CONFIG_BRANCH_PROFILE_NONE=y | ||
| 2055 | # CONFIG_PROFILE_ANNOTATED_BRANCHES is not set | ||
| 2056 | # CONFIG_PROFILE_ALL_BRANCHES is not set | ||
| 2057 | # CONFIG_STACK_TRACER is not set | ||
| 2058 | # CONFIG_KMEMTRACE is not set | ||
| 2059 | # CONFIG_WORKQUEUE_TRACER is not set | ||
| 2060 | CONFIG_BLK_DEV_IO_TRACE=y | ||
| 2061 | # CONFIG_FTRACE_STARTUP_TEST is not set | ||
| 2062 | # CONFIG_RING_BUFFER_BENCHMARK is not set | ||
| 2063 | # CONFIG_DYNAMIC_DEBUG is not set | ||
| 2064 | # CONFIG_DMA_API_DEBUG is not set | ||
| 2065 | # CONFIG_SAMPLES is not set | ||
| 2066 | CONFIG_HAVE_ARCH_KGDB=y | ||
| 2067 | # CONFIG_KGDB is not set | ||
| 2068 | # CONFIG_PPC_DISABLE_WERROR is not set | ||
| 2069 | CONFIG_PPC_WERROR=y | ||
| 2070 | CONFIG_PRINT_STACK_DEPTH=64 | ||
| 2071 | CONFIG_DEBUG_STACKOVERFLOW=y | ||
| 2072 | CONFIG_DEBUG_STACK_USAGE=y | ||
| 2073 | # CONFIG_PPC_EMULATED_STATS is not set | ||
| 2074 | CONFIG_CODE_PATCHING_SELFTEST=y | ||
| 2075 | CONFIG_FTR_FIXUP_SELFTEST=y | ||
| 2076 | CONFIG_MSI_BITMAP_SELFTEST=y | ||
| 2077 | CONFIG_XMON=y | ||
| 2078 | # CONFIG_XMON_DEFAULT is not set | ||
| 2079 | CONFIG_XMON_DISASSEMBLY=y | ||
| 2080 | CONFIG_DEBUGGER=y | ||
| 2081 | CONFIG_IRQSTACKS=y | ||
| 2082 | # CONFIG_VIRQ_DEBUG is not set | ||
| 2083 | # CONFIG_PPC_EARLY_DEBUG is not set | ||
| 2084 | |||
| 2085 | # | ||
| 2086 | # Security options | ||
| 2087 | # | ||
| 2088 | # CONFIG_KEYS is not set | ||
| 2089 | # CONFIG_SECURITY is not set | ||
| 2090 | # CONFIG_SECURITYFS is not set | ||
| 2091 | # CONFIG_SECURITY_FILE_CAPABILITIES is not set | ||
| 2092 | CONFIG_XOR_BLOCKS=y | ||
| 2093 | CONFIG_ASYNC_CORE=y | ||
| 2094 | CONFIG_ASYNC_MEMCPY=y | ||
| 2095 | CONFIG_ASYNC_XOR=y | ||
| 2096 | CONFIG_ASYNC_PQ=y | ||
| 2097 | CONFIG_ASYNC_RAID6_RECOV=y | ||
| 2098 | CONFIG_CRYPTO=y | ||
| 2099 | |||
| 2100 | # | ||
| 2101 | # Crypto core or helper | ||
| 2102 | # | ||
| 2103 | CONFIG_CRYPTO_ALGAPI=y | ||
| 2104 | CONFIG_CRYPTO_ALGAPI2=y | ||
| 2105 | CONFIG_CRYPTO_AEAD=m | ||
| 2106 | CONFIG_CRYPTO_AEAD2=y | ||
| 2107 | CONFIG_CRYPTO_BLKCIPHER=y | ||
| 2108 | CONFIG_CRYPTO_BLKCIPHER2=y | ||
| 2109 | CONFIG_CRYPTO_HASH=y | ||
| 2110 | CONFIG_CRYPTO_HASH2=y | ||
| 2111 | CONFIG_CRYPTO_RNG=m | ||
| 2112 | CONFIG_CRYPTO_RNG2=y | ||
| 2113 | CONFIG_CRYPTO_PCOMP=y | ||
| 2114 | CONFIG_CRYPTO_MANAGER=y | ||
| 2115 | CONFIG_CRYPTO_MANAGER2=y | ||
| 2116 | CONFIG_CRYPTO_GF128MUL=m | ||
| 2117 | CONFIG_CRYPTO_NULL=m | ||
| 2118 | CONFIG_CRYPTO_WORKQUEUE=y | ||
| 2119 | # CONFIG_CRYPTO_CRYPTD is not set | ||
| 2120 | CONFIG_CRYPTO_AUTHENC=m | ||
| 2121 | CONFIG_CRYPTO_TEST=m | ||
| 2122 | |||
| 2123 | # | ||
| 2124 | # Authenticated Encryption with Associated Data | ||
| 2125 | # | ||
| 2126 | CONFIG_CRYPTO_CCM=m | ||
| 2127 | CONFIG_CRYPTO_GCM=m | ||
| 2128 | CONFIG_CRYPTO_SEQIV=m | ||
| 2129 | |||
| 2130 | # | ||
| 2131 | # Block modes | ||
| 2132 | # | ||
| 2133 | CONFIG_CRYPTO_CBC=y | ||
| 2134 | CONFIG_CRYPTO_CTR=m | ||
| 2135 | # CONFIG_CRYPTO_CTS is not set | ||
| 2136 | CONFIG_CRYPTO_ECB=m | ||
| 2137 | # CONFIG_CRYPTO_LRW is not set | ||
| 2138 | CONFIG_CRYPTO_PCBC=m | ||
| 2139 | # CONFIG_CRYPTO_XTS is not set | ||
| 2140 | |||
| 2141 | # | ||
| 2142 | # Hash modes | ||
| 2143 | # | ||
| 2144 | CONFIG_CRYPTO_HMAC=y | ||
| 2145 | # CONFIG_CRYPTO_XCBC is not set | ||
| 2146 | # CONFIG_CRYPTO_VMAC is not set | ||
| 2147 | |||
| 2148 | # | ||
| 2149 | # Digest | ||
| 2150 | # | ||
| 2151 | CONFIG_CRYPTO_CRC32C=m | ||
| 2152 | CONFIG_CRYPTO_GHASH=m | ||
| 2153 | CONFIG_CRYPTO_MD4=m | ||
| 2154 | CONFIG_CRYPTO_MD5=y | ||
| 2155 | CONFIG_CRYPTO_MICHAEL_MIC=m | ||
| 2156 | # CONFIG_CRYPTO_RMD128 is not set | ||
| 2157 | # CONFIG_CRYPTO_RMD160 is not set | ||
| 2158 | # CONFIG_CRYPTO_RMD256 is not set | ||
| 2159 | # CONFIG_CRYPTO_RMD320 is not set | ||
| 2160 | CONFIG_CRYPTO_SHA1=m | ||
| 2161 | CONFIG_CRYPTO_SHA256=m | ||
| 2162 | CONFIG_CRYPTO_SHA512=m | ||
| 2163 | CONFIG_CRYPTO_TGR192=m | ||
| 2164 | CONFIG_CRYPTO_WP512=m | ||
| 2165 | |||
| 2166 | # | ||
| 2167 | # Ciphers | ||
| 2168 | # | ||
| 2169 | CONFIG_CRYPTO_AES=m | ||
| 2170 | CONFIG_CRYPTO_ANUBIS=m | ||
| 2171 | CONFIG_CRYPTO_ARC4=m | ||
| 2172 | CONFIG_CRYPTO_BLOWFISH=m | ||
| 2173 | # CONFIG_CRYPTO_CAMELLIA is not set | ||
| 2174 | CONFIG_CRYPTO_CAST5=m | ||
| 2175 | CONFIG_CRYPTO_CAST6=m | ||
| 2176 | CONFIG_CRYPTO_DES=y | ||
| 2177 | # CONFIG_CRYPTO_FCRYPT is not set | ||
| 2178 | CONFIG_CRYPTO_KHAZAD=m | ||
| 2179 | CONFIG_CRYPTO_SALSA20=m | ||
| 2180 | # CONFIG_CRYPTO_SEED is not set | ||
| 2181 | CONFIG_CRYPTO_SERPENT=m | ||
| 2182 | CONFIG_CRYPTO_TEA=m | ||
| 2183 | CONFIG_CRYPTO_TWOFISH=m | ||
| 2184 | CONFIG_CRYPTO_TWOFISH_COMMON=m | ||
| 2185 | |||
| 2186 | # | ||
| 2187 | # Compression | ||
| 2188 | # | ||
| 2189 | CONFIG_CRYPTO_DEFLATE=m | ||
| 2190 | # CONFIG_CRYPTO_ZLIB is not set | ||
| 2191 | CONFIG_CRYPTO_LZO=m | ||
| 2192 | |||
| 2193 | # | ||
| 2194 | # Random Number Generation | ||
| 2195 | # | ||
| 2196 | # CONFIG_CRYPTO_ANSI_CPRNG is not set | ||
| 2197 | # CONFIG_CRYPTO_HW is not set | ||
| 2198 | # CONFIG_PPC_CLOCK is not set | ||
| 2199 | # CONFIG_VIRTUALIZATION is not set | ||
diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h index 3a179827528d..20778a405d7a 100644 --- a/arch/powerpc/include/asm/firmware.h +++ b/arch/powerpc/include/asm/firmware.h | |||
| @@ -37,7 +37,7 @@ | |||
| 37 | #define FW_FEATURE_VIO ASM_CONST(0x0000000000004000) | 37 | #define FW_FEATURE_VIO ASM_CONST(0x0000000000004000) |
| 38 | #define FW_FEATURE_RDMA ASM_CONST(0x0000000000008000) | 38 | #define FW_FEATURE_RDMA ASM_CONST(0x0000000000008000) |
| 39 | #define FW_FEATURE_LLAN ASM_CONST(0x0000000000010000) | 39 | #define FW_FEATURE_LLAN ASM_CONST(0x0000000000010000) |
| 40 | #define FW_FEATURE_BULK ASM_CONST(0x0000000000020000) | 40 | #define FW_FEATURE_BULK_REMOVE ASM_CONST(0x0000000000020000) |
| 41 | #define FW_FEATURE_XDABR ASM_CONST(0x0000000000040000) | 41 | #define FW_FEATURE_XDABR ASM_CONST(0x0000000000040000) |
| 42 | #define FW_FEATURE_MULTITCE ASM_CONST(0x0000000000080000) | 42 | #define FW_FEATURE_MULTITCE ASM_CONST(0x0000000000080000) |
| 43 | #define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000) | 43 | #define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000) |
| @@ -45,8 +45,7 @@ | |||
| 45 | #define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000) | 45 | #define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000) |
| 46 | #define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000) | 46 | #define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000) |
| 47 | #define FW_FEATURE_BEAT ASM_CONST(0x0000000001000000) | 47 | #define FW_FEATURE_BEAT ASM_CONST(0x0000000001000000) |
| 48 | #define FW_FEATURE_BULK_REMOVE ASM_CONST(0x0000000002000000) | 48 | #define FW_FEATURE_CMO ASM_CONST(0x0000000002000000) |
| 49 | #define FW_FEATURE_CMO ASM_CONST(0x0000000004000000) | ||
| 50 | 49 | ||
| 51 | #ifndef __ASSEMBLY__ | 50 | #ifndef __ASSEMBLY__ |
| 52 | 51 | ||
| @@ -58,8 +57,9 @@ enum { | |||
| 58 | FW_FEATURE_PERF | FW_FEATURE_DUMP | FW_FEATURE_INTERRUPT | | 57 | FW_FEATURE_PERF | FW_FEATURE_DUMP | FW_FEATURE_INTERRUPT | |
| 59 | FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ | | 58 | FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ | |
| 60 | FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | | 59 | FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | |
| 61 | FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE | | 60 | FW_FEATURE_BULK_REMOVE | FW_FEATURE_XDABR | |
| 62 | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR | FW_FEATURE_CMO, | 61 | FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR | FW_FEATURE_LPAR | |
| 62 | FW_FEATURE_CMO, | ||
| 63 | FW_FEATURE_PSERIES_ALWAYS = 0, | 63 | FW_FEATURE_PSERIES_ALWAYS = 0, |
| 64 | FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, | 64 | FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, |
| 65 | FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, | 65 | FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 0b9c9135922e..03c862b6a9c4 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
| @@ -711,6 +711,8 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
| 711 | .cpu_setup = __setup_cpu_750, | 711 | .cpu_setup = __setup_cpu_750, |
| 712 | .machine_check = machine_check_generic, | 712 | .machine_check = machine_check_generic, |
| 713 | .platform = "ppc750", | 713 | .platform = "ppc750", |
| 714 | .oprofile_cpu_type = "ppc/750", | ||
| 715 | .oprofile_type = PPC_OPROFILE_G4, | ||
| 714 | }, | 716 | }, |
| 715 | { /* 745/755 */ | 717 | { /* 745/755 */ |
| 716 | .pvr_mask = 0xfffff000, | 718 | .pvr_mask = 0xfffff000, |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 900e0eea0099..9763267e38b4 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
| @@ -658,42 +658,43 @@ do_work: | |||
| 658 | cmpdi r0,0 | 658 | cmpdi r0,0 |
| 659 | crandc eq,cr1*4+eq,eq | 659 | crandc eq,cr1*4+eq,eq |
| 660 | bne restore | 660 | bne restore |
| 661 | /* here we are preempting the current task */ | 661 | |
| 662 | 1: | 662 | /* Here we are preempting the current task. |
| 663 | #ifdef CONFIG_TRACE_IRQFLAGS | 663 | * |
| 664 | bl .trace_hardirqs_on | 664 | * Ensure interrupts are soft-disabled. We also properly mark |
| 665 | /* Note: we just clobbered r10 which used to contain the previous | 665 | * the PACA to reflect the fact that they are hard-disabled |
| 666 | * MSR before the hard-disabling done by the caller of do_work. | 666 | * and trace the change |
| 667 | * We don't have that value anymore, but it doesn't matter as | ||
| 668 | * we will hard-enable unconditionally, we can just reload the | ||
| 669 | * current MSR into r10 | ||
| 670 | */ | 667 | */ |
| 671 | mfmsr r10 | 668 | li r0,0 |
| 672 | #endif /* CONFIG_TRACE_IRQFLAGS */ | ||
| 673 | li r0,1 | ||
| 674 | stb r0,PACASOFTIRQEN(r13) | 669 | stb r0,PACASOFTIRQEN(r13) |
| 675 | stb r0,PACAHARDIRQEN(r13) | 670 | stb r0,PACAHARDIRQEN(r13) |
| 671 | TRACE_DISABLE_INTS | ||
| 672 | |||
| 673 | /* Call the scheduler with soft IRQs off */ | ||
| 674 | 1: bl .preempt_schedule_irq | ||
| 675 | |||
| 676 | /* Hard-disable interrupts again (and update PACA) */ | ||
| 676 | #ifdef CONFIG_PPC_BOOK3E | 677 | #ifdef CONFIG_PPC_BOOK3E |
| 677 | wrteei 1 | ||
| 678 | bl .preempt_schedule | ||
| 679 | wrteei 0 | 678 | wrteei 0 |
| 680 | #else | 679 | #else |
| 681 | ori r10,r10,MSR_EE | ||
| 682 | mtmsrd r10,1 /* reenable interrupts */ | ||
| 683 | bl .preempt_schedule | ||
| 684 | mfmsr r10 | 680 | mfmsr r10 |
| 685 | clrrdi r9,r1,THREAD_SHIFT | 681 | rldicl r10,r10,48,1 |
| 686 | rldicl r10,r10,48,1 /* disable interrupts again */ | ||
| 687 | rotldi r10,r10,16 | 682 | rotldi r10,r10,16 |
| 688 | mtmsrd r10,1 | 683 | mtmsrd r10,1 |
| 689 | #endif /* CONFIG_PPC_BOOK3E */ | 684 | #endif /* CONFIG_PPC_BOOK3E */ |
| 685 | li r0,0 | ||
| 686 | stb r0,PACAHARDIRQEN(r13) | ||
| 687 | |||
| 688 | /* Re-test flags and eventually loop */ | ||
| 689 | clrrdi r9,r1,THREAD_SHIFT | ||
| 690 | ld r4,TI_FLAGS(r9) | 690 | ld r4,TI_FLAGS(r9) |
| 691 | andi. r0,r4,_TIF_NEED_RESCHED | 691 | andi. r0,r4,_TIF_NEED_RESCHED |
| 692 | bne 1b | 692 | bne 1b |
| 693 | b restore | 693 | b restore |
| 694 | 694 | ||
| 695 | user_work: | 695 | user_work: |
| 696 | #endif | 696 | #endif /* CONFIG_PREEMPT */ |
| 697 | |||
| 697 | /* Enable interrupts */ | 698 | /* Enable interrupts */ |
| 698 | #ifdef CONFIG_PPC_BOOK3E | 699 | #ifdef CONFIG_PPC_BOOK3E |
| 699 | wrteei 1 | 700 | wrteei 1 |
| @@ -1038,8 +1039,7 @@ _GLOBAL(mod_return_to_handler) | |||
| 1038 | * We are in a module using the module's TOC. | 1039 | * We are in a module using the module's TOC. |
| 1039 | * Switch to our TOC to run inside the core kernel. | 1040 | * Switch to our TOC to run inside the core kernel. |
| 1040 | */ | 1041 | */ |
| 1041 | LOAD_REG_IMMEDIATE(r4,ftrace_return_to_handler) | 1042 | ld r2, PACATOC(r13) |
| 1042 | ld r2, 8(r4) | ||
| 1043 | 1043 | ||
| 1044 | bl .ftrace_return_to_handler | 1044 | bl .ftrace_return_to_handler |
| 1045 | nop | 1045 | nop |
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c index fe8f71dd0b3f..641c74bb8e27 100644 --- a/arch/powerpc/kernel/kgdb.c +++ b/arch/powerpc/kernel/kgdb.c | |||
| @@ -282,12 +282,6 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) | |||
| 282 | { | 282 | { |
| 283 | unsigned long *ptr = gdb_regs; | 283 | unsigned long *ptr = gdb_regs; |
| 284 | int reg; | 284 | int reg; |
| 285 | #ifdef CONFIG_SPE | ||
| 286 | union { | ||
| 287 | u32 v32[2]; | ||
| 288 | u64 v64; | ||
| 289 | } acc; | ||
| 290 | #endif | ||
| 291 | 285 | ||
| 292 | for (reg = 0; reg < 32; reg++) | 286 | for (reg = 0; reg < 32; reg++) |
| 293 | UNPACK64(regs->gpr[reg], ptr); | 287 | UNPACK64(regs->gpr[reg], ptr); |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index bb8209e34931..e8dfdbd9327a 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
| @@ -1190,7 +1190,7 @@ EXPORT_SYMBOL(pcibios_align_resource); | |||
| 1190 | * Reparent resource children of pr that conflict with res | 1190 | * Reparent resource children of pr that conflict with res |
| 1191 | * under res, and make res replace those children. | 1191 | * under res, and make res replace those children. |
| 1192 | */ | 1192 | */ |
| 1193 | static int __init reparent_resources(struct resource *parent, | 1193 | static int reparent_resources(struct resource *parent, |
| 1194 | struct resource *res) | 1194 | struct resource *res) |
| 1195 | { | 1195 | { |
| 1196 | struct resource *p, **pp; | 1196 | struct resource *p, **pp; |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index ba949a2c93ac..ccf56ac92de5 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
| @@ -97,7 +97,9 @@ int pcibios_unmap_io_space(struct pci_bus *bus) | |||
| 97 | * to do an appropriate TLB flush here too | 97 | * to do an appropriate TLB flush here too |
| 98 | */ | 98 | */ |
| 99 | if (bus->self) { | 99 | if (bus->self) { |
| 100 | #ifdef CONFIG_PPC_STD_MMU_64 | ||
| 100 | struct resource *res = bus->resource[0]; | 101 | struct resource *res = bus->resource[0]; |
| 102 | #endif | ||
| 101 | 103 | ||
| 102 | pr_debug("IO unmapping for PCI-PCI bridge %s\n", | 104 | pr_debug("IO unmapping for PCI-PCI bridge %s\n", |
| 103 | pci_name(bus->self)); | 105 | pci_name(bus->self)); |
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c index bbcbae183e92..87f1663584b0 100644 --- a/arch/powerpc/kernel/perf_event.c +++ b/arch/powerpc/kernel/perf_event.c | |||
| @@ -116,20 +116,23 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp) | |||
| 116 | static inline u32 perf_get_misc_flags(struct pt_regs *regs) | 116 | static inline u32 perf_get_misc_flags(struct pt_regs *regs) |
| 117 | { | 117 | { |
| 118 | unsigned long mmcra = regs->dsisr; | 118 | unsigned long mmcra = regs->dsisr; |
| 119 | unsigned long sihv = MMCRA_SIHV; | ||
| 120 | unsigned long sipr = MMCRA_SIPR; | ||
| 119 | 121 | ||
| 120 | if (TRAP(regs) != 0xf00) | 122 | if (TRAP(regs) != 0xf00) |
| 121 | return 0; /* not a PMU interrupt */ | 123 | return 0; /* not a PMU interrupt */ |
| 122 | 124 | ||
| 123 | if (ppmu->flags & PPMU_ALT_SIPR) { | 125 | if (ppmu->flags & PPMU_ALT_SIPR) { |
| 124 | if (mmcra & POWER6_MMCRA_SIHV) | 126 | sihv = POWER6_MMCRA_SIHV; |
| 125 | return PERF_RECORD_MISC_HYPERVISOR; | 127 | sipr = POWER6_MMCRA_SIPR; |
| 126 | return (mmcra & POWER6_MMCRA_SIPR) ? | ||
| 127 | PERF_RECORD_MISC_USER : PERF_RECORD_MISC_KERNEL; | ||
| 128 | } | 128 | } |
| 129 | if (mmcra & MMCRA_SIHV) | 129 | |
| 130 | /* PR has priority over HV, so order below is important */ | ||
| 131 | if (mmcra & sipr) | ||
| 132 | return PERF_RECORD_MISC_USER; | ||
| 133 | if ((mmcra & sihv) && (freeze_events_kernel != MMCR0_FCHV)) | ||
| 130 | return PERF_RECORD_MISC_HYPERVISOR; | 134 | return PERF_RECORD_MISC_HYPERVISOR; |
| 131 | return (mmcra & MMCRA_SIPR) ? PERF_RECORD_MISC_USER : | 135 | return PERF_RECORD_MISC_KERNEL; |
| 132 | PERF_RECORD_MISC_KERNEL; | ||
| 133 | } | 136 | } |
| 134 | 137 | ||
| 135 | /* | 138 | /* |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 1168c5f440ab..c930ac38e59f 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
| @@ -1016,9 +1016,13 @@ void show_stack(struct task_struct *tsk, unsigned long *stack) | |||
| 1016 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 1016 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 1017 | int curr_frame = current->curr_ret_stack; | 1017 | int curr_frame = current->curr_ret_stack; |
| 1018 | extern void return_to_handler(void); | 1018 | extern void return_to_handler(void); |
| 1019 | unsigned long addr = (unsigned long)return_to_handler; | 1019 | unsigned long rth = (unsigned long)return_to_handler; |
| 1020 | unsigned long mrth = -1; | ||
| 1020 | #ifdef CONFIG_PPC64 | 1021 | #ifdef CONFIG_PPC64 |
| 1021 | addr = *(unsigned long*)addr; | 1022 | extern void mod_return_to_handler(void); |
| 1023 | rth = *(unsigned long *)rth; | ||
| 1024 | mrth = (unsigned long)mod_return_to_handler; | ||
| 1025 | mrth = *(unsigned long *)mrth; | ||
| 1022 | #endif | 1026 | #endif |
| 1023 | #endif | 1027 | #endif |
| 1024 | 1028 | ||
| @@ -1044,7 +1048,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack) | |||
| 1044 | if (!firstframe || ip != lr) { | 1048 | if (!firstframe || ip != lr) { |
| 1045 | printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip); | 1049 | printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip); |
| 1046 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 1050 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 1047 | if (ip == addr && curr_frame >= 0) { | 1051 | if ((ip == rth || ip == mrth) && curr_frame >= 0) { |
| 1048 | printk(" (%pS)", | 1052 | printk(" (%pS)", |
| 1049 | (void *)current->ret_stack[curr_frame].ret); | 1053 | (void *)current->ret_stack[curr_frame].ret); |
| 1050 | curr_frame--; | 1054 | curr_frame--; |
| @@ -1168,7 +1172,7 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) | |||
| 1168 | unsigned long base = mm->brk; | 1172 | unsigned long base = mm->brk; |
| 1169 | unsigned long ret; | 1173 | unsigned long ret; |
| 1170 | 1174 | ||
| 1171 | #ifdef CONFIG_PPC64 | 1175 | #ifdef CONFIG_PPC_STD_MMU_64 |
| 1172 | /* | 1176 | /* |
| 1173 | * If we are using 1TB segments and we are allowed to randomise | 1177 | * If we are using 1TB segments and we are allowed to randomise |
| 1174 | * the heap, we can put it above 1TB so it is backed by a 1TB | 1178 | * the heap, we can put it above 1TB so it is backed by a 1TB |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 797ea95aae2e..04f638d82fb3 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
| @@ -57,7 +57,6 @@ | |||
| 57 | #include <asm/cache.h> | 57 | #include <asm/cache.h> |
| 58 | #include <asm/page.h> | 58 | #include <asm/page.h> |
| 59 | #include <asm/mmu.h> | 59 | #include <asm/mmu.h> |
| 60 | #include <asm/mmu-hash64.h> | ||
| 61 | #include <asm/firmware.h> | 60 | #include <asm/firmware.h> |
| 62 | #include <asm/xmon.h> | 61 | #include <asm/xmon.h> |
| 63 | #include <asm/udbg.h> | 62 | #include <asm/udbg.h> |
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index 94e2df3cae07..137dc22afa42 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c | |||
| @@ -50,6 +50,9 @@ | |||
| 50 | /* Max supported size for symbol names */ | 50 | /* Max supported size for symbol names */ |
| 51 | #define MAX_SYMNAME 64 | 51 | #define MAX_SYMNAME 64 |
| 52 | 52 | ||
| 53 | /* The alignment of the vDSO */ | ||
| 54 | #define VDSO_ALIGNMENT (1 << 16) | ||
| 55 | |||
| 53 | extern char vdso32_start, vdso32_end; | 56 | extern char vdso32_start, vdso32_end; |
| 54 | static void *vdso32_kbase = &vdso32_start; | 57 | static void *vdso32_kbase = &vdso32_start; |
| 55 | static unsigned int vdso32_pages; | 58 | static unsigned int vdso32_pages; |
| @@ -231,15 +234,21 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
| 231 | * pick a base address for the vDSO in process space. We try to put it | 234 | * pick a base address for the vDSO in process space. We try to put it |
| 232 | * at vdso_base which is the "natural" base for it, but we might fail | 235 | * at vdso_base which is the "natural" base for it, but we might fail |
| 233 | * and end up putting it elsewhere. | 236 | * and end up putting it elsewhere. |
| 237 | * Add enough to the size so that the result can be aligned. | ||
| 234 | */ | 238 | */ |
| 235 | down_write(&mm->mmap_sem); | 239 | down_write(&mm->mmap_sem); |
| 236 | vdso_base = get_unmapped_area(NULL, vdso_base, | 240 | vdso_base = get_unmapped_area(NULL, vdso_base, |
| 237 | vdso_pages << PAGE_SHIFT, 0, 0); | 241 | (vdso_pages << PAGE_SHIFT) + |
| 242 | ((VDSO_ALIGNMENT - 1) & PAGE_MASK), | ||
| 243 | 0, 0); | ||
| 238 | if (IS_ERR_VALUE(vdso_base)) { | 244 | if (IS_ERR_VALUE(vdso_base)) { |
| 239 | rc = vdso_base; | 245 | rc = vdso_base; |
| 240 | goto fail_mmapsem; | 246 | goto fail_mmapsem; |
| 241 | } | 247 | } |
| 242 | 248 | ||
| 249 | /* Add required alignment. */ | ||
| 250 | vdso_base = ALIGN(vdso_base, VDSO_ALIGNMENT); | ||
| 251 | |||
| 243 | /* | 252 | /* |
| 244 | * Put vDSO base into mm struct. We need to do this before calling | 253 | * Put vDSO base into mm struct. We need to do this before calling |
| 245 | * install_special_mapping or the perf counter mmap tracking code | 254 | * install_special_mapping or the perf counter mmap tracking code |
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S index 904ef1360dd7..0546bcd49cd0 100644 --- a/arch/powerpc/kernel/vdso32/vdso32.lds.S +++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S | |||
| @@ -25,7 +25,7 @@ SECTIONS | |||
| 25 | . = ALIGN(16); | 25 | . = ALIGN(16); |
| 26 | .text : { | 26 | .text : { |
| 27 | *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) | 27 | *(.text .stub .text.* .gnu.linkonce.t.* __ftr_alt_*) |
| 28 | } | 28 | } :text |
| 29 | PROVIDE(__etext = .); | 29 | PROVIDE(__etext = .); |
| 30 | PROVIDE(_etext = .); | 30 | PROVIDE(_etext = .); |
| 31 | PROVIDE(etext = .); | 31 | PROVIDE(etext = .); |
| @@ -56,7 +56,7 @@ SECTIONS | |||
| 56 | .fixup : { *(.fixup) } | 56 | .fixup : { *(.fixup) } |
| 57 | 57 | ||
| 58 | .dynamic : { *(.dynamic) } :text :dynamic | 58 | .dynamic : { *(.dynamic) } :text :dynamic |
| 59 | .got : { *(.got) } | 59 | .got : { *(.got) } :text |
| 60 | .plt : { *(.plt) } | 60 | .plt : { *(.plt) } |
| 61 | 61 | ||
| 62 | _end = .; | 62 | _end = .; |
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index f56429362a12..27735a7ac12b 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S | |||
| @@ -236,6 +236,7 @@ SECTIONS | |||
| 236 | READ_MOSTLY_DATA(L1_CACHE_BYTES) | 236 | READ_MOSTLY_DATA(L1_CACHE_BYTES) |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | . = ALIGN(PAGE_SIZE); | ||
| 239 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { | 240 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { |
| 240 | NOSAVE_DATA | 241 | NOSAVE_DATA |
| 241 | } | 242 | } |
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S index bc44dc4b5c67..95ce35581696 100644 --- a/arch/powerpc/mm/slb_low.S +++ b/arch/powerpc/mm/slb_low.S | |||
| @@ -72,19 +72,17 @@ _GLOBAL(slb_miss_kernel_load_vmemmap) | |||
| 72 | 1: | 72 | 1: |
| 73 | #endif /* CONFIG_SPARSEMEM_VMEMMAP */ | 73 | #endif /* CONFIG_SPARSEMEM_VMEMMAP */ |
| 74 | 74 | ||
| 75 | /* vmalloc/ioremap mapping encoding bits, the "li" instructions below | 75 | /* vmalloc mapping gets the encoding from the PACA as the mapping |
| 76 | * will be patched by the kernel at boot | 76 | * can be demoted from 64K -> 4K dynamically on some machines |
| 77 | */ | 77 | */ |
| 78 | BEGIN_FTR_SECTION | ||
| 79 | /* check whether this is in vmalloc or ioremap space */ | ||
| 80 | clrldi r11,r10,48 | 78 | clrldi r11,r10,48 |
| 81 | cmpldi r11,(VMALLOC_SIZE >> 28) - 1 | 79 | cmpldi r11,(VMALLOC_SIZE >> 28) - 1 |
| 82 | bgt 5f | 80 | bgt 5f |
| 83 | lhz r11,PACAVMALLOCSLLP(r13) | 81 | lhz r11,PACAVMALLOCSLLP(r13) |
| 84 | b 6f | 82 | b 6f |
| 85 | 5: | 83 | 5: |
| 86 | END_FTR_SECTION_IFCLR(CPU_FTR_CI_LARGE_PAGE) | 84 | /* IO mapping */ |
| 87 | _GLOBAL(slb_miss_kernel_load_io) | 85 | _GLOBAL(slb_miss_kernel_load_io) |
| 88 | li r11,0 | 86 | li r11,0 |
| 89 | 6: | 87 | 6: |
| 90 | BEGIN_FTR_SECTION | 88 | BEGIN_FTR_SECTION |
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index aca5741ddc67..a86c34b3bb84 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c | |||
| @@ -365,7 +365,7 @@ static int axon_msi_probe(struct of_device *device, | |||
| 365 | printk(KERN_ERR | 365 | printk(KERN_ERR |
| 366 | "axon_msi: couldn't parse dcr properties on %s\n", | 366 | "axon_msi: couldn't parse dcr properties on %s\n", |
| 367 | dn->full_name); | 367 | dn->full_name); |
| 368 | goto out; | 368 | goto out_free_msic; |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | msic->dcr_host = dcr_map(dn, dcr_base, dcr_len); | 371 | msic->dcr_host = dcr_map(dn, dcr_base, dcr_len); |
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile index cc7161ff1666..ce014928d460 100644 --- a/arch/powerpc/platforms/iseries/Makefile +++ b/arch/powerpc/platforms/iseries/Makefile | |||
| @@ -1,18 +1,9 @@ | |||
| 1 | EXTRA_CFLAGS += -mno-minimal-toc | 1 | EXTRA_CFLAGS += -mno-minimal-toc |
| 2 | 2 | ||
| 3 | extra-y += dt.o | ||
| 4 | |||
| 5 | obj-y += exception.o | 3 | obj-y += exception.o |
| 6 | obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \ | 4 | obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt.o mf.o lpevents.o \ |
| 7 | hvcall.o proc.o htab.o iommu.o misc.o irq.o | 5 | hvcall.o proc.o htab.o iommu.o misc.o irq.o |
| 8 | obj-$(CONFIG_PCI) += pci.o | 6 | obj-$(CONFIG_PCI) += pci.o |
| 9 | obj-$(CONFIG_SMP) += smp.o | 7 | obj-$(CONFIG_SMP) += smp.o |
| 10 | obj-$(CONFIG_VIOPATH) += viopath.o vio.o | 8 | obj-$(CONFIG_VIOPATH) += viopath.o vio.o |
| 11 | obj-$(CONFIG_MODULES) += ksyms.o | 9 | obj-$(CONFIG_MODULES) += ksyms.o |
| 12 | |||
| 13 | quiet_cmd_dt_strings = DT_STR $@ | ||
| 14 | cmd_dt_strings = $(OBJCOPY) --rename-section .rodata.str1.8=.dt_strings \ | ||
| 15 | $< $@ | ||
| 16 | |||
| 17 | $(obj)/dt_mod.o: $(obj)/dt.o | ||
| 18 | $(call if_changed,dt_strings) | ||
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c index c5a87a72057b..7f45a51fe793 100644 --- a/arch/powerpc/platforms/iseries/dt.c +++ b/arch/powerpc/platforms/iseries/dt.c | |||
| @@ -51,11 +51,16 @@ | |||
| 51 | 51 | ||
| 52 | /* | 52 | /* |
| 53 | * These are created by the linker script at the start and end | 53 | * These are created by the linker script at the start and end |
| 54 | * of the section containing all the strings from this file. | 54 | * of the section containing all the strings marked with the DS macro. |
| 55 | */ | 55 | */ |
| 56 | extern char __dt_strings_start[]; | 56 | extern char __dt_strings_start[]; |
| 57 | extern char __dt_strings_end[]; | 57 | extern char __dt_strings_end[]; |
| 58 | 58 | ||
| 59 | #define DS(s) ({ \ | ||
| 60 | static const char __s[] __attribute__((section(".dt_strings"))) = s; \ | ||
| 61 | __s; \ | ||
| 62 | }) | ||
| 63 | |||
| 59 | struct iseries_flat_dt { | 64 | struct iseries_flat_dt { |
| 60 | struct boot_param_header header; | 65 | struct boot_param_header header; |
| 61 | u64 reserve_map[2]; | 66 | u64 reserve_map[2]; |
| @@ -64,9 +69,8 @@ struct iseries_flat_dt { | |||
| 64 | static void * __initdata dt_data; | 69 | static void * __initdata dt_data; |
| 65 | 70 | ||
| 66 | /* | 71 | /* |
| 67 | * Putting these strings here keeps them out of the section | 72 | * Putting these strings here keeps them out of the .dt_strings section |
| 68 | * that we rename to .dt_strings using objcopy and capture | 73 | * that we capture for the strings blob of the flattened device tree. |
| 69 | * for the strings blob of the flattened device tree. | ||
| 70 | */ | 74 | */ |
| 71 | static char __initdata device_type_cpu[] = "cpu"; | 75 | static char __initdata device_type_cpu[] = "cpu"; |
| 72 | static char __initdata device_type_memory[] = "memory"; | 76 | static char __initdata device_type_memory[] = "memory"; |
| @@ -173,7 +177,7 @@ static void __init dt_start_node(struct iseries_flat_dt *dt, const char *name) | |||
| 173 | 177 | ||
| 174 | #define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE) | 178 | #define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE) |
| 175 | 179 | ||
| 176 | static void __init dt_prop(struct iseries_flat_dt *dt, const char *name, | 180 | static void __init __dt_prop(struct iseries_flat_dt *dt, const char *name, |
| 177 | const void *data, int len) | 181 | const void *data, int len) |
| 178 | { | 182 | { |
| 179 | unsigned long offset; | 183 | unsigned long offset; |
| @@ -191,44 +195,32 @@ static void __init dt_prop(struct iseries_flat_dt *dt, const char *name, | |||
| 191 | /* The actual data. */ | 195 | /* The actual data. */ |
| 192 | dt_push_bytes(dt, data, len); | 196 | dt_push_bytes(dt, data, len); |
| 193 | } | 197 | } |
| 198 | #define dt_prop(dt, name, data, len) __dt_prop((dt), DS(name), (data), (len)) | ||
| 194 | 199 | ||
| 195 | static void __init dt_prop_str(struct iseries_flat_dt *dt, const char *name, | 200 | #define dt_prop_str(dt, name, data) \ |
| 196 | const char *data) | 201 | dt_prop((dt), name, (data), strlen((data)) + 1); /* + 1 for NULL */ |
| 197 | { | ||
| 198 | dt_prop(dt, name, data, strlen(data) + 1); /* + 1 for NULL */ | ||
| 199 | } | ||
| 200 | 202 | ||
| 201 | static void __init dt_prop_u32(struct iseries_flat_dt *dt, const char *name, | 203 | static void __init __dt_prop_u32(struct iseries_flat_dt *dt, const char *name, |
| 202 | u32 data) | 204 | u32 data) |
| 203 | { | 205 | { |
| 204 | dt_prop(dt, name, &data, sizeof(u32)); | 206 | __dt_prop(dt, name, &data, sizeof(u32)); |
| 205 | } | 207 | } |
| 208 | #define dt_prop_u32(dt, name, data) __dt_prop_u32((dt), DS(name), (data)) | ||
| 206 | 209 | ||
| 207 | static void __init __maybe_unused dt_prop_u64(struct iseries_flat_dt *dt, | 210 | static void __init __maybe_unused __dt_prop_u64(struct iseries_flat_dt *dt, |
| 208 | const char *name, | 211 | const char *name, u64 data) |
| 209 | u64 data) | ||
| 210 | { | 212 | { |
| 211 | dt_prop(dt, name, &data, sizeof(u64)); | 213 | __dt_prop(dt, name, &data, sizeof(u64)); |
| 212 | } | 214 | } |
| 215 | #define dt_prop_u64(dt, name, data) __dt_prop_u64((dt), DS(name), (data)) | ||
| 213 | 216 | ||
| 214 | static void __init dt_prop_u64_list(struct iseries_flat_dt *dt, | 217 | #define dt_prop_u64_list(dt, name, data, n) \ |
| 215 | const char *name, u64 *data, int n) | 218 | dt_prop((dt), name, (data), sizeof(u64) * (n)) |
| 216 | { | ||
| 217 | dt_prop(dt, name, data, sizeof(u64) * n); | ||
| 218 | } | ||
| 219 | 219 | ||
| 220 | static void __init dt_prop_u32_list(struct iseries_flat_dt *dt, | 220 | #define dt_prop_u32_list(dt, name, data, n) \ |
| 221 | const char *name, u32 *data, int n) | 221 | dt_prop((dt), name, (data), sizeof(u32) * (n)) |
| 222 | { | ||
| 223 | dt_prop(dt, name, data, sizeof(u32) * n); | ||
| 224 | } | ||
| 225 | 222 | ||
| 226 | #ifdef notyet | 223 | #define dt_prop_empty(dt, name) dt_prop((dt), name, NULL, 0) |
| 227 | static void __init dt_prop_empty(struct iseries_flat_dt *dt, const char *name) | ||
| 228 | { | ||
| 229 | dt_prop(dt, name, NULL, 0); | ||
| 230 | } | ||
| 231 | #endif | ||
| 232 | 224 | ||
| 233 | static void __init dt_cpus(struct iseries_flat_dt *dt) | 225 | static void __init dt_cpus(struct iseries_flat_dt *dt) |
| 234 | { | 226 | { |
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index 21226b74c9b2..414ca9849f23 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c | |||
| @@ -540,8 +540,11 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) | |||
| 540 | /* Make sure IRQ is disabled */ | 540 | /* Make sure IRQ is disabled */ |
| 541 | kw_write_reg(reg_ier, 0); | 541 | kw_write_reg(reg_ier, 0); |
| 542 | 542 | ||
| 543 | /* Request chip interrupt */ | 543 | /* Request chip interrupt. We set IRQF_TIMER because we don't |
| 544 | if (request_irq(host->irq, kw_i2c_irq, 0, "keywest i2c", host)) | 544 | * want that interrupt disabled between the 2 passes of driver |
| 545 | * suspend or we'll have issues running the pfuncs | ||
| 546 | */ | ||
| 547 | if (request_irq(host->irq, kw_i2c_irq, IRQF_TIMER, "keywest i2c", host)) | ||
| 545 | host->irq = NO_IRQ; | 548 | host->irq = NO_IRQ; |
| 546 | 549 | ||
| 547 | printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n", | 550 | printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n", |
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c index 5a707da3f5c2..0a14d8cd314f 100644 --- a/arch/powerpc/platforms/pseries/firmware.c +++ b/arch/powerpc/platforms/pseries/firmware.c | |||
| @@ -51,11 +51,10 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = { | |||
| 51 | {FW_FEATURE_VIO, "hcall-vio"}, | 51 | {FW_FEATURE_VIO, "hcall-vio"}, |
| 52 | {FW_FEATURE_RDMA, "hcall-rdma"}, | 52 | {FW_FEATURE_RDMA, "hcall-rdma"}, |
| 53 | {FW_FEATURE_LLAN, "hcall-lLAN"}, | 53 | {FW_FEATURE_LLAN, "hcall-lLAN"}, |
| 54 | {FW_FEATURE_BULK, "hcall-bulk"}, | 54 | {FW_FEATURE_BULK_REMOVE, "hcall-bulk"}, |
| 55 | {FW_FEATURE_XDABR, "hcall-xdabr"}, | 55 | {FW_FEATURE_XDABR, "hcall-xdabr"}, |
| 56 | {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, | 56 | {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, |
| 57 | {FW_FEATURE_SPLPAR, "hcall-splpar"}, | 57 | {FW_FEATURE_SPLPAR, "hcall-splpar"}, |
| 58 | {FW_FEATURE_BULK_REMOVE, "hcall-bulk"}, | ||
| 59 | }; | 58 | }; |
| 60 | 59 | ||
| 61 | /* Build up the firmware features bitmask using the contents of | 60 | /* Build up the firmware features bitmask using the contents of |
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index c6f0a71b405e..bdbe96c8a7e4 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
| @@ -517,6 +517,15 @@ static int xmon_core(struct pt_regs *regs, int fromipi) | |||
| 517 | in_xmon = 0; | 517 | in_xmon = 0; |
| 518 | #endif | 518 | #endif |
| 519 | 519 | ||
| 520 | #ifdef CONFIG_BOOKE | ||
| 521 | if (regs->msr & MSR_DE) { | ||
| 522 | bp = at_breakpoint(regs->nip); | ||
| 523 | if (bp != NULL) { | ||
| 524 | regs->nip = (unsigned long) &bp->instr[0]; | ||
| 525 | atomic_inc(&bp->ref_count); | ||
| 526 | } | ||
| 527 | } | ||
| 528 | #else | ||
| 520 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) == (MSR_IR|MSR_SF)) { | 529 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) == (MSR_IR|MSR_SF)) { |
| 521 | bp = at_breakpoint(regs->nip); | 530 | bp = at_breakpoint(regs->nip); |
| 522 | if (bp != NULL) { | 531 | if (bp != NULL) { |
| @@ -530,7 +539,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi) | |||
| 530 | } | 539 | } |
| 531 | } | 540 | } |
| 532 | } | 541 | } |
| 533 | 542 | #endif | |
| 534 | insert_cpu_bpts(); | 543 | insert_cpu_bpts(); |
| 535 | 544 | ||
| 536 | local_irq_restore(flags); | 545 | local_irq_restore(flags); |
| @@ -894,6 +903,14 @@ cmds(struct pt_regs *excp) | |||
| 894 | } | 903 | } |
| 895 | } | 904 | } |
| 896 | 905 | ||
| 906 | #ifdef CONFIG_BOOKE | ||
| 907 | static int do_step(struct pt_regs *regs) | ||
| 908 | { | ||
| 909 | regs->msr |= MSR_DE; | ||
| 910 | mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM); | ||
| 911 | return 1; | ||
| 912 | } | ||
| 913 | #else | ||
| 897 | /* | 914 | /* |
| 898 | * Step a single instruction. | 915 | * Step a single instruction. |
| 899 | * Some instructions we emulate, others we execute with MSR_SE set. | 916 | * Some instructions we emulate, others we execute with MSR_SE set. |
| @@ -924,6 +941,7 @@ static int do_step(struct pt_regs *regs) | |||
| 924 | regs->msr |= MSR_SE; | 941 | regs->msr |= MSR_SE; |
| 925 | return 1; | 942 | return 1; |
| 926 | } | 943 | } |
| 944 | #endif | ||
| 927 | 945 | ||
| 928 | static void bootcmds(void) | 946 | static void bootcmds(void) |
| 929 | { | 947 | { |
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c index 704dd396257b..77df726180ba 100644 --- a/arch/s390/hypfs/hypfs_diag.c +++ b/arch/s390/hypfs/hypfs_diag.c | |||
| @@ -438,7 +438,7 @@ static int diag204_probe(void) | |||
| 438 | } | 438 | } |
| 439 | if (diag204((unsigned long)SUBC_STIB6 | | 439 | if (diag204((unsigned long)SUBC_STIB6 | |
| 440 | (unsigned long)INFO_EXT, pages, buf) >= 0) { | 440 | (unsigned long)INFO_EXT, pages, buf) >= 0) { |
| 441 | diag204_store_sc = SUBC_STIB7; | 441 | diag204_store_sc = SUBC_STIB6; |
| 442 | diag204_info_type = INFO_EXT; | 442 | diag204_info_type = INFO_EXT; |
| 443 | goto out; | 443 | goto out; |
| 444 | } | 444 | } |
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c index 802c8ab247f3..0729f36c2fe3 100644 --- a/arch/s390/kernel/processor.c +++ b/arch/s390/kernel/processor.c | |||
| @@ -31,9 +31,9 @@ void __cpuinit print_cpu_info(void) | |||
| 31 | 31 | ||
| 32 | static int show_cpuinfo(struct seq_file *m, void *v) | 32 | static int show_cpuinfo(struct seq_file *m, void *v) |
| 33 | { | 33 | { |
| 34 | static const char *hwcap_str[9] = { | 34 | static const char *hwcap_str[10] = { |
| 35 | "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp", | 35 | "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp", |
| 36 | "edat", "etf3eh" | 36 | "edat", "etf3eh", "highgprs" |
| 37 | }; | 37 | }; |
| 38 | struct _lowcore *lc; | 38 | struct _lowcore *lc; |
| 39 | unsigned long n = (unsigned long) v - 1; | 39 | unsigned long n = (unsigned long) v - 1; |
| @@ -48,7 +48,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 48 | num_online_cpus(), loops_per_jiffy/(500000/HZ), | 48 | num_online_cpus(), loops_per_jiffy/(500000/HZ), |
| 49 | (loops_per_jiffy/(5000/HZ))%100); | 49 | (loops_per_jiffy/(5000/HZ))%100); |
| 50 | seq_puts(m, "features\t: "); | 50 | seq_puts(m, "features\t: "); |
| 51 | for (i = 0; i < 9; i++) | 51 | for (i = 0; i < 10; i++) |
| 52 | if (hwcap_str[i] && (elf_hwcap & (1UL << i))) | 52 | if (hwcap_str[i] && (elf_hwcap & (1UL << i))) |
| 53 | seq_printf(m, "%s ", hwcap_str[i]); | 53 | seq_printf(m, "%s ", hwcap_str[i]); |
| 54 | seq_puts(m, "\n"); | 54 | seq_puts(m, "\n"); |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index b940424f8ccc..0dc7e3cbeffa 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
| @@ -37,7 +37,6 @@ config SUPERH32 | |||
| 37 | select HAVE_FTRACE_MCOUNT_RECORD | 37 | select HAVE_FTRACE_MCOUNT_RECORD |
| 38 | select HAVE_DYNAMIC_FTRACE | 38 | select HAVE_DYNAMIC_FTRACE |
| 39 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST | 39 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST |
| 40 | select HAVE_FTRACE_SYSCALLS | ||
| 41 | select HAVE_FUNCTION_GRAPH_TRACER | 40 | select HAVE_FUNCTION_GRAPH_TRACER |
| 42 | select HAVE_ARCH_KGDB | 41 | select HAVE_ARCH_KGDB |
| 43 | select ARCH_HIBERNATION_POSSIBLE if MMU | 42 | select ARCH_HIBERNATION_POSSIBLE if MMU |
diff --git a/arch/sh/boards/mach-landisk/gio.c b/arch/sh/boards/mach-landisk/gio.c index 25cdf7358000..528013188196 100644 --- a/arch/sh/boards/mach-landisk/gio.c +++ b/arch/sh/boards/mach-landisk/gio.c | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | */ | 14 | */ |
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
| 17 | #include <linux/smp_lock.h> | ||
| 18 | #include <linux/kdev_t.h> | 17 | #include <linux/kdev_t.h> |
| 19 | #include <linux/cdev.h> | 18 | #include <linux/cdev.h> |
| 20 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
| @@ -35,7 +34,7 @@ static int gio_open(struct inode *inode, struct file *filp) | |||
| 35 | int minor; | 34 | int minor; |
| 36 | int ret = -ENOENT; | 35 | int ret = -ENOENT; |
| 37 | 36 | ||
| 38 | lock_kernel(); | 37 | preempt_disable(); |
| 39 | minor = MINOR(inode->i_rdev); | 38 | minor = MINOR(inode->i_rdev); |
| 40 | if (minor < DEVCOUNT) { | 39 | if (minor < DEVCOUNT) { |
| 41 | if (openCnt > 0) { | 40 | if (openCnt > 0) { |
| @@ -45,7 +44,7 @@ static int gio_open(struct inode *inode, struct file *filp) | |||
| 45 | ret = 0; | 44 | ret = 0; |
| 46 | } | 45 | } |
| 47 | } | 46 | } |
| 48 | unlock_kernel(); | 47 | preempt_enable(); |
| 49 | return ret; | 48 | return ret; |
| 50 | } | 49 | } |
| 51 | 50 | ||
| @@ -60,8 +59,7 @@ static int gio_close(struct inode *inode, struct file *filp) | |||
| 60 | return 0; | 59 | return 0; |
| 61 | } | 60 | } |
| 62 | 61 | ||
| 63 | static int gio_ioctl(struct inode *inode, struct file *filp, | 62 | static long gio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
| 64 | unsigned int cmd, unsigned long arg) | ||
| 65 | { | 63 | { |
| 66 | unsigned int data; | 64 | unsigned int data; |
| 67 | static unsigned int addr = 0; | 65 | static unsigned int addr = 0; |
| @@ -129,7 +127,7 @@ static const struct file_operations gio_fops = { | |||
| 129 | .owner = THIS_MODULE, | 127 | .owner = THIS_MODULE, |
| 130 | .open = gio_open, /* open */ | 128 | .open = gio_open, /* open */ |
| 131 | .release = gio_close, /* release */ | 129 | .release = gio_close, /* release */ |
| 132 | .ioctl = gio_ioctl, /* ioctl */ | 130 | .unlocked_ioctl = gio_ioctl, |
| 133 | }; | 131 | }; |
| 134 | 132 | ||
| 135 | static int __init gio_init(void) | 133 | static int __init gio_init(void) |
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S index 68d9223b145e..3eb84931d2aa 100644 --- a/arch/sh/kernel/entry-common.S +++ b/arch/sh/kernel/entry-common.S | |||
| @@ -121,7 +121,7 @@ noresched: | |||
| 121 | ENTRY(resume_userspace) | 121 | ENTRY(resume_userspace) |
| 122 | ! r8: current_thread_info | 122 | ! r8: current_thread_info |
| 123 | cli | 123 | cli |
| 124 | TRACE_IRQS_OfF | 124 | TRACE_IRQS_OFF |
| 125 | mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags | 125 | mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags |
| 126 | tst #(_TIF_WORK_MASK & 0xff), r0 | 126 | tst #(_TIF_WORK_MASK & 0xff), r0 |
| 127 | bt/s __restore_all | 127 | bt/s __restore_all |
diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c index a3dcc6d5d253..2c48e267256e 100644 --- a/arch/sh/kernel/ftrace.c +++ b/arch/sh/kernel/ftrace.c | |||
| @@ -291,31 +291,48 @@ struct syscall_metadata *syscall_nr_to_meta(int nr) | |||
| 291 | return syscalls_metadata[nr]; | 291 | return syscalls_metadata[nr]; |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | void arch_init_ftrace_syscalls(void) | 294 | int syscall_name_to_nr(char *name) |
| 295 | { | ||
| 296 | int i; | ||
| 297 | |||
| 298 | if (!syscalls_metadata) | ||
| 299 | return -1; | ||
| 300 | for (i = 0; i < NR_syscalls; i++) | ||
| 301 | if (syscalls_metadata[i]) | ||
| 302 | if (!strcmp(syscalls_metadata[i]->name, name)) | ||
| 303 | return i; | ||
| 304 | return -1; | ||
| 305 | } | ||
| 306 | |||
| 307 | void set_syscall_enter_id(int num, int id) | ||
| 308 | { | ||
| 309 | syscalls_metadata[num]->enter_id = id; | ||
| 310 | } | ||
| 311 | |||
| 312 | void set_syscall_exit_id(int num, int id) | ||
| 313 | { | ||
| 314 | syscalls_metadata[num]->exit_id = id; | ||
| 315 | } | ||
| 316 | |||
| 317 | static int __init arch_init_ftrace_syscalls(void) | ||
| 295 | { | 318 | { |
| 296 | int i; | 319 | int i; |
| 297 | struct syscall_metadata *meta; | 320 | struct syscall_metadata *meta; |
| 298 | unsigned long **psys_syscall_table = &sys_call_table; | 321 | unsigned long **psys_syscall_table = &sys_call_table; |
| 299 | static atomic_t refs; | ||
| 300 | |||
| 301 | if (atomic_inc_return(&refs) != 1) | ||
| 302 | goto end; | ||
| 303 | 322 | ||
| 304 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * | 323 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * |
| 305 | FTRACE_SYSCALL_MAX, GFP_KERNEL); | 324 | FTRACE_SYSCALL_MAX, GFP_KERNEL); |
| 306 | if (!syscalls_metadata) { | 325 | if (!syscalls_metadata) { |
| 307 | WARN_ON(1); | 326 | WARN_ON(1); |
| 308 | return; | 327 | return -ENOMEM; |
| 309 | } | 328 | } |
| 310 | 329 | ||
| 311 | for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { | 330 | for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { |
| 312 | meta = find_syscall_meta(psys_syscall_table[i]); | 331 | meta = find_syscall_meta(psys_syscall_table[i]); |
| 313 | syscalls_metadata[i] = meta; | 332 | syscalls_metadata[i] = meta; |
| 314 | } | 333 | } |
| 315 | return; | ||
| 316 | 334 | ||
| 317 | /* Paranoid: avoid overflow */ | 335 | return 0; |
| 318 | end: | ||
| 319 | atomic_dec(&refs); | ||
| 320 | } | 336 | } |
| 337 | arch_initcall(arch_init_ftrace_syscalls); | ||
| 321 | #endif /* CONFIG_FTRACE_SYSCALLS */ | 338 | #endif /* CONFIG_FTRACE_SYSCALLS */ |
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index f9d44f8e0df6..99b4fb553bf1 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
| @@ -549,6 +549,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 549 | 549 | ||
| 550 | if (cpu == 0) | 550 | if (cpu == 0) |
| 551 | seq_printf(m, "machine\t\t: %s\n", get_system_type()); | 551 | seq_printf(m, "machine\t\t: %s\n", get_system_type()); |
| 552 | else | ||
| 553 | seq_printf(m, "\n"); | ||
| 552 | 554 | ||
| 553 | seq_printf(m, "processor\t: %d\n", cpu); | 555 | seq_printf(m, "processor\t: %d\n", cpu); |
| 554 | seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine); | 556 | seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine); |
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index 6729703547a1..3db37425210d 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
| @@ -145,7 +145,7 @@ static inline int restore_sigcontext_fpu(struct sigcontext __user *sc) | |||
| 145 | { | 145 | { |
| 146 | struct task_struct *tsk = current; | 146 | struct task_struct *tsk = current; |
| 147 | 147 | ||
| 148 | if (!(current_cpu_data.flags & CPU_HAS_FPU)) | 148 | if (!(boot_cpu_data.flags & CPU_HAS_FPU)) |
| 149 | return 0; | 149 | return 0; |
| 150 | 150 | ||
| 151 | set_used_math(); | 151 | set_used_math(); |
| @@ -158,7 +158,7 @@ static inline int save_sigcontext_fpu(struct sigcontext __user *sc, | |||
| 158 | { | 158 | { |
| 159 | struct task_struct *tsk = current; | 159 | struct task_struct *tsk = current; |
| 160 | 160 | ||
| 161 | if (!(current_cpu_data.flags & CPU_HAS_FPU)) | 161 | if (!(boot_cpu_data.flags & CPU_HAS_FPU)) |
| 162 | return 0; | 162 | return 0; |
| 163 | 163 | ||
| 164 | if (!used_math()) { | 164 | if (!used_math()) { |
| @@ -199,7 +199,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *r0_p | |||
| 199 | #undef COPY | 199 | #undef COPY |
| 200 | 200 | ||
| 201 | #ifdef CONFIG_SH_FPU | 201 | #ifdef CONFIG_SH_FPU |
| 202 | if (current_cpu_data.flags & CPU_HAS_FPU) { | 202 | if (boot_cpu_data.flags & CPU_HAS_FPU) { |
| 203 | int owned_fp; | 203 | int owned_fp; |
| 204 | struct task_struct *tsk = current; | 204 | struct task_struct *tsk = current; |
| 205 | 205 | ||
| @@ -472,6 +472,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
| 472 | err |= __put_user(OR_R0_R0, &frame->retcode[6]); | 472 | err |= __put_user(OR_R0_R0, &frame->retcode[6]); |
| 473 | err |= __put_user((__NR_rt_sigreturn), &frame->retcode[7]); | 473 | err |= __put_user((__NR_rt_sigreturn), &frame->retcode[7]); |
| 474 | regs->pr = (unsigned long) frame->retcode; | 474 | regs->pr = (unsigned long) frame->retcode; |
| 475 | flush_icache_range(regs->pr, regs->pr + sizeof(frame->retcode)); | ||
| 475 | } | 476 | } |
| 476 | 477 | ||
| 477 | if (err) | 478 | if (err) |
| @@ -497,8 +498,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
| 497 | pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n", | 498 | pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n", |
| 498 | current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); | 499 | current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); |
| 499 | 500 | ||
| 500 | flush_icache_range(regs->pr, regs->pr + sizeof(frame->retcode)); | ||
| 501 | |||
| 502 | return 0; | 501 | return 0; |
| 503 | 502 | ||
| 504 | give_sigsegv: | 503 | give_sigsegv: |
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index 442d8d47a41e..160db1003cfb 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c | |||
| @@ -35,6 +35,8 @@ static inline void __init smp_store_cpu_info(unsigned int cpu) | |||
| 35 | { | 35 | { |
| 36 | struct sh_cpuinfo *c = cpu_data + cpu; | 36 | struct sh_cpuinfo *c = cpu_data + cpu; |
| 37 | 37 | ||
| 38 | memcpy(c, &boot_cpu_data, sizeof(struct sh_cpuinfo)); | ||
| 39 | |||
| 38 | c->loops_per_jiffy = loops_per_jiffy; | 40 | c->loops_per_jiffy = loops_per_jiffy; |
| 39 | } | 41 | } |
| 40 | 42 | ||
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c index e0b5e4b5accd..7a2ee3a6b8e7 100644 --- a/arch/sh/kernel/traps_32.c +++ b/arch/sh/kernel/traps_32.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/kexec.h> | 25 | #include <linux/kexec.h> |
| 26 | #include <linux/limits.h> | 26 | #include <linux/limits.h> |
| 27 | #include <linux/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
| 28 | #include <linux/sysfs.h> | ||
| 28 | #include <asm/system.h> | 29 | #include <asm/system.h> |
| 29 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
| 30 | #include <asm/fpu.h> | 31 | #include <asm/fpu.h> |
| @@ -159,12 +160,12 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
| 159 | 160 | ||
| 160 | oops_enter(); | 161 | oops_enter(); |
| 161 | 162 | ||
| 162 | console_verbose(); | ||
| 163 | spin_lock_irq(&die_lock); | 163 | spin_lock_irq(&die_lock); |
| 164 | console_verbose(); | ||
| 164 | bust_spinlocks(1); | 165 | bust_spinlocks(1); |
| 165 | 166 | ||
| 166 | printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); | 167 | printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); |
| 167 | 168 | sysfs_printk_last_file(); | |
| 168 | print_modules(); | 169 | print_modules(); |
| 169 | show_regs(regs); | 170 | show_regs(regs); |
| 170 | 171 | ||
| @@ -180,6 +181,7 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
| 180 | bust_spinlocks(0); | 181 | bust_spinlocks(0); |
| 181 | add_taint(TAINT_DIE); | 182 | add_taint(TAINT_DIE); |
| 182 | spin_unlock_irq(&die_lock); | 183 | spin_unlock_irq(&die_lock); |
| 184 | oops_exit(); | ||
| 183 | 185 | ||
| 184 | if (kexec_should_crash(current)) | 186 | if (kexec_should_crash(current)) |
| 185 | crash_kexec(regs); | 187 | crash_kexec(regs); |
| @@ -190,7 +192,6 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
| 190 | if (panic_on_oops) | 192 | if (panic_on_oops) |
| 191 | panic("Fatal exception"); | 193 | panic("Fatal exception"); |
| 192 | 194 | ||
| 193 | oops_exit(); | ||
| 194 | do_exit(SIGSEGV); | 195 | do_exit(SIGSEGV); |
| 195 | } | 196 | } |
| 196 | 197 | ||
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c index a98c7d8984fa..519e2d16cd06 100644 --- a/arch/sh/mm/cache-sh4.c +++ b/arch/sh/mm/cache-sh4.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #define MAX_DCACHE_PAGES 64 /* XXX: Tune for ways */ | 26 | #define MAX_DCACHE_PAGES 64 /* XXX: Tune for ways */ |
| 27 | #define MAX_ICACHE_PAGES 32 | 27 | #define MAX_ICACHE_PAGES 32 |
| 28 | 28 | ||
| 29 | static void __flush_cache_4096(unsigned long addr, unsigned long phys, | 29 | static void __flush_cache_one(unsigned long addr, unsigned long phys, |
| 30 | unsigned long exec_offset); | 30 | unsigned long exec_offset); |
| 31 | 31 | ||
| 32 | /* | 32 | /* |
| @@ -89,8 +89,7 @@ static void __uses_jump_to_uncached sh4_flush_icache_range(void *args) | |||
| 89 | local_irq_restore(flags); | 89 | local_irq_restore(flags); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | static inline void flush_cache_4096(unsigned long start, | 92 | static inline void flush_cache_one(unsigned long start, unsigned long phys) |
| 93 | unsigned long phys) | ||
| 94 | { | 93 | { |
| 95 | unsigned long flags, exec_offset = 0; | 94 | unsigned long flags, exec_offset = 0; |
| 96 | 95 | ||
| @@ -103,8 +102,7 @@ static inline void flush_cache_4096(unsigned long start, | |||
| 103 | exec_offset = 0x20000000; | 102 | exec_offset = 0x20000000; |
| 104 | 103 | ||
| 105 | local_irq_save(flags); | 104 | local_irq_save(flags); |
| 106 | __flush_cache_4096(start | SH_CACHE_ASSOC, | 105 | __flush_cache_one(start | SH_CACHE_ASSOC, P1SEGADDR(phys), exec_offset); |
| 107 | P1SEGADDR(phys), exec_offset); | ||
| 108 | local_irq_restore(flags); | 106 | local_irq_restore(flags); |
| 109 | } | 107 | } |
| 110 | 108 | ||
| @@ -129,8 +127,8 @@ static void sh4_flush_dcache_page(void *arg) | |||
| 129 | 127 | ||
| 130 | /* Loop all the D-cache */ | 128 | /* Loop all the D-cache */ |
| 131 | n = boot_cpu_data.dcache.n_aliases; | 129 | n = boot_cpu_data.dcache.n_aliases; |
| 132 | for (i = 0; i < n; i++, addr += 4096) | 130 | for (i = 0; i < n; i++, addr += PAGE_SIZE) |
| 133 | flush_cache_4096(addr, phys); | 131 | flush_cache_one(addr, phys); |
| 134 | } | 132 | } |
| 135 | 133 | ||
| 136 | wmb(); | 134 | wmb(); |
| @@ -318,11 +316,11 @@ static void sh4_flush_cache_page(void *args) | |||
| 318 | /* We only need to flush D-cache when we have alias */ | 316 | /* We only need to flush D-cache when we have alias */ |
| 319 | if ((address^phys) & alias_mask) { | 317 | if ((address^phys) & alias_mask) { |
| 320 | /* Loop 4K of the D-cache */ | 318 | /* Loop 4K of the D-cache */ |
| 321 | flush_cache_4096( | 319 | flush_cache_one( |
| 322 | CACHE_OC_ADDRESS_ARRAY | (address & alias_mask), | 320 | CACHE_OC_ADDRESS_ARRAY | (address & alias_mask), |
| 323 | phys); | 321 | phys); |
| 324 | /* Loop another 4K of the D-cache */ | 322 | /* Loop another 4K of the D-cache */ |
| 325 | flush_cache_4096( | 323 | flush_cache_one( |
| 326 | CACHE_OC_ADDRESS_ARRAY | (phys & alias_mask), | 324 | CACHE_OC_ADDRESS_ARRAY | (phys & alias_mask), |
| 327 | phys); | 325 | phys); |
| 328 | } | 326 | } |
| @@ -337,7 +335,7 @@ static void sh4_flush_cache_page(void *args) | |||
| 337 | * kernel has never executed the code through its identity | 335 | * kernel has never executed the code through its identity |
| 338 | * translation. | 336 | * translation. |
| 339 | */ | 337 | */ |
| 340 | flush_cache_4096( | 338 | flush_cache_one( |
| 341 | CACHE_IC_ADDRESS_ARRAY | (address & alias_mask), | 339 | CACHE_IC_ADDRESS_ARRAY | (address & alias_mask), |
| 342 | phys); | 340 | phys); |
| 343 | } | 341 | } |
| @@ -393,7 +391,7 @@ static void sh4_flush_cache_range(void *args) | |||
| 393 | } | 391 | } |
| 394 | 392 | ||
| 395 | /** | 393 | /** |
| 396 | * __flush_cache_4096 | 394 | * __flush_cache_one |
| 397 | * | 395 | * |
| 398 | * @addr: address in memory mapped cache array | 396 | * @addr: address in memory mapped cache array |
| 399 | * @phys: P1 address to flush (has to match tags if addr has 'A' bit | 397 | * @phys: P1 address to flush (has to match tags if addr has 'A' bit |
| @@ -406,7 +404,7 @@ static void sh4_flush_cache_range(void *args) | |||
| 406 | * operation (purge/write-back) is selected by the lower 2 bits of | 404 | * operation (purge/write-back) is selected by the lower 2 bits of |
| 407 | * 'phys'. | 405 | * 'phys'. |
| 408 | */ | 406 | */ |
| 409 | static void __flush_cache_4096(unsigned long addr, unsigned long phys, | 407 | static void __flush_cache_one(unsigned long addr, unsigned long phys, |
| 410 | unsigned long exec_offset) | 408 | unsigned long exec_offset) |
| 411 | { | 409 | { |
| 412 | int way_count; | 410 | int way_count; |
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c index 35c37b7f717a..a2dc7f9ecc51 100644 --- a/arch/sh/mm/cache.c +++ b/arch/sh/mm/cache.c | |||
| @@ -128,7 +128,7 @@ void __update_cache(struct vm_area_struct *vma, | |||
| 128 | return; | 128 | return; |
| 129 | 129 | ||
| 130 | page = pfn_to_page(pfn); | 130 | page = pfn_to_page(pfn); |
| 131 | if (pfn_valid(pfn) && page_mapping(page)) { | 131 | if (pfn_valid(pfn)) { |
| 132 | int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); | 132 | int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); |
| 133 | if (dirty) { | 133 | if (dirty) { |
| 134 | unsigned long addr = (unsigned long)page_address(page); | 134 | unsigned long addr = (unsigned long)page_address(page); |
| @@ -265,6 +265,8 @@ static void __init emit_cache_params(void) | |||
| 265 | 265 | ||
| 266 | void __init cpu_cache_init(void) | 266 | void __init cpu_cache_init(void) |
| 267 | { | 267 | { |
| 268 | unsigned int cache_disabled = !(__raw_readl(CCR) & CCR_CACHE_ENABLE); | ||
| 269 | |||
| 268 | compute_alias(&boot_cpu_data.icache); | 270 | compute_alias(&boot_cpu_data.icache); |
| 269 | compute_alias(&boot_cpu_data.dcache); | 271 | compute_alias(&boot_cpu_data.dcache); |
| 270 | compute_alias(&boot_cpu_data.scache); | 272 | compute_alias(&boot_cpu_data.scache); |
| @@ -273,6 +275,13 @@ void __init cpu_cache_init(void) | |||
| 273 | __flush_purge_region = noop__flush_region; | 275 | __flush_purge_region = noop__flush_region; |
| 274 | __flush_invalidate_region = noop__flush_region; | 276 | __flush_invalidate_region = noop__flush_region; |
| 275 | 277 | ||
| 278 | /* | ||
| 279 | * No flushing is necessary in the disabled cache case so we can | ||
| 280 | * just keep the noop functions in local_flush_..() and __flush_..() | ||
| 281 | */ | ||
| 282 | if (unlikely(cache_disabled)) | ||
| 283 | goto skip; | ||
| 284 | |||
| 276 | if (boot_cpu_data.family == CPU_FAMILY_SH2) { | 285 | if (boot_cpu_data.family == CPU_FAMILY_SH2) { |
| 277 | extern void __weak sh2_cache_init(void); | 286 | extern void __weak sh2_cache_init(void); |
| 278 | 287 | ||
| @@ -312,5 +321,6 @@ void __init cpu_cache_init(void) | |||
| 312 | sh5_cache_init(); | 321 | sh5_cache_init(); |
| 313 | } | 322 | } |
| 314 | 323 | ||
| 324 | skip: | ||
| 315 | emit_cache_params(); | 325 | emit_cache_params(); |
| 316 | } | 326 | } |
diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c index adf5f273868a..cb3c72c45aab 100644 --- a/arch/sparc/kernel/ldc.c +++ b/arch/sparc/kernel/ldc.c | |||
| @@ -1242,13 +1242,13 @@ int ldc_bind(struct ldc_channel *lp, const char *name) | |||
| 1242 | snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); | 1242 | snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); |
| 1243 | 1243 | ||
| 1244 | err = request_irq(lp->cfg.rx_irq, ldc_rx, | 1244 | err = request_irq(lp->cfg.rx_irq, ldc_rx, |
| 1245 | IRQF_SAMPLE_RANDOM | IRQF_SHARED, | 1245 | IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED, |
| 1246 | lp->rx_irq_name, lp); | 1246 | lp->rx_irq_name, lp); |
| 1247 | if (err) | 1247 | if (err) |
| 1248 | return err; | 1248 | return err; |
| 1249 | 1249 | ||
| 1250 | err = request_irq(lp->cfg.tx_irq, ldc_tx, | 1250 | err = request_irq(lp->cfg.tx_irq, ldc_tx, |
| 1251 | IRQF_SAMPLE_RANDOM | IRQF_SHARED, | 1251 | IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED, |
| 1252 | lp->tx_irq_name, lp); | 1252 | lp->tx_irq_name, lp); |
| 1253 | if (err) { | 1253 | if (err) { |
| 1254 | free_irq(lp->cfg.rx_irq, lp); | 1254 | free_irq(lp->cfg.rx_irq, lp); |
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index 04db92743896..fa5936e1c3b9 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
| @@ -437,7 +437,7 @@ static const struct sparc_pmu niagara2_pmu = { | |||
| 437 | .lower_shift = 6, | 437 | .lower_shift = 6, |
| 438 | .event_mask = 0xfff, | 438 | .event_mask = 0xfff, |
| 439 | .hv_bit = 0x8, | 439 | .hv_bit = 0x8, |
| 440 | .irq_bit = 0x03, | 440 | .irq_bit = 0x30, |
| 441 | .upper_nop = 0x220, | 441 | .upper_nop = 0x220, |
| 442 | .lower_nop = 0x220, | 442 | .lower_nop = 0x220, |
| 443 | }; | 443 | }; |
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index a70a5e1904d9..1886d37d411b 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
| @@ -265,7 +265,7 @@ static void flush_dcache(unsigned long pfn) | |||
| 265 | struct page *page; | 265 | struct page *page; |
| 266 | 266 | ||
| 267 | page = pfn_to_page(pfn); | 267 | page = pfn_to_page(pfn); |
| 268 | if (page && page_mapping(page)) { | 268 | if (page) { |
| 269 | unsigned long pg_flags; | 269 | unsigned long pg_flags; |
| 270 | 270 | ||
| 271 | pg_flags = page->flags; | 271 | pg_flags = page->flags; |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c876bace8fdc..07e01149e3bf 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -491,7 +491,7 @@ if PARAVIRT_GUEST | |||
| 491 | source "arch/x86/xen/Kconfig" | 491 | source "arch/x86/xen/Kconfig" |
| 492 | 492 | ||
| 493 | config VMI | 493 | config VMI |
| 494 | bool "VMI Guest support" | 494 | bool "VMI Guest support (DEPRECATED)" |
| 495 | select PARAVIRT | 495 | select PARAVIRT |
| 496 | depends on X86_32 | 496 | depends on X86_32 |
| 497 | ---help--- | 497 | ---help--- |
| @@ -500,6 +500,15 @@ config VMI | |||
| 500 | at the moment), by linking the kernel to a GPL-ed ROM module | 500 | at the moment), by linking the kernel to a GPL-ed ROM module |
| 501 | provided by the hypervisor. | 501 | provided by the hypervisor. |
| 502 | 502 | ||
| 503 | As of September 2009, VMware has started a phased retirement | ||
| 504 | of this feature from VMware's products. Please see | ||
| 505 | feature-removal-schedule.txt for details. If you are | ||
| 506 | planning to enable this option, please note that you cannot | ||
| 507 | live migrate a VMI enabled VM to a future VMware product, | ||
| 508 | which doesn't support VMI. So if you expect your kernel to | ||
| 509 | seamlessly migrate to newer VMware products, keep this | ||
| 510 | disabled. | ||
| 511 | |||
| 503 | config KVM_CLOCK | 512 | config KVM_CLOCK |
| 504 | bool "KVM paravirtualized clock" | 513 | bool "KVM paravirtualized clock" |
| 505 | select PARAVIRT | 514 | select PARAVIRT |
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c index 585edebe12cf..49c552c060e9 100644 --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c | |||
| @@ -82,7 +82,7 @@ static int aes_set_key_common(struct crypto_tfm *tfm, void *raw_ctx, | |||
| 82 | return -EINVAL; | 82 | return -EINVAL; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | if (irq_fpu_usable()) | 85 | if (!irq_fpu_usable()) |
| 86 | err = crypto_aes_expand_key(ctx, in_key, key_len); | 86 | err = crypto_aes_expand_key(ctx, in_key, key_len); |
| 87 | else { | 87 | else { |
| 88 | kernel_fpu_begin(); | 88 | kernel_fpu_begin(); |
| @@ -103,7 +103,7 @@ static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |||
| 103 | { | 103 | { |
| 104 | struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm)); | 104 | struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm)); |
| 105 | 105 | ||
| 106 | if (irq_fpu_usable()) | 106 | if (!irq_fpu_usable()) |
| 107 | crypto_aes_encrypt_x86(ctx, dst, src); | 107 | crypto_aes_encrypt_x86(ctx, dst, src); |
| 108 | else { | 108 | else { |
| 109 | kernel_fpu_begin(); | 109 | kernel_fpu_begin(); |
| @@ -116,7 +116,7 @@ static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | |||
| 116 | { | 116 | { |
| 117 | struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm)); | 117 | struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm)); |
| 118 | 118 | ||
| 119 | if (irq_fpu_usable()) | 119 | if (!irq_fpu_usable()) |
| 120 | crypto_aes_decrypt_x86(ctx, dst, src); | 120 | crypto_aes_decrypt_x86(ctx, dst, src); |
| 121 | else { | 121 | else { |
| 122 | kernel_fpu_begin(); | 122 | kernel_fpu_begin(); |
| @@ -342,7 +342,7 @@ static int ablk_encrypt(struct ablkcipher_request *req) | |||
| 342 | struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); | 342 | struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); |
| 343 | struct async_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm); | 343 | struct async_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm); |
| 344 | 344 | ||
| 345 | if (irq_fpu_usable()) { | 345 | if (!irq_fpu_usable()) { |
| 346 | struct ablkcipher_request *cryptd_req = | 346 | struct ablkcipher_request *cryptd_req = |
| 347 | ablkcipher_request_ctx(req); | 347 | ablkcipher_request_ctx(req); |
| 348 | memcpy(cryptd_req, req, sizeof(*req)); | 348 | memcpy(cryptd_req, req, sizeof(*req)); |
| @@ -363,7 +363,7 @@ static int ablk_decrypt(struct ablkcipher_request *req) | |||
| 363 | struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); | 363 | struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); |
| 364 | struct async_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm); | 364 | struct async_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm); |
| 365 | 365 | ||
| 366 | if (irq_fpu_usable()) { | 366 | if (!irq_fpu_usable()) { |
| 367 | struct ablkcipher_request *cryptd_req = | 367 | struct ablkcipher_request *cryptd_req = |
| 368 | ablkcipher_request_ctx(req); | 368 | ablkcipher_request_ctx(req); |
| 369 | memcpy(cryptd_req, req, sizeof(*req)); | 369 | memcpy(cryptd_req, req, sizeof(*req)); |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 8aebcc41041d..efb38994859c 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
| @@ -840,42 +840,22 @@ static __always_inline void __raw_spin_unlock(struct raw_spinlock *lock) | |||
| 840 | 840 | ||
| 841 | static inline unsigned long __raw_local_save_flags(void) | 841 | static inline unsigned long __raw_local_save_flags(void) |
| 842 | { | 842 | { |
| 843 | unsigned long f; | 843 | return PVOP_CALLEE0(unsigned long, pv_irq_ops.save_fl); |
| 844 | |||
| 845 | asm volatile(paravirt_alt(PARAVIRT_CALL) | ||
| 846 | : "=a"(f) | ||
| 847 | : paravirt_type(pv_irq_ops.save_fl), | ||
| 848 | paravirt_clobber(CLBR_EAX) | ||
| 849 | : "memory", "cc"); | ||
| 850 | return f; | ||
| 851 | } | 844 | } |
| 852 | 845 | ||
| 853 | static inline void raw_local_irq_restore(unsigned long f) | 846 | static inline void raw_local_irq_restore(unsigned long f) |
| 854 | { | 847 | { |
| 855 | asm volatile(paravirt_alt(PARAVIRT_CALL) | 848 | PVOP_VCALLEE1(pv_irq_ops.restore_fl, f); |
| 856 | : "=a"(f) | ||
| 857 | : PV_FLAGS_ARG(f), | ||
| 858 | paravirt_type(pv_irq_ops.restore_fl), | ||
| 859 | paravirt_clobber(CLBR_EAX) | ||
| 860 | : "memory", "cc"); | ||
| 861 | } | 849 | } |
| 862 | 850 | ||
| 863 | static inline void raw_local_irq_disable(void) | 851 | static inline void raw_local_irq_disable(void) |
| 864 | { | 852 | { |
| 865 | asm volatile(paravirt_alt(PARAVIRT_CALL) | 853 | PVOP_VCALLEE0(pv_irq_ops.irq_disable); |
| 866 | : | ||
| 867 | : paravirt_type(pv_irq_ops.irq_disable), | ||
| 868 | paravirt_clobber(CLBR_EAX) | ||
| 869 | : "memory", "eax", "cc"); | ||
| 870 | } | 854 | } |
| 871 | 855 | ||
| 872 | static inline void raw_local_irq_enable(void) | 856 | static inline void raw_local_irq_enable(void) |
| 873 | { | 857 | { |
| 874 | asm volatile(paravirt_alt(PARAVIRT_CALL) | 858 | PVOP_VCALLEE0(pv_irq_ops.irq_enable); |
| 875 | : | ||
| 876 | : paravirt_type(pv_irq_ops.irq_enable), | ||
| 877 | paravirt_clobber(CLBR_EAX) | ||
| 878 | : "memory", "eax", "cc"); | ||
| 879 | } | 859 | } |
| 880 | 860 | ||
| 881 | static inline unsigned long __raw_local_irq_save(void) | 861 | static inline unsigned long __raw_local_irq_save(void) |
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index dd0f5b32489d..9357473c8da0 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h | |||
| @@ -494,10 +494,11 @@ int paravirt_disable_iospace(void); | |||
| 494 | #define EXTRA_CLOBBERS | 494 | #define EXTRA_CLOBBERS |
| 495 | #define VEXTRA_CLOBBERS | 495 | #define VEXTRA_CLOBBERS |
| 496 | #else /* CONFIG_X86_64 */ | 496 | #else /* CONFIG_X86_64 */ |
| 497 | /* [re]ax isn't an arg, but the return val */ | ||
| 497 | #define PVOP_VCALL_ARGS \ | 498 | #define PVOP_VCALL_ARGS \ |
| 498 | unsigned long __edi = __edi, __esi = __esi, \ | 499 | unsigned long __edi = __edi, __esi = __esi, \ |
| 499 | __edx = __edx, __ecx = __ecx | 500 | __edx = __edx, __ecx = __ecx, __eax = __eax |
| 500 | #define PVOP_CALL_ARGS PVOP_VCALL_ARGS, __eax | 501 | #define PVOP_CALL_ARGS PVOP_VCALL_ARGS |
| 501 | 502 | ||
| 502 | #define PVOP_CALL_ARG1(x) "D" ((unsigned long)(x)) | 503 | #define PVOP_CALL_ARG1(x) "D" ((unsigned long)(x)) |
| 503 | #define PVOP_CALL_ARG2(x) "S" ((unsigned long)(x)) | 504 | #define PVOP_CALL_ARG2(x) "S" ((unsigned long)(x)) |
| @@ -509,6 +510,7 @@ int paravirt_disable_iospace(void); | |||
| 509 | "=c" (__ecx) | 510 | "=c" (__ecx) |
| 510 | #define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax) | 511 | #define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax) |
| 511 | 512 | ||
| 513 | /* void functions are still allowed [re]ax for scratch */ | ||
| 512 | #define PVOP_VCALLEE_CLOBBERS "=a" (__eax) | 514 | #define PVOP_VCALLEE_CLOBBERS "=a" (__eax) |
| 513 | #define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS | 515 | #define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS |
| 514 | 516 | ||
| @@ -583,8 +585,8 @@ int paravirt_disable_iospace(void); | |||
| 583 | VEXTRA_CLOBBERS, \ | 585 | VEXTRA_CLOBBERS, \ |
| 584 | pre, post, ##__VA_ARGS__) | 586 | pre, post, ##__VA_ARGS__) |
| 585 | 587 | ||
| 586 | #define __PVOP_VCALLEESAVE(rettype, op, pre, post, ...) \ | 588 | #define __PVOP_VCALLEESAVE(op, pre, post, ...) \ |
| 587 | ____PVOP_CALL(rettype, op.func, CLBR_RET_REG, \ | 589 | ____PVOP_VCALL(op.func, CLBR_RET_REG, \ |
| 588 | PVOP_VCALLEE_CLOBBERS, , \ | 590 | PVOP_VCALLEE_CLOBBERS, , \ |
| 589 | pre, post, ##__VA_ARGS__) | 591 | pre, post, ##__VA_ARGS__) |
| 590 | 592 | ||
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index 391206199515..04bbd5278568 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c | |||
| @@ -63,10 +63,10 @@ static int show_other_interrupts(struct seq_file *p, int prec) | |||
| 63 | for_each_online_cpu(j) | 63 | for_each_online_cpu(j) |
| 64 | seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count); | 64 | seq_printf(p, "%10u ", irq_stats(j)->irq_spurious_count); |
| 65 | seq_printf(p, " Spurious interrupts\n"); | 65 | seq_printf(p, " Spurious interrupts\n"); |
| 66 | seq_printf(p, "%*s: ", prec, "CNT"); | 66 | seq_printf(p, "%*s: ", prec, "PMI"); |
| 67 | for_each_online_cpu(j) | 67 | for_each_online_cpu(j) |
| 68 | seq_printf(p, "%10u ", irq_stats(j)->apic_perf_irqs); | 68 | seq_printf(p, "%10u ", irq_stats(j)->apic_perf_irqs); |
| 69 | seq_printf(p, " Performance counter interrupts\n"); | 69 | seq_printf(p, " Performance monitoring interrupts\n"); |
| 70 | seq_printf(p, "%*s: ", prec, "PND"); | 70 | seq_printf(p, "%*s: ", prec, "PND"); |
| 71 | for_each_online_cpu(j) | 71 | for_each_online_cpu(j) |
| 72 | seq_printf(p, "%10u ", irq_stats(j)->apic_pending_irqs); | 72 | seq_printf(p, "%10u ", irq_stats(j)->apic_pending_irqs); |
| @@ -244,7 +244,6 @@ unsigned int __irq_entry do_IRQ(struct pt_regs *regs) | |||
| 244 | __func__, smp_processor_id(), vector, irq); | 244 | __func__, smp_processor_id(), vector, irq); |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | run_local_timers(); | ||
| 248 | irq_exit(); | 247 | irq_exit(); |
| 249 | 248 | ||
| 250 | set_irq_regs(old_regs); | 249 | set_irq_regs(old_regs); |
| @@ -269,7 +268,6 @@ void smp_generic_interrupt(struct pt_regs *regs) | |||
| 269 | if (generic_interrupt_extension) | 268 | if (generic_interrupt_extension) |
| 270 | generic_interrupt_extension(); | 269 | generic_interrupt_extension(); |
| 271 | 270 | ||
| 272 | run_local_timers(); | ||
| 273 | irq_exit(); | 271 | irq_exit(); |
| 274 | 272 | ||
| 275 | set_irq_regs(old_regs); | 273 | set_irq_regs(old_regs); |
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index d20009b4e6ef..b2a71dca5642 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
| @@ -311,7 +311,7 @@ void pci_iommu_shutdown(void) | |||
| 311 | amd_iommu_shutdown(); | 311 | amd_iommu_shutdown(); |
| 312 | } | 312 | } |
| 313 | /* Must execute after PCI subsystem */ | 313 | /* Must execute after PCI subsystem */ |
| 314 | fs_initcall(pci_iommu_init); | 314 | rootfs_initcall(pci_iommu_init); |
| 315 | 315 | ||
| 316 | #ifdef CONFIG_PCI | 316 | #ifdef CONFIG_PCI |
| 317 | /* Many VIA bridges seem to corrupt data for DAC. Disable it here */ | 317 | /* Many VIA bridges seem to corrupt data for DAC. Disable it here */ |
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index d915d956e66d..ec1de97600e7 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c | |||
| @@ -198,7 +198,6 @@ void smp_reschedule_interrupt(struct pt_regs *regs) | |||
| 198 | { | 198 | { |
| 199 | ack_APIC_irq(); | 199 | ack_APIC_irq(); |
| 200 | inc_irq_stat(irq_resched_count); | 200 | inc_irq_stat(irq_resched_count); |
| 201 | run_local_timers(); | ||
| 202 | /* | 201 | /* |
| 203 | * KVM uses this interrupt to force a cpu out of guest mode | 202 | * KVM uses this interrupt to force a cpu out of guest mode |
| 204 | */ | 203 | */ |
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c index dcb00d278512..be2573448ed9 100644 --- a/arch/x86/kernel/time.c +++ b/arch/x86/kernel/time.c | |||
| @@ -38,7 +38,8 @@ unsigned long profile_pc(struct pt_regs *regs) | |||
| 38 | #ifdef CONFIG_FRAME_POINTER | 38 | #ifdef CONFIG_FRAME_POINTER |
| 39 | return *(unsigned long *)(regs->bp + sizeof(long)); | 39 | return *(unsigned long *)(regs->bp + sizeof(long)); |
| 40 | #else | 40 | #else |
| 41 | unsigned long *sp = (unsigned long *)regs->sp; | 41 | unsigned long *sp = |
| 42 | (unsigned long *)kernel_stack_pointer(regs); | ||
| 42 | /* | 43 | /* |
| 43 | * Return address is either directly at stack pointer | 44 | * Return address is either directly at stack pointer |
| 44 | * or above a saved flags. Eflags has bits 22-31 zero, | 45 | * or above a saved flags. Eflags has bits 22-31 zero, |
diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c index 699f7eeb896a..cd022121cab6 100644 --- a/arch/x86/kernel/trampoline.c +++ b/arch/x86/kernel/trampoline.c | |||
| @@ -3,8 +3,16 @@ | |||
| 3 | #include <asm/trampoline.h> | 3 | #include <asm/trampoline.h> |
| 4 | #include <asm/e820.h> | 4 | #include <asm/e820.h> |
| 5 | 5 | ||
| 6 | #if defined(CONFIG_X86_64) && defined(CONFIG_ACPI_SLEEP) | ||
| 7 | #define __trampinit | ||
| 8 | #define __trampinitdata | ||
| 9 | #else | ||
| 10 | #define __trampinit __cpuinit | ||
| 11 | #define __trampinitdata __cpuinitdata | ||
| 12 | #endif | ||
| 13 | |||
| 6 | /* ready for x86_64 and x86 */ | 14 | /* ready for x86_64 and x86 */ |
| 7 | unsigned char *__cpuinitdata trampoline_base = __va(TRAMPOLINE_BASE); | 15 | unsigned char *__trampinitdata trampoline_base = __va(TRAMPOLINE_BASE); |
| 8 | 16 | ||
| 9 | void __init reserve_trampoline_memory(void) | 17 | void __init reserve_trampoline_memory(void) |
| 10 | { | 18 | { |
| @@ -26,7 +34,7 @@ void __init reserve_trampoline_memory(void) | |||
| 26 | * bootstrap into the page concerned. The caller | 34 | * bootstrap into the page concerned. The caller |
| 27 | * has made sure it's suitably aligned. | 35 | * has made sure it's suitably aligned. |
| 28 | */ | 36 | */ |
| 29 | unsigned long __cpuinit setup_trampoline(void) | 37 | unsigned long __trampinit setup_trampoline(void) |
| 30 | { | 38 | { |
| 31 | memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE); | 39 | memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE); |
| 32 | return virt_to_phys(trampoline_base); | 40 | return virt_to_phys(trampoline_base); |
diff --git a/arch/x86/kernel/trampoline_64.S b/arch/x86/kernel/trampoline_64.S index 596d54c660a5..3af2dff58b21 100644 --- a/arch/x86/kernel/trampoline_64.S +++ b/arch/x86/kernel/trampoline_64.S | |||
| @@ -32,8 +32,12 @@ | |||
| 32 | #include <asm/segment.h> | 32 | #include <asm/segment.h> |
| 33 | #include <asm/processor-flags.h> | 33 | #include <asm/processor-flags.h> |
| 34 | 34 | ||
| 35 | #ifdef CONFIG_ACPI_SLEEP | ||
| 36 | .section .rodata, "a", @progbits | ||
| 37 | #else | ||
| 35 | /* We can free up the trampoline after bootup if cpu hotplug is not supported. */ | 38 | /* We can free up the trampoline after bootup if cpu hotplug is not supported. */ |
| 36 | __CPUINITRODATA | 39 | __CPUINITRODATA |
| 40 | #endif | ||
| 37 | .code16 | 41 | .code16 |
| 38 | 42 | ||
| 39 | ENTRY(trampoline_data) | 43 | ENTRY(trampoline_data) |
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c index 31e6f6cfe53e..d430e4c30193 100644 --- a/arch/x86/kernel/vmi_32.c +++ b/arch/x86/kernel/vmi_32.c | |||
| @@ -648,7 +648,7 @@ static inline int __init activate_vmi(void) | |||
| 648 | 648 | ||
| 649 | pv_info.paravirt_enabled = 1; | 649 | pv_info.paravirt_enabled = 1; |
| 650 | pv_info.kernel_rpl = kernel_cs & SEGMENT_RPL_MASK; | 650 | pv_info.kernel_rpl = kernel_cs & SEGMENT_RPL_MASK; |
| 651 | pv_info.name = "vmi"; | 651 | pv_info.name = "vmi [deprecated]"; |
| 652 | 652 | ||
| 653 | pv_init_ops.patch = vmi_patch; | 653 | pv_init_ops.patch = vmi_patch; |
| 654 | 654 | ||
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 82ad523b4901..144e7f60b5e2 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
| @@ -116,7 +116,7 @@ static s64 __kpit_elapsed(struct kvm *kvm) | |||
| 116 | * itself with the initial count and continues counting | 116 | * itself with the initial count and continues counting |
| 117 | * from there. | 117 | * from there. |
| 118 | */ | 118 | */ |
| 119 | remaining = hrtimer_expires_remaining(&ps->pit_timer.timer); | 119 | remaining = hrtimer_get_remaining(&ps->pit_timer.timer); |
| 120 | elapsed = ps->pit_timer.period - ktime_to_ns(remaining); | 120 | elapsed = ps->pit_timer.period - ktime_to_ns(remaining); |
| 121 | elapsed = mod_64(elapsed, ps->pit_timer.period); | 121 | elapsed = mod_64(elapsed, ps->pit_timer.period); |
| 122 | 122 | ||
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 7024224f0fc8..23c217692ea9 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
| @@ -521,7 +521,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) | |||
| 521 | if (apic_get_reg(apic, APIC_TMICT) == 0) | 521 | if (apic_get_reg(apic, APIC_TMICT) == 0) |
| 522 | return 0; | 522 | return 0; |
| 523 | 523 | ||
| 524 | remaining = hrtimer_expires_remaining(&apic->lapic_timer.timer); | 524 | remaining = hrtimer_get_remaining(&apic->lapic_timer.timer); |
| 525 | if (ktime_to_ns(remaining) < 0) | 525 | if (ktime_to_ns(remaining) < 0) |
| 526 | remaining = ktime_set(0, 0); | 526 | remaining = ktime_set(0, 0); |
| 527 | 527 | ||
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 685a4ffac8e6..818b92ad82cf 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
| @@ -748,7 +748,8 @@ static int rmap_write_protect(struct kvm *kvm, u64 gfn) | |||
| 748 | return write_protected; | 748 | return write_protected; |
| 749 | } | 749 | } |
| 750 | 750 | ||
| 751 | static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) | 751 | static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, |
| 752 | unsigned long data) | ||
| 752 | { | 753 | { |
| 753 | u64 *spte; | 754 | u64 *spte; |
| 754 | int need_tlb_flush = 0; | 755 | int need_tlb_flush = 0; |
| @@ -763,7 +764,8 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) | |||
| 763 | return need_tlb_flush; | 764 | return need_tlb_flush; |
| 764 | } | 765 | } |
| 765 | 766 | ||
| 766 | static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) | 767 | static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, |
| 768 | unsigned long data) | ||
| 767 | { | 769 | { |
| 768 | int need_flush = 0; | 770 | int need_flush = 0; |
| 769 | u64 *spte, new_spte; | 771 | u64 *spte, new_spte; |
| @@ -799,9 +801,10 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) | |||
| 799 | return 0; | 801 | return 0; |
| 800 | } | 802 | } |
| 801 | 803 | ||
| 802 | static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, u64 data, | 804 | static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, |
| 805 | unsigned long data, | ||
| 803 | int (*handler)(struct kvm *kvm, unsigned long *rmapp, | 806 | int (*handler)(struct kvm *kvm, unsigned long *rmapp, |
| 804 | u64 data)) | 807 | unsigned long data)) |
| 805 | { | 808 | { |
| 806 | int i, j; | 809 | int i, j; |
| 807 | int retval = 0; | 810 | int retval = 0; |
| @@ -846,10 +849,11 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) | |||
| 846 | 849 | ||
| 847 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) | 850 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) |
| 848 | { | 851 | { |
| 849 | kvm_handle_hva(kvm, hva, (u64)&pte, kvm_set_pte_rmapp); | 852 | kvm_handle_hva(kvm, hva, (unsigned long)&pte, kvm_set_pte_rmapp); |
| 850 | } | 853 | } |
| 851 | 854 | ||
| 852 | static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) | 855 | static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, |
| 856 | unsigned long data) | ||
| 853 | { | 857 | { |
| 854 | u64 *spte; | 858 | u64 *spte; |
| 855 | int young = 0; | 859 | int young = 0; |
diff --git a/block/blk-core.c b/block/blk-core.c index 81f34311659a..ac0fa10f8fa5 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -70,7 +70,7 @@ static void drive_stat_acct(struct request *rq, int new_io) | |||
| 70 | part_stat_inc(cpu, part, merges[rw]); | 70 | part_stat_inc(cpu, part, merges[rw]); |
| 71 | else { | 71 | else { |
| 72 | part_round_stats(cpu, part); | 72 | part_round_stats(cpu, part); |
| 73 | part_inc_in_flight(part); | 73 | part_inc_in_flight(part, rw); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | part_stat_unlock(); | 76 | part_stat_unlock(); |
| @@ -1030,9 +1030,9 @@ static void part_round_stats_single(int cpu, struct hd_struct *part, | |||
| 1030 | if (now == part->stamp) | 1030 | if (now == part->stamp) |
| 1031 | return; | 1031 | return; |
| 1032 | 1032 | ||
| 1033 | if (part->in_flight) { | 1033 | if (part_in_flight(part)) { |
| 1034 | __part_stat_add(cpu, part, time_in_queue, | 1034 | __part_stat_add(cpu, part, time_in_queue, |
| 1035 | part->in_flight * (now - part->stamp)); | 1035 | part_in_flight(part) * (now - part->stamp)); |
| 1036 | __part_stat_add(cpu, part, io_ticks, (now - part->stamp)); | 1036 | __part_stat_add(cpu, part, io_ticks, (now - part->stamp)); |
| 1037 | } | 1037 | } |
| 1038 | part->stamp = now; | 1038 | part->stamp = now; |
| @@ -1739,7 +1739,7 @@ static void blk_account_io_done(struct request *req) | |||
| 1739 | part_stat_inc(cpu, part, ios[rw]); | 1739 | part_stat_inc(cpu, part, ios[rw]); |
| 1740 | part_stat_add(cpu, part, ticks[rw], duration); | 1740 | part_stat_add(cpu, part, ticks[rw], duration); |
| 1741 | part_round_stats(cpu, part); | 1741 | part_round_stats(cpu, part); |
| 1742 | part_dec_in_flight(part); | 1742 | part_dec_in_flight(part, rw); |
| 1743 | 1743 | ||
| 1744 | part_stat_unlock(); | 1744 | part_stat_unlock(); |
| 1745 | } | 1745 | } |
| @@ -2492,14 +2492,6 @@ int kblockd_schedule_work(struct request_queue *q, struct work_struct *work) | |||
| 2492 | } | 2492 | } |
| 2493 | EXPORT_SYMBOL(kblockd_schedule_work); | 2493 | EXPORT_SYMBOL(kblockd_schedule_work); |
| 2494 | 2494 | ||
| 2495 | int kblockd_schedule_delayed_work(struct request_queue *q, | ||
| 2496 | struct delayed_work *work, | ||
| 2497 | unsigned long delay) | ||
| 2498 | { | ||
| 2499 | return queue_delayed_work(kblockd_workqueue, work, delay); | ||
| 2500 | } | ||
| 2501 | EXPORT_SYMBOL(kblockd_schedule_delayed_work); | ||
| 2502 | |||
| 2503 | int __init blk_dev_init(void) | 2495 | int __init blk_dev_init(void) |
| 2504 | { | 2496 | { |
| 2505 | BUILD_BUG_ON(__REQ_NR_BITS > 8 * | 2497 | BUILD_BUG_ON(__REQ_NR_BITS > 8 * |
diff --git a/block/blk-merge.c b/block/blk-merge.c index b0de8574fdc8..99cb5cf1f447 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
| @@ -351,7 +351,7 @@ static void blk_account_io_merge(struct request *req) | |||
| 351 | part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); | 351 | part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); |
| 352 | 352 | ||
| 353 | part_round_stats(cpu, part); | 353 | part_round_stats(cpu, part); |
| 354 | part_dec_in_flight(part); | 354 | part_dec_in_flight(part, rq_data_dir(req)); |
| 355 | 355 | ||
| 356 | part_stat_unlock(); | 356 | part_stat_unlock(); |
| 357 | } | 357 | } |
diff --git a/block/blk-settings.c b/block/blk-settings.c index e0695bca7027..66d4aa8799b7 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
| @@ -242,7 +242,7 @@ EXPORT_SYMBOL(blk_queue_max_hw_sectors); | |||
| 242 | /** | 242 | /** |
| 243 | * blk_queue_max_discard_sectors - set max sectors for a single discard | 243 | * blk_queue_max_discard_sectors - set max sectors for a single discard |
| 244 | * @q: the request queue for the device | 244 | * @q: the request queue for the device |
| 245 | * @max_discard: maximum number of sectors to discard | 245 | * @max_discard_sectors: maximum number of sectors to discard |
| 246 | **/ | 246 | **/ |
| 247 | void blk_queue_max_discard_sectors(struct request_queue *q, | 247 | void blk_queue_max_discard_sectors(struct request_queue *q, |
| 248 | unsigned int max_discard_sectors) | 248 | unsigned int max_discard_sectors) |
diff --git a/block/blk-tag.c b/block/blk-tag.c index 2e5cfeb59333..6b0f52c20964 100644 --- a/block/blk-tag.c +++ b/block/blk-tag.c | |||
| @@ -359,7 +359,7 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq) | |||
| 359 | max_depth -= 2; | 359 | max_depth -= 2; |
| 360 | if (!max_depth) | 360 | if (!max_depth) |
| 361 | max_depth = 1; | 361 | max_depth = 1; |
| 362 | if (q->in_flight[0] > max_depth) | 362 | if (q->in_flight[BLK_RW_ASYNC] > max_depth) |
| 363 | return 1; | 363 | return 1; |
| 364 | } | 364 | } |
| 365 | 365 | ||
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 9c4b679908f4..069a61017c02 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
| @@ -150,7 +150,7 @@ struct cfq_data { | |||
| 150 | * idle window management | 150 | * idle window management |
| 151 | */ | 151 | */ |
| 152 | struct timer_list idle_slice_timer; | 152 | struct timer_list idle_slice_timer; |
| 153 | struct delayed_work unplug_work; | 153 | struct work_struct unplug_work; |
| 154 | 154 | ||
| 155 | struct cfq_queue *active_queue; | 155 | struct cfq_queue *active_queue; |
| 156 | struct cfq_io_context *active_cic; | 156 | struct cfq_io_context *active_cic; |
| @@ -230,7 +230,7 @@ CFQ_CFQQ_FNS(coop); | |||
| 230 | blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args) | 230 | blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args) |
| 231 | 231 | ||
| 232 | static void cfq_dispatch_insert(struct request_queue *, struct request *); | 232 | static void cfq_dispatch_insert(struct request_queue *, struct request *); |
| 233 | static struct cfq_queue *cfq_get_queue(struct cfq_data *, int, | 233 | static struct cfq_queue *cfq_get_queue(struct cfq_data *, bool, |
| 234 | struct io_context *, gfp_t); | 234 | struct io_context *, gfp_t); |
| 235 | static struct cfq_io_context *cfq_cic_lookup(struct cfq_data *, | 235 | static struct cfq_io_context *cfq_cic_lookup(struct cfq_data *, |
| 236 | struct io_context *); | 236 | struct io_context *); |
| @@ -241,40 +241,35 @@ static inline int rq_in_driver(struct cfq_data *cfqd) | |||
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | static inline struct cfq_queue *cic_to_cfqq(struct cfq_io_context *cic, | 243 | static inline struct cfq_queue *cic_to_cfqq(struct cfq_io_context *cic, |
| 244 | int is_sync) | 244 | bool is_sync) |
| 245 | { | 245 | { |
| 246 | return cic->cfqq[!!is_sync]; | 246 | return cic->cfqq[is_sync]; |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | static inline void cic_set_cfqq(struct cfq_io_context *cic, | 249 | static inline void cic_set_cfqq(struct cfq_io_context *cic, |
| 250 | struct cfq_queue *cfqq, int is_sync) | 250 | struct cfq_queue *cfqq, bool is_sync) |
| 251 | { | 251 | { |
| 252 | cic->cfqq[!!is_sync] = cfqq; | 252 | cic->cfqq[is_sync] = cfqq; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | /* | 255 | /* |
| 256 | * We regard a request as SYNC, if it's either a read or has the SYNC bit | 256 | * We regard a request as SYNC, if it's either a read or has the SYNC bit |
| 257 | * set (in which case it could also be direct WRITE). | 257 | * set (in which case it could also be direct WRITE). |
| 258 | */ | 258 | */ |
| 259 | static inline int cfq_bio_sync(struct bio *bio) | 259 | static inline bool cfq_bio_sync(struct bio *bio) |
| 260 | { | 260 | { |
| 261 | if (bio_data_dir(bio) == READ || bio_rw_flagged(bio, BIO_RW_SYNCIO)) | 261 | return bio_data_dir(bio) == READ || bio_rw_flagged(bio, BIO_RW_SYNCIO); |
| 262 | return 1; | ||
| 263 | |||
| 264 | return 0; | ||
| 265 | } | 262 | } |
| 266 | 263 | ||
| 267 | /* | 264 | /* |
| 268 | * scheduler run of queue, if there are requests pending and no one in the | 265 | * scheduler run of queue, if there are requests pending and no one in the |
| 269 | * driver that will restart queueing | 266 | * driver that will restart queueing |
| 270 | */ | 267 | */ |
| 271 | static inline void cfq_schedule_dispatch(struct cfq_data *cfqd, | 268 | static inline void cfq_schedule_dispatch(struct cfq_data *cfqd) |
| 272 | unsigned long delay) | ||
| 273 | { | 269 | { |
| 274 | if (cfqd->busy_queues) { | 270 | if (cfqd->busy_queues) { |
| 275 | cfq_log(cfqd, "schedule dispatch"); | 271 | cfq_log(cfqd, "schedule dispatch"); |
| 276 | kblockd_schedule_delayed_work(cfqd->queue, &cfqd->unplug_work, | 272 | kblockd_schedule_work(cfqd->queue, &cfqd->unplug_work); |
| 277 | delay); | ||
| 278 | } | 273 | } |
| 279 | } | 274 | } |
| 280 | 275 | ||
| @@ -290,7 +285,7 @@ static int cfq_queue_empty(struct request_queue *q) | |||
| 290 | * if a queue is marked sync and has sync io queued. A sync queue with async | 285 | * if a queue is marked sync and has sync io queued. A sync queue with async |
| 291 | * io only, should not get full sync slice length. | 286 | * io only, should not get full sync slice length. |
| 292 | */ | 287 | */ |
| 293 | static inline int cfq_prio_slice(struct cfq_data *cfqd, int sync, | 288 | static inline int cfq_prio_slice(struct cfq_data *cfqd, bool sync, |
| 294 | unsigned short prio) | 289 | unsigned short prio) |
| 295 | { | 290 | { |
| 296 | const int base_slice = cfqd->cfq_slice[sync]; | 291 | const int base_slice = cfqd->cfq_slice[sync]; |
| @@ -318,7 +313,7 @@ cfq_set_prio_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
| 318 | * isn't valid until the first request from the dispatch is activated | 313 | * isn't valid until the first request from the dispatch is activated |
| 319 | * and the slice time set. | 314 | * and the slice time set. |
| 320 | */ | 315 | */ |
| 321 | static inline int cfq_slice_used(struct cfq_queue *cfqq) | 316 | static inline bool cfq_slice_used(struct cfq_queue *cfqq) |
| 322 | { | 317 | { |
| 323 | if (cfq_cfqq_slice_new(cfqq)) | 318 | if (cfq_cfqq_slice_new(cfqq)) |
| 324 | return 0; | 319 | return 0; |
| @@ -493,7 +488,7 @@ static unsigned long cfq_slice_offset(struct cfq_data *cfqd, | |||
| 493 | * we will service the queues. | 488 | * we will service the queues. |
| 494 | */ | 489 | */ |
| 495 | static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq, | 490 | static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq, |
| 496 | int add_front) | 491 | bool add_front) |
| 497 | { | 492 | { |
| 498 | struct rb_node **p, *parent; | 493 | struct rb_node **p, *parent; |
| 499 | struct cfq_queue *__cfqq; | 494 | struct cfq_queue *__cfqq; |
| @@ -509,11 +504,20 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
| 509 | } else | 504 | } else |
| 510 | rb_key += jiffies; | 505 | rb_key += jiffies; |
| 511 | } else if (!add_front) { | 506 | } else if (!add_front) { |
| 507 | /* | ||
| 508 | * Get our rb key offset. Subtract any residual slice | ||
| 509 | * value carried from last service. A negative resid | ||
| 510 | * count indicates slice overrun, and this should position | ||
| 511 | * the next service time further away in the tree. | ||
| 512 | */ | ||
| 512 | rb_key = cfq_slice_offset(cfqd, cfqq) + jiffies; | 513 | rb_key = cfq_slice_offset(cfqd, cfqq) + jiffies; |
| 513 | rb_key += cfqq->slice_resid; | 514 | rb_key -= cfqq->slice_resid; |
| 514 | cfqq->slice_resid = 0; | 515 | cfqq->slice_resid = 0; |
| 515 | } else | 516 | } else { |
| 516 | rb_key = 0; | 517 | rb_key = -HZ; |
| 518 | __cfqq = cfq_rb_first(&cfqd->service_tree); | ||
| 519 | rb_key += __cfqq ? __cfqq->rb_key : jiffies; | ||
| 520 | } | ||
| 517 | 521 | ||
| 518 | if (!RB_EMPTY_NODE(&cfqq->rb_node)) { | 522 | if (!RB_EMPTY_NODE(&cfqq->rb_node)) { |
| 519 | /* | 523 | /* |
| @@ -547,7 +551,7 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
| 547 | n = &(*p)->rb_left; | 551 | n = &(*p)->rb_left; |
| 548 | else if (cfq_class_idle(cfqq) > cfq_class_idle(__cfqq)) | 552 | else if (cfq_class_idle(cfqq) > cfq_class_idle(__cfqq)) |
| 549 | n = &(*p)->rb_right; | 553 | n = &(*p)->rb_right; |
| 550 | else if (rb_key < __cfqq->rb_key) | 554 | else if (time_before(rb_key, __cfqq->rb_key)) |
| 551 | n = &(*p)->rb_left; | 555 | n = &(*p)->rb_left; |
| 552 | else | 556 | else |
| 553 | n = &(*p)->rb_right; | 557 | n = &(*p)->rb_right; |
| @@ -827,8 +831,10 @@ cfq_merged_requests(struct request_queue *q, struct request *rq, | |||
| 827 | * reposition in fifo if next is older than rq | 831 | * reposition in fifo if next is older than rq |
| 828 | */ | 832 | */ |
| 829 | if (!list_empty(&rq->queuelist) && !list_empty(&next->queuelist) && | 833 | if (!list_empty(&rq->queuelist) && !list_empty(&next->queuelist) && |
| 830 | time_before(next->start_time, rq->start_time)) | 834 | time_before(rq_fifo_time(next), rq_fifo_time(rq))) { |
| 831 | list_move(&rq->queuelist, &next->queuelist); | 835 | list_move(&rq->queuelist, &next->queuelist); |
| 836 | rq_set_fifo_time(rq, rq_fifo_time(next)); | ||
| 837 | } | ||
| 832 | 838 | ||
| 833 | cfq_remove_request(next); | 839 | cfq_remove_request(next); |
| 834 | } | 840 | } |
| @@ -844,7 +850,7 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq, | |||
| 844 | * Disallow merge of a sync bio into an async request. | 850 | * Disallow merge of a sync bio into an async request. |
| 845 | */ | 851 | */ |
| 846 | if (cfq_bio_sync(bio) && !rq_is_sync(rq)) | 852 | if (cfq_bio_sync(bio) && !rq_is_sync(rq)) |
| 847 | return 0; | 853 | return false; |
| 848 | 854 | ||
| 849 | /* | 855 | /* |
| 850 | * Lookup the cfqq that this bio will be queued with. Allow | 856 | * Lookup the cfqq that this bio will be queued with. Allow |
| @@ -852,13 +858,10 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq, | |||
| 852 | */ | 858 | */ |
| 853 | cic = cfq_cic_lookup(cfqd, current->io_context); | 859 | cic = cfq_cic_lookup(cfqd, current->io_context); |
| 854 | if (!cic) | 860 | if (!cic) |
| 855 | return 0; | 861 | return false; |
| 856 | 862 | ||
| 857 | cfqq = cic_to_cfqq(cic, cfq_bio_sync(bio)); | 863 | cfqq = cic_to_cfqq(cic, cfq_bio_sync(bio)); |
| 858 | if (cfqq == RQ_CFQQ(rq)) | 864 | return cfqq == RQ_CFQQ(rq); |
| 859 | return 1; | ||
| 860 | |||
| 861 | return 0; | ||
| 862 | } | 865 | } |
| 863 | 866 | ||
| 864 | static void __cfq_set_active_queue(struct cfq_data *cfqd, | 867 | static void __cfq_set_active_queue(struct cfq_data *cfqd, |
| @@ -886,7 +889,7 @@ static void __cfq_set_active_queue(struct cfq_data *cfqd, | |||
| 886 | */ | 889 | */ |
| 887 | static void | 890 | static void |
| 888 | __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq, | 891 | __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq, |
| 889 | int timed_out) | 892 | bool timed_out) |
| 890 | { | 893 | { |
| 891 | cfq_log_cfqq(cfqd, cfqq, "slice expired t=%d", timed_out); | 894 | cfq_log_cfqq(cfqd, cfqq, "slice expired t=%d", timed_out); |
| 892 | 895 | ||
| @@ -914,7 +917,7 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
| 914 | } | 917 | } |
| 915 | } | 918 | } |
| 916 | 919 | ||
| 917 | static inline void cfq_slice_expired(struct cfq_data *cfqd, int timed_out) | 920 | static inline void cfq_slice_expired(struct cfq_data *cfqd, bool timed_out) |
| 918 | { | 921 | { |
| 919 | struct cfq_queue *cfqq = cfqd->active_queue; | 922 | struct cfq_queue *cfqq = cfqd->active_queue; |
| 920 | 923 | ||
| @@ -1026,7 +1029,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, | |||
| 1026 | */ | 1029 | */ |
| 1027 | static struct cfq_queue *cfq_close_cooperator(struct cfq_data *cfqd, | 1030 | static struct cfq_queue *cfq_close_cooperator(struct cfq_data *cfqd, |
| 1028 | struct cfq_queue *cur_cfqq, | 1031 | struct cfq_queue *cur_cfqq, |
| 1029 | int probe) | 1032 | bool probe) |
| 1030 | { | 1033 | { |
| 1031 | struct cfq_queue *cfqq; | 1034 | struct cfq_queue *cfqq; |
| 1032 | 1035 | ||
| @@ -1090,6 +1093,15 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd) | |||
| 1090 | if (!cic || !atomic_read(&cic->ioc->nr_tasks)) | 1093 | if (!cic || !atomic_read(&cic->ioc->nr_tasks)) |
| 1091 | return; | 1094 | return; |
| 1092 | 1095 | ||
| 1096 | /* | ||
| 1097 | * If our average think time is larger than the remaining time | ||
| 1098 | * slice, then don't idle. This avoids overrunning the allotted | ||
| 1099 | * time slice. | ||
| 1100 | */ | ||
| 1101 | if (sample_valid(cic->ttime_samples) && | ||
| 1102 | (cfqq->slice_end - jiffies < cic->ttime_mean)) | ||
| 1103 | return; | ||
| 1104 | |||
| 1093 | cfq_mark_cfqq_wait_request(cfqq); | 1105 | cfq_mark_cfqq_wait_request(cfqq); |
| 1094 | 1106 | ||
| 1095 | /* | 1107 | /* |
| @@ -1129,9 +1141,7 @@ static void cfq_dispatch_insert(struct request_queue *q, struct request *rq) | |||
| 1129 | */ | 1141 | */ |
| 1130 | static struct request *cfq_check_fifo(struct cfq_queue *cfqq) | 1142 | static struct request *cfq_check_fifo(struct cfq_queue *cfqq) |
| 1131 | { | 1143 | { |
| 1132 | struct cfq_data *cfqd = cfqq->cfqd; | 1144 | struct request *rq = NULL; |
| 1133 | struct request *rq; | ||
| 1134 | int fifo; | ||
| 1135 | 1145 | ||
| 1136 | if (cfq_cfqq_fifo_expire(cfqq)) | 1146 | if (cfq_cfqq_fifo_expire(cfqq)) |
| 1137 | return NULL; | 1147 | return NULL; |
| @@ -1141,13 +1151,11 @@ static struct request *cfq_check_fifo(struct cfq_queue *cfqq) | |||
| 1141 | if (list_empty(&cfqq->fifo)) | 1151 | if (list_empty(&cfqq->fifo)) |
| 1142 | return NULL; | 1152 | return NULL; |
| 1143 | 1153 | ||
| 1144 | fifo = cfq_cfqq_sync(cfqq); | ||
| 1145 | rq = rq_entry_fifo(cfqq->fifo.next); | 1154 | rq = rq_entry_fifo(cfqq->fifo.next); |
| 1146 | 1155 | if (time_before(jiffies, rq_fifo_time(rq))) | |
| 1147 | if (time_before(jiffies, rq->start_time + cfqd->cfq_fifo_expire[fifo])) | ||
| 1148 | rq = NULL; | 1156 | rq = NULL; |
| 1149 | 1157 | ||
| 1150 | cfq_log_cfqq(cfqd, cfqq, "fifo=%p", rq); | 1158 | cfq_log_cfqq(cfqq->cfqd, cfqq, "fifo=%p", rq); |
| 1151 | return rq; | 1159 | return rq; |
| 1152 | } | 1160 | } |
| 1153 | 1161 | ||
| @@ -1248,67 +1256,21 @@ static int cfq_forced_dispatch(struct cfq_data *cfqd) | |||
| 1248 | return dispatched; | 1256 | return dispatched; |
| 1249 | } | 1257 | } |
| 1250 | 1258 | ||
| 1251 | /* | 1259 | static bool cfq_may_dispatch(struct cfq_data *cfqd, struct cfq_queue *cfqq) |
| 1252 | * Dispatch a request from cfqq, moving them to the request queue | ||
| 1253 | * dispatch list. | ||
| 1254 | */ | ||
| 1255 | static void cfq_dispatch_request(struct cfq_data *cfqd, struct cfq_queue *cfqq) | ||
| 1256 | { | 1260 | { |
| 1257 | struct request *rq; | ||
| 1258 | |||
| 1259 | BUG_ON(RB_EMPTY_ROOT(&cfqq->sort_list)); | ||
| 1260 | |||
| 1261 | /* | ||
| 1262 | * follow expired path, else get first next available | ||
| 1263 | */ | ||
| 1264 | rq = cfq_check_fifo(cfqq); | ||
| 1265 | if (!rq) | ||
| 1266 | rq = cfqq->next_rq; | ||
| 1267 | |||
| 1268 | /* | ||
| 1269 | * insert request into driver dispatch list | ||
| 1270 | */ | ||
| 1271 | cfq_dispatch_insert(cfqd->queue, rq); | ||
| 1272 | |||
| 1273 | if (!cfqd->active_cic) { | ||
| 1274 | struct cfq_io_context *cic = RQ_CIC(rq); | ||
| 1275 | |||
| 1276 | atomic_long_inc(&cic->ioc->refcount); | ||
| 1277 | cfqd->active_cic = cic; | ||
| 1278 | } | ||
| 1279 | } | ||
| 1280 | |||
| 1281 | /* | ||
| 1282 | * Find the cfqq that we need to service and move a request from that to the | ||
| 1283 | * dispatch list | ||
| 1284 | */ | ||
| 1285 | static int cfq_dispatch_requests(struct request_queue *q, int force) | ||
| 1286 | { | ||
| 1287 | struct cfq_data *cfqd = q->elevator->elevator_data; | ||
| 1288 | struct cfq_queue *cfqq; | ||
| 1289 | unsigned int max_dispatch; | 1261 | unsigned int max_dispatch; |
| 1290 | 1262 | ||
| 1291 | if (!cfqd->busy_queues) | ||
| 1292 | return 0; | ||
| 1293 | |||
| 1294 | if (unlikely(force)) | ||
| 1295 | return cfq_forced_dispatch(cfqd); | ||
| 1296 | |||
| 1297 | cfqq = cfq_select_queue(cfqd); | ||
| 1298 | if (!cfqq) | ||
| 1299 | return 0; | ||
| 1300 | |||
| 1301 | /* | 1263 | /* |
| 1302 | * Drain async requests before we start sync IO | 1264 | * Drain async requests before we start sync IO |
| 1303 | */ | 1265 | */ |
| 1304 | if (cfq_cfqq_idle_window(cfqq) && cfqd->rq_in_driver[BLK_RW_ASYNC]) | 1266 | if (cfq_cfqq_idle_window(cfqq) && cfqd->rq_in_driver[BLK_RW_ASYNC]) |
| 1305 | return 0; | 1267 | return false; |
| 1306 | 1268 | ||
| 1307 | /* | 1269 | /* |
| 1308 | * If this is an async queue and we have sync IO in flight, let it wait | 1270 | * If this is an async queue and we have sync IO in flight, let it wait |
| 1309 | */ | 1271 | */ |
| 1310 | if (cfqd->sync_flight && !cfq_cfqq_sync(cfqq)) | 1272 | if (cfqd->sync_flight && !cfq_cfqq_sync(cfqq)) |
| 1311 | return 0; | 1273 | return false; |
| 1312 | 1274 | ||
| 1313 | max_dispatch = cfqd->cfq_quantum; | 1275 | max_dispatch = cfqd->cfq_quantum; |
| 1314 | if (cfq_class_idle(cfqq)) | 1276 | if (cfq_class_idle(cfqq)) |
| @@ -1322,13 +1284,13 @@ static int cfq_dispatch_requests(struct request_queue *q, int force) | |||
| 1322 | * idle queue must always only have a single IO in flight | 1284 | * idle queue must always only have a single IO in flight |
| 1323 | */ | 1285 | */ |
| 1324 | if (cfq_class_idle(cfqq)) | 1286 | if (cfq_class_idle(cfqq)) |
| 1325 | return 0; | 1287 | return false; |
| 1326 | 1288 | ||
| 1327 | /* | 1289 | /* |
| 1328 | * We have other queues, don't allow more IO from this one | 1290 | * We have other queues, don't allow more IO from this one |
| 1329 | */ | 1291 | */ |
| 1330 | if (cfqd->busy_queues > 1) | 1292 | if (cfqd->busy_queues > 1) |
| 1331 | return 0; | 1293 | return false; |
| 1332 | 1294 | ||
| 1333 | /* | 1295 | /* |
| 1334 | * Sole queue user, allow bigger slice | 1296 | * Sole queue user, allow bigger slice |
| @@ -1352,13 +1314,72 @@ static int cfq_dispatch_requests(struct request_queue *q, int force) | |||
| 1352 | max_dispatch = depth; | 1314 | max_dispatch = depth; |
| 1353 | } | 1315 | } |
| 1354 | 1316 | ||
| 1355 | if (cfqq->dispatched >= max_dispatch) | 1317 | /* |
| 1318 | * If we're below the current max, allow a dispatch | ||
| 1319 | */ | ||
| 1320 | return cfqq->dispatched < max_dispatch; | ||
| 1321 | } | ||
| 1322 | |||
| 1323 | /* | ||
| 1324 | * Dispatch a request from cfqq, moving them to the request queue | ||
| 1325 | * dispatch list. | ||
| 1326 | */ | ||
| 1327 | static bool cfq_dispatch_request(struct cfq_data *cfqd, struct cfq_queue *cfqq) | ||
| 1328 | { | ||
| 1329 | struct request *rq; | ||
| 1330 | |||
| 1331 | BUG_ON(RB_EMPTY_ROOT(&cfqq->sort_list)); | ||
| 1332 | |||
| 1333 | if (!cfq_may_dispatch(cfqd, cfqq)) | ||
| 1334 | return false; | ||
| 1335 | |||
| 1336 | /* | ||
| 1337 | * follow expired path, else get first next available | ||
| 1338 | */ | ||
| 1339 | rq = cfq_check_fifo(cfqq); | ||
| 1340 | if (!rq) | ||
| 1341 | rq = cfqq->next_rq; | ||
| 1342 | |||
| 1343 | /* | ||
| 1344 | * insert request into driver dispatch list | ||
| 1345 | */ | ||
| 1346 | cfq_dispatch_insert(cfqd->queue, rq); | ||
| 1347 | |||
| 1348 | if (!cfqd->active_cic) { | ||
| 1349 | struct cfq_io_context *cic = RQ_CIC(rq); | ||
| 1350 | |||
| 1351 | atomic_long_inc(&cic->ioc->refcount); | ||
| 1352 | cfqd->active_cic = cic; | ||
| 1353 | } | ||
| 1354 | |||
| 1355 | return true; | ||
| 1356 | } | ||
| 1357 | |||
| 1358 | /* | ||
| 1359 | * Find the cfqq that we need to service and move a request from that to the | ||
| 1360 | * dispatch list | ||
| 1361 | */ | ||
| 1362 | static int cfq_dispatch_requests(struct request_queue *q, int force) | ||
| 1363 | { | ||
| 1364 | struct cfq_data *cfqd = q->elevator->elevator_data; | ||
| 1365 | struct cfq_queue *cfqq; | ||
| 1366 | |||
| 1367 | if (!cfqd->busy_queues) | ||
| 1368 | return 0; | ||
| 1369 | |||
| 1370 | if (unlikely(force)) | ||
| 1371 | return cfq_forced_dispatch(cfqd); | ||
| 1372 | |||
| 1373 | cfqq = cfq_select_queue(cfqd); | ||
| 1374 | if (!cfqq) | ||
| 1356 | return 0; | 1375 | return 0; |
| 1357 | 1376 | ||
| 1358 | /* | 1377 | /* |
| 1359 | * Dispatch a request from this cfqq | 1378 | * Dispatch a request from this cfqq, if it is allowed |
| 1360 | */ | 1379 | */ |
| 1361 | cfq_dispatch_request(cfqd, cfqq); | 1380 | if (!cfq_dispatch_request(cfqd, cfqq)) |
| 1381 | return 0; | ||
| 1382 | |||
| 1362 | cfqq->slice_dispatch++; | 1383 | cfqq->slice_dispatch++; |
| 1363 | cfq_clear_cfqq_must_dispatch(cfqq); | 1384 | cfq_clear_cfqq_must_dispatch(cfqq); |
| 1364 | 1385 | ||
| @@ -1399,7 +1420,7 @@ static void cfq_put_queue(struct cfq_queue *cfqq) | |||
| 1399 | 1420 | ||
| 1400 | if (unlikely(cfqd->active_queue == cfqq)) { | 1421 | if (unlikely(cfqd->active_queue == cfqq)) { |
| 1401 | __cfq_slice_expired(cfqd, cfqq, 0); | 1422 | __cfq_slice_expired(cfqd, cfqq, 0); |
| 1402 | cfq_schedule_dispatch(cfqd, 0); | 1423 | cfq_schedule_dispatch(cfqd); |
| 1403 | } | 1424 | } |
| 1404 | 1425 | ||
| 1405 | kmem_cache_free(cfq_pool, cfqq); | 1426 | kmem_cache_free(cfq_pool, cfqq); |
| @@ -1494,7 +1515,7 @@ static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
| 1494 | { | 1515 | { |
| 1495 | if (unlikely(cfqq == cfqd->active_queue)) { | 1516 | if (unlikely(cfqq == cfqd->active_queue)) { |
| 1496 | __cfq_slice_expired(cfqd, cfqq, 0); | 1517 | __cfq_slice_expired(cfqd, cfqq, 0); |
| 1497 | cfq_schedule_dispatch(cfqd, 0); | 1518 | cfq_schedule_dispatch(cfqd); |
| 1498 | } | 1519 | } |
| 1499 | 1520 | ||
| 1500 | cfq_put_queue(cfqq); | 1521 | cfq_put_queue(cfqq); |
| @@ -1658,7 +1679,7 @@ static void cfq_ioc_set_ioprio(struct io_context *ioc) | |||
| 1658 | } | 1679 | } |
| 1659 | 1680 | ||
| 1660 | static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq, | 1681 | static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq, |
| 1661 | pid_t pid, int is_sync) | 1682 | pid_t pid, bool is_sync) |
| 1662 | { | 1683 | { |
| 1663 | RB_CLEAR_NODE(&cfqq->rb_node); | 1684 | RB_CLEAR_NODE(&cfqq->rb_node); |
| 1664 | RB_CLEAR_NODE(&cfqq->p_node); | 1685 | RB_CLEAR_NODE(&cfqq->p_node); |
| @@ -1678,7 +1699,7 @@ static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
| 1678 | } | 1699 | } |
| 1679 | 1700 | ||
| 1680 | static struct cfq_queue * | 1701 | static struct cfq_queue * |
| 1681 | cfq_find_alloc_queue(struct cfq_data *cfqd, int is_sync, | 1702 | cfq_find_alloc_queue(struct cfq_data *cfqd, bool is_sync, |
| 1682 | struct io_context *ioc, gfp_t gfp_mask) | 1703 | struct io_context *ioc, gfp_t gfp_mask) |
| 1683 | { | 1704 | { |
| 1684 | struct cfq_queue *cfqq, *new_cfqq = NULL; | 1705 | struct cfq_queue *cfqq, *new_cfqq = NULL; |
| @@ -1742,7 +1763,7 @@ cfq_async_queue_prio(struct cfq_data *cfqd, int ioprio_class, int ioprio) | |||
| 1742 | } | 1763 | } |
| 1743 | 1764 | ||
| 1744 | static struct cfq_queue * | 1765 | static struct cfq_queue * |
| 1745 | cfq_get_queue(struct cfq_data *cfqd, int is_sync, struct io_context *ioc, | 1766 | cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct io_context *ioc, |
| 1746 | gfp_t gfp_mask) | 1767 | gfp_t gfp_mask) |
| 1747 | { | 1768 | { |
| 1748 | const int ioprio = task_ioprio(ioc); | 1769 | const int ioprio = task_ioprio(ioc); |
| @@ -1977,7 +1998,10 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
| 1977 | (!cfqd->cfq_latency && cfqd->hw_tag && CIC_SEEKY(cic))) | 1998 | (!cfqd->cfq_latency && cfqd->hw_tag && CIC_SEEKY(cic))) |
| 1978 | enable_idle = 0; | 1999 | enable_idle = 0; |
| 1979 | else if (sample_valid(cic->ttime_samples)) { | 2000 | else if (sample_valid(cic->ttime_samples)) { |
| 1980 | if (cic->ttime_mean > cfqd->cfq_slice_idle) | 2001 | unsigned int slice_idle = cfqd->cfq_slice_idle; |
| 2002 | if (sample_valid(cic->seek_samples) && CIC_SEEKY(cic)) | ||
| 2003 | slice_idle = msecs_to_jiffies(CFQ_MIN_TT); | ||
| 2004 | if (cic->ttime_mean > slice_idle) | ||
| 1981 | enable_idle = 0; | 2005 | enable_idle = 0; |
| 1982 | else | 2006 | else |
| 1983 | enable_idle = 1; | 2007 | enable_idle = 1; |
| @@ -1996,7 +2020,7 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
| 1996 | * Check if new_cfqq should preempt the currently active queue. Return 0 for | 2020 | * Check if new_cfqq should preempt the currently active queue. Return 0 for |
| 1997 | * no or if we aren't sure, a 1 will cause a preempt. | 2021 | * no or if we aren't sure, a 1 will cause a preempt. |
| 1998 | */ | 2022 | */ |
| 1999 | static int | 2023 | static bool |
| 2000 | cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, | 2024 | cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, |
| 2001 | struct request *rq) | 2025 | struct request *rq) |
| 2002 | { | 2026 | { |
| @@ -2004,48 +2028,48 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, | |||
| 2004 | 2028 | ||
| 2005 | cfqq = cfqd->active_queue; | 2029 | cfqq = cfqd->active_queue; |
| 2006 | if (!cfqq) | 2030 | if (!cfqq) |
| 2007 | return 0; | 2031 | return false; |
| 2008 | 2032 | ||
| 2009 | if (cfq_slice_used(cfqq)) | 2033 | if (cfq_slice_used(cfqq)) |
| 2010 | return 1; | 2034 | return true; |
| 2011 | 2035 | ||
| 2012 | if (cfq_class_idle(new_cfqq)) | 2036 | if (cfq_class_idle(new_cfqq)) |
| 2013 | return 0; | 2037 | return false; |
| 2014 | 2038 | ||
| 2015 | if (cfq_class_idle(cfqq)) | 2039 | if (cfq_class_idle(cfqq)) |
| 2016 | return 1; | 2040 | return true; |
| 2017 | 2041 | ||
| 2018 | /* | 2042 | /* |
| 2019 | * if the new request is sync, but the currently running queue is | 2043 | * if the new request is sync, but the currently running queue is |
| 2020 | * not, let the sync request have priority. | 2044 | * not, let the sync request have priority. |
| 2021 | */ | 2045 | */ |
| 2022 | if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq)) | 2046 | if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq)) |
| 2023 | return 1; | 2047 | return true; |
| 2024 | 2048 | ||
| 2025 | /* | 2049 | /* |
| 2026 | * So both queues are sync. Let the new request get disk time if | 2050 | * So both queues are sync. Let the new request get disk time if |
| 2027 | * it's a metadata request and the current queue is doing regular IO. | 2051 | * it's a metadata request and the current queue is doing regular IO. |
| 2028 | */ | 2052 | */ |
| 2029 | if (rq_is_meta(rq) && !cfqq->meta_pending) | 2053 | if (rq_is_meta(rq) && !cfqq->meta_pending) |
| 2030 | return 1; | 2054 | return false; |
| 2031 | 2055 | ||
| 2032 | /* | 2056 | /* |
| 2033 | * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice. | 2057 | * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice. |
| 2034 | */ | 2058 | */ |
| 2035 | if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq)) | 2059 | if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq)) |
| 2036 | return 1; | 2060 | return true; |
| 2037 | 2061 | ||
| 2038 | if (!cfqd->active_cic || !cfq_cfqq_wait_request(cfqq)) | 2062 | if (!cfqd->active_cic || !cfq_cfqq_wait_request(cfqq)) |
| 2039 | return 0; | 2063 | return false; |
| 2040 | 2064 | ||
| 2041 | /* | 2065 | /* |
| 2042 | * if this request is as-good as one we would expect from the | 2066 | * if this request is as-good as one we would expect from the |
| 2043 | * current cfqq, let it preempt | 2067 | * current cfqq, let it preempt |
| 2044 | */ | 2068 | */ |
| 2045 | if (cfq_rq_close(cfqd, rq)) | 2069 | if (cfq_rq_close(cfqd, rq)) |
| 2046 | return 1; | 2070 | return true; |
| 2047 | 2071 | ||
| 2048 | return 0; | 2072 | return false; |
| 2049 | } | 2073 | } |
| 2050 | 2074 | ||
| 2051 | /* | 2075 | /* |
| @@ -2130,6 +2154,7 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq) | |||
| 2130 | 2154 | ||
| 2131 | cfq_add_rq_rb(rq); | 2155 | cfq_add_rq_rb(rq); |
| 2132 | 2156 | ||
| 2157 | rq_set_fifo_time(rq, jiffies + cfqd->cfq_fifo_expire[rq_is_sync(rq)]); | ||
| 2133 | list_add_tail(&rq->queuelist, &cfqq->fifo); | 2158 | list_add_tail(&rq->queuelist, &cfqq->fifo); |
| 2134 | 2159 | ||
| 2135 | cfq_rq_enqueued(cfqd, cfqq, rq); | 2160 | cfq_rq_enqueued(cfqd, cfqq, rq); |
| @@ -2211,7 +2236,7 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq) | |||
| 2211 | } | 2236 | } |
| 2212 | 2237 | ||
| 2213 | if (!rq_in_driver(cfqd)) | 2238 | if (!rq_in_driver(cfqd)) |
| 2214 | cfq_schedule_dispatch(cfqd, 0); | 2239 | cfq_schedule_dispatch(cfqd); |
| 2215 | } | 2240 | } |
| 2216 | 2241 | ||
| 2217 | /* | 2242 | /* |
| @@ -2309,7 +2334,7 @@ cfq_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask) | |||
| 2309 | struct cfq_data *cfqd = q->elevator->elevator_data; | 2334 | struct cfq_data *cfqd = q->elevator->elevator_data; |
| 2310 | struct cfq_io_context *cic; | 2335 | struct cfq_io_context *cic; |
| 2311 | const int rw = rq_data_dir(rq); | 2336 | const int rw = rq_data_dir(rq); |
| 2312 | const int is_sync = rq_is_sync(rq); | 2337 | const bool is_sync = rq_is_sync(rq); |
| 2313 | struct cfq_queue *cfqq; | 2338 | struct cfq_queue *cfqq; |
| 2314 | unsigned long flags; | 2339 | unsigned long flags; |
| 2315 | 2340 | ||
| @@ -2341,7 +2366,7 @@ queue_fail: | |||
| 2341 | if (cic) | 2366 | if (cic) |
| 2342 | put_io_context(cic->ioc); | 2367 | put_io_context(cic->ioc); |
| 2343 | 2368 | ||
| 2344 | cfq_schedule_dispatch(cfqd, 0); | 2369 | cfq_schedule_dispatch(cfqd); |
| 2345 | spin_unlock_irqrestore(q->queue_lock, flags); | 2370 | spin_unlock_irqrestore(q->queue_lock, flags); |
| 2346 | cfq_log(cfqd, "set_request fail"); | 2371 | cfq_log(cfqd, "set_request fail"); |
| 2347 | return 1; | 2372 | return 1; |
| @@ -2350,7 +2375,7 @@ queue_fail: | |||
| 2350 | static void cfq_kick_queue(struct work_struct *work) | 2375 | static void cfq_kick_queue(struct work_struct *work) |
| 2351 | { | 2376 | { |
| 2352 | struct cfq_data *cfqd = | 2377 | struct cfq_data *cfqd = |
| 2353 | container_of(work, struct cfq_data, unplug_work.work); | 2378 | container_of(work, struct cfq_data, unplug_work); |
| 2354 | struct request_queue *q = cfqd->queue; | 2379 | struct request_queue *q = cfqd->queue; |
| 2355 | 2380 | ||
| 2356 | spin_lock_irq(q->queue_lock); | 2381 | spin_lock_irq(q->queue_lock); |
| @@ -2404,7 +2429,7 @@ static void cfq_idle_slice_timer(unsigned long data) | |||
| 2404 | expire: | 2429 | expire: |
| 2405 | cfq_slice_expired(cfqd, timed_out); | 2430 | cfq_slice_expired(cfqd, timed_out); |
| 2406 | out_kick: | 2431 | out_kick: |
| 2407 | cfq_schedule_dispatch(cfqd, 0); | 2432 | cfq_schedule_dispatch(cfqd); |
| 2408 | out_cont: | 2433 | out_cont: |
| 2409 | spin_unlock_irqrestore(cfqd->queue->queue_lock, flags); | 2434 | spin_unlock_irqrestore(cfqd->queue->queue_lock, flags); |
| 2410 | } | 2435 | } |
| @@ -2412,7 +2437,7 @@ out_cont: | |||
| 2412 | static void cfq_shutdown_timer_wq(struct cfq_data *cfqd) | 2437 | static void cfq_shutdown_timer_wq(struct cfq_data *cfqd) |
| 2413 | { | 2438 | { |
| 2414 | del_timer_sync(&cfqd->idle_slice_timer); | 2439 | del_timer_sync(&cfqd->idle_slice_timer); |
| 2415 | cancel_delayed_work_sync(&cfqd->unplug_work); | 2440 | cancel_work_sync(&cfqd->unplug_work); |
| 2416 | } | 2441 | } |
| 2417 | 2442 | ||
| 2418 | static void cfq_put_async_queues(struct cfq_data *cfqd) | 2443 | static void cfq_put_async_queues(struct cfq_data *cfqd) |
| @@ -2494,7 +2519,7 @@ static void *cfq_init_queue(struct request_queue *q) | |||
| 2494 | cfqd->idle_slice_timer.function = cfq_idle_slice_timer; | 2519 | cfqd->idle_slice_timer.function = cfq_idle_slice_timer; |
| 2495 | cfqd->idle_slice_timer.data = (unsigned long) cfqd; | 2520 | cfqd->idle_slice_timer.data = (unsigned long) cfqd; |
| 2496 | 2521 | ||
| 2497 | INIT_DELAYED_WORK(&cfqd->unplug_work, cfq_kick_queue); | 2522 | INIT_WORK(&cfqd->unplug_work, cfq_kick_queue); |
| 2498 | 2523 | ||
| 2499 | cfqd->cfq_quantum = cfq_quantum; | 2524 | cfqd->cfq_quantum = cfq_quantum; |
| 2500 | cfqd->cfq_fifo_expire[0] = cfq_fifo_expire[0]; | 2525 | cfqd->cfq_fifo_expire[0] = cfq_fifo_expire[0]; |
diff --git a/block/elevator.c b/block/elevator.c index 1975b619c86d..a847046c6e53 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
| @@ -1059,9 +1059,7 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name, | |||
| 1059 | return count; | 1059 | return count; |
| 1060 | 1060 | ||
| 1061 | strlcpy(elevator_name, name, sizeof(elevator_name)); | 1061 | strlcpy(elevator_name, name, sizeof(elevator_name)); |
| 1062 | strstrip(elevator_name); | 1062 | e = elevator_get(strstrip(elevator_name)); |
| 1063 | |||
| 1064 | e = elevator_get(elevator_name); | ||
| 1065 | if (!e) { | 1063 | if (!e) { |
| 1066 | printk(KERN_ERR "elevator: type %s not found\n", elevator_name); | 1064 | printk(KERN_ERR "elevator: type %s not found\n", elevator_name); |
| 1067 | return -EINVAL; | 1065 | return -EINVAL; |
diff --git a/block/genhd.c b/block/genhd.c index 5a0861da324d..517e4332cb37 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
| @@ -869,6 +869,7 @@ static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); | |||
| 869 | static DEVICE_ATTR(alignment_offset, S_IRUGO, disk_alignment_offset_show, NULL); | 869 | static DEVICE_ATTR(alignment_offset, S_IRUGO, disk_alignment_offset_show, NULL); |
| 870 | static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL); | 870 | static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL); |
| 871 | static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); | 871 | static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); |
| 872 | static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL); | ||
| 872 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 873 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
| 873 | static struct device_attribute dev_attr_fail = | 874 | static struct device_attribute dev_attr_fail = |
| 874 | __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); | 875 | __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); |
| @@ -888,6 +889,7 @@ static struct attribute *disk_attrs[] = { | |||
| 888 | &dev_attr_alignment_offset.attr, | 889 | &dev_attr_alignment_offset.attr, |
| 889 | &dev_attr_capability.attr, | 890 | &dev_attr_capability.attr, |
| 890 | &dev_attr_stat.attr, | 891 | &dev_attr_stat.attr, |
| 892 | &dev_attr_inflight.attr, | ||
| 891 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 893 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
| 892 | &dev_attr_fail.attr, | 894 | &dev_attr_fail.attr, |
| 893 | #endif | 895 | #endif |
| @@ -1053,7 +1055,7 @@ static int diskstats_show(struct seq_file *seqf, void *v) | |||
| 1053 | part_stat_read(hd, merges[1]), | 1055 | part_stat_read(hd, merges[1]), |
| 1054 | (unsigned long long)part_stat_read(hd, sectors[1]), | 1056 | (unsigned long long)part_stat_read(hd, sectors[1]), |
| 1055 | jiffies_to_msecs(part_stat_read(hd, ticks[1])), | 1057 | jiffies_to_msecs(part_stat_read(hd, ticks[1])), |
| 1056 | hd->in_flight, | 1058 | part_in_flight(hd), |
| 1057 | jiffies_to_msecs(part_stat_read(hd, io_ticks)), | 1059 | jiffies_to_msecs(part_stat_read(hd, io_ticks)), |
| 1058 | jiffies_to_msecs(part_stat_read(hd, time_in_queue)) | 1060 | jiffies_to_msecs(part_stat_read(hd, time_in_queue)) |
| 1059 | ); | 1061 | ); |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 0ed42d8870c7..93d2c7971df6 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -218,10 +218,10 @@ config ACPI_PROCESSOR_AGGREGATOR | |||
| 218 | depends on X86 | 218 | depends on X86 |
| 219 | help | 219 | help |
| 220 | ACPI 4.0 defines processor Aggregator, which enables OS to perform | 220 | ACPI 4.0 defines processor Aggregator, which enables OS to perform |
| 221 | specfic processor configuration and control that applies to all | 221 | specific processor configuration and control that applies to all |
| 222 | processors in the platform. Currently only logical processor idling | 222 | processors in the platform. Currently only logical processor idling |
| 223 | is defined, which is to reduce power consumption. This driver | 223 | is defined, which is to reduce power consumption. This driver |
| 224 | support the new device. | 224 | supports the new device. |
| 225 | 225 | ||
| 226 | config ACPI_THERMAL | 226 | config ACPI_THERMAL |
| 227 | tristate "Thermal Zone" | 227 | tristate "Thermal Zone" |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 98b9690b0159..b6ed60b57b0d 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
| @@ -245,6 +245,7 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) | |||
| 245 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 245 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
| 246 | dev_name(&device->dev), event, | 246 | dev_name(&device->dev), event, |
| 247 | (u32) ac->state); | 247 | (u32) ac->state); |
| 248 | acpi_notifier_call_chain(device, event, (u32) ac->state); | ||
| 248 | #ifdef CONFIG_ACPI_SYSFS_POWER | 249 | #ifdef CONFIG_ACPI_SYSFS_POWER |
| 249 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | 250 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); |
| 250 | #endif | 251 | #endif |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 9335b87c5174..0c9c6a9a002c 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
| @@ -251,6 +251,9 @@ int acpi_lid_open(void) | |||
| 251 | acpi_status status; | 251 | acpi_status status; |
| 252 | unsigned long long state; | 252 | unsigned long long state; |
| 253 | 253 | ||
| 254 | if (!lid_device) | ||
| 255 | return -ENODEV; | ||
| 256 | |||
| 254 | status = acpi_evaluate_integer(lid_device->handle, "_LID", NULL, | 257 | status = acpi_evaluate_integer(lid_device->handle, "_LID", NULL, |
| 255 | &state); | 258 | &state); |
| 256 | if (ACPI_FAILURE(status)) | 259 | if (ACPI_FAILURE(status)) |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 31122214e0ec..1af808171d46 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
| @@ -389,6 +389,17 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle handle) | |||
| 389 | 389 | ||
| 390 | pbus = pdev->subordinate; | 390 | pbus = pdev->subordinate; |
| 391 | pci_dev_put(pdev); | 391 | pci_dev_put(pdev); |
| 392 | |||
| 393 | /* | ||
| 394 | * This function may be called for a non-PCI device that has a | ||
| 395 | * PCI parent (eg. a disk under a PCI SATA controller). In that | ||
| 396 | * case pdev->subordinate will be NULL for the parent. | ||
| 397 | */ | ||
| 398 | if (!pbus) { | ||
| 399 | dev_dbg(&pdev->dev, "Not a PCI-to-PCI bridge\n"); | ||
| 400 | pdev = NULL; | ||
| 401 | break; | ||
| 402 | } | ||
| 392 | } | 403 | } |
| 393 | out: | 404 | out: |
| 394 | list_for_each_entry_safe(node, tmp, &device_list, node) | 405 | list_for_each_entry_safe(node, tmp, &device_list, node) |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index f6e54bf8dd96..64e3c581b7a9 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -1109,7 +1109,12 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) | |||
| 1109 | */ | 1109 | */ |
| 1110 | 1110 | ||
| 1111 | /* Does this device support video switching? */ | 1111 | /* Does this device support video switching? */ |
| 1112 | if (video->cap._DOS) { | 1112 | if (video->cap._DOS || video->cap._DOD) { |
| 1113 | if (!video->cap._DOS) { | ||
| 1114 | printk(KERN_WARNING FW_BUG | ||
| 1115 | "ACPI(%s) defines _DOD but not _DOS\n", | ||
| 1116 | acpi_device_bid(video->device)); | ||
| 1117 | } | ||
| 1113 | video->flags.multihead = 1; | 1118 | video->flags.multihead = 1; |
| 1114 | status = 0; | 1119 | status = 0; |
| 1115 | } | 1120 | } |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 7032f25da9b5..575593a8b4e6 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
| @@ -84,7 +84,7 @@ long acpi_is_video_device(struct acpi_device *device) | |||
| 84 | return 0; | 84 | return 0; |
| 85 | 85 | ||
| 86 | /* Does this device able to support video switching ? */ | 86 | /* Does this device able to support video switching ? */ |
| 87 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) && | 87 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) || |
| 88 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) | 88 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) |
| 89 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; | 89 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; |
| 90 | 90 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index b1a257746a19..a06f5d6375a8 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -575,7 +575,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 575 | { PCI_VDEVICE(ATI, 0x4395), board_ahci_sb700 }, /* ATI SB700/800 */ | 575 | { PCI_VDEVICE(ATI, 0x4395), board_ahci_sb700 }, /* ATI SB700/800 */ |
| 576 | 576 | ||
| 577 | /* AMD */ | 577 | /* AMD */ |
| 578 | { PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD SB900 */ | 578 | { PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD Hudson-2 */ |
| 579 | /* AMD is using RAID class only for ahci controllers */ | 579 | /* AMD is using RAID class only for ahci controllers */ |
| 580 | { PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 580 | { PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| 581 | PCI_CLASS_STORAGE_RAID << 8, 0xffffff, board_ahci }, | 581 | PCI_CLASS_STORAGE_RAID << 8, 0xffffff, board_ahci }, |
| @@ -605,6 +605,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 605 | { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci_yesncq }, /* MCP67 */ | 605 | { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci_yesncq }, /* MCP67 */ |
| 606 | { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci_yesncq }, /* MCP67 */ | 606 | { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci_yesncq }, /* MCP67 */ |
| 607 | { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci_yesncq }, /* MCP67 */ | 607 | { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci_yesncq }, /* MCP67 */ |
| 608 | { PCI_VDEVICE(NVIDIA, 0x0580), board_ahci_yesncq }, /* Linux ID */ | ||
| 608 | { PCI_VDEVICE(NVIDIA, 0x07f0), board_ahci_yesncq }, /* MCP73 */ | 609 | { PCI_VDEVICE(NVIDIA, 0x07f0), board_ahci_yesncq }, /* MCP73 */ |
| 609 | { PCI_VDEVICE(NVIDIA, 0x07f1), board_ahci_yesncq }, /* MCP73 */ | 610 | { PCI_VDEVICE(NVIDIA, 0x07f1), board_ahci_yesncq }, /* MCP73 */ |
| 610 | { PCI_VDEVICE(NVIDIA, 0x07f2), board_ahci_yesncq }, /* MCP73 */ | 611 | { PCI_VDEVICE(NVIDIA, 0x07f2), board_ahci_yesncq }, /* MCP73 */ |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index b525a0981348..d7f0f1b1ae3e 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -5028,12 +5028,14 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
| 5028 | qc->flags |= ATA_QCFLAG_FAILED; | 5028 | qc->flags |= ATA_QCFLAG_FAILED; |
| 5029 | 5029 | ||
| 5030 | if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { | 5030 | if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { |
| 5031 | if (!ata_tag_internal(qc->tag)) { | 5031 | /* always fill result TF for failed qc */ |
| 5032 | /* always fill result TF for failed qc */ | 5032 | fill_result_tf(qc); |
| 5033 | fill_result_tf(qc); | 5033 | |
| 5034 | if (!ata_tag_internal(qc->tag)) | ||
| 5034 | ata_qc_schedule_eh(qc); | 5035 | ata_qc_schedule_eh(qc); |
| 5035 | return; | 5036 | else |
| 5036 | } | 5037 | __ata_qc_complete(qc); |
| 5038 | return; | ||
| 5037 | } | 5039 | } |
| 5038 | 5040 | ||
| 5039 | WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN); | 5041 | WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 0a97822da211..bba2ae5df1c2 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -2981,12 +2981,14 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, | |||
| 2981 | * device detection messages backwards. | 2981 | * device detection messages backwards. |
| 2982 | */ | 2982 | */ |
| 2983 | ata_for_each_dev(dev, link, ALL) { | 2983 | ata_for_each_dev(dev, link, ALL) { |
| 2984 | if (!(new_mask & (1 << dev->devno)) || | 2984 | if (!(new_mask & (1 << dev->devno))) |
| 2985 | dev->class == ATA_DEV_PMP) | ||
| 2986 | continue; | 2985 | continue; |
| 2987 | 2986 | ||
| 2988 | dev->class = ehc->classes[dev->devno]; | 2987 | dev->class = ehc->classes[dev->devno]; |
| 2989 | 2988 | ||
| 2989 | if (dev->class == ATA_DEV_PMP) | ||
| 2990 | continue; | ||
| 2991 | |||
| 2990 | ehc->i.flags |= ATA_EHI_PRINTINFO; | 2992 | ehc->i.flags |= ATA_EHI_PRINTINFO; |
| 2991 | rc = ata_dev_configure(dev); | 2993 | rc = ata_dev_configure(dev); |
| 2992 | ehc->i.flags &= ~ATA_EHI_PRINTINFO; | 2994 | ehc->i.flags &= ~ATA_EHI_PRINTINFO; |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index aa4b3f6ae771..ae4454d4e955 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
| @@ -246,7 +246,7 @@ static const struct pci_device_id atiixp[] = { | |||
| 246 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), }, | 246 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), }, |
| 247 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), }, | 247 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), }, |
| 248 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), }, | 248 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), }, |
| 249 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_SB900_IDE), }, | 249 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_HUDSON2_IDE), }, |
| 250 | 250 | ||
| 251 | { }, | 251 | { }, |
| 252 | }; | 252 | }; |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index f49814d6fd2e..3bbed8322ecf 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
| @@ -235,8 +235,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 235 | .udma_mask = ATA_UDMA2, | 235 | .udma_mask = ATA_UDMA2, |
| 236 | .port_ops = &sc1200_port_ops | 236 | .port_ops = &sc1200_port_ops |
| 237 | }; | 237 | }; |
| 238 | /* Can't enable port 2 yet, see top comments */ | 238 | const struct ata_port_info *ppi[] = { &info, NULL }; |
| 239 | const struct ata_port_info *ppi[] = { &info, }; | ||
| 240 | 239 | ||
| 241 | return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); | 240 | return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); |
| 242 | } | 241 | } |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 45657cacec43..88984b803d6d 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
| @@ -111,7 +111,7 @@ static const struct via_isa_bridge { | |||
| 111 | { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 111 | { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
| 112 | { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, | 112 | { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, |
| 113 | { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, | 113 | { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, |
| 114 | { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, | 114 | { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0xff, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, |
| 115 | { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 115 | { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
| 116 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 116 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
| 117 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 117 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 17f9ff9067a2..6f5093b7c8c5 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
| @@ -1382,6 +1382,25 @@ static int mv_qc_defer(struct ata_queued_cmd *qc) | |||
| 1382 | */ | 1382 | */ |
| 1383 | if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH) | 1383 | if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH) |
| 1384 | return ATA_DEFER_PORT; | 1384 | return ATA_DEFER_PORT; |
| 1385 | |||
| 1386 | /* PIO commands need exclusive link: no other commands [DMA or PIO] | ||
| 1387 | * can run concurrently. | ||
| 1388 | * set excl_link when we want to send a PIO command in DMA mode | ||
| 1389 | * or a non-NCQ command in NCQ mode. | ||
| 1390 | * When we receive a command from that link, and there are no | ||
| 1391 | * outstanding commands, mark a flag to clear excl_link and let | ||
| 1392 | * the command go through. | ||
| 1393 | */ | ||
| 1394 | if (unlikely(ap->excl_link)) { | ||
| 1395 | if (link == ap->excl_link) { | ||
| 1396 | if (ap->nr_active_links) | ||
| 1397 | return ATA_DEFER_PORT; | ||
| 1398 | qc->flags |= ATA_QCFLAG_CLEAR_EXCL; | ||
| 1399 | return 0; | ||
| 1400 | } else | ||
| 1401 | return ATA_DEFER_PORT; | ||
| 1402 | } | ||
| 1403 | |||
| 1385 | /* | 1404 | /* |
| 1386 | * If the port is completely idle, then allow the new qc. | 1405 | * If the port is completely idle, then allow the new qc. |
| 1387 | */ | 1406 | */ |
| @@ -1395,8 +1414,14 @@ static int mv_qc_defer(struct ata_queued_cmd *qc) | |||
| 1395 | * doesn't allow it. | 1414 | * doesn't allow it. |
| 1396 | */ | 1415 | */ |
| 1397 | if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) && | 1416 | if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) && |
| 1398 | (pp->pp_flags & MV_PP_FLAG_NCQ_EN) && ata_is_ncq(qc->tf.protocol)) | 1417 | (pp->pp_flags & MV_PP_FLAG_NCQ_EN)) { |
| 1399 | return 0; | 1418 | if (ata_is_ncq(qc->tf.protocol)) |
| 1419 | return 0; | ||
| 1420 | else { | ||
| 1421 | ap->excl_link = link; | ||
| 1422 | return ATA_DEFER_PORT; | ||
| 1423 | } | ||
| 1424 | } | ||
| 1400 | 1425 | ||
| 1401 | return ATA_DEFER_PORT; | 1426 | return ATA_DEFER_PORT; |
| 1402 | } | 1427 | } |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 86a40582999c..1eb4e020eb5c 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
| @@ -1594,9 +1594,21 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class, | |||
| 1594 | !ata_dev_enabled(link->device)) | 1594 | !ata_dev_enabled(link->device)) |
| 1595 | sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, | 1595 | sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, |
| 1596 | NULL, NULL); | 1596 | NULL, NULL); |
| 1597 | else if (!(ehc->i.flags & ATA_EHI_QUIET)) | 1597 | else { |
| 1598 | ata_link_printk(link, KERN_INFO, | 1598 | const unsigned long *timing = sata_ehc_deb_timing(ehc); |
| 1599 | "nv: skipping hardreset on occupied port\n"); | 1599 | int rc; |
| 1600 | |||
| 1601 | if (!(ehc->i.flags & ATA_EHI_QUIET)) | ||
| 1602 | ata_link_printk(link, KERN_INFO, "nv: skipping " | ||
| 1603 | "hardreset on occupied port\n"); | ||
| 1604 | |||
| 1605 | /* make sure the link is online */ | ||
| 1606 | rc = sata_link_resume(link, timing, deadline); | ||
| 1607 | /* whine about phy resume failure but proceed */ | ||
| 1608 | if (rc && rc != -EOPNOTSUPP) | ||
| 1609 | ata_link_printk(link, KERN_WARNING, "failed to resume " | ||
| 1610 | "link (errno=%d)\n", rc); | ||
| 1611 | } | ||
| 1600 | 1612 | ||
| 1601 | /* device signature acquisition is unreliable */ | 1613 | /* device signature acquisition is unreliable */ |
| 1602 | return -EAGAIN; | 1614 | return -EAGAIN; |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index fb5be2d95d52..6399e5090df4 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
| @@ -68,6 +68,12 @@ MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" | |||
| 68 | MODULE_VERSION("3.6.20"); | 68 | MODULE_VERSION("3.6.20"); |
| 69 | MODULE_LICENSE("GPL"); | 69 | MODULE_LICENSE("GPL"); |
| 70 | 70 | ||
| 71 | static int cciss_allow_hpsa; | ||
| 72 | module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR); | ||
| 73 | MODULE_PARM_DESC(cciss_allow_hpsa, | ||
| 74 | "Prevent cciss driver from accessing hardware known to be " | ||
| 75 | " supported by the hpsa driver"); | ||
| 76 | |||
| 71 | #include "cciss_cmd.h" | 77 | #include "cciss_cmd.h" |
| 72 | #include "cciss.h" | 78 | #include "cciss.h" |
| 73 | #include <linux/cciss_ioctl.h> | 79 | #include <linux/cciss_ioctl.h> |
| @@ -101,8 +107,6 @@ static const struct pci_device_id cciss_pci_device_id[] = { | |||
| 101 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249}, | 107 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249}, |
| 102 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A}, | 108 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A}, |
| 103 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B}, | 109 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B}, |
| 104 | {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | ||
| 105 | PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, | ||
| 106 | {0,} | 110 | {0,} |
| 107 | }; | 111 | }; |
| 108 | 112 | ||
| @@ -123,8 +127,6 @@ static struct board_type products[] = { | |||
| 123 | {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, | 127 | {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, |
| 124 | {0x40910E11, "Smart Array 6i", &SA5_access}, | 128 | {0x40910E11, "Smart Array 6i", &SA5_access}, |
| 125 | {0x3225103C, "Smart Array P600", &SA5_access}, | 129 | {0x3225103C, "Smart Array P600", &SA5_access}, |
| 126 | {0x3223103C, "Smart Array P800", &SA5_access}, | ||
| 127 | {0x3234103C, "Smart Array P400", &SA5_access}, | ||
| 128 | {0x3235103C, "Smart Array P400i", &SA5_access}, | 130 | {0x3235103C, "Smart Array P400i", &SA5_access}, |
| 129 | {0x3211103C, "Smart Array E200i", &SA5_access}, | 131 | {0x3211103C, "Smart Array E200i", &SA5_access}, |
| 130 | {0x3212103C, "Smart Array E200", &SA5_access}, | 132 | {0x3212103C, "Smart Array E200", &SA5_access}, |
| @@ -132,6 +134,10 @@ static struct board_type products[] = { | |||
| 132 | {0x3214103C, "Smart Array E200i", &SA5_access}, | 134 | {0x3214103C, "Smart Array E200i", &SA5_access}, |
| 133 | {0x3215103C, "Smart Array E200i", &SA5_access}, | 135 | {0x3215103C, "Smart Array E200i", &SA5_access}, |
| 134 | {0x3237103C, "Smart Array E500", &SA5_access}, | 136 | {0x3237103C, "Smart Array E500", &SA5_access}, |
| 137 | /* controllers below this line are also supported by the hpsa driver. */ | ||
| 138 | #define HPSA_BOUNDARY 0x3223103C | ||
| 139 | {0x3223103C, "Smart Array P800", &SA5_access}, | ||
| 140 | {0x3234103C, "Smart Array P400", &SA5_access}, | ||
| 135 | {0x323D103C, "Smart Array P700m", &SA5_access}, | 141 | {0x323D103C, "Smart Array P700m", &SA5_access}, |
| 136 | {0x3241103C, "Smart Array P212", &SA5_access}, | 142 | {0x3241103C, "Smart Array P212", &SA5_access}, |
| 137 | {0x3243103C, "Smart Array P410", &SA5_access}, | 143 | {0x3243103C, "Smart Array P410", &SA5_access}, |
| @@ -140,7 +146,6 @@ static struct board_type products[] = { | |||
| 140 | {0x3249103C, "Smart Array P812", &SA5_access}, | 146 | {0x3249103C, "Smart Array P812", &SA5_access}, |
| 141 | {0x324A103C, "Smart Array P712m", &SA5_access}, | 147 | {0x324A103C, "Smart Array P712m", &SA5_access}, |
| 142 | {0x324B103C, "Smart Array P711m", &SA5_access}, | 148 | {0x324B103C, "Smart Array P711m", &SA5_access}, |
| 143 | {0xFFFF103C, "Unknown Smart Array", &SA5_access}, | ||
| 144 | }; | 149 | }; |
| 145 | 150 | ||
| 146 | /* How long to wait (in milliseconds) for board to go into simple mode */ | 151 | /* How long to wait (in milliseconds) for board to go into simple mode */ |
| @@ -3754,7 +3759,27 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
| 3754 | __u64 cfg_offset; | 3759 | __u64 cfg_offset; |
| 3755 | __u32 cfg_base_addr; | 3760 | __u32 cfg_base_addr; |
| 3756 | __u64 cfg_base_addr_index; | 3761 | __u64 cfg_base_addr_index; |
| 3757 | int i, err; | 3762 | int i, prod_index, err; |
| 3763 | |||
| 3764 | subsystem_vendor_id = pdev->subsystem_vendor; | ||
| 3765 | subsystem_device_id = pdev->subsystem_device; | ||
| 3766 | board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) | | ||
| 3767 | subsystem_vendor_id); | ||
| 3768 | |||
| 3769 | for (i = 0; i < ARRAY_SIZE(products); i++) { | ||
| 3770 | /* Stand aside for hpsa driver on request */ | ||
| 3771 | if (cciss_allow_hpsa && products[i].board_id == HPSA_BOUNDARY) | ||
| 3772 | return -ENODEV; | ||
| 3773 | if (board_id == products[i].board_id) | ||
| 3774 | break; | ||
| 3775 | } | ||
| 3776 | prod_index = i; | ||
| 3777 | if (prod_index == ARRAY_SIZE(products)) { | ||
| 3778 | dev_warn(&pdev->dev, | ||
| 3779 | "unrecognized board ID: 0x%08lx, ignoring.\n", | ||
| 3780 | (unsigned long) board_id); | ||
| 3781 | return -ENODEV; | ||
| 3782 | } | ||
| 3758 | 3783 | ||
| 3759 | /* check to see if controller has been disabled */ | 3784 | /* check to see if controller has been disabled */ |
| 3760 | /* BEFORE trying to enable it */ | 3785 | /* BEFORE trying to enable it */ |
| @@ -3778,11 +3803,6 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
| 3778 | return err; | 3803 | return err; |
| 3779 | } | 3804 | } |
| 3780 | 3805 | ||
| 3781 | subsystem_vendor_id = pdev->subsystem_vendor; | ||
| 3782 | subsystem_device_id = pdev->subsystem_device; | ||
| 3783 | board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) | | ||
| 3784 | subsystem_vendor_id); | ||
| 3785 | |||
| 3786 | #ifdef CCISS_DEBUG | 3806 | #ifdef CCISS_DEBUG |
| 3787 | printk("command = %x\n", command); | 3807 | printk("command = %x\n", command); |
| 3788 | printk("irq = %x\n", pdev->irq); | 3808 | printk("irq = %x\n", pdev->irq); |
| @@ -3868,14 +3888,9 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
| 3868 | * leave a little room for ioctl calls. | 3888 | * leave a little room for ioctl calls. |
| 3869 | */ | 3889 | */ |
| 3870 | c->max_commands = readl(&(c->cfgtable->CmdsOutMax)); | 3890 | c->max_commands = readl(&(c->cfgtable->CmdsOutMax)); |
| 3871 | for (i = 0; i < ARRAY_SIZE(products); i++) { | 3891 | c->product_name = products[prod_index].product_name; |
| 3872 | if (board_id == products[i].board_id) { | 3892 | c->access = *(products[prod_index].access); |
| 3873 | c->product_name = products[i].product_name; | 3893 | c->nr_cmds = c->max_commands - 4; |
| 3874 | c->access = *(products[i].access); | ||
| 3875 | c->nr_cmds = c->max_commands - 4; | ||
| 3876 | break; | ||
| 3877 | } | ||
| 3878 | } | ||
| 3879 | if ((readb(&c->cfgtable->Signature[0]) != 'C') || | 3894 | if ((readb(&c->cfgtable->Signature[0]) != 'C') || |
| 3880 | (readb(&c->cfgtable->Signature[1]) != 'I') || | 3895 | (readb(&c->cfgtable->Signature[1]) != 'I') || |
| 3881 | (readb(&c->cfgtable->Signature[2]) != 'S') || | 3896 | (readb(&c->cfgtable->Signature[2]) != 'S') || |
| @@ -3884,27 +3899,6 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
| 3884 | err = -ENODEV; | 3899 | err = -ENODEV; |
| 3885 | goto err_out_free_res; | 3900 | goto err_out_free_res; |
| 3886 | } | 3901 | } |
| 3887 | /* We didn't find the controller in our list. We know the | ||
| 3888 | * signature is valid. If it's an HP device let's try to | ||
| 3889 | * bind to the device and fire it up. Otherwise we bail. | ||
| 3890 | */ | ||
| 3891 | if (i == ARRAY_SIZE(products)) { | ||
| 3892 | if (subsystem_vendor_id == PCI_VENDOR_ID_HP) { | ||
| 3893 | c->product_name = products[i-1].product_name; | ||
| 3894 | c->access = *(products[i-1].access); | ||
| 3895 | c->nr_cmds = c->max_commands - 4; | ||
| 3896 | printk(KERN_WARNING "cciss: This is an unknown " | ||
| 3897 | "Smart Array controller.\n" | ||
| 3898 | "cciss: Please update to the latest driver " | ||
| 3899 | "available from www.hp.com.\n"); | ||
| 3900 | } else { | ||
| 3901 | printk(KERN_WARNING "cciss: Sorry, I don't know how" | ||
| 3902 | " to access the Smart Array controller %08lx\n" | ||
| 3903 | , (unsigned long)board_id); | ||
| 3904 | err = -ENODEV; | ||
| 3905 | goto err_out_free_res; | ||
| 3906 | } | ||
| 3907 | } | ||
| 3908 | #ifdef CONFIG_X86 | 3902 | #ifdef CONFIG_X86 |
| 3909 | { | 3903 | { |
| 3910 | /* Need to enable prefetch in the SCSI core for 6400 in x86 */ | 3904 | /* Need to enable prefetch in the SCSI core for 6400 in x86 */ |
| @@ -4254,7 +4248,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
| 4254 | mutex_init(&hba[i]->busy_shutting_down); | 4248 | mutex_init(&hba[i]->busy_shutting_down); |
| 4255 | 4249 | ||
| 4256 | if (cciss_pci_init(hba[i], pdev) != 0) | 4250 | if (cciss_pci_init(hba[i], pdev) != 0) |
| 4257 | goto clean0; | 4251 | goto clean_no_release_regions; |
| 4258 | 4252 | ||
| 4259 | sprintf(hba[i]->devname, "cciss%d", i); | 4253 | sprintf(hba[i]->devname, "cciss%d", i); |
| 4260 | hba[i]->ctlr = i; | 4254 | hba[i]->ctlr = i; |
| @@ -4391,13 +4385,14 @@ clean2: | |||
| 4391 | clean1: | 4385 | clean1: |
| 4392 | cciss_destroy_hba_sysfs_entry(hba[i]); | 4386 | cciss_destroy_hba_sysfs_entry(hba[i]); |
| 4393 | clean0: | 4387 | clean0: |
| 4388 | pci_release_regions(pdev); | ||
| 4389 | clean_no_release_regions: | ||
| 4394 | hba[i]->busy_initializing = 0; | 4390 | hba[i]->busy_initializing = 0; |
| 4395 | 4391 | ||
| 4396 | /* | 4392 | /* |
| 4397 | * Deliberately omit pci_disable_device(): it does something nasty to | 4393 | * Deliberately omit pci_disable_device(): it does something nasty to |
| 4398 | * Smart Array controllers that pci_enable_device does not undo | 4394 | * Smart Array controllers that pci_enable_device does not undo |
| 4399 | */ | 4395 | */ |
| 4400 | pci_release_regions(pdev); | ||
| 4401 | pci_set_drvdata(pdev, NULL); | 4396 | pci_set_drvdata(pdev, NULL); |
| 4402 | free_hba(i); | 4397 | free_hba(i); |
| 4403 | return -1; | 4398 | return -1; |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 43f19389647a..51042f0ba7e1 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | #include <linux/blkdev.h> | 3 | #include <linux/blkdev.h> |
| 4 | #include <linux/hdreg.h> | 4 | #include <linux/hdreg.h> |
| 5 | #include <linux/virtio.h> | 5 | #include <linux/virtio.h> |
| 6 | #include <linux/virtio_ids.h> | ||
| 7 | #include <linux/virtio_blk.h> | 6 | #include <linux/virtio_blk.h> |
| 8 | #include <linux/scatterlist.h> | 7 | #include <linux/scatterlist.h> |
| 9 | 8 | ||
| @@ -183,34 +182,6 @@ static void do_virtblk_request(struct request_queue *q) | |||
| 183 | vblk->vq->vq_ops->kick(vblk->vq); | 182 | vblk->vq->vq_ops->kick(vblk->vq); |
| 184 | } | 183 | } |
| 185 | 184 | ||
| 186 | /* return ATA identify data | ||
| 187 | */ | ||
| 188 | static int virtblk_identify(struct gendisk *disk, void *argp) | ||
| 189 | { | ||
| 190 | struct virtio_blk *vblk = disk->private_data; | ||
| 191 | void *opaque; | ||
| 192 | int err = -ENOMEM; | ||
| 193 | |||
| 194 | opaque = kmalloc(VIRTIO_BLK_ID_BYTES, GFP_KERNEL); | ||
| 195 | if (!opaque) | ||
| 196 | goto out; | ||
| 197 | |||
| 198 | err = virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY, | ||
| 199 | offsetof(struct virtio_blk_config, identify), opaque, | ||
| 200 | VIRTIO_BLK_ID_BYTES); | ||
| 201 | |||
| 202 | if (err) | ||
| 203 | goto out_kfree; | ||
| 204 | |||
| 205 | if (copy_to_user(argp, opaque, VIRTIO_BLK_ID_BYTES)) | ||
| 206 | err = -EFAULT; | ||
| 207 | |||
| 208 | out_kfree: | ||
| 209 | kfree(opaque); | ||
| 210 | out: | ||
| 211 | return err; | ||
| 212 | } | ||
| 213 | |||
| 214 | static void virtblk_prepare_flush(struct request_queue *q, struct request *req) | 185 | static void virtblk_prepare_flush(struct request_queue *q, struct request *req) |
| 215 | { | 186 | { |
| 216 | req->cmd_type = REQ_TYPE_LINUX_BLOCK; | 187 | req->cmd_type = REQ_TYPE_LINUX_BLOCK; |
| @@ -222,10 +193,6 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | |||
| 222 | { | 193 | { |
| 223 | struct gendisk *disk = bdev->bd_disk; | 194 | struct gendisk *disk = bdev->bd_disk; |
| 224 | struct virtio_blk *vblk = disk->private_data; | 195 | struct virtio_blk *vblk = disk->private_data; |
| 225 | void __user *argp = (void __user *)data; | ||
| 226 | |||
| 227 | if (cmd == HDIO_GET_IDENTITY) | ||
| 228 | return virtblk_identify(disk, argp); | ||
| 229 | 196 | ||
| 230 | /* | 197 | /* |
| 231 | * Only allow the generic SCSI ioctls if the host can support it. | 198 | * Only allow the generic SCSI ioctls if the host can support it. |
| @@ -233,7 +200,8 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | |||
| 233 | if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) | 200 | if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) |
| 234 | return -ENOTTY; | 201 | return -ENOTTY; |
| 235 | 202 | ||
| 236 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp); | 203 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, |
| 204 | (void __user *)data); | ||
| 237 | } | 205 | } |
| 238 | 206 | ||
| 239 | /* We provide getgeo only to please some old bootloader/partitioning tools */ | 207 | /* We provide getgeo only to please some old bootloader/partitioning tools */ |
| @@ -332,7 +300,6 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
| 332 | } | 300 | } |
| 333 | 301 | ||
| 334 | vblk->disk->queue->queuedata = vblk; | 302 | vblk->disk->queue->queuedata = vblk; |
| 335 | queue_flag_set_unlocked(QUEUE_FLAG_VIRT, vblk->disk->queue); | ||
| 336 | 303 | ||
| 337 | if (index < 26) { | 304 | if (index < 26) { |
| 338 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); | 305 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); |
| @@ -445,7 +412,7 @@ static struct virtio_device_id id_table[] = { | |||
| 445 | static unsigned int features[] = { | 412 | static unsigned int features[] = { |
| 446 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, | 413 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, |
| 447 | VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, | 414 | VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, |
| 448 | VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_IDENTIFY, VIRTIO_BLK_F_FLUSH | 415 | VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH |
| 449 | }; | 416 | }; |
| 450 | 417 | ||
| 451 | /* | 418 | /* |
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c index aac0985a572b..31e7c91c2d9d 100644 --- a/drivers/char/genrtc.c +++ b/drivers/char/genrtc.c | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #define RTC_VERSION "1.07" | 43 | #define RTC_VERSION "1.07" |
| 44 | 44 | ||
| 45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
| 46 | #include <linux/sched.h> | ||
| 46 | #include <linux/errno.h> | 47 | #include <linux/errno.h> |
| 47 | #include <linux/miscdevice.h> | 48 | #include <linux/miscdevice.h> |
| 48 | #include <linux/fcntl.h> | 49 | #include <linux/fcntl.h> |
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 962968f05b94..915157fcff98 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c | |||
| @@ -21,7 +21,6 @@ | |||
| 21 | #include <linux/scatterlist.h> | 21 | #include <linux/scatterlist.h> |
| 22 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
| 23 | #include <linux/virtio.h> | 23 | #include <linux/virtio.h> |
| 24 | #include <linux/virtio_ids.h> | ||
| 25 | #include <linux/virtio_rng.h> | 24 | #include <linux/virtio_rng.h> |
| 26 | 25 | ||
| 27 | /* The host will fill any buffer we give it with sweet, sweet randomness. We | 26 | /* The host will fill any buffer we give it with sweet, sweet randomness. We |
| @@ -117,7 +116,7 @@ static int virtrng_probe(struct virtio_device *vdev) | |||
| 117 | return 0; | 116 | return 0; |
| 118 | } | 117 | } |
| 119 | 118 | ||
| 120 | static void virtrng_remove(struct virtio_device *vdev) | 119 | static void __devexit virtrng_remove(struct virtio_device *vdev) |
| 121 | { | 120 | { |
| 122 | vdev->config->reset(vdev); | 121 | vdev->config->reset(vdev); |
| 123 | hwrng_unregister(&virtio_hwrng); | 122 | hwrng_unregister(&virtio_hwrng); |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index e0d0f8b2696b..bc4ab3e54550 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
| @@ -74,6 +74,7 @@ | |||
| 74 | #include <linux/proc_fs.h> | 74 | #include <linux/proc_fs.h> |
| 75 | #include <linux/seq_file.h> | 75 | #include <linux/seq_file.h> |
| 76 | #include <linux/spinlock.h> | 76 | #include <linux/spinlock.h> |
| 77 | #include <linux/sched.h> | ||
| 77 | #include <linux/sysctl.h> | 78 | #include <linux/sysctl.h> |
| 78 | #include <linux/wait.h> | 79 | #include <linux/wait.h> |
| 79 | #include <linux/bcd.h> | 80 | #include <linux/bcd.h> |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index fd3dced97776..8c262aaf7c26 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | #include <linux/module.h> | 38 | #include <linux/module.h> |
| 39 | #include <linux/sched.h> | ||
| 39 | #include <linux/input.h> | 40 | #include <linux/input.h> |
| 40 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
| 41 | #include <linux/init.h> | 42 | #include <linux/init.h> |
diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c index 3108991c5c8b..66fa4e10d76b 100644 --- a/drivers/char/tty_buffer.c +++ b/drivers/char/tty_buffer.c | |||
| @@ -402,28 +402,26 @@ static void flush_to_ldisc(struct work_struct *work) | |||
| 402 | container_of(work, struct tty_struct, buf.work.work); | 402 | container_of(work, struct tty_struct, buf.work.work); |
| 403 | unsigned long flags; | 403 | unsigned long flags; |
| 404 | struct tty_ldisc *disc; | 404 | struct tty_ldisc *disc; |
| 405 | struct tty_buffer *tbuf, *head; | ||
| 406 | char *char_buf; | ||
| 407 | unsigned char *flag_buf; | ||
| 408 | 405 | ||
| 409 | disc = tty_ldisc_ref(tty); | 406 | disc = tty_ldisc_ref(tty); |
| 410 | if (disc == NULL) /* !TTY_LDISC */ | 407 | if (disc == NULL) /* !TTY_LDISC */ |
| 411 | return; | 408 | return; |
| 412 | 409 | ||
| 413 | spin_lock_irqsave(&tty->buf.lock, flags); | 410 | spin_lock_irqsave(&tty->buf.lock, flags); |
| 414 | /* So we know a flush is running */ | 411 | |
| 415 | set_bit(TTY_FLUSHING, &tty->flags); | 412 | if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) { |
| 416 | head = tty->buf.head; | 413 | struct tty_buffer *head; |
| 417 | if (head != NULL) { | 414 | while ((head = tty->buf.head) != NULL) { |
| 418 | tty->buf.head = NULL; | 415 | int count; |
| 419 | for (;;) { | 416 | char *char_buf; |
| 420 | int count = head->commit - head->read; | 417 | unsigned char *flag_buf; |
| 418 | |||
| 419 | count = head->commit - head->read; | ||
| 421 | if (!count) { | 420 | if (!count) { |
| 422 | if (head->next == NULL) | 421 | if (head->next == NULL) |
| 423 | break; | 422 | break; |
| 424 | tbuf = head; | 423 | tty->buf.head = head->next; |
| 425 | head = head->next; | 424 | tty_buffer_free(tty, head); |
| 426 | tty_buffer_free(tty, tbuf); | ||
| 427 | continue; | 425 | continue; |
| 428 | } | 426 | } |
| 429 | /* Ldisc or user is trying to flush the buffers | 427 | /* Ldisc or user is trying to flush the buffers |
| @@ -445,9 +443,9 @@ static void flush_to_ldisc(struct work_struct *work) | |||
| 445 | flag_buf, count); | 443 | flag_buf, count); |
| 446 | spin_lock_irqsave(&tty->buf.lock, flags); | 444 | spin_lock_irqsave(&tty->buf.lock, flags); |
| 447 | } | 445 | } |
| 448 | /* Restore the queue head */ | 446 | clear_bit(TTY_FLUSHING, &tty->flags); |
| 449 | tty->buf.head = head; | ||
| 450 | } | 447 | } |
| 448 | |||
| 451 | /* We may have a deferred request to flush the input buffer, | 449 | /* We may have a deferred request to flush the input buffer, |
| 452 | if so pull the chain under the lock and empty the queue */ | 450 | if so pull the chain under the lock and empty the queue */ |
| 453 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) { | 451 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) { |
| @@ -455,7 +453,6 @@ static void flush_to_ldisc(struct work_struct *work) | |||
| 455 | clear_bit(TTY_FLUSHPENDING, &tty->flags); | 453 | clear_bit(TTY_FLUSHPENDING, &tty->flags); |
| 456 | wake_up(&tty->read_wait); | 454 | wake_up(&tty->read_wait); |
| 457 | } | 455 | } |
| 458 | clear_bit(TTY_FLUSHING, &tty->flags); | ||
| 459 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 456 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
| 460 | 457 | ||
| 461 | tty_ldisc_deref(disc); | 458 | tty_ldisc_deref(disc); |
| @@ -471,7 +468,7 @@ static void flush_to_ldisc(struct work_struct *work) | |||
| 471 | */ | 468 | */ |
| 472 | void tty_flush_to_ldisc(struct tty_struct *tty) | 469 | void tty_flush_to_ldisc(struct tty_struct *tty) |
| 473 | { | 470 | { |
| 474 | flush_to_ldisc(&tty->buf.work.work); | 471 | flush_delayed_work(&tty->buf.work); |
| 475 | } | 472 | } |
| 476 | 473 | ||
| 477 | /** | 474 | /** |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 0d328b59568d..a035ae39a359 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <linux/err.h> | 31 | #include <linux/err.h> |
| 32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
| 33 | #include <linux/virtio.h> | 33 | #include <linux/virtio.h> |
| 34 | #include <linux/virtio_ids.h> | ||
| 35 | #include <linux/virtio_console.h> | 34 | #include <linux/virtio_console.h> |
| 36 | #include "hvc_console.h" | 35 | #include "hvc_console.h" |
| 37 | 36 | ||
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 6b36ee56e6fe..ed86d3bf249a 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
| @@ -1532,7 +1532,7 @@ long vt_compat_ioctl(struct tty_struct *tty, struct file * file, | |||
| 1532 | 1532 | ||
| 1533 | case PIO_UNIMAP: | 1533 | case PIO_UNIMAP: |
| 1534 | case GIO_UNIMAP: | 1534 | case GIO_UNIMAP: |
| 1535 | ret = do_unimap_ioctl(cmd, up, perm, vc); | 1535 | ret = compat_unimap_ioctl(cmd, up, perm, vc); |
| 1536 | break; | 1536 | break; |
| 1537 | 1537 | ||
| 1538 | /* | 1538 | /* |
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c index 76cb6b345e7b..0af80577dc7b 100644 --- a/drivers/crypto/padlock-sha.c +++ b/drivers/crypto/padlock-sha.c | |||
| @@ -24,6 +24,12 @@ | |||
| 24 | #include <asm/i387.h> | 24 | #include <asm/i387.h> |
| 25 | #include "padlock.h" | 25 | #include "padlock.h" |
| 26 | 26 | ||
| 27 | #ifdef CONFIG_64BIT | ||
| 28 | #define STACK_ALIGN 16 | ||
| 29 | #else | ||
| 30 | #define STACK_ALIGN 4 | ||
| 31 | #endif | ||
| 32 | |||
| 27 | struct padlock_sha_desc { | 33 | struct padlock_sha_desc { |
| 28 | struct shash_desc fallback; | 34 | struct shash_desc fallback; |
| 29 | }; | 35 | }; |
| @@ -64,7 +70,9 @@ static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in, | |||
| 64 | /* We can't store directly to *out as it may be unaligned. */ | 70 | /* We can't store directly to *out as it may be unaligned. */ |
| 65 | /* BTW Don't reduce the buffer size below 128 Bytes! | 71 | /* BTW Don't reduce the buffer size below 128 Bytes! |
| 66 | * PadLock microcode needs it that big. */ | 72 | * PadLock microcode needs it that big. */ |
| 67 | char result[128] __attribute__ ((aligned(PADLOCK_ALIGNMENT))); | 73 | char buf[128 + PADLOCK_ALIGNMENT - STACK_ALIGN] __attribute__ |
| 74 | ((aligned(STACK_ALIGN))); | ||
| 75 | char *result = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT); | ||
| 68 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); | 76 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); |
| 69 | struct sha1_state state; | 77 | struct sha1_state state; |
| 70 | unsigned int space; | 78 | unsigned int space; |
| @@ -128,7 +136,9 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in, | |||
| 128 | /* We can't store directly to *out as it may be unaligned. */ | 136 | /* We can't store directly to *out as it may be unaligned. */ |
| 129 | /* BTW Don't reduce the buffer size below 128 Bytes! | 137 | /* BTW Don't reduce the buffer size below 128 Bytes! |
| 130 | * PadLock microcode needs it that big. */ | 138 | * PadLock microcode needs it that big. */ |
| 131 | char result[128] __attribute__ ((aligned(PADLOCK_ALIGNMENT))); | 139 | char buf[128 + PADLOCK_ALIGNMENT - STACK_ALIGN] __attribute__ |
| 140 | ((aligned(STACK_ALIGN))); | ||
| 141 | char *result = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT); | ||
| 132 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); | 142 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); |
| 133 | struct sha256_state state; | 143 | struct sha256_state state; |
| 134 | unsigned int space; | 144 | unsigned int space; |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 4f4ac82382f7..d4560d9d5a83 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
| @@ -1122,7 +1122,7 @@ static void k8_read_dram_base_limit(struct amd64_pvt *pvt, int dram) | |||
| 1122 | debugf0("Reading K8_DRAM_BASE_LOW failed\n"); | 1122 | debugf0("Reading K8_DRAM_BASE_LOW failed\n"); |
| 1123 | 1123 | ||
| 1124 | /* Extract parts into separate data entries */ | 1124 | /* Extract parts into separate data entries */ |
| 1125 | pvt->dram_base[dram] = ((u64) low & 0xFFFF0000) << 24; | 1125 | pvt->dram_base[dram] = ((u64) low & 0xFFFF0000) << 8; |
| 1126 | pvt->dram_IntlvEn[dram] = (low >> 8) & 0x7; | 1126 | pvt->dram_IntlvEn[dram] = (low >> 8) & 0x7; |
| 1127 | pvt->dram_rw_en[dram] = (low & 0x3); | 1127 | pvt->dram_rw_en[dram] = (low & 0x3); |
| 1128 | 1128 | ||
| @@ -1135,7 +1135,7 @@ static void k8_read_dram_base_limit(struct amd64_pvt *pvt, int dram) | |||
| 1135 | * Extract parts into separate data entries. Limit is the HIGHEST memory | 1135 | * Extract parts into separate data entries. Limit is the HIGHEST memory |
| 1136 | * location of the region, so lower 24 bits need to be all ones | 1136 | * location of the region, so lower 24 bits need to be all ones |
| 1137 | */ | 1137 | */ |
| 1138 | pvt->dram_limit[dram] = (((u64) low & 0xFFFF0000) << 24) | 0x00FFFFFF; | 1138 | pvt->dram_limit[dram] = (((u64) low & 0xFFFF0000) << 8) | 0x00FFFFFF; |
| 1139 | pvt->dram_IntlvSel[dram] = (low >> 8) & 0x7; | 1139 | pvt->dram_IntlvSel[dram] = (low >> 8) & 0x7; |
| 1140 | pvt->dram_DstNode[dram] = (low & 0x7); | 1140 | pvt->dram_DstNode[dram] = (low & 0x7); |
| 1141 | } | 1141 | } |
| @@ -1369,7 +1369,7 @@ static void f10_read_dram_base_limit(struct amd64_pvt *pvt, int dram) | |||
| 1369 | pvt->dram_IntlvEn[dram] = (low_base >> 8) & 0x7; | 1369 | pvt->dram_IntlvEn[dram] = (low_base >> 8) & 0x7; |
| 1370 | 1370 | ||
| 1371 | pvt->dram_base[dram] = (((u64)high_base & 0x000000FF) << 40) | | 1371 | pvt->dram_base[dram] = (((u64)high_base & 0x000000FF) << 40) | |
| 1372 | (((u64)low_base & 0xFFFF0000) << 24); | 1372 | (((u64)low_base & 0xFFFF0000) << 8); |
| 1373 | 1373 | ||
| 1374 | low_offset = K8_DRAM_LIMIT_LOW + (dram << 3); | 1374 | low_offset = K8_DRAM_LIMIT_LOW + (dram << 3); |
| 1375 | high_offset = F10_DRAM_LIMIT_HIGH + (dram << 3); | 1375 | high_offset = F10_DRAM_LIMIT_HIGH + (dram << 3); |
| @@ -1391,7 +1391,7 @@ static void f10_read_dram_base_limit(struct amd64_pvt *pvt, int dram) | |||
| 1391 | * memory location of the region, so low 24 bits need to be all ones. | 1391 | * memory location of the region, so low 24 bits need to be all ones. |
| 1392 | */ | 1392 | */ |
| 1393 | pvt->dram_limit[dram] = (((u64)high_limit & 0x000000FF) << 40) | | 1393 | pvt->dram_limit[dram] = (((u64)high_limit & 0x000000FF) << 40) | |
| 1394 | (((u64) low_limit & 0xFFFF0000) << 24) | | 1394 | (((u64) low_limit & 0xFFFF0000) << 8) | |
| 1395 | 0x00FFFFFF; | 1395 | 0x00FFFFFF; |
| 1396 | } | 1396 | } |
| 1397 | 1397 | ||
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 50f0176de615..98dbbda3ad41 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
| @@ -188,14 +188,7 @@ static struct fw_device *target_device(struct sbp2_target *tgt) | |||
| 188 | /* Impossible login_id, to detect logout attempt before successful login */ | 188 | /* Impossible login_id, to detect logout attempt before successful login */ |
| 189 | #define INVALID_LOGIN_ID 0x10000 | 189 | #define INVALID_LOGIN_ID 0x10000 |
| 190 | 190 | ||
| 191 | /* | 191 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ |
| 192 | * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be | ||
| 193 | * provided in the config rom. Most devices do provide a value, which | ||
| 194 | * we'll use for login management orbs, but with some sane limits. | ||
| 195 | */ | ||
| 196 | #define SBP2_MIN_LOGIN_ORB_TIMEOUT 5000U /* Timeout in ms */ | ||
| 197 | #define SBP2_MAX_LOGIN_ORB_TIMEOUT 40000U /* Timeout in ms */ | ||
| 198 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ | ||
| 199 | #define SBP2_ORB_NULL 0x80000000 | 192 | #define SBP2_ORB_NULL 0x80000000 |
| 200 | #define SBP2_RETRY_LIMIT 0xf /* 15 retries */ | 193 | #define SBP2_RETRY_LIMIT 0xf /* 15 retries */ |
| 201 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ | 194 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ |
| @@ -1034,7 +1027,6 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory, | |||
| 1034 | { | 1027 | { |
| 1035 | struct fw_csr_iterator ci; | 1028 | struct fw_csr_iterator ci; |
| 1036 | int key, value; | 1029 | int key, value; |
| 1037 | unsigned int timeout; | ||
| 1038 | 1030 | ||
| 1039 | fw_csr_iterator_init(&ci, directory); | 1031 | fw_csr_iterator_init(&ci, directory); |
| 1040 | while (fw_csr_iterator_next(&ci, &key, &value)) { | 1032 | while (fw_csr_iterator_next(&ci, &key, &value)) { |
| @@ -1059,17 +1051,7 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory, | |||
| 1059 | 1051 | ||
| 1060 | case SBP2_CSR_UNIT_CHARACTERISTICS: | 1052 | case SBP2_CSR_UNIT_CHARACTERISTICS: |
| 1061 | /* the timeout value is stored in 500ms units */ | 1053 | /* the timeout value is stored in 500ms units */ |
| 1062 | timeout = ((unsigned int) value >> 8 & 0xff) * 500; | 1054 | tgt->mgt_orb_timeout = (value >> 8 & 0xff) * 500; |
| 1063 | timeout = max(timeout, SBP2_MIN_LOGIN_ORB_TIMEOUT); | ||
| 1064 | tgt->mgt_orb_timeout = | ||
| 1065 | min(timeout, SBP2_MAX_LOGIN_ORB_TIMEOUT); | ||
| 1066 | |||
| 1067 | if (timeout > tgt->mgt_orb_timeout) | ||
| 1068 | fw_notify("%s: config rom contains %ds " | ||
| 1069 | "management ORB timeout, limiting " | ||
| 1070 | "to %ds\n", tgt->bus_id, | ||
| 1071 | timeout / 1000, | ||
| 1072 | tgt->mgt_orb_timeout / 1000); | ||
| 1073 | break; | 1055 | break; |
| 1074 | 1056 | ||
| 1075 | case SBP2_CSR_LOGICAL_UNIT_NUMBER: | 1057 | case SBP2_CSR_LOGICAL_UNIT_NUMBER: |
| @@ -1087,6 +1069,22 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory, | |||
| 1087 | return 0; | 1069 | return 0; |
| 1088 | } | 1070 | } |
| 1089 | 1071 | ||
| 1072 | /* | ||
| 1073 | * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be | ||
| 1074 | * provided in the config rom. Most devices do provide a value, which | ||
| 1075 | * we'll use for login management orbs, but with some sane limits. | ||
| 1076 | */ | ||
| 1077 | static void sbp2_clamp_management_orb_timeout(struct sbp2_target *tgt) | ||
| 1078 | { | ||
| 1079 | unsigned int timeout = tgt->mgt_orb_timeout; | ||
| 1080 | |||
| 1081 | if (timeout > 40000) | ||
| 1082 | fw_notify("%s: %ds mgt_ORB_timeout limited to 40s\n", | ||
| 1083 | tgt->bus_id, timeout / 1000); | ||
| 1084 | |||
| 1085 | tgt->mgt_orb_timeout = clamp_val(timeout, 5000, 40000); | ||
| 1086 | } | ||
| 1087 | |||
| 1090 | static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, | 1088 | static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, |
| 1091 | u32 firmware_revision) | 1089 | u32 firmware_revision) |
| 1092 | { | 1090 | { |
| @@ -1171,6 +1169,7 @@ static int sbp2_probe(struct device *dev) | |||
| 1171 | &firmware_revision) < 0) | 1169 | &firmware_revision) < 0) |
| 1172 | goto fail_tgt_put; | 1170 | goto fail_tgt_put; |
| 1173 | 1171 | ||
| 1172 | sbp2_clamp_management_orb_timeout(tgt); | ||
| 1174 | sbp2_init_workarounds(tgt, model, firmware_revision); | 1173 | sbp2_init_workarounds(tgt, model, firmware_revision); |
| 1175 | 1174 | ||
| 1176 | /* | 1175 | /* |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index be34d32906bd..7d05c4bb201e 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -1066,7 +1066,7 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event); | |||
| 1066 | * @type: HID report type (HID_*_REPORT) | 1066 | * @type: HID report type (HID_*_REPORT) |
| 1067 | * @data: report contents | 1067 | * @data: report contents |
| 1068 | * @size: size of data parameter | 1068 | * @size: size of data parameter |
| 1069 | * @interrupt: called from atomic? | 1069 | * @interrupt: distinguish between interrupt and control transfers |
| 1070 | * | 1070 | * |
| 1071 | * This is data entry for lower layers. | 1071 | * This is data entry for lower layers. |
| 1072 | */ | 1072 | */ |
diff --git a/drivers/hid/hid-twinhan.c b/drivers/hid/hid-twinhan.c index b05f602c051e..c40afc57fc8f 100644 --- a/drivers/hid/hid-twinhan.c +++ b/drivers/hid/hid-twinhan.c | |||
| @@ -132,12 +132,12 @@ static struct hid_driver twinhan_driver = { | |||
| 132 | .input_mapping = twinhan_input_mapping, | 132 | .input_mapping = twinhan_input_mapping, |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | static int twinhan_init(void) | 135 | static int __init twinhan_init(void) |
| 136 | { | 136 | { |
| 137 | return hid_register_driver(&twinhan_driver); | 137 | return hid_register_driver(&twinhan_driver); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | static void twinhan_exit(void) | 140 | static void __exit twinhan_exit(void) |
| 141 | { | 141 | { |
| 142 | hid_unregister_driver(&twinhan_driver); | 142 | hid_unregister_driver(&twinhan_driver); |
| 143 | } | 143 | } |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index ba05275e5104..cdd136942bca 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
| @@ -48,10 +48,9 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, | |||
| 48 | char *report; | 48 | char *report; |
| 49 | DECLARE_WAITQUEUE(wait, current); | 49 | DECLARE_WAITQUEUE(wait, current); |
| 50 | 50 | ||
| 51 | while (ret == 0) { | 51 | mutex_lock(&list->read_mutex); |
| 52 | |||
| 53 | mutex_lock(&list->read_mutex); | ||
| 54 | 52 | ||
| 53 | while (ret == 0) { | ||
| 55 | if (list->head == list->tail) { | 54 | if (list->head == list->tail) { |
| 56 | add_wait_queue(&list->hidraw->wait, &wait); | 55 | add_wait_queue(&list->hidraw->wait, &wait); |
| 57 | set_current_state(TASK_INTERRUPTIBLE); | 56 | set_current_state(TASK_INTERRUPTIBLE); |
diff --git a/drivers/ide/atiixp.c b/drivers/ide/atiixp.c index 6396c3ad3252..837322b10a4c 100644 --- a/drivers/ide/atiixp.c +++ b/drivers/ide/atiixp.c | |||
| @@ -177,7 +177,7 @@ static const struct pci_device_id atiixp_pci_tbl[] = { | |||
| 177 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), 0 }, | 177 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), 0 }, |
| 178 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), 1 }, | 178 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), 1 }, |
| 179 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), 0 }, | 179 | { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), 0 }, |
| 180 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_SB900_IDE), 0 }, | 180 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_HUDSON2_IDE), 0 }, |
| 181 | { 0, }, | 181 | { 0, }, |
| 182 | }; | 182 | }; |
| 183 | MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); | 183 | MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); |
diff --git a/drivers/input/input.c b/drivers/input/input.c index c6f88ebb40c7..cc763c96fada 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -782,10 +782,29 @@ static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait) | |||
| 782 | return 0; | 782 | return 0; |
| 783 | } | 783 | } |
| 784 | 784 | ||
| 785 | union input_seq_state { | ||
| 786 | struct { | ||
| 787 | unsigned short pos; | ||
| 788 | bool mutex_acquired; | ||
| 789 | }; | ||
| 790 | void *p; | ||
| 791 | }; | ||
| 792 | |||
| 785 | static void *input_devices_seq_start(struct seq_file *seq, loff_t *pos) | 793 | static void *input_devices_seq_start(struct seq_file *seq, loff_t *pos) |
| 786 | { | 794 | { |
| 787 | if (mutex_lock_interruptible(&input_mutex)) | 795 | union input_seq_state *state = (union input_seq_state *)&seq->private; |
| 788 | return NULL; | 796 | int error; |
| 797 | |||
| 798 | /* We need to fit into seq->private pointer */ | ||
| 799 | BUILD_BUG_ON(sizeof(union input_seq_state) != sizeof(seq->private)); | ||
| 800 | |||
| 801 | error = mutex_lock_interruptible(&input_mutex); | ||
| 802 | if (error) { | ||
| 803 | state->mutex_acquired = false; | ||
| 804 | return ERR_PTR(error); | ||
| 805 | } | ||
| 806 | |||
| 807 | state->mutex_acquired = true; | ||
| 789 | 808 | ||
| 790 | return seq_list_start(&input_dev_list, *pos); | 809 | return seq_list_start(&input_dev_list, *pos); |
| 791 | } | 810 | } |
| @@ -795,9 +814,12 @@ static void *input_devices_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
| 795 | return seq_list_next(v, &input_dev_list, pos); | 814 | return seq_list_next(v, &input_dev_list, pos); |
| 796 | } | 815 | } |
| 797 | 816 | ||
| 798 | static void input_devices_seq_stop(struct seq_file *seq, void *v) | 817 | static void input_seq_stop(struct seq_file *seq, void *v) |
| 799 | { | 818 | { |
| 800 | mutex_unlock(&input_mutex); | 819 | union input_seq_state *state = (union input_seq_state *)&seq->private; |
| 820 | |||
| 821 | if (state->mutex_acquired) | ||
| 822 | mutex_unlock(&input_mutex); | ||
| 801 | } | 823 | } |
| 802 | 824 | ||
| 803 | static void input_seq_print_bitmap(struct seq_file *seq, const char *name, | 825 | static void input_seq_print_bitmap(struct seq_file *seq, const char *name, |
| @@ -861,7 +883,7 @@ static int input_devices_seq_show(struct seq_file *seq, void *v) | |||
| 861 | static const struct seq_operations input_devices_seq_ops = { | 883 | static const struct seq_operations input_devices_seq_ops = { |
| 862 | .start = input_devices_seq_start, | 884 | .start = input_devices_seq_start, |
| 863 | .next = input_devices_seq_next, | 885 | .next = input_devices_seq_next, |
| 864 | .stop = input_devices_seq_stop, | 886 | .stop = input_seq_stop, |
| 865 | .show = input_devices_seq_show, | 887 | .show = input_devices_seq_show, |
| 866 | }; | 888 | }; |
| 867 | 889 | ||
| @@ -881,40 +903,49 @@ static const struct file_operations input_devices_fileops = { | |||
| 881 | 903 | ||
| 882 | static void *input_handlers_seq_start(struct seq_file *seq, loff_t *pos) | 904 | static void *input_handlers_seq_start(struct seq_file *seq, loff_t *pos) |
| 883 | { | 905 | { |
| 884 | if (mutex_lock_interruptible(&input_mutex)) | 906 | union input_seq_state *state = (union input_seq_state *)&seq->private; |
| 885 | return NULL; | 907 | int error; |
| 908 | |||
| 909 | /* We need to fit into seq->private pointer */ | ||
| 910 | BUILD_BUG_ON(sizeof(union input_seq_state) != sizeof(seq->private)); | ||
| 911 | |||
| 912 | error = mutex_lock_interruptible(&input_mutex); | ||
| 913 | if (error) { | ||
| 914 | state->mutex_acquired = false; | ||
| 915 | return ERR_PTR(error); | ||
| 916 | } | ||
| 917 | |||
| 918 | state->mutex_acquired = true; | ||
| 919 | state->pos = *pos; | ||
| 886 | 920 | ||
| 887 | seq->private = (void *)(unsigned long)*pos; | ||
| 888 | return seq_list_start(&input_handler_list, *pos); | 921 | return seq_list_start(&input_handler_list, *pos); |
| 889 | } | 922 | } |
| 890 | 923 | ||
| 891 | static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 924 | static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
| 892 | { | 925 | { |
| 893 | seq->private = (void *)(unsigned long)(*pos + 1); | 926 | union input_seq_state *state = (union input_seq_state *)&seq->private; |
| 894 | return seq_list_next(v, &input_handler_list, pos); | ||
| 895 | } | ||
| 896 | 927 | ||
| 897 | static void input_handlers_seq_stop(struct seq_file *seq, void *v) | 928 | state->pos = *pos + 1; |
| 898 | { | 929 | return seq_list_next(v, &input_handler_list, pos); |
| 899 | mutex_unlock(&input_mutex); | ||
| 900 | } | 930 | } |
| 901 | 931 | ||
| 902 | static int input_handlers_seq_show(struct seq_file *seq, void *v) | 932 | static int input_handlers_seq_show(struct seq_file *seq, void *v) |
| 903 | { | 933 | { |
| 904 | struct input_handler *handler = container_of(v, struct input_handler, node); | 934 | struct input_handler *handler = container_of(v, struct input_handler, node); |
| 935 | union input_seq_state *state = (union input_seq_state *)&seq->private; | ||
| 905 | 936 | ||
| 906 | seq_printf(seq, "N: Number=%ld Name=%s", | 937 | seq_printf(seq, "N: Number=%u Name=%s", state->pos, handler->name); |
| 907 | (unsigned long)seq->private, handler->name); | ||
| 908 | if (handler->fops) | 938 | if (handler->fops) |
| 909 | seq_printf(seq, " Minor=%d", handler->minor); | 939 | seq_printf(seq, " Minor=%d", handler->minor); |
| 910 | seq_putc(seq, '\n'); | 940 | seq_putc(seq, '\n'); |
| 911 | 941 | ||
| 912 | return 0; | 942 | return 0; |
| 913 | } | 943 | } |
| 944 | |||
| 914 | static const struct seq_operations input_handlers_seq_ops = { | 945 | static const struct seq_operations input_handlers_seq_ops = { |
| 915 | .start = input_handlers_seq_start, | 946 | .start = input_handlers_seq_start, |
| 916 | .next = input_handlers_seq_next, | 947 | .next = input_handlers_seq_next, |
| 917 | .stop = input_handlers_seq_stop, | 948 | .stop = input_seq_stop, |
| 918 | .show = input_handlers_seq_show, | 949 | .show = input_handlers_seq_show, |
| 919 | }; | 950 | }; |
| 920 | 951 | ||
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 4709e15af607..a6512372c7a3 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
| @@ -574,11 +574,22 @@ static void atkbd_event_work(struct work_struct *work) | |||
| 574 | 574 | ||
| 575 | mutex_lock(&atkbd->event_mutex); | 575 | mutex_lock(&atkbd->event_mutex); |
| 576 | 576 | ||
| 577 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) | 577 | if (!atkbd->enabled) { |
| 578 | atkbd_set_leds(atkbd); | 578 | /* |
| 579 | * Serio ports are resumed asynchronously so while driver core | ||
| 580 | * thinks that device is already fully operational in reality | ||
| 581 | * it may not be ready yet. In this case we need to keep | ||
| 582 | * rescheduling till reconnect completes. | ||
| 583 | */ | ||
| 584 | schedule_delayed_work(&atkbd->event_work, | ||
| 585 | msecs_to_jiffies(100)); | ||
| 586 | } else { | ||
| 587 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) | ||
| 588 | atkbd_set_leds(atkbd); | ||
| 579 | 589 | ||
| 580 | if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) | 590 | if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) |
| 581 | atkbd_set_repeat_rate(atkbd); | 591 | atkbd_set_repeat_rate(atkbd); |
| 592 | } | ||
| 582 | 593 | ||
| 583 | mutex_unlock(&atkbd->event_mutex); | 594 | mutex_unlock(&atkbd->event_mutex); |
| 584 | } | 595 | } |
| @@ -770,6 +781,30 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra | |||
| 770 | return 3; | 781 | return 3; |
| 771 | } | 782 | } |
| 772 | 783 | ||
| 784 | static int atkbd_reset_state(struct atkbd *atkbd) | ||
| 785 | { | ||
| 786 | struct ps2dev *ps2dev = &atkbd->ps2dev; | ||
| 787 | unsigned char param[1]; | ||
| 788 | |||
| 789 | /* | ||
| 790 | * Set the LEDs to a predefined state (all off). | ||
| 791 | */ | ||
| 792 | |||
| 793 | param[0] = 0; | ||
| 794 | if (ps2_command(ps2dev, param, ATKBD_CMD_SETLEDS)) | ||
| 795 | return -1; | ||
| 796 | |||
| 797 | /* | ||
| 798 | * Set autorepeat to fastest possible. | ||
| 799 | */ | ||
| 800 | |||
| 801 | param[0] = 0; | ||
| 802 | if (ps2_command(ps2dev, param, ATKBD_CMD_SETREP)) | ||
| 803 | return -1; | ||
| 804 | |||
| 805 | return 0; | ||
| 806 | } | ||
| 807 | |||
| 773 | static int atkbd_activate(struct atkbd *atkbd) | 808 | static int atkbd_activate(struct atkbd *atkbd) |
| 774 | { | 809 | { |
| 775 | struct ps2dev *ps2dev = &atkbd->ps2dev; | 810 | struct ps2dev *ps2dev = &atkbd->ps2dev; |
| @@ -852,29 +887,6 @@ static unsigned int atkbd_hp_forced_release_keys[] = { | |||
| 852 | }; | 887 | }; |
| 853 | 888 | ||
| 854 | /* | 889 | /* |
| 855 | * Inventec system with broken key release on volume keys | ||
| 856 | */ | ||
| 857 | static unsigned int atkbd_inventec_forced_release_keys[] = { | ||
| 858 | 0xae, 0xb0, -1U | ||
| 859 | }; | ||
| 860 | |||
| 861 | /* | ||
| 862 | * Perform fixup for HP Pavilion ZV6100 laptop that doesn't generate release | ||
| 863 | * for its volume buttons | ||
| 864 | */ | ||
| 865 | static unsigned int atkbd_hp_zv6100_forced_release_keys[] = { | ||
| 866 | 0xae, 0xb0, -1U | ||
| 867 | }; | ||
| 868 | |||
| 869 | /* | ||
| 870 | * Perform fixup for HP (Compaq) Presario R4000 R4100 R4200 that don't generate | ||
| 871 | * release for their volume buttons | ||
| 872 | */ | ||
| 873 | static unsigned int atkbd_hp_r4000_forced_release_keys[] = { | ||
| 874 | 0xae, 0xb0, -1U | ||
| 875 | }; | ||
| 876 | |||
| 877 | /* | ||
| 878 | * Samsung NC10,NC20 with Fn+F? key release not working | 890 | * Samsung NC10,NC20 with Fn+F? key release not working |
| 879 | */ | 891 | */ |
| 880 | static unsigned int atkbd_samsung_forced_release_keys[] = { | 892 | static unsigned int atkbd_samsung_forced_release_keys[] = { |
| @@ -882,14 +894,6 @@ static unsigned int atkbd_samsung_forced_release_keys[] = { | |||
| 882 | }; | 894 | }; |
| 883 | 895 | ||
| 884 | /* | 896 | /* |
| 885 | * The volume up and volume down special keys on a Fujitsu Amilo PA 1510 laptop | ||
| 886 | * do not generate release events so we have to do it ourselves. | ||
| 887 | */ | ||
| 888 | static unsigned int atkbd_amilo_pa1510_forced_release_keys[] = { | ||
| 889 | 0xb0, 0xae, -1U | ||
| 890 | }; | ||
| 891 | |||
| 892 | /* | ||
| 893 | * Amilo Pi 3525 key release for Fn+Volume keys not working | 897 | * Amilo Pi 3525 key release for Fn+Volume keys not working |
| 894 | */ | 898 | */ |
| 895 | static unsigned int atkbd_amilo_pi3525_forced_release_keys[] = { | 899 | static unsigned int atkbd_amilo_pi3525_forced_release_keys[] = { |
| @@ -911,6 +915,14 @@ static unsigned int atkdb_soltech_ta12_forced_release_keys[] = { | |||
| 911 | }; | 915 | }; |
| 912 | 916 | ||
| 913 | /* | 917 | /* |
| 918 | * Many notebooks don't send key release event for volume up/down | ||
| 919 | * keys, with key list below common among them | ||
| 920 | */ | ||
| 921 | static unsigned int atkbd_volume_forced_release_keys[] = { | ||
| 922 | 0xae, 0xb0, -1U | ||
| 923 | }; | ||
| 924 | |||
| 925 | /* | ||
| 914 | * atkbd_set_keycode_table() initializes keyboard's keycode table | 926 | * atkbd_set_keycode_table() initializes keyboard's keycode table |
| 915 | * according to the selected scancode set | 927 | * according to the selected scancode set |
| 916 | */ | 928 | */ |
| @@ -1087,6 +1099,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
| 1087 | } | 1099 | } |
| 1088 | 1100 | ||
| 1089 | atkbd->set = atkbd_select_set(atkbd, atkbd_set, atkbd_extra); | 1101 | atkbd->set = atkbd_select_set(atkbd, atkbd_set, atkbd_extra); |
| 1102 | atkbd_reset_state(atkbd); | ||
| 1090 | atkbd_activate(atkbd); | 1103 | atkbd_activate(atkbd); |
| 1091 | 1104 | ||
| 1092 | } else { | 1105 | } else { |
| @@ -1267,6 +1280,7 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun | |||
| 1267 | 1280 | ||
| 1268 | atkbd->dev = new_dev; | 1281 | atkbd->dev = new_dev; |
| 1269 | atkbd->set = atkbd_select_set(atkbd, atkbd->set, value); | 1282 | atkbd->set = atkbd_select_set(atkbd, atkbd->set, value); |
| 1283 | atkbd_reset_state(atkbd); | ||
| 1270 | atkbd_activate(atkbd); | 1284 | atkbd_activate(atkbd); |
| 1271 | atkbd_set_keycode_table(atkbd); | 1285 | atkbd_set_keycode_table(atkbd); |
| 1272 | atkbd_set_device_attrs(atkbd); | 1286 | atkbd_set_device_attrs(atkbd); |
| @@ -1548,7 +1562,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { | |||
| 1548 | DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion ZV6100"), | 1562 | DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion ZV6100"), |
| 1549 | }, | 1563 | }, |
| 1550 | .callback = atkbd_setup_forced_release, | 1564 | .callback = atkbd_setup_forced_release, |
| 1551 | .driver_data = atkbd_hp_zv6100_forced_release_keys, | 1565 | .driver_data = atkbd_volume_forced_release_keys, |
| 1552 | }, | 1566 | }, |
| 1553 | { | 1567 | { |
| 1554 | .ident = "HP Presario R4000", | 1568 | .ident = "HP Presario R4000", |
| @@ -1557,7 +1571,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { | |||
| 1557 | DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4000"), | 1571 | DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4000"), |
| 1558 | }, | 1572 | }, |
| 1559 | .callback = atkbd_setup_forced_release, | 1573 | .callback = atkbd_setup_forced_release, |
| 1560 | .driver_data = atkbd_hp_r4000_forced_release_keys, | 1574 | .driver_data = atkbd_volume_forced_release_keys, |
| 1561 | }, | 1575 | }, |
| 1562 | { | 1576 | { |
| 1563 | .ident = "HP Presario R4100", | 1577 | .ident = "HP Presario R4100", |
| @@ -1566,7 +1580,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { | |||
| 1566 | DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4100"), | 1580 | DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4100"), |
| 1567 | }, | 1581 | }, |
| 1568 | .callback = atkbd_setup_forced_release, | 1582 | .callback = atkbd_setup_forced_release, |
| 1569 | .driver_data = atkbd_hp_r4000_forced_release_keys, | 1583 | .driver_data = atkbd_volume_forced_release_keys, |
| 1570 | }, | 1584 | }, |
| 1571 | { | 1585 | { |
| 1572 | .ident = "HP Presario R4200", | 1586 | .ident = "HP Presario R4200", |
| @@ -1575,7 +1589,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { | |||
| 1575 | DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4200"), | 1589 | DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4200"), |
| 1576 | }, | 1590 | }, |
| 1577 | .callback = atkbd_setup_forced_release, | 1591 | .callback = atkbd_setup_forced_release, |
| 1578 | .driver_data = atkbd_hp_r4000_forced_release_keys, | 1592 | .driver_data = atkbd_volume_forced_release_keys, |
| 1579 | }, | 1593 | }, |
| 1580 | { | 1594 | { |
| 1581 | .ident = "Inventec Symphony", | 1595 | .ident = "Inventec Symphony", |
| @@ -1584,7 +1598,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { | |||
| 1584 | DMI_MATCH(DMI_PRODUCT_NAME, "SYMPHONY 6.0/7.0"), | 1598 | DMI_MATCH(DMI_PRODUCT_NAME, "SYMPHONY 6.0/7.0"), |
| 1585 | }, | 1599 | }, |
| 1586 | .callback = atkbd_setup_forced_release, | 1600 | .callback = atkbd_setup_forced_release, |
| 1587 | .driver_data = atkbd_inventec_forced_release_keys, | 1601 | .driver_data = atkbd_volume_forced_release_keys, |
| 1588 | }, | 1602 | }, |
| 1589 | { | 1603 | { |
| 1590 | .ident = "Samsung NC10", | 1604 | .ident = "Samsung NC10", |
| @@ -1620,7 +1634,7 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { | |||
| 1620 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 1510"), | 1634 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pa 1510"), |
| 1621 | }, | 1635 | }, |
| 1622 | .callback = atkbd_setup_forced_release, | 1636 | .callback = atkbd_setup_forced_release, |
| 1623 | .driver_data = atkbd_amilo_pa1510_forced_release_keys, | 1637 | .driver_data = atkbd_volume_forced_release_keys, |
| 1624 | }, | 1638 | }, |
| 1625 | { | 1639 | { |
| 1626 | .ident = "Fujitsu Amilo Pi 3525", | 1640 | .ident = "Fujitsu Amilo Pi 3525", |
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index 216a559f55ea..ea821b546969 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c | |||
| @@ -209,7 +209,7 @@ static inline int hp_sdc_rtc_read_rt(struct timeval *res) { | |||
| 209 | 209 | ||
| 210 | /* Read the i8042 fast handshake timer */ | 210 | /* Read the i8042 fast handshake timer */ |
| 211 | static inline int hp_sdc_rtc_read_fhs(struct timeval *res) { | 211 | static inline int hp_sdc_rtc_read_fhs(struct timeval *res) { |
| 212 | uint64_t raw; | 212 | int64_t raw; |
| 213 | unsigned int tenms; | 213 | unsigned int tenms; |
| 214 | 214 | ||
| 215 | raw = hp_sdc_rtc_read_i8042timer(HP_SDC_CMD_LOAD_FHS, 2); | 215 | raw = hp_sdc_rtc_read_i8042timer(HP_SDC_CMD_LOAD_FHS, 2); |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index de745d751162..ab5dc5f5fd83 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
| @@ -219,7 +219,7 @@ static const struct ps2pp_info *get_model_info(unsigned char model) | |||
| 219 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | | 219 | PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | |
| 220 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN | PS2PP_HWHEEL }, | 220 | PS2PP_EXTRA_BTN | PS2PP_NAV_BTN | PS2PP_HWHEEL }, |
| 221 | { 72, PS2PP_KIND_TRACKMAN, 0 }, /* T-CH11: TrackMan Marble */ | 221 | { 72, PS2PP_KIND_TRACKMAN, 0 }, /* T-CH11: TrackMan Marble */ |
| 222 | { 73, 0, PS2PP_SIDE_BTN }, | 222 | { 73, PS2PP_KIND_TRACKMAN, PS2PP_SIDE_BTN }, /* TrackMan FX */ |
| 223 | { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 223 | { 75, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
| 224 | { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, | 224 | { 76, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, |
| 225 | { 79, PS2PP_KIND_TRACKMAN, PS2PP_WHEEL }, /* TrackMan with wheel */ | 225 | { 79, PS2PP_KIND_TRACKMAN, PS2PP_WHEEL }, /* TrackMan with wheel */ |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index b66ff1ac7dea..f4a61252bcc9 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
| @@ -652,6 +652,16 @@ static const struct dmi_system_id toshiba_dmi_table[] = { | |||
| 652 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 652 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
| 653 | DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"), | 653 | DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"), |
| 654 | }, | 654 | }, |
| 655 | |||
| 656 | }, | ||
| 657 | { | ||
| 658 | .ident = "Toshiba Portege M300", | ||
| 659 | .matches = { | ||
| 660 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
| 661 | DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"), | ||
| 662 | DMI_MATCH(DMI_PRODUCT_VERSION, "Version 1.0"), | ||
| 663 | }, | ||
| 664 | |||
| 655 | }, | 665 | }, |
| 656 | { } | 666 | { } |
| 657 | }; | 667 | }; |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index a39bc4eb902b..a537925f7651 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
| @@ -327,6 +327,17 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { | |||
| 327 | }, | 327 | }, |
| 328 | }, | 328 | }, |
| 329 | { | 329 | { |
| 330 | /* | ||
| 331 | * Reset and GET ID commands issued via KBD port are | ||
| 332 | * sometimes being delivered to AUX3. | ||
| 333 | */ | ||
| 334 | .ident = "Sony Vaio FZ-240E", | ||
| 335 | .matches = { | ||
| 336 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
| 337 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"), | ||
| 338 | }, | ||
| 339 | }, | ||
| 340 | { | ||
| 330 | .ident = "Amoi M636/A737", | 341 | .ident = "Amoi M636/A737", |
| 331 | .matches = { | 342 | .matches = { |
| 332 | DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."), | 343 | DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."), |
| @@ -661,7 +672,7 @@ static void i8042_pnp_exit(void) | |||
| 661 | static int __init i8042_pnp_init(void) | 672 | static int __init i8042_pnp_init(void) |
| 662 | { | 673 | { |
| 663 | char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; | 674 | char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; |
| 664 | int pnp_data_busted = false; | 675 | bool pnp_data_busted = false; |
| 665 | int err; | 676 | int err; |
| 666 | 677 | ||
| 667 | #ifdef CONFIG_X86 | 678 | #ifdef CONFIG_X86 |
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index b40fb9b6c862..6f308a4757ee 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
| @@ -405,7 +405,11 @@ static int __init via_pmu_start(void) | |||
| 405 | printk(KERN_ERR "via-pmu: can't map interrupt\n"); | 405 | printk(KERN_ERR "via-pmu: can't map interrupt\n"); |
| 406 | return -ENODEV; | 406 | return -ENODEV; |
| 407 | } | 407 | } |
| 408 | if (request_irq(irq, via_pmu_interrupt, 0, "VIA-PMU", (void *)0)) { | 408 | /* We set IRQF_TIMER because we don't want the interrupt to be disabled |
| 409 | * between the 2 passes of driver suspend, we control our own disabling | ||
| 410 | * for that one | ||
| 411 | */ | ||
| 412 | if (request_irq(irq, via_pmu_interrupt, IRQF_TIMER, "VIA-PMU", (void *)0)) { | ||
| 409 | printk(KERN_ERR "via-pmu: can't request irq %d\n", irq); | 413 | printk(KERN_ERR "via-pmu: can't request irq %d\n", irq); |
| 410 | return -ENODEV; | 414 | return -ENODEV; |
| 411 | } | 415 | } |
| @@ -419,7 +423,7 @@ static int __init via_pmu_start(void) | |||
| 419 | gpio_irq = irq_of_parse_and_map(gpio_node, 0); | 423 | gpio_irq = irq_of_parse_and_map(gpio_node, 0); |
| 420 | 424 | ||
| 421 | if (gpio_irq != NO_IRQ) { | 425 | if (gpio_irq != NO_IRQ) { |
| 422 | if (request_irq(gpio_irq, gpio1_interrupt, 0, | 426 | if (request_irq(gpio_irq, gpio1_interrupt, IRQF_TIMER, |
| 423 | "GPIO1 ADB", (void *)0)) | 427 | "GPIO1 ADB", (void *)0)) |
| 424 | printk(KERN_ERR "pmu: can't get irq %d" | 428 | printk(KERN_ERR "pmu: can't get irq %d" |
| 425 | " (GPIO1)\n", gpio_irq); | 429 | " (GPIO1)\n", gpio_irq); |
| @@ -925,8 +929,7 @@ proc_write_options(struct file *file, const char __user *buffer, | |||
| 925 | 929 | ||
| 926 | #ifdef CONFIG_ADB | 930 | #ifdef CONFIG_ADB |
| 927 | /* Send an ADB command */ | 931 | /* Send an ADB command */ |
| 928 | static int | 932 | static int pmu_send_request(struct adb_request *req, int sync) |
| 929 | pmu_send_request(struct adb_request *req, int sync) | ||
| 930 | { | 933 | { |
| 931 | int i, ret; | 934 | int i, ret; |
| 932 | 935 | ||
| @@ -1005,16 +1008,11 @@ pmu_send_request(struct adb_request *req, int sync) | |||
| 1005 | } | 1008 | } |
| 1006 | 1009 | ||
| 1007 | /* Enable/disable autopolling */ | 1010 | /* Enable/disable autopolling */ |
| 1008 | static int | 1011 | static int __pmu_adb_autopoll(int devs) |
| 1009 | pmu_adb_autopoll(int devs) | ||
| 1010 | { | 1012 | { |
| 1011 | struct adb_request req; | 1013 | struct adb_request req; |
| 1012 | 1014 | ||
| 1013 | if ((vias == NULL) || (!pmu_fully_inited) || !pmu_has_adb) | ||
| 1014 | return -ENXIO; | ||
| 1015 | |||
| 1016 | if (devs) { | 1015 | if (devs) { |
| 1017 | adb_dev_map = devs; | ||
| 1018 | pmu_request(&req, NULL, 5, PMU_ADB_CMD, 0, 0x86, | 1016 | pmu_request(&req, NULL, 5, PMU_ADB_CMD, 0, 0x86, |
| 1019 | adb_dev_map >> 8, adb_dev_map); | 1017 | adb_dev_map >> 8, adb_dev_map); |
| 1020 | pmu_adb_flags = 2; | 1018 | pmu_adb_flags = 2; |
| @@ -1027,9 +1025,17 @@ pmu_adb_autopoll(int devs) | |||
| 1027 | return 0; | 1025 | return 0; |
| 1028 | } | 1026 | } |
| 1029 | 1027 | ||
| 1028 | static int pmu_adb_autopoll(int devs) | ||
| 1029 | { | ||
| 1030 | if ((vias == NULL) || (!pmu_fully_inited) || !pmu_has_adb) | ||
| 1031 | return -ENXIO; | ||
| 1032 | |||
| 1033 | adb_dev_map = devs; | ||
| 1034 | return __pmu_adb_autopoll(devs); | ||
| 1035 | } | ||
| 1036 | |||
| 1030 | /* Reset the ADB bus */ | 1037 | /* Reset the ADB bus */ |
| 1031 | static int | 1038 | static int pmu_adb_reset_bus(void) |
| 1032 | pmu_adb_reset_bus(void) | ||
| 1033 | { | 1039 | { |
| 1034 | struct adb_request req; | 1040 | struct adb_request req; |
| 1035 | int save_autopoll = adb_dev_map; | 1041 | int save_autopoll = adb_dev_map; |
| @@ -1038,13 +1044,13 @@ pmu_adb_reset_bus(void) | |||
| 1038 | return -ENXIO; | 1044 | return -ENXIO; |
| 1039 | 1045 | ||
| 1040 | /* anyone got a better idea?? */ | 1046 | /* anyone got a better idea?? */ |
| 1041 | pmu_adb_autopoll(0); | 1047 | __pmu_adb_autopoll(0); |
| 1042 | 1048 | ||
| 1043 | req.nbytes = 5; | 1049 | req.nbytes = 4; |
| 1044 | req.done = NULL; | 1050 | req.done = NULL; |
| 1045 | req.data[0] = PMU_ADB_CMD; | 1051 | req.data[0] = PMU_ADB_CMD; |
| 1046 | req.data[1] = 0; | 1052 | req.data[1] = ADB_BUSRESET; |
| 1047 | req.data[2] = ADB_BUSRESET; | 1053 | req.data[2] = 0; |
| 1048 | req.data[3] = 0; | 1054 | req.data[3] = 0; |
| 1049 | req.data[4] = 0; | 1055 | req.data[4] = 0; |
| 1050 | req.reply_len = 0; | 1056 | req.reply_len = 0; |
| @@ -1056,7 +1062,7 @@ pmu_adb_reset_bus(void) | |||
| 1056 | pmu_wait_complete(&req); | 1062 | pmu_wait_complete(&req); |
| 1057 | 1063 | ||
| 1058 | if (save_autopoll != 0) | 1064 | if (save_autopoll != 0) |
| 1059 | pmu_adb_autopoll(save_autopoll); | 1065 | __pmu_adb_autopoll(save_autopoll); |
| 1060 | 1066 | ||
| 1061 | return 0; | 1067 | return 0; |
| 1062 | } | 1068 | } |
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c index 556acff3952f..7dbe652efb5a 100644 --- a/drivers/md/dm-exception-store.c +++ b/drivers/md/dm-exception-store.c | |||
| @@ -138,16 +138,6 @@ int dm_exception_store_type_unregister(struct dm_exception_store_type *type) | |||
| 138 | } | 138 | } |
| 139 | EXPORT_SYMBOL(dm_exception_store_type_unregister); | 139 | EXPORT_SYMBOL(dm_exception_store_type_unregister); |
| 140 | 140 | ||
| 141 | /* | ||
| 142 | * Round a number up to the nearest 'size' boundary. size must | ||
| 143 | * be a power of 2. | ||
| 144 | */ | ||
| 145 | static ulong round_up(ulong n, ulong size) | ||
| 146 | { | ||
| 147 | size--; | ||
| 148 | return (n + size) & ~size; | ||
| 149 | } | ||
| 150 | |||
| 151 | static int set_chunk_size(struct dm_exception_store *store, | 141 | static int set_chunk_size(struct dm_exception_store *store, |
| 152 | const char *chunk_size_arg, char **error) | 142 | const char *chunk_size_arg, char **error) |
| 153 | { | 143 | { |
| @@ -155,7 +145,8 @@ static int set_chunk_size(struct dm_exception_store *store, | |||
| 155 | char *value; | 145 | char *value; |
| 156 | 146 | ||
| 157 | chunk_size_ulong = simple_strtoul(chunk_size_arg, &value, 10); | 147 | chunk_size_ulong = simple_strtoul(chunk_size_arg, &value, 10); |
| 158 | if (*chunk_size_arg == '\0' || *value != '\0') { | 148 | if (*chunk_size_arg == '\0' || *value != '\0' || |
| 149 | chunk_size_ulong > UINT_MAX) { | ||
| 159 | *error = "Invalid chunk size"; | 150 | *error = "Invalid chunk size"; |
| 160 | return -EINVAL; | 151 | return -EINVAL; |
| 161 | } | 152 | } |
| @@ -165,40 +156,35 @@ static int set_chunk_size(struct dm_exception_store *store, | |||
| 165 | return 0; | 156 | return 0; |
| 166 | } | 157 | } |
| 167 | 158 | ||
| 168 | /* | 159 | return dm_exception_store_set_chunk_size(store, |
| 169 | * Chunk size must be multiple of page size. Silently | 160 | (unsigned) chunk_size_ulong, |
| 170 | * round up if it's not. | ||
| 171 | */ | ||
| 172 | chunk_size_ulong = round_up(chunk_size_ulong, PAGE_SIZE >> 9); | ||
| 173 | |||
| 174 | return dm_exception_store_set_chunk_size(store, chunk_size_ulong, | ||
| 175 | error); | 161 | error); |
| 176 | } | 162 | } |
| 177 | 163 | ||
| 178 | int dm_exception_store_set_chunk_size(struct dm_exception_store *store, | 164 | int dm_exception_store_set_chunk_size(struct dm_exception_store *store, |
| 179 | unsigned long chunk_size_ulong, | 165 | unsigned chunk_size, |
| 180 | char **error) | 166 | char **error) |
| 181 | { | 167 | { |
| 182 | /* Check chunk_size is a power of 2 */ | 168 | /* Check chunk_size is a power of 2 */ |
| 183 | if (!is_power_of_2(chunk_size_ulong)) { | 169 | if (!is_power_of_2(chunk_size)) { |
| 184 | *error = "Chunk size is not a power of 2"; | 170 | *error = "Chunk size is not a power of 2"; |
| 185 | return -EINVAL; | 171 | return -EINVAL; |
| 186 | } | 172 | } |
| 187 | 173 | ||
| 188 | /* Validate the chunk size against the device block size */ | 174 | /* Validate the chunk size against the device block size */ |
| 189 | if (chunk_size_ulong % (bdev_logical_block_size(store->cow->bdev) >> 9)) { | 175 | if (chunk_size % (bdev_logical_block_size(store->cow->bdev) >> 9)) { |
| 190 | *error = "Chunk size is not a multiple of device blocksize"; | 176 | *error = "Chunk size is not a multiple of device blocksize"; |
| 191 | return -EINVAL; | 177 | return -EINVAL; |
| 192 | } | 178 | } |
| 193 | 179 | ||
| 194 | if (chunk_size_ulong > INT_MAX >> SECTOR_SHIFT) { | 180 | if (chunk_size > INT_MAX >> SECTOR_SHIFT) { |
| 195 | *error = "Chunk size is too high"; | 181 | *error = "Chunk size is too high"; |
| 196 | return -EINVAL; | 182 | return -EINVAL; |
| 197 | } | 183 | } |
| 198 | 184 | ||
| 199 | store->chunk_size = chunk_size_ulong; | 185 | store->chunk_size = chunk_size; |
| 200 | store->chunk_mask = chunk_size_ulong - 1; | 186 | store->chunk_mask = chunk_size - 1; |
| 201 | store->chunk_shift = ffs(chunk_size_ulong) - 1; | 187 | store->chunk_shift = ffs(chunk_size) - 1; |
| 202 | 188 | ||
| 203 | return 0; | 189 | return 0; |
| 204 | } | 190 | } |
| @@ -251,7 +237,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv, | |||
| 251 | 237 | ||
| 252 | r = set_chunk_size(tmp_store, argv[2], &ti->error); | 238 | r = set_chunk_size(tmp_store, argv[2], &ti->error); |
| 253 | if (r) | 239 | if (r) |
| 254 | goto bad_cow; | 240 | goto bad_ctr; |
| 255 | 241 | ||
| 256 | r = type->ctr(tmp_store, 0, NULL); | 242 | r = type->ctr(tmp_store, 0, NULL); |
| 257 | if (r) { | 243 | if (r) { |
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h index 812c71872ba0..8a223a48802c 100644 --- a/drivers/md/dm-exception-store.h +++ b/drivers/md/dm-exception-store.h | |||
| @@ -101,9 +101,9 @@ struct dm_exception_store { | |||
| 101 | struct dm_dev *cow; | 101 | struct dm_dev *cow; |
| 102 | 102 | ||
| 103 | /* Size of data blocks saved - must be a power of 2 */ | 103 | /* Size of data blocks saved - must be a power of 2 */ |
| 104 | chunk_t chunk_size; | 104 | unsigned chunk_size; |
| 105 | chunk_t chunk_mask; | 105 | unsigned chunk_mask; |
| 106 | chunk_t chunk_shift; | 106 | unsigned chunk_shift; |
| 107 | 107 | ||
| 108 | void *context; | 108 | void *context; |
| 109 | }; | 109 | }; |
| @@ -169,7 +169,7 @@ int dm_exception_store_type_register(struct dm_exception_store_type *type); | |||
| 169 | int dm_exception_store_type_unregister(struct dm_exception_store_type *type); | 169 | int dm_exception_store_type_unregister(struct dm_exception_store_type *type); |
| 170 | 170 | ||
| 171 | int dm_exception_store_set_chunk_size(struct dm_exception_store *store, | 171 | int dm_exception_store_set_chunk_size(struct dm_exception_store *store, |
| 172 | unsigned long chunk_size_ulong, | 172 | unsigned chunk_size, |
| 173 | char **error); | 173 | char **error); |
| 174 | 174 | ||
| 175 | int dm_exception_store_create(struct dm_target *ti, int argc, char **argv, | 175 | int dm_exception_store_create(struct dm_target *ti, int argc, char **argv, |
diff --git a/drivers/md/dm-log-userspace-base.c b/drivers/md/dm-log-userspace-base.c index 652bd33109e3..7ac2c1450d10 100644 --- a/drivers/md/dm-log-userspace-base.c +++ b/drivers/md/dm-log-userspace-base.c | |||
| @@ -156,7 +156,7 @@ static int userspace_ctr(struct dm_dirty_log *log, struct dm_target *ti, | |||
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | /* The ptr value is sufficient for local unique id */ | 158 | /* The ptr value is sufficient for local unique id */ |
| 159 | lc->luid = (uint64_t)lc; | 159 | lc->luid = (unsigned long)lc; |
| 160 | 160 | ||
| 161 | lc->ti = ti; | 161 | lc->ti = ti; |
| 162 | 162 | ||
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c index d5b2e08750d5..0c746420c008 100644 --- a/drivers/md/dm-snap-persistent.c +++ b/drivers/md/dm-snap-persistent.c | |||
| @@ -284,12 +284,13 @@ static int read_header(struct pstore *ps, int *new_snapshot) | |||
| 284 | { | 284 | { |
| 285 | int r; | 285 | int r; |
| 286 | struct disk_header *dh; | 286 | struct disk_header *dh; |
| 287 | chunk_t chunk_size; | 287 | unsigned chunk_size; |
| 288 | int chunk_size_supplied = 1; | 288 | int chunk_size_supplied = 1; |
| 289 | char *chunk_err; | 289 | char *chunk_err; |
| 290 | 290 | ||
| 291 | /* | 291 | /* |
| 292 | * Use default chunk size (or hardsect_size, if larger) if none supplied | 292 | * Use default chunk size (or logical_block_size, if larger) |
| 293 | * if none supplied | ||
| 293 | */ | 294 | */ |
| 294 | if (!ps->store->chunk_size) { | 295 | if (!ps->store->chunk_size) { |
| 295 | ps->store->chunk_size = max(DM_CHUNK_SIZE_DEFAULT_SECTORS, | 296 | ps->store->chunk_size = max(DM_CHUNK_SIZE_DEFAULT_SECTORS, |
| @@ -334,10 +335,9 @@ static int read_header(struct pstore *ps, int *new_snapshot) | |||
| 334 | return 0; | 335 | return 0; |
| 335 | 336 | ||
| 336 | if (chunk_size_supplied) | 337 | if (chunk_size_supplied) |
| 337 | DMWARN("chunk size %llu in device metadata overrides " | 338 | DMWARN("chunk size %u in device metadata overrides " |
| 338 | "table chunk size of %llu.", | 339 | "table chunk size of %u.", |
| 339 | (unsigned long long)chunk_size, | 340 | chunk_size, ps->store->chunk_size); |
| 340 | (unsigned long long)ps->store->chunk_size); | ||
| 341 | 341 | ||
| 342 | /* We had a bogus chunk_size. Fix stuff up. */ | 342 | /* We had a bogus chunk_size. Fix stuff up. */ |
| 343 | free_area(ps); | 343 | free_area(ps); |
| @@ -345,8 +345,8 @@ static int read_header(struct pstore *ps, int *new_snapshot) | |||
| 345 | r = dm_exception_store_set_chunk_size(ps->store, chunk_size, | 345 | r = dm_exception_store_set_chunk_size(ps->store, chunk_size, |
| 346 | &chunk_err); | 346 | &chunk_err); |
| 347 | if (r) { | 347 | if (r) { |
| 348 | DMERR("invalid on-disk chunk size %llu: %s.", | 348 | DMERR("invalid on-disk chunk size %u: %s.", |
| 349 | (unsigned long long)chunk_size, chunk_err); | 349 | chunk_size, chunk_err); |
| 350 | return r; | 350 | return r; |
| 351 | } | 351 | } |
| 352 | 352 | ||
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 57f1bf7f3b7a..3a3ba46e6d4b 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
| @@ -296,6 +296,7 @@ static void __insert_origin(struct origin *o) | |||
| 296 | */ | 296 | */ |
| 297 | static int register_snapshot(struct dm_snapshot *snap) | 297 | static int register_snapshot(struct dm_snapshot *snap) |
| 298 | { | 298 | { |
| 299 | struct dm_snapshot *l; | ||
| 299 | struct origin *o, *new_o; | 300 | struct origin *o, *new_o; |
| 300 | struct block_device *bdev = snap->origin->bdev; | 301 | struct block_device *bdev = snap->origin->bdev; |
| 301 | 302 | ||
| @@ -319,7 +320,11 @@ static int register_snapshot(struct dm_snapshot *snap) | |||
| 319 | __insert_origin(o); | 320 | __insert_origin(o); |
| 320 | } | 321 | } |
| 321 | 322 | ||
| 322 | list_add_tail(&snap->list, &o->snapshots); | 323 | /* Sort the list according to chunk size, largest-first smallest-last */ |
| 324 | list_for_each_entry(l, &o->snapshots, list) | ||
| 325 | if (l->store->chunk_size < snap->store->chunk_size) | ||
| 326 | break; | ||
| 327 | list_add_tail(&snap->list, &l->list); | ||
| 323 | 328 | ||
| 324 | up_write(&_origins_lock); | 329 | up_write(&_origins_lock); |
| 325 | return 0; | 330 | return 0; |
| @@ -668,6 +673,11 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 668 | bio_list_init(&s->queued_bios); | 673 | bio_list_init(&s->queued_bios); |
| 669 | INIT_WORK(&s->queued_bios_work, flush_queued_bios); | 674 | INIT_WORK(&s->queued_bios_work, flush_queued_bios); |
| 670 | 675 | ||
| 676 | if (!s->store->chunk_size) { | ||
| 677 | ti->error = "Chunk size not set"; | ||
| 678 | goto bad_load_and_register; | ||
| 679 | } | ||
| 680 | |||
| 671 | /* Add snapshot to the list of snapshots for this origin */ | 681 | /* Add snapshot to the list of snapshots for this origin */ |
| 672 | /* Exceptions aren't triggered till snapshot_resume() is called */ | 682 | /* Exceptions aren't triggered till snapshot_resume() is called */ |
| 673 | if (register_snapshot(s)) { | 683 | if (register_snapshot(s)) { |
| @@ -951,7 +961,7 @@ static void start_copy(struct dm_snap_pending_exception *pe) | |||
| 951 | 961 | ||
| 952 | src.bdev = bdev; | 962 | src.bdev = bdev; |
| 953 | src.sector = chunk_to_sector(s->store, pe->e.old_chunk); | 963 | src.sector = chunk_to_sector(s->store, pe->e.old_chunk); |
| 954 | src.count = min(s->store->chunk_size, dev_size - src.sector); | 964 | src.count = min((sector_t)s->store->chunk_size, dev_size - src.sector); |
| 955 | 965 | ||
| 956 | dest.bdev = s->store->cow->bdev; | 966 | dest.bdev = s->store->cow->bdev; |
| 957 | dest.sector = chunk_to_sector(s->store, pe->e.new_chunk); | 967 | dest.sector = chunk_to_sector(s->store, pe->e.new_chunk); |
| @@ -1142,6 +1152,8 @@ static int snapshot_status(struct dm_target *ti, status_type_t type, | |||
| 1142 | unsigned sz = 0; | 1152 | unsigned sz = 0; |
| 1143 | struct dm_snapshot *snap = ti->private; | 1153 | struct dm_snapshot *snap = ti->private; |
| 1144 | 1154 | ||
| 1155 | down_write(&snap->lock); | ||
| 1156 | |||
| 1145 | switch (type) { | 1157 | switch (type) { |
| 1146 | case STATUSTYPE_INFO: | 1158 | case STATUSTYPE_INFO: |
| 1147 | if (!snap->valid) | 1159 | if (!snap->valid) |
| @@ -1173,6 +1185,8 @@ static int snapshot_status(struct dm_target *ti, status_type_t type, | |||
| 1173 | break; | 1185 | break; |
| 1174 | } | 1186 | } |
| 1175 | 1187 | ||
| 1188 | up_write(&snap->lock); | ||
| 1189 | |||
| 1176 | return 0; | 1190 | return 0; |
| 1177 | } | 1191 | } |
| 1178 | 1192 | ||
| @@ -1388,7 +1402,7 @@ static void origin_resume(struct dm_target *ti) | |||
| 1388 | struct dm_dev *dev = ti->private; | 1402 | struct dm_dev *dev = ti->private; |
| 1389 | struct dm_snapshot *snap; | 1403 | struct dm_snapshot *snap; |
| 1390 | struct origin *o; | 1404 | struct origin *o; |
| 1391 | chunk_t chunk_size = 0; | 1405 | unsigned chunk_size = 0; |
| 1392 | 1406 | ||
| 1393 | down_read(&_origins_lock); | 1407 | down_read(&_origins_lock); |
| 1394 | o = __lookup_origin(dev->bdev); | 1408 | o = __lookup_origin(dev->bdev); |
| @@ -1465,7 +1479,7 @@ static int __init dm_snapshot_init(void) | |||
| 1465 | r = dm_register_target(&snapshot_target); | 1479 | r = dm_register_target(&snapshot_target); |
| 1466 | if (r) { | 1480 | if (r) { |
| 1467 | DMERR("snapshot target register failed %d", r); | 1481 | DMERR("snapshot target register failed %d", r); |
| 1468 | return r; | 1482 | goto bad_register_snapshot_target; |
| 1469 | } | 1483 | } |
| 1470 | 1484 | ||
| 1471 | r = dm_register_target(&origin_target); | 1485 | r = dm_register_target(&origin_target); |
| @@ -1522,6 +1536,9 @@ bad2: | |||
| 1522 | dm_unregister_target(&origin_target); | 1536 | dm_unregister_target(&origin_target); |
| 1523 | bad1: | 1537 | bad1: |
| 1524 | dm_unregister_target(&snapshot_target); | 1538 | dm_unregister_target(&snapshot_target); |
| 1539 | |||
| 1540 | bad_register_snapshot_target: | ||
| 1541 | dm_exception_store_exit(); | ||
| 1525 | return r; | 1542 | return r; |
| 1526 | } | 1543 | } |
| 1527 | 1544 | ||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 23e76fe0d359..724efc63904d 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -47,6 +47,7 @@ struct dm_io { | |||
| 47 | atomic_t io_count; | 47 | atomic_t io_count; |
| 48 | struct bio *bio; | 48 | struct bio *bio; |
| 49 | unsigned long start_time; | 49 | unsigned long start_time; |
| 50 | spinlock_t endio_lock; | ||
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | /* | 53 | /* |
| @@ -130,7 +131,7 @@ struct mapped_device { | |||
| 130 | /* | 131 | /* |
| 131 | * A list of ios that arrived while we were suspended. | 132 | * A list of ios that arrived while we were suspended. |
| 132 | */ | 133 | */ |
| 133 | atomic_t pending; | 134 | atomic_t pending[2]; |
| 134 | wait_queue_head_t wait; | 135 | wait_queue_head_t wait; |
| 135 | struct work_struct work; | 136 | struct work_struct work; |
| 136 | struct bio_list deferred; | 137 | struct bio_list deferred; |
| @@ -453,13 +454,14 @@ static void start_io_acct(struct dm_io *io) | |||
| 453 | { | 454 | { |
| 454 | struct mapped_device *md = io->md; | 455 | struct mapped_device *md = io->md; |
| 455 | int cpu; | 456 | int cpu; |
| 457 | int rw = bio_data_dir(io->bio); | ||
| 456 | 458 | ||
| 457 | io->start_time = jiffies; | 459 | io->start_time = jiffies; |
| 458 | 460 | ||
| 459 | cpu = part_stat_lock(); | 461 | cpu = part_stat_lock(); |
| 460 | part_round_stats(cpu, &dm_disk(md)->part0); | 462 | part_round_stats(cpu, &dm_disk(md)->part0); |
| 461 | part_stat_unlock(); | 463 | part_stat_unlock(); |
| 462 | dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending); | 464 | dm_disk(md)->part0.in_flight[rw] = atomic_inc_return(&md->pending[rw]); |
| 463 | } | 465 | } |
| 464 | 466 | ||
| 465 | static void end_io_acct(struct dm_io *io) | 467 | static void end_io_acct(struct dm_io *io) |
| @@ -479,8 +481,9 @@ static void end_io_acct(struct dm_io *io) | |||
| 479 | * After this is decremented the bio must not be touched if it is | 481 | * After this is decremented the bio must not be touched if it is |
| 480 | * a barrier. | 482 | * a barrier. |
| 481 | */ | 483 | */ |
| 482 | dm_disk(md)->part0.in_flight = pending = | 484 | dm_disk(md)->part0.in_flight[rw] = pending = |
| 483 | atomic_dec_return(&md->pending); | 485 | atomic_dec_return(&md->pending[rw]); |
| 486 | pending += atomic_read(&md->pending[rw^0x1]); | ||
| 484 | 487 | ||
| 485 | /* nudge anyone waiting on suspend queue */ | 488 | /* nudge anyone waiting on suspend queue */ |
| 486 | if (!pending) | 489 | if (!pending) |
| @@ -576,8 +579,12 @@ static void dec_pending(struct dm_io *io, int error) | |||
| 576 | struct mapped_device *md = io->md; | 579 | struct mapped_device *md = io->md; |
| 577 | 580 | ||
| 578 | /* Push-back supersedes any I/O errors */ | 581 | /* Push-back supersedes any I/O errors */ |
| 579 | if (error && !(io->error > 0 && __noflush_suspending(md))) | 582 | if (unlikely(error)) { |
| 580 | io->error = error; | 583 | spin_lock_irqsave(&io->endio_lock, flags); |
| 584 | if (!(io->error > 0 && __noflush_suspending(md))) | ||
| 585 | io->error = error; | ||
| 586 | spin_unlock_irqrestore(&io->endio_lock, flags); | ||
| 587 | } | ||
| 581 | 588 | ||
| 582 | if (atomic_dec_and_test(&io->io_count)) { | 589 | if (atomic_dec_and_test(&io->io_count)) { |
| 583 | if (io->error == DM_ENDIO_REQUEUE) { | 590 | if (io->error == DM_ENDIO_REQUEUE) { |
| @@ -1224,6 +1231,7 @@ static void __split_and_process_bio(struct mapped_device *md, struct bio *bio) | |||
| 1224 | atomic_set(&ci.io->io_count, 1); | 1231 | atomic_set(&ci.io->io_count, 1); |
| 1225 | ci.io->bio = bio; | 1232 | ci.io->bio = bio; |
| 1226 | ci.io->md = md; | 1233 | ci.io->md = md; |
| 1234 | spin_lock_init(&ci.io->endio_lock); | ||
| 1227 | ci.sector = bio->bi_sector; | 1235 | ci.sector = bio->bi_sector; |
| 1228 | ci.sector_count = bio_sectors(bio); | 1236 | ci.sector_count = bio_sectors(bio); |
| 1229 | if (unlikely(bio_empty_barrier(bio))) | 1237 | if (unlikely(bio_empty_barrier(bio))) |
| @@ -1785,7 +1793,8 @@ static struct mapped_device *alloc_dev(int minor) | |||
| 1785 | if (!md->disk) | 1793 | if (!md->disk) |
| 1786 | goto bad_disk; | 1794 | goto bad_disk; |
| 1787 | 1795 | ||
| 1788 | atomic_set(&md->pending, 0); | 1796 | atomic_set(&md->pending[0], 0); |
| 1797 | atomic_set(&md->pending[1], 0); | ||
| 1789 | init_waitqueue_head(&md->wait); | 1798 | init_waitqueue_head(&md->wait); |
| 1790 | INIT_WORK(&md->work, dm_wq_work); | 1799 | INIT_WORK(&md->work, dm_wq_work); |
| 1791 | init_waitqueue_head(&md->eventq); | 1800 | init_waitqueue_head(&md->eventq); |
| @@ -1819,6 +1828,7 @@ static struct mapped_device *alloc_dev(int minor) | |||
| 1819 | bad_bdev: | 1828 | bad_bdev: |
| 1820 | destroy_workqueue(md->wq); | 1829 | destroy_workqueue(md->wq); |
| 1821 | bad_thread: | 1830 | bad_thread: |
| 1831 | del_gendisk(md->disk); | ||
| 1822 | put_disk(md->disk); | 1832 | put_disk(md->disk); |
| 1823 | bad_disk: | 1833 | bad_disk: |
| 1824 | blk_cleanup_queue(md->queue); | 1834 | blk_cleanup_queue(md->queue); |
| @@ -2088,7 +2098,8 @@ static int dm_wait_for_completion(struct mapped_device *md, int interruptible) | |||
| 2088 | break; | 2098 | break; |
| 2089 | } | 2099 | } |
| 2090 | spin_unlock_irqrestore(q->queue_lock, flags); | 2100 | spin_unlock_irqrestore(q->queue_lock, flags); |
| 2091 | } else if (!atomic_read(&md->pending)) | 2101 | } else if (!atomic_read(&md->pending[0]) && |
| 2102 | !atomic_read(&md->pending[1])) | ||
| 2092 | break; | 2103 | break; |
| 2093 | 2104 | ||
| 2094 | if (interruptible == TASK_INTERRUPTIBLE && | 2105 | if (interruptible == TASK_INTERRUPTIBLE && |
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c index e424cf6d8e9e..e832e975da60 100644 --- a/drivers/mfd/twl4030-core.c +++ b/drivers/mfd/twl4030-core.c | |||
| @@ -480,7 +480,6 @@ static int | |||
| 480 | add_children(struct twl4030_platform_data *pdata, unsigned long features) | 480 | add_children(struct twl4030_platform_data *pdata, unsigned long features) |
| 481 | { | 481 | { |
| 482 | struct device *child; | 482 | struct device *child; |
| 483 | struct device *usb_transceiver = NULL; | ||
| 484 | 483 | ||
| 485 | if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) { | 484 | if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) { |
| 486 | child = add_child(3, "twl4030_bci", | 485 | child = add_child(3, "twl4030_bci", |
| @@ -532,16 +531,61 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) | |||
| 532 | } | 531 | } |
| 533 | 532 | ||
| 534 | if (twl_has_usb() && pdata->usb) { | 533 | if (twl_has_usb() && pdata->usb) { |
| 534 | |||
| 535 | static struct regulator_consumer_supply usb1v5 = { | ||
| 536 | .supply = "usb1v5", | ||
| 537 | }; | ||
| 538 | static struct regulator_consumer_supply usb1v8 = { | ||
| 539 | .supply = "usb1v8", | ||
| 540 | }; | ||
| 541 | static struct regulator_consumer_supply usb3v1 = { | ||
| 542 | .supply = "usb3v1", | ||
| 543 | }; | ||
| 544 | |||
| 545 | /* First add the regulators so that they can be used by transceiver */ | ||
| 546 | if (twl_has_regulator()) { | ||
| 547 | /* this is a template that gets copied */ | ||
| 548 | struct regulator_init_data usb_fixed = { | ||
| 549 | .constraints.valid_modes_mask = | ||
| 550 | REGULATOR_MODE_NORMAL | ||
| 551 | | REGULATOR_MODE_STANDBY, | ||
| 552 | .constraints.valid_ops_mask = | ||
| 553 | REGULATOR_CHANGE_MODE | ||
| 554 | | REGULATOR_CHANGE_STATUS, | ||
| 555 | }; | ||
| 556 | |||
| 557 | child = add_regulator_linked(TWL4030_REG_VUSB1V5, | ||
| 558 | &usb_fixed, &usb1v5, 1); | ||
| 559 | if (IS_ERR(child)) | ||
| 560 | return PTR_ERR(child); | ||
| 561 | |||
| 562 | child = add_regulator_linked(TWL4030_REG_VUSB1V8, | ||
| 563 | &usb_fixed, &usb1v8, 1); | ||
| 564 | if (IS_ERR(child)) | ||
| 565 | return PTR_ERR(child); | ||
| 566 | |||
| 567 | child = add_regulator_linked(TWL4030_REG_VUSB3V1, | ||
| 568 | &usb_fixed, &usb3v1, 1); | ||
| 569 | if (IS_ERR(child)) | ||
| 570 | return PTR_ERR(child); | ||
| 571 | |||
| 572 | } | ||
| 573 | |||
| 535 | child = add_child(0, "twl4030_usb", | 574 | child = add_child(0, "twl4030_usb", |
| 536 | pdata->usb, sizeof(*pdata->usb), | 575 | pdata->usb, sizeof(*pdata->usb), |
| 537 | true, | 576 | true, |
| 538 | /* irq0 = USB_PRES, irq1 = USB */ | 577 | /* irq0 = USB_PRES, irq1 = USB */ |
| 539 | pdata->irq_base + 8 + 2, pdata->irq_base + 4); | 578 | pdata->irq_base + 8 + 2, pdata->irq_base + 4); |
| 579 | |||
| 540 | if (IS_ERR(child)) | 580 | if (IS_ERR(child)) |
| 541 | return PTR_ERR(child); | 581 | return PTR_ERR(child); |
| 542 | 582 | ||
| 543 | /* we need to connect regulators to this transceiver */ | 583 | /* we need to connect regulators to this transceiver */ |
| 544 | usb_transceiver = child; | 584 | if (twl_has_regulator() && child) { |
| 585 | usb1v5.dev = child; | ||
| 586 | usb1v8.dev = child; | ||
| 587 | usb3v1.dev = child; | ||
| 588 | } | ||
| 545 | } | 589 | } |
| 546 | 590 | ||
| 547 | if (twl_has_watchdog()) { | 591 | if (twl_has_watchdog()) { |
| @@ -580,47 +624,6 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) | |||
| 580 | return PTR_ERR(child); | 624 | return PTR_ERR(child); |
| 581 | } | 625 | } |
| 582 | 626 | ||
| 583 | if (twl_has_regulator() && usb_transceiver) { | ||
| 584 | static struct regulator_consumer_supply usb1v5 = { | ||
| 585 | .supply = "usb1v5", | ||
| 586 | }; | ||
| 587 | static struct regulator_consumer_supply usb1v8 = { | ||
| 588 | .supply = "usb1v8", | ||
| 589 | }; | ||
| 590 | static struct regulator_consumer_supply usb3v1 = { | ||
| 591 | .supply = "usb3v1", | ||
| 592 | }; | ||
| 593 | |||
| 594 | /* this is a template that gets copied */ | ||
| 595 | struct regulator_init_data usb_fixed = { | ||
| 596 | .constraints.valid_modes_mask = | ||
| 597 | REGULATOR_MODE_NORMAL | ||
| 598 | | REGULATOR_MODE_STANDBY, | ||
| 599 | .constraints.valid_ops_mask = | ||
| 600 | REGULATOR_CHANGE_MODE | ||
| 601 | | REGULATOR_CHANGE_STATUS, | ||
| 602 | }; | ||
| 603 | |||
| 604 | usb1v5.dev = usb_transceiver; | ||
| 605 | usb1v8.dev = usb_transceiver; | ||
| 606 | usb3v1.dev = usb_transceiver; | ||
| 607 | |||
| 608 | child = add_regulator_linked(TWL4030_REG_VUSB1V5, &usb_fixed, | ||
| 609 | &usb1v5, 1); | ||
| 610 | if (IS_ERR(child)) | ||
| 611 | return PTR_ERR(child); | ||
| 612 | |||
| 613 | child = add_regulator_linked(TWL4030_REG_VUSB1V8, &usb_fixed, | ||
| 614 | &usb1v8, 1); | ||
| 615 | if (IS_ERR(child)) | ||
| 616 | return PTR_ERR(child); | ||
| 617 | |||
| 618 | child = add_regulator_linked(TWL4030_REG_VUSB3V1, &usb_fixed, | ||
| 619 | &usb3v1, 1); | ||
| 620 | if (IS_ERR(child)) | ||
| 621 | return PTR_ERR(child); | ||
| 622 | } | ||
| 623 | |||
| 624 | /* maybe add LDOs that are omitted on cost-reduced parts */ | 627 | /* maybe add LDOs that are omitted on cost-reduced parts */ |
| 625 | if (twl_has_regulator() && !(features & TPS_SUBSET)) { | 628 | if (twl_has_regulator() && !(features & TPS_SUBSET)) { |
| 626 | child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2); | 629 | child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2); |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index e556d42cc45a..63924e0c7ea9 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
| @@ -72,7 +72,6 @@ | |||
| 72 | #include <asm/irq.h> | 72 | #include <asm/irq.h> |
| 73 | #include <asm/gpio.h> | 73 | #include <asm/gpio.h> |
| 74 | 74 | ||
| 75 | #include <asm/mach/mmc.h> | ||
| 76 | #include <mach/board.h> | 75 | #include <mach/board.h> |
| 77 | #include <mach/cpu.h> | 76 | #include <mach/cpu.h> |
| 78 | #include <mach/at91_mci.h> | 77 | #include <mach/at91_mci.h> |
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index 5e0b1529964d..b00d67319058 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
| @@ -693,7 +693,7 @@ static int pxamci_probe(struct platform_device *pdev) | |||
| 693 | if (gpio_is_valid(gpio_ro)) { | 693 | if (gpio_is_valid(gpio_ro)) { |
| 694 | ret = gpio_request(gpio_ro, "mmc card read only"); | 694 | ret = gpio_request(gpio_ro, "mmc card read only"); |
| 695 | if (ret) { | 695 | if (ret) { |
| 696 | dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_power); | 696 | dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro); |
| 697 | goto err_gpio_ro; | 697 | goto err_gpio_ro; |
| 698 | } | 698 | } |
| 699 | gpio_direction_input(gpio_ro); | 699 | gpio_direction_input(gpio_ro); |
| @@ -701,7 +701,7 @@ static int pxamci_probe(struct platform_device *pdev) | |||
| 701 | if (gpio_is_valid(gpio_cd)) { | 701 | if (gpio_is_valid(gpio_cd)) { |
| 702 | ret = gpio_request(gpio_cd, "mmc card detect"); | 702 | ret = gpio_request(gpio_cd, "mmc card detect"); |
| 703 | if (ret) { | 703 | if (ret) { |
| 704 | dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_power); | 704 | dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_cd); |
| 705 | goto err_gpio_cd; | 705 | goto err_gpio_cd; |
| 706 | } | 706 | } |
| 707 | gpio_direction_input(gpio_cd); | 707 | gpio_direction_input(gpio_cd); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 712776089b46..e19ca4bb7510 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -1741,6 +1741,7 @@ config KS8851 | |||
| 1741 | config KS8851_MLL | 1741 | config KS8851_MLL |
| 1742 | tristate "Micrel KS8851 MLL" | 1742 | tristate "Micrel KS8851 MLL" |
| 1743 | depends on HAS_IOMEM | 1743 | depends on HAS_IOMEM |
| 1744 | select MII | ||
| 1744 | help | 1745 | help |
| 1745 | This platform driver is for Micrel KS8851 Address/data bus | 1746 | This platform driver is for Micrel KS8851 Address/data bus |
| 1746 | multiplexed network chip. | 1747 | multiplexed network chip. |
| @@ -2482,6 +2483,8 @@ config S6GMAC | |||
| 2482 | To compile this driver as a module, choose M here. The module | 2483 | To compile this driver as a module, choose M here. The module |
| 2483 | will be called s6gmac. | 2484 | will be called s6gmac. |
| 2484 | 2485 | ||
| 2486 | source "drivers/net/stmmac/Kconfig" | ||
| 2487 | |||
| 2485 | endif # NETDEV_1000 | 2488 | endif # NETDEV_1000 |
| 2486 | 2489 | ||
| 2487 | # | 2490 | # |
| @@ -3230,4 +3233,12 @@ config VIRTIO_NET | |||
| 3230 | This is the virtual network driver for virtio. It can be used with | 3233 | This is the virtual network driver for virtio. It can be used with |
| 3231 | lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. | 3234 | lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. |
| 3232 | 3235 | ||
| 3236 | config VMXNET3 | ||
| 3237 | tristate "VMware VMXNET3 ethernet driver" | ||
| 3238 | depends on PCI && X86 && INET | ||
| 3239 | help | ||
| 3240 | This driver supports VMware's vmxnet3 virtual ethernet NIC. | ||
| 3241 | To compile this driver as a module, choose M here: the | ||
| 3242 | module will be called vmxnet3. | ||
| 3243 | |||
| 3233 | endif # NETDEVICES | 3244 | endif # NETDEVICES |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index d866b8cf65d1..246323d7f161 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
| @@ -2,6 +2,10 @@ | |||
| 2 | # Makefile for the Linux network (ethercard) device drivers. | 2 | # Makefile for the Linux network (ethercard) device drivers. |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-$(CONFIG_MII) += mii.o | ||
| 6 | obj-$(CONFIG_MDIO) += mdio.o | ||
| 7 | obj-$(CONFIG_PHYLIB) += phy/ | ||
| 8 | |||
| 5 | obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o | 9 | obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o |
| 6 | 10 | ||
| 7 | obj-$(CONFIG_E1000) += e1000/ | 11 | obj-$(CONFIG_E1000) += e1000/ |
| @@ -26,6 +30,7 @@ obj-$(CONFIG_TEHUTI) += tehuti.o | |||
| 26 | obj-$(CONFIG_ENIC) += enic/ | 30 | obj-$(CONFIG_ENIC) += enic/ |
| 27 | obj-$(CONFIG_JME) += jme.o | 31 | obj-$(CONFIG_JME) += jme.o |
| 28 | obj-$(CONFIG_BE2NET) += benet/ | 32 | obj-$(CONFIG_BE2NET) += benet/ |
| 33 | obj-$(CONFIG_VMXNET3) += vmxnet3/ | ||
| 29 | 34 | ||
| 30 | gianfar_driver-objs := gianfar.o \ | 35 | gianfar_driver-objs := gianfar.o \ |
| 31 | gianfar_ethtool.o \ | 36 | gianfar_ethtool.o \ |
| @@ -95,15 +100,12 @@ obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o | |||
| 95 | obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o | 100 | obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o |
| 96 | obj-$(CONFIG_RIONET) += rionet.o | 101 | obj-$(CONFIG_RIONET) += rionet.o |
| 97 | obj-$(CONFIG_SH_ETH) += sh_eth.o | 102 | obj-$(CONFIG_SH_ETH) += sh_eth.o |
| 103 | obj-$(CONFIG_STMMAC_ETH) += stmmac/ | ||
| 98 | 104 | ||
| 99 | # | 105 | # |
| 100 | # end link order section | 106 | # end link order section |
| 101 | # | 107 | # |
| 102 | 108 | ||
| 103 | obj-$(CONFIG_MII) += mii.o | ||
| 104 | obj-$(CONFIG_MDIO) += mdio.o | ||
| 105 | obj-$(CONFIG_PHYLIB) += phy/ | ||
| 106 | |||
| 107 | obj-$(CONFIG_SUNDANCE) += sundance.o | 109 | obj-$(CONFIG_SUNDANCE) += sundance.o |
| 108 | obj-$(CONFIG_HAMACHI) += hamachi.o | 110 | obj-$(CONFIG_HAMACHI) += hamachi.o |
| 109 | obj-$(CONFIG_NET) += Space.o loopback.o | 111 | obj-$(CONFIG_NET) += Space.o loopback.o |
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index 5f0b05c2d71f..d82a9a994753 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c | |||
| @@ -1209,7 +1209,8 @@ static int __devinit ace_init(struct net_device *dev) | |||
| 1209 | memset(ap->info, 0, sizeof(struct ace_info)); | 1209 | memset(ap->info, 0, sizeof(struct ace_info)); |
| 1210 | memset(ap->skb, 0, sizeof(struct ace_skb)); | 1210 | memset(ap->skb, 0, sizeof(struct ace_skb)); |
| 1211 | 1211 | ||
| 1212 | if (ace_load_firmware(dev)) | 1212 | ecode = ace_load_firmware(dev); |
| 1213 | if (ecode) | ||
| 1213 | goto init_error; | 1214 | goto init_error; |
| 1214 | 1215 | ||
| 1215 | ap->fw_running = 0; | 1216 | ap->fw_running = 0; |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 89876ade5e33..28a0eda92680 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
| @@ -243,15 +243,26 @@ static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) | |||
| 243 | 243 | ||
| 244 | int be_cmd_POST(struct be_adapter *adapter) | 244 | int be_cmd_POST(struct be_adapter *adapter) |
| 245 | { | 245 | { |
| 246 | u16 stage, error; | 246 | u16 stage; |
| 247 | int status, timeout = 0; | ||
| 247 | 248 | ||
| 248 | error = be_POST_stage_get(adapter, &stage); | 249 | do { |
| 249 | if (error || stage != POST_STAGE_ARMFW_RDY) { | 250 | status = be_POST_stage_get(adapter, &stage); |
| 250 | dev_err(&adapter->pdev->dev, "POST failed.\n"); | 251 | if (status) { |
| 251 | return -1; | 252 | dev_err(&adapter->pdev->dev, "POST error; stage=0x%x\n", |
| 252 | } | 253 | stage); |
| 254 | return -1; | ||
| 255 | } else if (stage != POST_STAGE_ARMFW_RDY) { | ||
| 256 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 257 | schedule_timeout(2 * HZ); | ||
| 258 | timeout += 2; | ||
| 259 | } else { | ||
| 260 | return 0; | ||
| 261 | } | ||
| 262 | } while (timeout < 20); | ||
| 253 | 263 | ||
| 254 | return 0; | 264 | dev_err(&adapter->pdev->dev, "POST timeout; stage=0x%x\n", stage); |
| 265 | return -1; | ||
| 255 | } | 266 | } |
| 256 | 267 | ||
| 257 | static inline void *embedded_payload(struct be_mcc_wrb *wrb) | 268 | static inline void *embedded_payload(struct be_mcc_wrb *wrb) |
| @@ -729,8 +740,8 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, | |||
| 729 | /* Create an rx filtering policy configuration on an i/f | 740 | /* Create an rx filtering policy configuration on an i/f |
| 730 | * Uses mbox | 741 | * Uses mbox |
| 731 | */ | 742 | */ |
| 732 | int be_cmd_if_create(struct be_adapter *adapter, u32 flags, u8 *mac, | 743 | int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, |
| 733 | bool pmac_invalid, u32 *if_handle, u32 *pmac_id) | 744 | u8 *mac, bool pmac_invalid, u32 *if_handle, u32 *pmac_id) |
| 734 | { | 745 | { |
| 735 | struct be_mcc_wrb *wrb; | 746 | struct be_mcc_wrb *wrb; |
| 736 | struct be_cmd_req_if_create *req; | 747 | struct be_cmd_req_if_create *req; |
| @@ -746,8 +757,8 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 flags, u8 *mac, | |||
| 746 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, | 757 | be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, |
| 747 | OPCODE_COMMON_NTWK_INTERFACE_CREATE, sizeof(*req)); | 758 | OPCODE_COMMON_NTWK_INTERFACE_CREATE, sizeof(*req)); |
| 748 | 759 | ||
| 749 | req->capability_flags = cpu_to_le32(flags); | 760 | req->capability_flags = cpu_to_le32(cap_flags); |
| 750 | req->enable_flags = cpu_to_le32(flags); | 761 | req->enable_flags = cpu_to_le32(en_flags); |
| 751 | req->pmac_invalid = pmac_invalid; | 762 | req->pmac_invalid = pmac_invalid; |
| 752 | if (!pmac_invalid) | 763 | if (!pmac_invalid) |
| 753 | memcpy(req->mac_addr, mac, ETH_ALEN); | 764 | memcpy(req->mac_addr, mac, ETH_ALEN); |
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index a86f917f85f4..49953787e41c 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h | |||
| @@ -720,8 +720,9 @@ extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, | |||
| 720 | extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, | 720 | extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, |
| 721 | u32 if_id, u32 *pmac_id); | 721 | u32 if_id, u32 *pmac_id); |
| 722 | extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id); | 722 | extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, u32 pmac_id); |
| 723 | extern int be_cmd_if_create(struct be_adapter *adapter, u32 if_flags, u8 *mac, | 723 | extern int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, |
| 724 | bool pmac_invalid, u32 *if_handle, u32 *pmac_id); | 724 | u32 en_flags, u8 *mac, bool pmac_invalid, |
| 725 | u32 *if_handle, u32 *pmac_id); | ||
| 725 | extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle); | 726 | extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle); |
| 726 | extern int be_cmd_eq_create(struct be_adapter *adapter, | 727 | extern int be_cmd_eq_create(struct be_adapter *adapter, |
| 727 | struct be_queue_info *eq, int eq_delay); | 728 | struct be_queue_info *eq, int eq_delay); |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 6d5e81f7046f..1f941f027718 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
| @@ -1620,19 +1620,22 @@ static int be_open(struct net_device *netdev) | |||
| 1620 | static int be_setup(struct be_adapter *adapter) | 1620 | static int be_setup(struct be_adapter *adapter) |
| 1621 | { | 1621 | { |
| 1622 | struct net_device *netdev = adapter->netdev; | 1622 | struct net_device *netdev = adapter->netdev; |
| 1623 | u32 if_flags; | 1623 | u32 cap_flags, en_flags; |
| 1624 | int status; | 1624 | int status; |
| 1625 | 1625 | ||
| 1626 | if_flags = BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_PROMISCUOUS | | 1626 | cap_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | |
| 1627 | BE_IF_FLAGS_MCAST_PROMISCUOUS | BE_IF_FLAGS_UNTAGGED | | 1627 | BE_IF_FLAGS_MCAST_PROMISCUOUS | |
| 1628 | BE_IF_FLAGS_PASS_L3L4_ERRORS; | 1628 | BE_IF_FLAGS_PROMISCUOUS | |
| 1629 | status = be_cmd_if_create(adapter, if_flags, netdev->dev_addr, | 1629 | BE_IF_FLAGS_PASS_L3L4_ERRORS; |
| 1630 | false/* pmac_invalid */, &adapter->if_handle, | 1630 | en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | |
| 1631 | &adapter->pmac_id); | 1631 | BE_IF_FLAGS_PASS_L3L4_ERRORS; |
| 1632 | |||
| 1633 | status = be_cmd_if_create(adapter, cap_flags, en_flags, | ||
| 1634 | netdev->dev_addr, false/* pmac_invalid */, | ||
| 1635 | &adapter->if_handle, &adapter->pmac_id); | ||
| 1632 | if (status != 0) | 1636 | if (status != 0) |
| 1633 | goto do_none; | 1637 | goto do_none; |
| 1634 | 1638 | ||
| 1635 | |||
| 1636 | status = be_tx_queues_create(adapter); | 1639 | status = be_tx_queues_create(adapter); |
| 1637 | if (status != 0) | 1640 | if (status != 0) |
| 1638 | goto if_destroy; | 1641 | goto if_destroy; |
| @@ -2055,6 +2058,10 @@ static int be_hw_up(struct be_adapter *adapter) | |||
| 2055 | if (status) | 2058 | if (status) |
| 2056 | return status; | 2059 | return status; |
| 2057 | 2060 | ||
| 2061 | status = be_cmd_reset_function(adapter); | ||
| 2062 | if (status) | ||
| 2063 | return status; | ||
| 2064 | |||
| 2058 | status = be_cmd_get_fw_ver(adapter, adapter->fw_ver); | 2065 | status = be_cmd_get_fw_ver(adapter, adapter->fw_ver); |
| 2059 | if (status) | 2066 | if (status) |
| 2060 | return status; | 2067 | return status; |
| @@ -2108,10 +2115,6 @@ static int __devinit be_probe(struct pci_dev *pdev, | |||
| 2108 | if (status) | 2115 | if (status) |
| 2109 | goto free_netdev; | 2116 | goto free_netdev; |
| 2110 | 2117 | ||
| 2111 | status = be_cmd_reset_function(adapter); | ||
| 2112 | if (status) | ||
| 2113 | goto ctrl_clean; | ||
| 2114 | |||
| 2115 | status = be_stats_init(adapter); | 2118 | status = be_stats_init(adapter); |
| 2116 | if (status) | 2119 | if (status) |
| 2117 | goto ctrl_clean; | 2120 | goto ctrl_clean; |
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c index 3373560405ba..9dd076a626a5 100644 --- a/drivers/net/can/sja1000/sja1000_of_platform.c +++ b/drivers/net/can/sja1000/sja1000_of_platform.c | |||
| @@ -213,6 +213,7 @@ static struct of_device_id __devinitdata sja1000_ofp_table[] = { | |||
| 213 | {.compatible = "nxp,sja1000"}, | 213 | {.compatible = "nxp,sja1000"}, |
| 214 | {}, | 214 | {}, |
| 215 | }; | 215 | }; |
| 216 | MODULE_DEVICE_TABLE(of, sja1000_ofp_table); | ||
| 216 | 217 | ||
| 217 | static struct of_platform_driver sja1000_ofp_driver = { | 218 | static struct of_platform_driver sja1000_ofp_driver = { |
| 218 | .owner = THIS_MODULE, | 219 | .owner = THIS_MODULE, |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 65a2d0ba64e2..f72c56dec33c 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
| @@ -333,6 +333,9 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1"; | |||
| 333 | #define EMAC_DM646X_MAC_EOI_C0_RXEN (0x01) | 333 | #define EMAC_DM646X_MAC_EOI_C0_RXEN (0x01) |
| 334 | #define EMAC_DM646X_MAC_EOI_C0_TXEN (0x02) | 334 | #define EMAC_DM646X_MAC_EOI_C0_TXEN (0x02) |
| 335 | 335 | ||
| 336 | /* EMAC Stats Clear Mask */ | ||
| 337 | #define EMAC_STATS_CLR_MASK (0xFFFFFFFF) | ||
| 338 | |||
| 336 | /** net_buf_obj: EMAC network bufferdata structure | 339 | /** net_buf_obj: EMAC network bufferdata structure |
| 337 | * | 340 | * |
| 338 | * EMAC network buffer data structure | 341 | * EMAC network buffer data structure |
| @@ -2548,40 +2551,49 @@ static int emac_dev_stop(struct net_device *ndev) | |||
| 2548 | static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev) | 2551 | static struct net_device_stats *emac_dev_getnetstats(struct net_device *ndev) |
| 2549 | { | 2552 | { |
| 2550 | struct emac_priv *priv = netdev_priv(ndev); | 2553 | struct emac_priv *priv = netdev_priv(ndev); |
| 2554 | u32 mac_control; | ||
| 2555 | u32 stats_clear_mask; | ||
| 2551 | 2556 | ||
| 2552 | /* update emac hardware stats and reset the registers*/ | 2557 | /* update emac hardware stats and reset the registers*/ |
| 2553 | 2558 | ||
| 2559 | mac_control = emac_read(EMAC_MACCONTROL); | ||
| 2560 | |||
| 2561 | if (mac_control & EMAC_MACCONTROL_GMIIEN) | ||
| 2562 | stats_clear_mask = EMAC_STATS_CLR_MASK; | ||
| 2563 | else | ||
| 2564 | stats_clear_mask = 0; | ||
| 2565 | |||
| 2554 | priv->net_dev_stats.multicast += emac_read(EMAC_RXMCASTFRAMES); | 2566 | priv->net_dev_stats.multicast += emac_read(EMAC_RXMCASTFRAMES); |
| 2555 | emac_write(EMAC_RXMCASTFRAMES, EMAC_ALL_MULTI_REG_VALUE); | 2567 | emac_write(EMAC_RXMCASTFRAMES, stats_clear_mask); |
| 2556 | 2568 | ||
| 2557 | priv->net_dev_stats.collisions += (emac_read(EMAC_TXCOLLISION) + | 2569 | priv->net_dev_stats.collisions += (emac_read(EMAC_TXCOLLISION) + |
| 2558 | emac_read(EMAC_TXSINGLECOLL) + | 2570 | emac_read(EMAC_TXSINGLECOLL) + |
| 2559 | emac_read(EMAC_TXMULTICOLL)); | 2571 | emac_read(EMAC_TXMULTICOLL)); |
| 2560 | emac_write(EMAC_TXCOLLISION, EMAC_ALL_MULTI_REG_VALUE); | 2572 | emac_write(EMAC_TXCOLLISION, stats_clear_mask); |
| 2561 | emac_write(EMAC_TXSINGLECOLL, EMAC_ALL_MULTI_REG_VALUE); | 2573 | emac_write(EMAC_TXSINGLECOLL, stats_clear_mask); |
| 2562 | emac_write(EMAC_TXMULTICOLL, EMAC_ALL_MULTI_REG_VALUE); | 2574 | emac_write(EMAC_TXMULTICOLL, stats_clear_mask); |
| 2563 | 2575 | ||
| 2564 | priv->net_dev_stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) + | 2576 | priv->net_dev_stats.rx_length_errors += (emac_read(EMAC_RXOVERSIZED) + |
| 2565 | emac_read(EMAC_RXJABBER) + | 2577 | emac_read(EMAC_RXJABBER) + |
| 2566 | emac_read(EMAC_RXUNDERSIZED)); | 2578 | emac_read(EMAC_RXUNDERSIZED)); |
| 2567 | emac_write(EMAC_RXOVERSIZED, EMAC_ALL_MULTI_REG_VALUE); | 2579 | emac_write(EMAC_RXOVERSIZED, stats_clear_mask); |
| 2568 | emac_write(EMAC_RXJABBER, EMAC_ALL_MULTI_REG_VALUE); | 2580 | emac_write(EMAC_RXJABBER, stats_clear_mask); |
| 2569 | emac_write(EMAC_RXUNDERSIZED, EMAC_ALL_MULTI_REG_VALUE); | 2581 | emac_write(EMAC_RXUNDERSIZED, stats_clear_mask); |
| 2570 | 2582 | ||
| 2571 | priv->net_dev_stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) + | 2583 | priv->net_dev_stats.rx_over_errors += (emac_read(EMAC_RXSOFOVERRUNS) + |
| 2572 | emac_read(EMAC_RXMOFOVERRUNS)); | 2584 | emac_read(EMAC_RXMOFOVERRUNS)); |
| 2573 | emac_write(EMAC_RXSOFOVERRUNS, EMAC_ALL_MULTI_REG_VALUE); | 2585 | emac_write(EMAC_RXSOFOVERRUNS, stats_clear_mask); |
| 2574 | emac_write(EMAC_RXMOFOVERRUNS, EMAC_ALL_MULTI_REG_VALUE); | 2586 | emac_write(EMAC_RXMOFOVERRUNS, stats_clear_mask); |
| 2575 | 2587 | ||
| 2576 | priv->net_dev_stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS); | 2588 | priv->net_dev_stats.rx_fifo_errors += emac_read(EMAC_RXDMAOVERRUNS); |
| 2577 | emac_write(EMAC_RXDMAOVERRUNS, EMAC_ALL_MULTI_REG_VALUE); | 2589 | emac_write(EMAC_RXDMAOVERRUNS, stats_clear_mask); |
| 2578 | 2590 | ||
| 2579 | priv->net_dev_stats.tx_carrier_errors += | 2591 | priv->net_dev_stats.tx_carrier_errors += |
| 2580 | emac_read(EMAC_TXCARRIERSENSE); | 2592 | emac_read(EMAC_TXCARRIERSENSE); |
| 2581 | emac_write(EMAC_TXCARRIERSENSE, EMAC_ALL_MULTI_REG_VALUE); | 2593 | emac_write(EMAC_TXCARRIERSENSE, stats_clear_mask); |
| 2582 | 2594 | ||
| 2583 | priv->net_dev_stats.tx_fifo_errors = emac_read(EMAC_TXUNDERRUN); | 2595 | priv->net_dev_stats.tx_fifo_errors = emac_read(EMAC_TXUNDERRUN); |
| 2584 | emac_write(EMAC_TXUNDERRUN, EMAC_ALL_MULTI_REG_VALUE); | 2596 | emac_write(EMAC_TXUNDERRUN, stats_clear_mask); |
| 2585 | 2597 | ||
| 2586 | return &priv->net_dev_stats; | 2598 | return &priv->net_dev_stats; |
| 2587 | } | 2599 | } |
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index 96f5b2a2d2c5..f7d9ac8324cb 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c | |||
| @@ -223,24 +223,25 @@ struct ethoc_bd { | |||
| 223 | u32 addr; | 223 | u32 addr; |
| 224 | }; | 224 | }; |
| 225 | 225 | ||
| 226 | static u32 ethoc_read(struct ethoc *dev, loff_t offset) | 226 | static inline u32 ethoc_read(struct ethoc *dev, loff_t offset) |
| 227 | { | 227 | { |
| 228 | return ioread32(dev->iobase + offset); | 228 | return ioread32(dev->iobase + offset); |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | static void ethoc_write(struct ethoc *dev, loff_t offset, u32 data) | 231 | static inline void ethoc_write(struct ethoc *dev, loff_t offset, u32 data) |
| 232 | { | 232 | { |
| 233 | iowrite32(data, dev->iobase + offset); | 233 | iowrite32(data, dev->iobase + offset); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | static void ethoc_read_bd(struct ethoc *dev, int index, struct ethoc_bd *bd) | 236 | static inline void ethoc_read_bd(struct ethoc *dev, int index, |
| 237 | struct ethoc_bd *bd) | ||
| 237 | { | 238 | { |
| 238 | loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd)); | 239 | loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd)); |
| 239 | bd->stat = ethoc_read(dev, offset + 0); | 240 | bd->stat = ethoc_read(dev, offset + 0); |
| 240 | bd->addr = ethoc_read(dev, offset + 4); | 241 | bd->addr = ethoc_read(dev, offset + 4); |
| 241 | } | 242 | } |
| 242 | 243 | ||
| 243 | static void ethoc_write_bd(struct ethoc *dev, int index, | 244 | static inline void ethoc_write_bd(struct ethoc *dev, int index, |
| 244 | const struct ethoc_bd *bd) | 245 | const struct ethoc_bd *bd) |
| 245 | { | 246 | { |
| 246 | loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd)); | 247 | loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd)); |
| @@ -248,33 +249,33 @@ static void ethoc_write_bd(struct ethoc *dev, int index, | |||
| 248 | ethoc_write(dev, offset + 4, bd->addr); | 249 | ethoc_write(dev, offset + 4, bd->addr); |
| 249 | } | 250 | } |
| 250 | 251 | ||
| 251 | static void ethoc_enable_irq(struct ethoc *dev, u32 mask) | 252 | static inline void ethoc_enable_irq(struct ethoc *dev, u32 mask) |
| 252 | { | 253 | { |
| 253 | u32 imask = ethoc_read(dev, INT_MASK); | 254 | u32 imask = ethoc_read(dev, INT_MASK); |
| 254 | imask |= mask; | 255 | imask |= mask; |
| 255 | ethoc_write(dev, INT_MASK, imask); | 256 | ethoc_write(dev, INT_MASK, imask); |
| 256 | } | 257 | } |
| 257 | 258 | ||
| 258 | static void ethoc_disable_irq(struct ethoc *dev, u32 mask) | 259 | static inline void ethoc_disable_irq(struct ethoc *dev, u32 mask) |
| 259 | { | 260 | { |
| 260 | u32 imask = ethoc_read(dev, INT_MASK); | 261 | u32 imask = ethoc_read(dev, INT_MASK); |
| 261 | imask &= ~mask; | 262 | imask &= ~mask; |
| 262 | ethoc_write(dev, INT_MASK, imask); | 263 | ethoc_write(dev, INT_MASK, imask); |
| 263 | } | 264 | } |
| 264 | 265 | ||
| 265 | static void ethoc_ack_irq(struct ethoc *dev, u32 mask) | 266 | static inline void ethoc_ack_irq(struct ethoc *dev, u32 mask) |
| 266 | { | 267 | { |
| 267 | ethoc_write(dev, INT_SOURCE, mask); | 268 | ethoc_write(dev, INT_SOURCE, mask); |
| 268 | } | 269 | } |
| 269 | 270 | ||
| 270 | static void ethoc_enable_rx_and_tx(struct ethoc *dev) | 271 | static inline void ethoc_enable_rx_and_tx(struct ethoc *dev) |
| 271 | { | 272 | { |
| 272 | u32 mode = ethoc_read(dev, MODER); | 273 | u32 mode = ethoc_read(dev, MODER); |
| 273 | mode |= MODER_RXEN | MODER_TXEN; | 274 | mode |= MODER_RXEN | MODER_TXEN; |
| 274 | ethoc_write(dev, MODER, mode); | 275 | ethoc_write(dev, MODER, mode); |
| 275 | } | 276 | } |
| 276 | 277 | ||
| 277 | static void ethoc_disable_rx_and_tx(struct ethoc *dev) | 278 | static inline void ethoc_disable_rx_and_tx(struct ethoc *dev) |
| 278 | { | 279 | { |
| 279 | u32 mode = ethoc_read(dev, MODER); | 280 | u32 mode = ethoc_read(dev, MODER); |
| 280 | mode &= ~(MODER_RXEN | MODER_TXEN); | 281 | mode &= ~(MODER_RXEN | MODER_TXEN); |
| @@ -508,7 +509,7 @@ static irqreturn_t ethoc_interrupt(int irq, void *dev_id) | |||
| 508 | return IRQ_NONE; | 509 | return IRQ_NONE; |
| 509 | } | 510 | } |
| 510 | 511 | ||
| 511 | ethoc_ack_irq(priv, INT_MASK_ALL); | 512 | ethoc_ack_irq(priv, pending); |
| 512 | 513 | ||
| 513 | if (pending & INT_MASK_BUSY) { | 514 | if (pending & INT_MASK_BUSY) { |
| 514 | dev_err(&dev->dev, "packet dropped\n"); | 515 | dev_err(&dev->dev, "packet dropped\n"); |
| @@ -664,7 +665,8 @@ static int ethoc_open(struct net_device *dev) | |||
| 664 | return ret; | 665 | return ret; |
| 665 | 666 | ||
| 666 | /* calculate the number of TX/RX buffers, maximum 128 supported */ | 667 | /* calculate the number of TX/RX buffers, maximum 128 supported */ |
| 667 | num_bd = min(128, (dev->mem_end - dev->mem_start + 1) / ETHOC_BUFSIZ); | 668 | num_bd = min_t(unsigned int, |
| 669 | 128, (dev->mem_end - dev->mem_start + 1) / ETHOC_BUFSIZ); | ||
| 668 | priv->num_tx = max(min_tx, num_bd / 4); | 670 | priv->num_tx = max(min_tx, num_bd / 4); |
| 669 | priv->num_rx = num_bd - priv->num_tx; | 671 | priv->num_rx = num_bd - priv->num_tx; |
| 670 | ethoc_write(priv, TX_BD_NUM, priv->num_tx); | 672 | ethoc_write(priv, TX_BD_NUM, priv->num_tx); |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 29234380e6c6..16a1d58419d9 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
| @@ -1654,7 +1654,7 @@ static const struct net_device_ops fec_netdev_ops = { | |||
| 1654 | * | 1654 | * |
| 1655 | * index is only used in legacy code | 1655 | * index is only used in legacy code |
| 1656 | */ | 1656 | */ |
| 1657 | int __init fec_enet_init(struct net_device *dev, int index) | 1657 | static int fec_enet_init(struct net_device *dev, int index) |
| 1658 | { | 1658 | { |
| 1659 | struct fec_enet_private *fep = netdev_priv(dev); | 1659 | struct fec_enet_private *fep = netdev_priv(dev); |
| 1660 | struct bufdesc *cbd_base; | 1660 | struct bufdesc *cbd_base; |
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index c40113f58963..66dace6d324f 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c | |||
| @@ -759,12 +759,6 @@ static void mpc52xx_fec_reset(struct net_device *dev) | |||
| 759 | 759 | ||
| 760 | mpc52xx_fec_hw_init(dev); | 760 | mpc52xx_fec_hw_init(dev); |
| 761 | 761 | ||
| 762 | if (priv->phydev) { | ||
| 763 | phy_stop(priv->phydev); | ||
| 764 | phy_write(priv->phydev, MII_BMCR, BMCR_RESET); | ||
| 765 | phy_start(priv->phydev); | ||
| 766 | } | ||
| 767 | |||
| 768 | bcom_fec_rx_reset(priv->rx_dmatsk); | 762 | bcom_fec_rx_reset(priv->rx_dmatsk); |
| 769 | bcom_fec_tx_reset(priv->tx_dmatsk); | 763 | bcom_fec_tx_reset(priv->tx_dmatsk); |
| 770 | 764 | ||
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c index 31e6d62b785d..ee0f3c6d3f88 100644 --- a/drivers/net/fec_mpc52xx_phy.c +++ b/drivers/net/fec_mpc52xx_phy.c | |||
| @@ -155,6 +155,7 @@ static struct of_device_id mpc52xx_fec_mdio_match[] = { | |||
| 155 | { .compatible = "mpc5200b-fec-phy", }, | 155 | { .compatible = "mpc5200b-fec-phy", }, |
| 156 | {} | 156 | {} |
| 157 | }; | 157 | }; |
| 158 | MODULE_DEVICE_TABLE(of, mpc52xx_fec_mdio_match); | ||
| 158 | 159 | ||
| 159 | struct of_platform_driver mpc52xx_fec_mdio_driver = { | 160 | struct of_platform_driver mpc52xx_fec_mdio_driver = { |
| 160 | .name = "mpc5200b-fec-phy", | 161 | .name = "mpc5200b-fec-phy", |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 2bc2d2b20644..ec2f5034457f 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
| @@ -1110,6 +1110,7 @@ static struct of_device_id fs_enet_match[] = { | |||
| 1110 | #endif | 1110 | #endif |
| 1111 | {} | 1111 | {} |
| 1112 | }; | 1112 | }; |
| 1113 | MODULE_DEVICE_TABLE(of, fs_enet_match); | ||
| 1113 | 1114 | ||
| 1114 | static struct of_platform_driver fs_enet_driver = { | 1115 | static struct of_platform_driver fs_enet_driver = { |
| 1115 | .name = "fs_enet", | 1116 | .name = "fs_enet", |
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c index 93b481b0e3c7..24ff9f43a62b 100644 --- a/drivers/net/fs_enet/mii-bitbang.c +++ b/drivers/net/fs_enet/mii-bitbang.c | |||
| @@ -221,6 +221,7 @@ static struct of_device_id fs_enet_mdio_bb_match[] = { | |||
| 221 | }, | 221 | }, |
| 222 | {}, | 222 | {}, |
| 223 | }; | 223 | }; |
| 224 | MODULE_DEVICE_TABLE(of, fs_enet_mdio_bb_match); | ||
| 224 | 225 | ||
| 225 | static struct of_platform_driver fs_enet_bb_mdio_driver = { | 226 | static struct of_platform_driver fs_enet_bb_mdio_driver = { |
| 226 | .name = "fsl-bb-mdio", | 227 | .name = "fsl-bb-mdio", |
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c index a2d69c1cd07e..96eba4280c5c 100644 --- a/drivers/net/fs_enet/mii-fec.c +++ b/drivers/net/fs_enet/mii-fec.c | |||
| @@ -219,6 +219,7 @@ static struct of_device_id fs_enet_mdio_fec_match[] = { | |||
| 219 | #endif | 219 | #endif |
| 220 | {}, | 220 | {}, |
| 221 | }; | 221 | }; |
| 222 | MODULE_DEVICE_TABLE(of, fs_enet_mdio_fec_match); | ||
| 222 | 223 | ||
| 223 | static struct of_platform_driver fs_enet_fec_mdio_driver = { | 224 | static struct of_platform_driver fs_enet_fec_mdio_driver = { |
| 224 | .name = "fsl-fec-mdio", | 225 | .name = "fsl-fec-mdio", |
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c index d167090248e2..6ac464866972 100644 --- a/drivers/net/fsl_pq_mdio.c +++ b/drivers/net/fsl_pq_mdio.c | |||
| @@ -407,6 +407,7 @@ static struct of_device_id fsl_pq_mdio_match[] = { | |||
| 407 | }, | 407 | }, |
| 408 | {}, | 408 | {}, |
| 409 | }; | 409 | }; |
| 410 | MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match); | ||
| 410 | 411 | ||
| 411 | static struct of_platform_driver fsl_pq_mdio_driver = { | 412 | static struct of_platform_driver fsl_pq_mdio_driver = { |
| 412 | .name = "fsl-pq_mdio", | 413 | .name = "fsl-pq_mdio", |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 1e5289ffef6f..5bf31f1509c9 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -2325,9 +2325,6 @@ static irqreturn_t gfar_error(int irq, void *dev_id) | |||
| 2325 | return IRQ_HANDLED; | 2325 | return IRQ_HANDLED; |
| 2326 | } | 2326 | } |
| 2327 | 2327 | ||
| 2328 | /* work with hotplug and coldplug */ | ||
| 2329 | MODULE_ALIAS("platform:fsl-gianfar"); | ||
| 2330 | |||
| 2331 | static struct of_device_id gfar_match[] = | 2328 | static struct of_device_id gfar_match[] = |
| 2332 | { | 2329 | { |
| 2333 | { | 2330 | { |
| @@ -2336,6 +2333,7 @@ static struct of_device_id gfar_match[] = | |||
| 2336 | }, | 2333 | }, |
| 2337 | {}, | 2334 | {}, |
| 2338 | }; | 2335 | }; |
| 2336 | MODULE_DEVICE_TABLE(of, gfar_match); | ||
| 2339 | 2337 | ||
| 2340 | /* Structure for a device driver */ | 2338 | /* Structure for a device driver */ |
| 2341 | static struct of_platform_driver gfar_driver = { | 2339 | static struct of_platform_driver gfar_driver = { |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index 89c82c5e63e4..3fae87559791 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | * | 24 | * |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #include <linux/module.h> | ||
| 27 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
| 28 | #include <linux/string.h> | 29 | #include <linux/string.h> |
| 29 | #include <linux/errno.h> | 30 | #include <linux/errno.h> |
| @@ -443,7 +444,7 @@ static u32 __emac_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_s | |||
| 443 | ret |= EMAC_MR1_TFS_2K; | 444 | ret |= EMAC_MR1_TFS_2K; |
| 444 | break; | 445 | break; |
| 445 | default: | 446 | default: |
| 446 | printk(KERN_WARNING "%s: Unknown Rx FIFO size %d\n", | 447 | printk(KERN_WARNING "%s: Unknown Tx FIFO size %d\n", |
| 447 | dev->ndev->name, tx_size); | 448 | dev->ndev->name, tx_size); |
| 448 | } | 449 | } |
| 449 | 450 | ||
| @@ -470,6 +471,9 @@ static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_ | |||
| 470 | DBG2(dev, "__emac4_calc_base_mr1" NL); | 471 | DBG2(dev, "__emac4_calc_base_mr1" NL); |
| 471 | 472 | ||
| 472 | switch(tx_size) { | 473 | switch(tx_size) { |
| 474 | case 16384: | ||
| 475 | ret |= EMAC4_MR1_TFS_16K; | ||
| 476 | break; | ||
| 473 | case 4096: | 477 | case 4096: |
| 474 | ret |= EMAC4_MR1_TFS_4K; | 478 | ret |= EMAC4_MR1_TFS_4K; |
| 475 | break; | 479 | break; |
| @@ -477,7 +481,7 @@ static u32 __emac4_calc_base_mr1(struct emac_instance *dev, int tx_size, int rx_ | |||
| 477 | ret |= EMAC4_MR1_TFS_2K; | 481 | ret |= EMAC4_MR1_TFS_2K; |
| 478 | break; | 482 | break; |
| 479 | default: | 483 | default: |
| 480 | printk(KERN_WARNING "%s: Unknown Rx FIFO size %d\n", | 484 | printk(KERN_WARNING "%s: Unknown Tx FIFO size %d\n", |
| 481 | dev->ndev->name, tx_size); | 485 | dev->ndev->name, tx_size); |
| 482 | } | 486 | } |
| 483 | 487 | ||
| @@ -2985,6 +2989,7 @@ static struct of_device_id emac_match[] = | |||
| 2985 | }, | 2989 | }, |
| 2986 | {}, | 2990 | {}, |
| 2987 | }; | 2991 | }; |
| 2992 | MODULE_DEVICE_TABLE(of, emac_match); | ||
| 2988 | 2993 | ||
| 2989 | static struct of_platform_driver emac_driver = { | 2994 | static struct of_platform_driver emac_driver = { |
| 2990 | .name = "emac", | 2995 | .name = "emac", |
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h index 0afc2cf5c52b..d34adf99fc6a 100644 --- a/drivers/net/ibm_newemac/emac.h +++ b/drivers/net/ibm_newemac/emac.h | |||
| @@ -153,6 +153,7 @@ struct emac_regs { | |||
| 153 | #define EMAC4_MR1_RFS_16K 0x00280000 | 153 | #define EMAC4_MR1_RFS_16K 0x00280000 |
| 154 | #define EMAC4_MR1_TFS_2K 0x00020000 | 154 | #define EMAC4_MR1_TFS_2K 0x00020000 |
| 155 | #define EMAC4_MR1_TFS_4K 0x00030000 | 155 | #define EMAC4_MR1_TFS_4K 0x00030000 |
| 156 | #define EMAC4_MR1_TFS_16K 0x00050000 | ||
| 156 | #define EMAC4_MR1_TR 0x00008000 | 157 | #define EMAC4_MR1_TR 0x00008000 |
| 157 | #define EMAC4_MR1_MWSW_001 0x00001000 | 158 | #define EMAC4_MR1_MWSW_001 0x00001000 |
| 158 | #define EMAC4_MR1_JPSM 0x00000800 | 159 | #define EMAC4_MR1_JPSM 0x00000800 |
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index 38bf7cf2256d..c412e8026173 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c | |||
| @@ -232,8 +232,11 @@ static int sa1100_irda_startup(struct sa1100_irda *si) | |||
| 232 | /* | 232 | /* |
| 233 | * Ensure that the ports for this device are setup correctly. | 233 | * Ensure that the ports for this device are setup correctly. |
| 234 | */ | 234 | */ |
| 235 | if (si->pdata->startup) | 235 | if (si->pdata->startup) { |
| 236 | si->pdata->startup(si->dev); | 236 | ret = si->pdata->startup(si->dev); |
| 237 | if (ret) | ||
| 238 | return ret; | ||
| 239 | } | ||
| 237 | 240 | ||
| 238 | /* | 241 | /* |
| 239 | * Configure PPC for IRDA - we want to drive TXD2 low. | 242 | * Configure PPC for IRDA - we want to drive TXD2 low. |
diff --git a/drivers/net/ixp2000/enp2611.c b/drivers/net/ixp2000/enp2611.c index b02a981c87a8..34a6cfd17930 100644 --- a/drivers/net/ixp2000/enp2611.c +++ b/drivers/net/ixp2000/enp2611.c | |||
| @@ -119,24 +119,9 @@ static struct ixp2400_msf_parameters enp2611_msf_parameters = | |||
| 119 | } | 119 | } |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | struct enp2611_ixpdev_priv | ||
| 123 | { | ||
| 124 | struct ixpdev_priv ixpdev_priv; | ||
| 125 | struct net_device_stats stats; | ||
| 126 | }; | ||
| 127 | |||
| 128 | static struct net_device *nds[3]; | 122 | static struct net_device *nds[3]; |
| 129 | static struct timer_list link_check_timer; | 123 | static struct timer_list link_check_timer; |
| 130 | 124 | ||
| 131 | static struct net_device_stats *enp2611_get_stats(struct net_device *dev) | ||
| 132 | { | ||
| 133 | struct enp2611_ixpdev_priv *ip = netdev_priv(dev); | ||
| 134 | |||
| 135 | pm3386_get_stats(ip->ixpdev_priv.channel, &(ip->stats)); | ||
| 136 | |||
| 137 | return &(ip->stats); | ||
| 138 | } | ||
| 139 | |||
| 140 | /* @@@ Poll the SFP moddef0 line too. */ | 125 | /* @@@ Poll the SFP moddef0 line too. */ |
| 141 | /* @@@ Try to use the pm3386 DOOL interrupt as well. */ | 126 | /* @@@ Try to use the pm3386 DOOL interrupt as well. */ |
| 142 | static void enp2611_check_link_status(unsigned long __dummy) | 127 | static void enp2611_check_link_status(unsigned long __dummy) |
| @@ -203,14 +188,13 @@ static int __init enp2611_init_module(void) | |||
| 203 | 188 | ||
| 204 | ports = pm3386_port_count(); | 189 | ports = pm3386_port_count(); |
| 205 | for (i = 0; i < ports; i++) { | 190 | for (i = 0; i < ports; i++) { |
| 206 | nds[i] = ixpdev_alloc(i, sizeof(struct enp2611_ixpdev_priv)); | 191 | nds[i] = ixpdev_alloc(i, sizeof(struct ixpdev_priv)); |
| 207 | if (nds[i] == NULL) { | 192 | if (nds[i] == NULL) { |
| 208 | while (--i >= 0) | 193 | while (--i >= 0) |
| 209 | free_netdev(nds[i]); | 194 | free_netdev(nds[i]); |
| 210 | return -ENOMEM; | 195 | return -ENOMEM; |
| 211 | } | 196 | } |
| 212 | 197 | ||
| 213 | nds[i]->get_stats = enp2611_get_stats; | ||
| 214 | pm3386_init_port(i); | 198 | pm3386_init_port(i); |
| 215 | pm3386_get_mac(i, nds[i]->dev_addr); | 199 | pm3386_get_mac(i, nds[i]->dev_addr); |
| 216 | } | 200 | } |
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c index 127243461a51..9aee0cc922c9 100644 --- a/drivers/net/ixp2000/ixpdev.c +++ b/drivers/net/ixp2000/ixpdev.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include "ixp2400_tx.ucode" | 21 | #include "ixp2400_tx.ucode" |
| 22 | #include "ixpdev_priv.h" | 22 | #include "ixpdev_priv.h" |
| 23 | #include "ixpdev.h" | 23 | #include "ixpdev.h" |
| 24 | #include "pm3386.h" | ||
| 24 | 25 | ||
| 25 | #define DRV_MODULE_VERSION "0.2" | 26 | #define DRV_MODULE_VERSION "0.2" |
| 26 | 27 | ||
| @@ -271,6 +272,15 @@ static int ixpdev_close(struct net_device *dev) | |||
| 271 | return 0; | 272 | return 0; |
| 272 | } | 273 | } |
| 273 | 274 | ||
| 275 | static struct net_device_stats *ixpdev_get_stats(struct net_device *dev) | ||
| 276 | { | ||
| 277 | struct ixpdev_priv *ip = netdev_priv(dev); | ||
| 278 | |||
| 279 | pm3386_get_stats(ip->channel, &(dev->stats)); | ||
| 280 | |||
| 281 | return &(dev->stats); | ||
| 282 | } | ||
| 283 | |||
| 274 | static const struct net_device_ops ixpdev_netdev_ops = { | 284 | static const struct net_device_ops ixpdev_netdev_ops = { |
| 275 | .ndo_open = ixpdev_open, | 285 | .ndo_open = ixpdev_open, |
| 276 | .ndo_stop = ixpdev_close, | 286 | .ndo_stop = ixpdev_close, |
| @@ -278,6 +288,7 @@ static const struct net_device_ops ixpdev_netdev_ops = { | |||
| 278 | .ndo_change_mtu = eth_change_mtu, | 288 | .ndo_change_mtu = eth_change_mtu, |
| 279 | .ndo_validate_addr = eth_validate_addr, | 289 | .ndo_validate_addr = eth_validate_addr, |
| 280 | .ndo_set_mac_address = eth_mac_addr, | 290 | .ndo_set_mac_address = eth_mac_addr, |
| 291 | .ndo_get_stats = ixpdev_get_stats, | ||
| 281 | #ifdef CONFIG_NET_POLL_CONTROLLER | 292 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 282 | .ndo_poll_controller = ixpdev_poll_controller, | 293 | .ndo_poll_controller = ixpdev_poll_controller, |
| 283 | #endif | 294 | #endif |
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c index 237835864357..a23f739d222f 100644 --- a/drivers/net/ks8851.c +++ b/drivers/net/ks8851.c | |||
| @@ -171,6 +171,36 @@ static void ks8851_wrreg16(struct ks8851_net *ks, unsigned reg, unsigned val) | |||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | /** | 173 | /** |
| 174 | * ks8851_wrreg8 - write 8bit register value to chip | ||
| 175 | * @ks: The chip state | ||
| 176 | * @reg: The register address | ||
| 177 | * @val: The value to write | ||
| 178 | * | ||
| 179 | * Issue a write to put the value @val into the register specified in @reg. | ||
| 180 | */ | ||
| 181 | static void ks8851_wrreg8(struct ks8851_net *ks, unsigned reg, unsigned val) | ||
| 182 | { | ||
| 183 | struct spi_transfer *xfer = &ks->spi_xfer1; | ||
| 184 | struct spi_message *msg = &ks->spi_msg1; | ||
| 185 | __le16 txb[2]; | ||
| 186 | int ret; | ||
| 187 | int bit; | ||
| 188 | |||
| 189 | bit = 1 << (reg & 3); | ||
| 190 | |||
| 191 | txb[0] = cpu_to_le16(MK_OP(bit, reg) | KS_SPIOP_WR); | ||
| 192 | txb[1] = val; | ||
| 193 | |||
| 194 | xfer->tx_buf = txb; | ||
| 195 | xfer->rx_buf = NULL; | ||
| 196 | xfer->len = 3; | ||
| 197 | |||
| 198 | ret = spi_sync(ks->spidev, msg); | ||
| 199 | if (ret < 0) | ||
| 200 | ks_err(ks, "spi_sync() failed\n"); | ||
| 201 | } | ||
| 202 | |||
| 203 | /** | ||
| 174 | * ks8851_rx_1msg - select whether to use one or two messages for spi read | 204 | * ks8851_rx_1msg - select whether to use one or two messages for spi read |
| 175 | * @ks: The device structure | 205 | * @ks: The device structure |
| 176 | * | 206 | * |
| @@ -322,13 +352,12 @@ static void ks8851_soft_reset(struct ks8851_net *ks, unsigned op) | |||
| 322 | static int ks8851_write_mac_addr(struct net_device *dev) | 352 | static int ks8851_write_mac_addr(struct net_device *dev) |
| 323 | { | 353 | { |
| 324 | struct ks8851_net *ks = netdev_priv(dev); | 354 | struct ks8851_net *ks = netdev_priv(dev); |
| 325 | u16 *mcp = (u16 *)dev->dev_addr; | 355 | int i; |
| 326 | 356 | ||
| 327 | mutex_lock(&ks->lock); | 357 | mutex_lock(&ks->lock); |
| 328 | 358 | ||
| 329 | ks8851_wrreg16(ks, KS_MARL, mcp[0]); | 359 | for (i = 0; i < ETH_ALEN; i++) |
| 330 | ks8851_wrreg16(ks, KS_MARM, mcp[1]); | 360 | ks8851_wrreg8(ks, KS_MAR(i), dev->dev_addr[i]); |
| 331 | ks8851_wrreg16(ks, KS_MARH, mcp[2]); | ||
| 332 | 361 | ||
| 333 | mutex_unlock(&ks->lock); | 362 | mutex_unlock(&ks->lock); |
| 334 | 363 | ||
| @@ -951,7 +980,7 @@ static void ks8851_set_rx_mode(struct net_device *dev) | |||
| 951 | mcptr = mcptr->next; | 980 | mcptr = mcptr->next; |
| 952 | } | 981 | } |
| 953 | 982 | ||
| 954 | rxctrl.rxcr1 = RXCR1_RXME | RXCR1_RXAE | RXCR1_RXPAFMA; | 983 | rxctrl.rxcr1 = RXCR1_RXME | RXCR1_RXPAFMA; |
| 955 | } else { | 984 | } else { |
| 956 | /* just accept broadcast / unicast */ | 985 | /* just accept broadcast / unicast */ |
| 957 | rxctrl.rxcr1 = RXCR1_RXPAFMA; | 986 | rxctrl.rxcr1 = RXCR1_RXPAFMA; |
| @@ -1239,6 +1268,9 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
| 1239 | ndev->netdev_ops = &ks8851_netdev_ops; | 1268 | ndev->netdev_ops = &ks8851_netdev_ops; |
| 1240 | ndev->irq = spi->irq; | 1269 | ndev->irq = spi->irq; |
| 1241 | 1270 | ||
| 1271 | /* issue a global soft reset to reset the device. */ | ||
| 1272 | ks8851_soft_reset(ks, GRR_GSR); | ||
| 1273 | |||
| 1242 | /* simple check for a valid chip being connected to the bus */ | 1274 | /* simple check for a valid chip being connected to the bus */ |
| 1243 | 1275 | ||
| 1244 | if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { | 1276 | if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { |
diff --git a/drivers/net/ks8851.h b/drivers/net/ks8851.h index 85abe147afbf..f52c312cc356 100644 --- a/drivers/net/ks8851.h +++ b/drivers/net/ks8851.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #define CCR_32PIN (1 << 0) | 16 | #define CCR_32PIN (1 << 0) |
| 17 | 17 | ||
| 18 | /* MAC address registers */ | 18 | /* MAC address registers */ |
| 19 | #define KS_MAR(_m) 0x15 - (_m) | ||
| 19 | #define KS_MARL 0x10 | 20 | #define KS_MARL 0x10 |
| 20 | #define KS_MARM 0x12 | 21 | #define KS_MARM 0x12 |
| 21 | #define KS_MARH 0x14 | 22 | #define KS_MARH 0x14 |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 9b9eab107704..7fc15e9e8adb 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
| @@ -595,7 +595,8 @@ netxen_setup_pci_map(struct netxen_adapter *adapter) | |||
| 595 | void __iomem *mem_ptr2 = NULL; | 595 | void __iomem *mem_ptr2 = NULL; |
| 596 | void __iomem *db_ptr = NULL; | 596 | void __iomem *db_ptr = NULL; |
| 597 | 597 | ||
| 598 | unsigned long mem_base, mem_len, db_base, db_len = 0, pci_len0 = 0; | 598 | resource_size_t mem_base, db_base; |
| 599 | unsigned long mem_len, db_len = 0, pci_len0 = 0; | ||
| 599 | 600 | ||
| 600 | struct pci_dev *pdev = adapter->pdev; | 601 | struct pci_dev *pdev = adapter->pdev; |
| 601 | int pci_func = adapter->ahw.pci_func; | 602 | int pci_func = adapter->ahw.pci_func; |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index f9364d0678f2..d6c7ac68f6ea 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
| @@ -3545,7 +3545,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, | |||
| 3545 | rp->rcr_index = index; | 3545 | rp->rcr_index = index; |
| 3546 | 3546 | ||
| 3547 | skb_reserve(skb, NET_IP_ALIGN); | 3547 | skb_reserve(skb, NET_IP_ALIGN); |
| 3548 | __pskb_pull_tail(skb, min(len, NIU_RXPULL_MAX)); | 3548 | __pskb_pull_tail(skb, min(len, VLAN_ETH_HLEN)); |
| 3549 | 3549 | ||
| 3550 | rp->rx_packets++; | 3550 | rp->rx_packets++; |
| 3551 | rp->rx_bytes += skb->len; | 3551 | rp->rx_bytes += skb->len; |
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index ee8ad3e180dd..b58965a2b3ae 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
| @@ -251,6 +251,7 @@ static void el3_tx_timeout(struct net_device *dev); | |||
| 251 | static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 251 | static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
| 252 | static const struct ethtool_ops netdev_ethtool_ops; | 252 | static const struct ethtool_ops netdev_ethtool_ops; |
| 253 | static void set_rx_mode(struct net_device *dev); | 253 | static void set_rx_mode(struct net_device *dev); |
| 254 | static void set_multicast_list(struct net_device *dev); | ||
| 254 | 255 | ||
| 255 | static void tc574_detach(struct pcmcia_device *p_dev); | 256 | static void tc574_detach(struct pcmcia_device *p_dev); |
| 256 | 257 | ||
| @@ -266,7 +267,7 @@ static const struct net_device_ops el3_netdev_ops = { | |||
| 266 | .ndo_tx_timeout = el3_tx_timeout, | 267 | .ndo_tx_timeout = el3_tx_timeout, |
| 267 | .ndo_get_stats = el3_get_stats, | 268 | .ndo_get_stats = el3_get_stats, |
| 268 | .ndo_do_ioctl = el3_ioctl, | 269 | .ndo_do_ioctl = el3_ioctl, |
| 269 | .ndo_set_multicast_list = set_rx_mode, | 270 | .ndo_set_multicast_list = set_multicast_list, |
| 270 | .ndo_change_mtu = eth_change_mtu, | 271 | .ndo_change_mtu = eth_change_mtu, |
| 271 | .ndo_set_mac_address = eth_mac_addr, | 272 | .ndo_set_mac_address = eth_mac_addr, |
| 272 | .ndo_validate_addr = eth_validate_addr, | 273 | .ndo_validate_addr = eth_validate_addr, |
| @@ -1161,6 +1162,16 @@ static void set_rx_mode(struct net_device *dev) | |||
| 1161 | outw(SetRxFilter | RxStation | RxBroadcast, ioaddr + EL3_CMD); | 1162 | outw(SetRxFilter | RxStation | RxBroadcast, ioaddr + EL3_CMD); |
| 1162 | } | 1163 | } |
| 1163 | 1164 | ||
| 1165 | static void set_multicast_list(struct net_device *dev) | ||
| 1166 | { | ||
| 1167 | struct el3_private *lp = netdev_priv(dev); | ||
| 1168 | unsigned long flags; | ||
| 1169 | |||
| 1170 | spin_lock_irqsave(&lp->window_lock, flags); | ||
| 1171 | set_rx_mode(dev); | ||
| 1172 | spin_unlock_irqrestore(&lp->window_lock, flags); | ||
| 1173 | } | ||
| 1174 | |||
| 1164 | static int el3_close(struct net_device *dev) | 1175 | static int el3_close(struct net_device *dev) |
| 1165 | { | 1176 | { |
| 1166 | unsigned int ioaddr = dev->base_addr; | 1177 | unsigned int ioaddr = dev->base_addr; |
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c index 250e10f2c35b..8659d341e769 100644 --- a/drivers/net/phy/mdio-gpio.c +++ b/drivers/net/phy/mdio-gpio.c | |||
| @@ -238,6 +238,7 @@ static struct of_device_id mdio_ofgpio_match[] = { | |||
| 238 | }, | 238 | }, |
| 239 | {}, | 239 | {}, |
| 240 | }; | 240 | }; |
| 241 | MODULE_DEVICE_TABLE(of, mdio_ofgpio_match); | ||
| 241 | 242 | ||
| 242 | static struct of_platform_driver mdio_ofgpio_driver = { | 243 | static struct of_platform_driver mdio_ofgpio_driver = { |
| 243 | .name = "mdio-gpio", | 244 | .name = "mdio-gpio", |
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index 3ec6e85587a2..e7285f01bd04 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
| @@ -803,6 +803,12 @@ enum { | |||
| 803 | MB_CMD_SET_PORT_CFG = 0x00000122, | 803 | MB_CMD_SET_PORT_CFG = 0x00000122, |
| 804 | MB_CMD_GET_PORT_CFG = 0x00000123, | 804 | MB_CMD_GET_PORT_CFG = 0x00000123, |
| 805 | MB_CMD_GET_LINK_STS = 0x00000124, | 805 | MB_CMD_GET_LINK_STS = 0x00000124, |
| 806 | MB_CMD_SET_MGMNT_TFK_CTL = 0x00000160, /* Set Mgmnt Traffic Control */ | ||
| 807 | MB_SET_MPI_TFK_STOP = (1 << 0), | ||
| 808 | MB_SET_MPI_TFK_RESUME = (1 << 1), | ||
| 809 | MB_CMD_GET_MGMNT_TFK_CTL = 0x00000161, /* Get Mgmnt Traffic Control */ | ||
| 810 | MB_GET_MPI_TFK_STOPPED = (1 << 0), | ||
| 811 | MB_GET_MPI_TFK_FIFO_EMPTY = (1 << 1), | ||
| 806 | 812 | ||
| 807 | /* Mailbox Command Status. */ | 813 | /* Mailbox Command Status. */ |
| 808 | MB_CMD_STS_GOOD = 0x00004000, /* Success. */ | 814 | MB_CMD_STS_GOOD = 0x00004000, /* Success. */ |
| @@ -1168,7 +1174,7 @@ struct ricb { | |||
| 1168 | #define RSS_RI6 0x40 | 1174 | #define RSS_RI6 0x40 |
| 1169 | #define RSS_RT6 0x80 | 1175 | #define RSS_RT6 0x80 |
| 1170 | __le16 mask; | 1176 | __le16 mask; |
| 1171 | __le32 hash_cq_id[256]; | 1177 | u8 hash_cq_id[1024]; |
| 1172 | __le32 ipv6_hash_key[10]; | 1178 | __le32 ipv6_hash_key[10]; |
| 1173 | __le32 ipv4_hash_key[4]; | 1179 | __le32 ipv4_hash_key[4]; |
| 1174 | } __attribute((packed)); | 1180 | } __attribute((packed)); |
| @@ -1606,6 +1612,8 @@ int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data); | |||
| 1606 | int ql_mb_about_fw(struct ql_adapter *qdev); | 1612 | int ql_mb_about_fw(struct ql_adapter *qdev); |
| 1607 | void ql_link_on(struct ql_adapter *qdev); | 1613 | void ql_link_on(struct ql_adapter *qdev); |
| 1608 | void ql_link_off(struct ql_adapter *qdev); | 1614 | void ql_link_off(struct ql_adapter *qdev); |
| 1615 | int ql_mb_set_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 control); | ||
| 1616 | int ql_wait_fifo_empty(struct ql_adapter *qdev); | ||
| 1609 | 1617 | ||
| 1610 | #if 1 | 1618 | #if 1 |
| 1611 | #define QL_ALL_DUMP | 1619 | #define QL_ALL_DUMP |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 61680715cde0..48b45df85ec9 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
| @@ -320,6 +320,37 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type, | |||
| 320 | 320 | ||
| 321 | switch (type) { | 321 | switch (type) { |
| 322 | case MAC_ADDR_TYPE_MULTI_MAC: | 322 | case MAC_ADDR_TYPE_MULTI_MAC: |
| 323 | { | ||
| 324 | u32 upper = (addr[0] << 8) | addr[1]; | ||
| 325 | u32 lower = (addr[2] << 24) | (addr[3] << 16) | | ||
| 326 | (addr[4] << 8) | (addr[5]); | ||
| 327 | |||
| 328 | status = | ||
| 329 | ql_wait_reg_rdy(qdev, | ||
| 330 | MAC_ADDR_IDX, MAC_ADDR_MW, 0); | ||
| 331 | if (status) | ||
| 332 | goto exit; | ||
| 333 | ql_write32(qdev, MAC_ADDR_IDX, (offset++) | | ||
| 334 | (index << MAC_ADDR_IDX_SHIFT) | | ||
| 335 | type | MAC_ADDR_E); | ||
| 336 | ql_write32(qdev, MAC_ADDR_DATA, lower); | ||
| 337 | status = | ||
| 338 | ql_wait_reg_rdy(qdev, | ||
| 339 | MAC_ADDR_IDX, MAC_ADDR_MW, 0); | ||
| 340 | if (status) | ||
| 341 | goto exit; | ||
| 342 | ql_write32(qdev, MAC_ADDR_IDX, (offset++) | | ||
| 343 | (index << MAC_ADDR_IDX_SHIFT) | | ||
| 344 | type | MAC_ADDR_E); | ||
| 345 | |||
| 346 | ql_write32(qdev, MAC_ADDR_DATA, upper); | ||
| 347 | status = | ||
| 348 | ql_wait_reg_rdy(qdev, | ||
| 349 | MAC_ADDR_IDX, MAC_ADDR_MW, 0); | ||
| 350 | if (status) | ||
| 351 | goto exit; | ||
| 352 | break; | ||
| 353 | } | ||
| 323 | case MAC_ADDR_TYPE_CAM_MAC: | 354 | case MAC_ADDR_TYPE_CAM_MAC: |
| 324 | { | 355 | { |
| 325 | u32 cam_output; | 356 | u32 cam_output; |
| @@ -365,16 +396,14 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type, | |||
| 365 | and possibly the function id. Right now we hardcode | 396 | and possibly the function id. Right now we hardcode |
| 366 | the route field to NIC core. | 397 | the route field to NIC core. |
| 367 | */ | 398 | */ |
| 368 | if (type == MAC_ADDR_TYPE_CAM_MAC) { | 399 | cam_output = (CAM_OUT_ROUTE_NIC | |
| 369 | cam_output = (CAM_OUT_ROUTE_NIC | | 400 | (qdev-> |
| 370 | (qdev-> | 401 | func << CAM_OUT_FUNC_SHIFT) | |
| 371 | func << CAM_OUT_FUNC_SHIFT) | | 402 | (0 << CAM_OUT_CQ_ID_SHIFT)); |
| 372 | (0 << CAM_OUT_CQ_ID_SHIFT)); | 403 | if (qdev->vlgrp) |
| 373 | if (qdev->vlgrp) | 404 | cam_output |= CAM_OUT_RV; |
| 374 | cam_output |= CAM_OUT_RV; | 405 | /* route to NIC core */ |
| 375 | /* route to NIC core */ | 406 | ql_write32(qdev, MAC_ADDR_DATA, cam_output); |
| 376 | ql_write32(qdev, MAC_ADDR_DATA, cam_output); | ||
| 377 | } | ||
| 378 | break; | 407 | break; |
| 379 | } | 408 | } |
| 380 | case MAC_ADDR_TYPE_VLAN: | 409 | case MAC_ADDR_TYPE_VLAN: |
| @@ -546,14 +575,14 @@ static int ql_set_routing_reg(struct ql_adapter *qdev, u32 index, u32 mask, | |||
| 546 | } | 575 | } |
| 547 | case RT_IDX_MCAST: /* Pass up All Multicast frames. */ | 576 | case RT_IDX_MCAST: /* Pass up All Multicast frames. */ |
| 548 | { | 577 | { |
| 549 | value = RT_IDX_DST_CAM_Q | /* dest */ | 578 | value = RT_IDX_DST_DFLT_Q | /* dest */ |
| 550 | RT_IDX_TYPE_NICQ | /* type */ | 579 | RT_IDX_TYPE_NICQ | /* type */ |
| 551 | (RT_IDX_ALLMULTI_SLOT << RT_IDX_IDX_SHIFT);/* index */ | 580 | (RT_IDX_ALLMULTI_SLOT << RT_IDX_IDX_SHIFT);/* index */ |
| 552 | break; | 581 | break; |
| 553 | } | 582 | } |
| 554 | case RT_IDX_MCAST_MATCH: /* Pass up matched Multicast frames. */ | 583 | case RT_IDX_MCAST_MATCH: /* Pass up matched Multicast frames. */ |
| 555 | { | 584 | { |
| 556 | value = RT_IDX_DST_CAM_Q | /* dest */ | 585 | value = RT_IDX_DST_DFLT_Q | /* dest */ |
| 557 | RT_IDX_TYPE_NICQ | /* type */ | 586 | RT_IDX_TYPE_NICQ | /* type */ |
| 558 | (RT_IDX_MCAST_MATCH_SLOT << RT_IDX_IDX_SHIFT);/* index */ | 587 | (RT_IDX_MCAST_MATCH_SLOT << RT_IDX_IDX_SHIFT);/* index */ |
| 559 | break; | 588 | break; |
| @@ -3077,6 +3106,12 @@ err_irq: | |||
| 3077 | 3106 | ||
| 3078 | static int ql_start_rss(struct ql_adapter *qdev) | 3107 | static int ql_start_rss(struct ql_adapter *qdev) |
| 3079 | { | 3108 | { |
| 3109 | u8 init_hash_seed[] = {0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, | ||
| 3110 | 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, | ||
| 3111 | 0xb0, 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, | ||
| 3112 | 0x30, 0xb4, 0x77, 0xcb, 0x2d, 0xa3, 0x80, | ||
| 3113 | 0x30, 0xf2, 0x0c, 0x6a, 0x42, 0xb7, 0x3b, | ||
| 3114 | 0xbe, 0xac, 0x01, 0xfa}; | ||
| 3080 | struct ricb *ricb = &qdev->ricb; | 3115 | struct ricb *ricb = &qdev->ricb; |
| 3081 | int status = 0; | 3116 | int status = 0; |
| 3082 | int i; | 3117 | int i; |
| @@ -3086,21 +3121,17 @@ static int ql_start_rss(struct ql_adapter *qdev) | |||
| 3086 | 3121 | ||
| 3087 | ricb->base_cq = RSS_L4K; | 3122 | ricb->base_cq = RSS_L4K; |
| 3088 | ricb->flags = | 3123 | ricb->flags = |
| 3089 | (RSS_L6K | RSS_LI | RSS_LB | RSS_LM | RSS_RI4 | RSS_RI6 | RSS_RT4 | | 3124 | (RSS_L6K | RSS_LI | RSS_LB | RSS_LM | RSS_RT4 | RSS_RT6); |
| 3090 | RSS_RT6); | 3125 | ricb->mask = cpu_to_le16((u16)(0x3ff)); |
| 3091 | ricb->mask = cpu_to_le16(qdev->rss_ring_count - 1); | ||
| 3092 | 3126 | ||
| 3093 | /* | 3127 | /* |
| 3094 | * Fill out the Indirection Table. | 3128 | * Fill out the Indirection Table. |
| 3095 | */ | 3129 | */ |
| 3096 | for (i = 0; i < 256; i++) | 3130 | for (i = 0; i < 1024; i++) |
| 3097 | hash_id[i] = i & (qdev->rss_ring_count - 1); | 3131 | hash_id[i] = (i & (qdev->rss_ring_count - 1)); |
| 3098 | 3132 | ||
| 3099 | /* | 3133 | memcpy((void *)&ricb->ipv6_hash_key[0], init_hash_seed, 40); |
| 3100 | * Random values for the IPv6 and IPv4 Hash Keys. | 3134 | memcpy((void *)&ricb->ipv4_hash_key[0], init_hash_seed, 16); |
| 3101 | */ | ||
| 3102 | get_random_bytes((void *)&ricb->ipv6_hash_key[0], 40); | ||
| 3103 | get_random_bytes((void *)&ricb->ipv4_hash_key[0], 16); | ||
| 3104 | 3135 | ||
| 3105 | QPRINTK(qdev, IFUP, DEBUG, "Initializing RSS.\n"); | 3136 | QPRINTK(qdev, IFUP, DEBUG, "Initializing RSS.\n"); |
| 3106 | 3137 | ||
| @@ -3239,6 +3270,13 @@ static int ql_adapter_initialize(struct ql_adapter *qdev) | |||
| 3239 | ql_write32(qdev, SPLT_HDR, SPLT_HDR_EP | | 3270 | ql_write32(qdev, SPLT_HDR, SPLT_HDR_EP | |
| 3240 | min(SMALL_BUFFER_SIZE, MAX_SPLIT_SIZE)); | 3271 | min(SMALL_BUFFER_SIZE, MAX_SPLIT_SIZE)); |
| 3241 | 3272 | ||
| 3273 | /* Set RX packet routing to use port/pci function on which the | ||
| 3274 | * packet arrived on in addition to usual frame routing. | ||
| 3275 | * This is helpful on bonding where both interfaces can have | ||
| 3276 | * the same MAC address. | ||
| 3277 | */ | ||
| 3278 | ql_write32(qdev, RST_FO, RST_FO_RR_MASK | RST_FO_RR_RCV_FUNC_CQ); | ||
| 3279 | |||
| 3242 | /* Start up the rx queues. */ | 3280 | /* Start up the rx queues. */ |
| 3243 | for (i = 0; i < qdev->rx_ring_count; i++) { | 3281 | for (i = 0; i < qdev->rx_ring_count; i++) { |
| 3244 | status = ql_start_rx_ring(qdev, &qdev->rx_ring[i]); | 3282 | status = ql_start_rx_ring(qdev, &qdev->rx_ring[i]); |
| @@ -3311,6 +3349,13 @@ static int ql_adapter_reset(struct ql_adapter *qdev) | |||
| 3311 | 3349 | ||
| 3312 | end_jiffies = jiffies + | 3350 | end_jiffies = jiffies + |
| 3313 | max((unsigned long)1, usecs_to_jiffies(30)); | 3351 | max((unsigned long)1, usecs_to_jiffies(30)); |
| 3352 | |||
| 3353 | /* Stop management traffic. */ | ||
| 3354 | ql_mb_set_mgmnt_traffic_ctl(qdev, MB_SET_MPI_TFK_STOP); | ||
| 3355 | |||
| 3356 | /* Wait for the NIC and MGMNT FIFOs to empty. */ | ||
| 3357 | ql_wait_fifo_empty(qdev); | ||
| 3358 | |||
| 3314 | ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); | 3359 | ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); |
| 3315 | 3360 | ||
| 3316 | do { | 3361 | do { |
| @@ -3326,6 +3371,8 @@ static int ql_adapter_reset(struct ql_adapter *qdev) | |||
| 3326 | status = -ETIMEDOUT; | 3371 | status = -ETIMEDOUT; |
| 3327 | } | 3372 | } |
| 3328 | 3373 | ||
| 3374 | /* Resume management traffic. */ | ||
| 3375 | ql_mb_set_mgmnt_traffic_ctl(qdev, MB_SET_MPI_TFK_RESUME); | ||
| 3329 | return status; | 3376 | return status; |
| 3330 | } | 3377 | } |
| 3331 | 3378 | ||
| @@ -3704,6 +3751,12 @@ static void ql_asic_reset_work(struct work_struct *work) | |||
| 3704 | status = ql_adapter_up(qdev); | 3751 | status = ql_adapter_up(qdev); |
| 3705 | if (status) | 3752 | if (status) |
| 3706 | goto error; | 3753 | goto error; |
| 3754 | |||
| 3755 | /* Restore rx mode. */ | ||
| 3756 | clear_bit(QL_ALLMULTI, &qdev->flags); | ||
| 3757 | clear_bit(QL_PROMISCUOUS, &qdev->flags); | ||
| 3758 | qlge_set_multicast_list(qdev->ndev); | ||
| 3759 | |||
| 3707 | rtnl_unlock(); | 3760 | rtnl_unlock(); |
| 3708 | return; | 3761 | return; |
| 3709 | error: | 3762 | error: |
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index c2e43073047e..99e58e3f8e22 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
| @@ -768,6 +768,95 @@ static int ql_idc_wait(struct ql_adapter *qdev) | |||
| 768 | return status; | 768 | return status; |
| 769 | } | 769 | } |
| 770 | 770 | ||
| 771 | int ql_mb_set_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 control) | ||
| 772 | { | ||
| 773 | struct mbox_params mbc; | ||
| 774 | struct mbox_params *mbcp = &mbc; | ||
| 775 | int status; | ||
| 776 | |||
| 777 | memset(mbcp, 0, sizeof(struct mbox_params)); | ||
| 778 | |||
| 779 | mbcp->in_count = 1; | ||
| 780 | mbcp->out_count = 2; | ||
| 781 | |||
| 782 | mbcp->mbox_in[0] = MB_CMD_SET_MGMNT_TFK_CTL; | ||
| 783 | mbcp->mbox_in[1] = control; | ||
| 784 | |||
| 785 | status = ql_mailbox_command(qdev, mbcp); | ||
| 786 | if (status) | ||
| 787 | return status; | ||
| 788 | |||
| 789 | if (mbcp->mbox_out[0] == MB_CMD_STS_GOOD) | ||
| 790 | return status; | ||
| 791 | |||
| 792 | if (mbcp->mbox_out[0] == MB_CMD_STS_INVLD_CMD) { | ||
| 793 | QPRINTK(qdev, DRV, ERR, | ||
| 794 | "Command not supported by firmware.\n"); | ||
| 795 | status = -EINVAL; | ||
| 796 | } else if (mbcp->mbox_out[0] == MB_CMD_STS_ERR) { | ||
| 797 | /* This indicates that the firmware is | ||
| 798 | * already in the state we are trying to | ||
| 799 | * change it to. | ||
| 800 | */ | ||
| 801 | QPRINTK(qdev, DRV, ERR, | ||
| 802 | "Command parameters make no change.\n"); | ||
| 803 | } | ||
| 804 | return status; | ||
| 805 | } | ||
| 806 | |||
| 807 | /* Returns a negative error code or the mailbox command status. */ | ||
| 808 | static int ql_mb_get_mgmnt_traffic_ctl(struct ql_adapter *qdev, u32 *control) | ||
| 809 | { | ||
| 810 | struct mbox_params mbc; | ||
| 811 | struct mbox_params *mbcp = &mbc; | ||
| 812 | int status; | ||
| 813 | |||
| 814 | memset(mbcp, 0, sizeof(struct mbox_params)); | ||
| 815 | *control = 0; | ||
| 816 | |||
| 817 | mbcp->in_count = 1; | ||
| 818 | mbcp->out_count = 1; | ||
| 819 | |||
| 820 | mbcp->mbox_in[0] = MB_CMD_GET_MGMNT_TFK_CTL; | ||
| 821 | |||
| 822 | status = ql_mailbox_command(qdev, mbcp); | ||
| 823 | if (status) | ||
| 824 | return status; | ||
| 825 | |||
| 826 | if (mbcp->mbox_out[0] == MB_CMD_STS_GOOD) { | ||
| 827 | *control = mbcp->mbox_in[1]; | ||
| 828 | return status; | ||
| 829 | } | ||
| 830 | |||
| 831 | if (mbcp->mbox_out[0] == MB_CMD_STS_INVLD_CMD) { | ||
| 832 | QPRINTK(qdev, DRV, ERR, | ||
| 833 | "Command not supported by firmware.\n"); | ||
| 834 | status = -EINVAL; | ||
| 835 | } else if (mbcp->mbox_out[0] == MB_CMD_STS_ERR) { | ||
| 836 | QPRINTK(qdev, DRV, ERR, | ||
| 837 | "Failed to get MPI traffic control.\n"); | ||
| 838 | status = -EIO; | ||
| 839 | } | ||
| 840 | return status; | ||
| 841 | } | ||
| 842 | |||
| 843 | int ql_wait_fifo_empty(struct ql_adapter *qdev) | ||
| 844 | { | ||
| 845 | int count = 5; | ||
| 846 | u32 mgmnt_fifo_empty; | ||
| 847 | u32 nic_fifo_empty; | ||
| 848 | |||
| 849 | do { | ||
| 850 | nic_fifo_empty = ql_read32(qdev, STS) & STS_NFE; | ||
| 851 | ql_mb_get_mgmnt_traffic_ctl(qdev, &mgmnt_fifo_empty); | ||
| 852 | mgmnt_fifo_empty &= MB_GET_MPI_TFK_FIFO_EMPTY; | ||
| 853 | if (nic_fifo_empty && mgmnt_fifo_empty) | ||
| 854 | return 0; | ||
| 855 | msleep(100); | ||
| 856 | } while (count-- > 0); | ||
| 857 | return -ETIMEDOUT; | ||
| 858 | } | ||
| 859 | |||
| 771 | /* API called in work thread context to set new TX/RX | 860 | /* API called in work thread context to set new TX/RX |
| 772 | * maximum frame size values to match MTU. | 861 | * maximum frame size values to match MTU. |
| 773 | */ | 862 | */ |
| @@ -876,6 +965,8 @@ void ql_mpi_work(struct work_struct *work) | |||
| 876 | int err = 0; | 965 | int err = 0; |
| 877 | 966 | ||
| 878 | rtnl_lock(); | 967 | rtnl_lock(); |
| 968 | /* Begin polled mode for MPI */ | ||
| 969 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16)); | ||
| 879 | 970 | ||
| 880 | while (ql_read32(qdev, STS) & STS_PI) { | 971 | while (ql_read32(qdev, STS) & STS_PI) { |
| 881 | memset(mbcp, 0, sizeof(struct mbox_params)); | 972 | memset(mbcp, 0, sizeof(struct mbox_params)); |
| @@ -888,6 +979,8 @@ void ql_mpi_work(struct work_struct *work) | |||
| 888 | break; | 979 | break; |
| 889 | } | 980 | } |
| 890 | 981 | ||
| 982 | /* End polled mode for MPI */ | ||
| 983 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI); | ||
| 891 | rtnl_unlock(); | 984 | rtnl_unlock(); |
| 892 | ql_enable_completion_interrupt(qdev, 0); | 985 | ql_enable_completion_interrupt(qdev, 0); |
| 893 | } | 986 | } |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 50c6a3cfe439..83c47d95c3aa 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
| @@ -115,7 +115,9 @@ enum mac_version { | |||
| 115 | RTL_GIGA_MAC_VER_22 = 0x16, // 8168C | 115 | RTL_GIGA_MAC_VER_22 = 0x16, // 8168C |
| 116 | RTL_GIGA_MAC_VER_23 = 0x17, // 8168CP | 116 | RTL_GIGA_MAC_VER_23 = 0x17, // 8168CP |
| 117 | RTL_GIGA_MAC_VER_24 = 0x18, // 8168CP | 117 | RTL_GIGA_MAC_VER_24 = 0x18, // 8168CP |
| 118 | RTL_GIGA_MAC_VER_25 = 0x19 // 8168D | 118 | RTL_GIGA_MAC_VER_25 = 0x19, // 8168D |
| 119 | RTL_GIGA_MAC_VER_26 = 0x1a, // 8168D | ||
| 120 | RTL_GIGA_MAC_VER_27 = 0x1b // 8168DP | ||
| 119 | }; | 121 | }; |
| 120 | 122 | ||
| 121 | #define _R(NAME,MAC,MASK) \ | 123 | #define _R(NAME,MAC,MASK) \ |
| @@ -150,7 +152,9 @@ static const struct { | |||
| 150 | _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_22, 0xff7e1880), // PCI-E | 152 | _R("RTL8168c/8111c", RTL_GIGA_MAC_VER_22, 0xff7e1880), // PCI-E |
| 151 | _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_23, 0xff7e1880), // PCI-E | 153 | _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_23, 0xff7e1880), // PCI-E |
| 152 | _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_24, 0xff7e1880), // PCI-E | 154 | _R("RTL8168cp/8111cp", RTL_GIGA_MAC_VER_24, 0xff7e1880), // PCI-E |
| 153 | _R("RTL8168d/8111d", RTL_GIGA_MAC_VER_25, 0xff7e1880) // PCI-E | 155 | _R("RTL8168d/8111d", RTL_GIGA_MAC_VER_25, 0xff7e1880), // PCI-E |
| 156 | _R("RTL8168d/8111d", RTL_GIGA_MAC_VER_26, 0xff7e1880), // PCI-E | ||
| 157 | _R("RTL8168dp/8111dp", RTL_GIGA_MAC_VER_27, 0xff7e1880) // PCI-E | ||
| 154 | }; | 158 | }; |
| 155 | #undef _R | 159 | #undef _R |
| 156 | 160 | ||
| @@ -253,6 +257,13 @@ enum rtl8168_8101_registers { | |||
| 253 | DBG_REG = 0xd1, | 257 | DBG_REG = 0xd1, |
| 254 | #define FIX_NAK_1 (1 << 4) | 258 | #define FIX_NAK_1 (1 << 4) |
| 255 | #define FIX_NAK_2 (1 << 3) | 259 | #define FIX_NAK_2 (1 << 3) |
| 260 | EFUSEAR = 0xdc, | ||
| 261 | #define EFUSEAR_FLAG 0x80000000 | ||
| 262 | #define EFUSEAR_WRITE_CMD 0x80000000 | ||
| 263 | #define EFUSEAR_READ_CMD 0x00000000 | ||
| 264 | #define EFUSEAR_REG_MASK 0x03ff | ||
| 265 | #define EFUSEAR_REG_SHIFT 8 | ||
| 266 | #define EFUSEAR_DATA_MASK 0xff | ||
| 256 | }; | 267 | }; |
| 257 | 268 | ||
| 258 | enum rtl_register_content { | 269 | enum rtl_register_content { |
| @@ -568,6 +579,14 @@ static void mdio_patch(void __iomem *ioaddr, int reg_addr, int value) | |||
| 568 | mdio_write(ioaddr, reg_addr, mdio_read(ioaddr, reg_addr) | value); | 579 | mdio_write(ioaddr, reg_addr, mdio_read(ioaddr, reg_addr) | value); |
| 569 | } | 580 | } |
| 570 | 581 | ||
| 582 | static void mdio_plus_minus(void __iomem *ioaddr, int reg_addr, int p, int m) | ||
| 583 | { | ||
| 584 | int val; | ||
| 585 | |||
| 586 | val = mdio_read(ioaddr, reg_addr); | ||
| 587 | mdio_write(ioaddr, reg_addr, (val | p) & ~m); | ||
| 588 | } | ||
| 589 | |||
| 571 | static void rtl_mdio_write(struct net_device *dev, int phy_id, int location, | 590 | static void rtl_mdio_write(struct net_device *dev, int phy_id, int location, |
| 572 | int val) | 591 | int val) |
| 573 | { | 592 | { |
| @@ -651,6 +670,24 @@ static u32 rtl_csi_read(void __iomem *ioaddr, int addr) | |||
| 651 | return value; | 670 | return value; |
| 652 | } | 671 | } |
| 653 | 672 | ||
| 673 | static u8 rtl8168d_efuse_read(void __iomem *ioaddr, int reg_addr) | ||
| 674 | { | ||
| 675 | u8 value = 0xff; | ||
| 676 | unsigned int i; | ||
| 677 | |||
| 678 | RTL_W32(EFUSEAR, (reg_addr & EFUSEAR_REG_MASK) << EFUSEAR_REG_SHIFT); | ||
| 679 | |||
| 680 | for (i = 0; i < 300; i++) { | ||
| 681 | if (RTL_R32(EFUSEAR) & EFUSEAR_FLAG) { | ||
| 682 | value = RTL_R32(EFUSEAR) & EFUSEAR_DATA_MASK; | ||
| 683 | break; | ||
| 684 | } | ||
| 685 | udelay(100); | ||
| 686 | } | ||
| 687 | |||
| 688 | return value; | ||
| 689 | } | ||
| 690 | |||
| 654 | static void rtl8169_irq_mask_and_ack(void __iomem *ioaddr) | 691 | static void rtl8169_irq_mask_and_ack(void __iomem *ioaddr) |
| 655 | { | 692 | { |
| 656 | RTL_W16(IntrMask, 0x0000); | 693 | RTL_W16(IntrMask, 0x0000); |
| @@ -1243,7 +1280,10 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp, | |||
| 1243 | int mac_version; | 1280 | int mac_version; |
| 1244 | } mac_info[] = { | 1281 | } mac_info[] = { |
| 1245 | /* 8168D family. */ | 1282 | /* 8168D family. */ |
| 1246 | { 0x7c800000, 0x28000000, RTL_GIGA_MAC_VER_25 }, | 1283 | { 0x7cf00000, 0x28300000, RTL_GIGA_MAC_VER_26 }, |
| 1284 | { 0x7cf00000, 0x28100000, RTL_GIGA_MAC_VER_25 }, | ||
| 1285 | { 0x7c800000, 0x28800000, RTL_GIGA_MAC_VER_27 }, | ||
| 1286 | { 0x7c800000, 0x28000000, RTL_GIGA_MAC_VER_26 }, | ||
| 1247 | 1287 | ||
| 1248 | /* 8168C family. */ | 1288 | /* 8168C family. */ |
| 1249 | { 0x7cf00000, 0x3ca00000, RTL_GIGA_MAC_VER_24 }, | 1289 | { 0x7cf00000, 0x3ca00000, RTL_GIGA_MAC_VER_24 }, |
| @@ -1648,74 +1688,903 @@ static void rtl8168c_4_hw_phy_config(void __iomem *ioaddr) | |||
| 1648 | rtl8168c_3_hw_phy_config(ioaddr); | 1688 | rtl8168c_3_hw_phy_config(ioaddr); |
| 1649 | } | 1689 | } |
| 1650 | 1690 | ||
| 1651 | static void rtl8168d_hw_phy_config(void __iomem *ioaddr) | 1691 | static void rtl8168d_1_hw_phy_config(void __iomem *ioaddr) |
| 1652 | { | 1692 | { |
| 1653 | struct phy_reg phy_reg_init_0[] = { | 1693 | static struct phy_reg phy_reg_init_0[] = { |
| 1654 | { 0x1f, 0x0001 }, | 1694 | { 0x1f, 0x0001 }, |
| 1655 | { 0x09, 0x2770 }, | 1695 | { 0x06, 0x4064 }, |
| 1656 | { 0x08, 0x04d0 }, | 1696 | { 0x07, 0x2863 }, |
| 1657 | { 0x0b, 0xad15 }, | 1697 | { 0x08, 0x059c }, |
| 1658 | { 0x0c, 0x5bf0 }, | 1698 | { 0x09, 0x26b4 }, |
| 1659 | { 0x1c, 0xf101 }, | 1699 | { 0x0a, 0x6a19 }, |
| 1700 | { 0x0b, 0xdcc8 }, | ||
| 1701 | { 0x10, 0xf06d }, | ||
| 1702 | { 0x14, 0x7f68 }, | ||
| 1703 | { 0x18, 0x7fd9 }, | ||
| 1704 | { 0x1c, 0xf0ff }, | ||
| 1705 | { 0x1d, 0x3d9c }, | ||
| 1660 | { 0x1f, 0x0003 }, | 1706 | { 0x1f, 0x0003 }, |
| 1661 | { 0x14, 0x94d7 }, | 1707 | { 0x12, 0xf49f }, |
| 1662 | { 0x12, 0xf4d6 }, | 1708 | { 0x13, 0x070b }, |
| 1663 | { 0x09, 0xca0f }, | 1709 | { 0x1a, 0x05ad }, |
| 1664 | { 0x1f, 0x0002 }, | 1710 | { 0x14, 0x94c0 } |
| 1665 | { 0x0b, 0x0b10 }, | 1711 | }; |
| 1666 | { 0x0c, 0xd1f7 }, | 1712 | static struct phy_reg phy_reg_init_1[] = { |
| 1667 | { 0x1f, 0x0002 }, | ||
| 1668 | { 0x06, 0x5461 }, | ||
| 1669 | { 0x1f, 0x0002 }, | 1713 | { 0x1f, 0x0002 }, |
| 1670 | { 0x05, 0x6662 }, | 1714 | { 0x06, 0x5561 }, |
| 1715 | { 0x1f, 0x0005 }, | ||
| 1716 | { 0x05, 0x8332 }, | ||
| 1717 | { 0x06, 0x5561 } | ||
| 1718 | }; | ||
| 1719 | static struct phy_reg phy_reg_init_2[] = { | ||
| 1720 | { 0x1f, 0x0005 }, | ||
| 1721 | { 0x05, 0xffc2 }, | ||
| 1722 | { 0x1f, 0x0005 }, | ||
| 1723 | { 0x05, 0x8000 }, | ||
| 1724 | { 0x06, 0xf8f9 }, | ||
| 1725 | { 0x06, 0xfaef }, | ||
| 1726 | { 0x06, 0x59ee }, | ||
| 1727 | { 0x06, 0xf8ea }, | ||
| 1728 | { 0x06, 0x00ee }, | ||
| 1729 | { 0x06, 0xf8eb }, | ||
| 1730 | { 0x06, 0x00e0 }, | ||
| 1731 | { 0x06, 0xf87c }, | ||
| 1732 | { 0x06, 0xe1f8 }, | ||
| 1733 | { 0x06, 0x7d59 }, | ||
| 1734 | { 0x06, 0x0fef }, | ||
| 1735 | { 0x06, 0x0139 }, | ||
| 1736 | { 0x06, 0x029e }, | ||
| 1737 | { 0x06, 0x06ef }, | ||
| 1738 | { 0x06, 0x1039 }, | ||
| 1739 | { 0x06, 0x089f }, | ||
| 1740 | { 0x06, 0x2aee }, | ||
| 1741 | { 0x06, 0xf8ea }, | ||
| 1742 | { 0x06, 0x00ee }, | ||
| 1743 | { 0x06, 0xf8eb }, | ||
| 1744 | { 0x06, 0x01e0 }, | ||
| 1745 | { 0x06, 0xf87c }, | ||
| 1746 | { 0x06, 0xe1f8 }, | ||
| 1747 | { 0x06, 0x7d58 }, | ||
| 1748 | { 0x06, 0x409e }, | ||
| 1749 | { 0x06, 0x0f39 }, | ||
| 1750 | { 0x06, 0x46aa }, | ||
| 1751 | { 0x06, 0x0bbf }, | ||
| 1752 | { 0x06, 0x8290 }, | ||
| 1753 | { 0x06, 0xd682 }, | ||
| 1754 | { 0x06, 0x9802 }, | ||
| 1755 | { 0x06, 0x014f }, | ||
| 1756 | { 0x06, 0xae09 }, | ||
| 1757 | { 0x06, 0xbf82 }, | ||
| 1758 | { 0x06, 0x98d6 }, | ||
| 1759 | { 0x06, 0x82a0 }, | ||
| 1760 | { 0x06, 0x0201 }, | ||
| 1761 | { 0x06, 0x4fef }, | ||
| 1762 | { 0x06, 0x95fe }, | ||
| 1763 | { 0x06, 0xfdfc }, | ||
| 1764 | { 0x06, 0x05f8 }, | ||
| 1765 | { 0x06, 0xf9fa }, | ||
| 1766 | { 0x06, 0xeef8 }, | ||
| 1767 | { 0x06, 0xea00 }, | ||
| 1768 | { 0x06, 0xeef8 }, | ||
| 1769 | { 0x06, 0xeb00 }, | ||
| 1770 | { 0x06, 0xe2f8 }, | ||
| 1771 | { 0x06, 0x7ce3 }, | ||
| 1772 | { 0x06, 0xf87d }, | ||
| 1773 | { 0x06, 0xa511 }, | ||
| 1774 | { 0x06, 0x1112 }, | ||
| 1775 | { 0x06, 0xd240 }, | ||
| 1776 | { 0x06, 0xd644 }, | ||
| 1777 | { 0x06, 0x4402 }, | ||
| 1778 | { 0x06, 0x8217 }, | ||
| 1779 | { 0x06, 0xd2a0 }, | ||
| 1780 | { 0x06, 0xd6aa }, | ||
| 1781 | { 0x06, 0xaa02 }, | ||
| 1782 | { 0x06, 0x8217 }, | ||
| 1783 | { 0x06, 0xae0f }, | ||
| 1784 | { 0x06, 0xa544 }, | ||
| 1785 | { 0x06, 0x4402 }, | ||
| 1786 | { 0x06, 0xae4d }, | ||
| 1787 | { 0x06, 0xa5aa }, | ||
| 1788 | { 0x06, 0xaa02 }, | ||
| 1789 | { 0x06, 0xae47 }, | ||
| 1790 | { 0x06, 0xaf82 }, | ||
| 1791 | { 0x06, 0x13ee }, | ||
| 1792 | { 0x06, 0x834e }, | ||
| 1793 | { 0x06, 0x00ee }, | ||
| 1794 | { 0x06, 0x834d }, | ||
| 1795 | { 0x06, 0x0fee }, | ||
| 1796 | { 0x06, 0x834c }, | ||
| 1797 | { 0x06, 0x0fee }, | ||
| 1798 | { 0x06, 0x834f }, | ||
| 1799 | { 0x06, 0x00ee }, | ||
| 1800 | { 0x06, 0x8351 }, | ||
| 1801 | { 0x06, 0x00ee }, | ||
| 1802 | { 0x06, 0x834a }, | ||
| 1803 | { 0x06, 0xffee }, | ||
| 1804 | { 0x06, 0x834b }, | ||
| 1805 | { 0x06, 0xffe0 }, | ||
| 1806 | { 0x06, 0x8330 }, | ||
| 1807 | { 0x06, 0xe183 }, | ||
| 1808 | { 0x06, 0x3158 }, | ||
| 1809 | { 0x06, 0xfee4 }, | ||
| 1810 | { 0x06, 0xf88a }, | ||
| 1811 | { 0x06, 0xe5f8 }, | ||
| 1812 | { 0x06, 0x8be0 }, | ||
| 1813 | { 0x06, 0x8332 }, | ||
| 1814 | { 0x06, 0xe183 }, | ||
| 1815 | { 0x06, 0x3359 }, | ||
| 1816 | { 0x06, 0x0fe2 }, | ||
| 1817 | { 0x06, 0x834d }, | ||
| 1818 | { 0x06, 0x0c24 }, | ||
| 1819 | { 0x06, 0x5af0 }, | ||
| 1820 | { 0x06, 0x1e12 }, | ||
| 1821 | { 0x06, 0xe4f8 }, | ||
| 1822 | { 0x06, 0x8ce5 }, | ||
| 1823 | { 0x06, 0xf88d }, | ||
| 1824 | { 0x06, 0xaf82 }, | ||
| 1825 | { 0x06, 0x13e0 }, | ||
| 1826 | { 0x06, 0x834f }, | ||
| 1827 | { 0x06, 0x10e4 }, | ||
| 1828 | { 0x06, 0x834f }, | ||
| 1829 | { 0x06, 0xe083 }, | ||
| 1830 | { 0x06, 0x4e78 }, | ||
| 1831 | { 0x06, 0x009f }, | ||
| 1832 | { 0x06, 0x0ae0 }, | ||
| 1833 | { 0x06, 0x834f }, | ||
| 1834 | { 0x06, 0xa010 }, | ||
| 1835 | { 0x06, 0xa5ee }, | ||
| 1836 | { 0x06, 0x834e }, | ||
| 1837 | { 0x06, 0x01e0 }, | ||
| 1838 | { 0x06, 0x834e }, | ||
| 1839 | { 0x06, 0x7805 }, | ||
| 1840 | { 0x06, 0x9e9a }, | ||
| 1841 | { 0x06, 0xe083 }, | ||
| 1842 | { 0x06, 0x4e78 }, | ||
| 1843 | { 0x06, 0x049e }, | ||
| 1844 | { 0x06, 0x10e0 }, | ||
| 1845 | { 0x06, 0x834e }, | ||
| 1846 | { 0x06, 0x7803 }, | ||
| 1847 | { 0x06, 0x9e0f }, | ||
| 1848 | { 0x06, 0xe083 }, | ||
| 1849 | { 0x06, 0x4e78 }, | ||
| 1850 | { 0x06, 0x019e }, | ||
| 1851 | { 0x06, 0x05ae }, | ||
| 1852 | { 0x06, 0x0caf }, | ||
| 1853 | { 0x06, 0x81f8 }, | ||
| 1854 | { 0x06, 0xaf81 }, | ||
| 1855 | { 0x06, 0xa3af }, | ||
| 1856 | { 0x06, 0x81dc }, | ||
| 1857 | { 0x06, 0xaf82 }, | ||
| 1858 | { 0x06, 0x13ee }, | ||
| 1859 | { 0x06, 0x8348 }, | ||
| 1860 | { 0x06, 0x00ee }, | ||
| 1861 | { 0x06, 0x8349 }, | ||
| 1862 | { 0x06, 0x00e0 }, | ||
| 1863 | { 0x06, 0x8351 }, | ||
| 1864 | { 0x06, 0x10e4 }, | ||
| 1865 | { 0x06, 0x8351 }, | ||
| 1866 | { 0x06, 0x5801 }, | ||
| 1867 | { 0x06, 0x9fea }, | ||
| 1868 | { 0x06, 0xd000 }, | ||
| 1869 | { 0x06, 0xd180 }, | ||
| 1870 | { 0x06, 0x1f66 }, | ||
| 1871 | { 0x06, 0xe2f8 }, | ||
| 1872 | { 0x06, 0xeae3 }, | ||
| 1873 | { 0x06, 0xf8eb }, | ||
| 1874 | { 0x06, 0x5af8 }, | ||
| 1875 | { 0x06, 0x1e20 }, | ||
| 1876 | { 0x06, 0xe6f8 }, | ||
| 1877 | { 0x06, 0xeae5 }, | ||
| 1878 | { 0x06, 0xf8eb }, | ||
| 1879 | { 0x06, 0xd302 }, | ||
| 1880 | { 0x06, 0xb3fe }, | ||
| 1881 | { 0x06, 0xe2f8 }, | ||
| 1882 | { 0x06, 0x7cef }, | ||
| 1883 | { 0x06, 0x325b }, | ||
| 1884 | { 0x06, 0x80e3 }, | ||
| 1885 | { 0x06, 0xf87d }, | ||
| 1886 | { 0x06, 0x9e03 }, | ||
| 1887 | { 0x06, 0x7dff }, | ||
| 1888 | { 0x06, 0xff0d }, | ||
| 1889 | { 0x06, 0x581c }, | ||
| 1890 | { 0x06, 0x551a }, | ||
| 1891 | { 0x06, 0x6511 }, | ||
| 1892 | { 0x06, 0xa190 }, | ||
| 1893 | { 0x06, 0xd3e2 }, | ||
| 1894 | { 0x06, 0x8348 }, | ||
| 1895 | { 0x06, 0xe383 }, | ||
| 1896 | { 0x06, 0x491b }, | ||
| 1897 | { 0x06, 0x56ab }, | ||
| 1898 | { 0x06, 0x08ef }, | ||
| 1899 | { 0x06, 0x56e6 }, | ||
| 1900 | { 0x06, 0x8348 }, | ||
| 1901 | { 0x06, 0xe783 }, | ||
| 1902 | { 0x06, 0x4910 }, | ||
| 1903 | { 0x06, 0xd180 }, | ||
| 1904 | { 0x06, 0x1f66 }, | ||
| 1905 | { 0x06, 0xa004 }, | ||
| 1906 | { 0x06, 0xb9e2 }, | ||
| 1907 | { 0x06, 0x8348 }, | ||
| 1908 | { 0x06, 0xe383 }, | ||
| 1909 | { 0x06, 0x49ef }, | ||
| 1910 | { 0x06, 0x65e2 }, | ||
| 1911 | { 0x06, 0x834a }, | ||
| 1912 | { 0x06, 0xe383 }, | ||
| 1913 | { 0x06, 0x4b1b }, | ||
| 1914 | { 0x06, 0x56aa }, | ||
| 1915 | { 0x06, 0x0eef }, | ||
| 1916 | { 0x06, 0x56e6 }, | ||
| 1917 | { 0x06, 0x834a }, | ||
| 1918 | { 0x06, 0xe783 }, | ||
| 1919 | { 0x06, 0x4be2 }, | ||
| 1920 | { 0x06, 0x834d }, | ||
| 1921 | { 0x06, 0xe683 }, | ||
| 1922 | { 0x06, 0x4ce0 }, | ||
| 1923 | { 0x06, 0x834d }, | ||
| 1924 | { 0x06, 0xa000 }, | ||
| 1925 | { 0x06, 0x0caf }, | ||
| 1926 | { 0x06, 0x81dc }, | ||
| 1927 | { 0x06, 0xe083 }, | ||
| 1928 | { 0x06, 0x4d10 }, | ||
| 1929 | { 0x06, 0xe483 }, | ||
| 1930 | { 0x06, 0x4dae }, | ||
| 1931 | { 0x06, 0x0480 }, | ||
| 1932 | { 0x06, 0xe483 }, | ||
| 1933 | { 0x06, 0x4de0 }, | ||
| 1934 | { 0x06, 0x834e }, | ||
| 1935 | { 0x06, 0x7803 }, | ||
| 1936 | { 0x06, 0x9e0b }, | ||
| 1937 | { 0x06, 0xe083 }, | ||
| 1938 | { 0x06, 0x4e78 }, | ||
| 1939 | { 0x06, 0x049e }, | ||
| 1940 | { 0x06, 0x04ee }, | ||
| 1941 | { 0x06, 0x834e }, | ||
| 1942 | { 0x06, 0x02e0 }, | ||
| 1943 | { 0x06, 0x8332 }, | ||
| 1944 | { 0x06, 0xe183 }, | ||
| 1945 | { 0x06, 0x3359 }, | ||
| 1946 | { 0x06, 0x0fe2 }, | ||
| 1947 | { 0x06, 0x834d }, | ||
| 1948 | { 0x06, 0x0c24 }, | ||
| 1949 | { 0x06, 0x5af0 }, | ||
| 1950 | { 0x06, 0x1e12 }, | ||
| 1951 | { 0x06, 0xe4f8 }, | ||
| 1952 | { 0x06, 0x8ce5 }, | ||
| 1953 | { 0x06, 0xf88d }, | ||
| 1954 | { 0x06, 0xe083 }, | ||
| 1955 | { 0x06, 0x30e1 }, | ||
| 1956 | { 0x06, 0x8331 }, | ||
| 1957 | { 0x06, 0x6801 }, | ||
| 1958 | { 0x06, 0xe4f8 }, | ||
| 1959 | { 0x06, 0x8ae5 }, | ||
| 1960 | { 0x06, 0xf88b }, | ||
| 1961 | { 0x06, 0xae37 }, | ||
| 1962 | { 0x06, 0xee83 }, | ||
| 1963 | { 0x06, 0x4e03 }, | ||
| 1964 | { 0x06, 0xe083 }, | ||
| 1965 | { 0x06, 0x4ce1 }, | ||
| 1966 | { 0x06, 0x834d }, | ||
| 1967 | { 0x06, 0x1b01 }, | ||
| 1968 | { 0x06, 0x9e04 }, | ||
| 1969 | { 0x06, 0xaaa1 }, | ||
| 1970 | { 0x06, 0xaea8 }, | ||
| 1971 | { 0x06, 0xee83 }, | ||
| 1972 | { 0x06, 0x4e04 }, | ||
| 1973 | { 0x06, 0xee83 }, | ||
| 1974 | { 0x06, 0x4f00 }, | ||
| 1975 | { 0x06, 0xaeab }, | ||
| 1976 | { 0x06, 0xe083 }, | ||
| 1977 | { 0x06, 0x4f78 }, | ||
| 1978 | { 0x06, 0x039f }, | ||
| 1979 | { 0x06, 0x14ee }, | ||
| 1980 | { 0x06, 0x834e }, | ||
| 1981 | { 0x06, 0x05d2 }, | ||
| 1982 | { 0x06, 0x40d6 }, | ||
| 1983 | { 0x06, 0x5554 }, | ||
| 1984 | { 0x06, 0x0282 }, | ||
| 1985 | { 0x06, 0x17d2 }, | ||
| 1986 | { 0x06, 0xa0d6 }, | ||
| 1987 | { 0x06, 0xba00 }, | ||
| 1988 | { 0x06, 0x0282 }, | ||
| 1989 | { 0x06, 0x17fe }, | ||
| 1990 | { 0x06, 0xfdfc }, | ||
| 1991 | { 0x06, 0x05f8 }, | ||
| 1992 | { 0x06, 0xe0f8 }, | ||
| 1993 | { 0x06, 0x60e1 }, | ||
| 1994 | { 0x06, 0xf861 }, | ||
| 1995 | { 0x06, 0x6802 }, | ||
| 1996 | { 0x06, 0xe4f8 }, | ||
| 1997 | { 0x06, 0x60e5 }, | ||
| 1998 | { 0x06, 0xf861 }, | ||
| 1999 | { 0x06, 0xe0f8 }, | ||
| 2000 | { 0x06, 0x48e1 }, | ||
| 2001 | { 0x06, 0xf849 }, | ||
| 2002 | { 0x06, 0x580f }, | ||
| 2003 | { 0x06, 0x1e02 }, | ||
| 2004 | { 0x06, 0xe4f8 }, | ||
| 2005 | { 0x06, 0x48e5 }, | ||
| 2006 | { 0x06, 0xf849 }, | ||
| 2007 | { 0x06, 0xd000 }, | ||
| 2008 | { 0x06, 0x0282 }, | ||
| 2009 | { 0x06, 0x5bbf }, | ||
| 2010 | { 0x06, 0x8350 }, | ||
| 2011 | { 0x06, 0xef46 }, | ||
| 2012 | { 0x06, 0xdc19 }, | ||
| 2013 | { 0x06, 0xddd0 }, | ||
| 2014 | { 0x06, 0x0102 }, | ||
| 2015 | { 0x06, 0x825b }, | ||
| 2016 | { 0x06, 0x0282 }, | ||
| 2017 | { 0x06, 0x77e0 }, | ||
| 2018 | { 0x06, 0xf860 }, | ||
| 2019 | { 0x06, 0xe1f8 }, | ||
| 2020 | { 0x06, 0x6158 }, | ||
| 2021 | { 0x06, 0xfde4 }, | ||
| 2022 | { 0x06, 0xf860 }, | ||
| 2023 | { 0x06, 0xe5f8 }, | ||
| 2024 | { 0x06, 0x61fc }, | ||
| 2025 | { 0x06, 0x04f9 }, | ||
| 2026 | { 0x06, 0xfafb }, | ||
| 2027 | { 0x06, 0xc6bf }, | ||
| 2028 | { 0x06, 0xf840 }, | ||
| 2029 | { 0x06, 0xbe83 }, | ||
| 2030 | { 0x06, 0x50a0 }, | ||
| 2031 | { 0x06, 0x0101 }, | ||
| 2032 | { 0x06, 0x071b }, | ||
| 2033 | { 0x06, 0x89cf }, | ||
| 2034 | { 0x06, 0xd208 }, | ||
| 2035 | { 0x06, 0xebdb }, | ||
| 2036 | { 0x06, 0x19b2 }, | ||
| 2037 | { 0x06, 0xfbff }, | ||
| 2038 | { 0x06, 0xfefd }, | ||
| 2039 | { 0x06, 0x04f8 }, | ||
| 2040 | { 0x06, 0xe0f8 }, | ||
| 2041 | { 0x06, 0x48e1 }, | ||
| 2042 | { 0x06, 0xf849 }, | ||
| 2043 | { 0x06, 0x6808 }, | ||
| 2044 | { 0x06, 0xe4f8 }, | ||
| 2045 | { 0x06, 0x48e5 }, | ||
| 2046 | { 0x06, 0xf849 }, | ||
| 2047 | { 0x06, 0x58f7 }, | ||
| 2048 | { 0x06, 0xe4f8 }, | ||
| 2049 | { 0x06, 0x48e5 }, | ||
| 2050 | { 0x06, 0xf849 }, | ||
| 2051 | { 0x06, 0xfc04 }, | ||
| 2052 | { 0x06, 0x4d20 }, | ||
| 2053 | { 0x06, 0x0002 }, | ||
| 2054 | { 0x06, 0x4e22 }, | ||
| 2055 | { 0x06, 0x0002 }, | ||
| 2056 | { 0x06, 0x4ddf }, | ||
| 2057 | { 0x06, 0xff01 }, | ||
| 2058 | { 0x06, 0x4edd }, | ||
| 2059 | { 0x06, 0xff01 }, | ||
| 2060 | { 0x05, 0x83d4 }, | ||
| 2061 | { 0x06, 0x8000 }, | ||
| 2062 | { 0x05, 0x83d8 }, | ||
| 2063 | { 0x06, 0x8051 }, | ||
| 2064 | { 0x02, 0x6010 }, | ||
| 2065 | { 0x03, 0xdc00 }, | ||
| 2066 | { 0x05, 0xfff6 }, | ||
| 2067 | { 0x06, 0x00fc }, | ||
| 1671 | { 0x1f, 0x0000 }, | 2068 | { 0x1f, 0x0000 }, |
| 1672 | { 0x14, 0x0060 }, | 2069 | |
| 1673 | { 0x1f, 0x0000 }, | 2070 | { 0x1f, 0x0000 }, |
| 1674 | { 0x0d, 0xf8a0 }, | 2071 | { 0x0d, 0xf880 }, |
| 2072 | { 0x1f, 0x0000 } | ||
| 2073 | }; | ||
| 2074 | |||
| 2075 | rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0)); | ||
| 2076 | |||
| 2077 | mdio_write(ioaddr, 0x1f, 0x0002); | ||
| 2078 | mdio_plus_minus(ioaddr, 0x0b, 0x0010, 0x00ef); | ||
| 2079 | mdio_plus_minus(ioaddr, 0x0c, 0xa200, 0x5d00); | ||
| 2080 | |||
| 2081 | rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1)); | ||
| 2082 | |||
| 2083 | if (rtl8168d_efuse_read(ioaddr, 0x01) == 0xb1) { | ||
| 2084 | struct phy_reg phy_reg_init[] = { | ||
| 2085 | { 0x1f, 0x0002 }, | ||
| 2086 | { 0x05, 0x669a }, | ||
| 2087 | { 0x1f, 0x0005 }, | ||
| 2088 | { 0x05, 0x8330 }, | ||
| 2089 | { 0x06, 0x669a }, | ||
| 2090 | { 0x1f, 0x0002 } | ||
| 2091 | }; | ||
| 2092 | int val; | ||
| 2093 | |||
| 2094 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | ||
| 2095 | |||
| 2096 | val = mdio_read(ioaddr, 0x0d); | ||
| 2097 | |||
| 2098 | if ((val & 0x00ff) != 0x006c) { | ||
| 2099 | u32 set[] = { | ||
| 2100 | 0x0065, 0x0066, 0x0067, 0x0068, | ||
| 2101 | 0x0069, 0x006a, 0x006b, 0x006c | ||
| 2102 | }; | ||
| 2103 | int i; | ||
| 2104 | |||
| 2105 | mdio_write(ioaddr, 0x1f, 0x0002); | ||
| 2106 | |||
| 2107 | val &= 0xff00; | ||
| 2108 | for (i = 0; i < ARRAY_SIZE(set); i++) | ||
| 2109 | mdio_write(ioaddr, 0x0d, val | set[i]); | ||
| 2110 | } | ||
| 2111 | } else { | ||
| 2112 | struct phy_reg phy_reg_init[] = { | ||
| 2113 | { 0x1f, 0x0002 }, | ||
| 2114 | { 0x05, 0x6662 }, | ||
| 2115 | { 0x1f, 0x0005 }, | ||
| 2116 | { 0x05, 0x8330 }, | ||
| 2117 | { 0x06, 0x6662 } | ||
| 2118 | }; | ||
| 2119 | |||
| 2120 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | ||
| 2121 | } | ||
| 2122 | |||
| 2123 | mdio_write(ioaddr, 0x1f, 0x0002); | ||
| 2124 | mdio_patch(ioaddr, 0x0d, 0x0300); | ||
| 2125 | mdio_patch(ioaddr, 0x0f, 0x0010); | ||
| 2126 | |||
| 2127 | mdio_write(ioaddr, 0x1f, 0x0002); | ||
| 2128 | mdio_plus_minus(ioaddr, 0x02, 0x0100, 0x0600); | ||
| 2129 | mdio_plus_minus(ioaddr, 0x03, 0x0000, 0xe000); | ||
| 2130 | |||
| 2131 | rtl_phy_write(ioaddr, phy_reg_init_2, ARRAY_SIZE(phy_reg_init_2)); | ||
| 2132 | } | ||
| 2133 | |||
| 2134 | static void rtl8168d_2_hw_phy_config(void __iomem *ioaddr) | ||
| 2135 | { | ||
| 2136 | static struct phy_reg phy_reg_init_0[] = { | ||
| 2137 | { 0x1f, 0x0001 }, | ||
| 2138 | { 0x06, 0x4064 }, | ||
| 2139 | { 0x07, 0x2863 }, | ||
| 2140 | { 0x08, 0x059c }, | ||
| 2141 | { 0x09, 0x26b4 }, | ||
| 2142 | { 0x0a, 0x6a19 }, | ||
| 2143 | { 0x0b, 0xdcc8 }, | ||
| 2144 | { 0x10, 0xf06d }, | ||
| 2145 | { 0x14, 0x7f68 }, | ||
| 2146 | { 0x18, 0x7fd9 }, | ||
| 2147 | { 0x1c, 0xf0ff }, | ||
| 2148 | { 0x1d, 0x3d9c }, | ||
| 2149 | { 0x1f, 0x0003 }, | ||
| 2150 | { 0x12, 0xf49f }, | ||
| 2151 | { 0x13, 0x070b }, | ||
| 2152 | { 0x1a, 0x05ad }, | ||
| 2153 | { 0x14, 0x94c0 }, | ||
| 2154 | |||
| 2155 | { 0x1f, 0x0002 }, | ||
| 2156 | { 0x06, 0x5561 }, | ||
| 2157 | { 0x1f, 0x0005 }, | ||
| 2158 | { 0x05, 0x8332 }, | ||
| 2159 | { 0x06, 0x5561 } | ||
| 2160 | }; | ||
| 2161 | static struct phy_reg phy_reg_init_1[] = { | ||
| 2162 | { 0x1f, 0x0005 }, | ||
| 2163 | { 0x05, 0xffc2 }, | ||
| 1675 | { 0x1f, 0x0005 }, | 2164 | { 0x1f, 0x0005 }, |
| 1676 | { 0x05, 0xffc2 } | 2165 | { 0x05, 0x8000 }, |
| 2166 | { 0x06, 0xf8f9 }, | ||
| 2167 | { 0x06, 0xfaee }, | ||
| 2168 | { 0x06, 0xf8ea }, | ||
| 2169 | { 0x06, 0x00ee }, | ||
| 2170 | { 0x06, 0xf8eb }, | ||
| 2171 | { 0x06, 0x00e2 }, | ||
| 2172 | { 0x06, 0xf87c }, | ||
| 2173 | { 0x06, 0xe3f8 }, | ||
| 2174 | { 0x06, 0x7da5 }, | ||
| 2175 | { 0x06, 0x1111 }, | ||
| 2176 | { 0x06, 0x12d2 }, | ||
| 2177 | { 0x06, 0x40d6 }, | ||
| 2178 | { 0x06, 0x4444 }, | ||
| 2179 | { 0x06, 0x0281 }, | ||
| 2180 | { 0x06, 0xc6d2 }, | ||
| 2181 | { 0x06, 0xa0d6 }, | ||
| 2182 | { 0x06, 0xaaaa }, | ||
| 2183 | { 0x06, 0x0281 }, | ||
| 2184 | { 0x06, 0xc6ae }, | ||
| 2185 | { 0x06, 0x0fa5 }, | ||
| 2186 | { 0x06, 0x4444 }, | ||
| 2187 | { 0x06, 0x02ae }, | ||
| 2188 | { 0x06, 0x4da5 }, | ||
| 2189 | { 0x06, 0xaaaa }, | ||
| 2190 | { 0x06, 0x02ae }, | ||
| 2191 | { 0x06, 0x47af }, | ||
| 2192 | { 0x06, 0x81c2 }, | ||
| 2193 | { 0x06, 0xee83 }, | ||
| 2194 | { 0x06, 0x4e00 }, | ||
| 2195 | { 0x06, 0xee83 }, | ||
| 2196 | { 0x06, 0x4d0f }, | ||
| 2197 | { 0x06, 0xee83 }, | ||
| 2198 | { 0x06, 0x4c0f }, | ||
| 2199 | { 0x06, 0xee83 }, | ||
| 2200 | { 0x06, 0x4f00 }, | ||
| 2201 | { 0x06, 0xee83 }, | ||
| 2202 | { 0x06, 0x5100 }, | ||
| 2203 | { 0x06, 0xee83 }, | ||
| 2204 | { 0x06, 0x4aff }, | ||
| 2205 | { 0x06, 0xee83 }, | ||
| 2206 | { 0x06, 0x4bff }, | ||
| 2207 | { 0x06, 0xe083 }, | ||
| 2208 | { 0x06, 0x30e1 }, | ||
| 2209 | { 0x06, 0x8331 }, | ||
| 2210 | { 0x06, 0x58fe }, | ||
| 2211 | { 0x06, 0xe4f8 }, | ||
| 2212 | { 0x06, 0x8ae5 }, | ||
| 2213 | { 0x06, 0xf88b }, | ||
| 2214 | { 0x06, 0xe083 }, | ||
| 2215 | { 0x06, 0x32e1 }, | ||
| 2216 | { 0x06, 0x8333 }, | ||
| 2217 | { 0x06, 0x590f }, | ||
| 2218 | { 0x06, 0xe283 }, | ||
| 2219 | { 0x06, 0x4d0c }, | ||
| 2220 | { 0x06, 0x245a }, | ||
| 2221 | { 0x06, 0xf01e }, | ||
| 2222 | { 0x06, 0x12e4 }, | ||
| 2223 | { 0x06, 0xf88c }, | ||
| 2224 | { 0x06, 0xe5f8 }, | ||
| 2225 | { 0x06, 0x8daf }, | ||
| 2226 | { 0x06, 0x81c2 }, | ||
| 2227 | { 0x06, 0xe083 }, | ||
| 2228 | { 0x06, 0x4f10 }, | ||
| 2229 | { 0x06, 0xe483 }, | ||
| 2230 | { 0x06, 0x4fe0 }, | ||
| 2231 | { 0x06, 0x834e }, | ||
| 2232 | { 0x06, 0x7800 }, | ||
| 2233 | { 0x06, 0x9f0a }, | ||
| 2234 | { 0x06, 0xe083 }, | ||
| 2235 | { 0x06, 0x4fa0 }, | ||
| 2236 | { 0x06, 0x10a5 }, | ||
| 2237 | { 0x06, 0xee83 }, | ||
| 2238 | { 0x06, 0x4e01 }, | ||
| 2239 | { 0x06, 0xe083 }, | ||
| 2240 | { 0x06, 0x4e78 }, | ||
| 2241 | { 0x06, 0x059e }, | ||
| 2242 | { 0x06, 0x9ae0 }, | ||
| 2243 | { 0x06, 0x834e }, | ||
| 2244 | { 0x06, 0x7804 }, | ||
| 2245 | { 0x06, 0x9e10 }, | ||
| 2246 | { 0x06, 0xe083 }, | ||
| 2247 | { 0x06, 0x4e78 }, | ||
| 2248 | { 0x06, 0x039e }, | ||
| 2249 | { 0x06, 0x0fe0 }, | ||
| 2250 | { 0x06, 0x834e }, | ||
| 2251 | { 0x06, 0x7801 }, | ||
| 2252 | { 0x06, 0x9e05 }, | ||
| 2253 | { 0x06, 0xae0c }, | ||
| 2254 | { 0x06, 0xaf81 }, | ||
| 2255 | { 0x06, 0xa7af }, | ||
| 2256 | { 0x06, 0x8152 }, | ||
| 2257 | { 0x06, 0xaf81 }, | ||
| 2258 | { 0x06, 0x8baf }, | ||
| 2259 | { 0x06, 0x81c2 }, | ||
| 2260 | { 0x06, 0xee83 }, | ||
| 2261 | { 0x06, 0x4800 }, | ||
| 2262 | { 0x06, 0xee83 }, | ||
| 2263 | { 0x06, 0x4900 }, | ||
| 2264 | { 0x06, 0xe083 }, | ||
| 2265 | { 0x06, 0x5110 }, | ||
| 2266 | { 0x06, 0xe483 }, | ||
| 2267 | { 0x06, 0x5158 }, | ||
| 2268 | { 0x06, 0x019f }, | ||
| 2269 | { 0x06, 0xead0 }, | ||
| 2270 | { 0x06, 0x00d1 }, | ||
| 2271 | { 0x06, 0x801f }, | ||
| 2272 | { 0x06, 0x66e2 }, | ||
| 2273 | { 0x06, 0xf8ea }, | ||
| 2274 | { 0x06, 0xe3f8 }, | ||
| 2275 | { 0x06, 0xeb5a }, | ||
| 2276 | { 0x06, 0xf81e }, | ||
| 2277 | { 0x06, 0x20e6 }, | ||
| 2278 | { 0x06, 0xf8ea }, | ||
| 2279 | { 0x06, 0xe5f8 }, | ||
| 2280 | { 0x06, 0xebd3 }, | ||
| 2281 | { 0x06, 0x02b3 }, | ||
| 2282 | { 0x06, 0xfee2 }, | ||
| 2283 | { 0x06, 0xf87c }, | ||
| 2284 | { 0x06, 0xef32 }, | ||
| 2285 | { 0x06, 0x5b80 }, | ||
| 2286 | { 0x06, 0xe3f8 }, | ||
| 2287 | { 0x06, 0x7d9e }, | ||
| 2288 | { 0x06, 0x037d }, | ||
| 2289 | { 0x06, 0xffff }, | ||
| 2290 | { 0x06, 0x0d58 }, | ||
| 2291 | { 0x06, 0x1c55 }, | ||
| 2292 | { 0x06, 0x1a65 }, | ||
| 2293 | { 0x06, 0x11a1 }, | ||
| 2294 | { 0x06, 0x90d3 }, | ||
| 2295 | { 0x06, 0xe283 }, | ||
| 2296 | { 0x06, 0x48e3 }, | ||
| 2297 | { 0x06, 0x8349 }, | ||
| 2298 | { 0x06, 0x1b56 }, | ||
| 2299 | { 0x06, 0xab08 }, | ||
| 2300 | { 0x06, 0xef56 }, | ||
| 2301 | { 0x06, 0xe683 }, | ||
| 2302 | { 0x06, 0x48e7 }, | ||
| 2303 | { 0x06, 0x8349 }, | ||
| 2304 | { 0x06, 0x10d1 }, | ||
| 2305 | { 0x06, 0x801f }, | ||
| 2306 | { 0x06, 0x66a0 }, | ||
| 2307 | { 0x06, 0x04b9 }, | ||
| 2308 | { 0x06, 0xe283 }, | ||
| 2309 | { 0x06, 0x48e3 }, | ||
| 2310 | { 0x06, 0x8349 }, | ||
| 2311 | { 0x06, 0xef65 }, | ||
| 2312 | { 0x06, 0xe283 }, | ||
| 2313 | { 0x06, 0x4ae3 }, | ||
| 2314 | { 0x06, 0x834b }, | ||
| 2315 | { 0x06, 0x1b56 }, | ||
| 2316 | { 0x06, 0xaa0e }, | ||
| 2317 | { 0x06, 0xef56 }, | ||
| 2318 | { 0x06, 0xe683 }, | ||
| 2319 | { 0x06, 0x4ae7 }, | ||
| 2320 | { 0x06, 0x834b }, | ||
| 2321 | { 0x06, 0xe283 }, | ||
| 2322 | { 0x06, 0x4de6 }, | ||
| 2323 | { 0x06, 0x834c }, | ||
| 2324 | { 0x06, 0xe083 }, | ||
| 2325 | { 0x06, 0x4da0 }, | ||
| 2326 | { 0x06, 0x000c }, | ||
| 2327 | { 0x06, 0xaf81 }, | ||
| 2328 | { 0x06, 0x8be0 }, | ||
| 2329 | { 0x06, 0x834d }, | ||
| 2330 | { 0x06, 0x10e4 }, | ||
| 2331 | { 0x06, 0x834d }, | ||
| 2332 | { 0x06, 0xae04 }, | ||
| 2333 | { 0x06, 0x80e4 }, | ||
| 2334 | { 0x06, 0x834d }, | ||
| 2335 | { 0x06, 0xe083 }, | ||
| 2336 | { 0x06, 0x4e78 }, | ||
| 2337 | { 0x06, 0x039e }, | ||
| 2338 | { 0x06, 0x0be0 }, | ||
| 2339 | { 0x06, 0x834e }, | ||
| 2340 | { 0x06, 0x7804 }, | ||
| 2341 | { 0x06, 0x9e04 }, | ||
| 2342 | { 0x06, 0xee83 }, | ||
| 2343 | { 0x06, 0x4e02 }, | ||
| 2344 | { 0x06, 0xe083 }, | ||
| 2345 | { 0x06, 0x32e1 }, | ||
| 2346 | { 0x06, 0x8333 }, | ||
| 2347 | { 0x06, 0x590f }, | ||
| 2348 | { 0x06, 0xe283 }, | ||
| 2349 | { 0x06, 0x4d0c }, | ||
| 2350 | { 0x06, 0x245a }, | ||
| 2351 | { 0x06, 0xf01e }, | ||
| 2352 | { 0x06, 0x12e4 }, | ||
| 2353 | { 0x06, 0xf88c }, | ||
| 2354 | { 0x06, 0xe5f8 }, | ||
| 2355 | { 0x06, 0x8de0 }, | ||
| 2356 | { 0x06, 0x8330 }, | ||
| 2357 | { 0x06, 0xe183 }, | ||
| 2358 | { 0x06, 0x3168 }, | ||
| 2359 | { 0x06, 0x01e4 }, | ||
| 2360 | { 0x06, 0xf88a }, | ||
| 2361 | { 0x06, 0xe5f8 }, | ||
| 2362 | { 0x06, 0x8bae }, | ||
| 2363 | { 0x06, 0x37ee }, | ||
| 2364 | { 0x06, 0x834e }, | ||
| 2365 | { 0x06, 0x03e0 }, | ||
| 2366 | { 0x06, 0x834c }, | ||
| 2367 | { 0x06, 0xe183 }, | ||
| 2368 | { 0x06, 0x4d1b }, | ||
| 2369 | { 0x06, 0x019e }, | ||
| 2370 | { 0x06, 0x04aa }, | ||
| 2371 | { 0x06, 0xa1ae }, | ||
| 2372 | { 0x06, 0xa8ee }, | ||
| 2373 | { 0x06, 0x834e }, | ||
| 2374 | { 0x06, 0x04ee }, | ||
| 2375 | { 0x06, 0x834f }, | ||
| 2376 | { 0x06, 0x00ae }, | ||
| 2377 | { 0x06, 0xabe0 }, | ||
| 2378 | { 0x06, 0x834f }, | ||
| 2379 | { 0x06, 0x7803 }, | ||
| 2380 | { 0x06, 0x9f14 }, | ||
| 2381 | { 0x06, 0xee83 }, | ||
| 2382 | { 0x06, 0x4e05 }, | ||
| 2383 | { 0x06, 0xd240 }, | ||
| 2384 | { 0x06, 0xd655 }, | ||
| 2385 | { 0x06, 0x5402 }, | ||
| 2386 | { 0x06, 0x81c6 }, | ||
| 2387 | { 0x06, 0xd2a0 }, | ||
| 2388 | { 0x06, 0xd6ba }, | ||
| 2389 | { 0x06, 0x0002 }, | ||
| 2390 | { 0x06, 0x81c6 }, | ||
| 2391 | { 0x06, 0xfefd }, | ||
| 2392 | { 0x06, 0xfc05 }, | ||
| 2393 | { 0x06, 0xf8e0 }, | ||
| 2394 | { 0x06, 0xf860 }, | ||
| 2395 | { 0x06, 0xe1f8 }, | ||
| 2396 | { 0x06, 0x6168 }, | ||
| 2397 | { 0x06, 0x02e4 }, | ||
| 2398 | { 0x06, 0xf860 }, | ||
| 2399 | { 0x06, 0xe5f8 }, | ||
| 2400 | { 0x06, 0x61e0 }, | ||
| 2401 | { 0x06, 0xf848 }, | ||
| 2402 | { 0x06, 0xe1f8 }, | ||
| 2403 | { 0x06, 0x4958 }, | ||
| 2404 | { 0x06, 0x0f1e }, | ||
| 2405 | { 0x06, 0x02e4 }, | ||
| 2406 | { 0x06, 0xf848 }, | ||
| 2407 | { 0x06, 0xe5f8 }, | ||
| 2408 | { 0x06, 0x49d0 }, | ||
| 2409 | { 0x06, 0x0002 }, | ||
| 2410 | { 0x06, 0x820a }, | ||
| 2411 | { 0x06, 0xbf83 }, | ||
| 2412 | { 0x06, 0x50ef }, | ||
| 2413 | { 0x06, 0x46dc }, | ||
| 2414 | { 0x06, 0x19dd }, | ||
| 2415 | { 0x06, 0xd001 }, | ||
| 2416 | { 0x06, 0x0282 }, | ||
| 2417 | { 0x06, 0x0a02 }, | ||
| 2418 | { 0x06, 0x8226 }, | ||
| 2419 | { 0x06, 0xe0f8 }, | ||
| 2420 | { 0x06, 0x60e1 }, | ||
| 2421 | { 0x06, 0xf861 }, | ||
| 2422 | { 0x06, 0x58fd }, | ||
| 2423 | { 0x06, 0xe4f8 }, | ||
| 2424 | { 0x06, 0x60e5 }, | ||
| 2425 | { 0x06, 0xf861 }, | ||
| 2426 | { 0x06, 0xfc04 }, | ||
| 2427 | { 0x06, 0xf9fa }, | ||
| 2428 | { 0x06, 0xfbc6 }, | ||
| 2429 | { 0x06, 0xbff8 }, | ||
| 2430 | { 0x06, 0x40be }, | ||
| 2431 | { 0x06, 0x8350 }, | ||
| 2432 | { 0x06, 0xa001 }, | ||
| 2433 | { 0x06, 0x0107 }, | ||
| 2434 | { 0x06, 0x1b89 }, | ||
| 2435 | { 0x06, 0xcfd2 }, | ||
| 2436 | { 0x06, 0x08eb }, | ||
| 2437 | { 0x06, 0xdb19 }, | ||
| 2438 | { 0x06, 0xb2fb }, | ||
| 2439 | { 0x06, 0xfffe }, | ||
| 2440 | { 0x06, 0xfd04 }, | ||
| 2441 | { 0x06, 0xf8e0 }, | ||
| 2442 | { 0x06, 0xf848 }, | ||
| 2443 | { 0x06, 0xe1f8 }, | ||
| 2444 | { 0x06, 0x4968 }, | ||
| 2445 | { 0x06, 0x08e4 }, | ||
| 2446 | { 0x06, 0xf848 }, | ||
| 2447 | { 0x06, 0xe5f8 }, | ||
| 2448 | { 0x06, 0x4958 }, | ||
| 2449 | { 0x06, 0xf7e4 }, | ||
| 2450 | { 0x06, 0xf848 }, | ||
| 2451 | { 0x06, 0xe5f8 }, | ||
| 2452 | { 0x06, 0x49fc }, | ||
| 2453 | { 0x06, 0x044d }, | ||
| 2454 | { 0x06, 0x2000 }, | ||
| 2455 | { 0x06, 0x024e }, | ||
| 2456 | { 0x06, 0x2200 }, | ||
| 2457 | { 0x06, 0x024d }, | ||
| 2458 | { 0x06, 0xdfff }, | ||
| 2459 | { 0x06, 0x014e }, | ||
| 2460 | { 0x06, 0xddff }, | ||
| 2461 | { 0x06, 0x0100 }, | ||
| 2462 | { 0x05, 0x83d8 }, | ||
| 2463 | { 0x06, 0x8000 }, | ||
| 2464 | { 0x03, 0xdc00 }, | ||
| 2465 | { 0x05, 0xfff6 }, | ||
| 2466 | { 0x06, 0x00fc }, | ||
| 2467 | { 0x1f, 0x0000 }, | ||
| 2468 | |||
| 2469 | { 0x1f, 0x0000 }, | ||
| 2470 | { 0x0d, 0xf880 }, | ||
| 2471 | { 0x1f, 0x0000 } | ||
| 1677 | }; | 2472 | }; |
| 1678 | 2473 | ||
| 1679 | rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0)); | 2474 | rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0)); |
| 1680 | 2475 | ||
| 1681 | if (mdio_read(ioaddr, 0x06) == 0xc400) { | 2476 | if (rtl8168d_efuse_read(ioaddr, 0x01) == 0xb1) { |
| 1682 | struct phy_reg phy_reg_init_1[] = { | 2477 | struct phy_reg phy_reg_init[] = { |
| 2478 | { 0x1f, 0x0002 }, | ||
| 2479 | { 0x05, 0x669a }, | ||
| 1683 | { 0x1f, 0x0005 }, | 2480 | { 0x1f, 0x0005 }, |
| 1684 | { 0x01, 0x0300 }, | 2481 | { 0x05, 0x8330 }, |
| 1685 | { 0x1f, 0x0000 }, | 2482 | { 0x06, 0x669a }, |
| 1686 | { 0x11, 0x401c }, | 2483 | |
| 1687 | { 0x16, 0x4100 }, | 2484 | { 0x1f, 0x0002 } |
| 2485 | }; | ||
| 2486 | int val; | ||
| 2487 | |||
| 2488 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | ||
| 2489 | |||
| 2490 | val = mdio_read(ioaddr, 0x0d); | ||
| 2491 | if ((val & 0x00ff) != 0x006c) { | ||
| 2492 | u32 set[] = { | ||
| 2493 | 0x0065, 0x0066, 0x0067, 0x0068, | ||
| 2494 | 0x0069, 0x006a, 0x006b, 0x006c | ||
| 2495 | }; | ||
| 2496 | int i; | ||
| 2497 | |||
| 2498 | mdio_write(ioaddr, 0x1f, 0x0002); | ||
| 2499 | |||
| 2500 | val &= 0xff00; | ||
| 2501 | for (i = 0; i < ARRAY_SIZE(set); i++) | ||
| 2502 | mdio_write(ioaddr, 0x0d, val | set[i]); | ||
| 2503 | } | ||
| 2504 | } else { | ||
| 2505 | struct phy_reg phy_reg_init[] = { | ||
| 2506 | { 0x1f, 0x0002 }, | ||
| 2507 | { 0x05, 0x2642 }, | ||
| 1688 | { 0x1f, 0x0005 }, | 2508 | { 0x1f, 0x0005 }, |
| 1689 | { 0x07, 0x0010 }, | 2509 | { 0x05, 0x8330 }, |
| 1690 | { 0x05, 0x83dc }, | 2510 | { 0x06, 0x2642 } |
| 1691 | { 0x06, 0x087d }, | ||
| 1692 | { 0x05, 0x8300 }, | ||
| 1693 | { 0x06, 0x0101 }, | ||
| 1694 | { 0x06, 0x05f8 }, | ||
| 1695 | { 0x06, 0xf9fa }, | ||
| 1696 | { 0x06, 0xfbef }, | ||
| 1697 | { 0x06, 0x79e2 }, | ||
| 1698 | { 0x06, 0x835f }, | ||
| 1699 | { 0x06, 0xe0f8 }, | ||
| 1700 | { 0x06, 0x9ae1 }, | ||
| 1701 | { 0x06, 0xf89b }, | ||
| 1702 | { 0x06, 0xef31 }, | ||
| 1703 | { 0x06, 0x3b65 }, | ||
| 1704 | { 0x06, 0xaa07 }, | ||
| 1705 | { 0x06, 0x81e4 }, | ||
| 1706 | { 0x06, 0xf89a }, | ||
| 1707 | { 0x06, 0xe5f8 }, | ||
| 1708 | { 0x06, 0x9baf }, | ||
| 1709 | { 0x06, 0x06ae }, | ||
| 1710 | { 0x05, 0x83dc }, | ||
| 1711 | { 0x06, 0x8300 }, | ||
| 1712 | }; | 2511 | }; |
| 1713 | 2512 | ||
| 1714 | rtl_phy_write(ioaddr, phy_reg_init_1, | 2513 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); |
| 1715 | ARRAY_SIZE(phy_reg_init_1)); | ||
| 1716 | } | 2514 | } |
| 1717 | 2515 | ||
| 1718 | mdio_write(ioaddr, 0x1f, 0x0000); | 2516 | mdio_write(ioaddr, 0x1f, 0x0002); |
| 2517 | mdio_plus_minus(ioaddr, 0x02, 0x0100, 0x0600); | ||
| 2518 | mdio_plus_minus(ioaddr, 0x03, 0x0000, 0xe000); | ||
| 2519 | |||
| 2520 | mdio_write(ioaddr, 0x1f, 0x0001); | ||
| 2521 | mdio_write(ioaddr, 0x17, 0x0cc0); | ||
| 2522 | |||
| 2523 | mdio_write(ioaddr, 0x1f, 0x0002); | ||
| 2524 | mdio_patch(ioaddr, 0x0f, 0x0017); | ||
| 2525 | |||
| 2526 | rtl_phy_write(ioaddr, phy_reg_init_1, ARRAY_SIZE(phy_reg_init_1)); | ||
| 2527 | } | ||
| 2528 | |||
| 2529 | static void rtl8168d_3_hw_phy_config(void __iomem *ioaddr) | ||
| 2530 | { | ||
| 2531 | struct phy_reg phy_reg_init[] = { | ||
| 2532 | { 0x1f, 0x0002 }, | ||
| 2533 | { 0x10, 0x0008 }, | ||
| 2534 | { 0x0d, 0x006c }, | ||
| 2535 | |||
| 2536 | { 0x1f, 0x0000 }, | ||
| 2537 | { 0x0d, 0xf880 }, | ||
| 2538 | |||
| 2539 | { 0x1f, 0x0001 }, | ||
| 2540 | { 0x17, 0x0cc0 }, | ||
| 2541 | |||
| 2542 | { 0x1f, 0x0001 }, | ||
| 2543 | { 0x0b, 0xa4d8 }, | ||
| 2544 | { 0x09, 0x281c }, | ||
| 2545 | { 0x07, 0x2883 }, | ||
| 2546 | { 0x0a, 0x6b35 }, | ||
| 2547 | { 0x1d, 0x3da4 }, | ||
| 2548 | { 0x1c, 0xeffd }, | ||
| 2549 | { 0x14, 0x7f52 }, | ||
| 2550 | { 0x18, 0x7fc6 }, | ||
| 2551 | { 0x08, 0x0601 }, | ||
| 2552 | { 0x06, 0x4063 }, | ||
| 2553 | { 0x10, 0xf074 }, | ||
| 2554 | { 0x1f, 0x0003 }, | ||
| 2555 | { 0x13, 0x0789 }, | ||
| 2556 | { 0x12, 0xf4bd }, | ||
| 2557 | { 0x1a, 0x04fd }, | ||
| 2558 | { 0x14, 0x84b0 }, | ||
| 2559 | { 0x1f, 0x0000 }, | ||
| 2560 | { 0x00, 0x9200 }, | ||
| 2561 | |||
| 2562 | { 0x1f, 0x0005 }, | ||
| 2563 | { 0x01, 0x0340 }, | ||
| 2564 | { 0x1f, 0x0001 }, | ||
| 2565 | { 0x04, 0x4000 }, | ||
| 2566 | { 0x03, 0x1d21 }, | ||
| 2567 | { 0x02, 0x0c32 }, | ||
| 2568 | { 0x01, 0x0200 }, | ||
| 2569 | { 0x00, 0x5554 }, | ||
| 2570 | { 0x04, 0x4800 }, | ||
| 2571 | { 0x04, 0x4000 }, | ||
| 2572 | { 0x04, 0xf000 }, | ||
| 2573 | { 0x03, 0xdf01 }, | ||
| 2574 | { 0x02, 0xdf20 }, | ||
| 2575 | { 0x01, 0x101a }, | ||
| 2576 | { 0x00, 0xa0ff }, | ||
| 2577 | { 0x04, 0xf800 }, | ||
| 2578 | { 0x04, 0xf000 }, | ||
| 2579 | { 0x1f, 0x0000 }, | ||
| 2580 | |||
| 2581 | { 0x1f, 0x0007 }, | ||
| 2582 | { 0x1e, 0x0023 }, | ||
| 2583 | { 0x16, 0x0000 }, | ||
| 2584 | { 0x1f, 0x0000 } | ||
| 2585 | }; | ||
| 2586 | |||
| 2587 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | ||
| 1719 | } | 2588 | } |
| 1720 | 2589 | ||
| 1721 | static void rtl8102e_hw_phy_config(void __iomem *ioaddr) | 2590 | static void rtl8102e_hw_phy_config(void __iomem *ioaddr) |
| @@ -1792,7 +2661,13 @@ static void rtl_hw_phy_config(struct net_device *dev) | |||
| 1792 | rtl8168cp_2_hw_phy_config(ioaddr); | 2661 | rtl8168cp_2_hw_phy_config(ioaddr); |
| 1793 | break; | 2662 | break; |
| 1794 | case RTL_GIGA_MAC_VER_25: | 2663 | case RTL_GIGA_MAC_VER_25: |
| 1795 | rtl8168d_hw_phy_config(ioaddr); | 2664 | rtl8168d_1_hw_phy_config(ioaddr); |
| 2665 | break; | ||
| 2666 | case RTL_GIGA_MAC_VER_26: | ||
| 2667 | rtl8168d_2_hw_phy_config(ioaddr); | ||
| 2668 | break; | ||
| 2669 | case RTL_GIGA_MAC_VER_27: | ||
| 2670 | rtl8168d_3_hw_phy_config(ioaddr); | ||
| 1796 | break; | 2671 | break; |
| 1797 | 2672 | ||
| 1798 | default: | 2673 | default: |
| @@ -2863,6 +3738,8 @@ static void rtl_hw_start_8168(struct net_device *dev) | |||
| 2863 | break; | 3738 | break; |
| 2864 | 3739 | ||
| 2865 | case RTL_GIGA_MAC_VER_25: | 3740 | case RTL_GIGA_MAC_VER_25: |
| 3741 | case RTL_GIGA_MAC_VER_26: | ||
| 3742 | case RTL_GIGA_MAC_VER_27: | ||
| 2866 | rtl_hw_start_8168d(ioaddr, pdev); | 3743 | rtl_hw_start_8168d(ioaddr, pdev); |
| 2867 | break; | 3744 | break; |
| 2868 | 3745 | ||
diff --git a/drivers/net/stmmac/Kconfig b/drivers/net/stmmac/Kconfig new file mode 100644 index 000000000000..35eaa5251d7f --- /dev/null +++ b/drivers/net/stmmac/Kconfig | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | config STMMAC_ETH | ||
| 2 | tristate "STMicroelectronics 10/100/1000 Ethernet driver" | ||
| 3 | select MII | ||
| 4 | select PHYLIB | ||
| 5 | depends on NETDEVICES && CPU_SUBTYPE_ST40 | ||
| 6 | help | ||
| 7 | This is the driver for the ST MAC 10/100/1000 on-chip Ethernet | ||
| 8 | controllers. ST Ethernet IPs are built around a Synopsys IP Core. | ||
| 9 | |||
| 10 | if STMMAC_ETH | ||
| 11 | |||
| 12 | config STMMAC_DA | ||
| 13 | bool "STMMAC DMA arbitration scheme" | ||
| 14 | default n | ||
| 15 | help | ||
| 16 | Selecting this option, rx has priority over Tx (only for Giga | ||
| 17 | Ethernet device). | ||
| 18 | By default, the DMA arbitration scheme is based on Round-robin | ||
| 19 | (rx:tx priority is 1:1). | ||
| 20 | |||
| 21 | config STMMAC_DUAL_MAC | ||
| 22 | bool "STMMAC: dual mac support (EXPERIMENTAL)" | ||
| 23 | default n | ||
| 24 | depends on EXPERIMENTAL && STMMAC_ETH && !STMMAC_TIMER | ||
| 25 | help | ||
| 26 | Some ST SoCs (for example the stx7141 and stx7200c2) have two | ||
| 27 | Ethernet Controllers. This option turns on the second Ethernet | ||
| 28 | device on this kind of platforms. | ||
| 29 | |||
| 30 | config STMMAC_TIMER | ||
| 31 | bool "STMMAC Timer optimisation" | ||
| 32 | default n | ||
| 33 | help | ||
| 34 | Use an external timer for mitigating the number of network | ||
| 35 | interrupts. | ||
| 36 | |||
| 37 | choice | ||
| 38 | prompt "Select Timer device" | ||
| 39 | depends on STMMAC_TIMER | ||
| 40 | |||
| 41 | config STMMAC_TMU_TIMER | ||
| 42 | bool "TMU channel 2" | ||
| 43 | depends on CPU_SH4 | ||
| 44 | help | ||
| 45 | |||
| 46 | config STMMAC_RTC_TIMER | ||
| 47 | bool "Real time clock" | ||
| 48 | depends on RTC_CLASS | ||
| 49 | help | ||
| 50 | |||
| 51 | endchoice | ||
| 52 | |||
| 53 | endif | ||
diff --git a/drivers/net/stmmac/Makefile b/drivers/net/stmmac/Makefile new file mode 100644 index 000000000000..b2d7a5564dfa --- /dev/null +++ b/drivers/net/stmmac/Makefile | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | obj-$(CONFIG_STMMAC_ETH) += stmmac.o | ||
| 2 | stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o | ||
| 3 | stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o \ | ||
| 4 | mac100.o gmac.o $(stmmac-y) | ||
diff --git a/drivers/net/stmmac/common.h b/drivers/net/stmmac/common.h new file mode 100644 index 000000000000..e49e5188e887 --- /dev/null +++ b/drivers/net/stmmac/common.h | |||
| @@ -0,0 +1,330 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | STMMAC Common Header File | ||
| 3 | |||
| 4 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 5 | |||
| 6 | This program is free software; you can redistribute it and/or modify it | ||
| 7 | under the terms and conditions of the GNU General Public License, | ||
| 8 | version 2, as published by the Free Software Foundation. | ||
| 9 | |||
| 10 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License along with | ||
| 16 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | |||
| 19 | The full GNU General Public License is included in this distribution in | ||
| 20 | the file called "COPYING". | ||
| 21 | |||
| 22 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 23 | *******************************************************************************/ | ||
| 24 | |||
| 25 | #include "descs.h" | ||
| 26 | #include <linux/io.h> | ||
| 27 | |||
| 28 | /* ********************************************* | ||
| 29 | DMA CRS Control and Status Register Mapping | ||
| 30 | * *********************************************/ | ||
| 31 | #define DMA_BUS_MODE 0x00001000 /* Bus Mode */ | ||
| 32 | #define DMA_XMT_POLL_DEMAND 0x00001004 /* Transmit Poll Demand */ | ||
| 33 | #define DMA_RCV_POLL_DEMAND 0x00001008 /* Received Poll Demand */ | ||
| 34 | #define DMA_RCV_BASE_ADDR 0x0000100c /* Receive List Base */ | ||
| 35 | #define DMA_TX_BASE_ADDR 0x00001010 /* Transmit List Base */ | ||
| 36 | #define DMA_STATUS 0x00001014 /* Status Register */ | ||
| 37 | #define DMA_CONTROL 0x00001018 /* Ctrl (Operational Mode) */ | ||
| 38 | #define DMA_INTR_ENA 0x0000101c /* Interrupt Enable */ | ||
| 39 | #define DMA_MISSED_FRAME_CTR 0x00001020 /* Missed Frame Counter */ | ||
| 40 | #define DMA_CUR_TX_BUF_ADDR 0x00001050 /* Current Host Tx Buffer */ | ||
| 41 | #define DMA_CUR_RX_BUF_ADDR 0x00001054 /* Current Host Rx Buffer */ | ||
| 42 | |||
| 43 | /* ******************************** | ||
| 44 | DMA Control register defines | ||
| 45 | * ********************************/ | ||
| 46 | #define DMA_CONTROL_ST 0x00002000 /* Start/Stop Transmission */ | ||
| 47 | #define DMA_CONTROL_SR 0x00000002 /* Start/Stop Receive */ | ||
| 48 | |||
| 49 | /* ************************************** | ||
| 50 | DMA Interrupt Enable register defines | ||
| 51 | * **************************************/ | ||
| 52 | /**** NORMAL INTERRUPT ****/ | ||
| 53 | #define DMA_INTR_ENA_NIE 0x00010000 /* Normal Summary */ | ||
| 54 | #define DMA_INTR_ENA_TIE 0x00000001 /* Transmit Interrupt */ | ||
| 55 | #define DMA_INTR_ENA_TUE 0x00000004 /* Transmit Buffer Unavailable */ | ||
| 56 | #define DMA_INTR_ENA_RIE 0x00000040 /* Receive Interrupt */ | ||
| 57 | #define DMA_INTR_ENA_ERE 0x00004000 /* Early Receive */ | ||
| 58 | |||
| 59 | #define DMA_INTR_NORMAL (DMA_INTR_ENA_NIE | DMA_INTR_ENA_RIE | \ | ||
| 60 | DMA_INTR_ENA_TIE) | ||
| 61 | |||
| 62 | /**** ABNORMAL INTERRUPT ****/ | ||
| 63 | #define DMA_INTR_ENA_AIE 0x00008000 /* Abnormal Summary */ | ||
| 64 | #define DMA_INTR_ENA_FBE 0x00002000 /* Fatal Bus Error */ | ||
| 65 | #define DMA_INTR_ENA_ETE 0x00000400 /* Early Transmit */ | ||
| 66 | #define DMA_INTR_ENA_RWE 0x00000200 /* Receive Watchdog */ | ||
| 67 | #define DMA_INTR_ENA_RSE 0x00000100 /* Receive Stopped */ | ||
| 68 | #define DMA_INTR_ENA_RUE 0x00000080 /* Receive Buffer Unavailable */ | ||
| 69 | #define DMA_INTR_ENA_UNE 0x00000020 /* Tx Underflow */ | ||
| 70 | #define DMA_INTR_ENA_OVE 0x00000010 /* Receive Overflow */ | ||
| 71 | #define DMA_INTR_ENA_TJE 0x00000008 /* Transmit Jabber */ | ||
| 72 | #define DMA_INTR_ENA_TSE 0x00000002 /* Transmit Stopped */ | ||
| 73 | |||
| 74 | #define DMA_INTR_ABNORMAL (DMA_INTR_ENA_AIE | DMA_INTR_ENA_FBE | \ | ||
| 75 | DMA_INTR_ENA_UNE) | ||
| 76 | |||
| 77 | /* DMA default interrupt mask */ | ||
| 78 | #define DMA_INTR_DEFAULT_MASK (DMA_INTR_NORMAL | DMA_INTR_ABNORMAL) | ||
| 79 | |||
| 80 | /* **************************** | ||
| 81 | * DMA Status register defines | ||
| 82 | * ****************************/ | ||
| 83 | #define DMA_STATUS_GPI 0x10000000 /* PMT interrupt */ | ||
| 84 | #define DMA_STATUS_GMI 0x08000000 /* MMC interrupt */ | ||
| 85 | #define DMA_STATUS_GLI 0x04000000 /* GMAC Line interface int. */ | ||
| 86 | #define DMA_STATUS_GMI 0x08000000 | ||
| 87 | #define DMA_STATUS_GLI 0x04000000 | ||
| 88 | #define DMA_STATUS_EB_MASK 0x00380000 /* Error Bits Mask */ | ||
| 89 | #define DMA_STATUS_EB_TX_ABORT 0x00080000 /* Error Bits - TX Abort */ | ||
| 90 | #define DMA_STATUS_EB_RX_ABORT 0x00100000 /* Error Bits - RX Abort */ | ||
| 91 | #define DMA_STATUS_TS_MASK 0x00700000 /* Transmit Process State */ | ||
| 92 | #define DMA_STATUS_TS_SHIFT 20 | ||
| 93 | #define DMA_STATUS_RS_MASK 0x000e0000 /* Receive Process State */ | ||
| 94 | #define DMA_STATUS_RS_SHIFT 17 | ||
| 95 | #define DMA_STATUS_NIS 0x00010000 /* Normal Interrupt Summary */ | ||
| 96 | #define DMA_STATUS_AIS 0x00008000 /* Abnormal Interrupt Summary */ | ||
| 97 | #define DMA_STATUS_ERI 0x00004000 /* Early Receive Interrupt */ | ||
| 98 | #define DMA_STATUS_FBI 0x00002000 /* Fatal Bus Error Interrupt */ | ||
| 99 | #define DMA_STATUS_ETI 0x00000400 /* Early Transmit Interrupt */ | ||
| 100 | #define DMA_STATUS_RWT 0x00000200 /* Receive Watchdog Timeout */ | ||
| 101 | #define DMA_STATUS_RPS 0x00000100 /* Receive Process Stopped */ | ||
| 102 | #define DMA_STATUS_RU 0x00000080 /* Receive Buffer Unavailable */ | ||
| 103 | #define DMA_STATUS_RI 0x00000040 /* Receive Interrupt */ | ||
| 104 | #define DMA_STATUS_UNF 0x00000020 /* Transmit Underflow */ | ||
| 105 | #define DMA_STATUS_OVF 0x00000010 /* Receive Overflow */ | ||
| 106 | #define DMA_STATUS_TJT 0x00000008 /* Transmit Jabber Timeout */ | ||
| 107 | #define DMA_STATUS_TU 0x00000004 /* Transmit Buffer Unavailable */ | ||
| 108 | #define DMA_STATUS_TPS 0x00000002 /* Transmit Process Stopped */ | ||
| 109 | #define DMA_STATUS_TI 0x00000001 /* Transmit Interrupt */ | ||
| 110 | |||
| 111 | /* Other defines */ | ||
| 112 | #define HASH_TABLE_SIZE 64 | ||
| 113 | #define PAUSE_TIME 0x200 | ||
| 114 | |||
| 115 | /* Flow Control defines */ | ||
| 116 | #define FLOW_OFF 0 | ||
| 117 | #define FLOW_RX 1 | ||
| 118 | #define FLOW_TX 2 | ||
| 119 | #define FLOW_AUTO (FLOW_TX | FLOW_RX) | ||
| 120 | |||
| 121 | /* DMA STORE-AND-FORWARD Operation Mode */ | ||
| 122 | #define SF_DMA_MODE 1 | ||
| 123 | |||
| 124 | #define HW_CSUM 1 | ||
| 125 | #define NO_HW_CSUM 0 | ||
| 126 | |||
| 127 | /* GMAC TX FIFO is 8K, Rx FIFO is 16K */ | ||
| 128 | #define BUF_SIZE_16KiB 16384 | ||
| 129 | #define BUF_SIZE_8KiB 8192 | ||
| 130 | #define BUF_SIZE_4KiB 4096 | ||
| 131 | #define BUF_SIZE_2KiB 2048 | ||
| 132 | |||
| 133 | /* Power Down and WOL */ | ||
| 134 | #define PMT_NOT_SUPPORTED 0 | ||
| 135 | #define PMT_SUPPORTED 1 | ||
| 136 | |||
| 137 | /* Common MAC defines */ | ||
| 138 | #define MAC_CTRL_REG 0x00000000 /* MAC Control */ | ||
| 139 | #define MAC_ENABLE_TX 0x00000008 /* Transmitter Enable */ | ||
| 140 | #define MAC_RNABLE_RX 0x00000004 /* Receiver Enable */ | ||
| 141 | |||
| 142 | /* MAC Management Counters register */ | ||
| 143 | #define MMC_CONTROL 0x00000100 /* MMC Control */ | ||
| 144 | #define MMC_HIGH_INTR 0x00000104 /* MMC High Interrupt */ | ||
| 145 | #define MMC_LOW_INTR 0x00000108 /* MMC Low Interrupt */ | ||
| 146 | #define MMC_HIGH_INTR_MASK 0x0000010c /* MMC High Interrupt Mask */ | ||
| 147 | #define MMC_LOW_INTR_MASK 0x00000110 /* MMC Low Interrupt Mask */ | ||
| 148 | |||
| 149 | #define MMC_CONTROL_MAX_FRM_MASK 0x0003ff8 /* Maximum Frame Size */ | ||
| 150 | #define MMC_CONTROL_MAX_FRM_SHIFT 3 | ||
| 151 | #define MMC_CONTROL_MAX_FRAME 0x7FF | ||
| 152 | |||
| 153 | struct stmmac_extra_stats { | ||
| 154 | /* Transmit errors */ | ||
| 155 | unsigned long tx_underflow ____cacheline_aligned; | ||
| 156 | unsigned long tx_carrier; | ||
| 157 | unsigned long tx_losscarrier; | ||
| 158 | unsigned long tx_heartbeat; | ||
| 159 | unsigned long tx_deferred; | ||
| 160 | unsigned long tx_vlan; | ||
| 161 | unsigned long tx_jabber; | ||
| 162 | unsigned long tx_frame_flushed; | ||
| 163 | unsigned long tx_payload_error; | ||
| 164 | unsigned long tx_ip_header_error; | ||
| 165 | /* Receive errors */ | ||
| 166 | unsigned long rx_desc; | ||
| 167 | unsigned long rx_partial; | ||
| 168 | unsigned long rx_runt; | ||
| 169 | unsigned long rx_toolong; | ||
| 170 | unsigned long rx_collision; | ||
| 171 | unsigned long rx_crc; | ||
| 172 | unsigned long rx_lenght; | ||
| 173 | unsigned long rx_mii; | ||
| 174 | unsigned long rx_multicast; | ||
| 175 | unsigned long rx_gmac_overflow; | ||
| 176 | unsigned long rx_watchdog; | ||
| 177 | unsigned long da_rx_filter_fail; | ||
| 178 | unsigned long sa_rx_filter_fail; | ||
| 179 | unsigned long rx_missed_cntr; | ||
| 180 | unsigned long rx_overflow_cntr; | ||
| 181 | unsigned long rx_vlan; | ||
| 182 | /* Tx/Rx IRQ errors */ | ||
| 183 | unsigned long tx_undeflow_irq; | ||
| 184 | unsigned long tx_process_stopped_irq; | ||
| 185 | unsigned long tx_jabber_irq; | ||
| 186 | unsigned long rx_overflow_irq; | ||
| 187 | unsigned long rx_buf_unav_irq; | ||
| 188 | unsigned long rx_process_stopped_irq; | ||
| 189 | unsigned long rx_watchdog_irq; | ||
| 190 | unsigned long tx_early_irq; | ||
| 191 | unsigned long fatal_bus_error_irq; | ||
| 192 | /* Extra info */ | ||
| 193 | unsigned long threshold; | ||
| 194 | unsigned long tx_pkt_n; | ||
| 195 | unsigned long rx_pkt_n; | ||
| 196 | unsigned long poll_n; | ||
| 197 | unsigned long sched_timer_n; | ||
| 198 | unsigned long normal_irq_n; | ||
| 199 | }; | ||
| 200 | |||
| 201 | /* GMAC core can compute the checksums in HW. */ | ||
| 202 | enum rx_frame_status { | ||
| 203 | good_frame = 0, | ||
| 204 | discard_frame = 1, | ||
| 205 | csum_none = 2, | ||
| 206 | }; | ||
| 207 | |||
| 208 | static inline void stmmac_set_mac_addr(unsigned long ioaddr, u8 addr[6], | ||
| 209 | unsigned int high, unsigned int low) | ||
| 210 | { | ||
| 211 | unsigned long data; | ||
| 212 | |||
| 213 | data = (addr[5] << 8) | addr[4]; | ||
| 214 | writel(data, ioaddr + high); | ||
| 215 | data = (addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) | addr[0]; | ||
| 216 | writel(data, ioaddr + low); | ||
| 217 | |||
| 218 | return; | ||
| 219 | } | ||
| 220 | |||
| 221 | static inline void stmmac_get_mac_addr(unsigned long ioaddr, | ||
| 222 | unsigned char *addr, unsigned int high, | ||
| 223 | unsigned int low) | ||
| 224 | { | ||
| 225 | unsigned int hi_addr, lo_addr; | ||
| 226 | |||
| 227 | /* Read the MAC address from the hardware */ | ||
| 228 | hi_addr = readl(ioaddr + high); | ||
| 229 | lo_addr = readl(ioaddr + low); | ||
| 230 | |||
| 231 | /* Extract the MAC address from the high and low words */ | ||
| 232 | addr[0] = lo_addr & 0xff; | ||
| 233 | addr[1] = (lo_addr >> 8) & 0xff; | ||
| 234 | addr[2] = (lo_addr >> 16) & 0xff; | ||
| 235 | addr[3] = (lo_addr >> 24) & 0xff; | ||
| 236 | addr[4] = hi_addr & 0xff; | ||
| 237 | addr[5] = (hi_addr >> 8) & 0xff; | ||
| 238 | |||
| 239 | return; | ||
| 240 | } | ||
| 241 | |||
| 242 | struct stmmac_ops { | ||
| 243 | /* MAC core initialization */ | ||
| 244 | void (*core_init) (unsigned long ioaddr) ____cacheline_aligned; | ||
| 245 | /* DMA core initialization */ | ||
| 246 | int (*dma_init) (unsigned long ioaddr, int pbl, u32 dma_tx, u32 dma_rx); | ||
| 247 | /* Dump MAC registers */ | ||
| 248 | void (*dump_mac_regs) (unsigned long ioaddr); | ||
| 249 | /* Dump DMA registers */ | ||
| 250 | void (*dump_dma_regs) (unsigned long ioaddr); | ||
| 251 | /* Set tx/rx threshold in the csr6 register | ||
| 252 | * An invalid value enables the store-and-forward mode */ | ||
| 253 | void (*dma_mode) (unsigned long ioaddr, int txmode, int rxmode); | ||
| 254 | /* To track extra statistic (if supported) */ | ||
| 255 | void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x, | ||
| 256 | unsigned long ioaddr); | ||
| 257 | /* RX descriptor ring initialization */ | ||
| 258 | void (*init_rx_desc) (struct dma_desc *p, unsigned int ring_size, | ||
| 259 | int disable_rx_ic); | ||
| 260 | /* TX descriptor ring initialization */ | ||
| 261 | void (*init_tx_desc) (struct dma_desc *p, unsigned int ring_size); | ||
| 262 | |||
| 263 | /* Invoked by the xmit function to prepare the tx descriptor */ | ||
| 264 | void (*prepare_tx_desc) (struct dma_desc *p, int is_fs, int len, | ||
| 265 | int csum_flag); | ||
| 266 | /* Set/get the owner of the descriptor */ | ||
| 267 | void (*set_tx_owner) (struct dma_desc *p); | ||
| 268 | int (*get_tx_owner) (struct dma_desc *p); | ||
| 269 | /* Invoked by the xmit function to close the tx descriptor */ | ||
| 270 | void (*close_tx_desc) (struct dma_desc *p); | ||
| 271 | /* Clean the tx descriptor as soon as the tx irq is received */ | ||
| 272 | void (*release_tx_desc) (struct dma_desc *p); | ||
| 273 | /* Clear interrupt on tx frame completion. When this bit is | ||
| 274 | * set an interrupt happens as soon as the frame is transmitted */ | ||
| 275 | void (*clear_tx_ic) (struct dma_desc *p); | ||
| 276 | /* Last tx segment reports the transmit status */ | ||
| 277 | int (*get_tx_ls) (struct dma_desc *p); | ||
| 278 | /* Return the transmit status looking at the TDES1 */ | ||
| 279 | int (*tx_status) (void *data, struct stmmac_extra_stats *x, | ||
| 280 | struct dma_desc *p, unsigned long ioaddr); | ||
| 281 | /* Get the buffer size from the descriptor */ | ||
| 282 | int (*get_tx_len) (struct dma_desc *p); | ||
| 283 | /* Handle extra events on specific interrupts hw dependent */ | ||
| 284 | void (*host_irq_status) (unsigned long ioaddr); | ||
| 285 | int (*get_rx_owner) (struct dma_desc *p); | ||
| 286 | void (*set_rx_owner) (struct dma_desc *p); | ||
| 287 | /* Get the receive frame size */ | ||
| 288 | int (*get_rx_frame_len) (struct dma_desc *p); | ||
| 289 | /* Return the reception status looking at the RDES1 */ | ||
| 290 | int (*rx_status) (void *data, struct stmmac_extra_stats *x, | ||
| 291 | struct dma_desc *p); | ||
| 292 | /* Multicast filter setting */ | ||
| 293 | void (*set_filter) (struct net_device *dev); | ||
| 294 | /* Flow control setting */ | ||
| 295 | void (*flow_ctrl) (unsigned long ioaddr, unsigned int duplex, | ||
| 296 | unsigned int fc, unsigned int pause_time); | ||
| 297 | /* Set power management mode (e.g. magic frame) */ | ||
| 298 | void (*pmt) (unsigned long ioaddr, unsigned long mode); | ||
| 299 | /* Set/Get Unicast MAC addresses */ | ||
| 300 | void (*set_umac_addr) (unsigned long ioaddr, unsigned char *addr, | ||
| 301 | unsigned int reg_n); | ||
| 302 | void (*get_umac_addr) (unsigned long ioaddr, unsigned char *addr, | ||
| 303 | unsigned int reg_n); | ||
| 304 | }; | ||
| 305 | |||
| 306 | struct mac_link { | ||
| 307 | int port; | ||
| 308 | int duplex; | ||
| 309 | int speed; | ||
| 310 | }; | ||
| 311 | |||
| 312 | struct mii_regs { | ||
| 313 | unsigned int addr; /* MII Address */ | ||
| 314 | unsigned int data; /* MII Data */ | ||
| 315 | }; | ||
| 316 | |||
| 317 | struct hw_cap { | ||
| 318 | unsigned int version; /* Core Version register (GMAC) */ | ||
| 319 | unsigned int pmt; /* Power-Down mode (GMAC) */ | ||
| 320 | struct mac_link link; | ||
| 321 | struct mii_regs mii; | ||
| 322 | }; | ||
| 323 | |||
| 324 | struct mac_device_info { | ||
| 325 | struct hw_cap hw; | ||
| 326 | struct stmmac_ops *ops; | ||
| 327 | }; | ||
| 328 | |||
| 329 | struct mac_device_info *gmac_setup(unsigned long addr); | ||
| 330 | struct mac_device_info *mac100_setup(unsigned long addr); | ||
diff --git a/drivers/net/stmmac/descs.h b/drivers/net/stmmac/descs.h new file mode 100644 index 000000000000..6d2a0b2f5e57 --- /dev/null +++ b/drivers/net/stmmac/descs.h | |||
| @@ -0,0 +1,163 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | Header File to describe the DMA descriptors | ||
| 3 | Use enhanced descriptors in case of GMAC Cores. | ||
| 4 | |||
| 5 | This program is free software; you can redistribute it and/or modify it | ||
| 6 | under the terms and conditions of the GNU General Public License, | ||
| 7 | version 2, as published by the Free Software Foundation. | ||
| 8 | |||
| 9 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License along with | ||
| 15 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | |||
| 18 | The full GNU General Public License is included in this distribution in | ||
| 19 | the file called "COPYING". | ||
| 20 | |||
| 21 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 22 | *******************************************************************************/ | ||
| 23 | struct dma_desc { | ||
| 24 | /* Receive descriptor */ | ||
| 25 | union { | ||
| 26 | struct { | ||
| 27 | /* RDES0 */ | ||
| 28 | u32 reserved1:1; | ||
| 29 | u32 crc_error:1; | ||
| 30 | u32 dribbling:1; | ||
| 31 | u32 mii_error:1; | ||
| 32 | u32 receive_watchdog:1; | ||
| 33 | u32 frame_type:1; | ||
| 34 | u32 collision:1; | ||
| 35 | u32 frame_too_long:1; | ||
| 36 | u32 last_descriptor:1; | ||
| 37 | u32 first_descriptor:1; | ||
| 38 | u32 multicast_frame:1; | ||
| 39 | u32 run_frame:1; | ||
| 40 | u32 length_error:1; | ||
| 41 | u32 partial_frame_error:1; | ||
| 42 | u32 descriptor_error:1; | ||
| 43 | u32 error_summary:1; | ||
| 44 | u32 frame_length:14; | ||
| 45 | u32 filtering_fail:1; | ||
| 46 | u32 own:1; | ||
| 47 | /* RDES1 */ | ||
| 48 | u32 buffer1_size:11; | ||
| 49 | u32 buffer2_size:11; | ||
| 50 | u32 reserved2:2; | ||
| 51 | u32 second_address_chained:1; | ||
| 52 | u32 end_ring:1; | ||
| 53 | u32 reserved3:5; | ||
| 54 | u32 disable_ic:1; | ||
| 55 | } rx; | ||
| 56 | struct { | ||
| 57 | /* RDES0 */ | ||
| 58 | u32 payload_csum_error:1; | ||
| 59 | u32 crc_error:1; | ||
| 60 | u32 dribbling:1; | ||
| 61 | u32 error_gmii:1; | ||
| 62 | u32 receive_watchdog:1; | ||
| 63 | u32 frame_type:1; | ||
| 64 | u32 late_collision:1; | ||
| 65 | u32 ipc_csum_error:1; | ||
| 66 | u32 last_descriptor:1; | ||
| 67 | u32 first_descriptor:1; | ||
| 68 | u32 vlan_tag:1; | ||
| 69 | u32 overflow_error:1; | ||
| 70 | u32 length_error:1; | ||
| 71 | u32 sa_filter_fail:1; | ||
| 72 | u32 descriptor_error:1; | ||
| 73 | u32 error_summary:1; | ||
| 74 | u32 frame_length:14; | ||
| 75 | u32 da_filter_fail:1; | ||
| 76 | u32 own:1; | ||
| 77 | /* RDES1 */ | ||
| 78 | u32 buffer1_size:13; | ||
| 79 | u32 reserved1:1; | ||
| 80 | u32 second_address_chained:1; | ||
| 81 | u32 end_ring:1; | ||
| 82 | u32 buffer2_size:13; | ||
| 83 | u32 reserved2:2; | ||
| 84 | u32 disable_ic:1; | ||
| 85 | } erx; /* -- enhanced -- */ | ||
| 86 | |||
| 87 | /* Transmit descriptor */ | ||
| 88 | struct { | ||
| 89 | /* TDES0 */ | ||
| 90 | u32 deferred:1; | ||
| 91 | u32 underflow_error:1; | ||
| 92 | u32 excessive_deferral:1; | ||
| 93 | u32 collision_count:4; | ||
| 94 | u32 heartbeat_fail:1; | ||
| 95 | u32 excessive_collisions:1; | ||
| 96 | u32 late_collision:1; | ||
| 97 | u32 no_carrier:1; | ||
| 98 | u32 loss_carrier:1; | ||
| 99 | u32 reserved1:3; | ||
| 100 | u32 error_summary:1; | ||
| 101 | u32 reserved2:15; | ||
| 102 | u32 own:1; | ||
| 103 | /* TDES1 */ | ||
| 104 | u32 buffer1_size:11; | ||
| 105 | u32 buffer2_size:11; | ||
| 106 | u32 reserved3:1; | ||
| 107 | u32 disable_padding:1; | ||
| 108 | u32 second_address_chained:1; | ||
| 109 | u32 end_ring:1; | ||
| 110 | u32 crc_disable:1; | ||
| 111 | u32 reserved4:2; | ||
| 112 | u32 first_segment:1; | ||
| 113 | u32 last_segment:1; | ||
| 114 | u32 interrupt:1; | ||
| 115 | } tx; | ||
| 116 | struct { | ||
| 117 | /* TDES0 */ | ||
| 118 | u32 deferred:1; | ||
| 119 | u32 underflow_error:1; | ||
| 120 | u32 excessive_deferral:1; | ||
| 121 | u32 collision_count:4; | ||
| 122 | u32 vlan_frame:1; | ||
| 123 | u32 excessive_collisions:1; | ||
| 124 | u32 late_collision:1; | ||
| 125 | u32 no_carrier:1; | ||
| 126 | u32 loss_carrier:1; | ||
| 127 | u32 payload_error:1; | ||
| 128 | u32 frame_flushed:1; | ||
| 129 | u32 jabber_timeout:1; | ||
| 130 | u32 error_summary:1; | ||
| 131 | u32 ip_header_error:1; | ||
| 132 | u32 time_stamp_status:1; | ||
| 133 | u32 reserved1:2; | ||
| 134 | u32 second_address_chained:1; | ||
| 135 | u32 end_ring:1; | ||
| 136 | u32 checksum_insertion:2; | ||
| 137 | u32 reserved2:1; | ||
| 138 | u32 time_stamp_enable:1; | ||
| 139 | u32 disable_padding:1; | ||
| 140 | u32 crc_disable:1; | ||
| 141 | u32 first_segment:1; | ||
| 142 | u32 last_segment:1; | ||
| 143 | u32 interrupt:1; | ||
| 144 | u32 own:1; | ||
| 145 | /* TDES1 */ | ||
| 146 | u32 buffer1_size:13; | ||
| 147 | u32 reserved3:3; | ||
| 148 | u32 buffer2_size:13; | ||
| 149 | u32 reserved4:3; | ||
| 150 | } etx; /* -- enhanced -- */ | ||
| 151 | } des01; | ||
| 152 | unsigned int des2; | ||
| 153 | unsigned int des3; | ||
| 154 | }; | ||
| 155 | |||
| 156 | /* Transmit checksum insertion control */ | ||
| 157 | enum tdes_csum_insertion { | ||
| 158 | cic_disabled = 0, /* Checksum Insertion Control */ | ||
| 159 | cic_only_ip = 1, /* Only IP header */ | ||
| 160 | cic_no_pseudoheader = 2, /* IP header but pseudoheader | ||
| 161 | * is not calculated */ | ||
| 162 | cic_full = 3, /* IP header and pseudoheader */ | ||
| 163 | }; | ||
diff --git a/drivers/net/stmmac/gmac.c b/drivers/net/stmmac/gmac.c new file mode 100644 index 000000000000..b624bb5bae0a --- /dev/null +++ b/drivers/net/stmmac/gmac.c | |||
| @@ -0,0 +1,693 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | This is the driver for the GMAC on-chip Ethernet controller for ST SoCs. | ||
| 3 | DWC Ether MAC 10/100/1000 Universal version 3.41a has been used for | ||
| 4 | developing this code. | ||
| 5 | |||
| 6 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 7 | |||
| 8 | This program is free software; you can redistribute it and/or modify it | ||
| 9 | under the terms and conditions of the GNU General Public License, | ||
| 10 | version 2, as published by the Free Software Foundation. | ||
| 11 | |||
| 12 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 15 | more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License along with | ||
| 18 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 19 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | |||
| 21 | The full GNU General Public License is included in this distribution in | ||
| 22 | the file called "COPYING". | ||
| 23 | |||
| 24 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 25 | *******************************************************************************/ | ||
| 26 | |||
| 27 | #include <linux/netdevice.h> | ||
| 28 | #include <linux/crc32.h> | ||
| 29 | #include <linux/mii.h> | ||
| 30 | #include <linux/phy.h> | ||
| 31 | |||
| 32 | #include "stmmac.h" | ||
| 33 | #include "gmac.h" | ||
| 34 | |||
| 35 | #undef GMAC_DEBUG | ||
| 36 | /*#define GMAC_DEBUG*/ | ||
| 37 | #undef FRAME_FILTER_DEBUG | ||
| 38 | /*#define FRAME_FILTER_DEBUG*/ | ||
| 39 | #ifdef GMAC_DEBUG | ||
| 40 | #define DBG(fmt, args...) printk(fmt, ## args) | ||
| 41 | #else | ||
| 42 | #define DBG(fmt, args...) do { } while (0) | ||
| 43 | #endif | ||
| 44 | |||
| 45 | static void gmac_dump_regs(unsigned long ioaddr) | ||
| 46 | { | ||
| 47 | int i; | ||
| 48 | pr_info("\t----------------------------------------------\n" | ||
| 49 | "\t GMAC registers (base addr = 0x%8x)\n" | ||
| 50 | "\t----------------------------------------------\n", | ||
| 51 | (unsigned int)ioaddr); | ||
| 52 | |||
| 53 | for (i = 0; i < 55; i++) { | ||
| 54 | int offset = i * 4; | ||
| 55 | pr_info("\tReg No. %d (offset 0x%x): 0x%08x\n", i, | ||
| 56 | offset, readl(ioaddr + offset)); | ||
| 57 | } | ||
| 58 | return; | ||
| 59 | } | ||
| 60 | |||
| 61 | static int gmac_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx, u32 dma_rx) | ||
| 62 | { | ||
| 63 | u32 value = readl(ioaddr + DMA_BUS_MODE); | ||
| 64 | /* DMA SW reset */ | ||
| 65 | value |= DMA_BUS_MODE_SFT_RESET; | ||
| 66 | writel(value, ioaddr + DMA_BUS_MODE); | ||
| 67 | do {} while ((readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)); | ||
| 68 | |||
| 69 | value = /* DMA_BUS_MODE_FB | */ DMA_BUS_MODE_4PBL | | ||
| 70 | ((pbl << DMA_BUS_MODE_PBL_SHIFT) | | ||
| 71 | (pbl << DMA_BUS_MODE_RPBL_SHIFT)); | ||
| 72 | |||
| 73 | #ifdef CONFIG_STMMAC_DA | ||
| 74 | value |= DMA_BUS_MODE_DA; /* Rx has priority over tx */ | ||
| 75 | #endif | ||
| 76 | writel(value, ioaddr + DMA_BUS_MODE); | ||
| 77 | |||
| 78 | /* Mask interrupts by writing to CSR7 */ | ||
| 79 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA); | ||
| 80 | |||
| 81 | /* The base address of the RX/TX descriptor lists must be written into | ||
| 82 | * DMA CSR3 and CSR4, respectively. */ | ||
| 83 | writel(dma_tx, ioaddr + DMA_TX_BASE_ADDR); | ||
| 84 | writel(dma_rx, ioaddr + DMA_RCV_BASE_ADDR); | ||
| 85 | |||
| 86 | return 0; | ||
| 87 | } | ||
| 88 | |||
| 89 | /* Transmit FIFO flush operation */ | ||
| 90 | static void gmac_flush_tx_fifo(unsigned long ioaddr) | ||
| 91 | { | ||
| 92 | u32 csr6 = readl(ioaddr + DMA_CONTROL); | ||
| 93 | writel((csr6 | DMA_CONTROL_FTF), ioaddr + DMA_CONTROL); | ||
| 94 | |||
| 95 | do {} while ((readl(ioaddr + DMA_CONTROL) & DMA_CONTROL_FTF)); | ||
| 96 | } | ||
| 97 | |||
| 98 | static void gmac_dma_operation_mode(unsigned long ioaddr, int txmode, | ||
| 99 | int rxmode) | ||
| 100 | { | ||
| 101 | u32 csr6 = readl(ioaddr + DMA_CONTROL); | ||
| 102 | |||
| 103 | if (txmode == SF_DMA_MODE) { | ||
| 104 | DBG(KERN_DEBUG "GMAC: enabling TX store and forward mode\n"); | ||
| 105 | /* Transmit COE type 2 cannot be done in cut-through mode. */ | ||
| 106 | csr6 |= DMA_CONTROL_TSF; | ||
| 107 | /* Operating on second frame increase the performance | ||
| 108 | * especially when transmit store-and-forward is used.*/ | ||
| 109 | csr6 |= DMA_CONTROL_OSF; | ||
| 110 | } else { | ||
| 111 | DBG(KERN_DEBUG "GMAC: disabling TX store and forward mode" | ||
| 112 | " (threshold = %d)\n", txmode); | ||
| 113 | csr6 &= ~DMA_CONTROL_TSF; | ||
| 114 | csr6 &= DMA_CONTROL_TC_TX_MASK; | ||
| 115 | /* Set the transmit threashold */ | ||
| 116 | if (txmode <= 32) | ||
| 117 | csr6 |= DMA_CONTROL_TTC_32; | ||
| 118 | else if (txmode <= 64) | ||
| 119 | csr6 |= DMA_CONTROL_TTC_64; | ||
| 120 | else if (txmode <= 128) | ||
| 121 | csr6 |= DMA_CONTROL_TTC_128; | ||
| 122 | else if (txmode <= 192) | ||
| 123 | csr6 |= DMA_CONTROL_TTC_192; | ||
| 124 | else | ||
| 125 | csr6 |= DMA_CONTROL_TTC_256; | ||
| 126 | } | ||
| 127 | |||
| 128 | if (rxmode == SF_DMA_MODE) { | ||
| 129 | DBG(KERN_DEBUG "GMAC: enabling RX store and forward mode\n"); | ||
| 130 | csr6 |= DMA_CONTROL_RSF; | ||
| 131 | } else { | ||
| 132 | DBG(KERN_DEBUG "GMAC: disabling RX store and forward mode" | ||
| 133 | " (threshold = %d)\n", rxmode); | ||
| 134 | csr6 &= ~DMA_CONTROL_RSF; | ||
| 135 | csr6 &= DMA_CONTROL_TC_RX_MASK; | ||
| 136 | if (rxmode <= 32) | ||
| 137 | csr6 |= DMA_CONTROL_RTC_32; | ||
| 138 | else if (rxmode <= 64) | ||
| 139 | csr6 |= DMA_CONTROL_RTC_64; | ||
| 140 | else if (rxmode <= 96) | ||
| 141 | csr6 |= DMA_CONTROL_RTC_96; | ||
| 142 | else | ||
| 143 | csr6 |= DMA_CONTROL_RTC_128; | ||
| 144 | } | ||
| 145 | |||
| 146 | writel(csr6, ioaddr + DMA_CONTROL); | ||
| 147 | return; | ||
| 148 | } | ||
| 149 | |||
| 150 | /* Not yet implemented --- no RMON module */ | ||
| 151 | static void gmac_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x, | ||
| 152 | unsigned long ioaddr) | ||
| 153 | { | ||
| 154 | return; | ||
| 155 | } | ||
| 156 | |||
| 157 | static void gmac_dump_dma_regs(unsigned long ioaddr) | ||
| 158 | { | ||
| 159 | int i; | ||
| 160 | pr_info(" DMA registers\n"); | ||
| 161 | for (i = 0; i < 22; i++) { | ||
| 162 | if ((i < 9) || (i > 17)) { | ||
| 163 | int offset = i * 4; | ||
| 164 | pr_err("\t Reg No. %d (offset 0x%x): 0x%08x\n", i, | ||
| 165 | (DMA_BUS_MODE + offset), | ||
| 166 | readl(ioaddr + DMA_BUS_MODE + offset)); | ||
| 167 | } | ||
| 168 | } | ||
| 169 | return; | ||
| 170 | } | ||
| 171 | |||
| 172 | static int gmac_get_tx_frame_status(void *data, struct stmmac_extra_stats *x, | ||
| 173 | struct dma_desc *p, unsigned long ioaddr) | ||
| 174 | { | ||
| 175 | int ret = 0; | ||
| 176 | struct net_device_stats *stats = (struct net_device_stats *)data; | ||
| 177 | |||
| 178 | if (unlikely(p->des01.etx.error_summary)) { | ||
| 179 | DBG(KERN_ERR "GMAC TX error... 0x%08x\n", p->des01.etx); | ||
| 180 | if (unlikely(p->des01.etx.jabber_timeout)) { | ||
| 181 | DBG(KERN_ERR "\tjabber_timeout error\n"); | ||
| 182 | x->tx_jabber++; | ||
| 183 | } | ||
| 184 | |||
| 185 | if (unlikely(p->des01.etx.frame_flushed)) { | ||
| 186 | DBG(KERN_ERR "\tframe_flushed error\n"); | ||
| 187 | x->tx_frame_flushed++; | ||
| 188 | gmac_flush_tx_fifo(ioaddr); | ||
| 189 | } | ||
| 190 | |||
| 191 | if (unlikely(p->des01.etx.loss_carrier)) { | ||
| 192 | DBG(KERN_ERR "\tloss_carrier error\n"); | ||
| 193 | x->tx_losscarrier++; | ||
| 194 | stats->tx_carrier_errors++; | ||
| 195 | } | ||
| 196 | if (unlikely(p->des01.etx.no_carrier)) { | ||
| 197 | DBG(KERN_ERR "\tno_carrier error\n"); | ||
| 198 | x->tx_carrier++; | ||
| 199 | stats->tx_carrier_errors++; | ||
| 200 | } | ||
| 201 | if (unlikely(p->des01.etx.late_collision)) { | ||
| 202 | DBG(KERN_ERR "\tlate_collision error\n"); | ||
| 203 | stats->collisions += p->des01.etx.collision_count; | ||
| 204 | } | ||
| 205 | if (unlikely(p->des01.etx.excessive_collisions)) { | ||
| 206 | DBG(KERN_ERR "\texcessive_collisions\n"); | ||
| 207 | stats->collisions += p->des01.etx.collision_count; | ||
| 208 | } | ||
| 209 | if (unlikely(p->des01.etx.excessive_deferral)) { | ||
| 210 | DBG(KERN_INFO "\texcessive tx_deferral\n"); | ||
| 211 | x->tx_deferred++; | ||
| 212 | } | ||
| 213 | |||
| 214 | if (unlikely(p->des01.etx.underflow_error)) { | ||
| 215 | DBG(KERN_ERR "\tunderflow error\n"); | ||
| 216 | gmac_flush_tx_fifo(ioaddr); | ||
| 217 | x->tx_underflow++; | ||
| 218 | } | ||
| 219 | |||
| 220 | if (unlikely(p->des01.etx.ip_header_error)) { | ||
| 221 | DBG(KERN_ERR "\tTX IP header csum error\n"); | ||
| 222 | x->tx_ip_header_error++; | ||
| 223 | } | ||
| 224 | |||
| 225 | if (unlikely(p->des01.etx.payload_error)) { | ||
| 226 | DBG(KERN_ERR "\tAddr/Payload csum error\n"); | ||
| 227 | x->tx_payload_error++; | ||
| 228 | gmac_flush_tx_fifo(ioaddr); | ||
| 229 | } | ||
| 230 | |||
| 231 | ret = -1; | ||
| 232 | } | ||
| 233 | |||
| 234 | if (unlikely(p->des01.etx.deferred)) { | ||
| 235 | DBG(KERN_INFO "GMAC TX status: tx deferred\n"); | ||
| 236 | x->tx_deferred++; | ||
| 237 | } | ||
| 238 | #ifdef STMMAC_VLAN_TAG_USED | ||
| 239 | if (p->des01.etx.vlan_frame) { | ||
| 240 | DBG(KERN_INFO "GMAC TX status: VLAN frame\n"); | ||
| 241 | x->tx_vlan++; | ||
| 242 | } | ||
| 243 | #endif | ||
| 244 | |||
| 245 | return ret; | ||
| 246 | } | ||
| 247 | |||
| 248 | static int gmac_get_tx_len(struct dma_desc *p) | ||
| 249 | { | ||
| 250 | return p->des01.etx.buffer1_size; | ||
| 251 | } | ||
| 252 | |||
| 253 | static int gmac_coe_rdes0(int ipc_err, int type, int payload_err) | ||
| 254 | { | ||
| 255 | int ret = good_frame; | ||
| 256 | u32 status = (type << 2 | ipc_err << 1 | payload_err) & 0x7; | ||
| 257 | |||
| 258 | /* bits 5 7 0 | Frame status | ||
| 259 | * ---------------------------------------------------------- | ||
| 260 | * 0 0 0 | IEEE 802.3 Type frame (lenght < 1536 octects) | ||
| 261 | * 1 0 0 | IPv4/6 No CSUM errorS. | ||
| 262 | * 1 0 1 | IPv4/6 CSUM PAYLOAD error | ||
| 263 | * 1 1 0 | IPv4/6 CSUM IP HR error | ||
| 264 | * 1 1 1 | IPv4/6 IP PAYLOAD AND HEADER errorS | ||
| 265 | * 0 0 1 | IPv4/6 unsupported IP PAYLOAD | ||
| 266 | * 0 1 1 | COE bypassed.. no IPv4/6 frame | ||
| 267 | * 0 1 0 | Reserved. | ||
| 268 | */ | ||
| 269 | if (status == 0x0) { | ||
| 270 | DBG(KERN_INFO "RX Des0 status: IEEE 802.3 Type frame.\n"); | ||
| 271 | ret = good_frame; | ||
| 272 | } else if (status == 0x4) { | ||
| 273 | DBG(KERN_INFO "RX Des0 status: IPv4/6 No CSUM errorS.\n"); | ||
| 274 | ret = good_frame; | ||
| 275 | } else if (status == 0x5) { | ||
| 276 | DBG(KERN_ERR "RX Des0 status: IPv4/6 Payload Error.\n"); | ||
| 277 | ret = csum_none; | ||
| 278 | } else if (status == 0x6) { | ||
| 279 | DBG(KERN_ERR "RX Des0 status: IPv4/6 Header Error.\n"); | ||
| 280 | ret = csum_none; | ||
| 281 | } else if (status == 0x7) { | ||
| 282 | DBG(KERN_ERR | ||
| 283 | "RX Des0 status: IPv4/6 Header and Payload Error.\n"); | ||
| 284 | ret = csum_none; | ||
| 285 | } else if (status == 0x1) { | ||
| 286 | DBG(KERN_ERR | ||
| 287 | "RX Des0 status: IPv4/6 unsupported IP PAYLOAD.\n"); | ||
| 288 | ret = discard_frame; | ||
| 289 | } else if (status == 0x3) { | ||
| 290 | DBG(KERN_ERR "RX Des0 status: No IPv4, IPv6 frame.\n"); | ||
| 291 | ret = discard_frame; | ||
| 292 | } | ||
| 293 | return ret; | ||
| 294 | } | ||
| 295 | |||
| 296 | static int gmac_get_rx_frame_status(void *data, struct stmmac_extra_stats *x, | ||
| 297 | struct dma_desc *p) | ||
| 298 | { | ||
| 299 | int ret = good_frame; | ||
| 300 | struct net_device_stats *stats = (struct net_device_stats *)data; | ||
| 301 | |||
| 302 | if (unlikely(p->des01.erx.error_summary)) { | ||
| 303 | DBG(KERN_ERR "GMAC RX Error Summary... 0x%08x\n", p->des01.erx); | ||
| 304 | if (unlikely(p->des01.erx.descriptor_error)) { | ||
| 305 | DBG(KERN_ERR "\tdescriptor error\n"); | ||
| 306 | x->rx_desc++; | ||
| 307 | stats->rx_length_errors++; | ||
| 308 | } | ||
| 309 | if (unlikely(p->des01.erx.overflow_error)) { | ||
| 310 | DBG(KERN_ERR "\toverflow error\n"); | ||
| 311 | x->rx_gmac_overflow++; | ||
| 312 | } | ||
| 313 | |||
| 314 | if (unlikely(p->des01.erx.ipc_csum_error)) | ||
| 315 | DBG(KERN_ERR "\tIPC Csum Error/Giant frame\n"); | ||
| 316 | |||
| 317 | if (unlikely(p->des01.erx.late_collision)) { | ||
| 318 | DBG(KERN_ERR "\tlate_collision error\n"); | ||
| 319 | stats->collisions++; | ||
| 320 | stats->collisions++; | ||
| 321 | } | ||
| 322 | if (unlikely(p->des01.erx.receive_watchdog)) { | ||
| 323 | DBG(KERN_ERR "\treceive_watchdog error\n"); | ||
| 324 | x->rx_watchdog++; | ||
| 325 | } | ||
| 326 | if (unlikely(p->des01.erx.error_gmii)) { | ||
| 327 | DBG(KERN_ERR "\tReceive Error\n"); | ||
| 328 | x->rx_mii++; | ||
| 329 | } | ||
| 330 | if (unlikely(p->des01.erx.crc_error)) { | ||
| 331 | DBG(KERN_ERR "\tCRC error\n"); | ||
| 332 | x->rx_crc++; | ||
| 333 | stats->rx_crc_errors++; | ||
| 334 | } | ||
| 335 | ret = discard_frame; | ||
| 336 | } | ||
| 337 | |||
| 338 | /* After a payload csum error, the ES bit is set. | ||
| 339 | * It doesn't match with the information reported into the databook. | ||
| 340 | * At any rate, we need to understand if the CSUM hw computation is ok | ||
| 341 | * and report this info to the upper layers. */ | ||
| 342 | ret = gmac_coe_rdes0(p->des01.erx.ipc_csum_error, | ||
| 343 | p->des01.erx.frame_type, p->des01.erx.payload_csum_error); | ||
| 344 | |||
| 345 | if (unlikely(p->des01.erx.dribbling)) { | ||
| 346 | DBG(KERN_ERR "GMAC RX: dribbling error\n"); | ||
| 347 | ret = discard_frame; | ||
| 348 | } | ||
| 349 | if (unlikely(p->des01.erx.sa_filter_fail)) { | ||
| 350 | DBG(KERN_ERR "GMAC RX : Source Address filter fail\n"); | ||
| 351 | x->sa_rx_filter_fail++; | ||
| 352 | ret = discard_frame; | ||
| 353 | } | ||
| 354 | if (unlikely(p->des01.erx.da_filter_fail)) { | ||
| 355 | DBG(KERN_ERR "GMAC RX : Destination Address filter fail\n"); | ||
| 356 | x->da_rx_filter_fail++; | ||
| 357 | ret = discard_frame; | ||
| 358 | } | ||
| 359 | if (unlikely(p->des01.erx.length_error)) { | ||
| 360 | DBG(KERN_ERR "GMAC RX: length_error error\n"); | ||
| 361 | x->rx_lenght++; | ||
| 362 | ret = discard_frame; | ||
| 363 | } | ||
| 364 | #ifdef STMMAC_VLAN_TAG_USED | ||
| 365 | if (p->des01.erx.vlan_tag) { | ||
| 366 | DBG(KERN_INFO "GMAC RX: VLAN frame tagged\n"); | ||
| 367 | x->rx_vlan++; | ||
| 368 | } | ||
| 369 | #endif | ||
| 370 | return ret; | ||
| 371 | } | ||
| 372 | |||
| 373 | static void gmac_irq_status(unsigned long ioaddr) | ||
| 374 | { | ||
| 375 | u32 intr_status = readl(ioaddr + GMAC_INT_STATUS); | ||
| 376 | |||
| 377 | /* Not used events (e.g. MMC interrupts) are not handled. */ | ||
| 378 | if ((intr_status & mmc_tx_irq)) | ||
| 379 | DBG(KERN_DEBUG "GMAC: MMC tx interrupt: 0x%08x\n", | ||
| 380 | readl(ioaddr + GMAC_MMC_TX_INTR)); | ||
| 381 | if (unlikely(intr_status & mmc_rx_irq)) | ||
| 382 | DBG(KERN_DEBUG "GMAC: MMC rx interrupt: 0x%08x\n", | ||
| 383 | readl(ioaddr + GMAC_MMC_RX_INTR)); | ||
| 384 | if (unlikely(intr_status & mmc_rx_csum_offload_irq)) | ||
| 385 | DBG(KERN_DEBUG "GMAC: MMC rx csum offload: 0x%08x\n", | ||
| 386 | readl(ioaddr + GMAC_MMC_RX_CSUM_OFFLOAD)); | ||
| 387 | if (unlikely(intr_status & pmt_irq)) { | ||
| 388 | DBG(KERN_DEBUG "GMAC: received Magic frame\n"); | ||
| 389 | /* clear the PMT bits 5 and 6 by reading the PMT | ||
| 390 | * status register. */ | ||
| 391 | readl(ioaddr + GMAC_PMT); | ||
| 392 | } | ||
| 393 | |||
| 394 | return; | ||
| 395 | } | ||
| 396 | |||
| 397 | static void gmac_core_init(unsigned long ioaddr) | ||
| 398 | { | ||
| 399 | u32 value = readl(ioaddr + GMAC_CONTROL); | ||
| 400 | value |= GMAC_CORE_INIT; | ||
| 401 | writel(value, ioaddr + GMAC_CONTROL); | ||
| 402 | |||
| 403 | /* STBus Bridge Configuration */ | ||
| 404 | /*writel(0xc5608, ioaddr + 0x00007000);*/ | ||
| 405 | |||
| 406 | /* Freeze MMC counters */ | ||
| 407 | writel(0x8, ioaddr + GMAC_MMC_CTRL); | ||
| 408 | /* Mask GMAC interrupts */ | ||
| 409 | writel(0x207, ioaddr + GMAC_INT_MASK); | ||
| 410 | |||
| 411 | #ifdef STMMAC_VLAN_TAG_USED | ||
| 412 | /* Tag detection without filtering */ | ||
| 413 | writel(0x0, ioaddr + GMAC_VLAN_TAG); | ||
| 414 | #endif | ||
| 415 | return; | ||
| 416 | } | ||
| 417 | |||
| 418 | static void gmac_set_umac_addr(unsigned long ioaddr, unsigned char *addr, | ||
| 419 | unsigned int reg_n) | ||
| 420 | { | ||
| 421 | stmmac_set_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n), | ||
| 422 | GMAC_ADDR_LOW(reg_n)); | ||
| 423 | } | ||
| 424 | |||
| 425 | static void gmac_get_umac_addr(unsigned long ioaddr, unsigned char *addr, | ||
| 426 | unsigned int reg_n) | ||
| 427 | { | ||
| 428 | stmmac_get_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n), | ||
| 429 | GMAC_ADDR_LOW(reg_n)); | ||
| 430 | } | ||
| 431 | |||
| 432 | static void gmac_set_filter(struct net_device *dev) | ||
| 433 | { | ||
| 434 | unsigned long ioaddr = dev->base_addr; | ||
| 435 | unsigned int value = 0; | ||
| 436 | |||
| 437 | DBG(KERN_INFO "%s: # mcasts %d, # unicast %d\n", | ||
| 438 | __func__, dev->mc_count, dev->uc_count); | ||
| 439 | |||
| 440 | if (dev->flags & IFF_PROMISC) | ||
| 441 | value = GMAC_FRAME_FILTER_PR; | ||
| 442 | else if ((dev->mc_count > HASH_TABLE_SIZE) | ||
| 443 | || (dev->flags & IFF_ALLMULTI)) { | ||
| 444 | value = GMAC_FRAME_FILTER_PM; /* pass all multi */ | ||
| 445 | writel(0xffffffff, ioaddr + GMAC_HASH_HIGH); | ||
| 446 | writel(0xffffffff, ioaddr + GMAC_HASH_LOW); | ||
| 447 | } else if (dev->mc_count > 0) { | ||
| 448 | int i; | ||
| 449 | u32 mc_filter[2]; | ||
| 450 | struct dev_mc_list *mclist; | ||
| 451 | |||
| 452 | /* Hash filter for multicast */ | ||
| 453 | value = GMAC_FRAME_FILTER_HMC; | ||
| 454 | |||
| 455 | memset(mc_filter, 0, sizeof(mc_filter)); | ||
| 456 | for (i = 0, mclist = dev->mc_list; | ||
| 457 | mclist && i < dev->mc_count; i++, mclist = mclist->next) { | ||
| 458 | /* The upper 6 bits of the calculated CRC are used to | ||
| 459 | index the contens of the hash table */ | ||
| 460 | int bit_nr = | ||
| 461 | bitrev32(~crc32_le(~0, mclist->dmi_addr, 6)) >> 26; | ||
| 462 | /* The most significant bit determines the register to | ||
| 463 | * use (H/L) while the other 5 bits determine the bit | ||
| 464 | * within the register. */ | ||
| 465 | mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); | ||
| 466 | } | ||
| 467 | writel(mc_filter[0], ioaddr + GMAC_HASH_LOW); | ||
| 468 | writel(mc_filter[1], ioaddr + GMAC_HASH_HIGH); | ||
| 469 | } | ||
| 470 | |||
| 471 | /* Handle multiple unicast addresses (perfect filtering)*/ | ||
| 472 | if (dev->uc_count > GMAC_MAX_UNICAST_ADDRESSES) | ||
| 473 | /* Switch to promiscuous mode is more than 16 addrs | ||
| 474 | are required */ | ||
| 475 | value |= GMAC_FRAME_FILTER_PR; | ||
| 476 | else { | ||
| 477 | int i; | ||
| 478 | struct dev_addr_list *uc_ptr = dev->uc_list; | ||
| 479 | |||
| 480 | for (i = 0; i < dev->uc_count; i++) { | ||
| 481 | gmac_set_umac_addr(ioaddr, uc_ptr->da_addr, | ||
| 482 | i + 1); | ||
| 483 | |||
| 484 | DBG(KERN_INFO "\t%d " | ||
| 485 | "- Unicast addr %02x:%02x:%02x:%02x:%02x:" | ||
| 486 | "%02x\n", i + 1, | ||
| 487 | uc_ptr->da_addr[0], uc_ptr->da_addr[1], | ||
| 488 | uc_ptr->da_addr[2], uc_ptr->da_addr[3], | ||
| 489 | uc_ptr->da_addr[4], uc_ptr->da_addr[5]); | ||
| 490 | uc_ptr = uc_ptr->next; | ||
| 491 | } | ||
| 492 | } | ||
| 493 | |||
| 494 | #ifdef FRAME_FILTER_DEBUG | ||
| 495 | /* Enable Receive all mode (to debug filtering_fail errors) */ | ||
| 496 | value |= GMAC_FRAME_FILTER_RA; | ||
| 497 | #endif | ||
| 498 | writel(value, ioaddr + GMAC_FRAME_FILTER); | ||
| 499 | |||
| 500 | DBG(KERN_INFO "\tFrame Filter reg: 0x%08x\n\tHash regs: " | ||
| 501 | "HI 0x%08x, LO 0x%08x\n", readl(ioaddr + GMAC_FRAME_FILTER), | ||
| 502 | readl(ioaddr + GMAC_HASH_HIGH), readl(ioaddr + GMAC_HASH_LOW)); | ||
| 503 | |||
| 504 | return; | ||
| 505 | } | ||
| 506 | |||
| 507 | static void gmac_flow_ctrl(unsigned long ioaddr, unsigned int duplex, | ||
| 508 | unsigned int fc, unsigned int pause_time) | ||
| 509 | { | ||
| 510 | unsigned int flow = 0; | ||
| 511 | |||
| 512 | DBG(KERN_DEBUG "GMAC Flow-Control:\n"); | ||
| 513 | if (fc & FLOW_RX) { | ||
| 514 | DBG(KERN_DEBUG "\tReceive Flow-Control ON\n"); | ||
| 515 | flow |= GMAC_FLOW_CTRL_RFE; | ||
| 516 | } | ||
| 517 | if (fc & FLOW_TX) { | ||
| 518 | DBG(KERN_DEBUG "\tTransmit Flow-Control ON\n"); | ||
| 519 | flow |= GMAC_FLOW_CTRL_TFE; | ||
| 520 | } | ||
| 521 | |||
| 522 | if (duplex) { | ||
| 523 | DBG(KERN_DEBUG "\tduplex mode: pause time: %d\n", pause_time); | ||
| 524 | flow |= (pause_time << GMAC_FLOW_CTRL_PT_SHIFT); | ||
| 525 | } | ||
| 526 | |||
| 527 | writel(flow, ioaddr + GMAC_FLOW_CTRL); | ||
| 528 | return; | ||
| 529 | } | ||
| 530 | |||
| 531 | static void gmac_pmt(unsigned long ioaddr, unsigned long mode) | ||
| 532 | { | ||
| 533 | unsigned int pmt = 0; | ||
| 534 | |||
| 535 | if (mode == WAKE_MAGIC) { | ||
| 536 | DBG(KERN_DEBUG "GMAC: WOL Magic frame\n"); | ||
| 537 | pmt |= power_down | magic_pkt_en; | ||
| 538 | } else if (mode == WAKE_UCAST) { | ||
| 539 | DBG(KERN_DEBUG "GMAC: WOL on global unicast\n"); | ||
| 540 | pmt |= global_unicast; | ||
| 541 | } | ||
| 542 | |||
| 543 | writel(pmt, ioaddr + GMAC_PMT); | ||
| 544 | return; | ||
| 545 | } | ||
| 546 | |||
| 547 | static void gmac_init_rx_desc(struct dma_desc *p, unsigned int ring_size, | ||
| 548 | int disable_rx_ic) | ||
| 549 | { | ||
| 550 | int i; | ||
| 551 | for (i = 0; i < ring_size; i++) { | ||
| 552 | p->des01.erx.own = 1; | ||
| 553 | p->des01.erx.buffer1_size = BUF_SIZE_8KiB - 1; | ||
| 554 | /* To support jumbo frames */ | ||
| 555 | p->des01.erx.buffer2_size = BUF_SIZE_8KiB - 1; | ||
| 556 | if (i == ring_size - 1) | ||
| 557 | p->des01.erx.end_ring = 1; | ||
| 558 | if (disable_rx_ic) | ||
| 559 | p->des01.erx.disable_ic = 1; | ||
| 560 | p++; | ||
| 561 | } | ||
| 562 | return; | ||
| 563 | } | ||
| 564 | |||
| 565 | static void gmac_init_tx_desc(struct dma_desc *p, unsigned int ring_size) | ||
| 566 | { | ||
| 567 | int i; | ||
| 568 | |||
| 569 | for (i = 0; i < ring_size; i++) { | ||
| 570 | p->des01.etx.own = 0; | ||
| 571 | if (i == ring_size - 1) | ||
| 572 | p->des01.etx.end_ring = 1; | ||
| 573 | p++; | ||
| 574 | } | ||
| 575 | |||
| 576 | return; | ||
| 577 | } | ||
| 578 | |||
| 579 | static int gmac_get_tx_owner(struct dma_desc *p) | ||
| 580 | { | ||
| 581 | return p->des01.etx.own; | ||
| 582 | } | ||
| 583 | |||
| 584 | static int gmac_get_rx_owner(struct dma_desc *p) | ||
| 585 | { | ||
| 586 | return p->des01.erx.own; | ||
| 587 | } | ||
| 588 | |||
| 589 | static void gmac_set_tx_owner(struct dma_desc *p) | ||
| 590 | { | ||
| 591 | p->des01.etx.own = 1; | ||
| 592 | } | ||
| 593 | |||
| 594 | static void gmac_set_rx_owner(struct dma_desc *p) | ||
| 595 | { | ||
| 596 | p->des01.erx.own = 1; | ||
| 597 | } | ||
| 598 | |||
| 599 | static int gmac_get_tx_ls(struct dma_desc *p) | ||
| 600 | { | ||
| 601 | return p->des01.etx.last_segment; | ||
| 602 | } | ||
| 603 | |||
| 604 | static void gmac_release_tx_desc(struct dma_desc *p) | ||
| 605 | { | ||
| 606 | int ter = p->des01.etx.end_ring; | ||
| 607 | |||
| 608 | memset(p, 0, sizeof(struct dma_desc)); | ||
| 609 | p->des01.etx.end_ring = ter; | ||
| 610 | |||
| 611 | return; | ||
| 612 | } | ||
| 613 | |||
| 614 | static void gmac_prepare_tx_desc(struct dma_desc *p, int is_fs, int len, | ||
| 615 | int csum_flag) | ||
| 616 | { | ||
| 617 | p->des01.etx.first_segment = is_fs; | ||
| 618 | if (unlikely(len > BUF_SIZE_4KiB)) { | ||
| 619 | p->des01.etx.buffer1_size = BUF_SIZE_4KiB; | ||
| 620 | p->des01.etx.buffer2_size = len - BUF_SIZE_4KiB; | ||
| 621 | } else { | ||
| 622 | p->des01.etx.buffer1_size = len; | ||
| 623 | } | ||
| 624 | if (likely(csum_flag)) | ||
| 625 | p->des01.etx.checksum_insertion = cic_full; | ||
| 626 | } | ||
| 627 | |||
| 628 | static void gmac_clear_tx_ic(struct dma_desc *p) | ||
| 629 | { | ||
| 630 | p->des01.etx.interrupt = 0; | ||
| 631 | } | ||
| 632 | |||
| 633 | static void gmac_close_tx_desc(struct dma_desc *p) | ||
| 634 | { | ||
| 635 | p->des01.etx.last_segment = 1; | ||
| 636 | p->des01.etx.interrupt = 1; | ||
| 637 | } | ||
| 638 | |||
| 639 | static int gmac_get_rx_frame_len(struct dma_desc *p) | ||
| 640 | { | ||
| 641 | return p->des01.erx.frame_length; | ||
| 642 | } | ||
| 643 | |||
| 644 | struct stmmac_ops gmac_driver = { | ||
| 645 | .core_init = gmac_core_init, | ||
| 646 | .dump_mac_regs = gmac_dump_regs, | ||
| 647 | .dma_init = gmac_dma_init, | ||
| 648 | .dump_dma_regs = gmac_dump_dma_regs, | ||
| 649 | .dma_mode = gmac_dma_operation_mode, | ||
| 650 | .dma_diagnostic_fr = gmac_dma_diagnostic_fr, | ||
| 651 | .tx_status = gmac_get_tx_frame_status, | ||
| 652 | .rx_status = gmac_get_rx_frame_status, | ||
| 653 | .get_tx_len = gmac_get_tx_len, | ||
| 654 | .set_filter = gmac_set_filter, | ||
| 655 | .flow_ctrl = gmac_flow_ctrl, | ||
| 656 | .pmt = gmac_pmt, | ||
| 657 | .init_rx_desc = gmac_init_rx_desc, | ||
| 658 | .init_tx_desc = gmac_init_tx_desc, | ||
| 659 | .get_tx_owner = gmac_get_tx_owner, | ||
| 660 | .get_rx_owner = gmac_get_rx_owner, | ||
| 661 | .release_tx_desc = gmac_release_tx_desc, | ||
| 662 | .prepare_tx_desc = gmac_prepare_tx_desc, | ||
| 663 | .clear_tx_ic = gmac_clear_tx_ic, | ||
| 664 | .close_tx_desc = gmac_close_tx_desc, | ||
| 665 | .get_tx_ls = gmac_get_tx_ls, | ||
| 666 | .set_tx_owner = gmac_set_tx_owner, | ||
| 667 | .set_rx_owner = gmac_set_rx_owner, | ||
| 668 | .get_rx_frame_len = gmac_get_rx_frame_len, | ||
| 669 | .host_irq_status = gmac_irq_status, | ||
| 670 | .set_umac_addr = gmac_set_umac_addr, | ||
| 671 | .get_umac_addr = gmac_get_umac_addr, | ||
| 672 | }; | ||
| 673 | |||
| 674 | struct mac_device_info *gmac_setup(unsigned long ioaddr) | ||
| 675 | { | ||
| 676 | struct mac_device_info *mac; | ||
| 677 | u32 uid = readl(ioaddr + GMAC_VERSION); | ||
| 678 | |||
| 679 | pr_info("\tGMAC - user ID: 0x%x, Synopsys ID: 0x%x\n", | ||
| 680 | ((uid & 0x0000ff00) >> 8), (uid & 0x000000ff)); | ||
| 681 | |||
| 682 | mac = kzalloc(sizeof(const struct mac_device_info), GFP_KERNEL); | ||
| 683 | |||
| 684 | mac->ops = &gmac_driver; | ||
| 685 | mac->hw.pmt = PMT_SUPPORTED; | ||
| 686 | mac->hw.link.port = GMAC_CONTROL_PS; | ||
| 687 | mac->hw.link.duplex = GMAC_CONTROL_DM; | ||
| 688 | mac->hw.link.speed = GMAC_CONTROL_FES; | ||
| 689 | mac->hw.mii.addr = GMAC_MII_ADDR; | ||
| 690 | mac->hw.mii.data = GMAC_MII_DATA; | ||
| 691 | |||
| 692 | return mac; | ||
| 693 | } | ||
diff --git a/drivers/net/stmmac/gmac.h b/drivers/net/stmmac/gmac.h new file mode 100644 index 000000000000..684a363120a9 --- /dev/null +++ b/drivers/net/stmmac/gmac.h | |||
| @@ -0,0 +1,204 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify it | ||
| 5 | under the terms and conditions of the GNU General Public License, | ||
| 6 | version 2, as published by the Free Software Foundation. | ||
| 7 | |||
| 8 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 9 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 10 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 11 | more details. | ||
| 12 | |||
| 13 | You should have received a copy of the GNU General Public License along with | ||
| 14 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 15 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 16 | |||
| 17 | The full GNU General Public License is included in this distribution in | ||
| 18 | the file called "COPYING". | ||
| 19 | |||
| 20 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 21 | *******************************************************************************/ | ||
| 22 | |||
| 23 | #define GMAC_CONTROL 0x00000000 /* Configuration */ | ||
| 24 | #define GMAC_FRAME_FILTER 0x00000004 /* Frame Filter */ | ||
| 25 | #define GMAC_HASH_HIGH 0x00000008 /* Multicast Hash Table High */ | ||
| 26 | #define GMAC_HASH_LOW 0x0000000c /* Multicast Hash Table Low */ | ||
| 27 | #define GMAC_MII_ADDR 0x00000010 /* MII Address */ | ||
| 28 | #define GMAC_MII_DATA 0x00000014 /* MII Data */ | ||
| 29 | #define GMAC_FLOW_CTRL 0x00000018 /* Flow Control */ | ||
| 30 | #define GMAC_VLAN_TAG 0x0000001c /* VLAN Tag */ | ||
| 31 | #define GMAC_VERSION 0x00000020 /* GMAC CORE Version */ | ||
| 32 | #define GMAC_WAKEUP_FILTER 0x00000028 /* Wake-up Frame Filter */ | ||
| 33 | |||
| 34 | #define GMAC_INT_STATUS 0x00000038 /* interrupt status register */ | ||
| 35 | enum gmac_irq_status { | ||
| 36 | time_stamp_irq = 0x0200, | ||
| 37 | mmc_rx_csum_offload_irq = 0x0080, | ||
| 38 | mmc_tx_irq = 0x0040, | ||
| 39 | mmc_rx_irq = 0x0020, | ||
| 40 | mmc_irq = 0x0010, | ||
| 41 | pmt_irq = 0x0008, | ||
| 42 | pcs_ane_irq = 0x0004, | ||
| 43 | pcs_link_irq = 0x0002, | ||
| 44 | rgmii_irq = 0x0001, | ||
| 45 | }; | ||
| 46 | #define GMAC_INT_MASK 0x0000003c /* interrupt mask register */ | ||
| 47 | |||
| 48 | /* PMT Control and Status */ | ||
| 49 | #define GMAC_PMT 0x0000002c | ||
| 50 | enum power_event { | ||
| 51 | pointer_reset = 0x80000000, | ||
| 52 | global_unicast = 0x00000200, | ||
| 53 | wake_up_rx_frame = 0x00000040, | ||
| 54 | magic_frame = 0x00000020, | ||
| 55 | wake_up_frame_en = 0x00000004, | ||
| 56 | magic_pkt_en = 0x00000002, | ||
| 57 | power_down = 0x00000001, | ||
| 58 | }; | ||
| 59 | |||
| 60 | /* GMAC HW ADDR regs */ | ||
| 61 | #define GMAC_ADDR_HIGH(reg) (0x00000040+(reg * 8)) | ||
| 62 | #define GMAC_ADDR_LOW(reg) (0x00000044+(reg * 8)) | ||
| 63 | #define GMAC_MAX_UNICAST_ADDRESSES 16 | ||
| 64 | |||
| 65 | #define GMAC_AN_CTRL 0x000000c0 /* AN control */ | ||
| 66 | #define GMAC_AN_STATUS 0x000000c4 /* AN status */ | ||
| 67 | #define GMAC_ANE_ADV 0x000000c8 /* Auto-Neg. Advertisement */ | ||
| 68 | #define GMAC_ANE_LINK 0x000000cc /* Auto-Neg. link partener ability */ | ||
| 69 | #define GMAC_ANE_EXP 0x000000d0 /* ANE expansion */ | ||
| 70 | #define GMAC_TBI 0x000000d4 /* TBI extend status */ | ||
| 71 | #define GMAC_GMII_STATUS 0x000000d8 /* S/R-GMII status */ | ||
| 72 | |||
| 73 | /* GMAC Configuration defines */ | ||
| 74 | #define GMAC_CONTROL_TC 0x01000000 /* Transmit Conf. in RGMII/SGMII */ | ||
| 75 | #define GMAC_CONTROL_WD 0x00800000 /* Disable Watchdog on receive */ | ||
| 76 | #define GMAC_CONTROL_JD 0x00400000 /* Jabber disable */ | ||
| 77 | #define GMAC_CONTROL_BE 0x00200000 /* Frame Burst Enable */ | ||
| 78 | #define GMAC_CONTROL_JE 0x00100000 /* Jumbo frame */ | ||
| 79 | enum inter_frame_gap { | ||
| 80 | GMAC_CONTROL_IFG_88 = 0x00040000, | ||
| 81 | GMAC_CONTROL_IFG_80 = 0x00020000, | ||
| 82 | GMAC_CONTROL_IFG_40 = 0x000e0000, | ||
| 83 | }; | ||
| 84 | #define GMAC_CONTROL_DCRS 0x00010000 /* Disable carrier sense during tx */ | ||
| 85 | #define GMAC_CONTROL_PS 0x00008000 /* Port Select 0:GMI 1:MII */ | ||
| 86 | #define GMAC_CONTROL_FES 0x00004000 /* Speed 0:10 1:100 */ | ||
| 87 | #define GMAC_CONTROL_DO 0x00002000 /* Disable Rx Own */ | ||
| 88 | #define GMAC_CONTROL_LM 0x00001000 /* Loop-back mode */ | ||
| 89 | #define GMAC_CONTROL_DM 0x00000800 /* Duplex Mode */ | ||
| 90 | #define GMAC_CONTROL_IPC 0x00000400 /* Checksum Offload */ | ||
| 91 | #define GMAC_CONTROL_DR 0x00000200 /* Disable Retry */ | ||
| 92 | #define GMAC_CONTROL_LUD 0x00000100 /* Link up/down */ | ||
| 93 | #define GMAC_CONTROL_ACS 0x00000080 /* Automatic Pad Stripping */ | ||
| 94 | #define GMAC_CONTROL_DC 0x00000010 /* Deferral Check */ | ||
| 95 | #define GMAC_CONTROL_TE 0x00000008 /* Transmitter Enable */ | ||
| 96 | #define GMAC_CONTROL_RE 0x00000004 /* Receiver Enable */ | ||
| 97 | |||
| 98 | #define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \ | ||
| 99 | GMAC_CONTROL_IPC | GMAC_CONTROL_JE | GMAC_CONTROL_BE) | ||
| 100 | |||
| 101 | /* GMAC Frame Filter defines */ | ||
| 102 | #define GMAC_FRAME_FILTER_PR 0x00000001 /* Promiscuous Mode */ | ||
| 103 | #define GMAC_FRAME_FILTER_HUC 0x00000002 /* Hash Unicast */ | ||
| 104 | #define GMAC_FRAME_FILTER_HMC 0x00000004 /* Hash Multicast */ | ||
| 105 | #define GMAC_FRAME_FILTER_DAIF 0x00000008 /* DA Inverse Filtering */ | ||
| 106 | #define GMAC_FRAME_FILTER_PM 0x00000010 /* Pass all multicast */ | ||
| 107 | #define GMAC_FRAME_FILTER_DBF 0x00000020 /* Disable Broadcast frames */ | ||
| 108 | #define GMAC_FRAME_FILTER_SAIF 0x00000100 /* Inverse Filtering */ | ||
| 109 | #define GMAC_FRAME_FILTER_SAF 0x00000200 /* Source Address Filter */ | ||
| 110 | #define GMAC_FRAME_FILTER_HPF 0x00000400 /* Hash or perfect Filter */ | ||
| 111 | #define GMAC_FRAME_FILTER_RA 0x80000000 /* Receive all mode */ | ||
| 112 | /* GMII ADDR defines */ | ||
| 113 | #define GMAC_MII_ADDR_WRITE 0x00000002 /* MII Write */ | ||
| 114 | #define GMAC_MII_ADDR_BUSY 0x00000001 /* MII Busy */ | ||
| 115 | /* GMAC FLOW CTRL defines */ | ||
| 116 | #define GMAC_FLOW_CTRL_PT_MASK 0xffff0000 /* Pause Time Mask */ | ||
| 117 | #define GMAC_FLOW_CTRL_PT_SHIFT 16 | ||
| 118 | #define GMAC_FLOW_CTRL_RFE 0x00000004 /* Rx Flow Control Enable */ | ||
| 119 | #define GMAC_FLOW_CTRL_TFE 0x00000002 /* Tx Flow Control Enable */ | ||
| 120 | #define GMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */ | ||
| 121 | |||
| 122 | /*--- DMA BLOCK defines ---*/ | ||
| 123 | /* DMA Bus Mode register defines */ | ||
| 124 | #define DMA_BUS_MODE_SFT_RESET 0x00000001 /* Software Reset */ | ||
| 125 | #define DMA_BUS_MODE_DA 0x00000002 /* Arbitration scheme */ | ||
| 126 | #define DMA_BUS_MODE_DSL_MASK 0x0000007c /* Descriptor Skip Length */ | ||
| 127 | #define DMA_BUS_MODE_DSL_SHIFT 2 /* (in DWORDS) */ | ||
| 128 | /* Programmable burst length (passed thorugh platform)*/ | ||
| 129 | #define DMA_BUS_MODE_PBL_MASK 0x00003f00 /* Programmable Burst Len */ | ||
| 130 | #define DMA_BUS_MODE_PBL_SHIFT 8 | ||
| 131 | |||
| 132 | enum rx_tx_priority_ratio { | ||
| 133 | double_ratio = 0x00004000, /*2:1 */ | ||
| 134 | triple_ratio = 0x00008000, /*3:1 */ | ||
| 135 | quadruple_ratio = 0x0000c000, /*4:1 */ | ||
| 136 | }; | ||
| 137 | |||
| 138 | #define DMA_BUS_MODE_FB 0x00010000 /* Fixed burst */ | ||
| 139 | #define DMA_BUS_MODE_RPBL_MASK 0x003e0000 /* Rx-Programmable Burst Len */ | ||
| 140 | #define DMA_BUS_MODE_RPBL_SHIFT 17 | ||
| 141 | #define DMA_BUS_MODE_USP 0x00800000 | ||
| 142 | #define DMA_BUS_MODE_4PBL 0x01000000 | ||
| 143 | #define DMA_BUS_MODE_AAL 0x02000000 | ||
| 144 | |||
| 145 | /* DMA CRS Control and Status Register Mapping */ | ||
| 146 | #define DMA_HOST_TX_DESC 0x00001048 /* Current Host Tx descriptor */ | ||
| 147 | #define DMA_HOST_RX_DESC 0x0000104c /* Current Host Rx descriptor */ | ||
| 148 | /* DMA Bus Mode register defines */ | ||
| 149 | #define DMA_BUS_PR_RATIO_MASK 0x0000c000 /* Rx/Tx priority ratio */ | ||
| 150 | #define DMA_BUS_PR_RATIO_SHIFT 14 | ||
| 151 | #define DMA_BUS_FB 0x00010000 /* Fixed Burst */ | ||
| 152 | |||
| 153 | /* DMA operation mode defines (start/stop tx/rx are placed in common header)*/ | ||
| 154 | #define DMA_CONTROL_DT 0x04000000 /* Disable Drop TCP/IP csum error */ | ||
| 155 | #define DMA_CONTROL_RSF 0x02000000 /* Receive Store and Forward */ | ||
| 156 | #define DMA_CONTROL_DFF 0x01000000 /* Disaable flushing */ | ||
| 157 | /* Theshold for Activating the FC */ | ||
| 158 | enum rfa { | ||
| 159 | act_full_minus_1 = 0x00800000, | ||
| 160 | act_full_minus_2 = 0x00800200, | ||
| 161 | act_full_minus_3 = 0x00800400, | ||
| 162 | act_full_minus_4 = 0x00800600, | ||
| 163 | }; | ||
| 164 | /* Theshold for Deactivating the FC */ | ||
| 165 | enum rfd { | ||
| 166 | deac_full_minus_1 = 0x00400000, | ||
| 167 | deac_full_minus_2 = 0x00400800, | ||
| 168 | deac_full_minus_3 = 0x00401000, | ||
| 169 | deac_full_minus_4 = 0x00401800, | ||
| 170 | }; | ||
| 171 | #define DMA_CONTROL_TSF 0x00200000 /* Transmit Store and Forward */ | ||
| 172 | #define DMA_CONTROL_FTF 0x00100000 /* Flush transmit FIFO */ | ||
| 173 | |||
| 174 | enum ttc_control { | ||
| 175 | DMA_CONTROL_TTC_64 = 0x00000000, | ||
| 176 | DMA_CONTROL_TTC_128 = 0x00004000, | ||
| 177 | DMA_CONTROL_TTC_192 = 0x00008000, | ||
| 178 | DMA_CONTROL_TTC_256 = 0x0000c000, | ||
| 179 | DMA_CONTROL_TTC_40 = 0x00010000, | ||
| 180 | DMA_CONTROL_TTC_32 = 0x00014000, | ||
| 181 | DMA_CONTROL_TTC_24 = 0x00018000, | ||
| 182 | DMA_CONTROL_TTC_16 = 0x0001c000, | ||
| 183 | }; | ||
| 184 | #define DMA_CONTROL_TC_TX_MASK 0xfffe3fff | ||
| 185 | |||
| 186 | #define DMA_CONTROL_EFC 0x00000100 | ||
| 187 | #define DMA_CONTROL_FEF 0x00000080 | ||
| 188 | #define DMA_CONTROL_FUF 0x00000040 | ||
| 189 | |||
| 190 | enum rtc_control { | ||
| 191 | DMA_CONTROL_RTC_64 = 0x00000000, | ||
| 192 | DMA_CONTROL_RTC_32 = 0x00000008, | ||
| 193 | DMA_CONTROL_RTC_96 = 0x00000010, | ||
| 194 | DMA_CONTROL_RTC_128 = 0x00000018, | ||
| 195 | }; | ||
| 196 | #define DMA_CONTROL_TC_RX_MASK 0xffffffe7 | ||
| 197 | |||
| 198 | #define DMA_CONTROL_OSF 0x00000004 /* Operate on second frame */ | ||
| 199 | |||
| 200 | /* MMC registers offset */ | ||
| 201 | #define GMAC_MMC_CTRL 0x100 | ||
| 202 | #define GMAC_MMC_RX_INTR 0x104 | ||
| 203 | #define GMAC_MMC_TX_INTR 0x108 | ||
| 204 | #define GMAC_MMC_RX_CSUM_OFFLOAD 0x208 | ||
diff --git a/drivers/net/stmmac/mac100.c b/drivers/net/stmmac/mac100.c new file mode 100644 index 000000000000..625171b6062b --- /dev/null +++ b/drivers/net/stmmac/mac100.c | |||
| @@ -0,0 +1,517 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | This is the driver for the MAC 10/100 on-chip Ethernet controller | ||
| 3 | currently tested on all the ST boards based on STb7109 and stx7200 SoCs. | ||
| 4 | |||
| 5 | DWC Ether MAC 10/100 Universal version 4.0 has been used for developing | ||
| 6 | this code. | ||
| 7 | |||
| 8 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 9 | |||
| 10 | This program is free software; you can redistribute it and/or modify it | ||
| 11 | under the terms and conditions of the GNU General Public License, | ||
| 12 | version 2, as published by the Free Software Foundation. | ||
| 13 | |||
| 14 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 15 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 16 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 17 | more details. | ||
| 18 | |||
| 19 | You should have received a copy of the GNU General Public License along with | ||
| 20 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 21 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 22 | |||
| 23 | The full GNU General Public License is included in this distribution in | ||
| 24 | the file called "COPYING". | ||
| 25 | |||
| 26 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 27 | *******************************************************************************/ | ||
| 28 | |||
| 29 | #include <linux/netdevice.h> | ||
| 30 | #include <linux/crc32.h> | ||
| 31 | #include <linux/mii.h> | ||
| 32 | #include <linux/phy.h> | ||
| 33 | |||
| 34 | #include "common.h" | ||
| 35 | #include "mac100.h" | ||
| 36 | |||
| 37 | #undef MAC100_DEBUG | ||
| 38 | /*#define MAC100_DEBUG*/ | ||
| 39 | #ifdef MAC100_DEBUG | ||
| 40 | #define DBG(fmt, args...) printk(fmt, ## args) | ||
| 41 | #else | ||
| 42 | #define DBG(fmt, args...) do { } while (0) | ||
| 43 | #endif | ||
| 44 | |||
| 45 | static void mac100_core_init(unsigned long ioaddr) | ||
| 46 | { | ||
| 47 | u32 value = readl(ioaddr + MAC_CONTROL); | ||
| 48 | |||
| 49 | writel((value | MAC_CORE_INIT), ioaddr + MAC_CONTROL); | ||
| 50 | |||
| 51 | #ifdef STMMAC_VLAN_TAG_USED | ||
| 52 | writel(ETH_P_8021Q, ioaddr + MAC_VLAN1); | ||
| 53 | #endif | ||
| 54 | return; | ||
| 55 | } | ||
| 56 | |||
| 57 | static void mac100_dump_mac_regs(unsigned long ioaddr) | ||
| 58 | { | ||
| 59 | pr_info("\t----------------------------------------------\n" | ||
| 60 | "\t MAC100 CSR (base addr = 0x%8x)\n" | ||
| 61 | "\t----------------------------------------------\n", | ||
| 62 | (unsigned int)ioaddr); | ||
| 63 | pr_info("\tcontrol reg (offset 0x%x): 0x%08x\n", MAC_CONTROL, | ||
| 64 | readl(ioaddr + MAC_CONTROL)); | ||
| 65 | pr_info("\taddr HI (offset 0x%x): 0x%08x\n ", MAC_ADDR_HIGH, | ||
| 66 | readl(ioaddr + MAC_ADDR_HIGH)); | ||
| 67 | pr_info("\taddr LO (offset 0x%x): 0x%08x\n", MAC_ADDR_LOW, | ||
| 68 | readl(ioaddr + MAC_ADDR_LOW)); | ||
| 69 | pr_info("\tmulticast hash HI (offset 0x%x): 0x%08x\n", | ||
| 70 | MAC_HASH_HIGH, readl(ioaddr + MAC_HASH_HIGH)); | ||
| 71 | pr_info("\tmulticast hash LO (offset 0x%x): 0x%08x\n", | ||
| 72 | MAC_HASH_LOW, readl(ioaddr + MAC_HASH_LOW)); | ||
| 73 | pr_info("\tflow control (offset 0x%x): 0x%08x\n", | ||
| 74 | MAC_FLOW_CTRL, readl(ioaddr + MAC_FLOW_CTRL)); | ||
| 75 | pr_info("\tVLAN1 tag (offset 0x%x): 0x%08x\n", MAC_VLAN1, | ||
| 76 | readl(ioaddr + MAC_VLAN1)); | ||
| 77 | pr_info("\tVLAN2 tag (offset 0x%x): 0x%08x\n", MAC_VLAN2, | ||
| 78 | readl(ioaddr + MAC_VLAN2)); | ||
| 79 | pr_info("\n\tMAC management counter registers\n"); | ||
| 80 | pr_info("\t MMC crtl (offset 0x%x): 0x%08x\n", | ||
| 81 | MMC_CONTROL, readl(ioaddr + MMC_CONTROL)); | ||
| 82 | pr_info("\t MMC High Interrupt (offset 0x%x): 0x%08x\n", | ||
| 83 | MMC_HIGH_INTR, readl(ioaddr + MMC_HIGH_INTR)); | ||
| 84 | pr_info("\t MMC Low Interrupt (offset 0x%x): 0x%08x\n", | ||
| 85 | MMC_LOW_INTR, readl(ioaddr + MMC_LOW_INTR)); | ||
| 86 | pr_info("\t MMC High Interrupt Mask (offset 0x%x): 0x%08x\n", | ||
| 87 | MMC_HIGH_INTR_MASK, readl(ioaddr + MMC_HIGH_INTR_MASK)); | ||
| 88 | pr_info("\t MMC Low Interrupt Mask (offset 0x%x): 0x%08x\n", | ||
| 89 | MMC_LOW_INTR_MASK, readl(ioaddr + MMC_LOW_INTR_MASK)); | ||
| 90 | return; | ||
| 91 | } | ||
| 92 | |||
| 93 | static int mac100_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx, | ||
| 94 | u32 dma_rx) | ||
| 95 | { | ||
| 96 | u32 value = readl(ioaddr + DMA_BUS_MODE); | ||
| 97 | /* DMA SW reset */ | ||
| 98 | value |= DMA_BUS_MODE_SFT_RESET; | ||
| 99 | writel(value, ioaddr + DMA_BUS_MODE); | ||
| 100 | do {} while ((readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)); | ||
| 101 | |||
| 102 | /* Enable Application Access by writing to DMA CSR0 */ | ||
| 103 | writel(DMA_BUS_MODE_DEFAULT | (pbl << DMA_BUS_MODE_PBL_SHIFT), | ||
| 104 | ioaddr + DMA_BUS_MODE); | ||
| 105 | |||
| 106 | /* Mask interrupts by writing to CSR7 */ | ||
| 107 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA); | ||
| 108 | |||
| 109 | /* The base address of the RX/TX descriptor lists must be written into | ||
| 110 | * DMA CSR3 and CSR4, respectively. */ | ||
| 111 | writel(dma_tx, ioaddr + DMA_TX_BASE_ADDR); | ||
| 112 | writel(dma_rx, ioaddr + DMA_RCV_BASE_ADDR); | ||
| 113 | |||
| 114 | return 0; | ||
| 115 | } | ||
| 116 | |||
| 117 | /* Store and Forward capability is not used at all.. | ||
| 118 | * The transmit threshold can be programmed by | ||
| 119 | * setting the TTC bits in the DMA control register.*/ | ||
| 120 | static void mac100_dma_operation_mode(unsigned long ioaddr, int txmode, | ||
| 121 | int rxmode) | ||
| 122 | { | ||
| 123 | u32 csr6 = readl(ioaddr + DMA_CONTROL); | ||
| 124 | |||
| 125 | if (txmode <= 32) | ||
| 126 | csr6 |= DMA_CONTROL_TTC_32; | ||
| 127 | else if (txmode <= 64) | ||
| 128 | csr6 |= DMA_CONTROL_TTC_64; | ||
| 129 | else | ||
| 130 | csr6 |= DMA_CONTROL_TTC_128; | ||
| 131 | |||
| 132 | writel(csr6, ioaddr + DMA_CONTROL); | ||
| 133 | |||
| 134 | return; | ||
| 135 | } | ||
| 136 | |||
| 137 | static void mac100_dump_dma_regs(unsigned long ioaddr) | ||
| 138 | { | ||
| 139 | int i; | ||
| 140 | |||
| 141 | DBG(KERN_DEBUG "MAC100 DMA CSR \n"); | ||
| 142 | for (i = 0; i < 9; i++) | ||
| 143 | pr_debug("\t CSR%d (offset 0x%x): 0x%08x\n", i, | ||
| 144 | (DMA_BUS_MODE + i * 4), | ||
| 145 | readl(ioaddr + DMA_BUS_MODE + i * 4)); | ||
| 146 | DBG(KERN_DEBUG "\t CSR20 (offset 0x%x): 0x%08x\n", | ||
| 147 | DMA_CUR_TX_BUF_ADDR, readl(ioaddr + DMA_CUR_TX_BUF_ADDR)); | ||
| 148 | DBG(KERN_DEBUG "\t CSR21 (offset 0x%x): 0x%08x\n", | ||
| 149 | DMA_CUR_RX_BUF_ADDR, readl(ioaddr + DMA_CUR_RX_BUF_ADDR)); | ||
| 150 | return; | ||
| 151 | } | ||
| 152 | |||
| 153 | /* DMA controller has two counters to track the number of | ||
| 154 | the receive missed frames. */ | ||
| 155 | static void mac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x, | ||
| 156 | unsigned long ioaddr) | ||
| 157 | { | ||
| 158 | struct net_device_stats *stats = (struct net_device_stats *)data; | ||
| 159 | u32 csr8 = readl(ioaddr + DMA_MISSED_FRAME_CTR); | ||
| 160 | |||
| 161 | if (unlikely(csr8)) { | ||
| 162 | if (csr8 & DMA_MISSED_FRAME_OVE) { | ||
| 163 | stats->rx_over_errors += 0x800; | ||
| 164 | x->rx_overflow_cntr += 0x800; | ||
| 165 | } else { | ||
| 166 | unsigned int ove_cntr; | ||
| 167 | ove_cntr = ((csr8 & DMA_MISSED_FRAME_OVE_CNTR) >> 17); | ||
| 168 | stats->rx_over_errors += ove_cntr; | ||
| 169 | x->rx_overflow_cntr += ove_cntr; | ||
| 170 | } | ||
| 171 | |||
| 172 | if (csr8 & DMA_MISSED_FRAME_OVE_M) { | ||
| 173 | stats->rx_missed_errors += 0xffff; | ||
| 174 | x->rx_missed_cntr += 0xffff; | ||
| 175 | } else { | ||
| 176 | unsigned int miss_f = (csr8 & DMA_MISSED_FRAME_M_CNTR); | ||
| 177 | stats->rx_missed_errors += miss_f; | ||
| 178 | x->rx_missed_cntr += miss_f; | ||
| 179 | } | ||
| 180 | } | ||
| 181 | return; | ||
| 182 | } | ||
| 183 | |||
| 184 | static int mac100_get_tx_frame_status(void *data, struct stmmac_extra_stats *x, | ||
| 185 | struct dma_desc *p, unsigned long ioaddr) | ||
| 186 | { | ||
| 187 | int ret = 0; | ||
| 188 | struct net_device_stats *stats = (struct net_device_stats *)data; | ||
| 189 | |||
| 190 | if (unlikely(p->des01.tx.error_summary)) { | ||
| 191 | if (unlikely(p->des01.tx.underflow_error)) { | ||
| 192 | x->tx_underflow++; | ||
| 193 | stats->tx_fifo_errors++; | ||
| 194 | } | ||
| 195 | if (unlikely(p->des01.tx.no_carrier)) { | ||
| 196 | x->tx_carrier++; | ||
| 197 | stats->tx_carrier_errors++; | ||
| 198 | } | ||
| 199 | if (unlikely(p->des01.tx.loss_carrier)) { | ||
| 200 | x->tx_losscarrier++; | ||
| 201 | stats->tx_carrier_errors++; | ||
| 202 | } | ||
| 203 | if (unlikely((p->des01.tx.excessive_deferral) || | ||
| 204 | (p->des01.tx.excessive_collisions) || | ||
| 205 | (p->des01.tx.late_collision))) | ||
| 206 | stats->collisions += p->des01.tx.collision_count; | ||
| 207 | ret = -1; | ||
| 208 | } | ||
| 209 | if (unlikely(p->des01.tx.heartbeat_fail)) { | ||
| 210 | x->tx_heartbeat++; | ||
| 211 | stats->tx_heartbeat_errors++; | ||
| 212 | ret = -1; | ||
| 213 | } | ||
| 214 | if (unlikely(p->des01.tx.deferred)) | ||
| 215 | x->tx_deferred++; | ||
| 216 | |||
| 217 | return ret; | ||
| 218 | } | ||
| 219 | |||
| 220 | static int mac100_get_tx_len(struct dma_desc *p) | ||
| 221 | { | ||
| 222 | return p->des01.tx.buffer1_size; | ||
| 223 | } | ||
| 224 | |||
| 225 | /* This function verifies if each incoming frame has some errors | ||
| 226 | * and, if required, updates the multicast statistics. | ||
| 227 | * In case of success, it returns csum_none becasue the device | ||
| 228 | * is not able to compute the csum in HW. */ | ||
| 229 | static int mac100_get_rx_frame_status(void *data, struct stmmac_extra_stats *x, | ||
| 230 | struct dma_desc *p) | ||
| 231 | { | ||
| 232 | int ret = csum_none; | ||
| 233 | struct net_device_stats *stats = (struct net_device_stats *)data; | ||
| 234 | |||
| 235 | if (unlikely(p->des01.rx.last_descriptor == 0)) { | ||
| 236 | pr_warning("mac100 Error: Oversized Ethernet " | ||
| 237 | "frame spanned multiple buffers\n"); | ||
| 238 | stats->rx_length_errors++; | ||
| 239 | return discard_frame; | ||
| 240 | } | ||
| 241 | |||
| 242 | if (unlikely(p->des01.rx.error_summary)) { | ||
| 243 | if (unlikely(p->des01.rx.descriptor_error)) | ||
| 244 | x->rx_desc++; | ||
| 245 | if (unlikely(p->des01.rx.partial_frame_error)) | ||
| 246 | x->rx_partial++; | ||
| 247 | if (unlikely(p->des01.rx.run_frame)) | ||
| 248 | x->rx_runt++; | ||
| 249 | if (unlikely(p->des01.rx.frame_too_long)) | ||
| 250 | x->rx_toolong++; | ||
| 251 | if (unlikely(p->des01.rx.collision)) { | ||
| 252 | x->rx_collision++; | ||
| 253 | stats->collisions++; | ||
| 254 | } | ||
| 255 | if (unlikely(p->des01.rx.crc_error)) { | ||
| 256 | x->rx_crc++; | ||
| 257 | stats->rx_crc_errors++; | ||
| 258 | } | ||
| 259 | ret = discard_frame; | ||
| 260 | } | ||
| 261 | if (unlikely(p->des01.rx.dribbling)) | ||
| 262 | ret = discard_frame; | ||
| 263 | |||
| 264 | if (unlikely(p->des01.rx.length_error)) { | ||
| 265 | x->rx_lenght++; | ||
| 266 | ret = discard_frame; | ||
| 267 | } | ||
| 268 | if (unlikely(p->des01.rx.mii_error)) { | ||
| 269 | x->rx_mii++; | ||
| 270 | ret = discard_frame; | ||
| 271 | } | ||
| 272 | if (p->des01.rx.multicast_frame) { | ||
| 273 | x->rx_multicast++; | ||
| 274 | stats->multicast++; | ||
| 275 | } | ||
| 276 | return ret; | ||
| 277 | } | ||
| 278 | |||
| 279 | static void mac100_irq_status(unsigned long ioaddr) | ||
| 280 | { | ||
| 281 | return; | ||
| 282 | } | ||
| 283 | |||
| 284 | static void mac100_set_umac_addr(unsigned long ioaddr, unsigned char *addr, | ||
| 285 | unsigned int reg_n) | ||
| 286 | { | ||
| 287 | stmmac_set_mac_addr(ioaddr, addr, MAC_ADDR_HIGH, MAC_ADDR_LOW); | ||
| 288 | } | ||
| 289 | |||
| 290 | static void mac100_get_umac_addr(unsigned long ioaddr, unsigned char *addr, | ||
| 291 | unsigned int reg_n) | ||
| 292 | { | ||
| 293 | stmmac_get_mac_addr(ioaddr, addr, MAC_ADDR_HIGH, MAC_ADDR_LOW); | ||
| 294 | } | ||
| 295 | |||
| 296 | static void mac100_set_filter(struct net_device *dev) | ||
| 297 | { | ||
| 298 | unsigned long ioaddr = dev->base_addr; | ||
| 299 | u32 value = readl(ioaddr + MAC_CONTROL); | ||
| 300 | |||
| 301 | if (dev->flags & IFF_PROMISC) { | ||
| 302 | value |= MAC_CONTROL_PR; | ||
| 303 | value &= ~(MAC_CONTROL_PM | MAC_CONTROL_IF | MAC_CONTROL_HO | | ||
| 304 | MAC_CONTROL_HP); | ||
| 305 | } else if ((dev->mc_count > HASH_TABLE_SIZE) | ||
| 306 | || (dev->flags & IFF_ALLMULTI)) { | ||
| 307 | value |= MAC_CONTROL_PM; | ||
| 308 | value &= ~(MAC_CONTROL_PR | MAC_CONTROL_IF | MAC_CONTROL_HO); | ||
| 309 | writel(0xffffffff, ioaddr + MAC_HASH_HIGH); | ||
| 310 | writel(0xffffffff, ioaddr + MAC_HASH_LOW); | ||
| 311 | } else if (dev->mc_count == 0) { /* no multicast */ | ||
| 312 | value &= ~(MAC_CONTROL_PM | MAC_CONTROL_PR | MAC_CONTROL_IF | | ||
| 313 | MAC_CONTROL_HO | MAC_CONTROL_HP); | ||
| 314 | } else { | ||
| 315 | int i; | ||
| 316 | u32 mc_filter[2]; | ||
| 317 | struct dev_mc_list *mclist; | ||
| 318 | |||
| 319 | /* Perfect filter mode for physical address and Hash | ||
| 320 | filter for multicast */ | ||
| 321 | value |= MAC_CONTROL_HP; | ||
| 322 | value &= ~(MAC_CONTROL_PM | MAC_CONTROL_PR | MAC_CONTROL_IF | ||
| 323 | | MAC_CONTROL_HO); | ||
| 324 | |||
| 325 | memset(mc_filter, 0, sizeof(mc_filter)); | ||
| 326 | for (i = 0, mclist = dev->mc_list; | ||
| 327 | mclist && i < dev->mc_count; i++, mclist = mclist->next) { | ||
| 328 | /* The upper 6 bits of the calculated CRC are used to | ||
| 329 | * index the contens of the hash table */ | ||
| 330 | int bit_nr = | ||
| 331 | ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26; | ||
| 332 | /* The most significant bit determines the register to | ||
| 333 | * use (H/L) while the other 5 bits determine the bit | ||
| 334 | * within the register. */ | ||
| 335 | mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); | ||
| 336 | } | ||
| 337 | writel(mc_filter[0], ioaddr + MAC_HASH_LOW); | ||
| 338 | writel(mc_filter[1], ioaddr + MAC_HASH_HIGH); | ||
| 339 | } | ||
| 340 | |||
| 341 | writel(value, ioaddr + MAC_CONTROL); | ||
| 342 | |||
| 343 | DBG(KERN_INFO "%s: CTRL reg: 0x%08x Hash regs: " | ||
| 344 | "HI 0x%08x, LO 0x%08x\n", | ||
| 345 | __func__, readl(ioaddr + MAC_CONTROL), | ||
| 346 | readl(ioaddr + MAC_HASH_HIGH), readl(ioaddr + MAC_HASH_LOW)); | ||
| 347 | return; | ||
| 348 | } | ||
| 349 | |||
| 350 | static void mac100_flow_ctrl(unsigned long ioaddr, unsigned int duplex, | ||
| 351 | unsigned int fc, unsigned int pause_time) | ||
| 352 | { | ||
| 353 | unsigned int flow = MAC_FLOW_CTRL_ENABLE; | ||
| 354 | |||
| 355 | if (duplex) | ||
| 356 | flow |= (pause_time << MAC_FLOW_CTRL_PT_SHIFT); | ||
| 357 | writel(flow, ioaddr + MAC_FLOW_CTRL); | ||
| 358 | |||
| 359 | return; | ||
| 360 | } | ||
| 361 | |||
| 362 | /* No PMT module supported in our SoC for the Ethernet Controller. */ | ||
| 363 | static void mac100_pmt(unsigned long ioaddr, unsigned long mode) | ||
| 364 | { | ||
| 365 | return; | ||
| 366 | } | ||
| 367 | |||
| 368 | static void mac100_init_rx_desc(struct dma_desc *p, unsigned int ring_size, | ||
| 369 | int disable_rx_ic) | ||
| 370 | { | ||
| 371 | int i; | ||
| 372 | for (i = 0; i < ring_size; i++) { | ||
| 373 | p->des01.rx.own = 1; | ||
| 374 | p->des01.rx.buffer1_size = BUF_SIZE_2KiB - 1; | ||
| 375 | if (i == ring_size - 1) | ||
| 376 | p->des01.rx.end_ring = 1; | ||
| 377 | if (disable_rx_ic) | ||
| 378 | p->des01.rx.disable_ic = 1; | ||
| 379 | p++; | ||
| 380 | } | ||
| 381 | return; | ||
| 382 | } | ||
| 383 | |||
| 384 | static void mac100_init_tx_desc(struct dma_desc *p, unsigned int ring_size) | ||
| 385 | { | ||
| 386 | int i; | ||
| 387 | for (i = 0; i < ring_size; i++) { | ||
| 388 | p->des01.tx.own = 0; | ||
| 389 | if (i == ring_size - 1) | ||
| 390 | p->des01.tx.end_ring = 1; | ||
| 391 | p++; | ||
| 392 | } | ||
| 393 | return; | ||
| 394 | } | ||
| 395 | |||
| 396 | static int mac100_get_tx_owner(struct dma_desc *p) | ||
| 397 | { | ||
| 398 | return p->des01.tx.own; | ||
| 399 | } | ||
| 400 | |||
| 401 | static int mac100_get_rx_owner(struct dma_desc *p) | ||
| 402 | { | ||
| 403 | return p->des01.rx.own; | ||
| 404 | } | ||
| 405 | |||
| 406 | static void mac100_set_tx_owner(struct dma_desc *p) | ||
| 407 | { | ||
| 408 | p->des01.tx.own = 1; | ||
| 409 | } | ||
| 410 | |||
| 411 | static void mac100_set_rx_owner(struct dma_desc *p) | ||
| 412 | { | ||
| 413 | p->des01.rx.own = 1; | ||
| 414 | } | ||
| 415 | |||
| 416 | static int mac100_get_tx_ls(struct dma_desc *p) | ||
| 417 | { | ||
| 418 | return p->des01.tx.last_segment; | ||
| 419 | } | ||
| 420 | |||
| 421 | static void mac100_release_tx_desc(struct dma_desc *p) | ||
| 422 | { | ||
| 423 | int ter = p->des01.tx.end_ring; | ||
| 424 | |||
| 425 | /* clean field used within the xmit */ | ||
| 426 | p->des01.tx.first_segment = 0; | ||
| 427 | p->des01.tx.last_segment = 0; | ||
| 428 | p->des01.tx.buffer1_size = 0; | ||
| 429 | |||
| 430 | /* clean status reported */ | ||
| 431 | p->des01.tx.error_summary = 0; | ||
| 432 | p->des01.tx.underflow_error = 0; | ||
| 433 | p->des01.tx.no_carrier = 0; | ||
| 434 | p->des01.tx.loss_carrier = 0; | ||
| 435 | p->des01.tx.excessive_deferral = 0; | ||
| 436 | p->des01.tx.excessive_collisions = 0; | ||
| 437 | p->des01.tx.late_collision = 0; | ||
| 438 | p->des01.tx.heartbeat_fail = 0; | ||
| 439 | p->des01.tx.deferred = 0; | ||
| 440 | |||
| 441 | /* set termination field */ | ||
| 442 | p->des01.tx.end_ring = ter; | ||
| 443 | |||
| 444 | return; | ||
| 445 | } | ||
| 446 | |||
| 447 | static void mac100_prepare_tx_desc(struct dma_desc *p, int is_fs, int len, | ||
| 448 | int csum_flag) | ||
| 449 | { | ||
| 450 | p->des01.tx.first_segment = is_fs; | ||
| 451 | p->des01.tx.buffer1_size = len; | ||
| 452 | } | ||
| 453 | |||
| 454 | static void mac100_clear_tx_ic(struct dma_desc *p) | ||
| 455 | { | ||
| 456 | p->des01.tx.interrupt = 0; | ||
| 457 | } | ||
| 458 | |||
| 459 | static void mac100_close_tx_desc(struct dma_desc *p) | ||
| 460 | { | ||
| 461 | p->des01.tx.last_segment = 1; | ||
| 462 | p->des01.tx.interrupt = 1; | ||
| 463 | } | ||
| 464 | |||
| 465 | static int mac100_get_rx_frame_len(struct dma_desc *p) | ||
| 466 | { | ||
| 467 | return p->des01.rx.frame_length; | ||
| 468 | } | ||
| 469 | |||
| 470 | struct stmmac_ops mac100_driver = { | ||
| 471 | .core_init = mac100_core_init, | ||
| 472 | .dump_mac_regs = mac100_dump_mac_regs, | ||
| 473 | .dma_init = mac100_dma_init, | ||
| 474 | .dump_dma_regs = mac100_dump_dma_regs, | ||
| 475 | .dma_mode = mac100_dma_operation_mode, | ||
| 476 | .dma_diagnostic_fr = mac100_dma_diagnostic_fr, | ||
| 477 | .tx_status = mac100_get_tx_frame_status, | ||
| 478 | .rx_status = mac100_get_rx_frame_status, | ||
| 479 | .get_tx_len = mac100_get_tx_len, | ||
| 480 | .set_filter = mac100_set_filter, | ||
| 481 | .flow_ctrl = mac100_flow_ctrl, | ||
| 482 | .pmt = mac100_pmt, | ||
| 483 | .init_rx_desc = mac100_init_rx_desc, | ||
| 484 | .init_tx_desc = mac100_init_tx_desc, | ||
| 485 | .get_tx_owner = mac100_get_tx_owner, | ||
| 486 | .get_rx_owner = mac100_get_rx_owner, | ||
| 487 | .release_tx_desc = mac100_release_tx_desc, | ||
| 488 | .prepare_tx_desc = mac100_prepare_tx_desc, | ||
| 489 | .clear_tx_ic = mac100_clear_tx_ic, | ||
| 490 | .close_tx_desc = mac100_close_tx_desc, | ||
| 491 | .get_tx_ls = mac100_get_tx_ls, | ||
| 492 | .set_tx_owner = mac100_set_tx_owner, | ||
| 493 | .set_rx_owner = mac100_set_rx_owner, | ||
| 494 | .get_rx_frame_len = mac100_get_rx_frame_len, | ||
| 495 | .host_irq_status = mac100_irq_status, | ||
| 496 | .set_umac_addr = mac100_set_umac_addr, | ||
| 497 | .get_umac_addr = mac100_get_umac_addr, | ||
| 498 | }; | ||
| 499 | |||
| 500 | struct mac_device_info *mac100_setup(unsigned long ioaddr) | ||
| 501 | { | ||
| 502 | struct mac_device_info *mac; | ||
| 503 | |||
| 504 | mac = kzalloc(sizeof(const struct mac_device_info), GFP_KERNEL); | ||
| 505 | |||
| 506 | pr_info("\tMAC 10/100\n"); | ||
| 507 | |||
| 508 | mac->ops = &mac100_driver; | ||
| 509 | mac->hw.pmt = PMT_NOT_SUPPORTED; | ||
| 510 | mac->hw.link.port = MAC_CONTROL_PS; | ||
| 511 | mac->hw.link.duplex = MAC_CONTROL_F; | ||
| 512 | mac->hw.link.speed = 0; | ||
| 513 | mac->hw.mii.addr = MAC_MII_ADDR; | ||
| 514 | mac->hw.mii.data = MAC_MII_DATA; | ||
| 515 | |||
| 516 | return mac; | ||
| 517 | } | ||
diff --git a/drivers/net/stmmac/mac100.h b/drivers/net/stmmac/mac100.h new file mode 100644 index 000000000000..0f8f110d004a --- /dev/null +++ b/drivers/net/stmmac/mac100.h | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | MAC 10/100 Header File | ||
| 3 | |||
| 4 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 5 | |||
| 6 | This program is free software; you can redistribute it and/or modify it | ||
| 7 | under the terms and conditions of the GNU General Public License, | ||
| 8 | version 2, as published by the Free Software Foundation. | ||
| 9 | |||
| 10 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License along with | ||
| 16 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | |||
| 19 | The full GNU General Public License is included in this distribution in | ||
| 20 | the file called "COPYING". | ||
| 21 | |||
| 22 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 23 | *******************************************************************************/ | ||
| 24 | |||
| 25 | /*---------------------------------------------------------------------------- | ||
| 26 | * MAC BLOCK defines | ||
| 27 | *---------------------------------------------------------------------------*/ | ||
| 28 | /* MAC CSR offset */ | ||
| 29 | #define MAC_CONTROL 0x00000000 /* MAC Control */ | ||
| 30 | #define MAC_ADDR_HIGH 0x00000004 /* MAC Address High */ | ||
| 31 | #define MAC_ADDR_LOW 0x00000008 /* MAC Address Low */ | ||
| 32 | #define MAC_HASH_HIGH 0x0000000c /* Multicast Hash Table High */ | ||
| 33 | #define MAC_HASH_LOW 0x00000010 /* Multicast Hash Table Low */ | ||
| 34 | #define MAC_MII_ADDR 0x00000014 /* MII Address */ | ||
| 35 | #define MAC_MII_DATA 0x00000018 /* MII Data */ | ||
| 36 | #define MAC_FLOW_CTRL 0x0000001c /* Flow Control */ | ||
| 37 | #define MAC_VLAN1 0x00000020 /* VLAN1 Tag */ | ||
| 38 | #define MAC_VLAN2 0x00000024 /* VLAN2 Tag */ | ||
| 39 | |||
| 40 | /* MAC CTRL defines */ | ||
| 41 | #define MAC_CONTROL_RA 0x80000000 /* Receive All Mode */ | ||
| 42 | #define MAC_CONTROL_BLE 0x40000000 /* Endian Mode */ | ||
| 43 | #define MAC_CONTROL_HBD 0x10000000 /* Heartbeat Disable */ | ||
| 44 | #define MAC_CONTROL_PS 0x08000000 /* Port Select */ | ||
| 45 | #define MAC_CONTROL_DRO 0x00800000 /* Disable Receive Own */ | ||
| 46 | #define MAC_CONTROL_EXT_LOOPBACK 0x00400000 /* Reserved (ext loopback?) */ | ||
| 47 | #define MAC_CONTROL_OM 0x00200000 /* Loopback Operating Mode */ | ||
| 48 | #define MAC_CONTROL_F 0x00100000 /* Full Duplex Mode */ | ||
| 49 | #define MAC_CONTROL_PM 0x00080000 /* Pass All Multicast */ | ||
| 50 | #define MAC_CONTROL_PR 0x00040000 /* Promiscuous Mode */ | ||
| 51 | #define MAC_CONTROL_IF 0x00020000 /* Inverse Filtering */ | ||
| 52 | #define MAC_CONTROL_PB 0x00010000 /* Pass Bad Frames */ | ||
| 53 | #define MAC_CONTROL_HO 0x00008000 /* Hash Only Filtering Mode */ | ||
| 54 | #define MAC_CONTROL_HP 0x00002000 /* Hash/Perfect Filtering Mode */ | ||
| 55 | #define MAC_CONTROL_LCC 0x00001000 /* Late Collision Control */ | ||
| 56 | #define MAC_CONTROL_DBF 0x00000800 /* Disable Broadcast Frames */ | ||
| 57 | #define MAC_CONTROL_DRTY 0x00000400 /* Disable Retry */ | ||
| 58 | #define MAC_CONTROL_ASTP 0x00000100 /* Automatic Pad Stripping */ | ||
| 59 | #define MAC_CONTROL_BOLMT_10 0x00000000 /* Back Off Limit 10 */ | ||
| 60 | #define MAC_CONTROL_BOLMT_8 0x00000040 /* Back Off Limit 8 */ | ||
| 61 | #define MAC_CONTROL_BOLMT_4 0x00000080 /* Back Off Limit 4 */ | ||
| 62 | #define MAC_CONTROL_BOLMT_1 0x000000c0 /* Back Off Limit 1 */ | ||
| 63 | #define MAC_CONTROL_DC 0x00000020 /* Deferral Check */ | ||
| 64 | #define MAC_CONTROL_TE 0x00000008 /* Transmitter Enable */ | ||
| 65 | #define MAC_CONTROL_RE 0x00000004 /* Receiver Enable */ | ||
| 66 | |||
| 67 | #define MAC_CORE_INIT (MAC_CONTROL_HBD | MAC_CONTROL_ASTP) | ||
| 68 | |||
| 69 | /* MAC FLOW CTRL defines */ | ||
| 70 | #define MAC_FLOW_CTRL_PT_MASK 0xffff0000 /* Pause Time Mask */ | ||
| 71 | #define MAC_FLOW_CTRL_PT_SHIFT 16 | ||
| 72 | #define MAC_FLOW_CTRL_PASS 0x00000004 /* Pass Control Frames */ | ||
| 73 | #define MAC_FLOW_CTRL_ENABLE 0x00000002 /* Flow Control Enable */ | ||
| 74 | #define MAC_FLOW_CTRL_PAUSE 0x00000001 /* Flow Control Busy ... */ | ||
| 75 | |||
| 76 | /* MII ADDR defines */ | ||
| 77 | #define MAC_MII_ADDR_WRITE 0x00000002 /* MII Write */ | ||
| 78 | #define MAC_MII_ADDR_BUSY 0x00000001 /* MII Busy */ | ||
| 79 | |||
| 80 | /*---------------------------------------------------------------------------- | ||
| 81 | * DMA BLOCK defines | ||
| 82 | *---------------------------------------------------------------------------*/ | ||
| 83 | |||
| 84 | /* DMA Bus Mode register defines */ | ||
| 85 | #define DMA_BUS_MODE_DBO 0x00100000 /* Descriptor Byte Ordering */ | ||
| 86 | #define DMA_BUS_MODE_BLE 0x00000080 /* Big Endian/Little Endian */ | ||
| 87 | #define DMA_BUS_MODE_PBL_MASK 0x00003f00 /* Programmable Burst Len */ | ||
| 88 | #define DMA_BUS_MODE_PBL_SHIFT 8 | ||
| 89 | #define DMA_BUS_MODE_DSL_MASK 0x0000007c /* Descriptor Skip Length */ | ||
| 90 | #define DMA_BUS_MODE_DSL_SHIFT 2 /* (in DWORDS) */ | ||
| 91 | #define DMA_BUS_MODE_BAR_BUS 0x00000002 /* Bar-Bus Arbitration */ | ||
| 92 | #define DMA_BUS_MODE_SFT_RESET 0x00000001 /* Software Reset */ | ||
| 93 | #define DMA_BUS_MODE_DEFAULT 0x00000000 | ||
| 94 | |||
| 95 | /* DMA Control register defines */ | ||
| 96 | #define DMA_CONTROL_SF 0x00200000 /* Store And Forward */ | ||
| 97 | |||
| 98 | /* Transmit Threshold Control */ | ||
| 99 | enum ttc_control { | ||
| 100 | DMA_CONTROL_TTC_DEFAULT = 0x00000000, /* Threshold is 32 DWORDS */ | ||
| 101 | DMA_CONTROL_TTC_64 = 0x00004000, /* Threshold is 64 DWORDS */ | ||
| 102 | DMA_CONTROL_TTC_128 = 0x00008000, /* Threshold is 128 DWORDS */ | ||
| 103 | DMA_CONTROL_TTC_256 = 0x0000c000, /* Threshold is 256 DWORDS */ | ||
| 104 | DMA_CONTROL_TTC_18 = 0x00400000, /* Threshold is 18 DWORDS */ | ||
| 105 | DMA_CONTROL_TTC_24 = 0x00404000, /* Threshold is 24 DWORDS */ | ||
| 106 | DMA_CONTROL_TTC_32 = 0x00408000, /* Threshold is 32 DWORDS */ | ||
| 107 | DMA_CONTROL_TTC_40 = 0x0040c000, /* Threshold is 40 DWORDS */ | ||
| 108 | DMA_CONTROL_SE = 0x00000008, /* Stop On Empty */ | ||
| 109 | DMA_CONTROL_OSF = 0x00000004, /* Operate On 2nd Frame */ | ||
| 110 | }; | ||
| 111 | |||
| 112 | /* STMAC110 DMA Missed Frame Counter register defines */ | ||
| 113 | #define DMA_MISSED_FRAME_OVE 0x10000000 /* FIFO Overflow Overflow */ | ||
| 114 | #define DMA_MISSED_FRAME_OVE_CNTR 0x0ffe0000 /* Overflow Frame Counter */ | ||
| 115 | #define DMA_MISSED_FRAME_OVE_M 0x00010000 /* Missed Frame Overflow */ | ||
| 116 | #define DMA_MISSED_FRAME_M_CNTR 0x0000ffff /* Missed Frame Couinter */ | ||
diff --git a/drivers/net/stmmac/stmmac.h b/drivers/net/stmmac/stmmac.h new file mode 100644 index 000000000000..6d2eae3040e5 --- /dev/null +++ b/drivers/net/stmmac/stmmac.h | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify it | ||
| 5 | under the terms and conditions of the GNU General Public License, | ||
| 6 | version 2, as published by the Free Software Foundation. | ||
| 7 | |||
| 8 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 9 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 10 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 11 | more details. | ||
| 12 | |||
| 13 | You should have received a copy of the GNU General Public License along with | ||
| 14 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 15 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 16 | |||
| 17 | The full GNU General Public License is included in this distribution in | ||
| 18 | the file called "COPYING". | ||
| 19 | |||
| 20 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 21 | *******************************************************************************/ | ||
| 22 | |||
| 23 | #define DRV_MODULE_VERSION "Oct_09" | ||
| 24 | |||
| 25 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | ||
| 26 | #define STMMAC_VLAN_TAG_USED | ||
| 27 | #include <linux/if_vlan.h> | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #include "common.h" | ||
| 31 | #ifdef CONFIG_STMMAC_TIMER | ||
| 32 | #include "stmmac_timer.h" | ||
| 33 | #endif | ||
| 34 | |||
| 35 | struct stmmac_priv { | ||
| 36 | /* Frequently used values are kept adjacent for cache effect */ | ||
| 37 | struct dma_desc *dma_tx ____cacheline_aligned; | ||
| 38 | dma_addr_t dma_tx_phy; | ||
| 39 | struct sk_buff **tx_skbuff; | ||
| 40 | unsigned int cur_tx; | ||
| 41 | unsigned int dirty_tx; | ||
| 42 | unsigned int dma_tx_size; | ||
| 43 | int tx_coe; | ||
| 44 | int tx_coalesce; | ||
| 45 | |||
| 46 | struct dma_desc *dma_rx ; | ||
| 47 | unsigned int cur_rx; | ||
| 48 | unsigned int dirty_rx; | ||
| 49 | struct sk_buff **rx_skbuff; | ||
| 50 | dma_addr_t *rx_skbuff_dma; | ||
| 51 | struct sk_buff_head rx_recycle; | ||
| 52 | |||
| 53 | struct net_device *dev; | ||
| 54 | int is_gmac; | ||
| 55 | dma_addr_t dma_rx_phy; | ||
| 56 | unsigned int dma_rx_size; | ||
| 57 | int rx_csum; | ||
| 58 | unsigned int dma_buf_sz; | ||
| 59 | struct device *device; | ||
| 60 | struct mac_device_info *mac_type; | ||
| 61 | |||
| 62 | struct stmmac_extra_stats xstats; | ||
| 63 | struct napi_struct napi; | ||
| 64 | |||
| 65 | phy_interface_t phy_interface; | ||
| 66 | int pbl; | ||
| 67 | int bus_id; | ||
| 68 | int phy_addr; | ||
| 69 | int phy_mask; | ||
| 70 | int (*phy_reset) (void *priv); | ||
| 71 | void (*fix_mac_speed) (void *priv, unsigned int speed); | ||
| 72 | void *bsp_priv; | ||
| 73 | |||
| 74 | int phy_irq; | ||
| 75 | struct phy_device *phydev; | ||
| 76 | int oldlink; | ||
| 77 | int speed; | ||
| 78 | int oldduplex; | ||
| 79 | unsigned int flow_ctrl; | ||
| 80 | unsigned int pause; | ||
| 81 | struct mii_bus *mii; | ||
| 82 | |||
| 83 | u32 msg_enable; | ||
| 84 | spinlock_t lock; | ||
| 85 | int wolopts; | ||
| 86 | int wolenabled; | ||
| 87 | int shutdown; | ||
| 88 | #ifdef CONFIG_STMMAC_TIMER | ||
| 89 | struct stmmac_timer *tm; | ||
| 90 | #endif | ||
| 91 | #ifdef STMMAC_VLAN_TAG_USED | ||
| 92 | struct vlan_group *vlgrp; | ||
| 93 | #endif | ||
| 94 | }; | ||
| 95 | |||
| 96 | extern int stmmac_mdio_unregister(struct net_device *ndev); | ||
| 97 | extern int stmmac_mdio_register(struct net_device *ndev); | ||
| 98 | extern void stmmac_set_ethtool_ops(struct net_device *netdev); | ||
diff --git a/drivers/net/stmmac/stmmac_ethtool.c b/drivers/net/stmmac/stmmac_ethtool.c new file mode 100644 index 000000000000..694ebe6a0758 --- /dev/null +++ b/drivers/net/stmmac/stmmac_ethtool.c | |||
| @@ -0,0 +1,395 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | STMMAC Ethtool support | ||
| 3 | |||
| 4 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 5 | |||
| 6 | This program is free software; you can redistribute it and/or modify it | ||
| 7 | under the terms and conditions of the GNU General Public License, | ||
| 8 | version 2, as published by the Free Software Foundation. | ||
| 9 | |||
| 10 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License along with | ||
| 16 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | |||
| 19 | The full GNU General Public License is included in this distribution in | ||
| 20 | the file called "COPYING". | ||
| 21 | |||
| 22 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 23 | *******************************************************************************/ | ||
| 24 | |||
| 25 | #include <linux/etherdevice.h> | ||
| 26 | #include <linux/ethtool.h> | ||
| 27 | #include <linux/mii.h> | ||
| 28 | #include <linux/phy.h> | ||
| 29 | |||
| 30 | #include "stmmac.h" | ||
| 31 | |||
| 32 | #define REG_SPACE_SIZE 0x1054 | ||
| 33 | #define MAC100_ETHTOOL_NAME "st_mac100" | ||
| 34 | #define GMAC_ETHTOOL_NAME "st_gmac" | ||
| 35 | |||
| 36 | struct stmmac_stats { | ||
| 37 | char stat_string[ETH_GSTRING_LEN]; | ||
| 38 | int sizeof_stat; | ||
| 39 | int stat_offset; | ||
| 40 | }; | ||
| 41 | |||
| 42 | #define STMMAC_STAT(m) \ | ||
| 43 | { #m, FIELD_SIZEOF(struct stmmac_extra_stats, m), \ | ||
| 44 | offsetof(struct stmmac_priv, xstats.m)} | ||
| 45 | |||
| 46 | static const struct stmmac_stats stmmac_gstrings_stats[] = { | ||
| 47 | STMMAC_STAT(tx_underflow), | ||
| 48 | STMMAC_STAT(tx_carrier), | ||
| 49 | STMMAC_STAT(tx_losscarrier), | ||
| 50 | STMMAC_STAT(tx_heartbeat), | ||
| 51 | STMMAC_STAT(tx_deferred), | ||
| 52 | STMMAC_STAT(tx_vlan), | ||
| 53 | STMMAC_STAT(rx_vlan), | ||
| 54 | STMMAC_STAT(tx_jabber), | ||
| 55 | STMMAC_STAT(tx_frame_flushed), | ||
| 56 | STMMAC_STAT(tx_payload_error), | ||
| 57 | STMMAC_STAT(tx_ip_header_error), | ||
| 58 | STMMAC_STAT(rx_desc), | ||
| 59 | STMMAC_STAT(rx_partial), | ||
| 60 | STMMAC_STAT(rx_runt), | ||
| 61 | STMMAC_STAT(rx_toolong), | ||
| 62 | STMMAC_STAT(rx_collision), | ||
| 63 | STMMAC_STAT(rx_crc), | ||
| 64 | STMMAC_STAT(rx_lenght), | ||
| 65 | STMMAC_STAT(rx_mii), | ||
| 66 | STMMAC_STAT(rx_multicast), | ||
| 67 | STMMAC_STAT(rx_gmac_overflow), | ||
| 68 | STMMAC_STAT(rx_watchdog), | ||
| 69 | STMMAC_STAT(da_rx_filter_fail), | ||
| 70 | STMMAC_STAT(sa_rx_filter_fail), | ||
| 71 | STMMAC_STAT(rx_missed_cntr), | ||
| 72 | STMMAC_STAT(rx_overflow_cntr), | ||
| 73 | STMMAC_STAT(tx_undeflow_irq), | ||
| 74 | STMMAC_STAT(tx_process_stopped_irq), | ||
| 75 | STMMAC_STAT(tx_jabber_irq), | ||
| 76 | STMMAC_STAT(rx_overflow_irq), | ||
| 77 | STMMAC_STAT(rx_buf_unav_irq), | ||
| 78 | STMMAC_STAT(rx_process_stopped_irq), | ||
| 79 | STMMAC_STAT(rx_watchdog_irq), | ||
| 80 | STMMAC_STAT(tx_early_irq), | ||
| 81 | STMMAC_STAT(fatal_bus_error_irq), | ||
| 82 | STMMAC_STAT(threshold), | ||
| 83 | STMMAC_STAT(tx_pkt_n), | ||
| 84 | STMMAC_STAT(rx_pkt_n), | ||
| 85 | STMMAC_STAT(poll_n), | ||
| 86 | STMMAC_STAT(sched_timer_n), | ||
| 87 | STMMAC_STAT(normal_irq_n), | ||
| 88 | }; | ||
| 89 | #define STMMAC_STATS_LEN ARRAY_SIZE(stmmac_gstrings_stats) | ||
| 90 | |||
| 91 | void stmmac_ethtool_getdrvinfo(struct net_device *dev, | ||
| 92 | struct ethtool_drvinfo *info) | ||
| 93 | { | ||
| 94 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 95 | |||
| 96 | if (!priv->is_gmac) | ||
| 97 | strcpy(info->driver, MAC100_ETHTOOL_NAME); | ||
| 98 | else | ||
| 99 | strcpy(info->driver, GMAC_ETHTOOL_NAME); | ||
| 100 | |||
| 101 | strcpy(info->version, DRV_MODULE_VERSION); | ||
| 102 | info->fw_version[0] = '\0'; | ||
| 103 | info->n_stats = STMMAC_STATS_LEN; | ||
| 104 | return; | ||
| 105 | } | ||
| 106 | |||
| 107 | int stmmac_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
| 108 | { | ||
| 109 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 110 | struct phy_device *phy = priv->phydev; | ||
| 111 | int rc; | ||
| 112 | if (phy == NULL) { | ||
| 113 | pr_err("%s: %s: PHY is not registered\n", | ||
| 114 | __func__, dev->name); | ||
| 115 | return -ENODEV; | ||
| 116 | } | ||
| 117 | if (!netif_running(dev)) { | ||
| 118 | pr_err("%s: interface is disabled: we cannot track " | ||
| 119 | "link speed / duplex setting\n", dev->name); | ||
| 120 | return -EBUSY; | ||
| 121 | } | ||
| 122 | cmd->transceiver = XCVR_INTERNAL; | ||
| 123 | spin_lock_irq(&priv->lock); | ||
| 124 | rc = phy_ethtool_gset(phy, cmd); | ||
| 125 | spin_unlock_irq(&priv->lock); | ||
| 126 | return rc; | ||
| 127 | } | ||
| 128 | |||
| 129 | int stmmac_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
| 130 | { | ||
| 131 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 132 | struct phy_device *phy = priv->phydev; | ||
| 133 | int rc; | ||
| 134 | |||
| 135 | spin_lock(&priv->lock); | ||
| 136 | rc = phy_ethtool_sset(phy, cmd); | ||
| 137 | spin_unlock(&priv->lock); | ||
| 138 | |||
| 139 | return rc; | ||
| 140 | } | ||
| 141 | |||
| 142 | u32 stmmac_ethtool_getmsglevel(struct net_device *dev) | ||
| 143 | { | ||
| 144 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 145 | return priv->msg_enable; | ||
| 146 | } | ||
| 147 | |||
| 148 | void stmmac_ethtool_setmsglevel(struct net_device *dev, u32 level) | ||
| 149 | { | ||
| 150 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 151 | priv->msg_enable = level; | ||
| 152 | |||
| 153 | } | ||
| 154 | |||
| 155 | int stmmac_check_if_running(struct net_device *dev) | ||
| 156 | { | ||
| 157 | if (!netif_running(dev)) | ||
| 158 | return -EBUSY; | ||
| 159 | return 0; | ||
| 160 | } | ||
| 161 | |||
| 162 | int stmmac_ethtool_get_regs_len(struct net_device *dev) | ||
| 163 | { | ||
| 164 | return REG_SPACE_SIZE; | ||
| 165 | } | ||
| 166 | |||
| 167 | void stmmac_ethtool_gregs(struct net_device *dev, | ||
| 168 | struct ethtool_regs *regs, void *space) | ||
| 169 | { | ||
| 170 | int i; | ||
| 171 | u32 *reg_space = (u32 *) space; | ||
| 172 | |||
| 173 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 174 | |||
| 175 | memset(reg_space, 0x0, REG_SPACE_SIZE); | ||
| 176 | |||
| 177 | if (!priv->is_gmac) { | ||
| 178 | /* MAC registers */ | ||
| 179 | for (i = 0; i < 12; i++) | ||
| 180 | reg_space[i] = readl(dev->base_addr + (i * 4)); | ||
| 181 | /* DMA registers */ | ||
| 182 | for (i = 0; i < 9; i++) | ||
| 183 | reg_space[i + 12] = | ||
| 184 | readl(dev->base_addr + (DMA_BUS_MODE + (i * 4))); | ||
| 185 | reg_space[22] = readl(dev->base_addr + DMA_CUR_TX_BUF_ADDR); | ||
| 186 | reg_space[23] = readl(dev->base_addr + DMA_CUR_RX_BUF_ADDR); | ||
| 187 | } else { | ||
| 188 | /* MAC registers */ | ||
| 189 | for (i = 0; i < 55; i++) | ||
| 190 | reg_space[i] = readl(dev->base_addr + (i * 4)); | ||
| 191 | /* DMA registers */ | ||
| 192 | for (i = 0; i < 22; i++) | ||
| 193 | reg_space[i + 55] = | ||
| 194 | readl(dev->base_addr + (DMA_BUS_MODE + (i * 4))); | ||
| 195 | } | ||
| 196 | |||
| 197 | return; | ||
| 198 | } | ||
| 199 | |||
| 200 | int stmmac_ethtool_set_tx_csum(struct net_device *netdev, u32 data) | ||
| 201 | { | ||
| 202 | if (data) | ||
| 203 | netdev->features |= NETIF_F_HW_CSUM; | ||
| 204 | else | ||
| 205 | netdev->features &= ~NETIF_F_HW_CSUM; | ||
| 206 | |||
| 207 | return 0; | ||
| 208 | } | ||
| 209 | |||
| 210 | u32 stmmac_ethtool_get_rx_csum(struct net_device *dev) | ||
| 211 | { | ||
| 212 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 213 | |||
| 214 | return priv->rx_csum; | ||
| 215 | } | ||
| 216 | |||
| 217 | static void | ||
| 218 | stmmac_get_pauseparam(struct net_device *netdev, | ||
| 219 | struct ethtool_pauseparam *pause) | ||
| 220 | { | ||
| 221 | struct stmmac_priv *priv = netdev_priv(netdev); | ||
| 222 | |||
| 223 | spin_lock(&priv->lock); | ||
| 224 | |||
| 225 | pause->rx_pause = 0; | ||
| 226 | pause->tx_pause = 0; | ||
| 227 | pause->autoneg = priv->phydev->autoneg; | ||
| 228 | |||
| 229 | if (priv->flow_ctrl & FLOW_RX) | ||
| 230 | pause->rx_pause = 1; | ||
| 231 | if (priv->flow_ctrl & FLOW_TX) | ||
| 232 | pause->tx_pause = 1; | ||
| 233 | |||
| 234 | spin_unlock(&priv->lock); | ||
| 235 | return; | ||
| 236 | } | ||
| 237 | |||
| 238 | static int | ||
| 239 | stmmac_set_pauseparam(struct net_device *netdev, | ||
| 240 | struct ethtool_pauseparam *pause) | ||
| 241 | { | ||
| 242 | struct stmmac_priv *priv = netdev_priv(netdev); | ||
| 243 | struct phy_device *phy = priv->phydev; | ||
| 244 | int new_pause = FLOW_OFF; | ||
| 245 | int ret = 0; | ||
| 246 | |||
| 247 | spin_lock(&priv->lock); | ||
| 248 | |||
| 249 | if (pause->rx_pause) | ||
| 250 | new_pause |= FLOW_RX; | ||
| 251 | if (pause->tx_pause) | ||
| 252 | new_pause |= FLOW_TX; | ||
| 253 | |||
| 254 | priv->flow_ctrl = new_pause; | ||
| 255 | |||
| 256 | if (phy->autoneg) { | ||
| 257 | if (netif_running(netdev)) { | ||
| 258 | struct ethtool_cmd cmd; | ||
| 259 | /* auto-negotiation automatically restarted */ | ||
| 260 | cmd.cmd = ETHTOOL_NWAY_RST; | ||
| 261 | cmd.supported = phy->supported; | ||
| 262 | cmd.advertising = phy->advertising; | ||
| 263 | cmd.autoneg = phy->autoneg; | ||
| 264 | cmd.speed = phy->speed; | ||
| 265 | cmd.duplex = phy->duplex; | ||
| 266 | cmd.phy_address = phy->addr; | ||
| 267 | ret = phy_ethtool_sset(phy, &cmd); | ||
| 268 | } | ||
| 269 | } else { | ||
| 270 | unsigned long ioaddr = netdev->base_addr; | ||
| 271 | priv->mac_type->ops->flow_ctrl(ioaddr, phy->duplex, | ||
| 272 | priv->flow_ctrl, priv->pause); | ||
| 273 | } | ||
| 274 | spin_unlock(&priv->lock); | ||
| 275 | return ret; | ||
| 276 | } | ||
| 277 | |||
| 278 | static void stmmac_get_ethtool_stats(struct net_device *dev, | ||
| 279 | struct ethtool_stats *dummy, u64 *data) | ||
| 280 | { | ||
| 281 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 282 | unsigned long ioaddr = dev->base_addr; | ||
| 283 | int i; | ||
| 284 | |||
| 285 | /* Update HW stats if supported */ | ||
| 286 | priv->mac_type->ops->dma_diagnostic_fr(&dev->stats, &priv->xstats, | ||
| 287 | ioaddr); | ||
| 288 | |||
| 289 | for (i = 0; i < STMMAC_STATS_LEN; i++) { | ||
| 290 | char *p = (char *)priv + stmmac_gstrings_stats[i].stat_offset; | ||
| 291 | data[i] = (stmmac_gstrings_stats[i].sizeof_stat == | ||
| 292 | sizeof(u64)) ? (*(u64 *)p) : (*(u32 *)p); | ||
| 293 | } | ||
| 294 | |||
| 295 | return; | ||
| 296 | } | ||
| 297 | |||
| 298 | static int stmmac_get_sset_count(struct net_device *netdev, int sset) | ||
| 299 | { | ||
| 300 | switch (sset) { | ||
| 301 | case ETH_SS_STATS: | ||
| 302 | return STMMAC_STATS_LEN; | ||
| 303 | default: | ||
| 304 | return -EOPNOTSUPP; | ||
| 305 | } | ||
| 306 | } | ||
| 307 | |||
| 308 | static void stmmac_get_strings(struct net_device *dev, u32 stringset, u8 *data) | ||
| 309 | { | ||
| 310 | int i; | ||
| 311 | u8 *p = data; | ||
| 312 | |||
| 313 | switch (stringset) { | ||
| 314 | case ETH_SS_STATS: | ||
| 315 | for (i = 0; i < STMMAC_STATS_LEN; i++) { | ||
| 316 | memcpy(p, stmmac_gstrings_stats[i].stat_string, | ||
| 317 | ETH_GSTRING_LEN); | ||
| 318 | p += ETH_GSTRING_LEN; | ||
| 319 | } | ||
| 320 | break; | ||
| 321 | default: | ||
| 322 | WARN_ON(1); | ||
| 323 | break; | ||
| 324 | } | ||
| 325 | return; | ||
| 326 | } | ||
| 327 | |||
| 328 | /* Currently only support WOL through Magic packet. */ | ||
| 329 | static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
| 330 | { | ||
| 331 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 332 | |||
| 333 | spin_lock_irq(&priv->lock); | ||
| 334 | if (priv->wolenabled == PMT_SUPPORTED) { | ||
| 335 | wol->supported = WAKE_MAGIC; | ||
| 336 | wol->wolopts = priv->wolopts; | ||
| 337 | } | ||
| 338 | spin_unlock_irq(&priv->lock); | ||
| 339 | } | ||
| 340 | |||
| 341 | static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
| 342 | { | ||
| 343 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 344 | u32 support = WAKE_MAGIC; | ||
| 345 | |||
| 346 | if (priv->wolenabled == PMT_NOT_SUPPORTED) | ||
| 347 | return -EINVAL; | ||
| 348 | |||
| 349 | if (wol->wolopts & ~support) | ||
| 350 | return -EINVAL; | ||
| 351 | |||
| 352 | if (wol->wolopts == 0) | ||
| 353 | device_set_wakeup_enable(priv->device, 0); | ||
| 354 | else | ||
| 355 | device_set_wakeup_enable(priv->device, 1); | ||
| 356 | |||
| 357 | spin_lock_irq(&priv->lock); | ||
| 358 | priv->wolopts = wol->wolopts; | ||
| 359 | spin_unlock_irq(&priv->lock); | ||
| 360 | |||
| 361 | return 0; | ||
| 362 | } | ||
| 363 | |||
| 364 | static struct ethtool_ops stmmac_ethtool_ops = { | ||
| 365 | .begin = stmmac_check_if_running, | ||
| 366 | .get_drvinfo = stmmac_ethtool_getdrvinfo, | ||
| 367 | .get_settings = stmmac_ethtool_getsettings, | ||
| 368 | .set_settings = stmmac_ethtool_setsettings, | ||
| 369 | .get_msglevel = stmmac_ethtool_getmsglevel, | ||
| 370 | .set_msglevel = stmmac_ethtool_setmsglevel, | ||
| 371 | .get_regs = stmmac_ethtool_gregs, | ||
| 372 | .get_regs_len = stmmac_ethtool_get_regs_len, | ||
| 373 | .get_link = ethtool_op_get_link, | ||
| 374 | .get_rx_csum = stmmac_ethtool_get_rx_csum, | ||
| 375 | .get_tx_csum = ethtool_op_get_tx_csum, | ||
| 376 | .set_tx_csum = stmmac_ethtool_set_tx_csum, | ||
| 377 | .get_sg = ethtool_op_get_sg, | ||
| 378 | .set_sg = ethtool_op_set_sg, | ||
| 379 | .get_pauseparam = stmmac_get_pauseparam, | ||
| 380 | .set_pauseparam = stmmac_set_pauseparam, | ||
| 381 | .get_ethtool_stats = stmmac_get_ethtool_stats, | ||
| 382 | .get_strings = stmmac_get_strings, | ||
| 383 | .get_wol = stmmac_get_wol, | ||
| 384 | .set_wol = stmmac_set_wol, | ||
| 385 | .get_sset_count = stmmac_get_sset_count, | ||
| 386 | #ifdef NETIF_F_TSO | ||
| 387 | .get_tso = ethtool_op_get_tso, | ||
| 388 | .set_tso = ethtool_op_set_tso, | ||
| 389 | #endif | ||
| 390 | }; | ||
| 391 | |||
| 392 | void stmmac_set_ethtool_ops(struct net_device *netdev) | ||
| 393 | { | ||
| 394 | SET_ETHTOOL_OPS(netdev, &stmmac_ethtool_ops); | ||
| 395 | } | ||
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c new file mode 100644 index 000000000000..c2f14dc9ba28 --- /dev/null +++ b/drivers/net/stmmac/stmmac_main.c | |||
| @@ -0,0 +1,2204 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | This is the driver for the ST MAC 10/100/1000 on-chip Ethernet controllers. | ||
| 3 | ST Ethernet IPs are built around a Synopsys IP Core. | ||
| 4 | |||
| 5 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 6 | |||
| 7 | This program is free software; you can redistribute it and/or modify it | ||
| 8 | under the terms and conditions of the GNU General Public License, | ||
| 9 | version 2, as published by the Free Software Foundation. | ||
| 10 | |||
| 11 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 14 | more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License along with | ||
| 17 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 18 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | |||
| 20 | The full GNU General Public License is included in this distribution in | ||
| 21 | the file called "COPYING". | ||
| 22 | |||
| 23 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 24 | |||
| 25 | Documentation available at: | ||
| 26 | http://www.stlinux.com | ||
| 27 | Support available at: | ||
| 28 | https://bugzilla.stlinux.com/ | ||
| 29 | *******************************************************************************/ | ||
| 30 | |||
| 31 | #include <linux/module.h> | ||
| 32 | #include <linux/init.h> | ||
| 33 | #include <linux/kernel.h> | ||
| 34 | #include <linux/interrupt.h> | ||
| 35 | #include <linux/netdevice.h> | ||
| 36 | #include <linux/etherdevice.h> | ||
| 37 | #include <linux/platform_device.h> | ||
| 38 | #include <linux/ip.h> | ||
| 39 | #include <linux/tcp.h> | ||
| 40 | #include <linux/skbuff.h> | ||
| 41 | #include <linux/ethtool.h> | ||
| 42 | #include <linux/if_ether.h> | ||
| 43 | #include <linux/crc32.h> | ||
| 44 | #include <linux/mii.h> | ||
| 45 | #include <linux/phy.h> | ||
| 46 | #include <linux/if_vlan.h> | ||
| 47 | #include <linux/dma-mapping.h> | ||
| 48 | #include <linux/stm/soc.h> | ||
| 49 | #include "stmmac.h" | ||
| 50 | |||
| 51 | #define STMMAC_RESOURCE_NAME "stmmaceth" | ||
| 52 | #define PHY_RESOURCE_NAME "stmmacphy" | ||
| 53 | |||
| 54 | #undef STMMAC_DEBUG | ||
| 55 | /*#define STMMAC_DEBUG*/ | ||
| 56 | #ifdef STMMAC_DEBUG | ||
| 57 | #define DBG(nlevel, klevel, fmt, args...) \ | ||
| 58 | ((void)(netif_msg_##nlevel(priv) && \ | ||
| 59 | printk(KERN_##klevel fmt, ## args))) | ||
| 60 | #else | ||
| 61 | #define DBG(nlevel, klevel, fmt, args...) do { } while (0) | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #undef STMMAC_RX_DEBUG | ||
| 65 | /*#define STMMAC_RX_DEBUG*/ | ||
| 66 | #ifdef STMMAC_RX_DEBUG | ||
| 67 | #define RX_DBG(fmt, args...) printk(fmt, ## args) | ||
| 68 | #else | ||
| 69 | #define RX_DBG(fmt, args...) do { } while (0) | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #undef STMMAC_XMIT_DEBUG | ||
| 73 | /*#define STMMAC_XMIT_DEBUG*/ | ||
| 74 | #ifdef STMMAC_TX_DEBUG | ||
| 75 | #define TX_DBG(fmt, args...) printk(fmt, ## args) | ||
| 76 | #else | ||
| 77 | #define TX_DBG(fmt, args...) do { } while (0) | ||
| 78 | #endif | ||
| 79 | |||
| 80 | #define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x) | ||
| 81 | #define JUMBO_LEN 9000 | ||
| 82 | |||
| 83 | /* Module parameters */ | ||
| 84 | #define TX_TIMEO 5000 /* default 5 seconds */ | ||
| 85 | static int watchdog = TX_TIMEO; | ||
| 86 | module_param(watchdog, int, S_IRUGO | S_IWUSR); | ||
| 87 | MODULE_PARM_DESC(watchdog, "Transmit timeout in milliseconds"); | ||
| 88 | |||
| 89 | static int debug = -1; /* -1: default, 0: no output, 16: all */ | ||
| 90 | module_param(debug, int, S_IRUGO | S_IWUSR); | ||
| 91 | MODULE_PARM_DESC(debug, "Message Level (0: no output, 16: all)"); | ||
| 92 | |||
| 93 | static int phyaddr = -1; | ||
| 94 | module_param(phyaddr, int, S_IRUGO); | ||
| 95 | MODULE_PARM_DESC(phyaddr, "Physical device address"); | ||
| 96 | |||
| 97 | #define DMA_TX_SIZE 256 | ||
| 98 | static int dma_txsize = DMA_TX_SIZE; | ||
| 99 | module_param(dma_txsize, int, S_IRUGO | S_IWUSR); | ||
| 100 | MODULE_PARM_DESC(dma_txsize, "Number of descriptors in the TX list"); | ||
| 101 | |||
| 102 | #define DMA_RX_SIZE 256 | ||
| 103 | static int dma_rxsize = DMA_RX_SIZE; | ||
| 104 | module_param(dma_rxsize, int, S_IRUGO | S_IWUSR); | ||
| 105 | MODULE_PARM_DESC(dma_rxsize, "Number of descriptors in the RX list"); | ||
| 106 | |||
| 107 | static int flow_ctrl = FLOW_OFF; | ||
| 108 | module_param(flow_ctrl, int, S_IRUGO | S_IWUSR); | ||
| 109 | MODULE_PARM_DESC(flow_ctrl, "Flow control ability [on/off]"); | ||
| 110 | |||
| 111 | static int pause = PAUSE_TIME; | ||
| 112 | module_param(pause, int, S_IRUGO | S_IWUSR); | ||
| 113 | MODULE_PARM_DESC(pause, "Flow Control Pause Time"); | ||
| 114 | |||
| 115 | #define TC_DEFAULT 64 | ||
| 116 | static int tc = TC_DEFAULT; | ||
| 117 | module_param(tc, int, S_IRUGO | S_IWUSR); | ||
| 118 | MODULE_PARM_DESC(tc, "DMA threshold control value"); | ||
| 119 | |||
| 120 | #define RX_NO_COALESCE 1 /* Always interrupt on completion */ | ||
| 121 | #define TX_NO_COALESCE -1 /* No moderation by default */ | ||
| 122 | |||
| 123 | /* Pay attention to tune this parameter; take care of both | ||
| 124 | * hardware capability and network stabitily/performance impact. | ||
| 125 | * Many tests showed that ~4ms latency seems to be good enough. */ | ||
| 126 | #ifdef CONFIG_STMMAC_TIMER | ||
| 127 | #define DEFAULT_PERIODIC_RATE 256 | ||
| 128 | static int tmrate = DEFAULT_PERIODIC_RATE; | ||
| 129 | module_param(tmrate, int, S_IRUGO | S_IWUSR); | ||
| 130 | MODULE_PARM_DESC(tmrate, "External timer freq. (default: 256Hz)"); | ||
| 131 | #endif | ||
| 132 | |||
| 133 | #define DMA_BUFFER_SIZE BUF_SIZE_2KiB | ||
| 134 | static int buf_sz = DMA_BUFFER_SIZE; | ||
| 135 | module_param(buf_sz, int, S_IRUGO | S_IWUSR); | ||
| 136 | MODULE_PARM_DESC(buf_sz, "DMA buffer size"); | ||
| 137 | |||
| 138 | /* In case of Giga ETH, we can enable/disable the COE for the | ||
| 139 | * transmit HW checksum computation. | ||
| 140 | * Note that, if tx csum is off in HW, SG will be still supported. */ | ||
| 141 | static int tx_coe = HW_CSUM; | ||
| 142 | module_param(tx_coe, int, S_IRUGO | S_IWUSR); | ||
| 143 | MODULE_PARM_DESC(tx_coe, "GMAC COE type 2 [on/off]"); | ||
| 144 | |||
| 145 | static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE | | ||
| 146 | NETIF_MSG_LINK | NETIF_MSG_IFUP | | ||
| 147 | NETIF_MSG_IFDOWN | NETIF_MSG_TIMER); | ||
| 148 | |||
| 149 | static irqreturn_t stmmac_interrupt(int irq, void *dev_id); | ||
| 150 | static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev); | ||
| 151 | |||
| 152 | /** | ||
| 153 | * stmmac_verify_args - verify the driver parameters. | ||
| 154 | * Description: it verifies if some wrong parameter is passed to the driver. | ||
| 155 | * Note that wrong parameters are replaced with the default values. | ||
| 156 | */ | ||
| 157 | static void stmmac_verify_args(void) | ||
| 158 | { | ||
| 159 | if (unlikely(watchdog < 0)) | ||
| 160 | watchdog = TX_TIMEO; | ||
| 161 | if (unlikely(dma_rxsize < 0)) | ||
| 162 | dma_rxsize = DMA_RX_SIZE; | ||
| 163 | if (unlikely(dma_txsize < 0)) | ||
| 164 | dma_txsize = DMA_TX_SIZE; | ||
| 165 | if (unlikely((buf_sz < DMA_BUFFER_SIZE) || (buf_sz > BUF_SIZE_16KiB))) | ||
| 166 | buf_sz = DMA_BUFFER_SIZE; | ||
| 167 | if (unlikely(flow_ctrl > 1)) | ||
| 168 | flow_ctrl = FLOW_AUTO; | ||
| 169 | else if (likely(flow_ctrl < 0)) | ||
| 170 | flow_ctrl = FLOW_OFF; | ||
| 171 | if (unlikely((pause < 0) || (pause > 0xffff))) | ||
| 172 | pause = PAUSE_TIME; | ||
| 173 | |||
| 174 | return; | ||
| 175 | } | ||
| 176 | |||
| 177 | #if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG) | ||
| 178 | static void print_pkt(unsigned char *buf, int len) | ||
| 179 | { | ||
| 180 | int j; | ||
| 181 | pr_info("len = %d byte, buf addr: 0x%p", len, buf); | ||
| 182 | for (j = 0; j < len; j++) { | ||
| 183 | if ((j % 16) == 0) | ||
| 184 | pr_info("\n %03x:", j); | ||
| 185 | pr_info(" %02x", buf[j]); | ||
| 186 | } | ||
| 187 | pr_info("\n"); | ||
| 188 | return; | ||
| 189 | } | ||
| 190 | #endif | ||
| 191 | |||
| 192 | /* minimum number of free TX descriptors required to wake up TX process */ | ||
| 193 | #define STMMAC_TX_THRESH(x) (x->dma_tx_size/4) | ||
| 194 | |||
| 195 | static inline u32 stmmac_tx_avail(struct stmmac_priv *priv) | ||
| 196 | { | ||
| 197 | return priv->dirty_tx + priv->dma_tx_size - priv->cur_tx - 1; | ||
| 198 | } | ||
| 199 | |||
| 200 | /** | ||
| 201 | * stmmac_adjust_link | ||
| 202 | * @dev: net device structure | ||
| 203 | * Description: it adjusts the link parameters. | ||
| 204 | */ | ||
| 205 | static void stmmac_adjust_link(struct net_device *dev) | ||
| 206 | { | ||
| 207 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 208 | struct phy_device *phydev = priv->phydev; | ||
| 209 | unsigned long ioaddr = dev->base_addr; | ||
| 210 | unsigned long flags; | ||
| 211 | int new_state = 0; | ||
| 212 | unsigned int fc = priv->flow_ctrl, pause_time = priv->pause; | ||
| 213 | |||
| 214 | if (phydev == NULL) | ||
| 215 | return; | ||
| 216 | |||
| 217 | DBG(probe, DEBUG, "stmmac_adjust_link: called. address %d link %d\n", | ||
| 218 | phydev->addr, phydev->link); | ||
| 219 | |||
| 220 | spin_lock_irqsave(&priv->lock, flags); | ||
| 221 | if (phydev->link) { | ||
| 222 | u32 ctrl = readl(ioaddr + MAC_CTRL_REG); | ||
| 223 | |||
| 224 | /* Now we make sure that we can be in full duplex mode. | ||
| 225 | * If not, we operate in half-duplex mode. */ | ||
| 226 | if (phydev->duplex != priv->oldduplex) { | ||
| 227 | new_state = 1; | ||
| 228 | if (!(phydev->duplex)) | ||
| 229 | ctrl &= ~priv->mac_type->hw.link.duplex; | ||
| 230 | else | ||
| 231 | ctrl |= priv->mac_type->hw.link.duplex; | ||
| 232 | priv->oldduplex = phydev->duplex; | ||
| 233 | } | ||
| 234 | /* Flow Control operation */ | ||
| 235 | if (phydev->pause) | ||
| 236 | priv->mac_type->ops->flow_ctrl(ioaddr, phydev->duplex, | ||
| 237 | fc, pause_time); | ||
| 238 | |||
| 239 | if (phydev->speed != priv->speed) { | ||
| 240 | new_state = 1; | ||
| 241 | switch (phydev->speed) { | ||
| 242 | case 1000: | ||
| 243 | if (likely(priv->is_gmac)) | ||
| 244 | ctrl &= ~priv->mac_type->hw.link.port; | ||
| 245 | break; | ||
| 246 | case 100: | ||
| 247 | case 10: | ||
| 248 | if (priv->is_gmac) { | ||
| 249 | ctrl |= priv->mac_type->hw.link.port; | ||
| 250 | if (phydev->speed == SPEED_100) { | ||
| 251 | ctrl |= | ||
| 252 | priv->mac_type->hw.link. | ||
| 253 | speed; | ||
| 254 | } else { | ||
| 255 | ctrl &= | ||
| 256 | ~(priv->mac_type->hw. | ||
| 257 | link.speed); | ||
| 258 | } | ||
| 259 | } else { | ||
| 260 | ctrl &= ~priv->mac_type->hw.link.port; | ||
| 261 | } | ||
| 262 | priv->fix_mac_speed(priv->bsp_priv, | ||
| 263 | phydev->speed); | ||
| 264 | break; | ||
| 265 | default: | ||
| 266 | if (netif_msg_link(priv)) | ||
| 267 | pr_warning("%s: Speed (%d) is not 10" | ||
| 268 | " or 100!\n", dev->name, phydev->speed); | ||
| 269 | break; | ||
| 270 | } | ||
| 271 | |||
| 272 | priv->speed = phydev->speed; | ||
| 273 | } | ||
| 274 | |||
| 275 | writel(ctrl, ioaddr + MAC_CTRL_REG); | ||
| 276 | |||
| 277 | if (!priv->oldlink) { | ||
| 278 | new_state = 1; | ||
| 279 | priv->oldlink = 1; | ||
| 280 | } | ||
| 281 | } else if (priv->oldlink) { | ||
| 282 | new_state = 1; | ||
| 283 | priv->oldlink = 0; | ||
| 284 | priv->speed = 0; | ||
| 285 | priv->oldduplex = -1; | ||
| 286 | } | ||
| 287 | |||
| 288 | if (new_state && netif_msg_link(priv)) | ||
| 289 | phy_print_status(phydev); | ||
| 290 | |||
| 291 | spin_unlock_irqrestore(&priv->lock, flags); | ||
| 292 | |||
| 293 | DBG(probe, DEBUG, "stmmac_adjust_link: exiting\n"); | ||
| 294 | } | ||
| 295 | |||
| 296 | /** | ||
| 297 | * stmmac_init_phy - PHY initialization | ||
| 298 | * @dev: net device structure | ||
| 299 | * Description: it initializes the driver's PHY state, and attaches the PHY | ||
| 300 | * to the mac driver. | ||
| 301 | * Return value: | ||
| 302 | * 0 on success | ||
| 303 | */ | ||
| 304 | static int stmmac_init_phy(struct net_device *dev) | ||
| 305 | { | ||
| 306 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 307 | struct phy_device *phydev; | ||
| 308 | char phy_id[BUS_ID_SIZE]; /* PHY to connect */ | ||
| 309 | char bus_id[BUS_ID_SIZE]; | ||
| 310 | |||
| 311 | priv->oldlink = 0; | ||
| 312 | priv->speed = 0; | ||
| 313 | priv->oldduplex = -1; | ||
| 314 | |||
| 315 | if (priv->phy_addr == -1) { | ||
| 316 | /* We don't have a PHY, so do nothing */ | ||
| 317 | return 0; | ||
| 318 | } | ||
| 319 | |||
| 320 | snprintf(bus_id, MII_BUS_ID_SIZE, "%x", priv->bus_id); | ||
| 321 | snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, bus_id, priv->phy_addr); | ||
| 322 | pr_debug("stmmac_init_phy: trying to attach to %s\n", phy_id); | ||
| 323 | |||
| 324 | phydev = phy_connect(dev, phy_id, &stmmac_adjust_link, 0, | ||
| 325 | priv->phy_interface); | ||
| 326 | |||
| 327 | if (IS_ERR(phydev)) { | ||
| 328 | pr_err("%s: Could not attach to PHY\n", dev->name); | ||
| 329 | return PTR_ERR(phydev); | ||
| 330 | } | ||
| 331 | |||
| 332 | /* | ||
| 333 | * Broken HW is sometimes missing the pull-up resistor on the | ||
| 334 | * MDIO line, which results in reads to non-existent devices returning | ||
| 335 | * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent | ||
| 336 | * device as well. | ||
| 337 | * Note: phydev->phy_id is the result of reading the UID PHY registers. | ||
| 338 | */ | ||
| 339 | if (phydev->phy_id == 0) { | ||
| 340 | phy_disconnect(phydev); | ||
| 341 | return -ENODEV; | ||
| 342 | } | ||
| 343 | pr_debug("stmmac_init_phy: %s: attached to PHY (UID 0x%x)" | ||
| 344 | " Link = %d\n", dev->name, phydev->phy_id, phydev->link); | ||
| 345 | |||
| 346 | priv->phydev = phydev; | ||
| 347 | |||
| 348 | return 0; | ||
| 349 | } | ||
| 350 | |||
| 351 | static inline void stmmac_mac_enable_rx(unsigned long ioaddr) | ||
| 352 | { | ||
| 353 | u32 value = readl(ioaddr + MAC_CTRL_REG); | ||
| 354 | value |= MAC_RNABLE_RX; | ||
| 355 | /* Set the RE (receive enable bit into the MAC CTRL register). */ | ||
| 356 | writel(value, ioaddr + MAC_CTRL_REG); | ||
| 357 | } | ||
| 358 | |||
| 359 | static inline void stmmac_mac_enable_tx(unsigned long ioaddr) | ||
| 360 | { | ||
| 361 | u32 value = readl(ioaddr + MAC_CTRL_REG); | ||
| 362 | value |= MAC_ENABLE_TX; | ||
| 363 | /* Set the TE (transmit enable bit into the MAC CTRL register). */ | ||
| 364 | writel(value, ioaddr + MAC_CTRL_REG); | ||
| 365 | } | ||
| 366 | |||
| 367 | static inline void stmmac_mac_disable_rx(unsigned long ioaddr) | ||
| 368 | { | ||
| 369 | u32 value = readl(ioaddr + MAC_CTRL_REG); | ||
| 370 | value &= ~MAC_RNABLE_RX; | ||
| 371 | writel(value, ioaddr + MAC_CTRL_REG); | ||
| 372 | } | ||
| 373 | |||
| 374 | static inline void stmmac_mac_disable_tx(unsigned long ioaddr) | ||
| 375 | { | ||
| 376 | u32 value = readl(ioaddr + MAC_CTRL_REG); | ||
| 377 | value &= ~MAC_ENABLE_TX; | ||
| 378 | writel(value, ioaddr + MAC_CTRL_REG); | ||
| 379 | } | ||
| 380 | |||
| 381 | /** | ||
| 382 | * display_ring | ||
| 383 | * @p: pointer to the ring. | ||
| 384 | * @size: size of the ring. | ||
| 385 | * Description: display all the descriptors within the ring. | ||
| 386 | */ | ||
| 387 | static void display_ring(struct dma_desc *p, int size) | ||
| 388 | { | ||
| 389 | struct tmp_s { | ||
| 390 | u64 a; | ||
| 391 | unsigned int b; | ||
| 392 | unsigned int c; | ||
| 393 | }; | ||
| 394 | int i; | ||
| 395 | for (i = 0; i < size; i++) { | ||
| 396 | struct tmp_s *x = (struct tmp_s *)(p + i); | ||
| 397 | pr_info("\t%d [0x%x]: DES0=0x%x DES1=0x%x BUF1=0x%x BUF2=0x%x", | ||
| 398 | i, (unsigned int)virt_to_phys(&p[i]), | ||
| 399 | (unsigned int)(x->a), (unsigned int)((x->a) >> 32), | ||
| 400 | x->b, x->c); | ||
| 401 | pr_info("\n"); | ||
| 402 | } | ||
| 403 | } | ||
| 404 | |||
| 405 | /** | ||
| 406 | * init_dma_desc_rings - init the RX/TX descriptor rings | ||
| 407 | * @dev: net device structure | ||
| 408 | * Description: this function initializes the DMA RX/TX descriptors | ||
| 409 | * and allocates the socket buffers. | ||
| 410 | */ | ||
| 411 | static void init_dma_desc_rings(struct net_device *dev) | ||
| 412 | { | ||
| 413 | int i; | ||
| 414 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 415 | struct sk_buff *skb; | ||
| 416 | unsigned int txsize = priv->dma_tx_size; | ||
| 417 | unsigned int rxsize = priv->dma_rx_size; | ||
| 418 | unsigned int bfsize = priv->dma_buf_sz; | ||
| 419 | int buff2_needed = 0; | ||
| 420 | int dis_ic = 0; | ||
| 421 | |||
| 422 | #ifdef CONFIG_STMMAC_TIMER | ||
| 423 | /* Using Timers disable interrupts on completion for the reception */ | ||
| 424 | dis_ic = 1; | ||
| 425 | #endif | ||
| 426 | /* Set the Buffer size according to the MTU; | ||
| 427 | * indeed, in case of jumbo we need to bump-up the buffer sizes. | ||
| 428 | */ | ||
| 429 | if (unlikely(dev->mtu >= BUF_SIZE_8KiB)) | ||
| 430 | bfsize = BUF_SIZE_16KiB; | ||
| 431 | else if (unlikely(dev->mtu >= BUF_SIZE_4KiB)) | ||
| 432 | bfsize = BUF_SIZE_8KiB; | ||
| 433 | else if (unlikely(dev->mtu >= BUF_SIZE_2KiB)) | ||
| 434 | bfsize = BUF_SIZE_4KiB; | ||
| 435 | else if (unlikely(dev->mtu >= DMA_BUFFER_SIZE)) | ||
| 436 | bfsize = BUF_SIZE_2KiB; | ||
| 437 | else | ||
| 438 | bfsize = DMA_BUFFER_SIZE; | ||
| 439 | |||
| 440 | /* If the MTU exceeds 8k so use the second buffer in the chain */ | ||
| 441 | if (bfsize >= BUF_SIZE_8KiB) | ||
| 442 | buff2_needed = 1; | ||
| 443 | |||
| 444 | DBG(probe, INFO, "stmmac: txsize %d, rxsize %d, bfsize %d\n", | ||
| 445 | txsize, rxsize, bfsize); | ||
| 446 | |||
| 447 | priv->rx_skbuff_dma = kmalloc(rxsize * sizeof(dma_addr_t), GFP_KERNEL); | ||
| 448 | priv->rx_skbuff = | ||
| 449 | kmalloc(sizeof(struct sk_buff *) * rxsize, GFP_KERNEL); | ||
| 450 | priv->dma_rx = | ||
| 451 | (struct dma_desc *)dma_alloc_coherent(priv->device, | ||
| 452 | rxsize * | ||
| 453 | sizeof(struct dma_desc), | ||
| 454 | &priv->dma_rx_phy, | ||
| 455 | GFP_KERNEL); | ||
| 456 | priv->tx_skbuff = kmalloc(sizeof(struct sk_buff *) * txsize, | ||
| 457 | GFP_KERNEL); | ||
| 458 | priv->dma_tx = | ||
| 459 | (struct dma_desc *)dma_alloc_coherent(priv->device, | ||
| 460 | txsize * | ||
| 461 | sizeof(struct dma_desc), | ||
| 462 | &priv->dma_tx_phy, | ||
| 463 | GFP_KERNEL); | ||
| 464 | |||
| 465 | if ((priv->dma_rx == NULL) || (priv->dma_tx == NULL)) { | ||
| 466 | pr_err("%s:ERROR allocating the DMA Tx/Rx desc\n", __func__); | ||
| 467 | return; | ||
| 468 | } | ||
| 469 | |||
| 470 | DBG(probe, INFO, "stmmac (%s) DMA desc rings: virt addr (Rx %p, " | ||
| 471 | "Tx %p)\n\tDMA phy addr (Rx 0x%08x, Tx 0x%08x)\n", | ||
| 472 | dev->name, priv->dma_rx, priv->dma_tx, | ||
| 473 | (unsigned int)priv->dma_rx_phy, (unsigned int)priv->dma_tx_phy); | ||
| 474 | |||
| 475 | /* RX INITIALIZATION */ | ||
| 476 | DBG(probe, INFO, "stmmac: SKB addresses:\n" | ||
| 477 | "skb\t\tskb data\tdma data\n"); | ||
| 478 | |||
| 479 | for (i = 0; i < rxsize; i++) { | ||
| 480 | struct dma_desc *p = priv->dma_rx + i; | ||
| 481 | |||
| 482 | skb = netdev_alloc_skb_ip_align(dev, bfsize); | ||
| 483 | if (unlikely(skb == NULL)) { | ||
| 484 | pr_err("%s: Rx init fails; skb is NULL\n", __func__); | ||
| 485 | break; | ||
| 486 | } | ||
| 487 | priv->rx_skbuff[i] = skb; | ||
| 488 | priv->rx_skbuff_dma[i] = dma_map_single(priv->device, skb->data, | ||
| 489 | bfsize, DMA_FROM_DEVICE); | ||
| 490 | |||
| 491 | p->des2 = priv->rx_skbuff_dma[i]; | ||
| 492 | if (unlikely(buff2_needed)) | ||
| 493 | p->des3 = p->des2 + BUF_SIZE_8KiB; | ||
| 494 | DBG(probe, INFO, "[%p]\t[%p]\t[%x]\n", priv->rx_skbuff[i], | ||
| 495 | priv->rx_skbuff[i]->data, priv->rx_skbuff_dma[i]); | ||
| 496 | } | ||
| 497 | priv->cur_rx = 0; | ||
| 498 | priv->dirty_rx = (unsigned int)(i - rxsize); | ||
| 499 | priv->dma_buf_sz = bfsize; | ||
| 500 | buf_sz = bfsize; | ||
| 501 | |||
| 502 | /* TX INITIALIZATION */ | ||
| 503 | for (i = 0; i < txsize; i++) { | ||
| 504 | priv->tx_skbuff[i] = NULL; | ||
| 505 | priv->dma_tx[i].des2 = 0; | ||
| 506 | } | ||
| 507 | priv->dirty_tx = 0; | ||
| 508 | priv->cur_tx = 0; | ||
| 509 | |||
| 510 | /* Clear the Rx/Tx descriptors */ | ||
| 511 | priv->mac_type->ops->init_rx_desc(priv->dma_rx, rxsize, dis_ic); | ||
| 512 | priv->mac_type->ops->init_tx_desc(priv->dma_tx, txsize); | ||
| 513 | |||
| 514 | if (netif_msg_hw(priv)) { | ||
| 515 | pr_info("RX descriptor ring:\n"); | ||
| 516 | display_ring(priv->dma_rx, rxsize); | ||
| 517 | pr_info("TX descriptor ring:\n"); | ||
| 518 | display_ring(priv->dma_tx, txsize); | ||
| 519 | } | ||
| 520 | return; | ||
| 521 | } | ||
| 522 | |||
| 523 | static void dma_free_rx_skbufs(struct stmmac_priv *priv) | ||
| 524 | { | ||
| 525 | int i; | ||
| 526 | |||
| 527 | for (i = 0; i < priv->dma_rx_size; i++) { | ||
| 528 | if (priv->rx_skbuff[i]) { | ||
| 529 | dma_unmap_single(priv->device, priv->rx_skbuff_dma[i], | ||
| 530 | priv->dma_buf_sz, DMA_FROM_DEVICE); | ||
| 531 | dev_kfree_skb_any(priv->rx_skbuff[i]); | ||
| 532 | } | ||
| 533 | priv->rx_skbuff[i] = NULL; | ||
| 534 | } | ||
| 535 | return; | ||
| 536 | } | ||
| 537 | |||
| 538 | static void dma_free_tx_skbufs(struct stmmac_priv *priv) | ||
| 539 | { | ||
| 540 | int i; | ||
| 541 | |||
| 542 | for (i = 0; i < priv->dma_tx_size; i++) { | ||
| 543 | if (priv->tx_skbuff[i] != NULL) { | ||
| 544 | struct dma_desc *p = priv->dma_tx + i; | ||
| 545 | if (p->des2) | ||
| 546 | dma_unmap_single(priv->device, p->des2, | ||
| 547 | priv->mac_type->ops->get_tx_len(p), | ||
| 548 | DMA_TO_DEVICE); | ||
| 549 | dev_kfree_skb_any(priv->tx_skbuff[i]); | ||
| 550 | priv->tx_skbuff[i] = NULL; | ||
| 551 | } | ||
| 552 | } | ||
| 553 | return; | ||
| 554 | } | ||
| 555 | |||
| 556 | static void free_dma_desc_resources(struct stmmac_priv *priv) | ||
| 557 | { | ||
| 558 | /* Release the DMA TX/RX socket buffers */ | ||
| 559 | dma_free_rx_skbufs(priv); | ||
| 560 | dma_free_tx_skbufs(priv); | ||
| 561 | |||
| 562 | /* Free the region of consistent memory previously allocated for | ||
| 563 | * the DMA */ | ||
| 564 | dma_free_coherent(priv->device, | ||
| 565 | priv->dma_tx_size * sizeof(struct dma_desc), | ||
| 566 | priv->dma_tx, priv->dma_tx_phy); | ||
| 567 | dma_free_coherent(priv->device, | ||
| 568 | priv->dma_rx_size * sizeof(struct dma_desc), | ||
| 569 | priv->dma_rx, priv->dma_rx_phy); | ||
| 570 | kfree(priv->rx_skbuff_dma); | ||
| 571 | kfree(priv->rx_skbuff); | ||
| 572 | kfree(priv->tx_skbuff); | ||
| 573 | |||
| 574 | return; | ||
| 575 | } | ||
| 576 | |||
| 577 | /** | ||
| 578 | * stmmac_dma_start_tx | ||
| 579 | * @ioaddr: device I/O address | ||
| 580 | * Description: this function starts the DMA tx process. | ||
| 581 | */ | ||
| 582 | static void stmmac_dma_start_tx(unsigned long ioaddr) | ||
| 583 | { | ||
| 584 | u32 value = readl(ioaddr + DMA_CONTROL); | ||
| 585 | value |= DMA_CONTROL_ST; | ||
| 586 | writel(value, ioaddr + DMA_CONTROL); | ||
| 587 | return; | ||
| 588 | } | ||
| 589 | |||
| 590 | static void stmmac_dma_stop_tx(unsigned long ioaddr) | ||
| 591 | { | ||
| 592 | u32 value = readl(ioaddr + DMA_CONTROL); | ||
| 593 | value &= ~DMA_CONTROL_ST; | ||
| 594 | writel(value, ioaddr + DMA_CONTROL); | ||
| 595 | return; | ||
| 596 | } | ||
| 597 | |||
| 598 | /** | ||
| 599 | * stmmac_dma_start_rx | ||
| 600 | * @ioaddr: device I/O address | ||
| 601 | * Description: this function starts the DMA rx process. | ||
| 602 | */ | ||
| 603 | static void stmmac_dma_start_rx(unsigned long ioaddr) | ||
| 604 | { | ||
| 605 | u32 value = readl(ioaddr + DMA_CONTROL); | ||
| 606 | value |= DMA_CONTROL_SR; | ||
| 607 | writel(value, ioaddr + DMA_CONTROL); | ||
| 608 | |||
| 609 | return; | ||
| 610 | } | ||
| 611 | |||
| 612 | static void stmmac_dma_stop_rx(unsigned long ioaddr) | ||
| 613 | { | ||
| 614 | u32 value = readl(ioaddr + DMA_CONTROL); | ||
| 615 | value &= ~DMA_CONTROL_SR; | ||
| 616 | writel(value, ioaddr + DMA_CONTROL); | ||
| 617 | |||
| 618 | return; | ||
| 619 | } | ||
| 620 | |||
| 621 | /** | ||
| 622 | * stmmac_dma_operation_mode - HW DMA operation mode | ||
| 623 | * @priv : pointer to the private device structure. | ||
| 624 | * Description: it sets the DMA operation mode: tx/rx DMA thresholds | ||
| 625 | * or Store-And-Forward capability. It also verifies the COE for the | ||
| 626 | * transmission in case of Giga ETH. | ||
| 627 | */ | ||
| 628 | static void stmmac_dma_operation_mode(struct stmmac_priv *priv) | ||
| 629 | { | ||
| 630 | if (!priv->is_gmac) { | ||
| 631 | /* MAC 10/100 */ | ||
| 632 | priv->mac_type->ops->dma_mode(priv->dev->base_addr, tc, 0); | ||
| 633 | priv->tx_coe = NO_HW_CSUM; | ||
| 634 | } else { | ||
| 635 | if ((priv->dev->mtu <= ETH_DATA_LEN) && (tx_coe)) { | ||
| 636 | priv->mac_type->ops->dma_mode(priv->dev->base_addr, | ||
| 637 | SF_DMA_MODE, SF_DMA_MODE); | ||
| 638 | tc = SF_DMA_MODE; | ||
| 639 | priv->tx_coe = HW_CSUM; | ||
| 640 | } else { | ||
| 641 | /* Checksum computation is performed in software. */ | ||
| 642 | priv->mac_type->ops->dma_mode(priv->dev->base_addr, tc, | ||
| 643 | SF_DMA_MODE); | ||
| 644 | priv->tx_coe = NO_HW_CSUM; | ||
| 645 | } | ||
| 646 | } | ||
| 647 | tx_coe = priv->tx_coe; | ||
| 648 | |||
| 649 | return; | ||
| 650 | } | ||
| 651 | |||
| 652 | #ifdef STMMAC_DEBUG | ||
| 653 | /** | ||
| 654 | * show_tx_process_state | ||
| 655 | * @status: tx descriptor status field | ||
| 656 | * Description: it shows the Transmit Process State for CSR5[22:20] | ||
| 657 | */ | ||
| 658 | static void show_tx_process_state(unsigned int status) | ||
| 659 | { | ||
| 660 | unsigned int state; | ||
| 661 | state = (status & DMA_STATUS_TS_MASK) >> DMA_STATUS_TS_SHIFT; | ||
| 662 | |||
| 663 | switch (state) { | ||
| 664 | case 0: | ||
| 665 | pr_info("- TX (Stopped): Reset or Stop command\n"); | ||
| 666 | break; | ||
| 667 | case 1: | ||
| 668 | pr_info("- TX (Running):Fetching the Tx desc\n"); | ||
| 669 | break; | ||
| 670 | case 2: | ||
| 671 | pr_info("- TX (Running): Waiting for end of tx\n"); | ||
| 672 | break; | ||
| 673 | case 3: | ||
| 674 | pr_info("- TX (Running): Reading the data " | ||
| 675 | "and queuing the data into the Tx buf\n"); | ||
| 676 | break; | ||
| 677 | case 6: | ||
| 678 | pr_info("- TX (Suspended): Tx Buff Underflow " | ||
| 679 | "or an unavailable Transmit descriptor\n"); | ||
| 680 | break; | ||
| 681 | case 7: | ||
| 682 | pr_info("- TX (Running): Closing Tx descriptor\n"); | ||
| 683 | break; | ||
| 684 | default: | ||
| 685 | break; | ||
| 686 | } | ||
| 687 | return; | ||
| 688 | } | ||
| 689 | |||
| 690 | /** | ||
| 691 | * show_rx_process_state | ||
| 692 | * @status: rx descriptor status field | ||
| 693 | * Description: it shows the Receive Process State for CSR5[19:17] | ||
| 694 | */ | ||
| 695 | static void show_rx_process_state(unsigned int status) | ||
| 696 | { | ||
| 697 | unsigned int state; | ||
| 698 | state = (status & DMA_STATUS_RS_MASK) >> DMA_STATUS_RS_SHIFT; | ||
| 699 | |||
| 700 | switch (state) { | ||
| 701 | case 0: | ||
| 702 | pr_info("- RX (Stopped): Reset or Stop command\n"); | ||
| 703 | break; | ||
| 704 | case 1: | ||
| 705 | pr_info("- RX (Running): Fetching the Rx desc\n"); | ||
| 706 | break; | ||
| 707 | case 2: | ||
| 708 | pr_info("- RX (Running):Checking for end of pkt\n"); | ||
| 709 | break; | ||
| 710 | case 3: | ||
| 711 | pr_info("- RX (Running): Waiting for Rx pkt\n"); | ||
| 712 | break; | ||
| 713 | case 4: | ||
| 714 | pr_info("- RX (Suspended): Unavailable Rx buf\n"); | ||
| 715 | break; | ||
| 716 | case 5: | ||
| 717 | pr_info("- RX (Running): Closing Rx descriptor\n"); | ||
| 718 | break; | ||
| 719 | case 6: | ||
| 720 | pr_info("- RX(Running): Flushing the current frame" | ||
| 721 | " from the Rx buf\n"); | ||
| 722 | break; | ||
| 723 | case 7: | ||
| 724 | pr_info("- RX (Running): Queuing the Rx frame" | ||
| 725 | " from the Rx buf into memory\n"); | ||
| 726 | break; | ||
| 727 | default: | ||
| 728 | break; | ||
| 729 | } | ||
| 730 | return; | ||
| 731 | } | ||
| 732 | #endif | ||
| 733 | |||
| 734 | /** | ||
| 735 | * stmmac_tx: | ||
| 736 | * @priv: private driver structure | ||
| 737 | * Description: it reclaims resources after transmission completes. | ||
| 738 | */ | ||
| 739 | static void stmmac_tx(struct stmmac_priv *priv) | ||
| 740 | { | ||
| 741 | unsigned int txsize = priv->dma_tx_size; | ||
| 742 | unsigned long ioaddr = priv->dev->base_addr; | ||
| 743 | |||
| 744 | while (priv->dirty_tx != priv->cur_tx) { | ||
| 745 | int last; | ||
| 746 | unsigned int entry = priv->dirty_tx % txsize; | ||
| 747 | struct sk_buff *skb = priv->tx_skbuff[entry]; | ||
| 748 | struct dma_desc *p = priv->dma_tx + entry; | ||
| 749 | |||
| 750 | /* Check if the descriptor is owned by the DMA. */ | ||
| 751 | if (priv->mac_type->ops->get_tx_owner(p)) | ||
| 752 | break; | ||
| 753 | |||
| 754 | /* Verify tx error by looking at the last segment */ | ||
| 755 | last = priv->mac_type->ops->get_tx_ls(p); | ||
| 756 | if (likely(last)) { | ||
| 757 | int tx_error = | ||
| 758 | priv->mac_type->ops->tx_status(&priv->dev->stats, | ||
| 759 | &priv->xstats, | ||
| 760 | p, ioaddr); | ||
| 761 | if (likely(tx_error == 0)) { | ||
| 762 | priv->dev->stats.tx_packets++; | ||
| 763 | priv->xstats.tx_pkt_n++; | ||
| 764 | } else | ||
| 765 | priv->dev->stats.tx_errors++; | ||
| 766 | } | ||
| 767 | TX_DBG("%s: curr %d, dirty %d\n", __func__, | ||
| 768 | priv->cur_tx, priv->dirty_tx); | ||
| 769 | |||
| 770 | if (likely(p->des2)) | ||
| 771 | dma_unmap_single(priv->device, p->des2, | ||
| 772 | priv->mac_type->ops->get_tx_len(p), | ||
| 773 | DMA_TO_DEVICE); | ||
| 774 | if (unlikely(p->des3)) | ||
| 775 | p->des3 = 0; | ||
| 776 | |||
| 777 | if (likely(skb != NULL)) { | ||
| 778 | /* | ||
| 779 | * If there's room in the queue (limit it to size) | ||
| 780 | * we add this skb back into the pool, | ||
| 781 | * if it's the right size. | ||
| 782 | */ | ||
| 783 | if ((skb_queue_len(&priv->rx_recycle) < | ||
| 784 | priv->dma_rx_size) && | ||
| 785 | skb_recycle_check(skb, priv->dma_buf_sz)) | ||
| 786 | __skb_queue_head(&priv->rx_recycle, skb); | ||
| 787 | else | ||
| 788 | dev_kfree_skb(skb); | ||
| 789 | |||
| 790 | priv->tx_skbuff[entry] = NULL; | ||
| 791 | } | ||
| 792 | |||
| 793 | priv->mac_type->ops->release_tx_desc(p); | ||
| 794 | |||
| 795 | entry = (++priv->dirty_tx) % txsize; | ||
| 796 | } | ||
| 797 | if (unlikely(netif_queue_stopped(priv->dev) && | ||
| 798 | stmmac_tx_avail(priv) > STMMAC_TX_THRESH(priv))) { | ||
| 799 | netif_tx_lock(priv->dev); | ||
| 800 | if (netif_queue_stopped(priv->dev) && | ||
| 801 | stmmac_tx_avail(priv) > STMMAC_TX_THRESH(priv)) { | ||
| 802 | TX_DBG("%s: restart transmit\n", __func__); | ||
| 803 | netif_wake_queue(priv->dev); | ||
| 804 | } | ||
| 805 | netif_tx_unlock(priv->dev); | ||
| 806 | } | ||
| 807 | return; | ||
| 808 | } | ||
| 809 | |||
| 810 | static inline void stmmac_enable_irq(struct stmmac_priv *priv) | ||
| 811 | { | ||
| 812 | #ifndef CONFIG_STMMAC_TIMER | ||
| 813 | writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA); | ||
| 814 | #else | ||
| 815 | priv->tm->timer_start(tmrate); | ||
| 816 | #endif | ||
| 817 | } | ||
| 818 | |||
| 819 | static inline void stmmac_disable_irq(struct stmmac_priv *priv) | ||
| 820 | { | ||
| 821 | #ifndef CONFIG_STMMAC_TIMER | ||
| 822 | writel(0, priv->dev->base_addr + DMA_INTR_ENA); | ||
| 823 | #else | ||
| 824 | priv->tm->timer_stop(); | ||
| 825 | #endif | ||
| 826 | } | ||
| 827 | |||
| 828 | static int stmmac_has_work(struct stmmac_priv *priv) | ||
| 829 | { | ||
| 830 | unsigned int has_work = 0; | ||
| 831 | int rxret, tx_work = 0; | ||
| 832 | |||
| 833 | rxret = priv->mac_type->ops->get_rx_owner(priv->dma_rx + | ||
| 834 | (priv->cur_rx % priv->dma_rx_size)); | ||
| 835 | |||
| 836 | if (priv->dirty_tx != priv->cur_tx) | ||
| 837 | tx_work = 1; | ||
| 838 | |||
| 839 | if (likely(!rxret || tx_work)) | ||
| 840 | has_work = 1; | ||
| 841 | |||
| 842 | return has_work; | ||
| 843 | } | ||
| 844 | |||
| 845 | static inline void _stmmac_schedule(struct stmmac_priv *priv) | ||
| 846 | { | ||
| 847 | if (likely(stmmac_has_work(priv))) { | ||
| 848 | stmmac_disable_irq(priv); | ||
| 849 | napi_schedule(&priv->napi); | ||
| 850 | } | ||
| 851 | } | ||
| 852 | |||
| 853 | #ifdef CONFIG_STMMAC_TIMER | ||
| 854 | void stmmac_schedule(struct net_device *dev) | ||
| 855 | { | ||
| 856 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 857 | |||
| 858 | priv->xstats.sched_timer_n++; | ||
| 859 | |||
| 860 | _stmmac_schedule(priv); | ||
| 861 | |||
| 862 | return; | ||
| 863 | } | ||
| 864 | |||
| 865 | static void stmmac_no_timer_started(unsigned int x) | ||
| 866 | {; | ||
| 867 | }; | ||
| 868 | |||
| 869 | static void stmmac_no_timer_stopped(void) | ||
| 870 | {; | ||
| 871 | }; | ||
| 872 | #endif | ||
| 873 | |||
| 874 | /** | ||
| 875 | * stmmac_tx_err: | ||
| 876 | * @priv: pointer to the private device structure | ||
| 877 | * Description: it cleans the descriptors and restarts the transmission | ||
| 878 | * in case of errors. | ||
| 879 | */ | ||
| 880 | static void stmmac_tx_err(struct stmmac_priv *priv) | ||
| 881 | { | ||
| 882 | netif_stop_queue(priv->dev); | ||
| 883 | |||
| 884 | stmmac_dma_stop_tx(priv->dev->base_addr); | ||
| 885 | dma_free_tx_skbufs(priv); | ||
| 886 | priv->mac_type->ops->init_tx_desc(priv->dma_tx, priv->dma_tx_size); | ||
| 887 | priv->dirty_tx = 0; | ||
| 888 | priv->cur_tx = 0; | ||
| 889 | stmmac_dma_start_tx(priv->dev->base_addr); | ||
| 890 | |||
| 891 | priv->dev->stats.tx_errors++; | ||
| 892 | netif_wake_queue(priv->dev); | ||
| 893 | |||
| 894 | return; | ||
| 895 | } | ||
| 896 | |||
| 897 | /** | ||
| 898 | * stmmac_dma_interrupt - Interrupt handler for the driver | ||
| 899 | * @dev: net device structure | ||
| 900 | * Description: Interrupt handler for the driver (DMA). | ||
| 901 | */ | ||
| 902 | static void stmmac_dma_interrupt(struct net_device *dev) | ||
| 903 | { | ||
| 904 | unsigned long ioaddr = dev->base_addr; | ||
| 905 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 906 | /* read the status register (CSR5) */ | ||
| 907 | u32 intr_status = readl(ioaddr + DMA_STATUS); | ||
| 908 | |||
| 909 | DBG(intr, INFO, "%s: [CSR5: 0x%08x]\n", __func__, intr_status); | ||
| 910 | |||
| 911 | #ifdef STMMAC_DEBUG | ||
| 912 | /* It displays the DMA transmit process state (CSR5 register) */ | ||
| 913 | if (netif_msg_tx_done(priv)) | ||
| 914 | show_tx_process_state(intr_status); | ||
| 915 | if (netif_msg_rx_status(priv)) | ||
| 916 | show_rx_process_state(intr_status); | ||
| 917 | #endif | ||
| 918 | /* ABNORMAL interrupts */ | ||
| 919 | if (unlikely(intr_status & DMA_STATUS_AIS)) { | ||
| 920 | DBG(intr, INFO, "CSR5[15] DMA ABNORMAL IRQ: "); | ||
| 921 | if (unlikely(intr_status & DMA_STATUS_UNF)) { | ||
| 922 | DBG(intr, INFO, "transmit underflow\n"); | ||
| 923 | if (unlikely(tc != SF_DMA_MODE) | ||
| 924 | && (tc <= 256)) { | ||
| 925 | /* Try to bump up the threshold */ | ||
| 926 | tc += 64; | ||
| 927 | priv->mac_type->ops->dma_mode(ioaddr, tc, | ||
| 928 | SF_DMA_MODE); | ||
| 929 | priv->xstats.threshold = tc; | ||
| 930 | } | ||
| 931 | stmmac_tx_err(priv); | ||
| 932 | priv->xstats.tx_undeflow_irq++; | ||
| 933 | } | ||
| 934 | if (unlikely(intr_status & DMA_STATUS_TJT)) { | ||
| 935 | DBG(intr, INFO, "transmit jabber\n"); | ||
| 936 | priv->xstats.tx_jabber_irq++; | ||
| 937 | } | ||
| 938 | if (unlikely(intr_status & DMA_STATUS_OVF)) { | ||
| 939 | DBG(intr, INFO, "recv overflow\n"); | ||
| 940 | priv->xstats.rx_overflow_irq++; | ||
| 941 | } | ||
| 942 | if (unlikely(intr_status & DMA_STATUS_RU)) { | ||
| 943 | DBG(intr, INFO, "receive buffer unavailable\n"); | ||
| 944 | priv->xstats.rx_buf_unav_irq++; | ||
| 945 | } | ||
| 946 | if (unlikely(intr_status & DMA_STATUS_RPS)) { | ||
| 947 | DBG(intr, INFO, "receive process stopped\n"); | ||
| 948 | priv->xstats.rx_process_stopped_irq++; | ||
| 949 | } | ||
| 950 | if (unlikely(intr_status & DMA_STATUS_RWT)) { | ||
| 951 | DBG(intr, INFO, "receive watchdog\n"); | ||
| 952 | priv->xstats.rx_watchdog_irq++; | ||
| 953 | } | ||
| 954 | if (unlikely(intr_status & DMA_STATUS_ETI)) { | ||
| 955 | DBG(intr, INFO, "transmit early interrupt\n"); | ||
| 956 | priv->xstats.tx_early_irq++; | ||
| 957 | } | ||
| 958 | if (unlikely(intr_status & DMA_STATUS_TPS)) { | ||
| 959 | DBG(intr, INFO, "transmit process stopped\n"); | ||
| 960 | priv->xstats.tx_process_stopped_irq++; | ||
| 961 | stmmac_tx_err(priv); | ||
| 962 | } | ||
| 963 | if (unlikely(intr_status & DMA_STATUS_FBI)) { | ||
| 964 | DBG(intr, INFO, "fatal bus error\n"); | ||
| 965 | priv->xstats.fatal_bus_error_irq++; | ||
| 966 | stmmac_tx_err(priv); | ||
| 967 | } | ||
| 968 | } | ||
| 969 | |||
| 970 | /* TX/RX NORMAL interrupts */ | ||
| 971 | if (intr_status & DMA_STATUS_NIS) { | ||
| 972 | priv->xstats.normal_irq_n++; | ||
| 973 | if (likely((intr_status & DMA_STATUS_RI) || | ||
| 974 | (intr_status & (DMA_STATUS_TI)))) | ||
| 975 | _stmmac_schedule(priv); | ||
| 976 | } | ||
| 977 | |||
| 978 | /* Optional hardware blocks, interrupts should be disabled */ | ||
| 979 | if (unlikely(intr_status & | ||
| 980 | (DMA_STATUS_GPI | DMA_STATUS_GMI | DMA_STATUS_GLI))) | ||
| 981 | pr_info("%s: unexpected status %08x\n", __func__, intr_status); | ||
| 982 | |||
| 983 | /* Clear the interrupt by writing a logic 1 to the CSR5[15-0] */ | ||
| 984 | writel((intr_status & 0x1ffff), ioaddr + DMA_STATUS); | ||
| 985 | |||
| 986 | DBG(intr, INFO, "\n\n"); | ||
| 987 | |||
| 988 | return; | ||
| 989 | } | ||
| 990 | |||
| 991 | /** | ||
| 992 | * stmmac_open - open entry point of the driver | ||
| 993 | * @dev : pointer to the device structure. | ||
| 994 | * Description: | ||
| 995 | * This function is the open entry point of the driver. | ||
| 996 | * Return value: | ||
| 997 | * 0 on success and an appropriate (-)ve integer as defined in errno.h | ||
| 998 | * file on failure. | ||
| 999 | */ | ||
| 1000 | static int stmmac_open(struct net_device *dev) | ||
| 1001 | { | ||
| 1002 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1003 | unsigned long ioaddr = dev->base_addr; | ||
| 1004 | int ret; | ||
| 1005 | |||
| 1006 | /* Check that the MAC address is valid. If its not, refuse | ||
| 1007 | * to bring the device up. The user must specify an | ||
| 1008 | * address using the following linux command: | ||
| 1009 | * ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx */ | ||
| 1010 | if (!is_valid_ether_addr(dev->dev_addr)) { | ||
| 1011 | random_ether_addr(dev->dev_addr); | ||
| 1012 | pr_warning("%s: generated random MAC address %pM\n", dev->name, | ||
| 1013 | dev->dev_addr); | ||
| 1014 | } | ||
| 1015 | |||
| 1016 | stmmac_verify_args(); | ||
| 1017 | |||
| 1018 | ret = stmmac_init_phy(dev); | ||
| 1019 | if (unlikely(ret)) { | ||
| 1020 | pr_err("%s: Cannot attach to PHY (error: %d)\n", __func__, ret); | ||
| 1021 | return ret; | ||
| 1022 | } | ||
| 1023 | |||
| 1024 | /* Request the IRQ lines */ | ||
| 1025 | ret = request_irq(dev->irq, &stmmac_interrupt, | ||
| 1026 | IRQF_SHARED, dev->name, dev); | ||
| 1027 | if (unlikely(ret < 0)) { | ||
| 1028 | pr_err("%s: ERROR: allocating the IRQ %d (error: %d)\n", | ||
| 1029 | __func__, dev->irq, ret); | ||
| 1030 | return ret; | ||
| 1031 | } | ||
| 1032 | |||
| 1033 | #ifdef CONFIG_STMMAC_TIMER | ||
| 1034 | priv->tm = kmalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); | ||
| 1035 | if (unlikely(priv->tm == NULL)) { | ||
| 1036 | pr_err("%s: ERROR: timer memory alloc failed \n", __func__); | ||
| 1037 | return -ENOMEM; | ||
| 1038 | } | ||
| 1039 | priv->tm->freq = tmrate; | ||
| 1040 | |||
| 1041 | /* Test if the HW timer can be actually used. | ||
| 1042 | * In case of failure continue with no timer. */ | ||
| 1043 | if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) { | ||
| 1044 | pr_warning("stmmaceth: cannot attach the HW timer\n"); | ||
| 1045 | tmrate = 0; | ||
| 1046 | priv->tm->freq = 0; | ||
| 1047 | priv->tm->timer_start = stmmac_no_timer_started; | ||
| 1048 | priv->tm->timer_stop = stmmac_no_timer_stopped; | ||
| 1049 | } | ||
| 1050 | #endif | ||
| 1051 | |||
| 1052 | /* Create and initialize the TX/RX descriptors chains. */ | ||
| 1053 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); | ||
| 1054 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); | ||
| 1055 | priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); | ||
| 1056 | init_dma_desc_rings(dev); | ||
| 1057 | |||
| 1058 | /* DMA initialization and SW reset */ | ||
| 1059 | if (unlikely(priv->mac_type->ops->dma_init(ioaddr, | ||
| 1060 | priv->pbl, priv->dma_tx_phy, priv->dma_rx_phy) < 0)) { | ||
| 1061 | |||
| 1062 | pr_err("%s: DMA initialization failed\n", __func__); | ||
| 1063 | return -1; | ||
| 1064 | } | ||
| 1065 | |||
| 1066 | /* Copy the MAC addr into the HW */ | ||
| 1067 | priv->mac_type->ops->set_umac_addr(ioaddr, dev->dev_addr, 0); | ||
| 1068 | /* Initialize the MAC Core */ | ||
| 1069 | priv->mac_type->ops->core_init(ioaddr); | ||
| 1070 | |||
| 1071 | priv->shutdown = 0; | ||
| 1072 | |||
| 1073 | /* Initialise the MMC (if present) to disable all interrupts. */ | ||
| 1074 | writel(0xffffffff, ioaddr + MMC_HIGH_INTR_MASK); | ||
| 1075 | writel(0xffffffff, ioaddr + MMC_LOW_INTR_MASK); | ||
| 1076 | |||
| 1077 | /* Enable the MAC Rx/Tx */ | ||
| 1078 | stmmac_mac_enable_rx(ioaddr); | ||
| 1079 | stmmac_mac_enable_tx(ioaddr); | ||
| 1080 | |||
| 1081 | /* Set the HW DMA mode and the COE */ | ||
| 1082 | stmmac_dma_operation_mode(priv); | ||
| 1083 | |||
| 1084 | /* Extra statistics */ | ||
| 1085 | memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); | ||
| 1086 | priv->xstats.threshold = tc; | ||
| 1087 | |||
| 1088 | /* Start the ball rolling... */ | ||
| 1089 | DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); | ||
| 1090 | stmmac_dma_start_tx(ioaddr); | ||
| 1091 | stmmac_dma_start_rx(ioaddr); | ||
| 1092 | |||
| 1093 | #ifdef CONFIG_STMMAC_TIMER | ||
| 1094 | priv->tm->timer_start(tmrate); | ||
| 1095 | #endif | ||
| 1096 | /* Dump DMA/MAC registers */ | ||
| 1097 | if (netif_msg_hw(priv)) { | ||
| 1098 | priv->mac_type->ops->dump_mac_regs(ioaddr); | ||
| 1099 | priv->mac_type->ops->dump_dma_regs(ioaddr); | ||
| 1100 | } | ||
| 1101 | |||
| 1102 | if (priv->phydev) | ||
| 1103 | phy_start(priv->phydev); | ||
| 1104 | |||
| 1105 | napi_enable(&priv->napi); | ||
| 1106 | skb_queue_head_init(&priv->rx_recycle); | ||
| 1107 | netif_start_queue(dev); | ||
| 1108 | return 0; | ||
| 1109 | } | ||
| 1110 | |||
| 1111 | /** | ||
| 1112 | * stmmac_release - close entry point of the driver | ||
| 1113 | * @dev : device pointer. | ||
| 1114 | * Description: | ||
| 1115 | * This is the stop entry point of the driver. | ||
| 1116 | */ | ||
| 1117 | static int stmmac_release(struct net_device *dev) | ||
| 1118 | { | ||
| 1119 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1120 | |||
| 1121 | /* Stop and disconnect the PHY */ | ||
| 1122 | if (priv->phydev) { | ||
| 1123 | phy_stop(priv->phydev); | ||
| 1124 | phy_disconnect(priv->phydev); | ||
| 1125 | priv->phydev = NULL; | ||
| 1126 | } | ||
| 1127 | |||
| 1128 | netif_stop_queue(dev); | ||
| 1129 | |||
| 1130 | #ifdef CONFIG_STMMAC_TIMER | ||
| 1131 | /* Stop and release the timer */ | ||
| 1132 | stmmac_close_ext_timer(); | ||
| 1133 | if (priv->tm != NULL) | ||
| 1134 | kfree(priv->tm); | ||
| 1135 | #endif | ||
| 1136 | napi_disable(&priv->napi); | ||
| 1137 | skb_queue_purge(&priv->rx_recycle); | ||
| 1138 | |||
| 1139 | /* Free the IRQ lines */ | ||
| 1140 | free_irq(dev->irq, dev); | ||
| 1141 | |||
| 1142 | /* Stop TX/RX DMA and clear the descriptors */ | ||
| 1143 | stmmac_dma_stop_tx(dev->base_addr); | ||
| 1144 | stmmac_dma_stop_rx(dev->base_addr); | ||
| 1145 | |||
| 1146 | /* Release and free the Rx/Tx resources */ | ||
| 1147 | free_dma_desc_resources(priv); | ||
| 1148 | |||
| 1149 | /* Disable the MAC core */ | ||
| 1150 | stmmac_mac_disable_tx(dev->base_addr); | ||
| 1151 | stmmac_mac_disable_rx(dev->base_addr); | ||
| 1152 | |||
| 1153 | netif_carrier_off(dev); | ||
| 1154 | |||
| 1155 | return 0; | ||
| 1156 | } | ||
| 1157 | |||
| 1158 | /* | ||
| 1159 | * To perform emulated hardware segmentation on skb. | ||
| 1160 | */ | ||
| 1161 | static int stmmac_sw_tso(struct stmmac_priv *priv, struct sk_buff *skb) | ||
| 1162 | { | ||
| 1163 | struct sk_buff *segs, *curr_skb; | ||
| 1164 | int gso_segs = skb_shinfo(skb)->gso_segs; | ||
| 1165 | |||
| 1166 | /* Estimate the number of fragments in the worst case */ | ||
| 1167 | if (unlikely(stmmac_tx_avail(priv) < gso_segs)) { | ||
| 1168 | netif_stop_queue(priv->dev); | ||
| 1169 | TX_DBG(KERN_ERR "%s: TSO BUG! Tx Ring full when queue awake\n", | ||
| 1170 | __func__); | ||
| 1171 | if (stmmac_tx_avail(priv) < gso_segs) | ||
| 1172 | return NETDEV_TX_BUSY; | ||
| 1173 | |||
| 1174 | netif_wake_queue(priv->dev); | ||
| 1175 | } | ||
| 1176 | TX_DBG("\tstmmac_sw_tso: segmenting: skb %p (len %d)\n", | ||
| 1177 | skb, skb->len); | ||
| 1178 | |||
| 1179 | segs = skb_gso_segment(skb, priv->dev->features & ~NETIF_F_TSO); | ||
| 1180 | if (unlikely(IS_ERR(segs))) | ||
| 1181 | goto sw_tso_end; | ||
| 1182 | |||
| 1183 | do { | ||
| 1184 | curr_skb = segs; | ||
| 1185 | segs = segs->next; | ||
| 1186 | TX_DBG("\t\tcurrent skb->len: %d, *curr %p," | ||
| 1187 | "*next %p\n", curr_skb->len, curr_skb, segs); | ||
| 1188 | curr_skb->next = NULL; | ||
| 1189 | stmmac_xmit(curr_skb, priv->dev); | ||
| 1190 | } while (segs); | ||
| 1191 | |||
| 1192 | sw_tso_end: | ||
| 1193 | dev_kfree_skb(skb); | ||
| 1194 | |||
| 1195 | return NETDEV_TX_OK; | ||
| 1196 | } | ||
| 1197 | |||
| 1198 | static unsigned int stmmac_handle_jumbo_frames(struct sk_buff *skb, | ||
| 1199 | struct net_device *dev, | ||
| 1200 | int csum_insertion) | ||
| 1201 | { | ||
| 1202 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1203 | unsigned int nopaged_len = skb_headlen(skb); | ||
| 1204 | unsigned int txsize = priv->dma_tx_size; | ||
| 1205 | unsigned int entry = priv->cur_tx % txsize; | ||
| 1206 | struct dma_desc *desc = priv->dma_tx + entry; | ||
| 1207 | |||
| 1208 | if (nopaged_len > BUF_SIZE_8KiB) { | ||
| 1209 | |||
| 1210 | int buf2_size = nopaged_len - BUF_SIZE_8KiB; | ||
| 1211 | |||
| 1212 | desc->des2 = dma_map_single(priv->device, skb->data, | ||
| 1213 | BUF_SIZE_8KiB, DMA_TO_DEVICE); | ||
| 1214 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | ||
| 1215 | priv->mac_type->ops->prepare_tx_desc(desc, 1, BUF_SIZE_8KiB, | ||
| 1216 | csum_insertion); | ||
| 1217 | |||
| 1218 | entry = (++priv->cur_tx) % txsize; | ||
| 1219 | desc = priv->dma_tx + entry; | ||
| 1220 | |||
| 1221 | desc->des2 = dma_map_single(priv->device, | ||
| 1222 | skb->data + BUF_SIZE_8KiB, | ||
| 1223 | buf2_size, DMA_TO_DEVICE); | ||
| 1224 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | ||
| 1225 | priv->mac_type->ops->prepare_tx_desc(desc, 0, | ||
| 1226 | buf2_size, csum_insertion); | ||
| 1227 | priv->mac_type->ops->set_tx_owner(desc); | ||
| 1228 | priv->tx_skbuff[entry] = NULL; | ||
| 1229 | } else { | ||
| 1230 | desc->des2 = dma_map_single(priv->device, skb->data, | ||
| 1231 | nopaged_len, DMA_TO_DEVICE); | ||
| 1232 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | ||
| 1233 | priv->mac_type->ops->prepare_tx_desc(desc, 1, nopaged_len, | ||
| 1234 | csum_insertion); | ||
| 1235 | } | ||
| 1236 | return entry; | ||
| 1237 | } | ||
| 1238 | |||
| 1239 | /** | ||
| 1240 | * stmmac_xmit: | ||
| 1241 | * @skb : the socket buffer | ||
| 1242 | * @dev : device pointer | ||
| 1243 | * Description : Tx entry point of the driver. | ||
| 1244 | */ | ||
| 1245 | static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | ||
| 1246 | { | ||
| 1247 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1248 | unsigned int txsize = priv->dma_tx_size; | ||
| 1249 | unsigned int entry; | ||
| 1250 | int i, csum_insertion = 0; | ||
| 1251 | int nfrags = skb_shinfo(skb)->nr_frags; | ||
| 1252 | struct dma_desc *desc, *first; | ||
| 1253 | |||
| 1254 | if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) { | ||
| 1255 | if (!netif_queue_stopped(dev)) { | ||
| 1256 | netif_stop_queue(dev); | ||
| 1257 | /* This is a hard error, log it. */ | ||
| 1258 | pr_err("%s: BUG! Tx Ring full when queue awake\n", | ||
| 1259 | __func__); | ||
| 1260 | } | ||
| 1261 | return NETDEV_TX_BUSY; | ||
| 1262 | } | ||
| 1263 | |||
| 1264 | entry = priv->cur_tx % txsize; | ||
| 1265 | |||
| 1266 | #ifdef STMMAC_XMIT_DEBUG | ||
| 1267 | if ((skb->len > ETH_FRAME_LEN) || nfrags) | ||
| 1268 | pr_info("stmmac xmit:\n" | ||
| 1269 | "\tskb addr %p - len: %d - nopaged_len: %d\n" | ||
| 1270 | "\tn_frags: %d - ip_summed: %d - %s gso\n", | ||
| 1271 | skb, skb->len, skb_headlen(skb), nfrags, skb->ip_summed, | ||
| 1272 | !skb_is_gso(skb) ? "isn't" : "is"); | ||
| 1273 | #endif | ||
| 1274 | |||
| 1275 | if (unlikely(skb_is_gso(skb))) | ||
| 1276 | return stmmac_sw_tso(priv, skb); | ||
| 1277 | |||
| 1278 | if (likely((skb->ip_summed == CHECKSUM_PARTIAL))) { | ||
| 1279 | if (likely(priv->tx_coe == NO_HW_CSUM)) | ||
| 1280 | skb_checksum_help(skb); | ||
| 1281 | else | ||
| 1282 | csum_insertion = 1; | ||
| 1283 | } | ||
| 1284 | |||
| 1285 | desc = priv->dma_tx + entry; | ||
| 1286 | first = desc; | ||
| 1287 | |||
| 1288 | #ifdef STMMAC_XMIT_DEBUG | ||
| 1289 | if ((nfrags > 0) || (skb->len > ETH_FRAME_LEN)) | ||
| 1290 | pr_debug("stmmac xmit: skb len: %d, nopaged_len: %d,\n" | ||
| 1291 | "\t\tn_frags: %d, ip_summed: %d\n", | ||
| 1292 | skb->len, skb_headlen(skb), nfrags, skb->ip_summed); | ||
| 1293 | #endif | ||
| 1294 | priv->tx_skbuff[entry] = skb; | ||
| 1295 | if (unlikely(skb->len >= BUF_SIZE_4KiB)) { | ||
| 1296 | entry = stmmac_handle_jumbo_frames(skb, dev, csum_insertion); | ||
| 1297 | desc = priv->dma_tx + entry; | ||
| 1298 | } else { | ||
| 1299 | unsigned int nopaged_len = skb_headlen(skb); | ||
| 1300 | desc->des2 = dma_map_single(priv->device, skb->data, | ||
| 1301 | nopaged_len, DMA_TO_DEVICE); | ||
| 1302 | priv->mac_type->ops->prepare_tx_desc(desc, 1, nopaged_len, | ||
| 1303 | csum_insertion); | ||
| 1304 | } | ||
| 1305 | |||
| 1306 | for (i = 0; i < nfrags; i++) { | ||
| 1307 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | ||
| 1308 | int len = frag->size; | ||
| 1309 | |||
| 1310 | entry = (++priv->cur_tx) % txsize; | ||
| 1311 | desc = priv->dma_tx + entry; | ||
| 1312 | |||
| 1313 | TX_DBG("\t[entry %d] segment len: %d\n", entry, len); | ||
| 1314 | desc->des2 = dma_map_page(priv->device, frag->page, | ||
| 1315 | frag->page_offset, | ||
| 1316 | len, DMA_TO_DEVICE); | ||
| 1317 | priv->tx_skbuff[entry] = NULL; | ||
| 1318 | priv->mac_type->ops->prepare_tx_desc(desc, 0, len, | ||
| 1319 | csum_insertion); | ||
| 1320 | priv->mac_type->ops->set_tx_owner(desc); | ||
| 1321 | } | ||
| 1322 | |||
| 1323 | /* Interrupt on completition only for the latest segment */ | ||
| 1324 | priv->mac_type->ops->close_tx_desc(desc); | ||
| 1325 | #ifdef CONFIG_STMMAC_TIMER | ||
| 1326 | /* Clean IC while using timers */ | ||
| 1327 | priv->mac_type->ops->clear_tx_ic(desc); | ||
| 1328 | #endif | ||
| 1329 | /* To avoid raise condition */ | ||
| 1330 | priv->mac_type->ops->set_tx_owner(first); | ||
| 1331 | |||
| 1332 | priv->cur_tx++; | ||
| 1333 | |||
| 1334 | #ifdef STMMAC_XMIT_DEBUG | ||
| 1335 | if (netif_msg_pktdata(priv)) { | ||
| 1336 | pr_info("stmmac xmit: current=%d, dirty=%d, entry=%d, " | ||
| 1337 | "first=%p, nfrags=%d\n", | ||
| 1338 | (priv->cur_tx % txsize), (priv->dirty_tx % txsize), | ||
| 1339 | entry, first, nfrags); | ||
| 1340 | display_ring(priv->dma_tx, txsize); | ||
| 1341 | pr_info(">>> frame to be transmitted: "); | ||
| 1342 | print_pkt(skb->data, skb->len); | ||
| 1343 | } | ||
| 1344 | #endif | ||
| 1345 | if (unlikely(stmmac_tx_avail(priv) <= (MAX_SKB_FRAGS + 1))) { | ||
| 1346 | TX_DBG("%s: stop transmitted packets\n", __func__); | ||
| 1347 | netif_stop_queue(dev); | ||
| 1348 | } | ||
| 1349 | |||
| 1350 | dev->stats.tx_bytes += skb->len; | ||
| 1351 | |||
| 1352 | /* CSR1 enables the transmit DMA to check for new descriptor */ | ||
| 1353 | writel(1, dev->base_addr + DMA_XMT_POLL_DEMAND); | ||
| 1354 | |||
| 1355 | return NETDEV_TX_OK; | ||
| 1356 | } | ||
| 1357 | |||
| 1358 | static inline void stmmac_rx_refill(struct stmmac_priv *priv) | ||
| 1359 | { | ||
| 1360 | unsigned int rxsize = priv->dma_rx_size; | ||
| 1361 | int bfsize = priv->dma_buf_sz; | ||
| 1362 | struct dma_desc *p = priv->dma_rx; | ||
| 1363 | |||
| 1364 | for (; priv->cur_rx - priv->dirty_rx > 0; priv->dirty_rx++) { | ||
| 1365 | unsigned int entry = priv->dirty_rx % rxsize; | ||
| 1366 | if (likely(priv->rx_skbuff[entry] == NULL)) { | ||
| 1367 | struct sk_buff *skb; | ||
| 1368 | |||
| 1369 | skb = __skb_dequeue(&priv->rx_recycle); | ||
| 1370 | if (skb == NULL) | ||
| 1371 | skb = netdev_alloc_skb_ip_align(priv->dev, | ||
| 1372 | bfsize); | ||
| 1373 | |||
| 1374 | if (unlikely(skb == NULL)) | ||
| 1375 | break; | ||
| 1376 | |||
| 1377 | priv->rx_skbuff[entry] = skb; | ||
| 1378 | priv->rx_skbuff_dma[entry] = | ||
| 1379 | dma_map_single(priv->device, skb->data, bfsize, | ||
| 1380 | DMA_FROM_DEVICE); | ||
| 1381 | |||
| 1382 | (p + entry)->des2 = priv->rx_skbuff_dma[entry]; | ||
| 1383 | if (unlikely(priv->is_gmac)) { | ||
| 1384 | if (bfsize >= BUF_SIZE_8KiB) | ||
| 1385 | (p + entry)->des3 = | ||
| 1386 | (p + entry)->des2 + BUF_SIZE_8KiB; | ||
| 1387 | } | ||
| 1388 | RX_DBG(KERN_INFO "\trefill entry #%d\n", entry); | ||
| 1389 | } | ||
| 1390 | priv->mac_type->ops->set_rx_owner(p + entry); | ||
| 1391 | } | ||
| 1392 | return; | ||
| 1393 | } | ||
| 1394 | |||
| 1395 | static int stmmac_rx(struct stmmac_priv *priv, int limit) | ||
| 1396 | { | ||
| 1397 | unsigned int rxsize = priv->dma_rx_size; | ||
| 1398 | unsigned int entry = priv->cur_rx % rxsize; | ||
| 1399 | unsigned int next_entry; | ||
| 1400 | unsigned int count = 0; | ||
| 1401 | struct dma_desc *p = priv->dma_rx + entry; | ||
| 1402 | struct dma_desc *p_next; | ||
| 1403 | |||
| 1404 | #ifdef STMMAC_RX_DEBUG | ||
| 1405 | if (netif_msg_hw(priv)) { | ||
| 1406 | pr_debug(">>> stmmac_rx: descriptor ring:\n"); | ||
| 1407 | display_ring(priv->dma_rx, rxsize); | ||
| 1408 | } | ||
| 1409 | #endif | ||
| 1410 | count = 0; | ||
| 1411 | while (!priv->mac_type->ops->get_rx_owner(p)) { | ||
| 1412 | int status; | ||
| 1413 | |||
| 1414 | if (count >= limit) | ||
| 1415 | break; | ||
| 1416 | |||
| 1417 | count++; | ||
| 1418 | |||
| 1419 | next_entry = (++priv->cur_rx) % rxsize; | ||
| 1420 | p_next = priv->dma_rx + next_entry; | ||
| 1421 | prefetch(p_next); | ||
| 1422 | |||
| 1423 | /* read the status of the incoming frame */ | ||
| 1424 | status = (priv->mac_type->ops->rx_status(&priv->dev->stats, | ||
| 1425 | &priv->xstats, p)); | ||
| 1426 | if (unlikely(status == discard_frame)) | ||
| 1427 | priv->dev->stats.rx_errors++; | ||
| 1428 | else { | ||
| 1429 | struct sk_buff *skb; | ||
| 1430 | /* Length should omit the CRC */ | ||
| 1431 | int frame_len = | ||
| 1432 | priv->mac_type->ops->get_rx_frame_len(p) - 4; | ||
| 1433 | |||
| 1434 | #ifdef STMMAC_RX_DEBUG | ||
| 1435 | if (frame_len > ETH_FRAME_LEN) | ||
| 1436 | pr_debug("\tRX frame size %d, COE status: %d\n", | ||
| 1437 | frame_len, status); | ||
| 1438 | |||
| 1439 | if (netif_msg_hw(priv)) | ||
| 1440 | pr_debug("\tdesc: %p [entry %d] buff=0x%x\n", | ||
| 1441 | p, entry, p->des2); | ||
| 1442 | #endif | ||
| 1443 | skb = priv->rx_skbuff[entry]; | ||
| 1444 | if (unlikely(!skb)) { | ||
| 1445 | pr_err("%s: Inconsistent Rx descriptor chain\n", | ||
| 1446 | priv->dev->name); | ||
| 1447 | priv->dev->stats.rx_dropped++; | ||
| 1448 | break; | ||
| 1449 | } | ||
| 1450 | prefetch(skb->data - NET_IP_ALIGN); | ||
| 1451 | priv->rx_skbuff[entry] = NULL; | ||
| 1452 | |||
| 1453 | skb_put(skb, frame_len); | ||
| 1454 | dma_unmap_single(priv->device, | ||
| 1455 | priv->rx_skbuff_dma[entry], | ||
| 1456 | priv->dma_buf_sz, DMA_FROM_DEVICE); | ||
| 1457 | #ifdef STMMAC_RX_DEBUG | ||
| 1458 | if (netif_msg_pktdata(priv)) { | ||
| 1459 | pr_info(" frame received (%dbytes)", frame_len); | ||
| 1460 | print_pkt(skb->data, frame_len); | ||
| 1461 | } | ||
| 1462 | #endif | ||
| 1463 | skb->protocol = eth_type_trans(skb, priv->dev); | ||
| 1464 | |||
| 1465 | if (unlikely(status == csum_none)) { | ||
| 1466 | /* always for the old mac 10/100 */ | ||
| 1467 | skb->ip_summed = CHECKSUM_NONE; | ||
| 1468 | netif_receive_skb(skb); | ||
| 1469 | } else { | ||
| 1470 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 1471 | napi_gro_receive(&priv->napi, skb); | ||
| 1472 | } | ||
| 1473 | |||
| 1474 | priv->dev->stats.rx_packets++; | ||
| 1475 | priv->dev->stats.rx_bytes += frame_len; | ||
| 1476 | priv->dev->last_rx = jiffies; | ||
| 1477 | } | ||
| 1478 | entry = next_entry; | ||
| 1479 | p = p_next; /* use prefetched values */ | ||
| 1480 | } | ||
| 1481 | |||
| 1482 | stmmac_rx_refill(priv); | ||
| 1483 | |||
| 1484 | priv->xstats.rx_pkt_n += count; | ||
| 1485 | |||
| 1486 | return count; | ||
| 1487 | } | ||
| 1488 | |||
| 1489 | /** | ||
| 1490 | * stmmac_poll - stmmac poll method (NAPI) | ||
| 1491 | * @napi : pointer to the napi structure. | ||
| 1492 | * @budget : maximum number of packets that the current CPU can receive from | ||
| 1493 | * all interfaces. | ||
| 1494 | * Description : | ||
| 1495 | * This function implements the the reception process. | ||
| 1496 | * Also it runs the TX completion thread | ||
| 1497 | */ | ||
| 1498 | static int stmmac_poll(struct napi_struct *napi, int budget) | ||
| 1499 | { | ||
| 1500 | struct stmmac_priv *priv = container_of(napi, struct stmmac_priv, napi); | ||
| 1501 | int work_done = 0; | ||
| 1502 | |||
| 1503 | priv->xstats.poll_n++; | ||
| 1504 | stmmac_tx(priv); | ||
| 1505 | work_done = stmmac_rx(priv, budget); | ||
| 1506 | |||
| 1507 | if (work_done < budget) { | ||
| 1508 | napi_complete(napi); | ||
| 1509 | stmmac_enable_irq(priv); | ||
| 1510 | } | ||
| 1511 | return work_done; | ||
| 1512 | } | ||
| 1513 | |||
| 1514 | /** | ||
| 1515 | * stmmac_tx_timeout | ||
| 1516 | * @dev : Pointer to net device structure | ||
| 1517 | * Description: this function is called when a packet transmission fails to | ||
| 1518 | * complete within a reasonable tmrate. The driver will mark the error in the | ||
| 1519 | * netdev structure and arrange for the device to be reset to a sane state | ||
| 1520 | * in order to transmit a new packet. | ||
| 1521 | */ | ||
| 1522 | static void stmmac_tx_timeout(struct net_device *dev) | ||
| 1523 | { | ||
| 1524 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1525 | |||
| 1526 | /* Clear Tx resources and restart transmitting again */ | ||
| 1527 | stmmac_tx_err(priv); | ||
| 1528 | return; | ||
| 1529 | } | ||
| 1530 | |||
| 1531 | /* Configuration changes (passed on by ifconfig) */ | ||
| 1532 | static int stmmac_config(struct net_device *dev, struct ifmap *map) | ||
| 1533 | { | ||
| 1534 | if (dev->flags & IFF_UP) /* can't act on a running interface */ | ||
| 1535 | return -EBUSY; | ||
| 1536 | |||
| 1537 | /* Don't allow changing the I/O address */ | ||
| 1538 | if (map->base_addr != dev->base_addr) { | ||
| 1539 | pr_warning("%s: can't change I/O address\n", dev->name); | ||
| 1540 | return -EOPNOTSUPP; | ||
| 1541 | } | ||
| 1542 | |||
| 1543 | /* Don't allow changing the IRQ */ | ||
| 1544 | if (map->irq != dev->irq) { | ||
| 1545 | pr_warning("%s: can't change IRQ number %d\n", | ||
| 1546 | dev->name, dev->irq); | ||
| 1547 | return -EOPNOTSUPP; | ||
| 1548 | } | ||
| 1549 | |||
| 1550 | /* ignore other fields */ | ||
| 1551 | return 0; | ||
| 1552 | } | ||
| 1553 | |||
| 1554 | /** | ||
| 1555 | * stmmac_multicast_list - entry point for multicast addressing | ||
| 1556 | * @dev : pointer to the device structure | ||
| 1557 | * Description: | ||
| 1558 | * This function is a driver entry point which gets called by the kernel | ||
| 1559 | * whenever multicast addresses must be enabled/disabled. | ||
| 1560 | * Return value: | ||
| 1561 | * void. | ||
| 1562 | */ | ||
| 1563 | static void stmmac_multicast_list(struct net_device *dev) | ||
| 1564 | { | ||
| 1565 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1566 | |||
| 1567 | spin_lock(&priv->lock); | ||
| 1568 | priv->mac_type->ops->set_filter(dev); | ||
| 1569 | spin_unlock(&priv->lock); | ||
| 1570 | return; | ||
| 1571 | } | ||
| 1572 | |||
| 1573 | /** | ||
| 1574 | * stmmac_change_mtu - entry point to change MTU size for the device. | ||
| 1575 | * @dev : device pointer. | ||
| 1576 | * @new_mtu : the new MTU size for the device. | ||
| 1577 | * Description: the Maximum Transfer Unit (MTU) is used by the network layer | ||
| 1578 | * to drive packet transmission. Ethernet has an MTU of 1500 octets | ||
| 1579 | * (ETH_DATA_LEN). This value can be changed with ifconfig. | ||
| 1580 | * Return value: | ||
| 1581 | * 0 on success and an appropriate (-)ve integer as defined in errno.h | ||
| 1582 | * file on failure. | ||
| 1583 | */ | ||
| 1584 | static int stmmac_change_mtu(struct net_device *dev, int new_mtu) | ||
| 1585 | { | ||
| 1586 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1587 | int max_mtu; | ||
| 1588 | |||
| 1589 | if (netif_running(dev)) { | ||
| 1590 | pr_err("%s: must be stopped to change its MTU\n", dev->name); | ||
| 1591 | return -EBUSY; | ||
| 1592 | } | ||
| 1593 | |||
| 1594 | if (priv->is_gmac) | ||
| 1595 | max_mtu = JUMBO_LEN; | ||
| 1596 | else | ||
| 1597 | max_mtu = ETH_DATA_LEN; | ||
| 1598 | |||
| 1599 | if ((new_mtu < 46) || (new_mtu > max_mtu)) { | ||
| 1600 | pr_err("%s: invalid MTU, max MTU is: %d\n", dev->name, max_mtu); | ||
| 1601 | return -EINVAL; | ||
| 1602 | } | ||
| 1603 | |||
| 1604 | dev->mtu = new_mtu; | ||
| 1605 | |||
| 1606 | return 0; | ||
| 1607 | } | ||
| 1608 | |||
| 1609 | static irqreturn_t stmmac_interrupt(int irq, void *dev_id) | ||
| 1610 | { | ||
| 1611 | struct net_device *dev = (struct net_device *)dev_id; | ||
| 1612 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1613 | |||
| 1614 | if (unlikely(!dev)) { | ||
| 1615 | pr_err("%s: invalid dev pointer\n", __func__); | ||
| 1616 | return IRQ_NONE; | ||
| 1617 | } | ||
| 1618 | |||
| 1619 | if (priv->is_gmac) { | ||
| 1620 | unsigned long ioaddr = dev->base_addr; | ||
| 1621 | /* To handle GMAC own interrupts */ | ||
| 1622 | priv->mac_type->ops->host_irq_status(ioaddr); | ||
| 1623 | } | ||
| 1624 | stmmac_dma_interrupt(dev); | ||
| 1625 | |||
| 1626 | return IRQ_HANDLED; | ||
| 1627 | } | ||
| 1628 | |||
| 1629 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 1630 | /* Polling receive - used by NETCONSOLE and other diagnostic tools | ||
| 1631 | * to allow network I/O with interrupts disabled. */ | ||
| 1632 | static void stmmac_poll_controller(struct net_device *dev) | ||
| 1633 | { | ||
| 1634 | disable_irq(dev->irq); | ||
| 1635 | stmmac_interrupt(dev->irq, dev); | ||
| 1636 | enable_irq(dev->irq); | ||
| 1637 | } | ||
| 1638 | #endif | ||
| 1639 | |||
| 1640 | /** | ||
| 1641 | * stmmac_ioctl - Entry point for the Ioctl | ||
| 1642 | * @dev: Device pointer. | ||
| 1643 | * @rq: An IOCTL specefic structure, that can contain a pointer to | ||
| 1644 | * a proprietary structure used to pass information to the driver. | ||
| 1645 | * @cmd: IOCTL command | ||
| 1646 | * Description: | ||
| 1647 | * Currently there are no special functionality supported in IOCTL, just the | ||
| 1648 | * phy_mii_ioctl(...) can be invoked. | ||
| 1649 | */ | ||
| 1650 | static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | ||
| 1651 | { | ||
| 1652 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1653 | int ret = -EOPNOTSUPP; | ||
| 1654 | |||
| 1655 | if (!netif_running(dev)) | ||
| 1656 | return -EINVAL; | ||
| 1657 | |||
| 1658 | switch (cmd) { | ||
| 1659 | case SIOCGMIIPHY: | ||
| 1660 | case SIOCGMIIREG: | ||
| 1661 | case SIOCSMIIREG: | ||
| 1662 | if (!priv->phydev) | ||
| 1663 | return -EINVAL; | ||
| 1664 | |||
| 1665 | spin_lock(&priv->lock); | ||
| 1666 | ret = phy_mii_ioctl(priv->phydev, if_mii(rq), cmd); | ||
| 1667 | spin_unlock(&priv->lock); | ||
| 1668 | default: | ||
| 1669 | break; | ||
| 1670 | } | ||
| 1671 | return ret; | ||
| 1672 | } | ||
| 1673 | |||
| 1674 | #ifdef STMMAC_VLAN_TAG_USED | ||
| 1675 | static void stmmac_vlan_rx_register(struct net_device *dev, | ||
| 1676 | struct vlan_group *grp) | ||
| 1677 | { | ||
| 1678 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1679 | |||
| 1680 | DBG(probe, INFO, "%s: Setting vlgrp to %p\n", dev->name, grp); | ||
| 1681 | |||
| 1682 | spin_lock(&priv->lock); | ||
| 1683 | priv->vlgrp = grp; | ||
| 1684 | spin_unlock(&priv->lock); | ||
| 1685 | |||
| 1686 | return; | ||
| 1687 | } | ||
| 1688 | #endif | ||
| 1689 | |||
| 1690 | static const struct net_device_ops stmmac_netdev_ops = { | ||
| 1691 | .ndo_open = stmmac_open, | ||
| 1692 | .ndo_start_xmit = stmmac_xmit, | ||
| 1693 | .ndo_stop = stmmac_release, | ||
| 1694 | .ndo_change_mtu = stmmac_change_mtu, | ||
| 1695 | .ndo_set_multicast_list = stmmac_multicast_list, | ||
| 1696 | .ndo_tx_timeout = stmmac_tx_timeout, | ||
| 1697 | .ndo_do_ioctl = stmmac_ioctl, | ||
| 1698 | .ndo_set_config = stmmac_config, | ||
| 1699 | #ifdef STMMAC_VLAN_TAG_USED | ||
| 1700 | .ndo_vlan_rx_register = stmmac_vlan_rx_register, | ||
| 1701 | #endif | ||
| 1702 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 1703 | .ndo_poll_controller = stmmac_poll_controller, | ||
| 1704 | #endif | ||
| 1705 | .ndo_set_mac_address = eth_mac_addr, | ||
| 1706 | }; | ||
| 1707 | |||
| 1708 | /** | ||
| 1709 | * stmmac_probe - Initialization of the adapter . | ||
| 1710 | * @dev : device pointer | ||
| 1711 | * Description: The function initializes the network device structure for | ||
| 1712 | * the STMMAC driver. It also calls the low level routines | ||
| 1713 | * in order to init the HW (i.e. the DMA engine) | ||
| 1714 | */ | ||
| 1715 | static int stmmac_probe(struct net_device *dev) | ||
| 1716 | { | ||
| 1717 | int ret = 0; | ||
| 1718 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1719 | |||
| 1720 | ether_setup(dev); | ||
| 1721 | |||
| 1722 | dev->netdev_ops = &stmmac_netdev_ops; | ||
| 1723 | stmmac_set_ethtool_ops(dev); | ||
| 1724 | |||
| 1725 | dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA); | ||
| 1726 | dev->watchdog_timeo = msecs_to_jiffies(watchdog); | ||
| 1727 | #ifdef STMMAC_VLAN_TAG_USED | ||
| 1728 | /* Both mac100 and gmac support receive VLAN tag detection */ | ||
| 1729 | dev->features |= NETIF_F_HW_VLAN_RX; | ||
| 1730 | #endif | ||
| 1731 | priv->msg_enable = netif_msg_init(debug, default_msg_level); | ||
| 1732 | |||
| 1733 | if (priv->is_gmac) | ||
| 1734 | priv->rx_csum = 1; | ||
| 1735 | |||
| 1736 | if (flow_ctrl) | ||
| 1737 | priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */ | ||
| 1738 | |||
| 1739 | priv->pause = pause; | ||
| 1740 | netif_napi_add(dev, &priv->napi, stmmac_poll, 64); | ||
| 1741 | |||
| 1742 | /* Get the MAC address */ | ||
| 1743 | priv->mac_type->ops->get_umac_addr(dev->base_addr, dev->dev_addr, 0); | ||
| 1744 | |||
| 1745 | if (!is_valid_ether_addr(dev->dev_addr)) | ||
| 1746 | pr_warning("\tno valid MAC address;" | ||
| 1747 | "please, use ifconfig or nwhwconfig!\n"); | ||
| 1748 | |||
| 1749 | ret = register_netdev(dev); | ||
| 1750 | if (ret) { | ||
| 1751 | pr_err("%s: ERROR %i registering the device\n", | ||
| 1752 | __func__, ret); | ||
| 1753 | return -ENODEV; | ||
| 1754 | } | ||
| 1755 | |||
| 1756 | DBG(probe, DEBUG, "%s: Scatter/Gather: %s - HW checksums: %s\n", | ||
| 1757 | dev->name, (dev->features & NETIF_F_SG) ? "on" : "off", | ||
| 1758 | (dev->features & NETIF_F_HW_CSUM) ? "on" : "off"); | ||
| 1759 | |||
| 1760 | spin_lock_init(&priv->lock); | ||
| 1761 | |||
| 1762 | return ret; | ||
| 1763 | } | ||
| 1764 | |||
| 1765 | /** | ||
| 1766 | * stmmac_mac_device_setup | ||
| 1767 | * @dev : device pointer | ||
| 1768 | * Description: select and initialise the mac device (mac100 or Gmac). | ||
| 1769 | */ | ||
| 1770 | static int stmmac_mac_device_setup(struct net_device *dev) | ||
| 1771 | { | ||
| 1772 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 1773 | unsigned long ioaddr = dev->base_addr; | ||
| 1774 | |||
| 1775 | struct mac_device_info *device; | ||
| 1776 | |||
| 1777 | if (priv->is_gmac) | ||
| 1778 | device = gmac_setup(ioaddr); | ||
| 1779 | else | ||
| 1780 | device = mac100_setup(ioaddr); | ||
| 1781 | |||
| 1782 | if (!device) | ||
| 1783 | return -ENOMEM; | ||
| 1784 | |||
| 1785 | priv->mac_type = device; | ||
| 1786 | |||
| 1787 | priv->wolenabled = priv->mac_type->hw.pmt; /* PMT supported */ | ||
| 1788 | if (priv->wolenabled == PMT_SUPPORTED) | ||
| 1789 | priv->wolopts = WAKE_MAGIC; /* Magic Frame */ | ||
| 1790 | |||
| 1791 | return 0; | ||
| 1792 | } | ||
| 1793 | |||
| 1794 | static int stmmacphy_dvr_probe(struct platform_device *pdev) | ||
| 1795 | { | ||
| 1796 | struct plat_stmmacphy_data *plat_dat; | ||
| 1797 | plat_dat = (struct plat_stmmacphy_data *)((pdev->dev).platform_data); | ||
| 1798 | |||
| 1799 | pr_debug("stmmacphy_dvr_probe: added phy for bus %d\n", | ||
| 1800 | plat_dat->bus_id); | ||
| 1801 | |||
| 1802 | return 0; | ||
| 1803 | } | ||
| 1804 | |||
| 1805 | static int stmmacphy_dvr_remove(struct platform_device *pdev) | ||
| 1806 | { | ||
| 1807 | return 0; | ||
| 1808 | } | ||
| 1809 | |||
| 1810 | static struct platform_driver stmmacphy_driver = { | ||
| 1811 | .driver = { | ||
| 1812 | .name = PHY_RESOURCE_NAME, | ||
| 1813 | }, | ||
| 1814 | .probe = stmmacphy_dvr_probe, | ||
| 1815 | .remove = stmmacphy_dvr_remove, | ||
| 1816 | }; | ||
| 1817 | |||
| 1818 | /** | ||
| 1819 | * stmmac_associate_phy | ||
| 1820 | * @dev: pointer to device structure | ||
| 1821 | * @data: points to the private structure. | ||
| 1822 | * Description: Scans through all the PHYs we have registered and checks if | ||
| 1823 | * any are associated with our MAC. If so, then just fill in | ||
| 1824 | * the blanks in our local context structure | ||
| 1825 | */ | ||
| 1826 | static int stmmac_associate_phy(struct device *dev, void *data) | ||
| 1827 | { | ||
| 1828 | struct stmmac_priv *priv = (struct stmmac_priv *)data; | ||
| 1829 | struct plat_stmmacphy_data *plat_dat; | ||
| 1830 | |||
| 1831 | plat_dat = (struct plat_stmmacphy_data *)(dev->platform_data); | ||
| 1832 | |||
| 1833 | DBG(probe, DEBUG, "%s: checking phy for bus %d\n", __func__, | ||
| 1834 | plat_dat->bus_id); | ||
| 1835 | |||
| 1836 | /* Check that this phy is for the MAC being initialised */ | ||
| 1837 | if (priv->bus_id != plat_dat->bus_id) | ||
| 1838 | return 0; | ||
| 1839 | |||
| 1840 | /* OK, this PHY is connected to the MAC. | ||
| 1841 | Go ahead and get the parameters */ | ||
| 1842 | DBG(probe, DEBUG, "%s: OK. Found PHY config\n", __func__); | ||
| 1843 | priv->phy_irq = | ||
| 1844 | platform_get_irq_byname(to_platform_device(dev), "phyirq"); | ||
| 1845 | DBG(probe, DEBUG, "%s: PHY irq on bus %d is %d\n", __func__, | ||
| 1846 | plat_dat->bus_id, priv->phy_irq); | ||
| 1847 | |||
| 1848 | /* Override with kernel parameters if supplied XXX CRS XXX | ||
| 1849 | * this needs to have multiple instances */ | ||
| 1850 | if ((phyaddr >= 0) && (phyaddr <= 31)) | ||
| 1851 | plat_dat->phy_addr = phyaddr; | ||
| 1852 | |||
| 1853 | priv->phy_addr = plat_dat->phy_addr; | ||
| 1854 | priv->phy_mask = plat_dat->phy_mask; | ||
| 1855 | priv->phy_interface = plat_dat->interface; | ||
| 1856 | priv->phy_reset = plat_dat->phy_reset; | ||
| 1857 | |||
| 1858 | DBG(probe, DEBUG, "%s: exiting\n", __func__); | ||
| 1859 | return 1; /* forces exit of driver_for_each_device() */ | ||
| 1860 | } | ||
| 1861 | |||
| 1862 | /** | ||
| 1863 | * stmmac_dvr_probe | ||
| 1864 | * @pdev: platform device pointer | ||
| 1865 | * Description: the driver is initialized through platform_device. | ||
| 1866 | */ | ||
| 1867 | static int stmmac_dvr_probe(struct platform_device *pdev) | ||
| 1868 | { | ||
| 1869 | int ret = 0; | ||
| 1870 | struct resource *res; | ||
| 1871 | unsigned int *addr = NULL; | ||
| 1872 | struct net_device *ndev = NULL; | ||
| 1873 | struct stmmac_priv *priv; | ||
| 1874 | struct plat_stmmacenet_data *plat_dat; | ||
| 1875 | |||
| 1876 | pr_info("STMMAC driver:\n\tplatform registration... "); | ||
| 1877 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 1878 | if (!res) { | ||
| 1879 | ret = -ENODEV; | ||
| 1880 | goto out; | ||
| 1881 | } | ||
| 1882 | pr_info("done!\n"); | ||
| 1883 | |||
| 1884 | if (!request_mem_region(res->start, (res->end - res->start), | ||
| 1885 | pdev->name)) { | ||
| 1886 | pr_err("%s: ERROR: memory allocation failed" | ||
| 1887 | "cannot get the I/O addr 0x%x\n", | ||
| 1888 | __func__, (unsigned int)res->start); | ||
| 1889 | ret = -EBUSY; | ||
| 1890 | goto out; | ||
| 1891 | } | ||
| 1892 | |||
| 1893 | addr = ioremap(res->start, (res->end - res->start)); | ||
| 1894 | if (!addr) { | ||
| 1895 | pr_err("%s: ERROR: memory mapping failed \n", __func__); | ||
| 1896 | ret = -ENOMEM; | ||
| 1897 | goto out; | ||
| 1898 | } | ||
| 1899 | |||
| 1900 | ndev = alloc_etherdev(sizeof(struct stmmac_priv)); | ||
| 1901 | if (!ndev) { | ||
| 1902 | pr_err("%s: ERROR: allocating the device\n", __func__); | ||
| 1903 | ret = -ENOMEM; | ||
| 1904 | goto out; | ||
| 1905 | } | ||
| 1906 | |||
| 1907 | SET_NETDEV_DEV(ndev, &pdev->dev); | ||
| 1908 | |||
| 1909 | /* Get the MAC information */ | ||
| 1910 | ndev->irq = platform_get_irq_byname(pdev, "macirq"); | ||
| 1911 | if (ndev->irq == -ENXIO) { | ||
| 1912 | pr_err("%s: ERROR: MAC IRQ configuration " | ||
| 1913 | "information not found\n", __func__); | ||
| 1914 | ret = -ENODEV; | ||
| 1915 | goto out; | ||
| 1916 | } | ||
| 1917 | |||
| 1918 | priv = netdev_priv(ndev); | ||
| 1919 | priv->device = &(pdev->dev); | ||
| 1920 | priv->dev = ndev; | ||
| 1921 | plat_dat = (struct plat_stmmacenet_data *)((pdev->dev).platform_data); | ||
| 1922 | priv->bus_id = plat_dat->bus_id; | ||
| 1923 | priv->pbl = plat_dat->pbl; /* TLI */ | ||
| 1924 | priv->is_gmac = plat_dat->has_gmac; /* GMAC is on board */ | ||
| 1925 | |||
| 1926 | platform_set_drvdata(pdev, ndev); | ||
| 1927 | |||
| 1928 | /* Set the I/O base addr */ | ||
| 1929 | ndev->base_addr = (unsigned long)addr; | ||
| 1930 | |||
| 1931 | /* MAC HW revice detection */ | ||
| 1932 | ret = stmmac_mac_device_setup(ndev); | ||
| 1933 | if (ret < 0) | ||
| 1934 | goto out; | ||
| 1935 | |||
| 1936 | /* Network Device Registration */ | ||
| 1937 | ret = stmmac_probe(ndev); | ||
| 1938 | if (ret < 0) | ||
| 1939 | goto out; | ||
| 1940 | |||
| 1941 | /* associate a PHY - it is provided by another platform bus */ | ||
| 1942 | if (!driver_for_each_device | ||
| 1943 | (&(stmmacphy_driver.driver), NULL, (void *)priv, | ||
| 1944 | stmmac_associate_phy)) { | ||
| 1945 | pr_err("No PHY device is associated with this MAC!\n"); | ||
| 1946 | ret = -ENODEV; | ||
| 1947 | goto out; | ||
| 1948 | } | ||
| 1949 | |||
| 1950 | priv->fix_mac_speed = plat_dat->fix_mac_speed; | ||
| 1951 | priv->bsp_priv = plat_dat->bsp_priv; | ||
| 1952 | |||
| 1953 | pr_info("\t%s - (dev. name: %s - id: %d, IRQ #%d\n" | ||
| 1954 | "\tIO base addr: 0x%08x)\n", ndev->name, pdev->name, | ||
| 1955 | pdev->id, ndev->irq, (unsigned int)addr); | ||
| 1956 | |||
| 1957 | /* MDIO bus Registration */ | ||
| 1958 | pr_debug("\tMDIO bus (id: %d)...", priv->bus_id); | ||
| 1959 | ret = stmmac_mdio_register(ndev); | ||
| 1960 | if (ret < 0) | ||
| 1961 | goto out; | ||
| 1962 | pr_debug("registered!\n"); | ||
| 1963 | |||
| 1964 | out: | ||
| 1965 | if (ret < 0) { | ||
| 1966 | platform_set_drvdata(pdev, NULL); | ||
| 1967 | release_mem_region(res->start, (res->end - res->start)); | ||
| 1968 | if (addr != NULL) | ||
| 1969 | iounmap(addr); | ||
| 1970 | } | ||
| 1971 | |||
| 1972 | return ret; | ||
| 1973 | } | ||
| 1974 | |||
| 1975 | /** | ||
| 1976 | * stmmac_dvr_remove | ||
| 1977 | * @pdev: platform device pointer | ||
| 1978 | * Description: this function resets the TX/RX processes, disables the MAC RX/TX | ||
| 1979 | * changes the link status, releases the DMA descriptor rings, | ||
| 1980 | * unregisters the MDIO bus and unmaps the allocated memory. | ||
| 1981 | */ | ||
| 1982 | static int stmmac_dvr_remove(struct platform_device *pdev) | ||
| 1983 | { | ||
| 1984 | struct net_device *ndev = platform_get_drvdata(pdev); | ||
| 1985 | struct resource *res; | ||
| 1986 | |||
| 1987 | pr_info("%s:\n\tremoving driver", __func__); | ||
| 1988 | |||
| 1989 | stmmac_dma_stop_rx(ndev->base_addr); | ||
| 1990 | stmmac_dma_stop_tx(ndev->base_addr); | ||
| 1991 | |||
| 1992 | stmmac_mac_disable_rx(ndev->base_addr); | ||
| 1993 | stmmac_mac_disable_tx(ndev->base_addr); | ||
| 1994 | |||
| 1995 | netif_carrier_off(ndev); | ||
| 1996 | |||
| 1997 | stmmac_mdio_unregister(ndev); | ||
| 1998 | |||
| 1999 | platform_set_drvdata(pdev, NULL); | ||
| 2000 | unregister_netdev(ndev); | ||
| 2001 | |||
| 2002 | iounmap((void *)ndev->base_addr); | ||
| 2003 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 2004 | release_mem_region(res->start, (res->end - res->start)); | ||
| 2005 | |||
| 2006 | free_netdev(ndev); | ||
| 2007 | |||
| 2008 | return 0; | ||
| 2009 | } | ||
| 2010 | |||
| 2011 | #ifdef CONFIG_PM | ||
| 2012 | static int stmmac_suspend(struct platform_device *pdev, pm_message_t state) | ||
| 2013 | { | ||
| 2014 | struct net_device *dev = platform_get_drvdata(pdev); | ||
| 2015 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 2016 | int dis_ic = 0; | ||
| 2017 | |||
| 2018 | if (!dev || !netif_running(dev)) | ||
| 2019 | return 0; | ||
| 2020 | |||
| 2021 | spin_lock(&priv->lock); | ||
| 2022 | |||
| 2023 | if (state.event == PM_EVENT_SUSPEND) { | ||
| 2024 | netif_device_detach(dev); | ||
| 2025 | netif_stop_queue(dev); | ||
| 2026 | if (priv->phydev) | ||
| 2027 | phy_stop(priv->phydev); | ||
| 2028 | |||
| 2029 | #ifdef CONFIG_STMMAC_TIMER | ||
| 2030 | priv->tm->timer_stop(); | ||
| 2031 | dis_ic = 1; | ||
| 2032 | #endif | ||
| 2033 | napi_disable(&priv->napi); | ||
| 2034 | |||
| 2035 | /* Stop TX/RX DMA */ | ||
| 2036 | stmmac_dma_stop_tx(dev->base_addr); | ||
| 2037 | stmmac_dma_stop_rx(dev->base_addr); | ||
| 2038 | /* Clear the Rx/Tx descriptors */ | ||
| 2039 | priv->mac_type->ops->init_rx_desc(priv->dma_rx, | ||
| 2040 | priv->dma_rx_size, dis_ic); | ||
| 2041 | priv->mac_type->ops->init_tx_desc(priv->dma_tx, | ||
| 2042 | priv->dma_tx_size); | ||
| 2043 | |||
| 2044 | stmmac_mac_disable_tx(dev->base_addr); | ||
| 2045 | |||
| 2046 | if (device_may_wakeup(&(pdev->dev))) { | ||
| 2047 | /* Enable Power down mode by programming the PMT regs */ | ||
| 2048 | if (priv->wolenabled == PMT_SUPPORTED) | ||
| 2049 | priv->mac_type->ops->pmt(dev->base_addr, | ||
| 2050 | priv->wolopts); | ||
| 2051 | } else { | ||
| 2052 | stmmac_mac_disable_rx(dev->base_addr); | ||
| 2053 | } | ||
| 2054 | } else { | ||
| 2055 | priv->shutdown = 1; | ||
| 2056 | /* Although this can appear slightly redundant it actually | ||
| 2057 | * makes fast the standby operation and guarantees the driver | ||
| 2058 | * working if hibernation is on media. */ | ||
| 2059 | stmmac_release(dev); | ||
| 2060 | } | ||
| 2061 | |||
| 2062 | spin_unlock(&priv->lock); | ||
| 2063 | return 0; | ||
| 2064 | } | ||
| 2065 | |||
| 2066 | static int stmmac_resume(struct platform_device *pdev) | ||
| 2067 | { | ||
| 2068 | struct net_device *dev = platform_get_drvdata(pdev); | ||
| 2069 | struct stmmac_priv *priv = netdev_priv(dev); | ||
| 2070 | unsigned long ioaddr = dev->base_addr; | ||
| 2071 | |||
| 2072 | if (!netif_running(dev)) | ||
| 2073 | return 0; | ||
| 2074 | |||
| 2075 | spin_lock(&priv->lock); | ||
| 2076 | |||
| 2077 | if (priv->shutdown) { | ||
| 2078 | /* Re-open the interface and re-init the MAC/DMA | ||
| 2079 | and the rings. */ | ||
| 2080 | stmmac_open(dev); | ||
| 2081 | goto out_resume; | ||
| 2082 | } | ||
| 2083 | |||
| 2084 | /* Power Down bit, into the PM register, is cleared | ||
| 2085 | * automatically as soon as a magic packet or a Wake-up frame | ||
| 2086 | * is received. Anyway, it's better to manually clear | ||
| 2087 | * this bit because it can generate problems while resuming | ||
| 2088 | * from another devices (e.g. serial console). */ | ||
| 2089 | if (device_may_wakeup(&(pdev->dev))) | ||
| 2090 | if (priv->wolenabled == PMT_SUPPORTED) | ||
| 2091 | priv->mac_type->ops->pmt(dev->base_addr, 0); | ||
| 2092 | |||
| 2093 | netif_device_attach(dev); | ||
| 2094 | |||
| 2095 | /* Enable the MAC and DMA */ | ||
| 2096 | stmmac_mac_enable_rx(ioaddr); | ||
| 2097 | stmmac_mac_enable_tx(ioaddr); | ||
| 2098 | stmmac_dma_start_tx(ioaddr); | ||
| 2099 | stmmac_dma_start_rx(ioaddr); | ||
| 2100 | |||
| 2101 | #ifdef CONFIG_STMMAC_TIMER | ||
| 2102 | priv->tm->timer_start(tmrate); | ||
| 2103 | #endif | ||
| 2104 | napi_enable(&priv->napi); | ||
| 2105 | |||
| 2106 | if (priv->phydev) | ||
| 2107 | phy_start(priv->phydev); | ||
| 2108 | |||
| 2109 | netif_start_queue(dev); | ||
| 2110 | |||
| 2111 | out_resume: | ||
| 2112 | spin_unlock(&priv->lock); | ||
| 2113 | return 0; | ||
| 2114 | } | ||
| 2115 | #endif | ||
| 2116 | |||
| 2117 | static struct platform_driver stmmac_driver = { | ||
| 2118 | .driver = { | ||
| 2119 | .name = STMMAC_RESOURCE_NAME, | ||
| 2120 | }, | ||
| 2121 | .probe = stmmac_dvr_probe, | ||
| 2122 | .remove = stmmac_dvr_remove, | ||
| 2123 | #ifdef CONFIG_PM | ||
| 2124 | .suspend = stmmac_suspend, | ||
| 2125 | .resume = stmmac_resume, | ||
| 2126 | #endif | ||
| 2127 | |||
| 2128 | }; | ||
| 2129 | |||
| 2130 | /** | ||
| 2131 | * stmmac_init_module - Entry point for the driver | ||
| 2132 | * Description: This function is the entry point for the driver. | ||
| 2133 | */ | ||
| 2134 | static int __init stmmac_init_module(void) | ||
| 2135 | { | ||
| 2136 | int ret; | ||
| 2137 | |||
| 2138 | if (platform_driver_register(&stmmacphy_driver)) { | ||
| 2139 | pr_err("No PHY devices registered!\n"); | ||
| 2140 | return -ENODEV; | ||
| 2141 | } | ||
| 2142 | |||
| 2143 | ret = platform_driver_register(&stmmac_driver); | ||
| 2144 | return ret; | ||
| 2145 | } | ||
| 2146 | |||
| 2147 | /** | ||
| 2148 | * stmmac_cleanup_module - Cleanup routine for the driver | ||
| 2149 | * Description: This function is the cleanup routine for the driver. | ||
| 2150 | */ | ||
| 2151 | static void __exit stmmac_cleanup_module(void) | ||
| 2152 | { | ||
| 2153 | platform_driver_unregister(&stmmacphy_driver); | ||
| 2154 | platform_driver_unregister(&stmmac_driver); | ||
| 2155 | } | ||
| 2156 | |||
| 2157 | #ifndef MODULE | ||
| 2158 | static int __init stmmac_cmdline_opt(char *str) | ||
| 2159 | { | ||
| 2160 | char *opt; | ||
| 2161 | |||
| 2162 | if (!str || !*str) | ||
| 2163 | return -EINVAL; | ||
| 2164 | while ((opt = strsep(&str, ",")) != NULL) { | ||
| 2165 | if (!strncmp(opt, "debug:", 6)) | ||
| 2166 | strict_strtoul(opt + 6, 0, (unsigned long *)&debug); | ||
| 2167 | else if (!strncmp(opt, "phyaddr:", 8)) | ||
| 2168 | strict_strtoul(opt + 8, 0, (unsigned long *)&phyaddr); | ||
| 2169 | else if (!strncmp(opt, "dma_txsize:", 11)) | ||
| 2170 | strict_strtoul(opt + 11, 0, | ||
| 2171 | (unsigned long *)&dma_txsize); | ||
| 2172 | else if (!strncmp(opt, "dma_rxsize:", 11)) | ||
| 2173 | strict_strtoul(opt + 11, 0, | ||
| 2174 | (unsigned long *)&dma_rxsize); | ||
| 2175 | else if (!strncmp(opt, "buf_sz:", 7)) | ||
| 2176 | strict_strtoul(opt + 7, 0, (unsigned long *)&buf_sz); | ||
| 2177 | else if (!strncmp(opt, "tc:", 3)) | ||
| 2178 | strict_strtoul(opt + 3, 0, (unsigned long *)&tc); | ||
| 2179 | else if (!strncmp(opt, "tx_coe:", 7)) | ||
| 2180 | strict_strtoul(opt + 7, 0, (unsigned long *)&tx_coe); | ||
| 2181 | else if (!strncmp(opt, "watchdog:", 9)) | ||
| 2182 | strict_strtoul(opt + 9, 0, (unsigned long *)&watchdog); | ||
| 2183 | else if (!strncmp(opt, "flow_ctrl:", 10)) | ||
| 2184 | strict_strtoul(opt + 10, 0, | ||
| 2185 | (unsigned long *)&flow_ctrl); | ||
| 2186 | else if (!strncmp(opt, "pause:", 6)) | ||
| 2187 | strict_strtoul(opt + 6, 0, (unsigned long *)&pause); | ||
| 2188 | #ifdef CONFIG_STMMAC_TIMER | ||
| 2189 | else if (!strncmp(opt, "tmrate:", 7)) | ||
| 2190 | strict_strtoul(opt + 7, 0, (unsigned long *)&tmrate); | ||
| 2191 | #endif | ||
| 2192 | } | ||
| 2193 | return 0; | ||
| 2194 | } | ||
| 2195 | |||
| 2196 | __setup("stmmaceth=", stmmac_cmdline_opt); | ||
| 2197 | #endif | ||
| 2198 | |||
| 2199 | module_init(stmmac_init_module); | ||
| 2200 | module_exit(stmmac_cleanup_module); | ||
| 2201 | |||
| 2202 | MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet driver"); | ||
| 2203 | MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); | ||
| 2204 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/stmmac/stmmac_mdio.c b/drivers/net/stmmac/stmmac_mdio.c new file mode 100644 index 000000000000..8498552a22fc --- /dev/null +++ b/drivers/net/stmmac/stmmac_mdio.c | |||
| @@ -0,0 +1,217 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | STMMAC Ethernet Driver -- MDIO bus implementation | ||
| 3 | Provides Bus interface for MII registers | ||
| 4 | |||
| 5 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 6 | |||
| 7 | This program is free software; you can redistribute it and/or modify it | ||
| 8 | under the terms and conditions of the GNU General Public License, | ||
| 9 | version 2, as published by the Free Software Foundation. | ||
| 10 | |||
| 11 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 14 | more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License along with | ||
| 17 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 18 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | |||
| 20 | The full GNU General Public License is included in this distribution in | ||
| 21 | the file called "COPYING". | ||
| 22 | |||
| 23 | Author: Carl Shaw <carl.shaw@st.com> | ||
| 24 | Maintainer: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 25 | *******************************************************************************/ | ||
| 26 | |||
| 27 | #include <linux/netdevice.h> | ||
| 28 | #include <linux/mii.h> | ||
| 29 | #include <linux/phy.h> | ||
| 30 | |||
| 31 | #include "stmmac.h" | ||
| 32 | |||
| 33 | #define MII_BUSY 0x00000001 | ||
| 34 | #define MII_WRITE 0x00000002 | ||
| 35 | |||
| 36 | /** | ||
| 37 | * stmmac_mdio_read | ||
| 38 | * @bus: points to the mii_bus structure | ||
| 39 | * @phyaddr: MII addr reg bits 15-11 | ||
| 40 | * @phyreg: MII addr reg bits 10-6 | ||
| 41 | * Description: it reads data from the MII register from within the phy device. | ||
| 42 | * For the 7111 GMAC, we must set the bit 0 in the MII address register while | ||
| 43 | * accessing the PHY registers. | ||
| 44 | * Fortunately, it seems this has no drawback for the 7109 MAC. | ||
| 45 | */ | ||
| 46 | static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg) | ||
| 47 | { | ||
| 48 | struct net_device *ndev = bus->priv; | ||
| 49 | struct stmmac_priv *priv = netdev_priv(ndev); | ||
| 50 | unsigned long ioaddr = ndev->base_addr; | ||
| 51 | unsigned int mii_address = priv->mac_type->hw.mii.addr; | ||
| 52 | unsigned int mii_data = priv->mac_type->hw.mii.data; | ||
| 53 | |||
| 54 | int data; | ||
| 55 | u16 regValue = (((phyaddr << 11) & (0x0000F800)) | | ||
| 56 | ((phyreg << 6) & (0x000007C0))); | ||
| 57 | regValue |= MII_BUSY; /* in case of GMAC */ | ||
| 58 | |||
| 59 | do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1); | ||
| 60 | writel(regValue, ioaddr + mii_address); | ||
| 61 | do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1); | ||
| 62 | |||
| 63 | /* Read the data from the MII data register */ | ||
| 64 | data = (int)readl(ioaddr + mii_data); | ||
| 65 | |||
| 66 | return data; | ||
| 67 | } | ||
| 68 | |||
| 69 | /** | ||
| 70 | * stmmac_mdio_write | ||
| 71 | * @bus: points to the mii_bus structure | ||
| 72 | * @phyaddr: MII addr reg bits 15-11 | ||
| 73 | * @phyreg: MII addr reg bits 10-6 | ||
| 74 | * @phydata: phy data | ||
| 75 | * Description: it writes the data into the MII register from within the device. | ||
| 76 | */ | ||
| 77 | static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg, | ||
| 78 | u16 phydata) | ||
| 79 | { | ||
| 80 | struct net_device *ndev = bus->priv; | ||
| 81 | struct stmmac_priv *priv = netdev_priv(ndev); | ||
| 82 | unsigned long ioaddr = ndev->base_addr; | ||
| 83 | unsigned int mii_address = priv->mac_type->hw.mii.addr; | ||
| 84 | unsigned int mii_data = priv->mac_type->hw.mii.data; | ||
| 85 | |||
| 86 | u16 value = | ||
| 87 | (((phyaddr << 11) & (0x0000F800)) | ((phyreg << 6) & (0x000007C0))) | ||
| 88 | | MII_WRITE; | ||
| 89 | |||
| 90 | value |= MII_BUSY; | ||
| 91 | |||
| 92 | /* Wait until any existing MII operation is complete */ | ||
| 93 | do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1); | ||
| 94 | |||
| 95 | /* Set the MII address register to write */ | ||
| 96 | writel(phydata, ioaddr + mii_data); | ||
| 97 | writel(value, ioaddr + mii_address); | ||
| 98 | |||
| 99 | /* Wait until any existing MII operation is complete */ | ||
| 100 | do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1); | ||
| 101 | |||
| 102 | return 0; | ||
| 103 | } | ||
| 104 | |||
| 105 | /** | ||
| 106 | * stmmac_mdio_reset | ||
| 107 | * @bus: points to the mii_bus structure | ||
| 108 | * Description: reset the MII bus | ||
| 109 | */ | ||
| 110 | static int stmmac_mdio_reset(struct mii_bus *bus) | ||
| 111 | { | ||
| 112 | struct net_device *ndev = bus->priv; | ||
| 113 | struct stmmac_priv *priv = netdev_priv(ndev); | ||
| 114 | unsigned long ioaddr = ndev->base_addr; | ||
| 115 | unsigned int mii_address = priv->mac_type->hw.mii.addr; | ||
| 116 | |||
| 117 | if (priv->phy_reset) { | ||
| 118 | pr_debug("stmmac_mdio_reset: calling phy_reset\n"); | ||
| 119 | priv->phy_reset(priv->bsp_priv); | ||
| 120 | } | ||
| 121 | |||
| 122 | /* This is a workaround for problems with the STE101P PHY. | ||
| 123 | * It doesn't complete its reset until at least one clock cycle | ||
| 124 | * on MDC, so perform a dummy mdio read. | ||
| 125 | */ | ||
| 126 | writel(0, ioaddr + mii_address); | ||
| 127 | |||
| 128 | return 0; | ||
| 129 | } | ||
| 130 | |||
| 131 | /** | ||
| 132 | * stmmac_mdio_register | ||
| 133 | * @ndev: net device structure | ||
| 134 | * Description: it registers the MII bus | ||
| 135 | */ | ||
| 136 | int stmmac_mdio_register(struct net_device *ndev) | ||
| 137 | { | ||
| 138 | int err = 0; | ||
| 139 | struct mii_bus *new_bus; | ||
| 140 | int *irqlist; | ||
| 141 | struct stmmac_priv *priv = netdev_priv(ndev); | ||
| 142 | int addr, found; | ||
| 143 | |||
| 144 | new_bus = mdiobus_alloc(); | ||
| 145 | if (new_bus == NULL) | ||
| 146 | return -ENOMEM; | ||
| 147 | |||
| 148 | irqlist = kzalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL); | ||
| 149 | if (irqlist == NULL) { | ||
| 150 | err = -ENOMEM; | ||
| 151 | goto irqlist_alloc_fail; | ||
| 152 | } | ||
| 153 | |||
| 154 | /* Assign IRQ to phy at address phy_addr */ | ||
| 155 | if (priv->phy_addr != -1) | ||
| 156 | irqlist[priv->phy_addr] = priv->phy_irq; | ||
| 157 | |||
| 158 | new_bus->name = "STMMAC MII Bus"; | ||
| 159 | new_bus->read = &stmmac_mdio_read; | ||
| 160 | new_bus->write = &stmmac_mdio_write; | ||
| 161 | new_bus->reset = &stmmac_mdio_reset; | ||
| 162 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", priv->bus_id); | ||
| 163 | new_bus->priv = ndev; | ||
| 164 | new_bus->irq = irqlist; | ||
| 165 | new_bus->phy_mask = priv->phy_mask; | ||
| 166 | new_bus->parent = priv->device; | ||
| 167 | err = mdiobus_register(new_bus); | ||
| 168 | if (err != 0) { | ||
| 169 | pr_err("%s: Cannot register as MDIO bus\n", new_bus->name); | ||
| 170 | goto bus_register_fail; | ||
| 171 | } | ||
| 172 | |||
| 173 | priv->mii = new_bus; | ||
| 174 | |||
| 175 | found = 0; | ||
| 176 | for (addr = 0; addr < 32; addr++) { | ||
| 177 | struct phy_device *phydev = new_bus->phy_map[addr]; | ||
| 178 | if (phydev) { | ||
| 179 | if (priv->phy_addr == -1) { | ||
| 180 | priv->phy_addr = addr; | ||
| 181 | phydev->irq = priv->phy_irq; | ||
| 182 | irqlist[addr] = priv->phy_irq; | ||
| 183 | } | ||
| 184 | pr_info("%s: PHY ID %08x at %d IRQ %d (%s)%s\n", | ||
| 185 | ndev->name, phydev->phy_id, addr, | ||
| 186 | phydev->irq, dev_name(&phydev->dev), | ||
| 187 | (addr == priv->phy_addr) ? " active" : ""); | ||
| 188 | found = 1; | ||
| 189 | } | ||
| 190 | } | ||
| 191 | |||
| 192 | if (!found) | ||
| 193 | pr_warning("%s: No PHY found\n", ndev->name); | ||
| 194 | |||
| 195 | return 0; | ||
| 196 | bus_register_fail: | ||
| 197 | kfree(irqlist); | ||
| 198 | irqlist_alloc_fail: | ||
| 199 | kfree(new_bus); | ||
| 200 | return err; | ||
| 201 | } | ||
| 202 | |||
| 203 | /** | ||
| 204 | * stmmac_mdio_unregister | ||
| 205 | * @ndev: net device structure | ||
| 206 | * Description: it unregisters the MII bus | ||
| 207 | */ | ||
| 208 | int stmmac_mdio_unregister(struct net_device *ndev) | ||
| 209 | { | ||
| 210 | struct stmmac_priv *priv = netdev_priv(ndev); | ||
| 211 | |||
| 212 | mdiobus_unregister(priv->mii); | ||
| 213 | priv->mii->priv = NULL; | ||
| 214 | kfree(priv->mii); | ||
| 215 | |||
| 216 | return 0; | ||
| 217 | } | ||
diff --git a/drivers/net/stmmac/stmmac_timer.c b/drivers/net/stmmac/stmmac_timer.c new file mode 100644 index 000000000000..b838c6582077 --- /dev/null +++ b/drivers/net/stmmac/stmmac_timer.c | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | STMMAC external timer support. | ||
| 3 | |||
| 4 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 5 | |||
| 6 | This program is free software; you can redistribute it and/or modify it | ||
| 7 | under the terms and conditions of the GNU General Public License, | ||
| 8 | version 2, as published by the Free Software Foundation. | ||
| 9 | |||
| 10 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License along with | ||
| 16 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | |||
| 19 | The full GNU General Public License is included in this distribution in | ||
| 20 | the file called "COPYING". | ||
| 21 | |||
| 22 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 23 | *******************************************************************************/ | ||
| 24 | |||
| 25 | #include <linux/kernel.h> | ||
| 26 | #include <linux/etherdevice.h> | ||
| 27 | #include "stmmac_timer.h" | ||
| 28 | |||
| 29 | static void stmmac_timer_handler(void *data) | ||
| 30 | { | ||
| 31 | struct net_device *dev = (struct net_device *)data; | ||
| 32 | |||
| 33 | stmmac_schedule(dev); | ||
| 34 | |||
| 35 | return; | ||
| 36 | } | ||
| 37 | |||
| 38 | #define STMMAC_TIMER_MSG(timer, freq) \ | ||
| 39 | printk(KERN_INFO "stmmac_timer: %s Timer ON (freq %dHz)\n", timer, freq); | ||
| 40 | |||
| 41 | #if defined(CONFIG_STMMAC_RTC_TIMER) | ||
| 42 | #include <linux/rtc.h> | ||
| 43 | static struct rtc_device *stmmac_rtc; | ||
| 44 | static rtc_task_t stmmac_task; | ||
| 45 | |||
| 46 | static void stmmac_rtc_start(unsigned int new_freq) | ||
| 47 | { | ||
| 48 | rtc_irq_set_freq(stmmac_rtc, &stmmac_task, new_freq); | ||
| 49 | rtc_irq_set_state(stmmac_rtc, &stmmac_task, 1); | ||
| 50 | return; | ||
| 51 | } | ||
| 52 | |||
| 53 | static void stmmac_rtc_stop(void) | ||
| 54 | { | ||
| 55 | rtc_irq_set_state(stmmac_rtc, &stmmac_task, 0); | ||
| 56 | return; | ||
| 57 | } | ||
| 58 | |||
| 59 | int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | ||
| 60 | { | ||
| 61 | stmmac_task.private_data = dev; | ||
| 62 | stmmac_task.func = stmmac_timer_handler; | ||
| 63 | |||
| 64 | stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); | ||
| 65 | if (stmmac_rtc == NULL) { | ||
| 66 | pr_error("open rtc device failed\n"); | ||
| 67 | return -ENODEV; | ||
| 68 | } | ||
| 69 | |||
| 70 | rtc_irq_register(stmmac_rtc, &stmmac_task); | ||
| 71 | |||
| 72 | /* Periodic mode is not supported */ | ||
| 73 | if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) { | ||
| 74 | pr_error("set periodic failed\n"); | ||
| 75 | rtc_irq_unregister(stmmac_rtc, &stmmac_task); | ||
| 76 | rtc_class_close(stmmac_rtc); | ||
| 77 | return -1; | ||
| 78 | } | ||
| 79 | |||
| 80 | STMMAC_TIMER_MSG(CONFIG_RTC_HCTOSYS_DEVICE, tm->freq); | ||
| 81 | |||
| 82 | tm->timer_start = stmmac_rtc_start; | ||
| 83 | tm->timer_stop = stmmac_rtc_stop; | ||
| 84 | |||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | |||
| 88 | int stmmac_close_ext_timer(void) | ||
| 89 | { | ||
| 90 | rtc_irq_set_state(stmmac_rtc, &stmmac_task, 0); | ||
| 91 | rtc_irq_unregister(stmmac_rtc, &stmmac_task); | ||
| 92 | rtc_class_close(stmmac_rtc); | ||
| 93 | return 0; | ||
| 94 | } | ||
| 95 | |||
| 96 | #elif defined(CONFIG_STMMAC_TMU_TIMER) | ||
| 97 | #include <linux/clk.h> | ||
| 98 | #define TMU_CHANNEL "tmu2_clk" | ||
| 99 | static struct clk *timer_clock; | ||
| 100 | |||
| 101 | static void stmmac_tmu_start(unsigned int new_freq) | ||
| 102 | { | ||
| 103 | clk_set_rate(timer_clock, new_freq); | ||
| 104 | clk_enable(timer_clock); | ||
| 105 | return; | ||
| 106 | } | ||
| 107 | |||
| 108 | static void stmmac_tmu_stop(void) | ||
| 109 | { | ||
| 110 | clk_disable(timer_clock); | ||
| 111 | return; | ||
| 112 | } | ||
| 113 | |||
| 114 | int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | ||
| 115 | { | ||
| 116 | timer_clock = clk_get(NULL, TMU_CHANNEL); | ||
| 117 | |||
| 118 | if (timer_clock == NULL) | ||
| 119 | return -1; | ||
| 120 | |||
| 121 | if (tmu2_register_user(stmmac_timer_handler, (void *)dev) < 0) { | ||
| 122 | timer_clock = NULL; | ||
| 123 | return -1; | ||
| 124 | } | ||
| 125 | |||
| 126 | STMMAC_TIMER_MSG("TMU2", tm->freq); | ||
| 127 | tm->timer_start = stmmac_tmu_start; | ||
| 128 | tm->timer_stop = stmmac_tmu_stop; | ||
| 129 | |||
| 130 | return 0; | ||
| 131 | } | ||
| 132 | |||
| 133 | int stmmac_close_ext_timer(void) | ||
| 134 | { | ||
| 135 | clk_disable(timer_clock); | ||
| 136 | tmu2_unregister_user(); | ||
| 137 | clk_put(timer_clock); | ||
| 138 | return 0; | ||
| 139 | } | ||
| 140 | #endif | ||
diff --git a/drivers/net/stmmac/stmmac_timer.h b/drivers/net/stmmac/stmmac_timer.h new file mode 100644 index 000000000000..f795cae33725 --- /dev/null +++ b/drivers/net/stmmac/stmmac_timer.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | STMMAC external timer Header File. | ||
| 3 | |||
| 4 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
| 5 | |||
| 6 | This program is free software; you can redistribute it and/or modify it | ||
| 7 | under the terms and conditions of the GNU General Public License, | ||
| 8 | version 2, as published by the Free Software Foundation. | ||
| 9 | |||
| 10 | This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License along with | ||
| 16 | this program; if not, write to the Free Software Foundation, Inc., | ||
| 17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 18 | |||
| 19 | The full GNU General Public License is included in this distribution in | ||
| 20 | the file called "COPYING". | ||
| 21 | |||
| 22 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 23 | *******************************************************************************/ | ||
| 24 | |||
| 25 | struct stmmac_timer { | ||
| 26 | void (*timer_start) (unsigned int new_freq); | ||
| 27 | void (*timer_stop) (void); | ||
| 28 | unsigned int freq; | ||
| 29 | }; | ||
| 30 | |||
| 31 | /* Open the HW timer device and return 0 in case of success */ | ||
| 32 | int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm); | ||
| 33 | /* Stop the timer and release it */ | ||
| 34 | int stmmac_close_ext_timer(void); | ||
| 35 | /* Function used for scheduling task within the stmmac */ | ||
| 36 | void stmmac_schedule(struct net_device *dev); | ||
| 37 | |||
| 38 | #if defined(CONFIG_STMMAC_TMU_TIMER) | ||
| 39 | extern int tmu2_register_user(void *fnt, void *data); | ||
| 40 | extern void tmu2_unregister_user(void); | ||
| 41 | #endif | ||
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index 6fdaba8674b9..ed4a508ef262 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c | |||
| @@ -62,8 +62,11 @@ static char *devid=NULL; | |||
| 62 | static struct usb_eth_dev usb_dev_id[] = { | 62 | static struct usb_eth_dev usb_dev_id[] = { |
| 63 | #define PEGASUS_DEV(pn, vid, pid, flags) \ | 63 | #define PEGASUS_DEV(pn, vid, pid, flags) \ |
| 64 | {.name = pn, .vendor = vid, .device = pid, .private = flags}, | 64 | {.name = pn, .vendor = vid, .device = pid, .private = flags}, |
| 65 | #define PEGASUS_DEV_CLASS(pn, vid, pid, dclass, flags) \ | ||
| 66 | PEGASUS_DEV(pn, vid, pid, flags) | ||
| 65 | #include "pegasus.h" | 67 | #include "pegasus.h" |
| 66 | #undef PEGASUS_DEV | 68 | #undef PEGASUS_DEV |
| 69 | #undef PEGASUS_DEV_CLASS | ||
| 67 | {NULL, 0, 0, 0}, | 70 | {NULL, 0, 0, 0}, |
| 68 | {NULL, 0, 0, 0} | 71 | {NULL, 0, 0, 0} |
| 69 | }; | 72 | }; |
| @@ -71,8 +74,18 @@ static struct usb_eth_dev usb_dev_id[] = { | |||
| 71 | static struct usb_device_id pegasus_ids[] = { | 74 | static struct usb_device_id pegasus_ids[] = { |
| 72 | #define PEGASUS_DEV(pn, vid, pid, flags) \ | 75 | #define PEGASUS_DEV(pn, vid, pid, flags) \ |
| 73 | {.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = vid, .idProduct = pid}, | 76 | {.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = vid, .idProduct = pid}, |
| 77 | /* | ||
| 78 | * The Belkin F8T012xx1 bluetooth adaptor has the same vendor and product | ||
| 79 | * IDs as the Belkin F5D5050, so we need to teach the pegasus driver to | ||
| 80 | * ignore adaptors belonging to the "Wireless" class 0xE0. For this one | ||
| 81 | * case anyway, seeing as the pegasus is for "Wired" adaptors. | ||
| 82 | */ | ||
| 83 | #define PEGASUS_DEV_CLASS(pn, vid, pid, dclass, flags) \ | ||
| 84 | {.match_flags = (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_CLASS), \ | ||
| 85 | .idVendor = vid, .idProduct = pid, .bDeviceClass = dclass}, | ||
| 74 | #include "pegasus.h" | 86 | #include "pegasus.h" |
| 75 | #undef PEGASUS_DEV | 87 | #undef PEGASUS_DEV |
| 88 | #undef PEGASUS_DEV_CLASS | ||
| 76 | {}, | 89 | {}, |
| 77 | {} | 90 | {} |
| 78 | }; | 91 | }; |
diff --git a/drivers/net/usb/pegasus.h b/drivers/net/usb/pegasus.h index f968c834ff63..5d02f0200737 100644 --- a/drivers/net/usb/pegasus.h +++ b/drivers/net/usb/pegasus.h | |||
| @@ -202,7 +202,11 @@ PEGASUS_DEV( "AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701, | |||
| 202 | DEFAULT_GPIO_RESET | PEGASUS_II ) | 202 | DEFAULT_GPIO_RESET | PEGASUS_II ) |
| 203 | PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100, | 203 | PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100, |
| 204 | DEFAULT_GPIO_RESET | PEGASUS_II ) | 204 | DEFAULT_GPIO_RESET | PEGASUS_II ) |
| 205 | PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, | 205 | /* |
| 206 | * Distinguish between this Belkin adaptor and the Belkin bluetooth adaptors | ||
| 207 | * with the same product IDs by checking the device class too. | ||
| 208 | */ | ||
| 209 | PEGASUS_DEV_CLASS( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 0x00, | ||
| 206 | DEFAULT_GPIO_RESET | PEGASUS_II ) | 210 | DEFAULT_GPIO_RESET | PEGASUS_II ) |
| 207 | PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986, | 211 | PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986, |
| 208 | DEFAULT_GPIO_RESET ) | 212 | DEFAULT_GPIO_RESET ) |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 8d009760277c..3709d6af9abf 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/ethtool.h> | 22 | #include <linux/ethtool.h> |
| 23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| 24 | #include <linux/virtio.h> | 24 | #include <linux/virtio.h> |
| 25 | #include <linux/virtio_ids.h> | ||
| 26 | #include <linux/virtio_net.h> | 25 | #include <linux/virtio_net.h> |
| 27 | #include <linux/scatterlist.h> | 26 | #include <linux/scatterlist.h> |
| 28 | #include <linux/if_vlan.h> | 27 | #include <linux/if_vlan.h> |
| @@ -454,7 +453,7 @@ static unsigned int free_old_xmit_skbs(struct virtnet_info *vi) | |||
| 454 | vi->dev->stats.tx_bytes += skb->len; | 453 | vi->dev->stats.tx_bytes += skb->len; |
| 455 | vi->dev->stats.tx_packets++; | 454 | vi->dev->stats.tx_packets++; |
| 456 | tot_sgs += skb_vnet_hdr(skb)->num_sg; | 455 | tot_sgs += skb_vnet_hdr(skb)->num_sg; |
| 457 | kfree_skb(skb); | 456 | dev_kfree_skb_any(skb); |
| 458 | } | 457 | } |
| 459 | return tot_sgs; | 458 | return tot_sgs; |
| 460 | } | 459 | } |
diff --git a/drivers/net/vmxnet3/Makefile b/drivers/net/vmxnet3/Makefile new file mode 100644 index 000000000000..880f5098eac9 --- /dev/null +++ b/drivers/net/vmxnet3/Makefile | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | ################################################################################ | ||
| 2 | # | ||
| 3 | # Linux driver for VMware's vmxnet3 ethernet NIC. | ||
| 4 | # | ||
| 5 | # Copyright (C) 2007-2009, VMware, Inc. All Rights Reserved. | ||
| 6 | # | ||
| 7 | # This program is free software; you can redistribute it and/or modify it | ||
| 8 | # under the terms of the GNU General Public License as published by the | ||
| 9 | # Free Software Foundation; version 2 of the License and no later version. | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, but | ||
| 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
| 14 | # NON INFRINGEMENT. See the GNU General Public License for more | ||
| 15 | # details. | ||
| 16 | # | ||
| 17 | # You should have received a copy of the GNU General Public License | ||
| 18 | # along with this program; if not, write to the Free Software | ||
| 19 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | # | ||
| 21 | # The full GNU General Public License is included in this distribution in | ||
| 22 | # the file called "COPYING". | ||
| 23 | # | ||
| 24 | # Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com> | ||
| 25 | # | ||
| 26 | # | ||
| 27 | ################################################################################ | ||
| 28 | |||
| 29 | # | ||
| 30 | # Makefile for the VMware vmxnet3 ethernet NIC driver | ||
| 31 | # | ||
| 32 | |||
| 33 | obj-$(CONFIG_VMXNET3) += vmxnet3.o | ||
| 34 | |||
| 35 | vmxnet3-objs := vmxnet3_drv.o vmxnet3_ethtool.o | ||
diff --git a/drivers/net/vmxnet3/upt1_defs.h b/drivers/net/vmxnet3/upt1_defs.h new file mode 100644 index 000000000000..37108fb226d3 --- /dev/null +++ b/drivers/net/vmxnet3/upt1_defs.h | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | /* | ||
| 2 | * Linux driver for VMware's vmxnet3 ethernet NIC. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the | ||
| 8 | * Free Software Foundation; version 2 of the License and no later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, but | ||
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
| 13 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
| 14 | * details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | * | ||
| 20 | * The full GNU General Public License is included in this distribution in | ||
| 21 | * the file called "COPYING". | ||
| 22 | * | ||
| 23 | * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com> | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | |||
| 27 | #ifndef _UPT1_DEFS_H | ||
| 28 | #define _UPT1_DEFS_H | ||
| 29 | |||
| 30 | struct UPT1_TxStats { | ||
| 31 | u64 TSOPktsTxOK; /* TSO pkts post-segmentation */ | ||
| 32 | u64 TSOBytesTxOK; | ||
| 33 | u64 ucastPktsTxOK; | ||
| 34 | u64 ucastBytesTxOK; | ||
| 35 | u64 mcastPktsTxOK; | ||
| 36 | u64 mcastBytesTxOK; | ||
| 37 | u64 bcastPktsTxOK; | ||
| 38 | u64 bcastBytesTxOK; | ||
| 39 | u64 pktsTxError; | ||
| 40 | u64 pktsTxDiscard; | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct UPT1_RxStats { | ||
| 44 | u64 LROPktsRxOK; /* LRO pkts */ | ||
| 45 | u64 LROBytesRxOK; /* bytes from LRO pkts */ | ||
| 46 | /* the following counters are for pkts from the wire, i.e., pre-LRO */ | ||
| 47 | u64 ucastPktsRxOK; | ||
| 48 | u64 ucastBytesRxOK; | ||
| 49 | u64 mcastPktsRxOK; | ||
| 50 | u64 mcastBytesRxOK; | ||
| 51 | u64 bcastPktsRxOK; | ||
| 52 | u64 bcastBytesRxOK; | ||
| 53 | u64 pktsRxOutOfBuf; | ||
| 54 | u64 pktsRxError; | ||
| 55 | }; | ||
| 56 | |||
| 57 | /* interrupt moderation level */ | ||
| 58 | enum { | ||
| 59 | UPT1_IML_NONE = 0, /* no interrupt moderation */ | ||
| 60 | UPT1_IML_HIGHEST = 7, /* least intr generated */ | ||
| 61 | UPT1_IML_ADAPTIVE = 8, /* adpative intr moderation */ | ||
| 62 | }; | ||
| 63 | /* values for UPT1_RSSConf.hashFunc */ | ||
| 64 | enum { | ||
| 65 | UPT1_RSS_HASH_TYPE_NONE = 0x0, | ||
| 66 | UPT1_RSS_HASH_TYPE_IPV4 = 0x01, | ||
| 67 | UPT1_RSS_HASH_TYPE_TCP_IPV4 = 0x02, | ||
| 68 | UPT1_RSS_HASH_TYPE_IPV6 = 0x04, | ||
| 69 | UPT1_RSS_HASH_TYPE_TCP_IPV6 = 0x08, | ||
| 70 | }; | ||
| 71 | |||
| 72 | enum { | ||
| 73 | UPT1_RSS_HASH_FUNC_NONE = 0x0, | ||
| 74 | UPT1_RSS_HASH_FUNC_TOEPLITZ = 0x01, | ||
| 75 | }; | ||
| 76 | |||
| 77 | #define UPT1_RSS_MAX_KEY_SIZE 40 | ||
| 78 | #define UPT1_RSS_MAX_IND_TABLE_SIZE 128 | ||
| 79 | |||
| 80 | struct UPT1_RSSConf { | ||
| 81 | u16 hashType; | ||
| 82 | u16 hashFunc; | ||
| 83 | u16 hashKeySize; | ||
| 84 | u16 indTableSize; | ||
| 85 | u8 hashKey[UPT1_RSS_MAX_KEY_SIZE]; | ||
| 86 | u8 indTable[UPT1_RSS_MAX_IND_TABLE_SIZE]; | ||
| 87 | }; | ||
| 88 | |||
| 89 | /* features */ | ||
| 90 | enum { | ||
| 91 | UPT1_F_RXCSUM = 0x0001, /* rx csum verification */ | ||
| 92 | UPT1_F_RSS = 0x0002, | ||
| 93 | UPT1_F_RXVLAN = 0x0004, /* VLAN tag stripping */ | ||
| 94 | UPT1_F_LRO = 0x0008, | ||
| 95 | }; | ||
| 96 | #endif | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_defs.h b/drivers/net/vmxnet3/vmxnet3_defs.h new file mode 100644 index 000000000000..dc8ee4438a4f --- /dev/null +++ b/drivers/net/vmxnet3/vmxnet3_defs.h | |||
| @@ -0,0 +1,535 @@ | |||
| 1 | /* | ||
| 2 | * Linux driver for VMware's vmxnet3 ethernet NIC. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the | ||
| 8 | * Free Software Foundation; version 2 of the License and no later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, but | ||
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
| 13 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
| 14 | * details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | * | ||
| 20 | * The full GNU General Public License is included in this distribution in | ||
| 21 | * the file called "COPYING". | ||
| 22 | * | ||
| 23 | * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com> | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | |||
| 27 | #ifndef _VMXNET3_DEFS_H_ | ||
| 28 | #define _VMXNET3_DEFS_H_ | ||
| 29 | |||
| 30 | #include "upt1_defs.h" | ||
| 31 | |||
| 32 | /* all registers are 32 bit wide */ | ||
| 33 | /* BAR 1 */ | ||
| 34 | enum { | ||
| 35 | VMXNET3_REG_VRRS = 0x0, /* Vmxnet3 Revision Report Selection */ | ||
| 36 | VMXNET3_REG_UVRS = 0x8, /* UPT Version Report Selection */ | ||
| 37 | VMXNET3_REG_DSAL = 0x10, /* Driver Shared Address Low */ | ||
| 38 | VMXNET3_REG_DSAH = 0x18, /* Driver Shared Address High */ | ||
| 39 | VMXNET3_REG_CMD = 0x20, /* Command */ | ||
| 40 | VMXNET3_REG_MACL = 0x28, /* MAC Address Low */ | ||
| 41 | VMXNET3_REG_MACH = 0x30, /* MAC Address High */ | ||
| 42 | VMXNET3_REG_ICR = 0x38, /* Interrupt Cause Register */ | ||
| 43 | VMXNET3_REG_ECR = 0x40 /* Event Cause Register */ | ||
| 44 | }; | ||
| 45 | |||
| 46 | /* BAR 0 */ | ||
| 47 | enum { | ||
| 48 | VMXNET3_REG_IMR = 0x0, /* Interrupt Mask Register */ | ||
| 49 | VMXNET3_REG_TXPROD = 0x600, /* Tx Producer Index */ | ||
| 50 | VMXNET3_REG_RXPROD = 0x800, /* Rx Producer Index for ring 1 */ | ||
| 51 | VMXNET3_REG_RXPROD2 = 0xA00 /* Rx Producer Index for ring 2 */ | ||
| 52 | }; | ||
| 53 | |||
| 54 | #define VMXNET3_PT_REG_SIZE 4096 /* BAR 0 */ | ||
| 55 | #define VMXNET3_VD_REG_SIZE 4096 /* BAR 1 */ | ||
| 56 | |||
| 57 | #define VMXNET3_REG_ALIGN 8 /* All registers are 8-byte aligned. */ | ||
| 58 | #define VMXNET3_REG_ALIGN_MASK 0x7 | ||
| 59 | |||
| 60 | /* I/O Mapped access to registers */ | ||
| 61 | #define VMXNET3_IO_TYPE_PT 0 | ||
| 62 | #define VMXNET3_IO_TYPE_VD 1 | ||
| 63 | #define VMXNET3_IO_ADDR(type, reg) (((type) << 24) | ((reg) & 0xFFFFFF)) | ||
| 64 | #define VMXNET3_IO_TYPE(addr) ((addr) >> 24) | ||
| 65 | #define VMXNET3_IO_REG(addr) ((addr) & 0xFFFFFF) | ||
| 66 | |||
| 67 | enum { | ||
| 68 | VMXNET3_CMD_FIRST_SET = 0xCAFE0000, | ||
| 69 | VMXNET3_CMD_ACTIVATE_DEV = VMXNET3_CMD_FIRST_SET, | ||
| 70 | VMXNET3_CMD_QUIESCE_DEV, | ||
| 71 | VMXNET3_CMD_RESET_DEV, | ||
| 72 | VMXNET3_CMD_UPDATE_RX_MODE, | ||
| 73 | VMXNET3_CMD_UPDATE_MAC_FILTERS, | ||
| 74 | VMXNET3_CMD_UPDATE_VLAN_FILTERS, | ||
| 75 | VMXNET3_CMD_UPDATE_RSSIDT, | ||
| 76 | VMXNET3_CMD_UPDATE_IML, | ||
| 77 | VMXNET3_CMD_UPDATE_PMCFG, | ||
| 78 | VMXNET3_CMD_UPDATE_FEATURE, | ||
| 79 | VMXNET3_CMD_LOAD_PLUGIN, | ||
| 80 | |||
| 81 | VMXNET3_CMD_FIRST_GET = 0xF00D0000, | ||
| 82 | VMXNET3_CMD_GET_QUEUE_STATUS = VMXNET3_CMD_FIRST_GET, | ||
| 83 | VMXNET3_CMD_GET_STATS, | ||
| 84 | VMXNET3_CMD_GET_LINK, | ||
| 85 | VMXNET3_CMD_GET_PERM_MAC_LO, | ||
| 86 | VMXNET3_CMD_GET_PERM_MAC_HI, | ||
| 87 | VMXNET3_CMD_GET_DID_LO, | ||
| 88 | VMXNET3_CMD_GET_DID_HI, | ||
| 89 | VMXNET3_CMD_GET_DEV_EXTRA_INFO, | ||
| 90 | VMXNET3_CMD_GET_CONF_INTR | ||
| 91 | }; | ||
| 92 | |||
| 93 | struct Vmxnet3_TxDesc { | ||
| 94 | u64 addr; | ||
| 95 | |||
| 96 | u32 len:14; | ||
| 97 | u32 gen:1; /* generation bit */ | ||
| 98 | u32 rsvd:1; | ||
| 99 | u32 dtype:1; /* descriptor type */ | ||
| 100 | u32 ext1:1; | ||
| 101 | u32 msscof:14; /* MSS, checksum offset, flags */ | ||
| 102 | |||
| 103 | u32 hlen:10; /* header len */ | ||
| 104 | u32 om:2; /* offload mode */ | ||
| 105 | u32 eop:1; /* End Of Packet */ | ||
| 106 | u32 cq:1; /* completion request */ | ||
| 107 | u32 ext2:1; | ||
| 108 | u32 ti:1; /* VLAN Tag Insertion */ | ||
| 109 | u32 tci:16; /* Tag to Insert */ | ||
| 110 | }; | ||
| 111 | |||
| 112 | /* TxDesc.OM values */ | ||
| 113 | #define VMXNET3_OM_NONE 0 | ||
| 114 | #define VMXNET3_OM_CSUM 2 | ||
| 115 | #define VMXNET3_OM_TSO 3 | ||
| 116 | |||
| 117 | /* fields in TxDesc we access w/o using bit fields */ | ||
| 118 | #define VMXNET3_TXD_EOP_SHIFT 12 | ||
| 119 | #define VMXNET3_TXD_CQ_SHIFT 13 | ||
| 120 | #define VMXNET3_TXD_GEN_SHIFT 14 | ||
| 121 | |||
| 122 | #define VMXNET3_TXD_CQ (1 << VMXNET3_TXD_CQ_SHIFT) | ||
| 123 | #define VMXNET3_TXD_EOP (1 << VMXNET3_TXD_EOP_SHIFT) | ||
| 124 | #define VMXNET3_TXD_GEN (1 << VMXNET3_TXD_GEN_SHIFT) | ||
| 125 | |||
| 126 | #define VMXNET3_HDR_COPY_SIZE 128 | ||
| 127 | |||
| 128 | |||
| 129 | struct Vmxnet3_TxDataDesc { | ||
| 130 | u8 data[VMXNET3_HDR_COPY_SIZE]; | ||
| 131 | }; | ||
| 132 | |||
| 133 | |||
| 134 | struct Vmxnet3_TxCompDesc { | ||
| 135 | u32 txdIdx:12; /* Index of the EOP TxDesc */ | ||
| 136 | u32 ext1:20; | ||
| 137 | |||
| 138 | u32 ext2; | ||
| 139 | u32 ext3; | ||
| 140 | |||
| 141 | u32 rsvd:24; | ||
| 142 | u32 type:7; /* completion type */ | ||
| 143 | u32 gen:1; /* generation bit */ | ||
| 144 | }; | ||
| 145 | |||
| 146 | |||
| 147 | struct Vmxnet3_RxDesc { | ||
| 148 | u64 addr; | ||
| 149 | |||
| 150 | u32 len:14; | ||
| 151 | u32 btype:1; /* Buffer Type */ | ||
| 152 | u32 dtype:1; /* Descriptor type */ | ||
| 153 | u32 rsvd:15; | ||
| 154 | u32 gen:1; /* Generation bit */ | ||
| 155 | |||
| 156 | u32 ext1; | ||
| 157 | }; | ||
| 158 | |||
| 159 | /* values of RXD.BTYPE */ | ||
| 160 | #define VMXNET3_RXD_BTYPE_HEAD 0 /* head only */ | ||
| 161 | #define VMXNET3_RXD_BTYPE_BODY 1 /* body only */ | ||
| 162 | |||
| 163 | /* fields in RxDesc we access w/o using bit fields */ | ||
| 164 | #define VMXNET3_RXD_BTYPE_SHIFT 14 | ||
| 165 | #define VMXNET3_RXD_GEN_SHIFT 31 | ||
| 166 | |||
| 167 | |||
| 168 | struct Vmxnet3_RxCompDesc { | ||
| 169 | u32 rxdIdx:12; /* Index of the RxDesc */ | ||
| 170 | u32 ext1:2; | ||
| 171 | u32 eop:1; /* End of Packet */ | ||
| 172 | u32 sop:1; /* Start of Packet */ | ||
| 173 | u32 rqID:10; /* rx queue/ring ID */ | ||
| 174 | u32 rssType:4; /* RSS hash type used */ | ||
| 175 | u32 cnc:1; /* Checksum Not Calculated */ | ||
| 176 | u32 ext2:1; | ||
| 177 | |||
| 178 | u32 rssHash; /* RSS hash value */ | ||
| 179 | |||
| 180 | u32 len:14; /* data length */ | ||
| 181 | u32 err:1; /* Error */ | ||
| 182 | u32 ts:1; /* Tag is stripped */ | ||
| 183 | u32 tci:16; /* Tag stripped */ | ||
| 184 | |||
| 185 | u32 csum:16; | ||
| 186 | u32 tuc:1; /* TCP/UDP Checksum Correct */ | ||
| 187 | u32 udp:1; /* UDP packet */ | ||
| 188 | u32 tcp:1; /* TCP packet */ | ||
| 189 | u32 ipc:1; /* IP Checksum Correct */ | ||
| 190 | u32 v6:1; /* IPv6 */ | ||
| 191 | u32 v4:1; /* IPv4 */ | ||
| 192 | u32 frg:1; /* IP Fragment */ | ||
| 193 | u32 fcs:1; /* Frame CRC correct */ | ||
| 194 | u32 type:7; /* completion type */ | ||
| 195 | u32 gen:1; /* generation bit */ | ||
| 196 | }; | ||
| 197 | |||
| 198 | /* fields in RxCompDesc we access via Vmxnet3_GenericDesc.dword[3] */ | ||
| 199 | #define VMXNET3_RCD_TUC_SHIFT 16 | ||
| 200 | #define VMXNET3_RCD_IPC_SHIFT 19 | ||
| 201 | |||
| 202 | /* fields in RxCompDesc we access via Vmxnet3_GenericDesc.qword[1] */ | ||
| 203 | #define VMXNET3_RCD_TYPE_SHIFT 56 | ||
| 204 | #define VMXNET3_RCD_GEN_SHIFT 63 | ||
| 205 | |||
| 206 | /* csum OK for TCP/UDP pkts over IP */ | ||
| 207 | #define VMXNET3_RCD_CSUM_OK (1 << VMXNET3_RCD_TUC_SHIFT | \ | ||
| 208 | 1 << VMXNET3_RCD_IPC_SHIFT) | ||
| 209 | |||
| 210 | /* value of RxCompDesc.rssType */ | ||
| 211 | enum { | ||
| 212 | VMXNET3_RCD_RSS_TYPE_NONE = 0, | ||
| 213 | VMXNET3_RCD_RSS_TYPE_IPV4 = 1, | ||
| 214 | VMXNET3_RCD_RSS_TYPE_TCPIPV4 = 2, | ||
| 215 | VMXNET3_RCD_RSS_TYPE_IPV6 = 3, | ||
| 216 | VMXNET3_RCD_RSS_TYPE_TCPIPV6 = 4, | ||
| 217 | }; | ||
| 218 | |||
| 219 | |||
| 220 | /* a union for accessing all cmd/completion descriptors */ | ||
| 221 | union Vmxnet3_GenericDesc { | ||
| 222 | u64 qword[2]; | ||
| 223 | u32 dword[4]; | ||
| 224 | u16 word[8]; | ||
| 225 | struct Vmxnet3_TxDesc txd; | ||
| 226 | struct Vmxnet3_RxDesc rxd; | ||
| 227 | struct Vmxnet3_TxCompDesc tcd; | ||
| 228 | struct Vmxnet3_RxCompDesc rcd; | ||
| 229 | }; | ||
| 230 | |||
| 231 | #define VMXNET3_INIT_GEN 1 | ||
| 232 | |||
| 233 | /* Max size of a single tx buffer */ | ||
| 234 | #define VMXNET3_MAX_TX_BUF_SIZE (1 << 14) | ||
| 235 | |||
| 236 | /* # of tx desc needed for a tx buffer size */ | ||
| 237 | #define VMXNET3_TXD_NEEDED(size) (((size) + VMXNET3_MAX_TX_BUF_SIZE - 1) / \ | ||
| 238 | VMXNET3_MAX_TX_BUF_SIZE) | ||
| 239 | |||
| 240 | /* max # of tx descs for a non-tso pkt */ | ||
| 241 | #define VMXNET3_MAX_TXD_PER_PKT 16 | ||
| 242 | |||
| 243 | /* Max size of a single rx buffer */ | ||
| 244 | #define VMXNET3_MAX_RX_BUF_SIZE ((1 << 14) - 1) | ||
| 245 | /* Minimum size of a type 0 buffer */ | ||
| 246 | #define VMXNET3_MIN_T0_BUF_SIZE 128 | ||
| 247 | #define VMXNET3_MAX_CSUM_OFFSET 1024 | ||
| 248 | |||
| 249 | /* Ring base address alignment */ | ||
| 250 | #define VMXNET3_RING_BA_ALIGN 512 | ||
| 251 | #define VMXNET3_RING_BA_MASK (VMXNET3_RING_BA_ALIGN - 1) | ||
| 252 | |||
| 253 | /* Ring size must be a multiple of 32 */ | ||
| 254 | #define VMXNET3_RING_SIZE_ALIGN 32 | ||
| 255 | #define VMXNET3_RING_SIZE_MASK (VMXNET3_RING_SIZE_ALIGN - 1) | ||
| 256 | |||
| 257 | /* Max ring size */ | ||
| 258 | #define VMXNET3_TX_RING_MAX_SIZE 4096 | ||
| 259 | #define VMXNET3_TC_RING_MAX_SIZE 4096 | ||
| 260 | #define VMXNET3_RX_RING_MAX_SIZE 4096 | ||
| 261 | #define VMXNET3_RC_RING_MAX_SIZE 8192 | ||
| 262 | |||
| 263 | /* a list of reasons for queue stop */ | ||
| 264 | |||
| 265 | enum { | ||
| 266 | VMXNET3_ERR_NOEOP = 0x80000000, /* cannot find the EOP desc of a pkt */ | ||
| 267 | VMXNET3_ERR_TXD_REUSE = 0x80000001, /* reuse TxDesc before tx completion */ | ||
| 268 | VMXNET3_ERR_BIG_PKT = 0x80000002, /* too many TxDesc for a pkt */ | ||
| 269 | VMXNET3_ERR_DESC_NOT_SPT = 0x80000003, /* descriptor type not supported */ | ||
| 270 | VMXNET3_ERR_SMALL_BUF = 0x80000004, /* type 0 buffer too small */ | ||
| 271 | VMXNET3_ERR_STRESS = 0x80000005, /* stress option firing in vmkernel */ | ||
| 272 | VMXNET3_ERR_SWITCH = 0x80000006, /* mode switch failure */ | ||
| 273 | VMXNET3_ERR_TXD_INVALID = 0x80000007, /* invalid TxDesc */ | ||
| 274 | }; | ||
| 275 | |||
| 276 | /* completion descriptor types */ | ||
| 277 | #define VMXNET3_CDTYPE_TXCOMP 0 /* Tx Completion Descriptor */ | ||
| 278 | #define VMXNET3_CDTYPE_RXCOMP 3 /* Rx Completion Descriptor */ | ||
| 279 | |||
| 280 | enum { | ||
| 281 | VMXNET3_GOS_BITS_UNK = 0, /* unknown */ | ||
| 282 | VMXNET3_GOS_BITS_32 = 1, | ||
| 283 | VMXNET3_GOS_BITS_64 = 2, | ||
| 284 | }; | ||
| 285 | |||
| 286 | #define VMXNET3_GOS_TYPE_LINUX 1 | ||
| 287 | |||
| 288 | |||
| 289 | struct Vmxnet3_GOSInfo { | ||
| 290 | u32 gosBits:2; /* 32-bit or 64-bit? */ | ||
| 291 | u32 gosType:4; /* which guest */ | ||
| 292 | u32 gosVer:16; /* gos version */ | ||
| 293 | u32 gosMisc:10; /* other info about gos */ | ||
| 294 | }; | ||
| 295 | |||
| 296 | |||
| 297 | struct Vmxnet3_DriverInfo { | ||
| 298 | u32 version; | ||
| 299 | struct Vmxnet3_GOSInfo gos; | ||
| 300 | u32 vmxnet3RevSpt; | ||
| 301 | u32 uptVerSpt; | ||
| 302 | }; | ||
| 303 | |||
| 304 | |||
| 305 | #define VMXNET3_REV1_MAGIC 0xbabefee1 | ||
| 306 | |||
| 307 | /* | ||
| 308 | * QueueDescPA must be 128 bytes aligned. It points to an array of | ||
| 309 | * Vmxnet3_TxQueueDesc followed by an array of Vmxnet3_RxQueueDesc. | ||
| 310 | * The number of Vmxnet3_TxQueueDesc/Vmxnet3_RxQueueDesc are specified by | ||
| 311 | * Vmxnet3_MiscConf.numTxQueues/numRxQueues, respectively. | ||
| 312 | */ | ||
| 313 | #define VMXNET3_QUEUE_DESC_ALIGN 128 | ||
| 314 | |||
| 315 | |||
| 316 | struct Vmxnet3_MiscConf { | ||
| 317 | struct Vmxnet3_DriverInfo driverInfo; | ||
| 318 | u64 uptFeatures; | ||
| 319 | u64 ddPA; /* driver data PA */ | ||
| 320 | u64 queueDescPA; /* queue descriptor table PA */ | ||
| 321 | u32 ddLen; /* driver data len */ | ||
| 322 | u32 queueDescLen; /* queue desc. table len in bytes */ | ||
| 323 | u32 mtu; | ||
| 324 | u16 maxNumRxSG; | ||
| 325 | u8 numTxQueues; | ||
| 326 | u8 numRxQueues; | ||
| 327 | u32 reserved[4]; | ||
| 328 | }; | ||
| 329 | |||
| 330 | |||
| 331 | struct Vmxnet3_TxQueueConf { | ||
| 332 | u64 txRingBasePA; | ||
| 333 | u64 dataRingBasePA; | ||
| 334 | u64 compRingBasePA; | ||
| 335 | u64 ddPA; /* driver data */ | ||
| 336 | u64 reserved; | ||
| 337 | u32 txRingSize; /* # of tx desc */ | ||
| 338 | u32 dataRingSize; /* # of data desc */ | ||
| 339 | u32 compRingSize; /* # of comp desc */ | ||
| 340 | u32 ddLen; /* size of driver data */ | ||
| 341 | u8 intrIdx; | ||
| 342 | u8 _pad[7]; | ||
| 343 | }; | ||
| 344 | |||
| 345 | |||
| 346 | struct Vmxnet3_RxQueueConf { | ||
| 347 | u64 rxRingBasePA[2]; | ||
| 348 | u64 compRingBasePA; | ||
| 349 | u64 ddPA; /* driver data */ | ||
| 350 | u64 reserved; | ||
| 351 | u32 rxRingSize[2]; /* # of rx desc */ | ||
| 352 | u32 compRingSize; /* # of rx comp desc */ | ||
| 353 | u32 ddLen; /* size of driver data */ | ||
| 354 | u8 intrIdx; | ||
| 355 | u8 _pad[7]; | ||
| 356 | }; | ||
| 357 | |||
| 358 | |||
| 359 | enum vmxnet3_intr_mask_mode { | ||
| 360 | VMXNET3_IMM_AUTO = 0, | ||
| 361 | VMXNET3_IMM_ACTIVE = 1, | ||
| 362 | VMXNET3_IMM_LAZY = 2 | ||
| 363 | }; | ||
| 364 | |||
| 365 | enum vmxnet3_intr_type { | ||
| 366 | VMXNET3_IT_AUTO = 0, | ||
| 367 | VMXNET3_IT_INTX = 1, | ||
| 368 | VMXNET3_IT_MSI = 2, | ||
| 369 | VMXNET3_IT_MSIX = 3 | ||
| 370 | }; | ||
| 371 | |||
| 372 | #define VMXNET3_MAX_TX_QUEUES 8 | ||
| 373 | #define VMXNET3_MAX_RX_QUEUES 16 | ||
| 374 | /* addition 1 for events */ | ||
| 375 | #define VMXNET3_MAX_INTRS 25 | ||
| 376 | |||
| 377 | |||
| 378 | struct Vmxnet3_IntrConf { | ||
| 379 | bool autoMask; | ||
| 380 | u8 numIntrs; /* # of interrupts */ | ||
| 381 | u8 eventIntrIdx; | ||
| 382 | u8 modLevels[VMXNET3_MAX_INTRS]; /* moderation level for | ||
| 383 | * each intr */ | ||
| 384 | u32 reserved[3]; | ||
| 385 | }; | ||
| 386 | |||
| 387 | /* one bit per VLAN ID, the size is in the units of u32 */ | ||
| 388 | #define VMXNET3_VFT_SIZE (4096 / (sizeof(u32) * 8)) | ||
| 389 | |||
| 390 | |||
| 391 | struct Vmxnet3_QueueStatus { | ||
| 392 | bool stopped; | ||
| 393 | u8 _pad[3]; | ||
| 394 | u32 error; | ||
| 395 | }; | ||
| 396 | |||
| 397 | |||
| 398 | struct Vmxnet3_TxQueueCtrl { | ||
| 399 | u32 txNumDeferred; | ||
| 400 | u32 txThreshold; | ||
| 401 | u64 reserved; | ||
| 402 | }; | ||
| 403 | |||
| 404 | |||
| 405 | struct Vmxnet3_RxQueueCtrl { | ||
| 406 | bool updateRxProd; | ||
| 407 | u8 _pad[7]; | ||
| 408 | u64 reserved; | ||
| 409 | }; | ||
| 410 | |||
| 411 | enum { | ||
| 412 | VMXNET3_RXM_UCAST = 0x01, /* unicast only */ | ||
| 413 | VMXNET3_RXM_MCAST = 0x02, /* multicast passing the filters */ | ||
| 414 | VMXNET3_RXM_BCAST = 0x04, /* broadcast only */ | ||
| 415 | VMXNET3_RXM_ALL_MULTI = 0x08, /* all multicast */ | ||
| 416 | VMXNET3_RXM_PROMISC = 0x10 /* promiscuous */ | ||
| 417 | }; | ||
| 418 | |||
| 419 | struct Vmxnet3_RxFilterConf { | ||
| 420 | u32 rxMode; /* VMXNET3_RXM_xxx */ | ||
| 421 | u16 mfTableLen; /* size of the multicast filter table */ | ||
| 422 | u16 _pad1; | ||
| 423 | u64 mfTablePA; /* PA of the multicast filters table */ | ||
| 424 | u32 vfTable[VMXNET3_VFT_SIZE]; /* vlan filter */ | ||
| 425 | }; | ||
| 426 | |||
| 427 | |||
| 428 | #define VMXNET3_PM_MAX_FILTERS 6 | ||
| 429 | #define VMXNET3_PM_MAX_PATTERN_SIZE 128 | ||
| 430 | #define VMXNET3_PM_MAX_MASK_SIZE (VMXNET3_PM_MAX_PATTERN_SIZE / 8) | ||
| 431 | |||
| 432 | #define VMXNET3_PM_WAKEUP_MAGIC 0x01 /* wake up on magic pkts */ | ||
| 433 | #define VMXNET3_PM_WAKEUP_FILTER 0x02 /* wake up on pkts matching | ||
| 434 | * filters */ | ||
| 435 | |||
| 436 | |||
| 437 | struct Vmxnet3_PM_PktFilter { | ||
| 438 | u8 maskSize; | ||
| 439 | u8 patternSize; | ||
| 440 | u8 mask[VMXNET3_PM_MAX_MASK_SIZE]; | ||
| 441 | u8 pattern[VMXNET3_PM_MAX_PATTERN_SIZE]; | ||
| 442 | u8 pad[6]; | ||
| 443 | }; | ||
| 444 | |||
| 445 | |||
| 446 | struct Vmxnet3_PMConf { | ||
| 447 | u16 wakeUpEvents; /* VMXNET3_PM_WAKEUP_xxx */ | ||
| 448 | u8 numFilters; | ||
| 449 | u8 pad[5]; | ||
| 450 | struct Vmxnet3_PM_PktFilter filters[VMXNET3_PM_MAX_FILTERS]; | ||
| 451 | }; | ||
| 452 | |||
| 453 | |||
| 454 | struct Vmxnet3_VariableLenConfDesc { | ||
| 455 | u32 confVer; | ||
| 456 | u32 confLen; | ||
| 457 | u64 confPA; | ||
| 458 | }; | ||
| 459 | |||
| 460 | |||
| 461 | struct Vmxnet3_TxQueueDesc { | ||
| 462 | struct Vmxnet3_TxQueueCtrl ctrl; | ||
| 463 | struct Vmxnet3_TxQueueConf conf; | ||
| 464 | |||
| 465 | /* Driver read after a GET command */ | ||
| 466 | struct Vmxnet3_QueueStatus status; | ||
| 467 | struct UPT1_TxStats stats; | ||
| 468 | u8 _pad[88]; /* 128 aligned */ | ||
| 469 | }; | ||
| 470 | |||
| 471 | |||
| 472 | struct Vmxnet3_RxQueueDesc { | ||
| 473 | struct Vmxnet3_RxQueueCtrl ctrl; | ||
| 474 | struct Vmxnet3_RxQueueConf conf; | ||
| 475 | /* Driver read after a GET commad */ | ||
| 476 | struct Vmxnet3_QueueStatus status; | ||
| 477 | struct UPT1_RxStats stats; | ||
| 478 | u8 __pad[88]; /* 128 aligned */ | ||
| 479 | }; | ||
| 480 | |||
| 481 | |||
| 482 | struct Vmxnet3_DSDevRead { | ||
| 483 | /* read-only region for device, read by dev in response to a SET cmd */ | ||
| 484 | struct Vmxnet3_MiscConf misc; | ||
| 485 | struct Vmxnet3_IntrConf intrConf; | ||
| 486 | struct Vmxnet3_RxFilterConf rxFilterConf; | ||
| 487 | struct Vmxnet3_VariableLenConfDesc rssConfDesc; | ||
| 488 | struct Vmxnet3_VariableLenConfDesc pmConfDesc; | ||
| 489 | struct Vmxnet3_VariableLenConfDesc pluginConfDesc; | ||
| 490 | }; | ||
| 491 | |||
| 492 | /* All structures in DriverShared are padded to multiples of 8 bytes */ | ||
| 493 | struct Vmxnet3_DriverShared { | ||
| 494 | u32 magic; | ||
| 495 | /* make devRead start at 64bit boundaries */ | ||
| 496 | u32 pad; | ||
| 497 | struct Vmxnet3_DSDevRead devRead; | ||
| 498 | u32 ecr; | ||
| 499 | u32 reserved[5]; | ||
| 500 | }; | ||
| 501 | |||
| 502 | |||
| 503 | #define VMXNET3_ECR_RQERR (1 << 0) | ||
| 504 | #define VMXNET3_ECR_TQERR (1 << 1) | ||
| 505 | #define VMXNET3_ECR_LINK (1 << 2) | ||
| 506 | #define VMXNET3_ECR_DIC (1 << 3) | ||
| 507 | #define VMXNET3_ECR_DEBUG (1 << 4) | ||
| 508 | |||
| 509 | /* flip the gen bit of a ring */ | ||
| 510 | #define VMXNET3_FLIP_RING_GEN(gen) ((gen) = (gen) ^ 0x1) | ||
| 511 | |||
| 512 | /* only use this if moving the idx won't affect the gen bit */ | ||
| 513 | #define VMXNET3_INC_RING_IDX_ONLY(idx, ring_size) \ | ||
| 514 | do {\ | ||
| 515 | (idx)++;\ | ||
| 516 | if (unlikely((idx) == (ring_size))) {\ | ||
| 517 | (idx) = 0;\ | ||
| 518 | } \ | ||
| 519 | } while (0) | ||
| 520 | |||
| 521 | #define VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid) \ | ||
| 522 | (vfTable[vid >> 5] |= (1 << (vid & 31))) | ||
| 523 | #define VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vid) \ | ||
| 524 | (vfTable[vid >> 5] &= ~(1 << (vid & 31))) | ||
| 525 | |||
| 526 | #define VMXNET3_VFTABLE_ENTRY_IS_SET(vfTable, vid) \ | ||
| 527 | ((vfTable[vid >> 5] & (1 << (vid & 31))) != 0) | ||
| 528 | |||
| 529 | #define VMXNET3_MAX_MTU 9000 | ||
| 530 | #define VMXNET3_MIN_MTU 60 | ||
| 531 | |||
| 532 | #define VMXNET3_LINK_UP (10000 << 16 | 1) /* 10 Gbps, up */ | ||
| 533 | #define VMXNET3_LINK_DOWN 0 | ||
| 534 | |||
| 535 | #endif /* _VMXNET3_DEFS_H_ */ | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c new file mode 100644 index 000000000000..004353a46af0 --- /dev/null +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
| @@ -0,0 +1,2574 @@ | |||
| 1 | /* | ||
| 2 | * Linux driver for VMware's vmxnet3 ethernet NIC. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the | ||
| 8 | * Free Software Foundation; version 2 of the License and no later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, but | ||
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
| 13 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
| 14 | * details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | * | ||
| 20 | * The full GNU General Public License is included in this distribution in | ||
| 21 | * the file called "COPYING". | ||
| 22 | * | ||
| 23 | * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com> | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | |||
| 27 | #include "vmxnet3_int.h" | ||
| 28 | |||
| 29 | char vmxnet3_driver_name[] = "vmxnet3"; | ||
| 30 | #define VMXNET3_DRIVER_DESC "VMware vmxnet3 virtual NIC driver" | ||
| 31 | |||
| 32 | |||
| 33 | /* | ||
| 34 | * PCI Device ID Table | ||
| 35 | * Last entry must be all 0s | ||
| 36 | */ | ||
| 37 | static const struct pci_device_id vmxnet3_pciid_table[] = { | ||
| 38 | {PCI_VDEVICE(VMWARE, PCI_DEVICE_ID_VMWARE_VMXNET3)}, | ||
| 39 | {0} | ||
| 40 | }; | ||
| 41 | |||
| 42 | MODULE_DEVICE_TABLE(pci, vmxnet3_pciid_table); | ||
| 43 | |||
| 44 | static atomic_t devices_found; | ||
| 45 | |||
| 46 | |||
| 47 | /* | ||
| 48 | * Enable/Disable the given intr | ||
| 49 | */ | ||
| 50 | static void | ||
| 51 | vmxnet3_enable_intr(struct vmxnet3_adapter *adapter, unsigned intr_idx) | ||
| 52 | { | ||
| 53 | VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_IMR + intr_idx * 8, 0); | ||
| 54 | } | ||
| 55 | |||
| 56 | |||
| 57 | static void | ||
| 58 | vmxnet3_disable_intr(struct vmxnet3_adapter *adapter, unsigned intr_idx) | ||
| 59 | { | ||
| 60 | VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_IMR + intr_idx * 8, 1); | ||
| 61 | } | ||
| 62 | |||
| 63 | |||
| 64 | /* | ||
| 65 | * Enable/Disable all intrs used by the device | ||
| 66 | */ | ||
| 67 | static void | ||
| 68 | vmxnet3_enable_all_intrs(struct vmxnet3_adapter *adapter) | ||
| 69 | { | ||
| 70 | int i; | ||
| 71 | |||
| 72 | for (i = 0; i < adapter->intr.num_intrs; i++) | ||
| 73 | vmxnet3_enable_intr(adapter, i); | ||
| 74 | } | ||
| 75 | |||
| 76 | |||
| 77 | static void | ||
| 78 | vmxnet3_disable_all_intrs(struct vmxnet3_adapter *adapter) | ||
| 79 | { | ||
| 80 | int i; | ||
| 81 | |||
| 82 | for (i = 0; i < adapter->intr.num_intrs; i++) | ||
| 83 | vmxnet3_disable_intr(adapter, i); | ||
| 84 | } | ||
| 85 | |||
| 86 | |||
| 87 | static void | ||
| 88 | vmxnet3_ack_events(struct vmxnet3_adapter *adapter, u32 events) | ||
| 89 | { | ||
| 90 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_ECR, events); | ||
| 91 | } | ||
| 92 | |||
| 93 | |||
| 94 | static bool | ||
| 95 | vmxnet3_tq_stopped(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter) | ||
| 96 | { | ||
| 97 | return netif_queue_stopped(adapter->netdev); | ||
| 98 | } | ||
| 99 | |||
| 100 | |||
| 101 | static void | ||
| 102 | vmxnet3_tq_start(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter) | ||
| 103 | { | ||
| 104 | tq->stopped = false; | ||
| 105 | netif_start_queue(adapter->netdev); | ||
| 106 | } | ||
| 107 | |||
| 108 | |||
| 109 | static void | ||
| 110 | vmxnet3_tq_wake(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter) | ||
| 111 | { | ||
| 112 | tq->stopped = false; | ||
| 113 | netif_wake_queue(adapter->netdev); | ||
| 114 | } | ||
| 115 | |||
| 116 | |||
| 117 | static void | ||
| 118 | vmxnet3_tq_stop(struct vmxnet3_tx_queue *tq, struct vmxnet3_adapter *adapter) | ||
| 119 | { | ||
| 120 | tq->stopped = true; | ||
| 121 | tq->num_stop++; | ||
| 122 | netif_stop_queue(adapter->netdev); | ||
| 123 | } | ||
| 124 | |||
| 125 | |||
| 126 | /* | ||
| 127 | * Check the link state. This may start or stop the tx queue. | ||
| 128 | */ | ||
| 129 | static void | ||
| 130 | vmxnet3_check_link(struct vmxnet3_adapter *adapter) | ||
| 131 | { | ||
| 132 | u32 ret; | ||
| 133 | |||
| 134 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_LINK); | ||
| 135 | ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); | ||
| 136 | adapter->link_speed = ret >> 16; | ||
| 137 | if (ret & 1) { /* Link is up. */ | ||
| 138 | printk(KERN_INFO "%s: NIC Link is Up %d Mbps\n", | ||
| 139 | adapter->netdev->name, adapter->link_speed); | ||
| 140 | if (!netif_carrier_ok(adapter->netdev)) | ||
| 141 | netif_carrier_on(adapter->netdev); | ||
| 142 | |||
| 143 | vmxnet3_tq_start(&adapter->tx_queue, adapter); | ||
| 144 | } else { | ||
| 145 | printk(KERN_INFO "%s: NIC Link is Down\n", | ||
| 146 | adapter->netdev->name); | ||
| 147 | if (netif_carrier_ok(adapter->netdev)) | ||
| 148 | netif_carrier_off(adapter->netdev); | ||
| 149 | |||
| 150 | vmxnet3_tq_stop(&adapter->tx_queue, adapter); | ||
| 151 | } | ||
| 152 | } | ||
| 153 | |||
| 154 | |||
| 155 | static void | ||
| 156 | vmxnet3_process_events(struct vmxnet3_adapter *adapter) | ||
| 157 | { | ||
| 158 | u32 events = adapter->shared->ecr; | ||
| 159 | if (!events) | ||
| 160 | return; | ||
| 161 | |||
| 162 | vmxnet3_ack_events(adapter, events); | ||
| 163 | |||
| 164 | /* Check if link state has changed */ | ||
| 165 | if (events & VMXNET3_ECR_LINK) | ||
| 166 | vmxnet3_check_link(adapter); | ||
| 167 | |||
| 168 | /* Check if there is an error on xmit/recv queues */ | ||
| 169 | if (events & (VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR)) { | ||
| 170 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 171 | VMXNET3_CMD_GET_QUEUE_STATUS); | ||
| 172 | |||
| 173 | if (adapter->tqd_start->status.stopped) { | ||
| 174 | printk(KERN_ERR "%s: tq error 0x%x\n", | ||
| 175 | adapter->netdev->name, | ||
| 176 | adapter->tqd_start->status.error); | ||
| 177 | } | ||
| 178 | if (adapter->rqd_start->status.stopped) { | ||
| 179 | printk(KERN_ERR "%s: rq error 0x%x\n", | ||
| 180 | adapter->netdev->name, | ||
| 181 | adapter->rqd_start->status.error); | ||
| 182 | } | ||
| 183 | |||
| 184 | schedule_work(&adapter->work); | ||
| 185 | } | ||
| 186 | } | ||
| 187 | |||
| 188 | |||
| 189 | static void | ||
| 190 | vmxnet3_unmap_tx_buf(struct vmxnet3_tx_buf_info *tbi, | ||
| 191 | struct pci_dev *pdev) | ||
| 192 | { | ||
| 193 | if (tbi->map_type == VMXNET3_MAP_SINGLE) | ||
| 194 | pci_unmap_single(pdev, tbi->dma_addr, tbi->len, | ||
| 195 | PCI_DMA_TODEVICE); | ||
| 196 | else if (tbi->map_type == VMXNET3_MAP_PAGE) | ||
| 197 | pci_unmap_page(pdev, tbi->dma_addr, tbi->len, | ||
| 198 | PCI_DMA_TODEVICE); | ||
| 199 | else | ||
| 200 | BUG_ON(tbi->map_type != VMXNET3_MAP_NONE); | ||
| 201 | |||
| 202 | tbi->map_type = VMXNET3_MAP_NONE; /* to help debugging */ | ||
| 203 | } | ||
| 204 | |||
| 205 | |||
| 206 | static int | ||
| 207 | vmxnet3_unmap_pkt(u32 eop_idx, struct vmxnet3_tx_queue *tq, | ||
| 208 | struct pci_dev *pdev, struct vmxnet3_adapter *adapter) | ||
| 209 | { | ||
| 210 | struct sk_buff *skb; | ||
| 211 | int entries = 0; | ||
| 212 | |||
| 213 | /* no out of order completion */ | ||
| 214 | BUG_ON(tq->buf_info[eop_idx].sop_idx != tq->tx_ring.next2comp); | ||
| 215 | BUG_ON(tq->tx_ring.base[eop_idx].txd.eop != 1); | ||
| 216 | |||
| 217 | skb = tq->buf_info[eop_idx].skb; | ||
| 218 | BUG_ON(skb == NULL); | ||
| 219 | tq->buf_info[eop_idx].skb = NULL; | ||
| 220 | |||
| 221 | VMXNET3_INC_RING_IDX_ONLY(eop_idx, tq->tx_ring.size); | ||
| 222 | |||
| 223 | while (tq->tx_ring.next2comp != eop_idx) { | ||
| 224 | vmxnet3_unmap_tx_buf(tq->buf_info + tq->tx_ring.next2comp, | ||
| 225 | pdev); | ||
| 226 | |||
| 227 | /* update next2comp w/o tx_lock. Since we are marking more, | ||
| 228 | * instead of less, tx ring entries avail, the worst case is | ||
| 229 | * that the tx routine incorrectly re-queues a pkt due to | ||
| 230 | * insufficient tx ring entries. | ||
| 231 | */ | ||
| 232 | vmxnet3_cmd_ring_adv_next2comp(&tq->tx_ring); | ||
| 233 | entries++; | ||
| 234 | } | ||
| 235 | |||
| 236 | dev_kfree_skb_any(skb); | ||
| 237 | return entries; | ||
| 238 | } | ||
| 239 | |||
| 240 | |||
| 241 | static int | ||
| 242 | vmxnet3_tq_tx_complete(struct vmxnet3_tx_queue *tq, | ||
| 243 | struct vmxnet3_adapter *adapter) | ||
| 244 | { | ||
| 245 | int completed = 0; | ||
| 246 | union Vmxnet3_GenericDesc *gdesc; | ||
| 247 | |||
| 248 | gdesc = tq->comp_ring.base + tq->comp_ring.next2proc; | ||
| 249 | while (gdesc->tcd.gen == tq->comp_ring.gen) { | ||
| 250 | completed += vmxnet3_unmap_pkt(gdesc->tcd.txdIdx, tq, | ||
| 251 | adapter->pdev, adapter); | ||
| 252 | |||
| 253 | vmxnet3_comp_ring_adv_next2proc(&tq->comp_ring); | ||
| 254 | gdesc = tq->comp_ring.base + tq->comp_ring.next2proc; | ||
| 255 | } | ||
| 256 | |||
| 257 | if (completed) { | ||
| 258 | spin_lock(&tq->tx_lock); | ||
| 259 | if (unlikely(vmxnet3_tq_stopped(tq, adapter) && | ||
| 260 | vmxnet3_cmd_ring_desc_avail(&tq->tx_ring) > | ||
| 261 | VMXNET3_WAKE_QUEUE_THRESHOLD(tq) && | ||
| 262 | netif_carrier_ok(adapter->netdev))) { | ||
| 263 | vmxnet3_tq_wake(tq, adapter); | ||
| 264 | } | ||
| 265 | spin_unlock(&tq->tx_lock); | ||
| 266 | } | ||
| 267 | return completed; | ||
| 268 | } | ||
| 269 | |||
| 270 | |||
| 271 | static void | ||
| 272 | vmxnet3_tq_cleanup(struct vmxnet3_tx_queue *tq, | ||
| 273 | struct vmxnet3_adapter *adapter) | ||
| 274 | { | ||
| 275 | int i; | ||
| 276 | |||
| 277 | while (tq->tx_ring.next2comp != tq->tx_ring.next2fill) { | ||
| 278 | struct vmxnet3_tx_buf_info *tbi; | ||
| 279 | union Vmxnet3_GenericDesc *gdesc; | ||
| 280 | |||
| 281 | tbi = tq->buf_info + tq->tx_ring.next2comp; | ||
| 282 | gdesc = tq->tx_ring.base + tq->tx_ring.next2comp; | ||
| 283 | |||
| 284 | vmxnet3_unmap_tx_buf(tbi, adapter->pdev); | ||
| 285 | if (tbi->skb) { | ||
| 286 | dev_kfree_skb_any(tbi->skb); | ||
| 287 | tbi->skb = NULL; | ||
| 288 | } | ||
| 289 | vmxnet3_cmd_ring_adv_next2comp(&tq->tx_ring); | ||
| 290 | } | ||
| 291 | |||
| 292 | /* sanity check, verify all buffers are indeed unmapped and freed */ | ||
| 293 | for (i = 0; i < tq->tx_ring.size; i++) { | ||
| 294 | BUG_ON(tq->buf_info[i].skb != NULL || | ||
| 295 | tq->buf_info[i].map_type != VMXNET3_MAP_NONE); | ||
| 296 | } | ||
| 297 | |||
| 298 | tq->tx_ring.gen = VMXNET3_INIT_GEN; | ||
| 299 | tq->tx_ring.next2fill = tq->tx_ring.next2comp = 0; | ||
| 300 | |||
| 301 | tq->comp_ring.gen = VMXNET3_INIT_GEN; | ||
| 302 | tq->comp_ring.next2proc = 0; | ||
| 303 | } | ||
| 304 | |||
| 305 | |||
| 306 | void | ||
| 307 | vmxnet3_tq_destroy(struct vmxnet3_tx_queue *tq, | ||
| 308 | struct vmxnet3_adapter *adapter) | ||
| 309 | { | ||
| 310 | if (tq->tx_ring.base) { | ||
| 311 | pci_free_consistent(adapter->pdev, tq->tx_ring.size * | ||
| 312 | sizeof(struct Vmxnet3_TxDesc), | ||
| 313 | tq->tx_ring.base, tq->tx_ring.basePA); | ||
| 314 | tq->tx_ring.base = NULL; | ||
| 315 | } | ||
| 316 | if (tq->data_ring.base) { | ||
| 317 | pci_free_consistent(adapter->pdev, tq->data_ring.size * | ||
| 318 | sizeof(struct Vmxnet3_TxDataDesc), | ||
| 319 | tq->data_ring.base, tq->data_ring.basePA); | ||
| 320 | tq->data_ring.base = NULL; | ||
| 321 | } | ||
| 322 | if (tq->comp_ring.base) { | ||
| 323 | pci_free_consistent(adapter->pdev, tq->comp_ring.size * | ||
| 324 | sizeof(struct Vmxnet3_TxCompDesc), | ||
| 325 | tq->comp_ring.base, tq->comp_ring.basePA); | ||
| 326 | tq->comp_ring.base = NULL; | ||
| 327 | } | ||
| 328 | kfree(tq->buf_info); | ||
| 329 | tq->buf_info = NULL; | ||
| 330 | } | ||
| 331 | |||
| 332 | |||
| 333 | static void | ||
| 334 | vmxnet3_tq_init(struct vmxnet3_tx_queue *tq, | ||
| 335 | struct vmxnet3_adapter *adapter) | ||
| 336 | { | ||
| 337 | int i; | ||
| 338 | |||
| 339 | /* reset the tx ring contents to 0 and reset the tx ring states */ | ||
| 340 | memset(tq->tx_ring.base, 0, tq->tx_ring.size * | ||
| 341 | sizeof(struct Vmxnet3_TxDesc)); | ||
| 342 | tq->tx_ring.next2fill = tq->tx_ring.next2comp = 0; | ||
| 343 | tq->tx_ring.gen = VMXNET3_INIT_GEN; | ||
| 344 | |||
| 345 | memset(tq->data_ring.base, 0, tq->data_ring.size * | ||
| 346 | sizeof(struct Vmxnet3_TxDataDesc)); | ||
| 347 | |||
| 348 | /* reset the tx comp ring contents to 0 and reset comp ring states */ | ||
| 349 | memset(tq->comp_ring.base, 0, tq->comp_ring.size * | ||
| 350 | sizeof(struct Vmxnet3_TxCompDesc)); | ||
| 351 | tq->comp_ring.next2proc = 0; | ||
| 352 | tq->comp_ring.gen = VMXNET3_INIT_GEN; | ||
| 353 | |||
| 354 | /* reset the bookkeeping data */ | ||
| 355 | memset(tq->buf_info, 0, sizeof(tq->buf_info[0]) * tq->tx_ring.size); | ||
| 356 | for (i = 0; i < tq->tx_ring.size; i++) | ||
| 357 | tq->buf_info[i].map_type = VMXNET3_MAP_NONE; | ||
| 358 | |||
| 359 | /* stats are not reset */ | ||
| 360 | } | ||
| 361 | |||
| 362 | |||
| 363 | static int | ||
| 364 | vmxnet3_tq_create(struct vmxnet3_tx_queue *tq, | ||
| 365 | struct vmxnet3_adapter *adapter) | ||
| 366 | { | ||
| 367 | BUG_ON(tq->tx_ring.base || tq->data_ring.base || | ||
| 368 | tq->comp_ring.base || tq->buf_info); | ||
| 369 | |||
| 370 | tq->tx_ring.base = pci_alloc_consistent(adapter->pdev, tq->tx_ring.size | ||
| 371 | * sizeof(struct Vmxnet3_TxDesc), | ||
| 372 | &tq->tx_ring.basePA); | ||
| 373 | if (!tq->tx_ring.base) { | ||
| 374 | printk(KERN_ERR "%s: failed to allocate tx ring\n", | ||
| 375 | adapter->netdev->name); | ||
| 376 | goto err; | ||
| 377 | } | ||
| 378 | |||
| 379 | tq->data_ring.base = pci_alloc_consistent(adapter->pdev, | ||
| 380 | tq->data_ring.size * | ||
| 381 | sizeof(struct Vmxnet3_TxDataDesc), | ||
| 382 | &tq->data_ring.basePA); | ||
| 383 | if (!tq->data_ring.base) { | ||
| 384 | printk(KERN_ERR "%s: failed to allocate data ring\n", | ||
| 385 | adapter->netdev->name); | ||
| 386 | goto err; | ||
| 387 | } | ||
| 388 | |||
| 389 | tq->comp_ring.base = pci_alloc_consistent(adapter->pdev, | ||
| 390 | tq->comp_ring.size * | ||
| 391 | sizeof(struct Vmxnet3_TxCompDesc), | ||
| 392 | &tq->comp_ring.basePA); | ||
| 393 | if (!tq->comp_ring.base) { | ||
| 394 | printk(KERN_ERR "%s: failed to allocate tx comp ring\n", | ||
| 395 | adapter->netdev->name); | ||
| 396 | goto err; | ||
| 397 | } | ||
| 398 | |||
| 399 | tq->buf_info = kcalloc(tq->tx_ring.size, sizeof(tq->buf_info[0]), | ||
| 400 | GFP_KERNEL); | ||
| 401 | if (!tq->buf_info) { | ||
| 402 | printk(KERN_ERR "%s: failed to allocate tx bufinfo\n", | ||
| 403 | adapter->netdev->name); | ||
| 404 | goto err; | ||
| 405 | } | ||
| 406 | |||
| 407 | return 0; | ||
| 408 | |||
| 409 | err: | ||
| 410 | vmxnet3_tq_destroy(tq, adapter); | ||
| 411 | return -ENOMEM; | ||
| 412 | } | ||
| 413 | |||
| 414 | |||
| 415 | /* | ||
| 416 | * starting from ring->next2fill, allocate rx buffers for the given ring | ||
| 417 | * of the rx queue and update the rx desc. stop after @num_to_alloc buffers | ||
| 418 | * are allocated or allocation fails | ||
| 419 | */ | ||
| 420 | |||
| 421 | static int | ||
| 422 | vmxnet3_rq_alloc_rx_buf(struct vmxnet3_rx_queue *rq, u32 ring_idx, | ||
| 423 | int num_to_alloc, struct vmxnet3_adapter *adapter) | ||
| 424 | { | ||
| 425 | int num_allocated = 0; | ||
| 426 | struct vmxnet3_rx_buf_info *rbi_base = rq->buf_info[ring_idx]; | ||
| 427 | struct vmxnet3_cmd_ring *ring = &rq->rx_ring[ring_idx]; | ||
| 428 | u32 val; | ||
| 429 | |||
| 430 | while (num_allocated < num_to_alloc) { | ||
| 431 | struct vmxnet3_rx_buf_info *rbi; | ||
| 432 | union Vmxnet3_GenericDesc *gd; | ||
| 433 | |||
| 434 | rbi = rbi_base + ring->next2fill; | ||
| 435 | gd = ring->base + ring->next2fill; | ||
| 436 | |||
| 437 | if (rbi->buf_type == VMXNET3_RX_BUF_SKB) { | ||
| 438 | if (rbi->skb == NULL) { | ||
| 439 | rbi->skb = dev_alloc_skb(rbi->len + | ||
| 440 | NET_IP_ALIGN); | ||
| 441 | if (unlikely(rbi->skb == NULL)) { | ||
| 442 | rq->stats.rx_buf_alloc_failure++; | ||
| 443 | break; | ||
| 444 | } | ||
| 445 | rbi->skb->dev = adapter->netdev; | ||
| 446 | |||
| 447 | skb_reserve(rbi->skb, NET_IP_ALIGN); | ||
| 448 | rbi->dma_addr = pci_map_single(adapter->pdev, | ||
| 449 | rbi->skb->data, rbi->len, | ||
| 450 | PCI_DMA_FROMDEVICE); | ||
| 451 | } else { | ||
| 452 | /* rx buffer skipped by the device */ | ||
| 453 | } | ||
| 454 | val = VMXNET3_RXD_BTYPE_HEAD << VMXNET3_RXD_BTYPE_SHIFT; | ||
| 455 | } else { | ||
| 456 | BUG_ON(rbi->buf_type != VMXNET3_RX_BUF_PAGE || | ||
| 457 | rbi->len != PAGE_SIZE); | ||
| 458 | |||
| 459 | if (rbi->page == NULL) { | ||
| 460 | rbi->page = alloc_page(GFP_ATOMIC); | ||
| 461 | if (unlikely(rbi->page == NULL)) { | ||
| 462 | rq->stats.rx_buf_alloc_failure++; | ||
| 463 | break; | ||
| 464 | } | ||
| 465 | rbi->dma_addr = pci_map_page(adapter->pdev, | ||
| 466 | rbi->page, 0, PAGE_SIZE, | ||
| 467 | PCI_DMA_FROMDEVICE); | ||
| 468 | } else { | ||
| 469 | /* rx buffers skipped by the device */ | ||
| 470 | } | ||
| 471 | val = VMXNET3_RXD_BTYPE_BODY << VMXNET3_RXD_BTYPE_SHIFT; | ||
| 472 | } | ||
| 473 | |||
| 474 | BUG_ON(rbi->dma_addr == 0); | ||
| 475 | gd->rxd.addr = rbi->dma_addr; | ||
| 476 | gd->dword[2] = (ring->gen << VMXNET3_RXD_GEN_SHIFT) | val | | ||
| 477 | rbi->len; | ||
| 478 | |||
| 479 | num_allocated++; | ||
| 480 | vmxnet3_cmd_ring_adv_next2fill(ring); | ||
| 481 | } | ||
| 482 | rq->uncommitted[ring_idx] += num_allocated; | ||
| 483 | |||
| 484 | dev_dbg(&adapter->netdev->dev, | ||
| 485 | "alloc_rx_buf: %d allocated, next2fill %u, next2comp " | ||
| 486 | "%u, uncommited %u\n", num_allocated, ring->next2fill, | ||
| 487 | ring->next2comp, rq->uncommitted[ring_idx]); | ||
| 488 | |||
| 489 | /* so that the device can distinguish a full ring and an empty ring */ | ||
| 490 | BUG_ON(num_allocated != 0 && ring->next2fill == ring->next2comp); | ||
| 491 | |||
| 492 | return num_allocated; | ||
| 493 | } | ||
| 494 | |||
| 495 | |||
| 496 | static void | ||
| 497 | vmxnet3_append_frag(struct sk_buff *skb, struct Vmxnet3_RxCompDesc *rcd, | ||
| 498 | struct vmxnet3_rx_buf_info *rbi) | ||
| 499 | { | ||
| 500 | struct skb_frag_struct *frag = skb_shinfo(skb)->frags + | ||
| 501 | skb_shinfo(skb)->nr_frags; | ||
| 502 | |||
| 503 | BUG_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS); | ||
| 504 | |||
| 505 | frag->page = rbi->page; | ||
| 506 | frag->page_offset = 0; | ||
| 507 | frag->size = rcd->len; | ||
| 508 | skb->data_len += frag->size; | ||
| 509 | skb_shinfo(skb)->nr_frags++; | ||
| 510 | } | ||
| 511 | |||
| 512 | |||
| 513 | static void | ||
| 514 | vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx, | ||
| 515 | struct vmxnet3_tx_queue *tq, struct pci_dev *pdev, | ||
| 516 | struct vmxnet3_adapter *adapter) | ||
| 517 | { | ||
| 518 | u32 dw2, len; | ||
| 519 | unsigned long buf_offset; | ||
| 520 | int i; | ||
| 521 | union Vmxnet3_GenericDesc *gdesc; | ||
| 522 | struct vmxnet3_tx_buf_info *tbi = NULL; | ||
| 523 | |||
| 524 | BUG_ON(ctx->copy_size > skb_headlen(skb)); | ||
| 525 | |||
| 526 | /* use the previous gen bit for the SOP desc */ | ||
| 527 | dw2 = (tq->tx_ring.gen ^ 0x1) << VMXNET3_TXD_GEN_SHIFT; | ||
| 528 | |||
| 529 | ctx->sop_txd = tq->tx_ring.base + tq->tx_ring.next2fill; | ||
| 530 | gdesc = ctx->sop_txd; /* both loops below can be skipped */ | ||
| 531 | |||
| 532 | /* no need to map the buffer if headers are copied */ | ||
| 533 | if (ctx->copy_size) { | ||
| 534 | ctx->sop_txd->txd.addr = tq->data_ring.basePA + | ||
| 535 | tq->tx_ring.next2fill * | ||
| 536 | sizeof(struct Vmxnet3_TxDataDesc); | ||
| 537 | ctx->sop_txd->dword[2] = dw2 | ctx->copy_size; | ||
| 538 | ctx->sop_txd->dword[3] = 0; | ||
| 539 | |||
| 540 | tbi = tq->buf_info + tq->tx_ring.next2fill; | ||
| 541 | tbi->map_type = VMXNET3_MAP_NONE; | ||
| 542 | |||
| 543 | dev_dbg(&adapter->netdev->dev, | ||
| 544 | "txd[%u]: 0x%Lx 0x%x 0x%x\n", | ||
| 545 | tq->tx_ring.next2fill, ctx->sop_txd->txd.addr, | ||
| 546 | ctx->sop_txd->dword[2], ctx->sop_txd->dword[3]); | ||
| 547 | vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring); | ||
| 548 | |||
| 549 | /* use the right gen for non-SOP desc */ | ||
| 550 | dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT; | ||
| 551 | } | ||
| 552 | |||
| 553 | /* linear part can use multiple tx desc if it's big */ | ||
| 554 | len = skb_headlen(skb) - ctx->copy_size; | ||
| 555 | buf_offset = ctx->copy_size; | ||
| 556 | while (len) { | ||
| 557 | u32 buf_size; | ||
| 558 | |||
| 559 | buf_size = len > VMXNET3_MAX_TX_BUF_SIZE ? | ||
| 560 | VMXNET3_MAX_TX_BUF_SIZE : len; | ||
| 561 | |||
| 562 | tbi = tq->buf_info + tq->tx_ring.next2fill; | ||
| 563 | tbi->map_type = VMXNET3_MAP_SINGLE; | ||
| 564 | tbi->dma_addr = pci_map_single(adapter->pdev, | ||
| 565 | skb->data + buf_offset, buf_size, | ||
| 566 | PCI_DMA_TODEVICE); | ||
| 567 | |||
| 568 | tbi->len = buf_size; /* this automatically convert 2^14 to 0 */ | ||
| 569 | |||
| 570 | gdesc = tq->tx_ring.base + tq->tx_ring.next2fill; | ||
| 571 | BUG_ON(gdesc->txd.gen == tq->tx_ring.gen); | ||
| 572 | |||
| 573 | gdesc->txd.addr = tbi->dma_addr; | ||
| 574 | gdesc->dword[2] = dw2 | buf_size; | ||
| 575 | gdesc->dword[3] = 0; | ||
| 576 | |||
| 577 | dev_dbg(&adapter->netdev->dev, | ||
| 578 | "txd[%u]: 0x%Lx 0x%x 0x%x\n", | ||
| 579 | tq->tx_ring.next2fill, gdesc->txd.addr, | ||
| 580 | gdesc->dword[2], gdesc->dword[3]); | ||
| 581 | vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring); | ||
| 582 | dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT; | ||
| 583 | |||
| 584 | len -= buf_size; | ||
| 585 | buf_offset += buf_size; | ||
| 586 | } | ||
| 587 | |||
| 588 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | ||
| 589 | struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; | ||
| 590 | |||
| 591 | tbi = tq->buf_info + tq->tx_ring.next2fill; | ||
| 592 | tbi->map_type = VMXNET3_MAP_PAGE; | ||
| 593 | tbi->dma_addr = pci_map_page(adapter->pdev, frag->page, | ||
| 594 | frag->page_offset, frag->size, | ||
| 595 | PCI_DMA_TODEVICE); | ||
| 596 | |||
| 597 | tbi->len = frag->size; | ||
| 598 | |||
| 599 | gdesc = tq->tx_ring.base + tq->tx_ring.next2fill; | ||
| 600 | BUG_ON(gdesc->txd.gen == tq->tx_ring.gen); | ||
| 601 | |||
| 602 | gdesc->txd.addr = tbi->dma_addr; | ||
| 603 | gdesc->dword[2] = dw2 | frag->size; | ||
| 604 | gdesc->dword[3] = 0; | ||
| 605 | |||
| 606 | dev_dbg(&adapter->netdev->dev, | ||
| 607 | "txd[%u]: 0x%llu %u %u\n", | ||
| 608 | tq->tx_ring.next2fill, gdesc->txd.addr, | ||
| 609 | gdesc->dword[2], gdesc->dword[3]); | ||
| 610 | vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring); | ||
| 611 | dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT; | ||
| 612 | } | ||
| 613 | |||
| 614 | ctx->eop_txd = gdesc; | ||
| 615 | |||
| 616 | /* set the last buf_info for the pkt */ | ||
| 617 | tbi->skb = skb; | ||
| 618 | tbi->sop_idx = ctx->sop_txd - tq->tx_ring.base; | ||
| 619 | } | ||
| 620 | |||
| 621 | |||
| 622 | /* | ||
| 623 | * parse and copy relevant protocol headers: | ||
| 624 | * For a tso pkt, relevant headers are L2/3/4 including options | ||
| 625 | * For a pkt requesting csum offloading, they are L2/3 and may include L4 | ||
| 626 | * if it's a TCP/UDP pkt | ||
| 627 | * | ||
| 628 | * Returns: | ||
| 629 | * -1: error happens during parsing | ||
| 630 | * 0: protocol headers parsed, but too big to be copied | ||
| 631 | * 1: protocol headers parsed and copied | ||
| 632 | * | ||
| 633 | * Other effects: | ||
| 634 | * 1. related *ctx fields are updated. | ||
| 635 | * 2. ctx->copy_size is # of bytes copied | ||
| 636 | * 3. the portion copied is guaranteed to be in the linear part | ||
| 637 | * | ||
| 638 | */ | ||
| 639 | static int | ||
| 640 | vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, | ||
| 641 | struct vmxnet3_tx_ctx *ctx, | ||
| 642 | struct vmxnet3_adapter *adapter) | ||
| 643 | { | ||
| 644 | struct Vmxnet3_TxDataDesc *tdd; | ||
| 645 | |||
| 646 | if (ctx->mss) { | ||
| 647 | ctx->eth_ip_hdr_size = skb_transport_offset(skb); | ||
| 648 | ctx->l4_hdr_size = ((struct tcphdr *) | ||
| 649 | skb_transport_header(skb))->doff * 4; | ||
| 650 | ctx->copy_size = ctx->eth_ip_hdr_size + ctx->l4_hdr_size; | ||
| 651 | } else { | ||
| 652 | unsigned int pull_size; | ||
| 653 | |||
| 654 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | ||
| 655 | ctx->eth_ip_hdr_size = skb_transport_offset(skb); | ||
| 656 | |||
| 657 | if (ctx->ipv4) { | ||
| 658 | struct iphdr *iph = (struct iphdr *) | ||
| 659 | skb_network_header(skb); | ||
| 660 | if (iph->protocol == IPPROTO_TCP) { | ||
| 661 | pull_size = ctx->eth_ip_hdr_size + | ||
| 662 | sizeof(struct tcphdr); | ||
| 663 | |||
| 664 | if (unlikely(!pskb_may_pull(skb, | ||
| 665 | pull_size))) { | ||
| 666 | goto err; | ||
| 667 | } | ||
| 668 | ctx->l4_hdr_size = ((struct tcphdr *) | ||
| 669 | skb_transport_header(skb))->doff * 4; | ||
| 670 | } else if (iph->protocol == IPPROTO_UDP) { | ||
| 671 | ctx->l4_hdr_size = | ||
| 672 | sizeof(struct udphdr); | ||
| 673 | } else { | ||
| 674 | ctx->l4_hdr_size = 0; | ||
| 675 | } | ||
| 676 | } else { | ||
| 677 | /* for simplicity, don't copy L4 headers */ | ||
| 678 | ctx->l4_hdr_size = 0; | ||
| 679 | } | ||
| 680 | ctx->copy_size = ctx->eth_ip_hdr_size + | ||
| 681 | ctx->l4_hdr_size; | ||
| 682 | } else { | ||
| 683 | ctx->eth_ip_hdr_size = 0; | ||
| 684 | ctx->l4_hdr_size = 0; | ||
| 685 | /* copy as much as allowed */ | ||
| 686 | ctx->copy_size = min((unsigned int)VMXNET3_HDR_COPY_SIZE | ||
| 687 | , skb_headlen(skb)); | ||
| 688 | } | ||
| 689 | |||
| 690 | /* make sure headers are accessible directly */ | ||
| 691 | if (unlikely(!pskb_may_pull(skb, ctx->copy_size))) | ||
| 692 | goto err; | ||
| 693 | } | ||
| 694 | |||
| 695 | if (unlikely(ctx->copy_size > VMXNET3_HDR_COPY_SIZE)) { | ||
| 696 | tq->stats.oversized_hdr++; | ||
| 697 | ctx->copy_size = 0; | ||
| 698 | return 0; | ||
| 699 | } | ||
| 700 | |||
| 701 | tdd = tq->data_ring.base + tq->tx_ring.next2fill; | ||
| 702 | |||
| 703 | memcpy(tdd->data, skb->data, ctx->copy_size); | ||
| 704 | dev_dbg(&adapter->netdev->dev, | ||
| 705 | "copy %u bytes to dataRing[%u]\n", | ||
| 706 | ctx->copy_size, tq->tx_ring.next2fill); | ||
| 707 | return 1; | ||
| 708 | |||
| 709 | err: | ||
| 710 | return -1; | ||
| 711 | } | ||
| 712 | |||
| 713 | |||
| 714 | static void | ||
| 715 | vmxnet3_prepare_tso(struct sk_buff *skb, | ||
| 716 | struct vmxnet3_tx_ctx *ctx) | ||
| 717 | { | ||
| 718 | struct tcphdr *tcph = (struct tcphdr *)skb_transport_header(skb); | ||
| 719 | if (ctx->ipv4) { | ||
| 720 | struct iphdr *iph = (struct iphdr *)skb_network_header(skb); | ||
| 721 | iph->check = 0; | ||
| 722 | tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, 0, | ||
| 723 | IPPROTO_TCP, 0); | ||
| 724 | } else { | ||
| 725 | struct ipv6hdr *iph = (struct ipv6hdr *)skb_network_header(skb); | ||
| 726 | tcph->check = ~csum_ipv6_magic(&iph->saddr, &iph->daddr, 0, | ||
| 727 | IPPROTO_TCP, 0); | ||
| 728 | } | ||
| 729 | } | ||
| 730 | |||
| 731 | |||
| 732 | /* | ||
| 733 | * Transmits a pkt thru a given tq | ||
| 734 | * Returns: | ||
| 735 | * NETDEV_TX_OK: descriptors are setup successfully | ||
| 736 | * NETDEV_TX_OK: error occured, the pkt is dropped | ||
| 737 | * NETDEV_TX_BUSY: tx ring is full, queue is stopped | ||
| 738 | * | ||
| 739 | * Side-effects: | ||
| 740 | * 1. tx ring may be changed | ||
| 741 | * 2. tq stats may be updated accordingly | ||
| 742 | * 3. shared->txNumDeferred may be updated | ||
| 743 | */ | ||
| 744 | |||
| 745 | static int | ||
| 746 | vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, | ||
| 747 | struct vmxnet3_adapter *adapter, struct net_device *netdev) | ||
| 748 | { | ||
| 749 | int ret; | ||
| 750 | u32 count; | ||
| 751 | unsigned long flags; | ||
| 752 | struct vmxnet3_tx_ctx ctx; | ||
| 753 | union Vmxnet3_GenericDesc *gdesc; | ||
| 754 | |||
| 755 | /* conservatively estimate # of descriptors to use */ | ||
| 756 | count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + | ||
| 757 | skb_shinfo(skb)->nr_frags + 1; | ||
| 758 | |||
| 759 | ctx.ipv4 = (skb->protocol == __constant_ntohs(ETH_P_IP)); | ||
| 760 | |||
| 761 | ctx.mss = skb_shinfo(skb)->gso_size; | ||
| 762 | if (ctx.mss) { | ||
| 763 | if (skb_header_cloned(skb)) { | ||
| 764 | if (unlikely(pskb_expand_head(skb, 0, 0, | ||
| 765 | GFP_ATOMIC) != 0)) { | ||
| 766 | tq->stats.drop_tso++; | ||
| 767 | goto drop_pkt; | ||
| 768 | } | ||
| 769 | tq->stats.copy_skb_header++; | ||
| 770 | } | ||
| 771 | vmxnet3_prepare_tso(skb, &ctx); | ||
| 772 | } else { | ||
| 773 | if (unlikely(count > VMXNET3_MAX_TXD_PER_PKT)) { | ||
| 774 | |||
| 775 | /* non-tso pkts must not use more than | ||
| 776 | * VMXNET3_MAX_TXD_PER_PKT entries | ||
| 777 | */ | ||
| 778 | if (skb_linearize(skb) != 0) { | ||
| 779 | tq->stats.drop_too_many_frags++; | ||
| 780 | goto drop_pkt; | ||
| 781 | } | ||
| 782 | tq->stats.linearized++; | ||
| 783 | |||
| 784 | /* recalculate the # of descriptors to use */ | ||
| 785 | count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1; | ||
| 786 | } | ||
| 787 | } | ||
| 788 | |||
| 789 | ret = vmxnet3_parse_and_copy_hdr(skb, tq, &ctx, adapter); | ||
| 790 | if (ret >= 0) { | ||
| 791 | BUG_ON(ret <= 0 && ctx.copy_size != 0); | ||
| 792 | /* hdrs parsed, check against other limits */ | ||
| 793 | if (ctx.mss) { | ||
| 794 | if (unlikely(ctx.eth_ip_hdr_size + ctx.l4_hdr_size > | ||
| 795 | VMXNET3_MAX_TX_BUF_SIZE)) { | ||
| 796 | goto hdr_too_big; | ||
| 797 | } | ||
| 798 | } else { | ||
| 799 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | ||
| 800 | if (unlikely(ctx.eth_ip_hdr_size + | ||
| 801 | skb->csum_offset > | ||
| 802 | VMXNET3_MAX_CSUM_OFFSET)) { | ||
| 803 | goto hdr_too_big; | ||
| 804 | } | ||
| 805 | } | ||
| 806 | } | ||
| 807 | } else { | ||
| 808 | tq->stats.drop_hdr_inspect_err++; | ||
| 809 | goto drop_pkt; | ||
| 810 | } | ||
| 811 | |||
| 812 | spin_lock_irqsave(&tq->tx_lock, flags); | ||
| 813 | |||
| 814 | if (count > vmxnet3_cmd_ring_desc_avail(&tq->tx_ring)) { | ||
| 815 | tq->stats.tx_ring_full++; | ||
| 816 | dev_dbg(&adapter->netdev->dev, | ||
| 817 | "tx queue stopped on %s, next2comp %u" | ||
| 818 | " next2fill %u\n", adapter->netdev->name, | ||
| 819 | tq->tx_ring.next2comp, tq->tx_ring.next2fill); | ||
| 820 | |||
| 821 | vmxnet3_tq_stop(tq, adapter); | ||
| 822 | spin_unlock_irqrestore(&tq->tx_lock, flags); | ||
| 823 | return NETDEV_TX_BUSY; | ||
| 824 | } | ||
| 825 | |||
| 826 | /* fill tx descs related to addr & len */ | ||
| 827 | vmxnet3_map_pkt(skb, &ctx, tq, adapter->pdev, adapter); | ||
| 828 | |||
| 829 | /* setup the EOP desc */ | ||
| 830 | ctx.eop_txd->dword[3] = VMXNET3_TXD_CQ | VMXNET3_TXD_EOP; | ||
| 831 | |||
| 832 | /* setup the SOP desc */ | ||
| 833 | gdesc = ctx.sop_txd; | ||
| 834 | if (ctx.mss) { | ||
| 835 | gdesc->txd.hlen = ctx.eth_ip_hdr_size + ctx.l4_hdr_size; | ||
| 836 | gdesc->txd.om = VMXNET3_OM_TSO; | ||
| 837 | gdesc->txd.msscof = ctx.mss; | ||
| 838 | tq->shared->txNumDeferred += (skb->len - gdesc->txd.hlen + | ||
| 839 | ctx.mss - 1) / ctx.mss; | ||
| 840 | } else { | ||
| 841 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | ||
| 842 | gdesc->txd.hlen = ctx.eth_ip_hdr_size; | ||
| 843 | gdesc->txd.om = VMXNET3_OM_CSUM; | ||
| 844 | gdesc->txd.msscof = ctx.eth_ip_hdr_size + | ||
| 845 | skb->csum_offset; | ||
| 846 | } else { | ||
| 847 | gdesc->txd.om = 0; | ||
| 848 | gdesc->txd.msscof = 0; | ||
| 849 | } | ||
| 850 | tq->shared->txNumDeferred++; | ||
| 851 | } | ||
| 852 | |||
| 853 | if (vlan_tx_tag_present(skb)) { | ||
| 854 | gdesc->txd.ti = 1; | ||
| 855 | gdesc->txd.tci = vlan_tx_tag_get(skb); | ||
| 856 | } | ||
| 857 | |||
| 858 | wmb(); | ||
| 859 | |||
| 860 | /* finally flips the GEN bit of the SOP desc */ | ||
| 861 | gdesc->dword[2] ^= VMXNET3_TXD_GEN; | ||
| 862 | dev_dbg(&adapter->netdev->dev, | ||
| 863 | "txd[%u]: SOP 0x%Lx 0x%x 0x%x\n", | ||
| 864 | (u32)((union Vmxnet3_GenericDesc *)ctx.sop_txd - | ||
| 865 | tq->tx_ring.base), gdesc->txd.addr, gdesc->dword[2], | ||
| 866 | gdesc->dword[3]); | ||
| 867 | |||
| 868 | spin_unlock_irqrestore(&tq->tx_lock, flags); | ||
| 869 | |||
| 870 | if (tq->shared->txNumDeferred >= tq->shared->txThreshold) { | ||
| 871 | tq->shared->txNumDeferred = 0; | ||
| 872 | VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_TXPROD, | ||
| 873 | tq->tx_ring.next2fill); | ||
| 874 | } | ||
| 875 | netdev->trans_start = jiffies; | ||
| 876 | |||
| 877 | return NETDEV_TX_OK; | ||
| 878 | |||
| 879 | hdr_too_big: | ||
| 880 | tq->stats.drop_oversized_hdr++; | ||
| 881 | drop_pkt: | ||
| 882 | tq->stats.drop_total++; | ||
| 883 | dev_kfree_skb(skb); | ||
| 884 | return NETDEV_TX_OK; | ||
| 885 | } | ||
| 886 | |||
| 887 | |||
| 888 | static netdev_tx_t | ||
| 889 | vmxnet3_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | ||
| 890 | { | ||
| 891 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 892 | struct vmxnet3_tx_queue *tq = &adapter->tx_queue; | ||
| 893 | |||
| 894 | return vmxnet3_tq_xmit(skb, tq, adapter, netdev); | ||
| 895 | } | ||
| 896 | |||
| 897 | |||
| 898 | static void | ||
| 899 | vmxnet3_rx_csum(struct vmxnet3_adapter *adapter, | ||
| 900 | struct sk_buff *skb, | ||
| 901 | union Vmxnet3_GenericDesc *gdesc) | ||
| 902 | { | ||
| 903 | if (!gdesc->rcd.cnc && adapter->rxcsum) { | ||
| 904 | /* typical case: TCP/UDP over IP and both csums are correct */ | ||
| 905 | if ((gdesc->dword[3] & VMXNET3_RCD_CSUM_OK) == | ||
| 906 | VMXNET3_RCD_CSUM_OK) { | ||
| 907 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 908 | BUG_ON(!(gdesc->rcd.tcp || gdesc->rcd.udp)); | ||
| 909 | BUG_ON(!(gdesc->rcd.v4 || gdesc->rcd.v6)); | ||
| 910 | BUG_ON(gdesc->rcd.frg); | ||
| 911 | } else { | ||
| 912 | if (gdesc->rcd.csum) { | ||
| 913 | skb->csum = htons(gdesc->rcd.csum); | ||
| 914 | skb->ip_summed = CHECKSUM_PARTIAL; | ||
| 915 | } else { | ||
| 916 | skb->ip_summed = CHECKSUM_NONE; | ||
| 917 | } | ||
| 918 | } | ||
| 919 | } else { | ||
| 920 | skb->ip_summed = CHECKSUM_NONE; | ||
| 921 | } | ||
| 922 | } | ||
| 923 | |||
| 924 | |||
| 925 | static void | ||
| 926 | vmxnet3_rx_error(struct vmxnet3_rx_queue *rq, struct Vmxnet3_RxCompDesc *rcd, | ||
| 927 | struct vmxnet3_rx_ctx *ctx, struct vmxnet3_adapter *adapter) | ||
| 928 | { | ||
| 929 | rq->stats.drop_err++; | ||
| 930 | if (!rcd->fcs) | ||
| 931 | rq->stats.drop_fcs++; | ||
| 932 | |||
| 933 | rq->stats.drop_total++; | ||
| 934 | |||
| 935 | /* | ||
| 936 | * We do not unmap and chain the rx buffer to the skb. | ||
| 937 | * We basically pretend this buffer is not used and will be recycled | ||
| 938 | * by vmxnet3_rq_alloc_rx_buf() | ||
| 939 | */ | ||
| 940 | |||
| 941 | /* | ||
| 942 | * ctx->skb may be NULL if this is the first and the only one | ||
| 943 | * desc for the pkt | ||
| 944 | */ | ||
| 945 | if (ctx->skb) | ||
| 946 | dev_kfree_skb_irq(ctx->skb); | ||
| 947 | |||
| 948 | ctx->skb = NULL; | ||
| 949 | } | ||
| 950 | |||
| 951 | |||
| 952 | static int | ||
| 953 | vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, | ||
| 954 | struct vmxnet3_adapter *adapter, int quota) | ||
| 955 | { | ||
| 956 | static u32 rxprod_reg[2] = {VMXNET3_REG_RXPROD, VMXNET3_REG_RXPROD2}; | ||
| 957 | u32 num_rxd = 0; | ||
| 958 | struct Vmxnet3_RxCompDesc *rcd; | ||
| 959 | struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx; | ||
| 960 | |||
| 961 | rcd = &rq->comp_ring.base[rq->comp_ring.next2proc].rcd; | ||
| 962 | while (rcd->gen == rq->comp_ring.gen) { | ||
| 963 | struct vmxnet3_rx_buf_info *rbi; | ||
| 964 | struct sk_buff *skb; | ||
| 965 | int num_to_alloc; | ||
| 966 | struct Vmxnet3_RxDesc *rxd; | ||
| 967 | u32 idx, ring_idx; | ||
| 968 | |||
| 969 | if (num_rxd >= quota) { | ||
| 970 | /* we may stop even before we see the EOP desc of | ||
| 971 | * the current pkt | ||
| 972 | */ | ||
| 973 | break; | ||
| 974 | } | ||
| 975 | num_rxd++; | ||
| 976 | |||
| 977 | idx = rcd->rxdIdx; | ||
| 978 | ring_idx = rcd->rqID == rq->qid ? 0 : 1; | ||
| 979 | |||
| 980 | rxd = &rq->rx_ring[ring_idx].base[idx].rxd; | ||
| 981 | rbi = rq->buf_info[ring_idx] + idx; | ||
| 982 | |||
| 983 | BUG_ON(rxd->addr != rbi->dma_addr || rxd->len != rbi->len); | ||
| 984 | |||
| 985 | if (unlikely(rcd->eop && rcd->err)) { | ||
| 986 | vmxnet3_rx_error(rq, rcd, ctx, adapter); | ||
| 987 | goto rcd_done; | ||
| 988 | } | ||
| 989 | |||
| 990 | if (rcd->sop) { /* first buf of the pkt */ | ||
| 991 | BUG_ON(rxd->btype != VMXNET3_RXD_BTYPE_HEAD || | ||
| 992 | rcd->rqID != rq->qid); | ||
| 993 | |||
| 994 | BUG_ON(rbi->buf_type != VMXNET3_RX_BUF_SKB); | ||
| 995 | BUG_ON(ctx->skb != NULL || rbi->skb == NULL); | ||
| 996 | |||
| 997 | if (unlikely(rcd->len == 0)) { | ||
| 998 | /* Pretend the rx buffer is skipped. */ | ||
| 999 | BUG_ON(!(rcd->sop && rcd->eop)); | ||
| 1000 | dev_dbg(&adapter->netdev->dev, | ||
| 1001 | "rxRing[%u][%u] 0 length\n", | ||
| 1002 | ring_idx, idx); | ||
| 1003 | goto rcd_done; | ||
| 1004 | } | ||
| 1005 | |||
| 1006 | ctx->skb = rbi->skb; | ||
| 1007 | rbi->skb = NULL; | ||
| 1008 | |||
| 1009 | pci_unmap_single(adapter->pdev, rbi->dma_addr, rbi->len, | ||
| 1010 | PCI_DMA_FROMDEVICE); | ||
| 1011 | |||
| 1012 | skb_put(ctx->skb, rcd->len); | ||
| 1013 | } else { | ||
| 1014 | BUG_ON(ctx->skb == NULL); | ||
| 1015 | /* non SOP buffer must be type 1 in most cases */ | ||
| 1016 | if (rbi->buf_type == VMXNET3_RX_BUF_PAGE) { | ||
| 1017 | BUG_ON(rxd->btype != VMXNET3_RXD_BTYPE_BODY); | ||
| 1018 | |||
| 1019 | if (rcd->len) { | ||
| 1020 | pci_unmap_page(adapter->pdev, | ||
| 1021 | rbi->dma_addr, rbi->len, | ||
| 1022 | PCI_DMA_FROMDEVICE); | ||
| 1023 | |||
| 1024 | vmxnet3_append_frag(ctx->skb, rcd, rbi); | ||
| 1025 | rbi->page = NULL; | ||
| 1026 | } | ||
| 1027 | } else { | ||
| 1028 | /* | ||
| 1029 | * The only time a non-SOP buffer is type 0 is | ||
| 1030 | * when it's EOP and error flag is raised, which | ||
| 1031 | * has already been handled. | ||
| 1032 | */ | ||
| 1033 | BUG_ON(true); | ||
| 1034 | } | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | skb = ctx->skb; | ||
| 1038 | if (rcd->eop) { | ||
| 1039 | skb->len += skb->data_len; | ||
| 1040 | skb->truesize += skb->data_len; | ||
| 1041 | |||
| 1042 | vmxnet3_rx_csum(adapter, skb, | ||
| 1043 | (union Vmxnet3_GenericDesc *)rcd); | ||
| 1044 | skb->protocol = eth_type_trans(skb, adapter->netdev); | ||
| 1045 | |||
| 1046 | if (unlikely(adapter->vlan_grp && rcd->ts)) { | ||
| 1047 | vlan_hwaccel_receive_skb(skb, | ||
| 1048 | adapter->vlan_grp, rcd->tci); | ||
| 1049 | } else { | ||
| 1050 | netif_receive_skb(skb); | ||
| 1051 | } | ||
| 1052 | |||
| 1053 | adapter->netdev->last_rx = jiffies; | ||
| 1054 | ctx->skb = NULL; | ||
| 1055 | } | ||
| 1056 | |||
| 1057 | rcd_done: | ||
| 1058 | /* device may skip some rx descs */ | ||
| 1059 | rq->rx_ring[ring_idx].next2comp = idx; | ||
| 1060 | VMXNET3_INC_RING_IDX_ONLY(rq->rx_ring[ring_idx].next2comp, | ||
| 1061 | rq->rx_ring[ring_idx].size); | ||
| 1062 | |||
| 1063 | /* refill rx buffers frequently to avoid starving the h/w */ | ||
| 1064 | num_to_alloc = vmxnet3_cmd_ring_desc_avail(rq->rx_ring + | ||
| 1065 | ring_idx); | ||
| 1066 | if (unlikely(num_to_alloc > VMXNET3_RX_ALLOC_THRESHOLD(rq, | ||
| 1067 | ring_idx, adapter))) { | ||
| 1068 | vmxnet3_rq_alloc_rx_buf(rq, ring_idx, num_to_alloc, | ||
| 1069 | adapter); | ||
| 1070 | |||
| 1071 | /* if needed, update the register */ | ||
| 1072 | if (unlikely(rq->shared->updateRxProd)) { | ||
| 1073 | VMXNET3_WRITE_BAR0_REG(adapter, | ||
| 1074 | rxprod_reg[ring_idx] + rq->qid * 8, | ||
| 1075 | rq->rx_ring[ring_idx].next2fill); | ||
| 1076 | rq->uncommitted[ring_idx] = 0; | ||
| 1077 | } | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | vmxnet3_comp_ring_adv_next2proc(&rq->comp_ring); | ||
| 1081 | rcd = &rq->comp_ring.base[rq->comp_ring.next2proc].rcd; | ||
| 1082 | } | ||
| 1083 | |||
| 1084 | return num_rxd; | ||
| 1085 | } | ||
| 1086 | |||
| 1087 | |||
| 1088 | static void | ||
| 1089 | vmxnet3_rq_cleanup(struct vmxnet3_rx_queue *rq, | ||
| 1090 | struct vmxnet3_adapter *adapter) | ||
| 1091 | { | ||
| 1092 | u32 i, ring_idx; | ||
| 1093 | struct Vmxnet3_RxDesc *rxd; | ||
| 1094 | |||
| 1095 | for (ring_idx = 0; ring_idx < 2; ring_idx++) { | ||
| 1096 | for (i = 0; i < rq->rx_ring[ring_idx].size; i++) { | ||
| 1097 | rxd = &rq->rx_ring[ring_idx].base[i].rxd; | ||
| 1098 | |||
| 1099 | if (rxd->btype == VMXNET3_RXD_BTYPE_HEAD && | ||
| 1100 | rq->buf_info[ring_idx][i].skb) { | ||
| 1101 | pci_unmap_single(adapter->pdev, rxd->addr, | ||
| 1102 | rxd->len, PCI_DMA_FROMDEVICE); | ||
| 1103 | dev_kfree_skb(rq->buf_info[ring_idx][i].skb); | ||
| 1104 | rq->buf_info[ring_idx][i].skb = NULL; | ||
| 1105 | } else if (rxd->btype == VMXNET3_RXD_BTYPE_BODY && | ||
| 1106 | rq->buf_info[ring_idx][i].page) { | ||
| 1107 | pci_unmap_page(adapter->pdev, rxd->addr, | ||
| 1108 | rxd->len, PCI_DMA_FROMDEVICE); | ||
| 1109 | put_page(rq->buf_info[ring_idx][i].page); | ||
| 1110 | rq->buf_info[ring_idx][i].page = NULL; | ||
| 1111 | } | ||
| 1112 | } | ||
| 1113 | |||
| 1114 | rq->rx_ring[ring_idx].gen = VMXNET3_INIT_GEN; | ||
| 1115 | rq->rx_ring[ring_idx].next2fill = | ||
| 1116 | rq->rx_ring[ring_idx].next2comp = 0; | ||
| 1117 | rq->uncommitted[ring_idx] = 0; | ||
| 1118 | } | ||
| 1119 | |||
| 1120 | rq->comp_ring.gen = VMXNET3_INIT_GEN; | ||
| 1121 | rq->comp_ring.next2proc = 0; | ||
| 1122 | } | ||
| 1123 | |||
| 1124 | |||
| 1125 | void vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq, | ||
| 1126 | struct vmxnet3_adapter *adapter) | ||
| 1127 | { | ||
| 1128 | int i; | ||
| 1129 | int j; | ||
| 1130 | |||
| 1131 | /* all rx buffers must have already been freed */ | ||
| 1132 | for (i = 0; i < 2; i++) { | ||
| 1133 | if (rq->buf_info[i]) { | ||
| 1134 | for (j = 0; j < rq->rx_ring[i].size; j++) | ||
| 1135 | BUG_ON(rq->buf_info[i][j].page != NULL); | ||
| 1136 | } | ||
| 1137 | } | ||
| 1138 | |||
| 1139 | |||
| 1140 | kfree(rq->buf_info[0]); | ||
| 1141 | |||
| 1142 | for (i = 0; i < 2; i++) { | ||
| 1143 | if (rq->rx_ring[i].base) { | ||
| 1144 | pci_free_consistent(adapter->pdev, rq->rx_ring[i].size | ||
| 1145 | * sizeof(struct Vmxnet3_RxDesc), | ||
| 1146 | rq->rx_ring[i].base, | ||
| 1147 | rq->rx_ring[i].basePA); | ||
| 1148 | rq->rx_ring[i].base = NULL; | ||
| 1149 | } | ||
| 1150 | rq->buf_info[i] = NULL; | ||
| 1151 | } | ||
| 1152 | |||
| 1153 | if (rq->comp_ring.base) { | ||
| 1154 | pci_free_consistent(adapter->pdev, rq->comp_ring.size * | ||
| 1155 | sizeof(struct Vmxnet3_RxCompDesc), | ||
| 1156 | rq->comp_ring.base, rq->comp_ring.basePA); | ||
| 1157 | rq->comp_ring.base = NULL; | ||
| 1158 | } | ||
| 1159 | } | ||
| 1160 | |||
| 1161 | |||
| 1162 | static int | ||
| 1163 | vmxnet3_rq_init(struct vmxnet3_rx_queue *rq, | ||
| 1164 | struct vmxnet3_adapter *adapter) | ||
| 1165 | { | ||
| 1166 | int i; | ||
| 1167 | |||
| 1168 | /* initialize buf_info */ | ||
| 1169 | for (i = 0; i < rq->rx_ring[0].size; i++) { | ||
| 1170 | |||
| 1171 | /* 1st buf for a pkt is skbuff */ | ||
| 1172 | if (i % adapter->rx_buf_per_pkt == 0) { | ||
| 1173 | rq->buf_info[0][i].buf_type = VMXNET3_RX_BUF_SKB; | ||
| 1174 | rq->buf_info[0][i].len = adapter->skb_buf_size; | ||
| 1175 | } else { /* subsequent bufs for a pkt is frag */ | ||
| 1176 | rq->buf_info[0][i].buf_type = VMXNET3_RX_BUF_PAGE; | ||
| 1177 | rq->buf_info[0][i].len = PAGE_SIZE; | ||
| 1178 | } | ||
| 1179 | } | ||
| 1180 | for (i = 0; i < rq->rx_ring[1].size; i++) { | ||
| 1181 | rq->buf_info[1][i].buf_type = VMXNET3_RX_BUF_PAGE; | ||
| 1182 | rq->buf_info[1][i].len = PAGE_SIZE; | ||
| 1183 | } | ||
| 1184 | |||
| 1185 | /* reset internal state and allocate buffers for both rings */ | ||
| 1186 | for (i = 0; i < 2; i++) { | ||
| 1187 | rq->rx_ring[i].next2fill = rq->rx_ring[i].next2comp = 0; | ||
| 1188 | rq->uncommitted[i] = 0; | ||
| 1189 | |||
| 1190 | memset(rq->rx_ring[i].base, 0, rq->rx_ring[i].size * | ||
| 1191 | sizeof(struct Vmxnet3_RxDesc)); | ||
| 1192 | rq->rx_ring[i].gen = VMXNET3_INIT_GEN; | ||
| 1193 | } | ||
| 1194 | if (vmxnet3_rq_alloc_rx_buf(rq, 0, rq->rx_ring[0].size - 1, | ||
| 1195 | adapter) == 0) { | ||
| 1196 | /* at least has 1 rx buffer for the 1st ring */ | ||
| 1197 | return -ENOMEM; | ||
| 1198 | } | ||
| 1199 | vmxnet3_rq_alloc_rx_buf(rq, 1, rq->rx_ring[1].size - 1, adapter); | ||
| 1200 | |||
| 1201 | /* reset the comp ring */ | ||
| 1202 | rq->comp_ring.next2proc = 0; | ||
| 1203 | memset(rq->comp_ring.base, 0, rq->comp_ring.size * | ||
| 1204 | sizeof(struct Vmxnet3_RxCompDesc)); | ||
| 1205 | rq->comp_ring.gen = VMXNET3_INIT_GEN; | ||
| 1206 | |||
| 1207 | /* reset rxctx */ | ||
| 1208 | rq->rx_ctx.skb = NULL; | ||
| 1209 | |||
| 1210 | /* stats are not reset */ | ||
| 1211 | return 0; | ||
| 1212 | } | ||
| 1213 | |||
| 1214 | |||
| 1215 | static int | ||
| 1216 | vmxnet3_rq_create(struct vmxnet3_rx_queue *rq, struct vmxnet3_adapter *adapter) | ||
| 1217 | { | ||
| 1218 | int i; | ||
| 1219 | size_t sz; | ||
| 1220 | struct vmxnet3_rx_buf_info *bi; | ||
| 1221 | |||
| 1222 | for (i = 0; i < 2; i++) { | ||
| 1223 | |||
| 1224 | sz = rq->rx_ring[i].size * sizeof(struct Vmxnet3_RxDesc); | ||
| 1225 | rq->rx_ring[i].base = pci_alloc_consistent(adapter->pdev, sz, | ||
| 1226 | &rq->rx_ring[i].basePA); | ||
| 1227 | if (!rq->rx_ring[i].base) { | ||
| 1228 | printk(KERN_ERR "%s: failed to allocate rx ring %d\n", | ||
| 1229 | adapter->netdev->name, i); | ||
| 1230 | goto err; | ||
| 1231 | } | ||
| 1232 | } | ||
| 1233 | |||
| 1234 | sz = rq->comp_ring.size * sizeof(struct Vmxnet3_RxCompDesc); | ||
| 1235 | rq->comp_ring.base = pci_alloc_consistent(adapter->pdev, sz, | ||
| 1236 | &rq->comp_ring.basePA); | ||
| 1237 | if (!rq->comp_ring.base) { | ||
| 1238 | printk(KERN_ERR "%s: failed to allocate rx comp ring\n", | ||
| 1239 | adapter->netdev->name); | ||
| 1240 | goto err; | ||
| 1241 | } | ||
| 1242 | |||
| 1243 | sz = sizeof(struct vmxnet3_rx_buf_info) * (rq->rx_ring[0].size + | ||
| 1244 | rq->rx_ring[1].size); | ||
| 1245 | bi = kmalloc(sz, GFP_KERNEL); | ||
| 1246 | if (!bi) { | ||
| 1247 | printk(KERN_ERR "%s: failed to allocate rx bufinfo\n", | ||
| 1248 | adapter->netdev->name); | ||
| 1249 | goto err; | ||
| 1250 | } | ||
| 1251 | memset(bi, 0, sz); | ||
| 1252 | rq->buf_info[0] = bi; | ||
| 1253 | rq->buf_info[1] = bi + rq->rx_ring[0].size; | ||
| 1254 | |||
| 1255 | return 0; | ||
| 1256 | |||
| 1257 | err: | ||
| 1258 | vmxnet3_rq_destroy(rq, adapter); | ||
| 1259 | return -ENOMEM; | ||
| 1260 | } | ||
| 1261 | |||
| 1262 | |||
| 1263 | static int | ||
| 1264 | vmxnet3_do_poll(struct vmxnet3_adapter *adapter, int budget) | ||
| 1265 | { | ||
| 1266 | if (unlikely(adapter->shared->ecr)) | ||
| 1267 | vmxnet3_process_events(adapter); | ||
| 1268 | |||
| 1269 | vmxnet3_tq_tx_complete(&adapter->tx_queue, adapter); | ||
| 1270 | return vmxnet3_rq_rx_complete(&adapter->rx_queue, adapter, budget); | ||
| 1271 | } | ||
| 1272 | |||
| 1273 | |||
| 1274 | static int | ||
| 1275 | vmxnet3_poll(struct napi_struct *napi, int budget) | ||
| 1276 | { | ||
| 1277 | struct vmxnet3_adapter *adapter = container_of(napi, | ||
| 1278 | struct vmxnet3_adapter, napi); | ||
| 1279 | int rxd_done; | ||
| 1280 | |||
| 1281 | rxd_done = vmxnet3_do_poll(adapter, budget); | ||
| 1282 | |||
| 1283 | if (rxd_done < budget) { | ||
| 1284 | napi_complete(napi); | ||
| 1285 | vmxnet3_enable_intr(adapter, 0); | ||
| 1286 | } | ||
| 1287 | return rxd_done; | ||
| 1288 | } | ||
| 1289 | |||
| 1290 | |||
| 1291 | /* Interrupt handler for vmxnet3 */ | ||
| 1292 | static irqreturn_t | ||
| 1293 | vmxnet3_intr(int irq, void *dev_id) | ||
| 1294 | { | ||
| 1295 | struct net_device *dev = dev_id; | ||
| 1296 | struct vmxnet3_adapter *adapter = netdev_priv(dev); | ||
| 1297 | |||
| 1298 | if (unlikely(adapter->intr.type == VMXNET3_IT_INTX)) { | ||
| 1299 | u32 icr = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_ICR); | ||
| 1300 | if (unlikely(icr == 0)) | ||
| 1301 | /* not ours */ | ||
| 1302 | return IRQ_NONE; | ||
| 1303 | } | ||
| 1304 | |||
| 1305 | |||
| 1306 | /* disable intr if needed */ | ||
| 1307 | if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE) | ||
| 1308 | vmxnet3_disable_intr(adapter, 0); | ||
| 1309 | |||
| 1310 | napi_schedule(&adapter->napi); | ||
| 1311 | |||
| 1312 | return IRQ_HANDLED; | ||
| 1313 | } | ||
| 1314 | |||
| 1315 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 1316 | |||
| 1317 | |||
| 1318 | /* netpoll callback. */ | ||
| 1319 | static void | ||
| 1320 | vmxnet3_netpoll(struct net_device *netdev) | ||
| 1321 | { | ||
| 1322 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 1323 | int irq; | ||
| 1324 | |||
| 1325 | #ifdef CONFIG_PCI_MSI | ||
| 1326 | if (adapter->intr.type == VMXNET3_IT_MSIX) | ||
| 1327 | irq = adapter->intr.msix_entries[0].vector; | ||
| 1328 | else | ||
| 1329 | #endif | ||
| 1330 | irq = adapter->pdev->irq; | ||
| 1331 | |||
| 1332 | disable_irq(irq); | ||
| 1333 | vmxnet3_intr(irq, netdev); | ||
| 1334 | enable_irq(irq); | ||
| 1335 | } | ||
| 1336 | #endif | ||
| 1337 | |||
| 1338 | static int | ||
| 1339 | vmxnet3_request_irqs(struct vmxnet3_adapter *adapter) | ||
| 1340 | { | ||
| 1341 | int err; | ||
| 1342 | |||
| 1343 | #ifdef CONFIG_PCI_MSI | ||
| 1344 | if (adapter->intr.type == VMXNET3_IT_MSIX) { | ||
| 1345 | /* we only use 1 MSI-X vector */ | ||
| 1346 | err = request_irq(adapter->intr.msix_entries[0].vector, | ||
| 1347 | vmxnet3_intr, 0, adapter->netdev->name, | ||
| 1348 | adapter->netdev); | ||
| 1349 | } else | ||
| 1350 | #endif | ||
| 1351 | if (adapter->intr.type == VMXNET3_IT_MSI) { | ||
| 1352 | err = request_irq(adapter->pdev->irq, vmxnet3_intr, 0, | ||
| 1353 | adapter->netdev->name, adapter->netdev); | ||
| 1354 | } else { | ||
| 1355 | err = request_irq(adapter->pdev->irq, vmxnet3_intr, | ||
| 1356 | IRQF_SHARED, adapter->netdev->name, | ||
| 1357 | adapter->netdev); | ||
| 1358 | } | ||
| 1359 | |||
| 1360 | if (err) | ||
| 1361 | printk(KERN_ERR "Failed to request irq %s (intr type:%d), error" | ||
| 1362 | ":%d\n", adapter->netdev->name, adapter->intr.type, err); | ||
| 1363 | |||
| 1364 | |||
| 1365 | if (!err) { | ||
| 1366 | int i; | ||
| 1367 | /* init our intr settings */ | ||
| 1368 | for (i = 0; i < adapter->intr.num_intrs; i++) | ||
| 1369 | adapter->intr.mod_levels[i] = UPT1_IML_ADAPTIVE; | ||
| 1370 | |||
| 1371 | /* next setup intr index for all intr sources */ | ||
| 1372 | adapter->tx_queue.comp_ring.intr_idx = 0; | ||
| 1373 | adapter->rx_queue.comp_ring.intr_idx = 0; | ||
| 1374 | adapter->intr.event_intr_idx = 0; | ||
| 1375 | |||
| 1376 | printk(KERN_INFO "%s: intr type %u, mode %u, %u vectors " | ||
| 1377 | "allocated\n", adapter->netdev->name, adapter->intr.type, | ||
| 1378 | adapter->intr.mask_mode, adapter->intr.num_intrs); | ||
| 1379 | } | ||
| 1380 | |||
| 1381 | return err; | ||
| 1382 | } | ||
| 1383 | |||
| 1384 | |||
| 1385 | static void | ||
| 1386 | vmxnet3_free_irqs(struct vmxnet3_adapter *adapter) | ||
| 1387 | { | ||
| 1388 | BUG_ON(adapter->intr.type == VMXNET3_IT_AUTO || | ||
| 1389 | adapter->intr.num_intrs <= 0); | ||
| 1390 | |||
| 1391 | switch (adapter->intr.type) { | ||
| 1392 | #ifdef CONFIG_PCI_MSI | ||
| 1393 | case VMXNET3_IT_MSIX: | ||
| 1394 | { | ||
| 1395 | int i; | ||
| 1396 | |||
| 1397 | for (i = 0; i < adapter->intr.num_intrs; i++) | ||
| 1398 | free_irq(adapter->intr.msix_entries[i].vector, | ||
| 1399 | adapter->netdev); | ||
| 1400 | break; | ||
| 1401 | } | ||
| 1402 | #endif | ||
| 1403 | case VMXNET3_IT_MSI: | ||
| 1404 | free_irq(adapter->pdev->irq, adapter->netdev); | ||
| 1405 | break; | ||
| 1406 | case VMXNET3_IT_INTX: | ||
| 1407 | free_irq(adapter->pdev->irq, adapter->netdev); | ||
| 1408 | break; | ||
| 1409 | default: | ||
| 1410 | BUG_ON(true); | ||
| 1411 | } | ||
| 1412 | } | ||
| 1413 | |||
| 1414 | |||
| 1415 | static void | ||
| 1416 | vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | ||
| 1417 | { | ||
| 1418 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 1419 | struct Vmxnet3_DriverShared *shared = adapter->shared; | ||
| 1420 | u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable; | ||
| 1421 | |||
| 1422 | if (grp) { | ||
| 1423 | /* add vlan rx stripping. */ | ||
| 1424 | if (adapter->netdev->features & NETIF_F_HW_VLAN_RX) { | ||
| 1425 | int i; | ||
| 1426 | struct Vmxnet3_DSDevRead *devRead = &shared->devRead; | ||
| 1427 | adapter->vlan_grp = grp; | ||
| 1428 | |||
| 1429 | /* update FEATURES to device */ | ||
| 1430 | devRead->misc.uptFeatures |= UPT1_F_RXVLAN; | ||
| 1431 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 1432 | VMXNET3_CMD_UPDATE_FEATURE); | ||
| 1433 | /* | ||
| 1434 | * Clear entire vfTable; then enable untagged pkts. | ||
| 1435 | * Note: setting one entry in vfTable to non-zero turns | ||
| 1436 | * on VLAN rx filtering. | ||
| 1437 | */ | ||
| 1438 | for (i = 0; i < VMXNET3_VFT_SIZE; i++) | ||
| 1439 | vfTable[i] = 0; | ||
| 1440 | |||
| 1441 | VMXNET3_SET_VFTABLE_ENTRY(vfTable, 0); | ||
| 1442 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 1443 | VMXNET3_CMD_UPDATE_VLAN_FILTERS); | ||
| 1444 | } else { | ||
| 1445 | printk(KERN_ERR "%s: vlan_rx_register when device has " | ||
| 1446 | "no NETIF_F_HW_VLAN_RX\n", netdev->name); | ||
| 1447 | } | ||
| 1448 | } else { | ||
| 1449 | /* remove vlan rx stripping. */ | ||
| 1450 | struct Vmxnet3_DSDevRead *devRead = &shared->devRead; | ||
| 1451 | adapter->vlan_grp = NULL; | ||
| 1452 | |||
| 1453 | if (devRead->misc.uptFeatures & UPT1_F_RXVLAN) { | ||
| 1454 | int i; | ||
| 1455 | |||
| 1456 | for (i = 0; i < VMXNET3_VFT_SIZE; i++) { | ||
| 1457 | /* clear entire vfTable; this also disables | ||
| 1458 | * VLAN rx filtering | ||
| 1459 | */ | ||
| 1460 | vfTable[i] = 0; | ||
| 1461 | } | ||
| 1462 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 1463 | VMXNET3_CMD_UPDATE_VLAN_FILTERS); | ||
| 1464 | |||
| 1465 | /* update FEATURES to device */ | ||
| 1466 | devRead->misc.uptFeatures &= ~UPT1_F_RXVLAN; | ||
| 1467 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 1468 | VMXNET3_CMD_UPDATE_FEATURE); | ||
| 1469 | } | ||
| 1470 | } | ||
| 1471 | } | ||
| 1472 | |||
| 1473 | |||
| 1474 | static void | ||
| 1475 | vmxnet3_restore_vlan(struct vmxnet3_adapter *adapter) | ||
| 1476 | { | ||
| 1477 | if (adapter->vlan_grp) { | ||
| 1478 | u16 vid; | ||
| 1479 | u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable; | ||
| 1480 | bool activeVlan = false; | ||
| 1481 | |||
| 1482 | for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) { | ||
| 1483 | if (vlan_group_get_device(adapter->vlan_grp, vid)) { | ||
| 1484 | VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid); | ||
| 1485 | activeVlan = true; | ||
| 1486 | } | ||
| 1487 | } | ||
| 1488 | if (activeVlan) { | ||
| 1489 | /* continue to allow untagged pkts */ | ||
| 1490 | VMXNET3_SET_VFTABLE_ENTRY(vfTable, 0); | ||
| 1491 | } | ||
| 1492 | } | ||
| 1493 | } | ||
| 1494 | |||
| 1495 | |||
| 1496 | static void | ||
| 1497 | vmxnet3_vlan_rx_add_vid(struct net_device *netdev, u16 vid) | ||
| 1498 | { | ||
| 1499 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 1500 | u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable; | ||
| 1501 | |||
| 1502 | VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid); | ||
| 1503 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 1504 | VMXNET3_CMD_UPDATE_VLAN_FILTERS); | ||
| 1505 | } | ||
| 1506 | |||
| 1507 | |||
| 1508 | static void | ||
| 1509 | vmxnet3_vlan_rx_kill_vid(struct net_device *netdev, u16 vid) | ||
| 1510 | { | ||
| 1511 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 1512 | u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable; | ||
| 1513 | |||
| 1514 | VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vid); | ||
| 1515 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 1516 | VMXNET3_CMD_UPDATE_VLAN_FILTERS); | ||
| 1517 | } | ||
| 1518 | |||
| 1519 | |||
| 1520 | static u8 * | ||
| 1521 | vmxnet3_copy_mc(struct net_device *netdev) | ||
| 1522 | { | ||
| 1523 | u8 *buf = NULL; | ||
| 1524 | u32 sz = netdev->mc_count * ETH_ALEN; | ||
| 1525 | |||
| 1526 | /* struct Vmxnet3_RxFilterConf.mfTableLen is u16. */ | ||
| 1527 | if (sz <= 0xffff) { | ||
| 1528 | /* We may be called with BH disabled */ | ||
| 1529 | buf = kmalloc(sz, GFP_ATOMIC); | ||
| 1530 | if (buf) { | ||
| 1531 | int i; | ||
| 1532 | struct dev_mc_list *mc = netdev->mc_list; | ||
| 1533 | |||
| 1534 | for (i = 0; i < netdev->mc_count; i++) { | ||
| 1535 | BUG_ON(!mc); | ||
| 1536 | memcpy(buf + i * ETH_ALEN, mc->dmi_addr, | ||
| 1537 | ETH_ALEN); | ||
| 1538 | mc = mc->next; | ||
| 1539 | } | ||
| 1540 | } | ||
| 1541 | } | ||
| 1542 | return buf; | ||
| 1543 | } | ||
| 1544 | |||
| 1545 | |||
| 1546 | static void | ||
| 1547 | vmxnet3_set_mc(struct net_device *netdev) | ||
| 1548 | { | ||
| 1549 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 1550 | struct Vmxnet3_RxFilterConf *rxConf = | ||
| 1551 | &adapter->shared->devRead.rxFilterConf; | ||
| 1552 | u8 *new_table = NULL; | ||
| 1553 | u32 new_mode = VMXNET3_RXM_UCAST; | ||
| 1554 | |||
| 1555 | if (netdev->flags & IFF_PROMISC) | ||
| 1556 | new_mode |= VMXNET3_RXM_PROMISC; | ||
| 1557 | |||
| 1558 | if (netdev->flags & IFF_BROADCAST) | ||
| 1559 | new_mode |= VMXNET3_RXM_BCAST; | ||
| 1560 | |||
| 1561 | if (netdev->flags & IFF_ALLMULTI) | ||
| 1562 | new_mode |= VMXNET3_RXM_ALL_MULTI; | ||
| 1563 | else | ||
| 1564 | if (netdev->mc_count > 0) { | ||
| 1565 | new_table = vmxnet3_copy_mc(netdev); | ||
| 1566 | if (new_table) { | ||
| 1567 | new_mode |= VMXNET3_RXM_MCAST; | ||
| 1568 | rxConf->mfTableLen = netdev->mc_count * | ||
| 1569 | ETH_ALEN; | ||
| 1570 | rxConf->mfTablePA = virt_to_phys(new_table); | ||
| 1571 | } else { | ||
| 1572 | printk(KERN_INFO "%s: failed to copy mcast list" | ||
| 1573 | ", setting ALL_MULTI\n", netdev->name); | ||
| 1574 | new_mode |= VMXNET3_RXM_ALL_MULTI; | ||
| 1575 | } | ||
| 1576 | } | ||
| 1577 | |||
| 1578 | |||
| 1579 | if (!(new_mode & VMXNET3_RXM_MCAST)) { | ||
| 1580 | rxConf->mfTableLen = 0; | ||
| 1581 | rxConf->mfTablePA = 0; | ||
| 1582 | } | ||
| 1583 | |||
| 1584 | if (new_mode != rxConf->rxMode) { | ||
| 1585 | rxConf->rxMode = new_mode; | ||
| 1586 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 1587 | VMXNET3_CMD_UPDATE_RX_MODE); | ||
| 1588 | } | ||
| 1589 | |||
| 1590 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 1591 | VMXNET3_CMD_UPDATE_MAC_FILTERS); | ||
| 1592 | |||
| 1593 | kfree(new_table); | ||
| 1594 | } | ||
| 1595 | |||
| 1596 | |||
| 1597 | /* | ||
| 1598 | * Set up driver_shared based on settings in adapter. | ||
| 1599 | */ | ||
| 1600 | |||
| 1601 | static void | ||
| 1602 | vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter) | ||
| 1603 | { | ||
| 1604 | struct Vmxnet3_DriverShared *shared = adapter->shared; | ||
| 1605 | struct Vmxnet3_DSDevRead *devRead = &shared->devRead; | ||
| 1606 | struct Vmxnet3_TxQueueConf *tqc; | ||
| 1607 | struct Vmxnet3_RxQueueConf *rqc; | ||
| 1608 | int i; | ||
| 1609 | |||
| 1610 | memset(shared, 0, sizeof(*shared)); | ||
| 1611 | |||
| 1612 | /* driver settings */ | ||
| 1613 | shared->magic = VMXNET3_REV1_MAGIC; | ||
| 1614 | devRead->misc.driverInfo.version = VMXNET3_DRIVER_VERSION_NUM; | ||
| 1615 | devRead->misc.driverInfo.gos.gosBits = (sizeof(void *) == 4 ? | ||
| 1616 | VMXNET3_GOS_BITS_32 : VMXNET3_GOS_BITS_64); | ||
| 1617 | devRead->misc.driverInfo.gos.gosType = VMXNET3_GOS_TYPE_LINUX; | ||
| 1618 | devRead->misc.driverInfo.vmxnet3RevSpt = 1; | ||
| 1619 | devRead->misc.driverInfo.uptVerSpt = 1; | ||
| 1620 | |||
| 1621 | devRead->misc.ddPA = virt_to_phys(adapter); | ||
| 1622 | devRead->misc.ddLen = sizeof(struct vmxnet3_adapter); | ||
| 1623 | |||
| 1624 | /* set up feature flags */ | ||
| 1625 | if (adapter->rxcsum) | ||
| 1626 | devRead->misc.uptFeatures |= UPT1_F_RXCSUM; | ||
| 1627 | |||
| 1628 | if (adapter->lro) { | ||
| 1629 | devRead->misc.uptFeatures |= UPT1_F_LRO; | ||
| 1630 | devRead->misc.maxNumRxSG = 1 + MAX_SKB_FRAGS; | ||
| 1631 | } | ||
| 1632 | if ((adapter->netdev->features & NETIF_F_HW_VLAN_RX) | ||
| 1633 | && adapter->vlan_grp) { | ||
| 1634 | devRead->misc.uptFeatures |= UPT1_F_RXVLAN; | ||
| 1635 | } | ||
| 1636 | |||
| 1637 | devRead->misc.mtu = adapter->netdev->mtu; | ||
| 1638 | devRead->misc.queueDescPA = adapter->queue_desc_pa; | ||
| 1639 | devRead->misc.queueDescLen = sizeof(struct Vmxnet3_TxQueueDesc) + | ||
| 1640 | sizeof(struct Vmxnet3_RxQueueDesc); | ||
| 1641 | |||
| 1642 | /* tx queue settings */ | ||
| 1643 | BUG_ON(adapter->tx_queue.tx_ring.base == NULL); | ||
| 1644 | |||
| 1645 | devRead->misc.numTxQueues = 1; | ||
| 1646 | tqc = &adapter->tqd_start->conf; | ||
| 1647 | tqc->txRingBasePA = adapter->tx_queue.tx_ring.basePA; | ||
| 1648 | tqc->dataRingBasePA = adapter->tx_queue.data_ring.basePA; | ||
| 1649 | tqc->compRingBasePA = adapter->tx_queue.comp_ring.basePA; | ||
| 1650 | tqc->ddPA = virt_to_phys(adapter->tx_queue.buf_info); | ||
| 1651 | tqc->txRingSize = adapter->tx_queue.tx_ring.size; | ||
| 1652 | tqc->dataRingSize = adapter->tx_queue.data_ring.size; | ||
| 1653 | tqc->compRingSize = adapter->tx_queue.comp_ring.size; | ||
| 1654 | tqc->ddLen = sizeof(struct vmxnet3_tx_buf_info) * | ||
| 1655 | tqc->txRingSize; | ||
| 1656 | tqc->intrIdx = adapter->tx_queue.comp_ring.intr_idx; | ||
| 1657 | |||
| 1658 | /* rx queue settings */ | ||
| 1659 | devRead->misc.numRxQueues = 1; | ||
| 1660 | rqc = &adapter->rqd_start->conf; | ||
| 1661 | rqc->rxRingBasePA[0] = adapter->rx_queue.rx_ring[0].basePA; | ||
| 1662 | rqc->rxRingBasePA[1] = adapter->rx_queue.rx_ring[1].basePA; | ||
| 1663 | rqc->compRingBasePA = adapter->rx_queue.comp_ring.basePA; | ||
| 1664 | rqc->ddPA = virt_to_phys(adapter->rx_queue.buf_info); | ||
| 1665 | rqc->rxRingSize[0] = adapter->rx_queue.rx_ring[0].size; | ||
| 1666 | rqc->rxRingSize[1] = adapter->rx_queue.rx_ring[1].size; | ||
| 1667 | rqc->compRingSize = adapter->rx_queue.comp_ring.size; | ||
| 1668 | rqc->ddLen = sizeof(struct vmxnet3_rx_buf_info) * | ||
| 1669 | (rqc->rxRingSize[0] + rqc->rxRingSize[1]); | ||
| 1670 | rqc->intrIdx = adapter->rx_queue.comp_ring.intr_idx; | ||
| 1671 | |||
| 1672 | /* intr settings */ | ||
| 1673 | devRead->intrConf.autoMask = adapter->intr.mask_mode == | ||
| 1674 | VMXNET3_IMM_AUTO; | ||
| 1675 | devRead->intrConf.numIntrs = adapter->intr.num_intrs; | ||
| 1676 | for (i = 0; i < adapter->intr.num_intrs; i++) | ||
| 1677 | devRead->intrConf.modLevels[i] = adapter->intr.mod_levels[i]; | ||
| 1678 | |||
| 1679 | devRead->intrConf.eventIntrIdx = adapter->intr.event_intr_idx; | ||
| 1680 | |||
| 1681 | /* rx filter settings */ | ||
| 1682 | devRead->rxFilterConf.rxMode = 0; | ||
| 1683 | vmxnet3_restore_vlan(adapter); | ||
| 1684 | /* the rest are already zeroed */ | ||
| 1685 | } | ||
| 1686 | |||
| 1687 | |||
| 1688 | int | ||
| 1689 | vmxnet3_activate_dev(struct vmxnet3_adapter *adapter) | ||
| 1690 | { | ||
| 1691 | int err; | ||
| 1692 | u32 ret; | ||
| 1693 | |||
| 1694 | dev_dbg(&adapter->netdev->dev, | ||
| 1695 | "%s: skb_buf_size %d, rx_buf_per_pkt %d, ring sizes" | ||
| 1696 | " %u %u %u\n", adapter->netdev->name, adapter->skb_buf_size, | ||
| 1697 | adapter->rx_buf_per_pkt, adapter->tx_queue.tx_ring.size, | ||
| 1698 | adapter->rx_queue.rx_ring[0].size, | ||
| 1699 | adapter->rx_queue.rx_ring[1].size); | ||
| 1700 | |||
| 1701 | vmxnet3_tq_init(&adapter->tx_queue, adapter); | ||
| 1702 | err = vmxnet3_rq_init(&adapter->rx_queue, adapter); | ||
| 1703 | if (err) { | ||
| 1704 | printk(KERN_ERR "Failed to init rx queue for %s: error %d\n", | ||
| 1705 | adapter->netdev->name, err); | ||
| 1706 | goto rq_err; | ||
| 1707 | } | ||
| 1708 | |||
| 1709 | err = vmxnet3_request_irqs(adapter); | ||
| 1710 | if (err) { | ||
| 1711 | printk(KERN_ERR "Failed to setup irq for %s: error %d\n", | ||
| 1712 | adapter->netdev->name, err); | ||
| 1713 | goto irq_err; | ||
| 1714 | } | ||
| 1715 | |||
| 1716 | vmxnet3_setup_driver_shared(adapter); | ||
| 1717 | |||
| 1718 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAL, | ||
| 1719 | VMXNET3_GET_ADDR_LO(adapter->shared_pa)); | ||
| 1720 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAH, | ||
| 1721 | VMXNET3_GET_ADDR_HI(adapter->shared_pa)); | ||
| 1722 | |||
| 1723 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 1724 | VMXNET3_CMD_ACTIVATE_DEV); | ||
| 1725 | ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); | ||
| 1726 | |||
| 1727 | if (ret != 0) { | ||
| 1728 | printk(KERN_ERR "Failed to activate dev %s: error %u\n", | ||
| 1729 | adapter->netdev->name, ret); | ||
| 1730 | err = -EINVAL; | ||
| 1731 | goto activate_err; | ||
| 1732 | } | ||
| 1733 | VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_RXPROD, | ||
| 1734 | adapter->rx_queue.rx_ring[0].next2fill); | ||
| 1735 | VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_RXPROD2, | ||
| 1736 | adapter->rx_queue.rx_ring[1].next2fill); | ||
| 1737 | |||
| 1738 | /* Apply the rx filter settins last. */ | ||
| 1739 | vmxnet3_set_mc(adapter->netdev); | ||
| 1740 | |||
| 1741 | /* | ||
| 1742 | * Check link state when first activating device. It will start the | ||
| 1743 | * tx queue if the link is up. | ||
| 1744 | */ | ||
| 1745 | vmxnet3_check_link(adapter); | ||
| 1746 | |||
| 1747 | napi_enable(&adapter->napi); | ||
| 1748 | vmxnet3_enable_all_intrs(adapter); | ||
| 1749 | clear_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state); | ||
| 1750 | return 0; | ||
| 1751 | |||
| 1752 | activate_err: | ||
| 1753 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAL, 0); | ||
| 1754 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAH, 0); | ||
| 1755 | vmxnet3_free_irqs(adapter); | ||
| 1756 | irq_err: | ||
| 1757 | rq_err: | ||
| 1758 | /* free up buffers we allocated */ | ||
| 1759 | vmxnet3_rq_cleanup(&adapter->rx_queue, adapter); | ||
| 1760 | return err; | ||
| 1761 | } | ||
| 1762 | |||
| 1763 | |||
| 1764 | void | ||
| 1765 | vmxnet3_reset_dev(struct vmxnet3_adapter *adapter) | ||
| 1766 | { | ||
| 1767 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_RESET_DEV); | ||
| 1768 | } | ||
| 1769 | |||
| 1770 | |||
| 1771 | int | ||
| 1772 | vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter) | ||
| 1773 | { | ||
| 1774 | if (test_and_set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state)) | ||
| 1775 | return 0; | ||
| 1776 | |||
| 1777 | |||
| 1778 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 1779 | VMXNET3_CMD_QUIESCE_DEV); | ||
| 1780 | vmxnet3_disable_all_intrs(adapter); | ||
| 1781 | |||
| 1782 | napi_disable(&adapter->napi); | ||
| 1783 | netif_tx_disable(adapter->netdev); | ||
| 1784 | adapter->link_speed = 0; | ||
| 1785 | netif_carrier_off(adapter->netdev); | ||
| 1786 | |||
| 1787 | vmxnet3_tq_cleanup(&adapter->tx_queue, adapter); | ||
| 1788 | vmxnet3_rq_cleanup(&adapter->rx_queue, adapter); | ||
| 1789 | vmxnet3_free_irqs(adapter); | ||
| 1790 | return 0; | ||
| 1791 | } | ||
| 1792 | |||
| 1793 | |||
| 1794 | static void | ||
| 1795 | vmxnet3_write_mac_addr(struct vmxnet3_adapter *adapter, u8 *mac) | ||
| 1796 | { | ||
| 1797 | u32 tmp; | ||
| 1798 | |||
| 1799 | tmp = *(u32 *)mac; | ||
| 1800 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_MACL, tmp); | ||
| 1801 | |||
| 1802 | tmp = (mac[5] << 8) | mac[4]; | ||
| 1803 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_MACH, tmp); | ||
| 1804 | } | ||
| 1805 | |||
| 1806 | |||
| 1807 | static int | ||
| 1808 | vmxnet3_set_mac_addr(struct net_device *netdev, void *p) | ||
| 1809 | { | ||
| 1810 | struct sockaddr *addr = p; | ||
| 1811 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 1812 | |||
| 1813 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | ||
| 1814 | vmxnet3_write_mac_addr(adapter, addr->sa_data); | ||
| 1815 | |||
| 1816 | return 0; | ||
| 1817 | } | ||
| 1818 | |||
| 1819 | |||
| 1820 | /* ==================== initialization and cleanup routines ============ */ | ||
| 1821 | |||
| 1822 | static int | ||
| 1823 | vmxnet3_alloc_pci_resources(struct vmxnet3_adapter *adapter, bool *dma64) | ||
| 1824 | { | ||
| 1825 | int err; | ||
| 1826 | unsigned long mmio_start, mmio_len; | ||
| 1827 | struct pci_dev *pdev = adapter->pdev; | ||
| 1828 | |||
| 1829 | err = pci_enable_device(pdev); | ||
| 1830 | if (err) { | ||
| 1831 | printk(KERN_ERR "Failed to enable adapter %s: error %d\n", | ||
| 1832 | pci_name(pdev), err); | ||
| 1833 | return err; | ||
| 1834 | } | ||
| 1835 | |||
| 1836 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) { | ||
| 1837 | if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) { | ||
| 1838 | printk(KERN_ERR "pci_set_consistent_dma_mask failed " | ||
| 1839 | "for adapter %s\n", pci_name(pdev)); | ||
| 1840 | err = -EIO; | ||
| 1841 | goto err_set_mask; | ||
| 1842 | } | ||
| 1843 | *dma64 = true; | ||
| 1844 | } else { | ||
| 1845 | if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) { | ||
| 1846 | printk(KERN_ERR "pci_set_dma_mask failed for adapter " | ||
| 1847 | "%s\n", pci_name(pdev)); | ||
| 1848 | err = -EIO; | ||
| 1849 | goto err_set_mask; | ||
| 1850 | } | ||
| 1851 | *dma64 = false; | ||
| 1852 | } | ||
| 1853 | |||
| 1854 | err = pci_request_selected_regions(pdev, (1 << 2) - 1, | ||
| 1855 | vmxnet3_driver_name); | ||
| 1856 | if (err) { | ||
| 1857 | printk(KERN_ERR "Failed to request region for adapter %s: " | ||
| 1858 | "error %d\n", pci_name(pdev), err); | ||
| 1859 | goto err_set_mask; | ||
| 1860 | } | ||
| 1861 | |||
| 1862 | pci_set_master(pdev); | ||
| 1863 | |||
| 1864 | mmio_start = pci_resource_start(pdev, 0); | ||
| 1865 | mmio_len = pci_resource_len(pdev, 0); | ||
| 1866 | adapter->hw_addr0 = ioremap(mmio_start, mmio_len); | ||
| 1867 | if (!adapter->hw_addr0) { | ||
| 1868 | printk(KERN_ERR "Failed to map bar0 for adapter %s\n", | ||
| 1869 | pci_name(pdev)); | ||
| 1870 | err = -EIO; | ||
| 1871 | goto err_ioremap; | ||
| 1872 | } | ||
| 1873 | |||
| 1874 | mmio_start = pci_resource_start(pdev, 1); | ||
| 1875 | mmio_len = pci_resource_len(pdev, 1); | ||
| 1876 | adapter->hw_addr1 = ioremap(mmio_start, mmio_len); | ||
| 1877 | if (!adapter->hw_addr1) { | ||
| 1878 | printk(KERN_ERR "Failed to map bar1 for adapter %s\n", | ||
| 1879 | pci_name(pdev)); | ||
| 1880 | err = -EIO; | ||
| 1881 | goto err_bar1; | ||
| 1882 | } | ||
| 1883 | return 0; | ||
| 1884 | |||
| 1885 | err_bar1: | ||
| 1886 | iounmap(adapter->hw_addr0); | ||
| 1887 | err_ioremap: | ||
| 1888 | pci_release_selected_regions(pdev, (1 << 2) - 1); | ||
| 1889 | err_set_mask: | ||
| 1890 | pci_disable_device(pdev); | ||
| 1891 | return err; | ||
| 1892 | } | ||
| 1893 | |||
| 1894 | |||
| 1895 | static void | ||
| 1896 | vmxnet3_free_pci_resources(struct vmxnet3_adapter *adapter) | ||
| 1897 | { | ||
| 1898 | BUG_ON(!adapter->pdev); | ||
| 1899 | |||
| 1900 | iounmap(adapter->hw_addr0); | ||
| 1901 | iounmap(adapter->hw_addr1); | ||
| 1902 | pci_release_selected_regions(adapter->pdev, (1 << 2) - 1); | ||
| 1903 | pci_disable_device(adapter->pdev); | ||
| 1904 | } | ||
| 1905 | |||
| 1906 | |||
| 1907 | static void | ||
| 1908 | vmxnet3_adjust_rx_ring_size(struct vmxnet3_adapter *adapter) | ||
| 1909 | { | ||
| 1910 | size_t sz; | ||
| 1911 | |||
| 1912 | if (adapter->netdev->mtu <= VMXNET3_MAX_SKB_BUF_SIZE - | ||
| 1913 | VMXNET3_MAX_ETH_HDR_SIZE) { | ||
| 1914 | adapter->skb_buf_size = adapter->netdev->mtu + | ||
| 1915 | VMXNET3_MAX_ETH_HDR_SIZE; | ||
| 1916 | if (adapter->skb_buf_size < VMXNET3_MIN_T0_BUF_SIZE) | ||
| 1917 | adapter->skb_buf_size = VMXNET3_MIN_T0_BUF_SIZE; | ||
| 1918 | |||
| 1919 | adapter->rx_buf_per_pkt = 1; | ||
| 1920 | } else { | ||
| 1921 | adapter->skb_buf_size = VMXNET3_MAX_SKB_BUF_SIZE; | ||
| 1922 | sz = adapter->netdev->mtu - VMXNET3_MAX_SKB_BUF_SIZE + | ||
| 1923 | VMXNET3_MAX_ETH_HDR_SIZE; | ||
| 1924 | adapter->rx_buf_per_pkt = 1 + (sz + PAGE_SIZE - 1) / PAGE_SIZE; | ||
| 1925 | } | ||
| 1926 | |||
| 1927 | /* | ||
| 1928 | * for simplicity, force the ring0 size to be a multiple of | ||
| 1929 | * rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN | ||
| 1930 | */ | ||
| 1931 | sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN; | ||
| 1932 | adapter->rx_queue.rx_ring[0].size = (adapter->rx_queue.rx_ring[0].size + | ||
| 1933 | sz - 1) / sz * sz; | ||
| 1934 | adapter->rx_queue.rx_ring[0].size = min_t(u32, | ||
| 1935 | adapter->rx_queue.rx_ring[0].size, | ||
| 1936 | VMXNET3_RX_RING_MAX_SIZE / sz * sz); | ||
| 1937 | } | ||
| 1938 | |||
| 1939 | |||
| 1940 | int | ||
| 1941 | vmxnet3_create_queues(struct vmxnet3_adapter *adapter, u32 tx_ring_size, | ||
| 1942 | u32 rx_ring_size, u32 rx_ring2_size) | ||
| 1943 | { | ||
| 1944 | int err; | ||
| 1945 | |||
| 1946 | adapter->tx_queue.tx_ring.size = tx_ring_size; | ||
| 1947 | adapter->tx_queue.data_ring.size = tx_ring_size; | ||
| 1948 | adapter->tx_queue.comp_ring.size = tx_ring_size; | ||
| 1949 | adapter->tx_queue.shared = &adapter->tqd_start->ctrl; | ||
| 1950 | adapter->tx_queue.stopped = true; | ||
| 1951 | err = vmxnet3_tq_create(&adapter->tx_queue, adapter); | ||
| 1952 | if (err) | ||
| 1953 | return err; | ||
| 1954 | |||
| 1955 | adapter->rx_queue.rx_ring[0].size = rx_ring_size; | ||
| 1956 | adapter->rx_queue.rx_ring[1].size = rx_ring2_size; | ||
| 1957 | vmxnet3_adjust_rx_ring_size(adapter); | ||
| 1958 | adapter->rx_queue.comp_ring.size = adapter->rx_queue.rx_ring[0].size + | ||
| 1959 | adapter->rx_queue.rx_ring[1].size; | ||
| 1960 | adapter->rx_queue.qid = 0; | ||
| 1961 | adapter->rx_queue.qid2 = 1; | ||
| 1962 | adapter->rx_queue.shared = &adapter->rqd_start->ctrl; | ||
| 1963 | err = vmxnet3_rq_create(&adapter->rx_queue, adapter); | ||
| 1964 | if (err) | ||
| 1965 | vmxnet3_tq_destroy(&adapter->tx_queue, adapter); | ||
| 1966 | |||
| 1967 | return err; | ||
| 1968 | } | ||
| 1969 | |||
| 1970 | static int | ||
| 1971 | vmxnet3_open(struct net_device *netdev) | ||
| 1972 | { | ||
| 1973 | struct vmxnet3_adapter *adapter; | ||
| 1974 | int err; | ||
| 1975 | |||
| 1976 | adapter = netdev_priv(netdev); | ||
| 1977 | |||
| 1978 | spin_lock_init(&adapter->tx_queue.tx_lock); | ||
| 1979 | |||
| 1980 | err = vmxnet3_create_queues(adapter, VMXNET3_DEF_TX_RING_SIZE, | ||
| 1981 | VMXNET3_DEF_RX_RING_SIZE, | ||
| 1982 | VMXNET3_DEF_RX_RING_SIZE); | ||
| 1983 | if (err) | ||
| 1984 | goto queue_err; | ||
| 1985 | |||
| 1986 | err = vmxnet3_activate_dev(adapter); | ||
| 1987 | if (err) | ||
| 1988 | goto activate_err; | ||
| 1989 | |||
| 1990 | return 0; | ||
| 1991 | |||
| 1992 | activate_err: | ||
| 1993 | vmxnet3_rq_destroy(&adapter->rx_queue, adapter); | ||
| 1994 | vmxnet3_tq_destroy(&adapter->tx_queue, adapter); | ||
| 1995 | queue_err: | ||
| 1996 | return err; | ||
| 1997 | } | ||
| 1998 | |||
| 1999 | |||
| 2000 | static int | ||
| 2001 | vmxnet3_close(struct net_device *netdev) | ||
| 2002 | { | ||
| 2003 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 2004 | |||
| 2005 | /* | ||
| 2006 | * Reset_work may be in the middle of resetting the device, wait for its | ||
| 2007 | * completion. | ||
| 2008 | */ | ||
| 2009 | while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state)) | ||
| 2010 | msleep(1); | ||
| 2011 | |||
| 2012 | vmxnet3_quiesce_dev(adapter); | ||
| 2013 | |||
| 2014 | vmxnet3_rq_destroy(&adapter->rx_queue, adapter); | ||
| 2015 | vmxnet3_tq_destroy(&adapter->tx_queue, adapter); | ||
| 2016 | |||
| 2017 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); | ||
| 2018 | |||
| 2019 | |||
| 2020 | return 0; | ||
| 2021 | } | ||
| 2022 | |||
| 2023 | |||
| 2024 | void | ||
| 2025 | vmxnet3_force_close(struct vmxnet3_adapter *adapter) | ||
| 2026 | { | ||
| 2027 | /* | ||
| 2028 | * we must clear VMXNET3_STATE_BIT_RESETTING, otherwise | ||
| 2029 | * vmxnet3_close() will deadlock. | ||
| 2030 | */ | ||
| 2031 | BUG_ON(test_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state)); | ||
| 2032 | |||
| 2033 | /* we need to enable NAPI, otherwise dev_close will deadlock */ | ||
| 2034 | napi_enable(&adapter->napi); | ||
| 2035 | dev_close(adapter->netdev); | ||
| 2036 | } | ||
| 2037 | |||
| 2038 | |||
| 2039 | static int | ||
| 2040 | vmxnet3_change_mtu(struct net_device *netdev, int new_mtu) | ||
| 2041 | { | ||
| 2042 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 2043 | int err = 0; | ||
| 2044 | |||
| 2045 | if (new_mtu < VMXNET3_MIN_MTU || new_mtu > VMXNET3_MAX_MTU) | ||
| 2046 | return -EINVAL; | ||
| 2047 | |||
| 2048 | if (new_mtu > 1500 && !adapter->jumbo_frame) | ||
| 2049 | return -EINVAL; | ||
| 2050 | |||
| 2051 | netdev->mtu = new_mtu; | ||
| 2052 | |||
| 2053 | /* | ||
| 2054 | * Reset_work may be in the middle of resetting the device, wait for its | ||
| 2055 | * completion. | ||
| 2056 | */ | ||
| 2057 | while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state)) | ||
| 2058 | msleep(1); | ||
| 2059 | |||
| 2060 | if (netif_running(netdev)) { | ||
| 2061 | vmxnet3_quiesce_dev(adapter); | ||
| 2062 | vmxnet3_reset_dev(adapter); | ||
| 2063 | |||
| 2064 | /* we need to re-create the rx queue based on the new mtu */ | ||
| 2065 | vmxnet3_rq_destroy(&adapter->rx_queue, adapter); | ||
| 2066 | vmxnet3_adjust_rx_ring_size(adapter); | ||
| 2067 | adapter->rx_queue.comp_ring.size = | ||
| 2068 | adapter->rx_queue.rx_ring[0].size + | ||
| 2069 | adapter->rx_queue.rx_ring[1].size; | ||
| 2070 | err = vmxnet3_rq_create(&adapter->rx_queue, adapter); | ||
| 2071 | if (err) { | ||
| 2072 | printk(KERN_ERR "%s: failed to re-create rx queue," | ||
| 2073 | " error %d. Closing it.\n", netdev->name, err); | ||
| 2074 | goto out; | ||
| 2075 | } | ||
| 2076 | |||
| 2077 | err = vmxnet3_activate_dev(adapter); | ||
| 2078 | if (err) { | ||
| 2079 | printk(KERN_ERR "%s: failed to re-activate, error %d. " | ||
| 2080 | "Closing it\n", netdev->name, err); | ||
| 2081 | goto out; | ||
| 2082 | } | ||
| 2083 | } | ||
| 2084 | |||
| 2085 | out: | ||
| 2086 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); | ||
| 2087 | if (err) | ||
| 2088 | vmxnet3_force_close(adapter); | ||
| 2089 | |||
| 2090 | return err; | ||
| 2091 | } | ||
| 2092 | |||
| 2093 | |||
| 2094 | static void | ||
| 2095 | vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64) | ||
| 2096 | { | ||
| 2097 | struct net_device *netdev = adapter->netdev; | ||
| 2098 | |||
| 2099 | netdev->features = NETIF_F_SG | | ||
| 2100 | NETIF_F_HW_CSUM | | ||
| 2101 | NETIF_F_HW_VLAN_TX | | ||
| 2102 | NETIF_F_HW_VLAN_RX | | ||
| 2103 | NETIF_F_HW_VLAN_FILTER | | ||
| 2104 | NETIF_F_TSO | | ||
| 2105 | NETIF_F_TSO6 | | ||
| 2106 | NETIF_F_LRO; | ||
| 2107 | |||
| 2108 | printk(KERN_INFO "features: sg csum vlan jf tso tsoIPv6 lro"); | ||
| 2109 | |||
| 2110 | adapter->rxcsum = true; | ||
| 2111 | adapter->jumbo_frame = true; | ||
| 2112 | adapter->lro = true; | ||
| 2113 | |||
| 2114 | if (dma64) { | ||
| 2115 | netdev->features |= NETIF_F_HIGHDMA; | ||
| 2116 | printk(" highDMA"); | ||
| 2117 | } | ||
| 2118 | |||
| 2119 | netdev->vlan_features = netdev->features; | ||
| 2120 | printk("\n"); | ||
| 2121 | } | ||
| 2122 | |||
| 2123 | |||
| 2124 | static void | ||
| 2125 | vmxnet3_read_mac_addr(struct vmxnet3_adapter *adapter, u8 *mac) | ||
| 2126 | { | ||
| 2127 | u32 tmp; | ||
| 2128 | |||
| 2129 | tmp = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_MACL); | ||
| 2130 | *(u32 *)mac = tmp; | ||
| 2131 | |||
| 2132 | tmp = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_MACH); | ||
| 2133 | mac[4] = tmp & 0xff; | ||
| 2134 | mac[5] = (tmp >> 8) & 0xff; | ||
| 2135 | } | ||
| 2136 | |||
| 2137 | |||
| 2138 | static void | ||
| 2139 | vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter) | ||
| 2140 | { | ||
| 2141 | u32 cfg; | ||
| 2142 | |||
| 2143 | /* intr settings */ | ||
| 2144 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 2145 | VMXNET3_CMD_GET_CONF_INTR); | ||
| 2146 | cfg = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); | ||
| 2147 | adapter->intr.type = cfg & 0x3; | ||
| 2148 | adapter->intr.mask_mode = (cfg >> 2) & 0x3; | ||
| 2149 | |||
| 2150 | if (adapter->intr.type == VMXNET3_IT_AUTO) { | ||
| 2151 | int err; | ||
| 2152 | |||
| 2153 | #ifdef CONFIG_PCI_MSI | ||
| 2154 | adapter->intr.msix_entries[0].entry = 0; | ||
| 2155 | err = pci_enable_msix(adapter->pdev, adapter->intr.msix_entries, | ||
| 2156 | VMXNET3_LINUX_MAX_MSIX_VECT); | ||
| 2157 | if (!err) { | ||
| 2158 | adapter->intr.num_intrs = 1; | ||
| 2159 | adapter->intr.type = VMXNET3_IT_MSIX; | ||
| 2160 | return; | ||
| 2161 | } | ||
| 2162 | #endif | ||
| 2163 | |||
| 2164 | err = pci_enable_msi(adapter->pdev); | ||
| 2165 | if (!err) { | ||
| 2166 | adapter->intr.num_intrs = 1; | ||
| 2167 | adapter->intr.type = VMXNET3_IT_MSI; | ||
| 2168 | return; | ||
| 2169 | } | ||
| 2170 | } | ||
| 2171 | |||
| 2172 | adapter->intr.type = VMXNET3_IT_INTX; | ||
| 2173 | |||
| 2174 | /* INT-X related setting */ | ||
| 2175 | adapter->intr.num_intrs = 1; | ||
| 2176 | } | ||
| 2177 | |||
| 2178 | |||
| 2179 | static void | ||
| 2180 | vmxnet3_free_intr_resources(struct vmxnet3_adapter *adapter) | ||
| 2181 | { | ||
| 2182 | if (adapter->intr.type == VMXNET3_IT_MSIX) | ||
| 2183 | pci_disable_msix(adapter->pdev); | ||
| 2184 | else if (adapter->intr.type == VMXNET3_IT_MSI) | ||
| 2185 | pci_disable_msi(adapter->pdev); | ||
| 2186 | else | ||
| 2187 | BUG_ON(adapter->intr.type != VMXNET3_IT_INTX); | ||
| 2188 | } | ||
| 2189 | |||
| 2190 | |||
| 2191 | static void | ||
| 2192 | vmxnet3_tx_timeout(struct net_device *netdev) | ||
| 2193 | { | ||
| 2194 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 2195 | adapter->tx_timeout_count++; | ||
| 2196 | |||
| 2197 | printk(KERN_ERR "%s: tx hang\n", adapter->netdev->name); | ||
| 2198 | schedule_work(&adapter->work); | ||
| 2199 | } | ||
| 2200 | |||
| 2201 | |||
| 2202 | static void | ||
| 2203 | vmxnet3_reset_work(struct work_struct *data) | ||
| 2204 | { | ||
| 2205 | struct vmxnet3_adapter *adapter; | ||
| 2206 | |||
| 2207 | adapter = container_of(data, struct vmxnet3_adapter, work); | ||
| 2208 | |||
| 2209 | /* if another thread is resetting the device, no need to proceed */ | ||
| 2210 | if (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state)) | ||
| 2211 | return; | ||
| 2212 | |||
| 2213 | /* if the device is closed, we must leave it alone */ | ||
| 2214 | if (netif_running(adapter->netdev)) { | ||
| 2215 | printk(KERN_INFO "%s: resetting\n", adapter->netdev->name); | ||
| 2216 | vmxnet3_quiesce_dev(adapter); | ||
| 2217 | vmxnet3_reset_dev(adapter); | ||
| 2218 | vmxnet3_activate_dev(adapter); | ||
| 2219 | } else { | ||
| 2220 | printk(KERN_INFO "%s: already closed\n", adapter->netdev->name); | ||
| 2221 | } | ||
| 2222 | |||
| 2223 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); | ||
| 2224 | } | ||
| 2225 | |||
| 2226 | |||
| 2227 | static int __devinit | ||
| 2228 | vmxnet3_probe_device(struct pci_dev *pdev, | ||
| 2229 | const struct pci_device_id *id) | ||
| 2230 | { | ||
| 2231 | static const struct net_device_ops vmxnet3_netdev_ops = { | ||
| 2232 | .ndo_open = vmxnet3_open, | ||
| 2233 | .ndo_stop = vmxnet3_close, | ||
| 2234 | .ndo_start_xmit = vmxnet3_xmit_frame, | ||
| 2235 | .ndo_set_mac_address = vmxnet3_set_mac_addr, | ||
| 2236 | .ndo_change_mtu = vmxnet3_change_mtu, | ||
| 2237 | .ndo_get_stats = vmxnet3_get_stats, | ||
| 2238 | .ndo_tx_timeout = vmxnet3_tx_timeout, | ||
| 2239 | .ndo_set_multicast_list = vmxnet3_set_mc, | ||
| 2240 | .ndo_vlan_rx_register = vmxnet3_vlan_rx_register, | ||
| 2241 | .ndo_vlan_rx_add_vid = vmxnet3_vlan_rx_add_vid, | ||
| 2242 | .ndo_vlan_rx_kill_vid = vmxnet3_vlan_rx_kill_vid, | ||
| 2243 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 2244 | .ndo_poll_controller = vmxnet3_netpoll, | ||
| 2245 | #endif | ||
| 2246 | }; | ||
| 2247 | int err; | ||
| 2248 | bool dma64 = false; /* stupid gcc */ | ||
| 2249 | u32 ver; | ||
| 2250 | struct net_device *netdev; | ||
| 2251 | struct vmxnet3_adapter *adapter; | ||
| 2252 | u8 mac[ETH_ALEN]; | ||
| 2253 | |||
| 2254 | netdev = alloc_etherdev(sizeof(struct vmxnet3_adapter)); | ||
| 2255 | if (!netdev) { | ||
| 2256 | printk(KERN_ERR "Failed to alloc ethernet device for adapter " | ||
| 2257 | "%s\n", pci_name(pdev)); | ||
| 2258 | return -ENOMEM; | ||
| 2259 | } | ||
| 2260 | |||
| 2261 | pci_set_drvdata(pdev, netdev); | ||
| 2262 | adapter = netdev_priv(netdev); | ||
| 2263 | adapter->netdev = netdev; | ||
| 2264 | adapter->pdev = pdev; | ||
| 2265 | |||
| 2266 | adapter->shared = pci_alloc_consistent(adapter->pdev, | ||
| 2267 | sizeof(struct Vmxnet3_DriverShared), | ||
| 2268 | &adapter->shared_pa); | ||
| 2269 | if (!adapter->shared) { | ||
| 2270 | printk(KERN_ERR "Failed to allocate memory for %s\n", | ||
| 2271 | pci_name(pdev)); | ||
| 2272 | err = -ENOMEM; | ||
| 2273 | goto err_alloc_shared; | ||
| 2274 | } | ||
| 2275 | |||
| 2276 | adapter->tqd_start = pci_alloc_consistent(adapter->pdev, | ||
| 2277 | sizeof(struct Vmxnet3_TxQueueDesc) + | ||
| 2278 | sizeof(struct Vmxnet3_RxQueueDesc), | ||
| 2279 | &adapter->queue_desc_pa); | ||
| 2280 | |||
| 2281 | if (!adapter->tqd_start) { | ||
| 2282 | printk(KERN_ERR "Failed to allocate memory for %s\n", | ||
| 2283 | pci_name(pdev)); | ||
| 2284 | err = -ENOMEM; | ||
| 2285 | goto err_alloc_queue_desc; | ||
| 2286 | } | ||
| 2287 | adapter->rqd_start = (struct Vmxnet3_RxQueueDesc *)(adapter->tqd_start | ||
| 2288 | + 1); | ||
| 2289 | |||
| 2290 | adapter->pm_conf = kmalloc(sizeof(struct Vmxnet3_PMConf), GFP_KERNEL); | ||
| 2291 | if (adapter->pm_conf == NULL) { | ||
| 2292 | printk(KERN_ERR "Failed to allocate memory for %s\n", | ||
| 2293 | pci_name(pdev)); | ||
| 2294 | err = -ENOMEM; | ||
| 2295 | goto err_alloc_pm; | ||
| 2296 | } | ||
| 2297 | |||
| 2298 | err = vmxnet3_alloc_pci_resources(adapter, &dma64); | ||
| 2299 | if (err < 0) | ||
| 2300 | goto err_alloc_pci; | ||
| 2301 | |||
| 2302 | ver = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_VRRS); | ||
| 2303 | if (ver & 1) { | ||
| 2304 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_VRRS, 1); | ||
| 2305 | } else { | ||
| 2306 | printk(KERN_ERR "Incompatible h/w version (0x%x) for adapter" | ||
| 2307 | " %s\n", ver, pci_name(pdev)); | ||
| 2308 | err = -EBUSY; | ||
| 2309 | goto err_ver; | ||
| 2310 | } | ||
| 2311 | |||
| 2312 | ver = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_UVRS); | ||
| 2313 | if (ver & 1) { | ||
| 2314 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_UVRS, 1); | ||
| 2315 | } else { | ||
| 2316 | printk(KERN_ERR "Incompatible upt version (0x%x) for " | ||
| 2317 | "adapter %s\n", ver, pci_name(pdev)); | ||
| 2318 | err = -EBUSY; | ||
| 2319 | goto err_ver; | ||
| 2320 | } | ||
| 2321 | |||
| 2322 | vmxnet3_declare_features(adapter, dma64); | ||
| 2323 | |||
| 2324 | adapter->dev_number = atomic_read(&devices_found); | ||
| 2325 | vmxnet3_alloc_intr_resources(adapter); | ||
| 2326 | |||
| 2327 | vmxnet3_read_mac_addr(adapter, mac); | ||
| 2328 | memcpy(netdev->dev_addr, mac, netdev->addr_len); | ||
| 2329 | |||
| 2330 | netdev->netdev_ops = &vmxnet3_netdev_ops; | ||
| 2331 | netdev->watchdog_timeo = 5 * HZ; | ||
| 2332 | vmxnet3_set_ethtool_ops(netdev); | ||
| 2333 | |||
| 2334 | INIT_WORK(&adapter->work, vmxnet3_reset_work); | ||
| 2335 | |||
| 2336 | netif_napi_add(netdev, &adapter->napi, vmxnet3_poll, 64); | ||
| 2337 | SET_NETDEV_DEV(netdev, &pdev->dev); | ||
| 2338 | err = register_netdev(netdev); | ||
| 2339 | |||
| 2340 | if (err) { | ||
| 2341 | printk(KERN_ERR "Failed to register adapter %s\n", | ||
| 2342 | pci_name(pdev)); | ||
| 2343 | goto err_register; | ||
| 2344 | } | ||
| 2345 | |||
| 2346 | set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state); | ||
| 2347 | atomic_inc(&devices_found); | ||
| 2348 | return 0; | ||
| 2349 | |||
| 2350 | err_register: | ||
| 2351 | vmxnet3_free_intr_resources(adapter); | ||
| 2352 | err_ver: | ||
| 2353 | vmxnet3_free_pci_resources(adapter); | ||
| 2354 | err_alloc_pci: | ||
| 2355 | kfree(adapter->pm_conf); | ||
| 2356 | err_alloc_pm: | ||
| 2357 | pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_TxQueueDesc) + | ||
| 2358 | sizeof(struct Vmxnet3_RxQueueDesc), | ||
| 2359 | adapter->tqd_start, adapter->queue_desc_pa); | ||
| 2360 | err_alloc_queue_desc: | ||
| 2361 | pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_DriverShared), | ||
| 2362 | adapter->shared, adapter->shared_pa); | ||
| 2363 | err_alloc_shared: | ||
| 2364 | pci_set_drvdata(pdev, NULL); | ||
| 2365 | free_netdev(netdev); | ||
| 2366 | return err; | ||
| 2367 | } | ||
| 2368 | |||
| 2369 | |||
| 2370 | static void __devexit | ||
| 2371 | vmxnet3_remove_device(struct pci_dev *pdev) | ||
| 2372 | { | ||
| 2373 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 2374 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 2375 | |||
| 2376 | flush_scheduled_work(); | ||
| 2377 | |||
| 2378 | unregister_netdev(netdev); | ||
| 2379 | |||
| 2380 | vmxnet3_free_intr_resources(adapter); | ||
| 2381 | vmxnet3_free_pci_resources(adapter); | ||
| 2382 | kfree(adapter->pm_conf); | ||
| 2383 | pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_TxQueueDesc) + | ||
| 2384 | sizeof(struct Vmxnet3_RxQueueDesc), | ||
| 2385 | adapter->tqd_start, adapter->queue_desc_pa); | ||
| 2386 | pci_free_consistent(adapter->pdev, sizeof(struct Vmxnet3_DriverShared), | ||
| 2387 | adapter->shared, adapter->shared_pa); | ||
| 2388 | free_netdev(netdev); | ||
| 2389 | } | ||
| 2390 | |||
| 2391 | |||
| 2392 | #ifdef CONFIG_PM | ||
| 2393 | |||
| 2394 | static int | ||
| 2395 | vmxnet3_suspend(struct device *device) | ||
| 2396 | { | ||
| 2397 | struct pci_dev *pdev = to_pci_dev(device); | ||
| 2398 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 2399 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 2400 | struct Vmxnet3_PMConf *pmConf; | ||
| 2401 | struct ethhdr *ehdr; | ||
| 2402 | struct arphdr *ahdr; | ||
| 2403 | u8 *arpreq; | ||
| 2404 | struct in_device *in_dev; | ||
| 2405 | struct in_ifaddr *ifa; | ||
| 2406 | int i = 0; | ||
| 2407 | |||
| 2408 | if (!netif_running(netdev)) | ||
| 2409 | return 0; | ||
| 2410 | |||
| 2411 | vmxnet3_disable_all_intrs(adapter); | ||
| 2412 | vmxnet3_free_irqs(adapter); | ||
| 2413 | vmxnet3_free_intr_resources(adapter); | ||
| 2414 | |||
| 2415 | netif_device_detach(netdev); | ||
| 2416 | netif_stop_queue(netdev); | ||
| 2417 | |||
| 2418 | /* Create wake-up filters. */ | ||
| 2419 | pmConf = adapter->pm_conf; | ||
| 2420 | memset(pmConf, 0, sizeof(*pmConf)); | ||
| 2421 | |||
| 2422 | if (adapter->wol & WAKE_UCAST) { | ||
| 2423 | pmConf->filters[i].patternSize = ETH_ALEN; | ||
| 2424 | pmConf->filters[i].maskSize = 1; | ||
| 2425 | memcpy(pmConf->filters[i].pattern, netdev->dev_addr, ETH_ALEN); | ||
| 2426 | pmConf->filters[i].mask[0] = 0x3F; /* LSB ETH_ALEN bits */ | ||
| 2427 | |||
| 2428 | pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER; | ||
| 2429 | i++; | ||
| 2430 | } | ||
| 2431 | |||
| 2432 | if (adapter->wol & WAKE_ARP) { | ||
| 2433 | in_dev = in_dev_get(netdev); | ||
| 2434 | if (!in_dev) | ||
| 2435 | goto skip_arp; | ||
| 2436 | |||
| 2437 | ifa = (struct in_ifaddr *)in_dev->ifa_list; | ||
| 2438 | if (!ifa) | ||
| 2439 | goto skip_arp; | ||
| 2440 | |||
| 2441 | pmConf->filters[i].patternSize = ETH_HLEN + /* Ethernet header*/ | ||
| 2442 | sizeof(struct arphdr) + /* ARP header */ | ||
| 2443 | 2 * ETH_ALEN + /* 2 Ethernet addresses*/ | ||
| 2444 | 2 * sizeof(u32); /*2 IPv4 addresses */ | ||
| 2445 | pmConf->filters[i].maskSize = | ||
| 2446 | (pmConf->filters[i].patternSize - 1) / 8 + 1; | ||
| 2447 | |||
| 2448 | /* ETH_P_ARP in Ethernet header. */ | ||
| 2449 | ehdr = (struct ethhdr *)pmConf->filters[i].pattern; | ||
| 2450 | ehdr->h_proto = htons(ETH_P_ARP); | ||
| 2451 | |||
| 2452 | /* ARPOP_REQUEST in ARP header. */ | ||
| 2453 | ahdr = (struct arphdr *)&pmConf->filters[i].pattern[ETH_HLEN]; | ||
| 2454 | ahdr->ar_op = htons(ARPOP_REQUEST); | ||
| 2455 | arpreq = (u8 *)(ahdr + 1); | ||
| 2456 | |||
| 2457 | /* The Unicast IPv4 address in 'tip' field. */ | ||
| 2458 | arpreq += 2 * ETH_ALEN + sizeof(u32); | ||
| 2459 | *(u32 *)arpreq = ifa->ifa_address; | ||
| 2460 | |||
| 2461 | /* The mask for the relevant bits. */ | ||
| 2462 | pmConf->filters[i].mask[0] = 0x00; | ||
| 2463 | pmConf->filters[i].mask[1] = 0x30; /* ETH_P_ARP */ | ||
| 2464 | pmConf->filters[i].mask[2] = 0x30; /* ARPOP_REQUEST */ | ||
| 2465 | pmConf->filters[i].mask[3] = 0x00; | ||
| 2466 | pmConf->filters[i].mask[4] = 0xC0; /* IPv4 TIP */ | ||
| 2467 | pmConf->filters[i].mask[5] = 0x03; /* IPv4 TIP */ | ||
| 2468 | in_dev_put(in_dev); | ||
| 2469 | |||
| 2470 | pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER; | ||
| 2471 | i++; | ||
| 2472 | } | ||
| 2473 | |||
| 2474 | skip_arp: | ||
| 2475 | if (adapter->wol & WAKE_MAGIC) | ||
| 2476 | pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_MAGIC; | ||
| 2477 | |||
| 2478 | pmConf->numFilters = i; | ||
| 2479 | |||
| 2480 | adapter->shared->devRead.pmConfDesc.confVer = 1; | ||
| 2481 | adapter->shared->devRead.pmConfDesc.confLen = sizeof(*pmConf); | ||
| 2482 | adapter->shared->devRead.pmConfDesc.confPA = virt_to_phys(pmConf); | ||
| 2483 | |||
| 2484 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 2485 | VMXNET3_CMD_UPDATE_PMCFG); | ||
| 2486 | |||
| 2487 | pci_save_state(pdev); | ||
| 2488 | pci_enable_wake(pdev, pci_choose_state(pdev, PMSG_SUSPEND), | ||
| 2489 | adapter->wol); | ||
| 2490 | pci_disable_device(pdev); | ||
| 2491 | pci_set_power_state(pdev, pci_choose_state(pdev, PMSG_SUSPEND)); | ||
| 2492 | |||
| 2493 | return 0; | ||
| 2494 | } | ||
| 2495 | |||
| 2496 | |||
| 2497 | static int | ||
| 2498 | vmxnet3_resume(struct device *device) | ||
| 2499 | { | ||
| 2500 | int err; | ||
| 2501 | struct pci_dev *pdev = to_pci_dev(device); | ||
| 2502 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
| 2503 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 2504 | struct Vmxnet3_PMConf *pmConf; | ||
| 2505 | |||
| 2506 | if (!netif_running(netdev)) | ||
| 2507 | return 0; | ||
| 2508 | |||
| 2509 | /* Destroy wake-up filters. */ | ||
| 2510 | pmConf = adapter->pm_conf; | ||
| 2511 | memset(pmConf, 0, sizeof(*pmConf)); | ||
| 2512 | |||
| 2513 | adapter->shared->devRead.pmConfDesc.confVer = 1; | ||
| 2514 | adapter->shared->devRead.pmConfDesc.confLen = sizeof(*pmConf); | ||
| 2515 | adapter->shared->devRead.pmConfDesc.confPA = virt_to_phys(pmConf); | ||
| 2516 | |||
| 2517 | netif_device_attach(netdev); | ||
| 2518 | pci_set_power_state(pdev, PCI_D0); | ||
| 2519 | pci_restore_state(pdev); | ||
| 2520 | err = pci_enable_device_mem(pdev); | ||
| 2521 | if (err != 0) | ||
| 2522 | return err; | ||
| 2523 | |||
| 2524 | pci_enable_wake(pdev, PCI_D0, 0); | ||
| 2525 | |||
| 2526 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 2527 | VMXNET3_CMD_UPDATE_PMCFG); | ||
| 2528 | vmxnet3_alloc_intr_resources(adapter); | ||
| 2529 | vmxnet3_request_irqs(adapter); | ||
| 2530 | vmxnet3_enable_all_intrs(adapter); | ||
| 2531 | |||
| 2532 | return 0; | ||
| 2533 | } | ||
| 2534 | |||
| 2535 | static struct dev_pm_ops vmxnet3_pm_ops = { | ||
| 2536 | .suspend = vmxnet3_suspend, | ||
| 2537 | .resume = vmxnet3_resume, | ||
| 2538 | }; | ||
| 2539 | #endif | ||
| 2540 | |||
| 2541 | static struct pci_driver vmxnet3_driver = { | ||
| 2542 | .name = vmxnet3_driver_name, | ||
| 2543 | .id_table = vmxnet3_pciid_table, | ||
| 2544 | .probe = vmxnet3_probe_device, | ||
| 2545 | .remove = __devexit_p(vmxnet3_remove_device), | ||
| 2546 | #ifdef CONFIG_PM | ||
| 2547 | .driver.pm = &vmxnet3_pm_ops, | ||
| 2548 | #endif | ||
| 2549 | }; | ||
| 2550 | |||
| 2551 | |||
| 2552 | static int __init | ||
| 2553 | vmxnet3_init_module(void) | ||
| 2554 | { | ||
| 2555 | printk(KERN_INFO "%s - version %s\n", VMXNET3_DRIVER_DESC, | ||
| 2556 | VMXNET3_DRIVER_VERSION_REPORT); | ||
| 2557 | return pci_register_driver(&vmxnet3_driver); | ||
| 2558 | } | ||
| 2559 | |||
| 2560 | module_init(vmxnet3_init_module); | ||
| 2561 | |||
| 2562 | |||
| 2563 | static void | ||
| 2564 | vmxnet3_exit_module(void) | ||
| 2565 | { | ||
| 2566 | pci_unregister_driver(&vmxnet3_driver); | ||
| 2567 | } | ||
| 2568 | |||
| 2569 | module_exit(vmxnet3_exit_module); | ||
| 2570 | |||
| 2571 | MODULE_AUTHOR("VMware, Inc."); | ||
| 2572 | MODULE_DESCRIPTION(VMXNET3_DRIVER_DESC); | ||
| 2573 | MODULE_LICENSE("GPL v2"); | ||
| 2574 | MODULE_VERSION(VMXNET3_DRIVER_VERSION_STRING); | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c new file mode 100644 index 000000000000..c2c15e4cafc7 --- /dev/null +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c | |||
| @@ -0,0 +1,566 @@ | |||
| 1 | /* | ||
| 2 | * Linux driver for VMware's vmxnet3 ethernet NIC. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the | ||
| 8 | * Free Software Foundation; version 2 of the License and no later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, but | ||
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
| 13 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
| 14 | * details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | * | ||
| 20 | * The full GNU General Public License is included in this distribution in | ||
| 21 | * the file called "COPYING". | ||
| 22 | * | ||
| 23 | * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com> | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | |||
| 27 | |||
| 28 | #include "vmxnet3_int.h" | ||
| 29 | |||
| 30 | struct vmxnet3_stat_desc { | ||
| 31 | char desc[ETH_GSTRING_LEN]; | ||
| 32 | int offset; | ||
| 33 | }; | ||
| 34 | |||
| 35 | |||
| 36 | static u32 | ||
| 37 | vmxnet3_get_rx_csum(struct net_device *netdev) | ||
| 38 | { | ||
| 39 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 40 | return adapter->rxcsum; | ||
| 41 | } | ||
| 42 | |||
| 43 | |||
| 44 | static int | ||
| 45 | vmxnet3_set_rx_csum(struct net_device *netdev, u32 val) | ||
| 46 | { | ||
| 47 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 48 | |||
| 49 | if (adapter->rxcsum != val) { | ||
| 50 | adapter->rxcsum = val; | ||
| 51 | if (netif_running(netdev)) { | ||
| 52 | if (val) | ||
| 53 | adapter->shared->devRead.misc.uptFeatures |= | ||
| 54 | UPT1_F_RXCSUM; | ||
| 55 | else | ||
| 56 | adapter->shared->devRead.misc.uptFeatures &= | ||
| 57 | ~UPT1_F_RXCSUM; | ||
| 58 | |||
| 59 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 60 | VMXNET3_CMD_UPDATE_FEATURE); | ||
| 61 | } | ||
| 62 | } | ||
| 63 | return 0; | ||
| 64 | } | ||
| 65 | |||
| 66 | |||
| 67 | /* per tq stats maintained by the device */ | ||
| 68 | static const struct vmxnet3_stat_desc | ||
| 69 | vmxnet3_tq_dev_stats[] = { | ||
| 70 | /* description, offset */ | ||
| 71 | { "TSO pkts tx", offsetof(struct UPT1_TxStats, TSOPktsTxOK) }, | ||
| 72 | { "TSO bytes tx", offsetof(struct UPT1_TxStats, TSOBytesTxOK) }, | ||
| 73 | { "ucast pkts tx", offsetof(struct UPT1_TxStats, ucastPktsTxOK) }, | ||
| 74 | { "ucast bytes tx", offsetof(struct UPT1_TxStats, ucastBytesTxOK) }, | ||
| 75 | { "mcast pkts tx", offsetof(struct UPT1_TxStats, mcastPktsTxOK) }, | ||
| 76 | { "mcast bytes tx", offsetof(struct UPT1_TxStats, mcastBytesTxOK) }, | ||
| 77 | { "bcast pkts tx", offsetof(struct UPT1_TxStats, bcastPktsTxOK) }, | ||
| 78 | { "bcast bytes tx", offsetof(struct UPT1_TxStats, bcastBytesTxOK) }, | ||
| 79 | { "pkts tx err", offsetof(struct UPT1_TxStats, pktsTxError) }, | ||
| 80 | { "pkts tx discard", offsetof(struct UPT1_TxStats, pktsTxDiscard) }, | ||
| 81 | }; | ||
| 82 | |||
| 83 | /* per tq stats maintained by the driver */ | ||
| 84 | static const struct vmxnet3_stat_desc | ||
| 85 | vmxnet3_tq_driver_stats[] = { | ||
| 86 | /* description, offset */ | ||
| 87 | {"drv dropped tx total", offsetof(struct vmxnet3_tq_driver_stats, | ||
| 88 | drop_total) }, | ||
| 89 | { " too many frags", offsetof(struct vmxnet3_tq_driver_stats, | ||
| 90 | drop_too_many_frags) }, | ||
| 91 | { " giant hdr", offsetof(struct vmxnet3_tq_driver_stats, | ||
| 92 | drop_oversized_hdr) }, | ||
| 93 | { " hdr err", offsetof(struct vmxnet3_tq_driver_stats, | ||
| 94 | drop_hdr_inspect_err) }, | ||
| 95 | { " tso", offsetof(struct vmxnet3_tq_driver_stats, | ||
| 96 | drop_tso) }, | ||
| 97 | { "ring full", offsetof(struct vmxnet3_tq_driver_stats, | ||
| 98 | tx_ring_full) }, | ||
| 99 | { "pkts linearized", offsetof(struct vmxnet3_tq_driver_stats, | ||
| 100 | linearized) }, | ||
| 101 | { "hdr cloned", offsetof(struct vmxnet3_tq_driver_stats, | ||
| 102 | copy_skb_header) }, | ||
| 103 | { "giant hdr", offsetof(struct vmxnet3_tq_driver_stats, | ||
| 104 | oversized_hdr) }, | ||
| 105 | }; | ||
| 106 | |||
| 107 | /* per rq stats maintained by the device */ | ||
| 108 | static const struct vmxnet3_stat_desc | ||
| 109 | vmxnet3_rq_dev_stats[] = { | ||
| 110 | { "LRO pkts rx", offsetof(struct UPT1_RxStats, LROPktsRxOK) }, | ||
| 111 | { "LRO byte rx", offsetof(struct UPT1_RxStats, LROBytesRxOK) }, | ||
| 112 | { "ucast pkts rx", offsetof(struct UPT1_RxStats, ucastPktsRxOK) }, | ||
| 113 | { "ucast bytes rx", offsetof(struct UPT1_RxStats, ucastBytesRxOK) }, | ||
| 114 | { "mcast pkts rx", offsetof(struct UPT1_RxStats, mcastPktsRxOK) }, | ||
| 115 | { "mcast bytes rx", offsetof(struct UPT1_RxStats, mcastBytesRxOK) }, | ||
| 116 | { "bcast pkts rx", offsetof(struct UPT1_RxStats, bcastPktsRxOK) }, | ||
| 117 | { "bcast bytes rx", offsetof(struct UPT1_RxStats, bcastBytesRxOK) }, | ||
| 118 | { "pkts rx out of buf", offsetof(struct UPT1_RxStats, pktsRxOutOfBuf) }, | ||
| 119 | { "pkts rx err", offsetof(struct UPT1_RxStats, pktsRxError) }, | ||
| 120 | }; | ||
| 121 | |||
| 122 | /* per rq stats maintained by the driver */ | ||
| 123 | static const struct vmxnet3_stat_desc | ||
| 124 | vmxnet3_rq_driver_stats[] = { | ||
| 125 | /* description, offset */ | ||
| 126 | { "drv dropped rx total", offsetof(struct vmxnet3_rq_driver_stats, | ||
| 127 | drop_total) }, | ||
| 128 | { " err", offsetof(struct vmxnet3_rq_driver_stats, | ||
| 129 | drop_err) }, | ||
| 130 | { " fcs", offsetof(struct vmxnet3_rq_driver_stats, | ||
| 131 | drop_fcs) }, | ||
| 132 | { "rx buf alloc fail", offsetof(struct vmxnet3_rq_driver_stats, | ||
| 133 | rx_buf_alloc_failure) }, | ||
| 134 | }; | ||
| 135 | |||
| 136 | /* gloabl stats maintained by the driver */ | ||
| 137 | static const struct vmxnet3_stat_desc | ||
| 138 | vmxnet3_global_stats[] = { | ||
| 139 | /* description, offset */ | ||
| 140 | { "tx timeout count", offsetof(struct vmxnet3_adapter, | ||
| 141 | tx_timeout_count) } | ||
| 142 | }; | ||
| 143 | |||
| 144 | |||
| 145 | struct net_device_stats * | ||
| 146 | vmxnet3_get_stats(struct net_device *netdev) | ||
| 147 | { | ||
| 148 | struct vmxnet3_adapter *adapter; | ||
| 149 | struct vmxnet3_tq_driver_stats *drvTxStats; | ||
| 150 | struct vmxnet3_rq_driver_stats *drvRxStats; | ||
| 151 | struct UPT1_TxStats *devTxStats; | ||
| 152 | struct UPT1_RxStats *devRxStats; | ||
| 153 | struct net_device_stats *net_stats = &netdev->stats; | ||
| 154 | |||
| 155 | adapter = netdev_priv(netdev); | ||
| 156 | |||
| 157 | /* Collect the dev stats into the shared area */ | ||
| 158 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); | ||
| 159 | |||
| 160 | /* Assuming that we have a single queue device */ | ||
| 161 | devTxStats = &adapter->tqd_start->stats; | ||
| 162 | devRxStats = &adapter->rqd_start->stats; | ||
| 163 | |||
| 164 | /* Get access to the driver stats per queue */ | ||
| 165 | drvTxStats = &adapter->tx_queue.stats; | ||
| 166 | drvRxStats = &adapter->rx_queue.stats; | ||
| 167 | |||
| 168 | memset(net_stats, 0, sizeof(*net_stats)); | ||
| 169 | |||
| 170 | net_stats->rx_packets = devRxStats->ucastPktsRxOK + | ||
| 171 | devRxStats->mcastPktsRxOK + | ||
| 172 | devRxStats->bcastPktsRxOK; | ||
| 173 | |||
| 174 | net_stats->tx_packets = devTxStats->ucastPktsTxOK + | ||
| 175 | devTxStats->mcastPktsTxOK + | ||
| 176 | devTxStats->bcastPktsTxOK; | ||
| 177 | |||
| 178 | net_stats->rx_bytes = devRxStats->ucastBytesRxOK + | ||
| 179 | devRxStats->mcastBytesRxOK + | ||
| 180 | devRxStats->bcastBytesRxOK; | ||
| 181 | |||
| 182 | net_stats->tx_bytes = devTxStats->ucastBytesTxOK + | ||
| 183 | devTxStats->mcastBytesTxOK + | ||
| 184 | devTxStats->bcastBytesTxOK; | ||
| 185 | |||
| 186 | net_stats->rx_errors = devRxStats->pktsRxError; | ||
| 187 | net_stats->tx_errors = devTxStats->pktsTxError; | ||
| 188 | net_stats->rx_dropped = drvRxStats->drop_total; | ||
| 189 | net_stats->tx_dropped = drvTxStats->drop_total; | ||
| 190 | net_stats->multicast = devRxStats->mcastPktsRxOK; | ||
| 191 | |||
| 192 | return net_stats; | ||
| 193 | } | ||
| 194 | |||
| 195 | static int | ||
| 196 | vmxnet3_get_sset_count(struct net_device *netdev, int sset) | ||
| 197 | { | ||
| 198 | switch (sset) { | ||
| 199 | case ETH_SS_STATS: | ||
| 200 | return ARRAY_SIZE(vmxnet3_tq_dev_stats) + | ||
| 201 | ARRAY_SIZE(vmxnet3_tq_driver_stats) + | ||
| 202 | ARRAY_SIZE(vmxnet3_rq_dev_stats) + | ||
| 203 | ARRAY_SIZE(vmxnet3_rq_driver_stats) + | ||
| 204 | ARRAY_SIZE(vmxnet3_global_stats); | ||
| 205 | default: | ||
| 206 | return -EOPNOTSUPP; | ||
| 207 | } | ||
| 208 | } | ||
| 209 | |||
| 210 | |||
| 211 | static int | ||
| 212 | vmxnet3_get_regs_len(struct net_device *netdev) | ||
| 213 | { | ||
| 214 | return 20 * sizeof(u32); | ||
| 215 | } | ||
| 216 | |||
| 217 | |||
| 218 | static void | ||
| 219 | vmxnet3_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | ||
| 220 | { | ||
| 221 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 222 | |||
| 223 | strlcpy(drvinfo->driver, vmxnet3_driver_name, sizeof(drvinfo->driver)); | ||
| 224 | drvinfo->driver[sizeof(drvinfo->driver) - 1] = '\0'; | ||
| 225 | |||
| 226 | strlcpy(drvinfo->version, VMXNET3_DRIVER_VERSION_REPORT, | ||
| 227 | sizeof(drvinfo->version)); | ||
| 228 | drvinfo->driver[sizeof(drvinfo->version) - 1] = '\0'; | ||
| 229 | |||
| 230 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | ||
| 231 | drvinfo->fw_version[sizeof(drvinfo->fw_version) - 1] = '\0'; | ||
| 232 | |||
| 233 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), | ||
| 234 | ETHTOOL_BUSINFO_LEN); | ||
| 235 | drvinfo->n_stats = vmxnet3_get_sset_count(netdev, ETH_SS_STATS); | ||
| 236 | drvinfo->testinfo_len = 0; | ||
| 237 | drvinfo->eedump_len = 0; | ||
| 238 | drvinfo->regdump_len = vmxnet3_get_regs_len(netdev); | ||
| 239 | } | ||
| 240 | |||
| 241 | |||
| 242 | static void | ||
| 243 | vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) | ||
| 244 | { | ||
| 245 | if (stringset == ETH_SS_STATS) { | ||
| 246 | int i; | ||
| 247 | |||
| 248 | for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++) { | ||
| 249 | memcpy(buf, vmxnet3_tq_dev_stats[i].desc, | ||
| 250 | ETH_GSTRING_LEN); | ||
| 251 | buf += ETH_GSTRING_LEN; | ||
| 252 | } | ||
| 253 | for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++) { | ||
| 254 | memcpy(buf, vmxnet3_tq_driver_stats[i].desc, | ||
| 255 | ETH_GSTRING_LEN); | ||
| 256 | buf += ETH_GSTRING_LEN; | ||
| 257 | } | ||
| 258 | for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++) { | ||
| 259 | memcpy(buf, vmxnet3_rq_dev_stats[i].desc, | ||
| 260 | ETH_GSTRING_LEN); | ||
| 261 | buf += ETH_GSTRING_LEN; | ||
| 262 | } | ||
| 263 | for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++) { | ||
| 264 | memcpy(buf, vmxnet3_rq_driver_stats[i].desc, | ||
| 265 | ETH_GSTRING_LEN); | ||
| 266 | buf += ETH_GSTRING_LEN; | ||
| 267 | } | ||
| 268 | for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++) { | ||
| 269 | memcpy(buf, vmxnet3_global_stats[i].desc, | ||
| 270 | ETH_GSTRING_LEN); | ||
| 271 | buf += ETH_GSTRING_LEN; | ||
| 272 | } | ||
| 273 | } | ||
| 274 | } | ||
| 275 | |||
| 276 | static u32 | ||
| 277 | vmxnet3_get_flags(struct net_device *netdev) { | ||
| 278 | return netdev->features; | ||
| 279 | } | ||
| 280 | |||
| 281 | static int | ||
| 282 | vmxnet3_set_flags(struct net_device *netdev, u32 data) { | ||
| 283 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 284 | u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1; | ||
| 285 | u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1; | ||
| 286 | |||
| 287 | if (lro_requested ^ lro_present) { | ||
| 288 | /* toggle the LRO feature*/ | ||
| 289 | netdev->features ^= NETIF_F_LRO; | ||
| 290 | |||
| 291 | /* update harware LRO capability accordingly */ | ||
| 292 | if (lro_requested) | ||
| 293 | adapter->shared->devRead.misc.uptFeatures &= UPT1_F_LRO; | ||
| 294 | else | ||
| 295 | adapter->shared->devRead.misc.uptFeatures &= | ||
| 296 | ~UPT1_F_LRO; | ||
| 297 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
| 298 | VMXNET3_CMD_UPDATE_FEATURE); | ||
| 299 | } | ||
| 300 | return 0; | ||
| 301 | } | ||
| 302 | |||
| 303 | static void | ||
| 304 | vmxnet3_get_ethtool_stats(struct net_device *netdev, | ||
| 305 | struct ethtool_stats *stats, u64 *buf) | ||
| 306 | { | ||
| 307 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 308 | u8 *base; | ||
| 309 | int i; | ||
| 310 | |||
| 311 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); | ||
| 312 | |||
| 313 | /* this does assume each counter is 64-bit wide */ | ||
| 314 | |||
| 315 | base = (u8 *)&adapter->tqd_start->stats; | ||
| 316 | for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++) | ||
| 317 | *buf++ = *(u64 *)(base + vmxnet3_tq_dev_stats[i].offset); | ||
| 318 | |||
| 319 | base = (u8 *)&adapter->tx_queue.stats; | ||
| 320 | for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++) | ||
| 321 | *buf++ = *(u64 *)(base + vmxnet3_tq_driver_stats[i].offset); | ||
| 322 | |||
| 323 | base = (u8 *)&adapter->rqd_start->stats; | ||
| 324 | for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++) | ||
| 325 | *buf++ = *(u64 *)(base + vmxnet3_rq_dev_stats[i].offset); | ||
| 326 | |||
| 327 | base = (u8 *)&adapter->rx_queue.stats; | ||
| 328 | for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++) | ||
| 329 | *buf++ = *(u64 *)(base + vmxnet3_rq_driver_stats[i].offset); | ||
| 330 | |||
| 331 | base = (u8 *)adapter; | ||
| 332 | for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++) | ||
| 333 | *buf++ = *(u64 *)(base + vmxnet3_global_stats[i].offset); | ||
| 334 | } | ||
| 335 | |||
| 336 | |||
| 337 | static void | ||
| 338 | vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p) | ||
| 339 | { | ||
| 340 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 341 | u32 *buf = p; | ||
| 342 | |||
| 343 | memset(p, 0, vmxnet3_get_regs_len(netdev)); | ||
| 344 | |||
| 345 | regs->version = 1; | ||
| 346 | |||
| 347 | /* Update vmxnet3_get_regs_len if we want to dump more registers */ | ||
| 348 | |||
| 349 | /* make each ring use multiple of 16 bytes */ | ||
| 350 | buf[0] = adapter->tx_queue.tx_ring.next2fill; | ||
| 351 | buf[1] = adapter->tx_queue.tx_ring.next2comp; | ||
| 352 | buf[2] = adapter->tx_queue.tx_ring.gen; | ||
| 353 | buf[3] = 0; | ||
| 354 | |||
| 355 | buf[4] = adapter->tx_queue.comp_ring.next2proc; | ||
| 356 | buf[5] = adapter->tx_queue.comp_ring.gen; | ||
| 357 | buf[6] = adapter->tx_queue.stopped; | ||
| 358 | buf[7] = 0; | ||
| 359 | |||
| 360 | buf[8] = adapter->rx_queue.rx_ring[0].next2fill; | ||
| 361 | buf[9] = adapter->rx_queue.rx_ring[0].next2comp; | ||
| 362 | buf[10] = adapter->rx_queue.rx_ring[0].gen; | ||
| 363 | buf[11] = 0; | ||
| 364 | |||
| 365 | buf[12] = adapter->rx_queue.rx_ring[1].next2fill; | ||
| 366 | buf[13] = adapter->rx_queue.rx_ring[1].next2comp; | ||
| 367 | buf[14] = adapter->rx_queue.rx_ring[1].gen; | ||
| 368 | buf[15] = 0; | ||
| 369 | |||
| 370 | buf[16] = adapter->rx_queue.comp_ring.next2proc; | ||
| 371 | buf[17] = adapter->rx_queue.comp_ring.gen; | ||
| 372 | buf[18] = 0; | ||
| 373 | buf[19] = 0; | ||
| 374 | } | ||
| 375 | |||
| 376 | |||
| 377 | static void | ||
| 378 | vmxnet3_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | ||
| 379 | { | ||
| 380 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 381 | |||
| 382 | wol->supported = WAKE_UCAST | WAKE_ARP | WAKE_MAGIC; | ||
| 383 | wol->wolopts = adapter->wol; | ||
| 384 | } | ||
| 385 | |||
| 386 | |||
| 387 | static int | ||
| 388 | vmxnet3_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | ||
| 389 | { | ||
| 390 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 391 | |||
| 392 | if (wol->wolopts & (WAKE_PHY | WAKE_MCAST | WAKE_BCAST | | ||
| 393 | WAKE_MAGICSECURE)) { | ||
| 394 | return -EOPNOTSUPP; | ||
| 395 | } | ||
| 396 | |||
| 397 | adapter->wol = wol->wolopts; | ||
| 398 | |||
| 399 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | ||
| 400 | |||
| 401 | return 0; | ||
| 402 | } | ||
| 403 | |||
| 404 | |||
| 405 | static int | ||
| 406 | vmxnet3_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | ||
| 407 | { | ||
| 408 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 409 | |||
| 410 | ecmd->supported = SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full | | ||
| 411 | SUPPORTED_TP; | ||
| 412 | ecmd->advertising = ADVERTISED_TP; | ||
| 413 | ecmd->port = PORT_TP; | ||
| 414 | ecmd->transceiver = XCVR_INTERNAL; | ||
| 415 | |||
| 416 | if (adapter->link_speed) { | ||
| 417 | ecmd->speed = adapter->link_speed; | ||
| 418 | ecmd->duplex = DUPLEX_FULL; | ||
| 419 | } else { | ||
| 420 | ecmd->speed = -1; | ||
| 421 | ecmd->duplex = -1; | ||
| 422 | } | ||
| 423 | return 0; | ||
| 424 | } | ||
| 425 | |||
| 426 | |||
| 427 | static void | ||
| 428 | vmxnet3_get_ringparam(struct net_device *netdev, | ||
| 429 | struct ethtool_ringparam *param) | ||
| 430 | { | ||
| 431 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 432 | |||
| 433 | param->rx_max_pending = VMXNET3_RX_RING_MAX_SIZE; | ||
| 434 | param->tx_max_pending = VMXNET3_TX_RING_MAX_SIZE; | ||
| 435 | param->rx_mini_max_pending = 0; | ||
| 436 | param->rx_jumbo_max_pending = 0; | ||
| 437 | |||
| 438 | param->rx_pending = adapter->rx_queue.rx_ring[0].size; | ||
| 439 | param->tx_pending = adapter->tx_queue.tx_ring.size; | ||
| 440 | param->rx_mini_pending = 0; | ||
| 441 | param->rx_jumbo_pending = 0; | ||
| 442 | } | ||
| 443 | |||
| 444 | |||
| 445 | static int | ||
| 446 | vmxnet3_set_ringparam(struct net_device *netdev, | ||
| 447 | struct ethtool_ringparam *param) | ||
| 448 | { | ||
| 449 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
| 450 | u32 new_tx_ring_size, new_rx_ring_size; | ||
| 451 | u32 sz; | ||
| 452 | int err = 0; | ||
| 453 | |||
| 454 | if (param->tx_pending == 0 || param->tx_pending > | ||
| 455 | VMXNET3_TX_RING_MAX_SIZE) | ||
| 456 | return -EINVAL; | ||
| 457 | |||
| 458 | if (param->rx_pending == 0 || param->rx_pending > | ||
| 459 | VMXNET3_RX_RING_MAX_SIZE) | ||
| 460 | return -EINVAL; | ||
| 461 | |||
| 462 | |||
| 463 | /* round it up to a multiple of VMXNET3_RING_SIZE_ALIGN */ | ||
| 464 | new_tx_ring_size = (param->tx_pending + VMXNET3_RING_SIZE_MASK) & | ||
| 465 | ~VMXNET3_RING_SIZE_MASK; | ||
| 466 | new_tx_ring_size = min_t(u32, new_tx_ring_size, | ||
| 467 | VMXNET3_TX_RING_MAX_SIZE); | ||
| 468 | if (new_tx_ring_size > VMXNET3_TX_RING_MAX_SIZE || (new_tx_ring_size % | ||
| 469 | VMXNET3_RING_SIZE_ALIGN) != 0) | ||
| 470 | return -EINVAL; | ||
| 471 | |||
| 472 | /* ring0 has to be a multiple of | ||
| 473 | * rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN | ||
| 474 | */ | ||
| 475 | sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN; | ||
| 476 | new_rx_ring_size = (param->rx_pending + sz - 1) / sz * sz; | ||
| 477 | new_rx_ring_size = min_t(u32, new_rx_ring_size, | ||
| 478 | VMXNET3_RX_RING_MAX_SIZE / sz * sz); | ||
| 479 | if (new_rx_ring_size > VMXNET3_RX_RING_MAX_SIZE || (new_rx_ring_size % | ||
| 480 | sz) != 0) | ||
| 481 | return -EINVAL; | ||
| 482 | |||
| 483 | if (new_tx_ring_size == adapter->tx_queue.tx_ring.size && | ||
| 484 | new_rx_ring_size == adapter->rx_queue.rx_ring[0].size) { | ||
| 485 | return 0; | ||
| 486 | } | ||
| 487 | |||
| 488 | /* | ||
| 489 | * Reset_work may be in the middle of resetting the device, wait for its | ||
| 490 | * completion. | ||
| 491 | */ | ||
| 492 | while (test_and_set_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state)) | ||
| 493 | msleep(1); | ||
| 494 | |||
| 495 | if (netif_running(netdev)) { | ||
| 496 | vmxnet3_quiesce_dev(adapter); | ||
| 497 | vmxnet3_reset_dev(adapter); | ||
| 498 | |||
| 499 | /* recreate the rx queue and the tx queue based on the | ||
| 500 | * new sizes */ | ||
| 501 | vmxnet3_tq_destroy(&adapter->tx_queue, adapter); | ||
| 502 | vmxnet3_rq_destroy(&adapter->rx_queue, adapter); | ||
| 503 | |||
| 504 | err = vmxnet3_create_queues(adapter, new_tx_ring_size, | ||
| 505 | new_rx_ring_size, VMXNET3_DEF_RX_RING_SIZE); | ||
| 506 | if (err) { | ||
| 507 | /* failed, most likely because of OOM, try default | ||
| 508 | * size */ | ||
| 509 | printk(KERN_ERR "%s: failed to apply new sizes, try the" | ||
| 510 | " default ones\n", netdev->name); | ||
| 511 | err = vmxnet3_create_queues(adapter, | ||
| 512 | VMXNET3_DEF_TX_RING_SIZE, | ||
| 513 | VMXNET3_DEF_RX_RING_SIZE, | ||
| 514 | VMXNET3_DEF_RX_RING_SIZE); | ||
| 515 | if (err) { | ||
| 516 | printk(KERN_ERR "%s: failed to create queues " | ||
| 517 | "with default sizes. Closing it\n", | ||
| 518 | netdev->name); | ||
| 519 | goto out; | ||
| 520 | } | ||
| 521 | } | ||
| 522 | |||
| 523 | err = vmxnet3_activate_dev(adapter); | ||
| 524 | if (err) | ||
| 525 | printk(KERN_ERR "%s: failed to re-activate, error %d." | ||
| 526 | " Closing it\n", netdev->name, err); | ||
| 527 | } | ||
| 528 | |||
| 529 | out: | ||
| 530 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); | ||
| 531 | if (err) | ||
| 532 | vmxnet3_force_close(adapter); | ||
| 533 | |||
| 534 | return err; | ||
| 535 | } | ||
| 536 | |||
| 537 | |||
| 538 | static struct ethtool_ops vmxnet3_ethtool_ops = { | ||
| 539 | .get_settings = vmxnet3_get_settings, | ||
| 540 | .get_drvinfo = vmxnet3_get_drvinfo, | ||
| 541 | .get_regs_len = vmxnet3_get_regs_len, | ||
| 542 | .get_regs = vmxnet3_get_regs, | ||
| 543 | .get_wol = vmxnet3_get_wol, | ||
| 544 | .set_wol = vmxnet3_set_wol, | ||
| 545 | .get_link = ethtool_op_get_link, | ||
| 546 | .get_rx_csum = vmxnet3_get_rx_csum, | ||
| 547 | .set_rx_csum = vmxnet3_set_rx_csum, | ||
| 548 | .get_tx_csum = ethtool_op_get_tx_csum, | ||
| 549 | .set_tx_csum = ethtool_op_set_tx_hw_csum, | ||
| 550 | .get_sg = ethtool_op_get_sg, | ||
| 551 | .set_sg = ethtool_op_set_sg, | ||
| 552 | .get_tso = ethtool_op_get_tso, | ||
| 553 | .set_tso = ethtool_op_set_tso, | ||
| 554 | .get_strings = vmxnet3_get_strings, | ||
| 555 | .get_flags = vmxnet3_get_flags, | ||
| 556 | .set_flags = vmxnet3_set_flags, | ||
| 557 | .get_sset_count = vmxnet3_get_sset_count, | ||
| 558 | .get_ethtool_stats = vmxnet3_get_ethtool_stats, | ||
| 559 | .get_ringparam = vmxnet3_get_ringparam, | ||
| 560 | .set_ringparam = vmxnet3_set_ringparam, | ||
| 561 | }; | ||
| 562 | |||
| 563 | void vmxnet3_set_ethtool_ops(struct net_device *netdev) | ||
| 564 | { | ||
| 565 | SET_ETHTOOL_OPS(netdev, &vmxnet3_ethtool_ops); | ||
| 566 | } | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h new file mode 100644 index 000000000000..3c0d70d58111 --- /dev/null +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
| @@ -0,0 +1,389 @@ | |||
| 1 | /* | ||
| 2 | * Linux driver for VMware's vmxnet3 ethernet NIC. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-2009, VMware, Inc. All Rights Reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License as published by the | ||
| 8 | * Free Software Foundation; version 2 of the License and no later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, but | ||
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
| 13 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
| 14 | * details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | * | ||
| 20 | * The full GNU General Public License is included in this distribution in | ||
| 21 | * the file called "COPYING". | ||
| 22 | * | ||
| 23 | * Maintained by: Shreyas Bhatewara <pv-drivers@vmware.com> | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | |||
| 27 | #ifndef _VMXNET3_INT_H | ||
| 28 | #define _VMXNET3_INT_H | ||
| 29 | |||
| 30 | #include <linux/types.h> | ||
| 31 | #include <linux/ethtool.h> | ||
| 32 | #include <linux/delay.h> | ||
| 33 | #include <linux/device.h> | ||
| 34 | #include <linux/netdevice.h> | ||
| 35 | #include <linux/pci.h> | ||
| 36 | #include <linux/ethtool.h> | ||
| 37 | #include <linux/compiler.h> | ||
| 38 | #include <linux/module.h> | ||
| 39 | #include <linux/moduleparam.h> | ||
| 40 | #include <linux/slab.h> | ||
| 41 | #include <linux/spinlock.h> | ||
| 42 | #include <linux/ioport.h> | ||
| 43 | #include <linux/highmem.h> | ||
| 44 | #include <linux/init.h> | ||
| 45 | #include <linux/timer.h> | ||
| 46 | #include <linux/skbuff.h> | ||
| 47 | #include <linux/interrupt.h> | ||
| 48 | #include <linux/workqueue.h> | ||
| 49 | #include <linux/uaccess.h> | ||
| 50 | #include <asm/dma.h> | ||
| 51 | #include <asm/page.h> | ||
| 52 | |||
| 53 | #include <linux/tcp.h> | ||
| 54 | #include <linux/udp.h> | ||
| 55 | #include <linux/ip.h> | ||
| 56 | #include <linux/ipv6.h> | ||
| 57 | #include <linux/in.h> | ||
| 58 | #include <linux/etherdevice.h> | ||
| 59 | #include <asm/checksum.h> | ||
| 60 | #include <linux/if_vlan.h> | ||
| 61 | #include <linux/if_arp.h> | ||
| 62 | #include <linux/inetdevice.h> | ||
| 63 | |||
| 64 | #include "vmxnet3_defs.h" | ||
| 65 | |||
| 66 | #ifdef DEBUG | ||
| 67 | # define VMXNET3_DRIVER_VERSION_REPORT VMXNET3_DRIVER_VERSION_STRING"-NAPI(debug)" | ||
| 68 | #else | ||
| 69 | # define VMXNET3_DRIVER_VERSION_REPORT VMXNET3_DRIVER_VERSION_STRING"-NAPI" | ||
| 70 | #endif | ||
| 71 | |||
| 72 | |||
| 73 | /* | ||
| 74 | * Version numbers | ||
| 75 | */ | ||
| 76 | #define VMXNET3_DRIVER_VERSION_STRING "1.0.5.0-k" | ||
| 77 | |||
| 78 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ | ||
| 79 | #define VMXNET3_DRIVER_VERSION_NUM 0x01000500 | ||
| 80 | |||
| 81 | |||
| 82 | /* | ||
| 83 | * Capabilities | ||
| 84 | */ | ||
| 85 | |||
| 86 | enum { | ||
| 87 | VMNET_CAP_SG = 0x0001, /* Can do scatter-gather transmits. */ | ||
| 88 | VMNET_CAP_IP4_CSUM = 0x0002, /* Can checksum only TCP/UDP over | ||
| 89 | * IPv4 */ | ||
| 90 | VMNET_CAP_HW_CSUM = 0x0004, /* Can checksum all packets. */ | ||
| 91 | VMNET_CAP_HIGH_DMA = 0x0008, /* Can DMA to high memory. */ | ||
| 92 | VMNET_CAP_TOE = 0x0010, /* Supports TCP/IP offload. */ | ||
| 93 | VMNET_CAP_TSO = 0x0020, /* Supports TCP Segmentation | ||
| 94 | * offload */ | ||
| 95 | VMNET_CAP_SW_TSO = 0x0040, /* Supports SW TCP Segmentation */ | ||
| 96 | VMNET_CAP_VMXNET_APROM = 0x0080, /* Vmxnet APROM support */ | ||
| 97 | VMNET_CAP_HW_TX_VLAN = 0x0100, /* Can we do VLAN tagging in HW */ | ||
| 98 | VMNET_CAP_HW_RX_VLAN = 0x0200, /* Can we do VLAN untagging in HW */ | ||
| 99 | VMNET_CAP_SW_VLAN = 0x0400, /* VLAN tagging/untagging in SW */ | ||
| 100 | VMNET_CAP_WAKE_PCKT_RCV = 0x0800, /* Can wake on network packet recv? */ | ||
| 101 | VMNET_CAP_ENABLE_INT_INLINE = 0x1000, /* Enable Interrupt Inline */ | ||
| 102 | VMNET_CAP_ENABLE_HEADER_COPY = 0x2000, /* copy header for vmkernel */ | ||
| 103 | VMNET_CAP_TX_CHAIN = 0x4000, /* Guest can use multiple tx entries | ||
| 104 | * for a pkt */ | ||
| 105 | VMNET_CAP_RX_CHAIN = 0x8000, /* pkt can span multiple rx entries */ | ||
| 106 | VMNET_CAP_LPD = 0x10000, /* large pkt delivery */ | ||
| 107 | VMNET_CAP_BPF = 0x20000, /* BPF Support in VMXNET Virtual HW*/ | ||
| 108 | VMNET_CAP_SG_SPAN_PAGES = 0x40000, /* Scatter-gather can span multiple*/ | ||
| 109 | /* pages transmits */ | ||
| 110 | VMNET_CAP_IP6_CSUM = 0x80000, /* Can do IPv6 csum offload. */ | ||
| 111 | VMNET_CAP_TSO6 = 0x100000, /* TSO seg. offload for IPv6 pkts. */ | ||
| 112 | VMNET_CAP_TSO256k = 0x200000, /* Can do TSO seg offload for */ | ||
| 113 | /* pkts up to 256kB. */ | ||
| 114 | VMNET_CAP_UPT = 0x400000 /* Support UPT */ | ||
| 115 | }; | ||
| 116 | |||
| 117 | /* | ||
| 118 | * PCI vendor and device IDs. | ||
| 119 | */ | ||
| 120 | #define PCI_VENDOR_ID_VMWARE 0x15AD | ||
| 121 | #define PCI_DEVICE_ID_VMWARE_VMXNET3 0x07B0 | ||
| 122 | #define MAX_ETHERNET_CARDS 10 | ||
| 123 | #define MAX_PCI_PASSTHRU_DEVICE 6 | ||
| 124 | |||
| 125 | struct vmxnet3_cmd_ring { | ||
| 126 | union Vmxnet3_GenericDesc *base; | ||
| 127 | u32 size; | ||
| 128 | u32 next2fill; | ||
| 129 | u32 next2comp; | ||
| 130 | u8 gen; | ||
| 131 | dma_addr_t basePA; | ||
| 132 | }; | ||
| 133 | |||
| 134 | static inline void | ||
| 135 | vmxnet3_cmd_ring_adv_next2fill(struct vmxnet3_cmd_ring *ring) | ||
| 136 | { | ||
| 137 | ring->next2fill++; | ||
| 138 | if (unlikely(ring->next2fill == ring->size)) { | ||
| 139 | ring->next2fill = 0; | ||
| 140 | VMXNET3_FLIP_RING_GEN(ring->gen); | ||
| 141 | } | ||
| 142 | } | ||
| 143 | |||
| 144 | static inline void | ||
| 145 | vmxnet3_cmd_ring_adv_next2comp(struct vmxnet3_cmd_ring *ring) | ||
| 146 | { | ||
| 147 | VMXNET3_INC_RING_IDX_ONLY(ring->next2comp, ring->size); | ||
| 148 | } | ||
| 149 | |||
| 150 | static inline int | ||
| 151 | vmxnet3_cmd_ring_desc_avail(struct vmxnet3_cmd_ring *ring) | ||
| 152 | { | ||
| 153 | return (ring->next2comp > ring->next2fill ? 0 : ring->size) + | ||
| 154 | ring->next2comp - ring->next2fill - 1; | ||
| 155 | } | ||
| 156 | |||
| 157 | struct vmxnet3_comp_ring { | ||
| 158 | union Vmxnet3_GenericDesc *base; | ||
| 159 | u32 size; | ||
| 160 | u32 next2proc; | ||
| 161 | u8 gen; | ||
| 162 | u8 intr_idx; | ||
| 163 | dma_addr_t basePA; | ||
| 164 | }; | ||
| 165 | |||
| 166 | static inline void | ||
| 167 | vmxnet3_comp_ring_adv_next2proc(struct vmxnet3_comp_ring *ring) | ||
| 168 | { | ||
| 169 | ring->next2proc++; | ||
| 170 | if (unlikely(ring->next2proc == ring->size)) { | ||
| 171 | ring->next2proc = 0; | ||
| 172 | VMXNET3_FLIP_RING_GEN(ring->gen); | ||
| 173 | } | ||
| 174 | } | ||
| 175 | |||
| 176 | struct vmxnet3_tx_data_ring { | ||
| 177 | struct Vmxnet3_TxDataDesc *base; | ||
| 178 | u32 size; | ||
| 179 | dma_addr_t basePA; | ||
| 180 | }; | ||
| 181 | |||
| 182 | enum vmxnet3_buf_map_type { | ||
| 183 | VMXNET3_MAP_INVALID = 0, | ||
| 184 | VMXNET3_MAP_NONE, | ||
| 185 | VMXNET3_MAP_SINGLE, | ||
| 186 | VMXNET3_MAP_PAGE, | ||
| 187 | }; | ||
| 188 | |||
| 189 | struct vmxnet3_tx_buf_info { | ||
| 190 | u32 map_type; | ||
| 191 | u16 len; | ||
| 192 | u16 sop_idx; | ||
| 193 | dma_addr_t dma_addr; | ||
| 194 | struct sk_buff *skb; | ||
| 195 | }; | ||
| 196 | |||
| 197 | struct vmxnet3_tq_driver_stats { | ||
| 198 | u64 drop_total; /* # of pkts dropped by the driver, the | ||
| 199 | * counters below track droppings due to | ||
| 200 | * different reasons | ||
| 201 | */ | ||
| 202 | u64 drop_too_many_frags; | ||
| 203 | u64 drop_oversized_hdr; | ||
| 204 | u64 drop_hdr_inspect_err; | ||
| 205 | u64 drop_tso; | ||
| 206 | |||
| 207 | u64 tx_ring_full; | ||
| 208 | u64 linearized; /* # of pkts linearized */ | ||
| 209 | u64 copy_skb_header; /* # of times we have to copy skb header */ | ||
| 210 | u64 oversized_hdr; | ||
| 211 | }; | ||
| 212 | |||
| 213 | struct vmxnet3_tx_ctx { | ||
| 214 | bool ipv4; | ||
| 215 | u16 mss; | ||
| 216 | u32 eth_ip_hdr_size; /* only valid for pkts requesting tso or csum | ||
| 217 | * offloading | ||
| 218 | */ | ||
| 219 | u32 l4_hdr_size; /* only valid if mss != 0 */ | ||
| 220 | u32 copy_size; /* # of bytes copied into the data ring */ | ||
| 221 | union Vmxnet3_GenericDesc *sop_txd; | ||
| 222 | union Vmxnet3_GenericDesc *eop_txd; | ||
| 223 | }; | ||
| 224 | |||
| 225 | struct vmxnet3_tx_queue { | ||
| 226 | spinlock_t tx_lock; | ||
| 227 | struct vmxnet3_cmd_ring tx_ring; | ||
| 228 | struct vmxnet3_tx_buf_info *buf_info; | ||
| 229 | struct vmxnet3_tx_data_ring data_ring; | ||
| 230 | struct vmxnet3_comp_ring comp_ring; | ||
| 231 | struct Vmxnet3_TxQueueCtrl *shared; | ||
| 232 | struct vmxnet3_tq_driver_stats stats; | ||
| 233 | bool stopped; | ||
| 234 | int num_stop; /* # of times the queue is | ||
| 235 | * stopped */ | ||
| 236 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | ||
| 237 | |||
| 238 | enum vmxnet3_rx_buf_type { | ||
| 239 | VMXNET3_RX_BUF_NONE = 0, | ||
| 240 | VMXNET3_RX_BUF_SKB = 1, | ||
| 241 | VMXNET3_RX_BUF_PAGE = 2 | ||
| 242 | }; | ||
| 243 | |||
| 244 | struct vmxnet3_rx_buf_info { | ||
| 245 | enum vmxnet3_rx_buf_type buf_type; | ||
| 246 | u16 len; | ||
| 247 | union { | ||
| 248 | struct sk_buff *skb; | ||
| 249 | struct page *page; | ||
| 250 | }; | ||
| 251 | dma_addr_t dma_addr; | ||
| 252 | }; | ||
| 253 | |||
| 254 | struct vmxnet3_rx_ctx { | ||
| 255 | struct sk_buff *skb; | ||
| 256 | u32 sop_idx; | ||
| 257 | }; | ||
| 258 | |||
| 259 | struct vmxnet3_rq_driver_stats { | ||
| 260 | u64 drop_total; | ||
| 261 | u64 drop_err; | ||
| 262 | u64 drop_fcs; | ||
| 263 | u64 rx_buf_alloc_failure; | ||
| 264 | }; | ||
| 265 | |||
| 266 | struct vmxnet3_rx_queue { | ||
| 267 | struct vmxnet3_cmd_ring rx_ring[2]; | ||
| 268 | struct vmxnet3_comp_ring comp_ring; | ||
| 269 | struct vmxnet3_rx_ctx rx_ctx; | ||
| 270 | u32 qid; /* rqID in RCD for buffer from 1st ring */ | ||
| 271 | u32 qid2; /* rqID in RCD for buffer from 2nd ring */ | ||
| 272 | u32 uncommitted[2]; /* # of buffers allocated since last RXPROD | ||
| 273 | * update */ | ||
| 274 | struct vmxnet3_rx_buf_info *buf_info[2]; | ||
| 275 | struct Vmxnet3_RxQueueCtrl *shared; | ||
| 276 | struct vmxnet3_rq_driver_stats stats; | ||
| 277 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | ||
| 278 | |||
| 279 | #define VMXNET3_LINUX_MAX_MSIX_VECT 1 | ||
| 280 | |||
| 281 | struct vmxnet3_intr { | ||
| 282 | enum vmxnet3_intr_mask_mode mask_mode; | ||
| 283 | enum vmxnet3_intr_type type; /* MSI-X, MSI, or INTx? */ | ||
| 284 | u8 num_intrs; /* # of intr vectors */ | ||
| 285 | u8 event_intr_idx; /* idx of the intr vector for event */ | ||
| 286 | u8 mod_levels[VMXNET3_LINUX_MAX_MSIX_VECT]; /* moderation level */ | ||
| 287 | #ifdef CONFIG_PCI_MSI | ||
| 288 | struct msix_entry msix_entries[VMXNET3_LINUX_MAX_MSIX_VECT]; | ||
| 289 | #endif | ||
| 290 | }; | ||
| 291 | |||
| 292 | #define VMXNET3_STATE_BIT_RESETTING 0 | ||
| 293 | #define VMXNET3_STATE_BIT_QUIESCED 1 | ||
| 294 | struct vmxnet3_adapter { | ||
| 295 | struct vmxnet3_tx_queue tx_queue; | ||
| 296 | struct vmxnet3_rx_queue rx_queue; | ||
| 297 | struct napi_struct napi; | ||
| 298 | struct vlan_group *vlan_grp; | ||
| 299 | |||
| 300 | struct vmxnet3_intr intr; | ||
| 301 | |||
| 302 | struct Vmxnet3_DriverShared *shared; | ||
| 303 | struct Vmxnet3_PMConf *pm_conf; | ||
| 304 | struct Vmxnet3_TxQueueDesc *tqd_start; /* first tx queue desc */ | ||
| 305 | struct Vmxnet3_RxQueueDesc *rqd_start; /* first rx queue desc */ | ||
| 306 | struct net_device *netdev; | ||
| 307 | struct pci_dev *pdev; | ||
| 308 | |||
| 309 | u8 *hw_addr0; /* for BAR 0 */ | ||
| 310 | u8 *hw_addr1; /* for BAR 1 */ | ||
| 311 | |||
| 312 | /* feature control */ | ||
| 313 | bool rxcsum; | ||
| 314 | bool lro; | ||
| 315 | bool jumbo_frame; | ||
| 316 | |||
| 317 | /* rx buffer related */ | ||
| 318 | unsigned skb_buf_size; | ||
| 319 | int rx_buf_per_pkt; /* only apply to the 1st ring */ | ||
| 320 | dma_addr_t shared_pa; | ||
| 321 | dma_addr_t queue_desc_pa; | ||
| 322 | |||
| 323 | /* Wake-on-LAN */ | ||
| 324 | u32 wol; | ||
| 325 | |||
| 326 | /* Link speed */ | ||
| 327 | u32 link_speed; /* in mbps */ | ||
| 328 | |||
| 329 | u64 tx_timeout_count; | ||
| 330 | struct work_struct work; | ||
| 331 | |||
| 332 | unsigned long state; /* VMXNET3_STATE_BIT_xxx */ | ||
| 333 | |||
| 334 | int dev_number; | ||
| 335 | }; | ||
| 336 | |||
| 337 | #define VMXNET3_WRITE_BAR0_REG(adapter, reg, val) \ | ||
| 338 | writel((val), (adapter)->hw_addr0 + (reg)) | ||
| 339 | #define VMXNET3_READ_BAR0_REG(adapter, reg) \ | ||
| 340 | readl((adapter)->hw_addr0 + (reg)) | ||
| 341 | |||
| 342 | #define VMXNET3_WRITE_BAR1_REG(adapter, reg, val) \ | ||
| 343 | writel((val), (adapter)->hw_addr1 + (reg)) | ||
| 344 | #define VMXNET3_READ_BAR1_REG(adapter, reg) \ | ||
| 345 | readl((adapter)->hw_addr1 + (reg)) | ||
| 346 | |||
| 347 | #define VMXNET3_WAKE_QUEUE_THRESHOLD(tq) (5) | ||
| 348 | #define VMXNET3_RX_ALLOC_THRESHOLD(rq, ring_idx, adapter) \ | ||
| 349 | ((rq)->rx_ring[ring_idx].size >> 3) | ||
| 350 | |||
| 351 | #define VMXNET3_GET_ADDR_LO(dma) ((u32)(dma)) | ||
| 352 | #define VMXNET3_GET_ADDR_HI(dma) ((u32)(((u64)(dma)) >> 32)) | ||
| 353 | |||
| 354 | /* must be a multiple of VMXNET3_RING_SIZE_ALIGN */ | ||
| 355 | #define VMXNET3_DEF_TX_RING_SIZE 512 | ||
| 356 | #define VMXNET3_DEF_RX_RING_SIZE 256 | ||
| 357 | |||
| 358 | #define VMXNET3_MAX_ETH_HDR_SIZE 22 | ||
| 359 | #define VMXNET3_MAX_SKB_BUF_SIZE (3*1024) | ||
| 360 | |||
| 361 | int | ||
| 362 | vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter); | ||
| 363 | |||
| 364 | int | ||
| 365 | vmxnet3_activate_dev(struct vmxnet3_adapter *adapter); | ||
| 366 | |||
| 367 | void | ||
| 368 | vmxnet3_force_close(struct vmxnet3_adapter *adapter); | ||
| 369 | |||
| 370 | void | ||
| 371 | vmxnet3_reset_dev(struct vmxnet3_adapter *adapter); | ||
| 372 | |||
| 373 | void | ||
| 374 | vmxnet3_tq_destroy(struct vmxnet3_tx_queue *tq, | ||
| 375 | struct vmxnet3_adapter *adapter); | ||
| 376 | |||
| 377 | void | ||
| 378 | vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq, | ||
| 379 | struct vmxnet3_adapter *adapter); | ||
| 380 | |||
| 381 | int | ||
| 382 | vmxnet3_create_queues(struct vmxnet3_adapter *adapter, | ||
| 383 | u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size); | ||
| 384 | |||
| 385 | extern void vmxnet3_set_ethtool_ops(struct net_device *netdev); | ||
| 386 | extern struct net_device_stats *vmxnet3_get_stats(struct net_device *netdev); | ||
| 387 | |||
| 388 | extern char vmxnet3_driver_name[]; | ||
| 389 | #endif | ||
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index 9693b0fd323d..0bd898c94759 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 19 | #include <linux/capability.h> | ||
| 19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
| 20 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 21 | #include <linux/string.h> | 22 | #include <linux/string.h> |
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index cf5fd17ad707..f1bff98acd1f 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
| @@ -58,8 +58,7 @@ struct cisco_state { | |||
| 58 | spinlock_t lock; | 58 | spinlock_t lock; |
| 59 | unsigned long last_poll; | 59 | unsigned long last_poll; |
| 60 | int up; | 60 | int up; |
| 61 | int request_sent; | 61 | u32 txseq; /* TX sequence number, 0 = none */ |
| 62 | u32 txseq; /* TX sequence number */ | ||
| 63 | u32 rxseq; /* RX sequence number */ | 62 | u32 rxseq; /* RX sequence number */ |
| 64 | }; | 63 | }; |
| 65 | 64 | ||
| @@ -163,6 +162,7 @@ static int cisco_rx(struct sk_buff *skb) | |||
| 163 | struct cisco_packet *cisco_data; | 162 | struct cisco_packet *cisco_data; |
| 164 | struct in_device *in_dev; | 163 | struct in_device *in_dev; |
| 165 | __be32 addr, mask; | 164 | __be32 addr, mask; |
| 165 | u32 ack; | ||
| 166 | 166 | ||
| 167 | if (skb->len < sizeof(struct hdlc_header)) | 167 | if (skb->len < sizeof(struct hdlc_header)) |
| 168 | goto rx_error; | 168 | goto rx_error; |
| @@ -223,8 +223,10 @@ static int cisco_rx(struct sk_buff *skb) | |||
| 223 | case CISCO_KEEPALIVE_REQ: | 223 | case CISCO_KEEPALIVE_REQ: |
| 224 | spin_lock(&st->lock); | 224 | spin_lock(&st->lock); |
| 225 | st->rxseq = ntohl(cisco_data->par1); | 225 | st->rxseq = ntohl(cisco_data->par1); |
| 226 | if (st->request_sent && | 226 | ack = ntohl(cisco_data->par2); |
| 227 | ntohl(cisco_data->par2) == st->txseq) { | 227 | if (ack && (ack == st->txseq || |
| 228 | /* our current REQ may be in transit */ | ||
| 229 | ack == st->txseq - 1)) { | ||
| 228 | st->last_poll = jiffies; | 230 | st->last_poll = jiffies; |
| 229 | if (!st->up) { | 231 | if (!st->up) { |
| 230 | u32 sec, min, hrs, days; | 232 | u32 sec, min, hrs, days; |
| @@ -275,7 +277,6 @@ static void cisco_timer(unsigned long arg) | |||
| 275 | 277 | ||
| 276 | cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, htonl(++st->txseq), | 278 | cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, htonl(++st->txseq), |
| 277 | htonl(st->rxseq)); | 279 | htonl(st->rxseq)); |
| 278 | st->request_sent = 1; | ||
| 279 | spin_unlock(&st->lock); | 280 | spin_unlock(&st->lock); |
| 280 | 281 | ||
| 281 | st->timer.expires = jiffies + st->settings.interval * HZ; | 282 | st->timer.expires = jiffies + st->settings.interval * HZ; |
| @@ -293,9 +294,7 @@ static void cisco_start(struct net_device *dev) | |||
| 293 | unsigned long flags; | 294 | unsigned long flags; |
| 294 | 295 | ||
| 295 | spin_lock_irqsave(&st->lock, flags); | 296 | spin_lock_irqsave(&st->lock, flags); |
| 296 | st->up = 0; | 297 | st->up = st->txseq = st->rxseq = 0; |
| 297 | st->request_sent = 0; | ||
| 298 | st->txseq = st->rxseq = 0; | ||
| 299 | spin_unlock_irqrestore(&st->lock, flags); | 298 | spin_unlock_irqrestore(&st->lock, flags); |
| 300 | 299 | ||
| 301 | init_timer(&st->timer); | 300 | init_timer(&st->timer); |
| @@ -317,8 +316,7 @@ static void cisco_stop(struct net_device *dev) | |||
| 317 | 316 | ||
| 318 | spin_lock_irqsave(&st->lock, flags); | 317 | spin_lock_irqsave(&st->lock, flags); |
| 319 | netif_dormant_on(dev); | 318 | netif_dormant_on(dev); |
| 320 | st->up = 0; | 319 | st->up = st->txseq = 0; |
| 321 | st->request_sent = 0; | ||
| 322 | spin_unlock_irqrestore(&st->lock, flags); | 320 | spin_unlock_irqrestore(&st->lock, flags); |
| 323 | } | 321 | } |
| 324 | 322 | ||
diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c index 83da596e2052..58c66819f39b 100644 --- a/drivers/net/wan/n2.c +++ b/drivers/net/wan/n2.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
| 21 | #include <linux/capability.h> | ||
| 21 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 22 | #include <linux/types.h> | 23 | #include <linux/types.h> |
| 23 | #include <linux/fcntl.h> | 24 | #include <linux/fcntl.h> |
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c index a52f29c72c33..f1340faaf022 100644 --- a/drivers/net/wan/pci200syn.c +++ b/drivers/net/wan/pci200syn.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 19 | #include <linux/capability.h> | ||
| 19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
| 20 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 21 | #include <linux/fcntl.h> | 22 | #include <linux/fcntl.h> |
diff --git a/drivers/net/wireless/adm8211.h b/drivers/net/wireless/adm8211.h index 4f6ab1322189..b07e4d3a6b4d 100644 --- a/drivers/net/wireless/adm8211.h +++ b/drivers/net/wireless/adm8211.h | |||
| @@ -266,7 +266,7 @@ do { \ | |||
| 266 | #define ADM8211_SYNCTL_CS1 (1 << 28) | 266 | #define ADM8211_SYNCTL_CS1 (1 << 28) |
| 267 | #define ADM8211_SYNCTL_CAL (1 << 27) | 267 | #define ADM8211_SYNCTL_CAL (1 << 27) |
| 268 | #define ADM8211_SYNCTL_SELCAL (1 << 26) | 268 | #define ADM8211_SYNCTL_SELCAL (1 << 26) |
| 269 | #define ADM8211_SYNCTL_RFtype ((1 << 24) || (1 << 23) || (1 << 22)) | 269 | #define ADM8211_SYNCTL_RFtype ((1 << 24) | (1 << 23) | (1 << 22)) |
| 270 | #define ADM8211_SYNCTL_RFMD (1 << 22) | 270 | #define ADM8211_SYNCTL_RFMD (1 << 22) |
| 271 | #define ADM8211_SYNCTL_GENERAL (0x7 << 22) | 271 | #define ADM8211_SYNCTL_GENERAL (0x7 << 22) |
| 272 | /* SYNCTL 21:0 Data (Si4126: 18-bit data, 4-bit address) */ | 272 | /* SYNCTL 21:0 Data (Si4126: 18-bit data, 4-bit address) */ |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index fa1549a03c71..660716214d49 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
| @@ -607,82 +607,7 @@ struct b43_qos_params { | |||
| 607 | struct ieee80211_tx_queue_params p; | 607 | struct ieee80211_tx_queue_params p; |
| 608 | }; | 608 | }; |
| 609 | 609 | ||
| 610 | struct b43_wldev; | 610 | struct b43_wl; |
| 611 | |||
| 612 | /* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */ | ||
| 613 | struct b43_wl { | ||
| 614 | /* Pointer to the active wireless device on this chip */ | ||
| 615 | struct b43_wldev *current_dev; | ||
| 616 | /* Pointer to the ieee80211 hardware data structure */ | ||
| 617 | struct ieee80211_hw *hw; | ||
| 618 | |||
| 619 | /* Global driver mutex. Every operation must run with this mutex locked. */ | ||
| 620 | struct mutex mutex; | ||
| 621 | /* Hard-IRQ spinlock. This lock protects things used in the hard-IRQ | ||
| 622 | * handler, only. This basically is just the IRQ mask register. */ | ||
| 623 | spinlock_t hardirq_lock; | ||
| 624 | |||
| 625 | /* The number of queues that were registered with the mac80211 subsystem | ||
| 626 | * initially. This is a backup copy of hw->queues in case hw->queues has | ||
| 627 | * to be dynamically lowered at runtime (Firmware does not support QoS). | ||
| 628 | * hw->queues has to be restored to the original value before unregistering | ||
| 629 | * from the mac80211 subsystem. */ | ||
| 630 | u16 mac80211_initially_registered_queues; | ||
| 631 | |||
| 632 | /* We can only have one operating interface (802.11 core) | ||
| 633 | * at a time. General information about this interface follows. | ||
| 634 | */ | ||
| 635 | |||
| 636 | struct ieee80211_vif *vif; | ||
| 637 | /* The MAC address of the operating interface. */ | ||
| 638 | u8 mac_addr[ETH_ALEN]; | ||
| 639 | /* Current BSSID */ | ||
| 640 | u8 bssid[ETH_ALEN]; | ||
| 641 | /* Interface type. (NL80211_IFTYPE_XXX) */ | ||
| 642 | int if_type; | ||
| 643 | /* Is the card operating in AP, STA or IBSS mode? */ | ||
| 644 | bool operating; | ||
| 645 | /* filter flags */ | ||
| 646 | unsigned int filter_flags; | ||
| 647 | /* Stats about the wireless interface */ | ||
| 648 | struct ieee80211_low_level_stats ieee_stats; | ||
| 649 | |||
| 650 | #ifdef CONFIG_B43_HWRNG | ||
| 651 | struct hwrng rng; | ||
| 652 | bool rng_initialized; | ||
| 653 | char rng_name[30 + 1]; | ||
| 654 | #endif /* CONFIG_B43_HWRNG */ | ||
| 655 | |||
| 656 | /* List of all wireless devices on this chip */ | ||
| 657 | struct list_head devlist; | ||
| 658 | u8 nr_devs; | ||
| 659 | |||
| 660 | bool radiotap_enabled; | ||
| 661 | bool radio_enabled; | ||
| 662 | |||
| 663 | /* The beacon we are currently using (AP or IBSS mode). */ | ||
| 664 | struct sk_buff *current_beacon; | ||
| 665 | bool beacon0_uploaded; | ||
| 666 | bool beacon1_uploaded; | ||
| 667 | bool beacon_templates_virgin; /* Never wrote the templates? */ | ||
| 668 | struct work_struct beacon_update_trigger; | ||
| 669 | |||
| 670 | /* The current QOS parameters for the 4 queues. */ | ||
| 671 | struct b43_qos_params qos_params[4]; | ||
| 672 | |||
| 673 | /* Work for adjustment of the transmission power. | ||
| 674 | * This is scheduled when we determine that the actual TX output | ||
| 675 | * power doesn't match what we want. */ | ||
| 676 | struct work_struct txpower_adjust_work; | ||
| 677 | |||
| 678 | /* Packet transmit work */ | ||
| 679 | struct work_struct tx_work; | ||
| 680 | /* Queue of packets to be transmitted. */ | ||
| 681 | struct sk_buff_head tx_queue; | ||
| 682 | |||
| 683 | /* The device LEDs. */ | ||
| 684 | struct b43_leds leds; | ||
| 685 | }; | ||
| 686 | 611 | ||
| 687 | /* The type of the firmware file. */ | 612 | /* The type of the firmware file. */ |
| 688 | enum b43_firmware_file_type { | 613 | enum b43_firmware_file_type { |
| @@ -824,6 +749,97 @@ struct b43_wldev { | |||
| 824 | #endif | 749 | #endif |
| 825 | }; | 750 | }; |
| 826 | 751 | ||
| 752 | /* | ||
| 753 | * Include goes here to avoid a dependency problem. | ||
| 754 | * A better fix would be to integrate xmit.h into b43.h. | ||
| 755 | */ | ||
| 756 | #include "xmit.h" | ||
| 757 | |||
| 758 | /* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */ | ||
| 759 | struct b43_wl { | ||
| 760 | /* Pointer to the active wireless device on this chip */ | ||
| 761 | struct b43_wldev *current_dev; | ||
| 762 | /* Pointer to the ieee80211 hardware data structure */ | ||
| 763 | struct ieee80211_hw *hw; | ||
| 764 | |||
| 765 | /* Global driver mutex. Every operation must run with this mutex locked. */ | ||
| 766 | struct mutex mutex; | ||
| 767 | /* Hard-IRQ spinlock. This lock protects things used in the hard-IRQ | ||
| 768 | * handler, only. This basically is just the IRQ mask register. */ | ||
| 769 | spinlock_t hardirq_lock; | ||
| 770 | |||
| 771 | /* The number of queues that were registered with the mac80211 subsystem | ||
| 772 | * initially. This is a backup copy of hw->queues in case hw->queues has | ||
| 773 | * to be dynamically lowered at runtime (Firmware does not support QoS). | ||
| 774 | * hw->queues has to be restored to the original value before unregistering | ||
| 775 | * from the mac80211 subsystem. */ | ||
| 776 | u16 mac80211_initially_registered_queues; | ||
| 777 | |||
| 778 | /* We can only have one operating interface (802.11 core) | ||
| 779 | * at a time. General information about this interface follows. | ||
| 780 | */ | ||
| 781 | |||
| 782 | struct ieee80211_vif *vif; | ||
| 783 | /* The MAC address of the operating interface. */ | ||
| 784 | u8 mac_addr[ETH_ALEN]; | ||
| 785 | /* Current BSSID */ | ||
| 786 | u8 bssid[ETH_ALEN]; | ||
| 787 | /* Interface type. (NL80211_IFTYPE_XXX) */ | ||
| 788 | int if_type; | ||
| 789 | /* Is the card operating in AP, STA or IBSS mode? */ | ||
| 790 | bool operating; | ||
| 791 | /* filter flags */ | ||
| 792 | unsigned int filter_flags; | ||
| 793 | /* Stats about the wireless interface */ | ||
| 794 | struct ieee80211_low_level_stats ieee_stats; | ||
| 795 | |||
| 796 | #ifdef CONFIG_B43_HWRNG | ||
| 797 | struct hwrng rng; | ||
| 798 | bool rng_initialized; | ||
| 799 | char rng_name[30 + 1]; | ||
| 800 | #endif /* CONFIG_B43_HWRNG */ | ||
| 801 | |||
| 802 | /* List of all wireless devices on this chip */ | ||
| 803 | struct list_head devlist; | ||
| 804 | u8 nr_devs; | ||
| 805 | |||
| 806 | bool radiotap_enabled; | ||
| 807 | bool radio_enabled; | ||
| 808 | |||
| 809 | /* The beacon we are currently using (AP or IBSS mode). */ | ||
| 810 | struct sk_buff *current_beacon; | ||
| 811 | bool beacon0_uploaded; | ||
| 812 | bool beacon1_uploaded; | ||
| 813 | bool beacon_templates_virgin; /* Never wrote the templates? */ | ||
| 814 | struct work_struct beacon_update_trigger; | ||
| 815 | |||
| 816 | /* The current QOS parameters for the 4 queues. */ | ||
| 817 | struct b43_qos_params qos_params[4]; | ||
| 818 | |||
| 819 | /* Work for adjustment of the transmission power. | ||
| 820 | * This is scheduled when we determine that the actual TX output | ||
| 821 | * power doesn't match what we want. */ | ||
| 822 | struct work_struct txpower_adjust_work; | ||
| 823 | |||
| 824 | /* Packet transmit work */ | ||
| 825 | struct work_struct tx_work; | ||
| 826 | /* Queue of packets to be transmitted. */ | ||
| 827 | struct sk_buff_head tx_queue; | ||
| 828 | |||
| 829 | /* The device LEDs. */ | ||
| 830 | struct b43_leds leds; | ||
| 831 | |||
| 832 | #ifdef CONFIG_B43_PIO | ||
| 833 | /* | ||
| 834 | * RX/TX header/tail buffers used by the frame transmit functions. | ||
| 835 | */ | ||
| 836 | struct b43_rxhdr_fw4 rxhdr; | ||
| 837 | struct b43_txhdr txhdr; | ||
| 838 | u8 rx_tail[4]; | ||
| 839 | u8 tx_tail[4]; | ||
| 840 | #endif /* CONFIG_B43_PIO */ | ||
| 841 | }; | ||
| 842 | |||
| 827 | static inline struct b43_wl *hw_to_b43_wl(struct ieee80211_hw *hw) | 843 | static inline struct b43_wl *hw_to_b43_wl(struct ieee80211_hw *hw) |
| 828 | { | 844 | { |
| 829 | return hw->priv; | 845 | return hw->priv; |
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c index fbe3d4f62ce2..1e8dba488004 100644 --- a/drivers/net/wireless/b43/leds.c +++ b/drivers/net/wireless/b43/leds.c | |||
| @@ -348,9 +348,9 @@ void b43_leds_register(struct b43_wldev *dev) | |||
| 348 | } | 348 | } |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | void b43_leds_unregister(struct b43_wldev *dev) | 351 | void b43_leds_unregister(struct b43_wl *wl) |
| 352 | { | 352 | { |
| 353 | struct b43_leds *leds = &dev->wl->leds; | 353 | struct b43_leds *leds = &wl->leds; |
| 354 | 354 | ||
| 355 | b43_unregister_led(&leds->led_tx); | 355 | b43_unregister_led(&leds->led_tx); |
| 356 | b43_unregister_led(&leds->led_rx); | 356 | b43_unregister_led(&leds->led_rx); |
diff --git a/drivers/net/wireless/b43/leds.h b/drivers/net/wireless/b43/leds.h index 9592e4c5a5f5..4c56187810fc 100644 --- a/drivers/net/wireless/b43/leds.h +++ b/drivers/net/wireless/b43/leds.h | |||
| @@ -60,7 +60,7 @@ enum b43_led_behaviour { | |||
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | void b43_leds_register(struct b43_wldev *dev); | 62 | void b43_leds_register(struct b43_wldev *dev); |
| 63 | void b43_leds_unregister(struct b43_wldev *dev); | 63 | void b43_leds_unregister(struct b43_wl *wl); |
| 64 | void b43_leds_init(struct b43_wldev *dev); | 64 | void b43_leds_init(struct b43_wldev *dev); |
| 65 | void b43_leds_exit(struct b43_wldev *dev); | 65 | void b43_leds_exit(struct b43_wldev *dev); |
| 66 | void b43_leds_stop(struct b43_wldev *dev); | 66 | void b43_leds_stop(struct b43_wldev *dev); |
| @@ -76,7 +76,7 @@ struct b43_leds { | |||
| 76 | static inline void b43_leds_register(struct b43_wldev *dev) | 76 | static inline void b43_leds_register(struct b43_wldev *dev) |
| 77 | { | 77 | { |
| 78 | } | 78 | } |
| 79 | static inline void b43_leds_unregister(struct b43_wldev *dev) | 79 | static inline void b43_leds_unregister(struct b43_wl *wl) |
| 80 | { | 80 | { |
| 81 | } | 81 | } |
| 82 | static inline void b43_leds_init(struct b43_wldev *dev) | 82 | static inline void b43_leds_init(struct b43_wldev *dev) |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 9b907a36bb8c..df6b26a0c05e 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -3874,6 +3874,7 @@ static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev) | |||
| 3874 | { | 3874 | { |
| 3875 | struct b43_wl *wl = dev->wl; | 3875 | struct b43_wl *wl = dev->wl; |
| 3876 | struct b43_wldev *orig_dev; | 3876 | struct b43_wldev *orig_dev; |
| 3877 | u32 mask; | ||
| 3877 | 3878 | ||
| 3878 | redo: | 3879 | redo: |
| 3879 | if (!dev || b43_status(dev) < B43_STAT_STARTED) | 3880 | if (!dev || b43_status(dev) < B43_STAT_STARTED) |
| @@ -3920,7 +3921,8 @@ redo: | |||
| 3920 | goto redo; | 3921 | goto redo; |
| 3921 | return dev; | 3922 | return dev; |
| 3922 | } | 3923 | } |
| 3923 | B43_WARN_ON(b43_read32(dev, B43_MMIO_GEN_IRQ_MASK)); | 3924 | mask = b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); |
| 3925 | B43_WARN_ON(mask != 0xFFFFFFFF && mask); | ||
| 3924 | 3926 | ||
| 3925 | /* Drain the TX queue */ | 3927 | /* Drain the TX queue */ |
| 3926 | while (skb_queue_len(&wl->tx_queue)) | 3928 | while (skb_queue_len(&wl->tx_queue)) |
| @@ -4499,6 +4501,7 @@ static void b43_op_stop(struct ieee80211_hw *hw) | |||
| 4499 | 4501 | ||
| 4500 | cancel_work_sync(&(wl->beacon_update_trigger)); | 4502 | cancel_work_sync(&(wl->beacon_update_trigger)); |
| 4501 | 4503 | ||
| 4504 | wiphy_rfkill_stop_polling(hw->wiphy); | ||
| 4502 | mutex_lock(&wl->mutex); | 4505 | mutex_lock(&wl->mutex); |
| 4503 | if (b43_status(dev) >= B43_STAT_STARTED) { | 4506 | if (b43_status(dev) >= B43_STAT_STARTED) { |
| 4504 | dev = b43_wireless_core_stop(dev); | 4507 | dev = b43_wireless_core_stop(dev); |
| @@ -4997,7 +5000,7 @@ static void b43_remove(struct ssb_device *dev) | |||
| 4997 | 5000 | ||
| 4998 | if (list_empty(&wl->devlist)) { | 5001 | if (list_empty(&wl->devlist)) { |
| 4999 | b43_rng_exit(wl); | 5002 | b43_rng_exit(wl); |
| 5000 | b43_leds_unregister(wldev); | 5003 | b43_leds_unregister(wl); |
| 5001 | /* Last core on the chip unregistered. | 5004 | /* Last core on the chip unregistered. |
| 5002 | * We can destroy common struct b43_wl. | 5005 | * We can destroy common struct b43_wl. |
| 5003 | */ | 5006 | */ |
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c index 5e87650b07fb..9b9044400218 100644 --- a/drivers/net/wireless/b43/pio.c +++ b/drivers/net/wireless/b43/pio.c | |||
| @@ -332,6 +332,7 @@ static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q, | |||
| 332 | unsigned int data_len) | 332 | unsigned int data_len) |
| 333 | { | 333 | { |
| 334 | struct b43_wldev *dev = q->dev; | 334 | struct b43_wldev *dev = q->dev; |
| 335 | struct b43_wl *wl = dev->wl; | ||
| 335 | const u8 *data = _data; | 336 | const u8 *data = _data; |
| 336 | 337 | ||
| 337 | ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI; | 338 | ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI; |
| @@ -341,13 +342,12 @@ static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q, | |||
| 341 | q->mmio_base + B43_PIO_TXDATA, | 342 | q->mmio_base + B43_PIO_TXDATA, |
| 342 | sizeof(u16)); | 343 | sizeof(u16)); |
| 343 | if (data_len & 1) { | 344 | if (data_len & 1) { |
| 344 | u8 tail[2] = { 0, }; | ||
| 345 | |||
| 346 | /* Write the last byte. */ | 345 | /* Write the last byte. */ |
| 347 | ctl &= ~B43_PIO_TXCTL_WRITEHI; | 346 | ctl &= ~B43_PIO_TXCTL_WRITEHI; |
| 348 | b43_piotx_write16(q, B43_PIO_TXCTL, ctl); | 347 | b43_piotx_write16(q, B43_PIO_TXCTL, ctl); |
| 349 | tail[0] = data[data_len - 1]; | 348 | wl->tx_tail[0] = data[data_len - 1]; |
| 350 | ssb_block_write(dev->dev, tail, 2, | 349 | wl->tx_tail[1] = 0; |
| 350 | ssb_block_write(dev->dev, wl->tx_tail, 2, | ||
| 351 | q->mmio_base + B43_PIO_TXDATA, | 351 | q->mmio_base + B43_PIO_TXDATA, |
| 352 | sizeof(u16)); | 352 | sizeof(u16)); |
| 353 | } | 353 | } |
| @@ -382,6 +382,7 @@ static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q, | |||
| 382 | unsigned int data_len) | 382 | unsigned int data_len) |
| 383 | { | 383 | { |
| 384 | struct b43_wldev *dev = q->dev; | 384 | struct b43_wldev *dev = q->dev; |
| 385 | struct b43_wl *wl = dev->wl; | ||
| 385 | const u8 *data = _data; | 386 | const u8 *data = _data; |
| 386 | 387 | ||
| 387 | ctl |= B43_PIO8_TXCTL_0_7 | B43_PIO8_TXCTL_8_15 | | 388 | ctl |= B43_PIO8_TXCTL_0_7 | B43_PIO8_TXCTL_8_15 | |
| @@ -392,29 +393,31 @@ static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q, | |||
| 392 | q->mmio_base + B43_PIO8_TXDATA, | 393 | q->mmio_base + B43_PIO8_TXDATA, |
| 393 | sizeof(u32)); | 394 | sizeof(u32)); |
| 394 | if (data_len & 3) { | 395 | if (data_len & 3) { |
| 395 | u8 tail[4] = { 0, }; | 396 | wl->tx_tail[3] = 0; |
| 396 | |||
| 397 | /* Write the last few bytes. */ | 397 | /* Write the last few bytes. */ |
| 398 | ctl &= ~(B43_PIO8_TXCTL_8_15 | B43_PIO8_TXCTL_16_23 | | 398 | ctl &= ~(B43_PIO8_TXCTL_8_15 | B43_PIO8_TXCTL_16_23 | |
| 399 | B43_PIO8_TXCTL_24_31); | 399 | B43_PIO8_TXCTL_24_31); |
| 400 | switch (data_len & 3) { | 400 | switch (data_len & 3) { |
| 401 | case 3: | 401 | case 3: |
| 402 | ctl |= B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_8_15; | 402 | ctl |= B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_8_15; |
| 403 | tail[0] = data[data_len - 3]; | 403 | wl->tx_tail[0] = data[data_len - 3]; |
| 404 | tail[1] = data[data_len - 2]; | 404 | wl->tx_tail[1] = data[data_len - 2]; |
| 405 | tail[2] = data[data_len - 1]; | 405 | wl->tx_tail[2] = data[data_len - 1]; |
| 406 | break; | 406 | break; |
| 407 | case 2: | 407 | case 2: |
| 408 | ctl |= B43_PIO8_TXCTL_8_15; | 408 | ctl |= B43_PIO8_TXCTL_8_15; |
| 409 | tail[0] = data[data_len - 2]; | 409 | wl->tx_tail[0] = data[data_len - 2]; |
| 410 | tail[1] = data[data_len - 1]; | 410 | wl->tx_tail[1] = data[data_len - 1]; |
| 411 | wl->tx_tail[2] = 0; | ||
| 411 | break; | 412 | break; |
| 412 | case 1: | 413 | case 1: |
| 413 | tail[0] = data[data_len - 1]; | 414 | wl->tx_tail[0] = data[data_len - 1]; |
| 415 | wl->tx_tail[1] = 0; | ||
| 416 | wl->tx_tail[2] = 0; | ||
| 414 | break; | 417 | break; |
| 415 | } | 418 | } |
| 416 | b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); | 419 | b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); |
| 417 | ssb_block_write(dev->dev, tail, 4, | 420 | ssb_block_write(dev->dev, wl->tx_tail, 4, |
| 418 | q->mmio_base + B43_PIO8_TXDATA, | 421 | q->mmio_base + B43_PIO8_TXDATA, |
| 419 | sizeof(u32)); | 422 | sizeof(u32)); |
| 420 | } | 423 | } |
| @@ -446,8 +449,9 @@ static void pio_tx_frame_4byte_queue(struct b43_pio_txpacket *pack, | |||
| 446 | static int pio_tx_frame(struct b43_pio_txqueue *q, | 449 | static int pio_tx_frame(struct b43_pio_txqueue *q, |
| 447 | struct sk_buff *skb) | 450 | struct sk_buff *skb) |
| 448 | { | 451 | { |
| 452 | struct b43_wldev *dev = q->dev; | ||
| 453 | struct b43_wl *wl = dev->wl; | ||
| 449 | struct b43_pio_txpacket *pack; | 454 | struct b43_pio_txpacket *pack; |
| 450 | struct b43_txhdr txhdr; | ||
| 451 | u16 cookie; | 455 | u16 cookie; |
| 452 | int err; | 456 | int err; |
| 453 | unsigned int hdrlen; | 457 | unsigned int hdrlen; |
| @@ -458,8 +462,8 @@ static int pio_tx_frame(struct b43_pio_txqueue *q, | |||
| 458 | struct b43_pio_txpacket, list); | 462 | struct b43_pio_txpacket, list); |
| 459 | 463 | ||
| 460 | cookie = generate_cookie(q, pack); | 464 | cookie = generate_cookie(q, pack); |
| 461 | hdrlen = b43_txhdr_size(q->dev); | 465 | hdrlen = b43_txhdr_size(dev); |
| 462 | err = b43_generate_txhdr(q->dev, (u8 *)&txhdr, skb, | 466 | err = b43_generate_txhdr(dev, (u8 *)&wl->txhdr, skb, |
| 463 | info, cookie); | 467 | info, cookie); |
| 464 | if (err) | 468 | if (err) |
| 465 | return err; | 469 | return err; |
| @@ -467,15 +471,15 @@ static int pio_tx_frame(struct b43_pio_txqueue *q, | |||
| 467 | if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { | 471 | if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { |
| 468 | /* Tell the firmware about the cookie of the last | 472 | /* Tell the firmware about the cookie of the last |
| 469 | * mcast frame, so it can clear the more-data bit in it. */ | 473 | * mcast frame, so it can clear the more-data bit in it. */ |
| 470 | b43_shm_write16(q->dev, B43_SHM_SHARED, | 474 | b43_shm_write16(dev, B43_SHM_SHARED, |
| 471 | B43_SHM_SH_MCASTCOOKIE, cookie); | 475 | B43_SHM_SH_MCASTCOOKIE, cookie); |
| 472 | } | 476 | } |
| 473 | 477 | ||
| 474 | pack->skb = skb; | 478 | pack->skb = skb; |
| 475 | if (q->rev >= 8) | 479 | if (q->rev >= 8) |
| 476 | pio_tx_frame_4byte_queue(pack, (const u8 *)&txhdr, hdrlen); | 480 | pio_tx_frame_4byte_queue(pack, (const u8 *)&wl->txhdr, hdrlen); |
| 477 | else | 481 | else |
| 478 | pio_tx_frame_2byte_queue(pack, (const u8 *)&txhdr, hdrlen); | 482 | pio_tx_frame_2byte_queue(pack, (const u8 *)&wl->txhdr, hdrlen); |
| 479 | 483 | ||
| 480 | /* Remove it from the list of available packet slots. | 484 | /* Remove it from the list of available packet slots. |
| 481 | * It will be put back when we receive the status report. */ | 485 | * It will be put back when we receive the status report. */ |
| @@ -615,14 +619,14 @@ void b43_pio_get_tx_stats(struct b43_wldev *dev, | |||
| 615 | static bool pio_rx_frame(struct b43_pio_rxqueue *q) | 619 | static bool pio_rx_frame(struct b43_pio_rxqueue *q) |
| 616 | { | 620 | { |
| 617 | struct b43_wldev *dev = q->dev; | 621 | struct b43_wldev *dev = q->dev; |
| 618 | struct b43_rxhdr_fw4 rxhdr; | 622 | struct b43_wl *wl = dev->wl; |
| 619 | u16 len; | 623 | u16 len; |
| 620 | u32 macstat; | 624 | u32 macstat; |
| 621 | unsigned int i, padding; | 625 | unsigned int i, padding; |
| 622 | struct sk_buff *skb; | 626 | struct sk_buff *skb; |
| 623 | const char *err_msg = NULL; | 627 | const char *err_msg = NULL; |
| 624 | 628 | ||
| 625 | memset(&rxhdr, 0, sizeof(rxhdr)); | 629 | memset(&wl->rxhdr, 0, sizeof(wl->rxhdr)); |
| 626 | 630 | ||
| 627 | /* Check if we have data and wait for it to get ready. */ | 631 | /* Check if we have data and wait for it to get ready. */ |
| 628 | if (q->rev >= 8) { | 632 | if (q->rev >= 8) { |
| @@ -660,16 +664,16 @@ data_ready: | |||
| 660 | 664 | ||
| 661 | /* Get the preamble (RX header) */ | 665 | /* Get the preamble (RX header) */ |
| 662 | if (q->rev >= 8) { | 666 | if (q->rev >= 8) { |
| 663 | ssb_block_read(dev->dev, &rxhdr, sizeof(rxhdr), | 667 | ssb_block_read(dev->dev, &wl->rxhdr, sizeof(wl->rxhdr), |
| 664 | q->mmio_base + B43_PIO8_RXDATA, | 668 | q->mmio_base + B43_PIO8_RXDATA, |
| 665 | sizeof(u32)); | 669 | sizeof(u32)); |
| 666 | } else { | 670 | } else { |
| 667 | ssb_block_read(dev->dev, &rxhdr, sizeof(rxhdr), | 671 | ssb_block_read(dev->dev, &wl->rxhdr, sizeof(wl->rxhdr), |
| 668 | q->mmio_base + B43_PIO_RXDATA, | 672 | q->mmio_base + B43_PIO_RXDATA, |
| 669 | sizeof(u16)); | 673 | sizeof(u16)); |
| 670 | } | 674 | } |
| 671 | /* Sanity checks. */ | 675 | /* Sanity checks. */ |
| 672 | len = le16_to_cpu(rxhdr.frame_len); | 676 | len = le16_to_cpu(wl->rxhdr.frame_len); |
| 673 | if (unlikely(len > 0x700)) { | 677 | if (unlikely(len > 0x700)) { |
| 674 | err_msg = "len > 0x700"; | 678 | err_msg = "len > 0x700"; |
| 675 | goto rx_error; | 679 | goto rx_error; |
| @@ -679,7 +683,7 @@ data_ready: | |||
| 679 | goto rx_error; | 683 | goto rx_error; |
| 680 | } | 684 | } |
| 681 | 685 | ||
| 682 | macstat = le32_to_cpu(rxhdr.mac_status); | 686 | macstat = le32_to_cpu(wl->rxhdr.mac_status); |
| 683 | if (macstat & B43_RX_MAC_FCSERR) { | 687 | if (macstat & B43_RX_MAC_FCSERR) { |
| 684 | if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) { | 688 | if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) { |
| 685 | /* Drop frames with failed FCS. */ | 689 | /* Drop frames with failed FCS. */ |
| @@ -704,24 +708,22 @@ data_ready: | |||
| 704 | q->mmio_base + B43_PIO8_RXDATA, | 708 | q->mmio_base + B43_PIO8_RXDATA, |
| 705 | sizeof(u32)); | 709 | sizeof(u32)); |
| 706 | if (len & 3) { | 710 | if (len & 3) { |
| 707 | u8 tail[4] = { 0, }; | ||
| 708 | |||
| 709 | /* Read the last few bytes. */ | 711 | /* Read the last few bytes. */ |
| 710 | ssb_block_read(dev->dev, tail, 4, | 712 | ssb_block_read(dev->dev, wl->rx_tail, 4, |
| 711 | q->mmio_base + B43_PIO8_RXDATA, | 713 | q->mmio_base + B43_PIO8_RXDATA, |
| 712 | sizeof(u32)); | 714 | sizeof(u32)); |
| 713 | switch (len & 3) { | 715 | switch (len & 3) { |
| 714 | case 3: | 716 | case 3: |
| 715 | skb->data[len + padding - 3] = tail[0]; | 717 | skb->data[len + padding - 3] = wl->rx_tail[0]; |
| 716 | skb->data[len + padding - 2] = tail[1]; | 718 | skb->data[len + padding - 2] = wl->rx_tail[1]; |
| 717 | skb->data[len + padding - 1] = tail[2]; | 719 | skb->data[len + padding - 1] = wl->rx_tail[2]; |
| 718 | break; | 720 | break; |
| 719 | case 2: | 721 | case 2: |
| 720 | skb->data[len + padding - 2] = tail[0]; | 722 | skb->data[len + padding - 2] = wl->rx_tail[0]; |
| 721 | skb->data[len + padding - 1] = tail[1]; | 723 | skb->data[len + padding - 1] = wl->rx_tail[1]; |
| 722 | break; | 724 | break; |
| 723 | case 1: | 725 | case 1: |
| 724 | skb->data[len + padding - 1] = tail[0]; | 726 | skb->data[len + padding - 1] = wl->rx_tail[0]; |
| 725 | break; | 727 | break; |
| 726 | } | 728 | } |
| 727 | } | 729 | } |
| @@ -730,17 +732,15 @@ data_ready: | |||
| 730 | q->mmio_base + B43_PIO_RXDATA, | 732 | q->mmio_base + B43_PIO_RXDATA, |
| 731 | sizeof(u16)); | 733 | sizeof(u16)); |
| 732 | if (len & 1) { | 734 | if (len & 1) { |
| 733 | u8 tail[2] = { 0, }; | ||
| 734 | |||
| 735 | /* Read the last byte. */ | 735 | /* Read the last byte. */ |
| 736 | ssb_block_read(dev->dev, tail, 2, | 736 | ssb_block_read(dev->dev, wl->rx_tail, 2, |
| 737 | q->mmio_base + B43_PIO_RXDATA, | 737 | q->mmio_base + B43_PIO_RXDATA, |
| 738 | sizeof(u16)); | 738 | sizeof(u16)); |
| 739 | skb->data[len + padding - 1] = tail[0]; | 739 | skb->data[len + padding - 1] = wl->rx_tail[0]; |
| 740 | } | 740 | } |
| 741 | } | 741 | } |
| 742 | 742 | ||
| 743 | b43_rx(q->dev, skb, &rxhdr); | 743 | b43_rx(q->dev, skb, &wl->rxhdr); |
| 744 | 744 | ||
| 745 | return 1; | 745 | return 1; |
| 746 | 746 | ||
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index ac9f600995e4..f4e9695ec186 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include "xmit.h" | 30 | #include "b43.h" |
| 31 | #include "phy_common.h" | 31 | #include "phy_common.h" |
| 32 | #include "dma.h" | 32 | #include "dma.h" |
| 33 | #include "pio.h" | 33 | #include "pio.h" |
| @@ -690,7 +690,10 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
| 690 | } | 690 | } |
| 691 | 691 | ||
| 692 | memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); | 692 | memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); |
| 693 | |||
| 694 | local_bh_disable(); | ||
| 693 | ieee80211_rx(dev->wl->hw, skb); | 695 | ieee80211_rx(dev->wl->hw, skb); |
| 696 | local_bh_enable(); | ||
| 694 | 697 | ||
| 695 | #if B43_DEBUG | 698 | #if B43_DEBUG |
| 696 | dev->rx_count++; | 699 | dev->rx_count++; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index a16bd4147eac..cbb0585083a9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
| @@ -702,7 +702,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
| 702 | u8 sta_id = iwl_find_station(priv, hdr->addr1); | 702 | u8 sta_id = iwl_find_station(priv, hdr->addr1); |
| 703 | 703 | ||
| 704 | if (sta_id == IWL_INVALID_STATION) { | 704 | if (sta_id == IWL_INVALID_STATION) { |
| 705 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pm\n", | 705 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", |
| 706 | hdr->addr1); | 706 | hdr->addr1); |
| 707 | sta_id = iwl_add_station(priv, hdr->addr1, false, | 707 | sta_id = iwl_add_station(priv, hdr->addr1, false, |
| 708 | CMD_ASYNC, NULL); | 708 | CMD_ASYNC, NULL); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 68136172b823..f059b49dc691 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
| @@ -611,7 +611,7 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, | |||
| 611 | if (rx_status.band == IEEE80211_BAND_5GHZ) | 611 | if (rx_status.band == IEEE80211_BAND_5GHZ) |
| 612 | rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; | 612 | rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; |
| 613 | 613 | ||
| 614 | rx_status.antenna = le16_to_cpu(rx_hdr->phy_flags & | 614 | rx_status.antenna = (le16_to_cpu(rx_hdr->phy_flags) & |
| 615 | RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; | 615 | RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4; |
| 616 | 616 | ||
| 617 | /* set the preamble flag if appropriate */ | 617 | /* set the preamble flag if appropriate */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index d6bc0e051043..6e6f516ba404 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
| @@ -318,7 +318,7 @@ static void iwl5000_gain_computation(struct iwl_priv *priv, | |||
| 318 | (s32)average_noise[i])) / 1500; | 318 | (s32)average_noise[i])) / 1500; |
| 319 | /* bound gain by 2 bits value max, 3rd bit is sign */ | 319 | /* bound gain by 2 bits value max, 3rd bit is sign */ |
| 320 | data->delta_gain_code[i] = | 320 | data->delta_gain_code[i] = |
| 321 | min(abs(delta_g), CHAIN_NOISE_MAX_DELTA_GAIN_CODE); | 321 | min(abs(delta_g), (long) CHAIN_NOISE_MAX_DELTA_GAIN_CODE); |
| 322 | 322 | ||
| 323 | if (delta_g < 0) | 323 | if (delta_g < 0) |
| 324 | /* set negative sign */ | 324 | /* set negative sign */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 313d3e5ee84b..eaafae091f5b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
| @@ -3106,8 +3106,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 3106 | out_pci_disable_device: | 3106 | out_pci_disable_device: |
| 3107 | pci_disable_device(pdev); | 3107 | pci_disable_device(pdev); |
| 3108 | out_ieee80211_free_hw: | 3108 | out_ieee80211_free_hw: |
| 3109 | ieee80211_free_hw(priv->hw); | ||
| 3110 | iwl_free_traffic_mem(priv); | 3109 | iwl_free_traffic_mem(priv); |
| 3110 | ieee80211_free_hw(priv->hw); | ||
| 3111 | out: | 3111 | out: |
| 3112 | return err; | 3112 | return err; |
| 3113 | } | 3113 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 2c5c88fc38f5..4afaf773aeac 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
| @@ -1154,7 +1154,7 @@ struct iwl_wep_cmd { | |||
| 1154 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) | 1154 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) |
| 1155 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) | 1155 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) |
| 1156 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) | 1156 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) |
| 1157 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK cpu_to_le16(0xf0) | 1157 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xf0 |
| 1158 | #define RX_RES_PHY_FLAGS_ANTENNA_POS 4 | 1158 | #define RX_RES_PHY_FLAGS_ANTENNA_POS 4 |
| 1159 | 1159 | ||
| 1160 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) | 1160 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index 3d2b93a61e62..e14c9952a935 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
| @@ -410,7 +410,6 @@ static int iwl_find_otp_image(struct iwl_priv *priv, | |||
| 410 | u16 *validblockaddr) | 410 | u16 *validblockaddr) |
| 411 | { | 411 | { |
| 412 | u16 next_link_addr = 0, link_value = 0, valid_addr; | 412 | u16 next_link_addr = 0, link_value = 0, valid_addr; |
| 413 | int ret = 0; | ||
| 414 | int usedblocks = 0; | 413 | int usedblocks = 0; |
| 415 | 414 | ||
| 416 | /* set addressing mode to absolute to traverse the link list */ | 415 | /* set addressing mode to absolute to traverse the link list */ |
| @@ -430,29 +429,29 @@ static int iwl_find_otp_image(struct iwl_priv *priv, | |||
| 430 | * check for more block on the link list | 429 | * check for more block on the link list |
| 431 | */ | 430 | */ |
| 432 | valid_addr = next_link_addr; | 431 | valid_addr = next_link_addr; |
| 433 | next_link_addr = link_value; | 432 | next_link_addr = link_value * sizeof(u16); |
| 434 | IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", | 433 | IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n", |
| 435 | usedblocks, next_link_addr); | 434 | usedblocks, next_link_addr); |
| 436 | if (iwl_read_otp_word(priv, next_link_addr, &link_value)) | 435 | if (iwl_read_otp_word(priv, next_link_addr, &link_value)) |
| 437 | return -EINVAL; | 436 | return -EINVAL; |
| 438 | if (!link_value) { | 437 | if (!link_value) { |
| 439 | /* | 438 | /* |
| 440 | * reach the end of link list, | 439 | * reach the end of link list, return success and |
| 441 | * set address point to the starting address | 440 | * set address point to the starting address |
| 442 | * of the image | 441 | * of the image |
| 443 | */ | 442 | */ |
| 444 | goto done; | 443 | *validblockaddr = valid_addr; |
| 444 | /* skip first 2 bytes (link list pointer) */ | ||
| 445 | *validblockaddr += 2; | ||
| 446 | return 0; | ||
| 445 | } | 447 | } |
| 446 | /* more in the link list, continue */ | 448 | /* more in the link list, continue */ |
| 447 | usedblocks++; | 449 | usedblocks++; |
| 448 | } while (usedblocks < priv->cfg->max_ll_items); | 450 | } while (usedblocks <= priv->cfg->max_ll_items); |
| 449 | /* OTP full, use last block */ | 451 | |
| 450 | IWL_DEBUG_INFO(priv, "OTP is full, use last block\n"); | 452 | /* OTP has no valid blocks */ |
| 451 | done: | 453 | IWL_DEBUG_INFO(priv, "OTP has no valid blocks\n"); |
| 452 | *validblockaddr = valid_addr; | 454 | return -EINVAL; |
| 453 | /* skip first 2 bytes (link list pointer) */ | ||
| 454 | *validblockaddr += 2; | ||
| 455 | return ret; | ||
| 456 | } | 455 | } |
| 457 | 456 | ||
| 458 | /** | 457 | /** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index 6b68db7b1b81..80b9e45d9b9c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
| @@ -220,35 +220,35 @@ struct iwl_eeprom_enhanced_txpwr { | |||
| 220 | * Section 10: 2.4 GHz 40MHz channels: 132, 44 (_above_) | 220 | * Section 10: 2.4 GHz 40MHz channels: 132, 44 (_above_) |
| 221 | */ | 221 | */ |
| 222 | /* 2.4 GHz band: CCK */ | 222 | /* 2.4 GHz band: CCK */ |
| 223 | #define EEPROM_LB_CCK_20_COMMON ((0xAA)\ | 223 | #define EEPROM_LB_CCK_20_COMMON ((0xA8)\ |
| 224 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 8 bytes */ | 224 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 8 bytes */ |
| 225 | /* 2.4 GHz band: 20MHz-Legacy, 20MHz-HT, 40MHz-HT */ | 225 | /* 2.4 GHz band: 20MHz-Legacy, 20MHz-HT, 40MHz-HT */ |
| 226 | #define EEPROM_LB_OFDM_COMMON ((0xB2)\ | 226 | #define EEPROM_LB_OFDM_COMMON ((0xB0)\ |
| 227 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */ | 227 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */ |
| 228 | /* 5.2 GHz band: 20MHz-Legacy, 20MHz-HT, 40MHz-HT */ | 228 | /* 5.2 GHz band: 20MHz-Legacy, 20MHz-HT, 40MHz-HT */ |
| 229 | #define EEPROM_HB_OFDM_COMMON ((0xCA)\ | 229 | #define EEPROM_HB_OFDM_COMMON ((0xC8)\ |
| 230 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */ | 230 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */ |
| 231 | /* 2.4GHz band channels: | 231 | /* 2.4GHz band channels: |
| 232 | * 1Legacy, 1HT, 2Legacy, 2HT, 10Legacy, 10HT, 11Legacy, 11HT */ | 232 | * 1Legacy, 1HT, 2Legacy, 2HT, 10Legacy, 10HT, 11Legacy, 11HT */ |
| 233 | #define EEPROM_LB_OFDM_20_BAND ((0xE2)\ | 233 | #define EEPROM_LB_OFDM_20_BAND ((0xE0)\ |
| 234 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 64 bytes */ | 234 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 64 bytes */ |
| 235 | /* 2.4 GHz band HT40 channels: (1,+1) (2,+1) (6,+1) (7,+1) (9,+1) */ | 235 | /* 2.4 GHz band HT40 channels: (1,+1) (2,+1) (6,+1) (7,+1) (9,+1) */ |
| 236 | #define EEPROM_LB_OFDM_HT40_BAND ((0x122)\ | 236 | #define EEPROM_LB_OFDM_HT40_BAND ((0x120)\ |
| 237 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 40 bytes */ | 237 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 40 bytes */ |
| 238 | /* 5.2GHz band channels: 36Legacy, 36HT, 64Legacy, 64HT, 100Legacy, 100HT */ | 238 | /* 5.2GHz band channels: 36Legacy, 36HT, 64Legacy, 64HT, 100Legacy, 100HT */ |
| 239 | #define EEPROM_HB_OFDM_20_BAND ((0x14A)\ | 239 | #define EEPROM_HB_OFDM_20_BAND ((0x148)\ |
| 240 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 48 bytes */ | 240 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 48 bytes */ |
| 241 | /* 5.2 GHz band HT40 channels: (36,+1) (60,+1) (100,+1) */ | 241 | /* 5.2 GHz band HT40 channels: (36,+1) (60,+1) (100,+1) */ |
| 242 | #define EEPROM_HB_OFDM_HT40_BAND ((0x17A)\ | 242 | #define EEPROM_HB_OFDM_HT40_BAND ((0x178)\ |
| 243 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */ | 243 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 24 bytes */ |
| 244 | /* 2.4 GHz band, channnel 13: Legacy, HT */ | 244 | /* 2.4 GHz band, channnel 13: Legacy, HT */ |
| 245 | #define EEPROM_LB_OFDM_20_CHANNEL_13 ((0x192)\ | 245 | #define EEPROM_LB_OFDM_20_CHANNEL_13 ((0x190)\ |
| 246 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */ | 246 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */ |
| 247 | /* 5.2 GHz band, channnel 140: Legacy, HT */ | 247 | /* 5.2 GHz band, channnel 140: Legacy, HT */ |
| 248 | #define EEPROM_HB_OFDM_20_CHANNEL_140 ((0x1A2)\ | 248 | #define EEPROM_HB_OFDM_20_CHANNEL_140 ((0x1A0)\ |
| 249 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */ | 249 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */ |
| 250 | /* 5.2 GHz band, HT40 channnels (132,+1) (44,+1) */ | 250 | /* 5.2 GHz band, HT40 channnels (132,+1) (44,+1) */ |
| 251 | #define EEPROM_HB_OFDM_HT40_BAND_1 ((0x1B2)\ | 251 | #define EEPROM_HB_OFDM_HT40_BAND_1 ((0x1B0)\ |
| 252 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */ | 252 | | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 16 bytes */ |
| 253 | 253 | ||
| 254 | 254 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 8e1bb53c0aa3..493626bcd3ec 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
| @@ -1044,7 +1044,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
| 1044 | * as a bitmask. | 1044 | * as a bitmask. |
| 1045 | */ | 1045 | */ |
| 1046 | rx_status.antenna = | 1046 | rx_status.antenna = |
| 1047 | le16_to_cpu(phy_res->phy_flags & RX_RES_PHY_FLAGS_ANTENNA_MSK) | 1047 | (le16_to_cpu(phy_res->phy_flags) & RX_RES_PHY_FLAGS_ANTENNA_MSK) |
| 1048 | >> RX_RES_PHY_FLAGS_ANTENNA_POS; | 1048 | >> RX_RES_PHY_FLAGS_ANTENNA_POS; |
| 1049 | 1049 | ||
| 1050 | /* set the preamble flag if appropriate */ | 1050 | /* set the preamble flag if appropriate */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index aa49230422f3..d00a80334095 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
| @@ -4097,8 +4097,8 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
| 4097 | pci_set_drvdata(pdev, NULL); | 4097 | pci_set_drvdata(pdev, NULL); |
| 4098 | pci_disable_device(pdev); | 4098 | pci_disable_device(pdev); |
| 4099 | out_ieee80211_free_hw: | 4099 | out_ieee80211_free_hw: |
| 4100 | ieee80211_free_hw(priv->hw); | ||
| 4101 | iwl_free_traffic_mem(priv); | 4100 | iwl_free_traffic_mem(priv); |
| 4101 | ieee80211_free_hw(priv->hw); | ||
| 4102 | out: | 4102 | out: |
| 4103 | return err; | 4103 | return err; |
| 4104 | } | 4104 | } |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index c42d3faa2660..23f684337fdd 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | * responses as well as events generated by firmware. | 3 | * responses as well as events generated by firmware. |
| 4 | */ | 4 | */ |
| 5 | #include <linux/delay.h> | 5 | #include <linux/delay.h> |
| 6 | #include <linux/sched.h> | ||
| 6 | #include <linux/if_arp.h> | 7 | #include <linux/if_arp.h> |
| 7 | #include <linux/netdevice.h> | 8 | #include <linux/netdevice.h> |
| 8 | #include <asm/unaligned.h> | 9 | #include <asm/unaligned.h> |
diff --git a/drivers/net/znet.c b/drivers/net/znet.c index a0384b6f09b6..b42347333750 100644 --- a/drivers/net/znet.c +++ b/drivers/net/znet.c | |||
| @@ -169,7 +169,6 @@ static void znet_tx_timeout (struct net_device *dev); | |||
| 169 | static int znet_request_resources (struct net_device *dev) | 169 | static int znet_request_resources (struct net_device *dev) |
| 170 | { | 170 | { |
| 171 | struct znet_private *znet = netdev_priv(dev); | 171 | struct znet_private *znet = netdev_priv(dev); |
| 172 | unsigned long flags; | ||
| 173 | 172 | ||
| 174 | if (request_irq (dev->irq, &znet_interrupt, 0, "ZNet", dev)) | 173 | if (request_irq (dev->irq, &znet_interrupt, 0, "ZNet", dev)) |
| 175 | goto failed; | 174 | goto failed; |
| @@ -187,13 +186,9 @@ static int znet_request_resources (struct net_device *dev) | |||
| 187 | free_sia: | 186 | free_sia: |
| 188 | release_region (znet->sia_base, znet->sia_size); | 187 | release_region (znet->sia_base, znet->sia_size); |
| 189 | free_tx_dma: | 188 | free_tx_dma: |
| 190 | flags = claim_dma_lock(); | ||
| 191 | free_dma (znet->tx_dma); | 189 | free_dma (znet->tx_dma); |
| 192 | release_dma_lock (flags); | ||
| 193 | free_rx_dma: | 190 | free_rx_dma: |
| 194 | flags = claim_dma_lock(); | ||
| 195 | free_dma (znet->rx_dma); | 191 | free_dma (znet->rx_dma); |
| 196 | release_dma_lock (flags); | ||
| 197 | free_irq: | 192 | free_irq: |
| 198 | free_irq (dev->irq, dev); | 193 | free_irq (dev->irq, dev); |
| 199 | failed: | 194 | failed: |
| @@ -203,14 +198,11 @@ static int znet_request_resources (struct net_device *dev) | |||
| 203 | static void znet_release_resources (struct net_device *dev) | 198 | static void znet_release_resources (struct net_device *dev) |
| 204 | { | 199 | { |
| 205 | struct znet_private *znet = netdev_priv(dev); | 200 | struct znet_private *znet = netdev_priv(dev); |
| 206 | unsigned long flags; | ||
| 207 | 201 | ||
| 208 | release_region (znet->sia_base, znet->sia_size); | 202 | release_region (znet->sia_base, znet->sia_size); |
| 209 | release_region (dev->base_addr, znet->io_size); | 203 | release_region (dev->base_addr, znet->io_size); |
| 210 | flags = claim_dma_lock(); | ||
| 211 | free_dma (znet->tx_dma); | 204 | free_dma (znet->tx_dma); |
| 212 | free_dma (znet->rx_dma); | 205 | free_dma (znet->rx_dma); |
| 213 | release_dma_lock (flags); | ||
| 214 | free_irq (dev->irq, dev); | 206 | free_irq (dev->irq, dev); |
| 215 | } | 207 | } |
| 216 | 208 | ||
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index 2b7ae366ceb1..5df60a6b6776 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c | |||
| @@ -35,12 +35,23 @@ static size_t buffer_pos; | |||
| 35 | /* atomic_t because wait_event checks it outside of buffer_mutex */ | 35 | /* atomic_t because wait_event checks it outside of buffer_mutex */ |
| 36 | static atomic_t buffer_ready = ATOMIC_INIT(0); | 36 | static atomic_t buffer_ready = ATOMIC_INIT(0); |
| 37 | 37 | ||
| 38 | /* Add an entry to the event buffer. When we | 38 | /* |
| 39 | * get near to the end we wake up the process | 39 | * Add an entry to the event buffer. When we get near to the end we |
| 40 | * sleeping on the read() of the file. | 40 | * wake up the process sleeping on the read() of the file. To protect |
| 41 | * the event_buffer this function may only be called when buffer_mutex | ||
| 42 | * is set. | ||
| 41 | */ | 43 | */ |
| 42 | void add_event_entry(unsigned long value) | 44 | void add_event_entry(unsigned long value) |
| 43 | { | 45 | { |
| 46 | /* | ||
| 47 | * This shouldn't happen since all workqueues or handlers are | ||
| 48 | * canceled or flushed before the event buffer is freed. | ||
| 49 | */ | ||
| 50 | if (!event_buffer) { | ||
| 51 | WARN_ON_ONCE(1); | ||
| 52 | return; | ||
| 53 | } | ||
| 54 | |||
| 44 | if (buffer_pos == buffer_size) { | 55 | if (buffer_pos == buffer_size) { |
| 45 | atomic_inc(&oprofile_stats.event_lost_overflow); | 56 | atomic_inc(&oprofile_stats.event_lost_overflow); |
| 46 | return; | 57 | return; |
| @@ -69,7 +80,6 @@ void wake_up_buffer_waiter(void) | |||
| 69 | 80 | ||
| 70 | int alloc_event_buffer(void) | 81 | int alloc_event_buffer(void) |
| 71 | { | 82 | { |
| 72 | int err = -ENOMEM; | ||
| 73 | unsigned long flags; | 83 | unsigned long flags; |
| 74 | 84 | ||
| 75 | spin_lock_irqsave(&oprofilefs_lock, flags); | 85 | spin_lock_irqsave(&oprofilefs_lock, flags); |
| @@ -80,21 +90,22 @@ int alloc_event_buffer(void) | |||
| 80 | if (buffer_watershed >= buffer_size) | 90 | if (buffer_watershed >= buffer_size) |
| 81 | return -EINVAL; | 91 | return -EINVAL; |
| 82 | 92 | ||
| 93 | buffer_pos = 0; | ||
| 83 | event_buffer = vmalloc(sizeof(unsigned long) * buffer_size); | 94 | event_buffer = vmalloc(sizeof(unsigned long) * buffer_size); |
| 84 | if (!event_buffer) | 95 | if (!event_buffer) |
| 85 | goto out; | 96 | return -ENOMEM; |
| 86 | 97 | ||
| 87 | err = 0; | 98 | return 0; |
| 88 | out: | ||
| 89 | return err; | ||
| 90 | } | 99 | } |
| 91 | 100 | ||
| 92 | 101 | ||
| 93 | void free_event_buffer(void) | 102 | void free_event_buffer(void) |
| 94 | { | 103 | { |
| 104 | mutex_lock(&buffer_mutex); | ||
| 95 | vfree(event_buffer); | 105 | vfree(event_buffer); |
| 96 | 106 | buffer_pos = 0; | |
| 97 | event_buffer = NULL; | 107 | event_buffer = NULL; |
| 108 | mutex_unlock(&buffer_mutex); | ||
| 98 | } | 109 | } |
| 99 | 110 | ||
| 100 | 111 | ||
| @@ -167,6 +178,12 @@ static ssize_t event_buffer_read(struct file *file, char __user *buf, | |||
| 167 | 178 | ||
| 168 | mutex_lock(&buffer_mutex); | 179 | mutex_lock(&buffer_mutex); |
| 169 | 180 | ||
| 181 | /* May happen if the buffer is freed during pending reads. */ | ||
| 182 | if (!event_buffer) { | ||
| 183 | retval = -EINTR; | ||
| 184 | goto out; | ||
| 185 | } | ||
| 186 | |||
| 170 | atomic_set(&buffer_ready, 0); | 187 | atomic_set(&buffer_ready, 0); |
| 171 | 188 | ||
| 172 | retval = -EFAULT; | 189 | retval = -EFAULT; |
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c index 14bbaa17e2ca..22b02c6df854 100644 --- a/drivers/pci/dmar.c +++ b/drivers/pci/dmar.c | |||
| @@ -354,6 +354,7 @@ dmar_table_print_dmar_entry(struct acpi_dmar_header *header) | |||
| 354 | struct acpi_dmar_hardware_unit *drhd; | 354 | struct acpi_dmar_hardware_unit *drhd; |
| 355 | struct acpi_dmar_reserved_memory *rmrr; | 355 | struct acpi_dmar_reserved_memory *rmrr; |
| 356 | struct acpi_dmar_atsr *atsr; | 356 | struct acpi_dmar_atsr *atsr; |
| 357 | struct acpi_dmar_rhsa *rhsa; | ||
| 357 | 358 | ||
| 358 | switch (header->type) { | 359 | switch (header->type) { |
| 359 | case ACPI_DMAR_TYPE_HARDWARE_UNIT: | 360 | case ACPI_DMAR_TYPE_HARDWARE_UNIT: |
| @@ -375,6 +376,12 @@ dmar_table_print_dmar_entry(struct acpi_dmar_header *header) | |||
| 375 | atsr = container_of(header, struct acpi_dmar_atsr, header); | 376 | atsr = container_of(header, struct acpi_dmar_atsr, header); |
| 376 | printk(KERN_INFO PREFIX "ATSR flags: %#x\n", atsr->flags); | 377 | printk(KERN_INFO PREFIX "ATSR flags: %#x\n", atsr->flags); |
| 377 | break; | 378 | break; |
| 379 | case ACPI_DMAR_HARDWARE_AFFINITY: | ||
| 380 | rhsa = container_of(header, struct acpi_dmar_rhsa, header); | ||
| 381 | printk(KERN_INFO PREFIX "RHSA base: %#016Lx proximity domain: %#x\n", | ||
| 382 | (unsigned long long)rhsa->base_address, | ||
| 383 | rhsa->proximity_domain); | ||
| 384 | break; | ||
| 378 | } | 385 | } |
| 379 | } | 386 | } |
| 380 | 387 | ||
| @@ -459,9 +466,13 @@ parse_dmar_table(void) | |||
| 459 | ret = dmar_parse_one_atsr(entry_header); | 466 | ret = dmar_parse_one_atsr(entry_header); |
| 460 | #endif | 467 | #endif |
| 461 | break; | 468 | break; |
| 469 | case ACPI_DMAR_HARDWARE_AFFINITY: | ||
| 470 | /* We don't do anything with RHSA (yet?) */ | ||
| 471 | break; | ||
| 462 | default: | 472 | default: |
| 463 | printk(KERN_WARNING PREFIX | 473 | printk(KERN_WARNING PREFIX |
| 464 | "Unknown DMAR structure type\n"); | 474 | "Unknown DMAR structure type %d\n", |
| 475 | entry_header->type); | ||
| 465 | ret = 0; /* for forward compatibility */ | 476 | ret = 0; /* for forward compatibility */ |
| 466 | break; | 477 | break; |
| 467 | } | 478 | } |
diff --git a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h index 53836001d511..9c6a9fd26812 100644 --- a/drivers/pci/hotplug/cpqphp.h +++ b/drivers/pci/hotplug/cpqphp.h | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <asm/io.h> /* for read? and write? functions */ | 32 | #include <asm/io.h> /* for read? and write? functions */ |
| 33 | #include <linux/delay.h> /* for delays */ | 33 | #include <linux/delay.h> /* for delays */ |
| 34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
| 35 | #include <linux/sched.h> /* for signal_pending() */ | ||
| 35 | 36 | ||
| 36 | #define MY_NAME "cpqphp" | 37 | #define MY_NAME "cpqphp" |
| 37 | 38 | ||
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 855dd7ca47f3..b1e97e682500 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
| @@ -48,6 +48,7 @@ | |||
| 48 | 48 | ||
| 49 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) | 49 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) |
| 50 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) | 50 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) |
| 51 | #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) | ||
| 51 | 52 | ||
| 52 | #define IOAPIC_RANGE_START (0xfee00000) | 53 | #define IOAPIC_RANGE_START (0xfee00000) |
| 53 | #define IOAPIC_RANGE_END (0xfeefffff) | 54 | #define IOAPIC_RANGE_END (0xfeefffff) |
| @@ -94,6 +95,7 @@ static inline unsigned long virt_to_dma_pfn(void *p) | |||
| 94 | /* global iommu list, set NULL for ignored DMAR units */ | 95 | /* global iommu list, set NULL for ignored DMAR units */ |
| 95 | static struct intel_iommu **g_iommus; | 96 | static struct intel_iommu **g_iommus; |
| 96 | 97 | ||
| 98 | static void __init check_tylersburg_isoch(void); | ||
| 97 | static int rwbf_quirk; | 99 | static int rwbf_quirk; |
| 98 | 100 | ||
| 99 | /* | 101 | /* |
| @@ -1934,6 +1936,9 @@ error: | |||
| 1934 | } | 1936 | } |
| 1935 | 1937 | ||
| 1936 | static int iommu_identity_mapping; | 1938 | static int iommu_identity_mapping; |
| 1939 | #define IDENTMAP_ALL 1 | ||
| 1940 | #define IDENTMAP_GFX 2 | ||
| 1941 | #define IDENTMAP_AZALIA 4 | ||
| 1937 | 1942 | ||
| 1938 | static int iommu_domain_identity_map(struct dmar_domain *domain, | 1943 | static int iommu_domain_identity_map(struct dmar_domain *domain, |
| 1939 | unsigned long long start, | 1944 | unsigned long long start, |
| @@ -2151,8 +2156,14 @@ static int domain_add_dev_info(struct dmar_domain *domain, | |||
| 2151 | 2156 | ||
| 2152 | static int iommu_should_identity_map(struct pci_dev *pdev, int startup) | 2157 | static int iommu_should_identity_map(struct pci_dev *pdev, int startup) |
| 2153 | { | 2158 | { |
| 2154 | if (iommu_identity_mapping == 2) | 2159 | if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev)) |
| 2155 | return IS_GFX_DEVICE(pdev); | 2160 | return 1; |
| 2161 | |||
| 2162 | if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev)) | ||
| 2163 | return 1; | ||
| 2164 | |||
| 2165 | if (!(iommu_identity_mapping & IDENTMAP_ALL)) | ||
| 2166 | return 0; | ||
| 2156 | 2167 | ||
| 2157 | /* | 2168 | /* |
| 2158 | * We want to start off with all devices in the 1:1 domain, and | 2169 | * We want to start off with all devices in the 1:1 domain, and |
| @@ -2332,11 +2343,14 @@ int __init init_dmars(void) | |||
| 2332 | } | 2343 | } |
| 2333 | 2344 | ||
| 2334 | if (iommu_pass_through) | 2345 | if (iommu_pass_through) |
| 2335 | iommu_identity_mapping = 1; | 2346 | iommu_identity_mapping |= IDENTMAP_ALL; |
| 2347 | |||
| 2336 | #ifdef CONFIG_DMAR_BROKEN_GFX_WA | 2348 | #ifdef CONFIG_DMAR_BROKEN_GFX_WA |
| 2337 | else | 2349 | iommu_identity_mapping |= IDENTMAP_GFX; |
| 2338 | iommu_identity_mapping = 2; | ||
| 2339 | #endif | 2350 | #endif |
| 2351 | |||
| 2352 | check_tylersburg_isoch(); | ||
| 2353 | |||
| 2340 | /* | 2354 | /* |
| 2341 | * If pass through is not set or not enabled, setup context entries for | 2355 | * If pass through is not set or not enabled, setup context entries for |
| 2342 | * identity mappings for rmrr, gfx, and isa and may fall back to static | 2356 | * identity mappings for rmrr, gfx, and isa and may fall back to static |
| @@ -3670,3 +3684,61 @@ static void __devinit quirk_iommu_rwbf(struct pci_dev *dev) | |||
| 3670 | } | 3684 | } |
| 3671 | 3685 | ||
| 3672 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); | 3686 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); |
| 3687 | |||
| 3688 | /* On Tylersburg chipsets, some BIOSes have been known to enable the | ||
| 3689 | ISOCH DMAR unit for the Azalia sound device, but not give it any | ||
| 3690 | TLB entries, which causes it to deadlock. Check for that. We do | ||
| 3691 | this in a function called from init_dmars(), instead of in a PCI | ||
| 3692 | quirk, because we don't want to print the obnoxious "BIOS broken" | ||
| 3693 | message if VT-d is actually disabled. | ||
| 3694 | */ | ||
| 3695 | static void __init check_tylersburg_isoch(void) | ||
| 3696 | { | ||
| 3697 | struct pci_dev *pdev; | ||
| 3698 | uint32_t vtisochctrl; | ||
| 3699 | |||
| 3700 | /* If there's no Azalia in the system anyway, forget it. */ | ||
| 3701 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x3a3e, NULL); | ||
| 3702 | if (!pdev) | ||
| 3703 | return; | ||
| 3704 | pci_dev_put(pdev); | ||
| 3705 | |||
| 3706 | /* System Management Registers. Might be hidden, in which case | ||
| 3707 | we can't do the sanity check. But that's OK, because the | ||
| 3708 | known-broken BIOSes _don't_ actually hide it, so far. */ | ||
| 3709 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x342e, NULL); | ||
| 3710 | if (!pdev) | ||
| 3711 | return; | ||
| 3712 | |||
| 3713 | if (pci_read_config_dword(pdev, 0x188, &vtisochctrl)) { | ||
| 3714 | pci_dev_put(pdev); | ||
| 3715 | return; | ||
| 3716 | } | ||
| 3717 | |||
| 3718 | pci_dev_put(pdev); | ||
| 3719 | |||
| 3720 | /* If Azalia DMA is routed to the non-isoch DMAR unit, fine. */ | ||
| 3721 | if (vtisochctrl & 1) | ||
| 3722 | return; | ||
| 3723 | |||
| 3724 | /* Drop all bits other than the number of TLB entries */ | ||
| 3725 | vtisochctrl &= 0x1c; | ||
| 3726 | |||
| 3727 | /* If we have the recommended number of TLB entries (16), fine. */ | ||
| 3728 | if (vtisochctrl == 0x10) | ||
| 3729 | return; | ||
| 3730 | |||
| 3731 | /* Zero TLB entries? You get to ride the short bus to school. */ | ||
| 3732 | if (!vtisochctrl) { | ||
| 3733 | WARN(1, "Your BIOS is broken; DMA routed to ISOCH DMAR unit but no TLB space.\n" | ||
| 3734 | "BIOS vendor: %s; Ver: %s; Product Version: %s\n", | ||
| 3735 | dmi_get_system_info(DMI_BIOS_VENDOR), | ||
| 3736 | dmi_get_system_info(DMI_BIOS_VERSION), | ||
| 3737 | dmi_get_system_info(DMI_PRODUCT_VERSION)); | ||
| 3738 | iommu_identity_mapping |= IDENTMAP_AZALIA; | ||
| 3739 | return; | ||
| 3740 | } | ||
| 3741 | |||
| 3742 | printk(KERN_WARNING "DMAR: Recommended TLB entries for ISOCH unit is 16; your BIOS set %d\n", | ||
| 3743 | vtisochctrl); | ||
| 3744 | } | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6edecff0b419..4e4c295a049f 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -513,7 +513,11 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
| 513 | else if (state == PCI_D2 || dev->current_state == PCI_D2) | 513 | else if (state == PCI_D2 || dev->current_state == PCI_D2) |
| 514 | udelay(PCI_PM_D2_DELAY); | 514 | udelay(PCI_PM_D2_DELAY); |
| 515 | 515 | ||
| 516 | dev->current_state = state; | 516 | pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); |
| 517 | dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); | ||
| 518 | if (dev->current_state != state && printk_ratelimit()) | ||
| 519 | dev_info(&dev->dev, "Refused to change power state, " | ||
| 520 | "currently in D%d\n", dev->current_state); | ||
| 517 | 521 | ||
| 518 | /* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT | 522 | /* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT |
| 519 | * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning | 523 | * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning |
| @@ -2542,10 +2546,10 @@ int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type) | |||
| 2542 | 2546 | ||
| 2543 | /** | 2547 | /** |
| 2544 | * pci_set_vga_state - set VGA decode state on device and parents if requested | 2548 | * pci_set_vga_state - set VGA decode state on device and parents if requested |
| 2545 | * @dev the PCI device | 2549 | * @dev: the PCI device |
| 2546 | * @decode - true = enable decoding, false = disable decoding | 2550 | * @decode: true = enable decoding, false = disable decoding |
| 2547 | * @command_bits PCI_COMMAND_IO and/or PCI_COMMAND_MEMORY | 2551 | * @command_bits: PCI_COMMAND_IO and/or PCI_COMMAND_MEMORY |
| 2548 | * @change_bridge - traverse ancestors and change bridges | 2552 | * @change_bridge: traverse ancestors and change bridges |
| 2549 | */ | 2553 | */ |
| 2550 | int pci_set_vga_state(struct pci_dev *dev, bool decode, | 2554 | int pci_set_vga_state(struct pci_dev *dev, bool decode, |
| 2551 | unsigned int command_bits, bool change_bridge) | 2555 | unsigned int command_bits, bool change_bridge) |
| @@ -2719,17 +2723,6 @@ int __attribute__ ((weak)) pci_ext_cfg_avail(struct pci_dev *dev) | |||
| 2719 | return 1; | 2723 | return 1; |
| 2720 | } | 2724 | } |
| 2721 | 2725 | ||
| 2722 | static int __devinit pci_init(void) | ||
| 2723 | { | ||
| 2724 | struct pci_dev *dev = NULL; | ||
| 2725 | |||
| 2726 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | ||
| 2727 | pci_fixup_device(pci_fixup_final, dev); | ||
| 2728 | } | ||
| 2729 | |||
| 2730 | return 0; | ||
| 2731 | } | ||
| 2732 | |||
| 2733 | static int __init pci_setup(char *str) | 2726 | static int __init pci_setup(char *str) |
| 2734 | { | 2727 | { |
| 2735 | while (str) { | 2728 | while (str) { |
| @@ -2767,8 +2760,6 @@ static int __init pci_setup(char *str) | |||
| 2767 | } | 2760 | } |
| 2768 | early_param("pci", pci_setup); | 2761 | early_param("pci", pci_setup); |
| 2769 | 2762 | ||
| 2770 | device_initcall(pci_init); | ||
| 2771 | |||
| 2772 | EXPORT_SYMBOL(pci_reenable_device); | 2763 | EXPORT_SYMBOL(pci_reenable_device); |
| 2773 | EXPORT_SYMBOL(pci_enable_device_io); | 2764 | EXPORT_SYMBOL(pci_enable_device_io); |
| 2774 | EXPORT_SYMBOL(pci_enable_device_mem); | 2765 | EXPORT_SYMBOL(pci_enable_device_mem); |
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index d49ecc94bd49..40c3cc5d1caf 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
| @@ -53,7 +53,7 @@ static struct pci_error_handlers aer_error_handlers = { | |||
| 53 | 53 | ||
| 54 | static struct pcie_port_service_driver aerdriver = { | 54 | static struct pcie_port_service_driver aerdriver = { |
| 55 | .name = "aer", | 55 | .name = "aer", |
| 56 | .port_type = PCIE_ANY_PORT, | 56 | .port_type = PCIE_RC_PORT, |
| 57 | .service = PCIE_PORT_SERVICE_AER, | 57 | .service = PCIE_PORT_SERVICE_AER, |
| 58 | 58 | ||
| 59 | .probe = aer_probe, | 59 | .probe = aer_probe, |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 6df5c984a791..f635e476d632 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
| @@ -30,7 +30,6 @@ MODULE_DESCRIPTION(DRIVER_DESC); | |||
| 30 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
| 31 | 31 | ||
| 32 | /* global data */ | 32 | /* global data */ |
| 33 | static const char device_name[] = "pcieport-driver"; | ||
| 34 | 33 | ||
| 35 | static int pcie_portdrv_restore_config(struct pci_dev *dev) | 34 | static int pcie_portdrv_restore_config(struct pci_dev *dev) |
| 36 | { | 35 | { |
| @@ -262,7 +261,7 @@ static struct pci_error_handlers pcie_portdrv_err_handler = { | |||
| 262 | }; | 261 | }; |
| 263 | 262 | ||
| 264 | static struct pci_driver pcie_portdriver = { | 263 | static struct pci_driver pcie_portdriver = { |
| 265 | .name = (char *)device_name, | 264 | .name = "pcieport", |
| 266 | .id_table = &port_pci_ids[0], | 265 | .id_table = &port_pci_ids[0], |
| 267 | 266 | ||
| 268 | .probe = pcie_portdrv_probe, | 267 | .probe = pcie_portdrv_probe, |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 6099facecd79..245d2cdb4765 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -670,6 +670,25 @@ static void __devinit quirk_vt8235_acpi(struct pci_dev *dev) | |||
| 670 | } | 670 | } |
| 671 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); | 671 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); |
| 672 | 672 | ||
| 673 | /* | ||
| 674 | * TI XIO2000a PCIe-PCI Bridge erroneously reports it supports fast back-to-back: | ||
| 675 | * Disable fast back-to-back on the secondary bus segment | ||
| 676 | */ | ||
| 677 | static void __devinit quirk_xio2000a(struct pci_dev *dev) | ||
| 678 | { | ||
| 679 | struct pci_dev *pdev; | ||
| 680 | u16 command; | ||
| 681 | |||
| 682 | dev_warn(&dev->dev, "TI XIO2000a quirk detected; " | ||
| 683 | "secondary bus fast back-to-back transfers disabled\n"); | ||
| 684 | list_for_each_entry(pdev, &dev->subordinate->devices, bus_list) { | ||
| 685 | pci_read_config_word(pdev, PCI_COMMAND, &command); | ||
| 686 | if (command & PCI_COMMAND_FAST_BACK) | ||
| 687 | pci_write_config_word(pdev, PCI_COMMAND, command & ~PCI_COMMAND_FAST_BACK); | ||
| 688 | } | ||
| 689 | } | ||
| 690 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_XIO2000A, | ||
| 691 | quirk_xio2000a); | ||
| 673 | 692 | ||
| 674 | #ifdef CONFIG_X86_IO_APIC | 693 | #ifdef CONFIG_X86_IO_APIC |
| 675 | 694 | ||
| @@ -990,7 +1009,7 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, | |||
| 990 | 1009 | ||
| 991 | static void __devinit quirk_amd_ide_mode(struct pci_dev *pdev) | 1010 | static void __devinit quirk_amd_ide_mode(struct pci_dev *pdev) |
| 992 | { | 1011 | { |
| 993 | /* set SBX00 SATA in IDE mode to AHCI mode */ | 1012 | /* set SBX00/Hudson-2 SATA in IDE mode to AHCI mode */ |
| 994 | u8 tmp; | 1013 | u8 tmp; |
| 995 | 1014 | ||
| 996 | pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp); | 1015 | pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp); |
| @@ -1009,8 +1028,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk | |||
| 1009 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode); | 1028 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode); |
| 1010 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); | 1029 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); |
| 1011 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); | 1030 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); |
| 1012 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_SB900_SATA_IDE, quirk_amd_ide_mode); | 1031 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode); |
| 1013 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_SB900_SATA_IDE, quirk_amd_ide_mode); | 1032 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode); |
| 1014 | 1033 | ||
| 1015 | /* | 1034 | /* |
| 1016 | * Serverworks CSB5 IDE does not fully support native mode | 1035 | * Serverworks CSB5 IDE does not fully support native mode |
| @@ -2572,6 +2591,19 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) | |||
| 2572 | } | 2591 | } |
| 2573 | pci_do_fixups(dev, start, end); | 2592 | pci_do_fixups(dev, start, end); |
| 2574 | } | 2593 | } |
| 2594 | |||
| 2595 | static int __init pci_apply_final_quirks(void) | ||
| 2596 | { | ||
| 2597 | struct pci_dev *dev = NULL; | ||
| 2598 | |||
| 2599 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | ||
| 2600 | pci_fixup_device(pci_fixup_final, dev); | ||
| 2601 | } | ||
| 2602 | |||
| 2603 | return 0; | ||
| 2604 | } | ||
| 2605 | |||
| 2606 | fs_initcall_sync(pci_apply_final_quirks); | ||
| 2575 | #else | 2607 | #else |
| 2576 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {} | 2608 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {} |
| 2577 | #endif | 2609 | #endif |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index cb1a027eb552..0959430534b2 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
| @@ -299,8 +299,17 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus, unsigned lon | |||
| 299 | r = bus->resource[i]; | 299 | r = bus->resource[i]; |
| 300 | if (r == &ioport_resource || r == &iomem_resource) | 300 | if (r == &ioport_resource || r == &iomem_resource) |
| 301 | continue; | 301 | continue; |
| 302 | if (r && (r->flags & type_mask) == type && !r->parent) | 302 | if (r && (r->flags & type_mask) == type) { |
| 303 | return r; | 303 | if (!r->parent) |
| 304 | return r; | ||
| 305 | /* | ||
| 306 | * if there is no child under that, we should release | ||
| 307 | * and use it. don't need to reset it, pbus_size_* will | ||
| 308 | * set it again | ||
| 309 | */ | ||
| 310 | if (!r->child && !release_resource(r)) | ||
| 311 | return r; | ||
| 312 | } | ||
| 304 | } | 313 | } |
| 305 | return NULL; | 314 | return NULL; |
| 306 | } | 315 | } |
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 706f82d8111f..c54526b206b5 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
| @@ -205,43 +205,6 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
| 205 | return ret; | 205 | return ret; |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | #if 0 | ||
| 209 | int pci_assign_resource_fixed(struct pci_dev *dev, int resno) | ||
| 210 | { | ||
| 211 | struct pci_bus *bus = dev->bus; | ||
| 212 | struct resource *res = dev->resource + resno; | ||
| 213 | unsigned int type_mask; | ||
| 214 | int i, ret = -EBUSY; | ||
| 215 | |||
| 216 | type_mask = IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH; | ||
| 217 | |||
| 218 | for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { | ||
| 219 | struct resource *r = bus->resource[i]; | ||
| 220 | if (!r) | ||
| 221 | continue; | ||
| 222 | |||
| 223 | /* type_mask must match */ | ||
| 224 | if ((res->flags ^ r->flags) & type_mask) | ||
| 225 | continue; | ||
| 226 | |||
| 227 | ret = request_resource(r, res); | ||
| 228 | |||
| 229 | if (ret == 0) | ||
| 230 | break; | ||
| 231 | } | ||
| 232 | |||
| 233 | if (ret) { | ||
| 234 | dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n", | ||
| 235 | resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res); | ||
| 236 | } else if (resno < PCI_BRIDGE_RESOURCES) { | ||
| 237 | pci_update_resource(dev, resno); | ||
| 238 | } | ||
| 239 | |||
| 240 | return ret; | ||
| 241 | } | ||
| 242 | EXPORT_SYMBOL_GPL(pci_assign_resource_fixed); | ||
| 243 | #endif | ||
| 244 | |||
| 245 | /* Sort resources by alignment */ | 208 | /* Sort resources by alignment */ |
| 246 | void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | 209 | void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) |
| 247 | { | 210 | { |
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 749e2102b2be..d379e74a05d0 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
| @@ -150,6 +150,8 @@ struct eeepc_hotk { | |||
| 150 | /* The actual device the driver binds to */ | 150 | /* The actual device the driver binds to */ |
| 151 | static struct eeepc_hotk *ehotk; | 151 | static struct eeepc_hotk *ehotk; |
| 152 | 152 | ||
| 153 | static void eeepc_rfkill_hotplug(bool real); | ||
| 154 | |||
| 153 | /* Platform device/driver */ | 155 | /* Platform device/driver */ |
| 154 | static int eeepc_hotk_thaw(struct device *device); | 156 | static int eeepc_hotk_thaw(struct device *device); |
| 155 | static int eeepc_hotk_restore(struct device *device); | 157 | static int eeepc_hotk_restore(struct device *device); |
| @@ -343,14 +345,23 @@ static bool eeepc_wlan_rfkill_blocked(void) | |||
| 343 | static int eeepc_rfkill_set(void *data, bool blocked) | 345 | static int eeepc_rfkill_set(void *data, bool blocked) |
| 344 | { | 346 | { |
| 345 | unsigned long asl = (unsigned long)data; | 347 | unsigned long asl = (unsigned long)data; |
| 346 | return set_acpi(asl, !blocked); | 348 | int ret; |
| 349 | |||
| 350 | if (asl != CM_ASL_WLAN) | ||
| 351 | return set_acpi(asl, !blocked); | ||
| 352 | |||
| 353 | /* hack to avoid panic with rt2860sta */ | ||
| 354 | if (blocked) | ||
| 355 | eeepc_rfkill_hotplug(false); | ||
| 356 | ret = set_acpi(asl, !blocked); | ||
| 357 | return ret; | ||
| 347 | } | 358 | } |
| 348 | 359 | ||
| 349 | static const struct rfkill_ops eeepc_rfkill_ops = { | 360 | static const struct rfkill_ops eeepc_rfkill_ops = { |
| 350 | .set_block = eeepc_rfkill_set, | 361 | .set_block = eeepc_rfkill_set, |
| 351 | }; | 362 | }; |
| 352 | 363 | ||
| 353 | static void __init eeepc_enable_camera(void) | 364 | static void __devinit eeepc_enable_camera(void) |
| 354 | { | 365 | { |
| 355 | /* | 366 | /* |
| 356 | * If the following call to set_acpi() fails, it's because there's no | 367 | * If the following call to set_acpi() fails, it's because there's no |
| @@ -643,13 +654,13 @@ static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot, | |||
| 643 | return 0; | 654 | return 0; |
| 644 | } | 655 | } |
| 645 | 656 | ||
| 646 | static void eeepc_rfkill_hotplug(void) | 657 | static void eeepc_rfkill_hotplug(bool real) |
| 647 | { | 658 | { |
| 648 | struct pci_dev *dev; | 659 | struct pci_dev *dev; |
| 649 | struct pci_bus *bus; | 660 | struct pci_bus *bus; |
| 650 | bool blocked = eeepc_wlan_rfkill_blocked(); | 661 | bool blocked = real ? eeepc_wlan_rfkill_blocked() : true; |
| 651 | 662 | ||
| 652 | if (ehotk->wlan_rfkill) | 663 | if (real && ehotk->wlan_rfkill) |
| 653 | rfkill_set_sw_state(ehotk->wlan_rfkill, blocked); | 664 | rfkill_set_sw_state(ehotk->wlan_rfkill, blocked); |
| 654 | 665 | ||
| 655 | mutex_lock(&ehotk->hotplug_lock); | 666 | mutex_lock(&ehotk->hotplug_lock); |
| @@ -692,7 +703,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) | |||
| 692 | if (event != ACPI_NOTIFY_BUS_CHECK) | 703 | if (event != ACPI_NOTIFY_BUS_CHECK) |
| 693 | return; | 704 | return; |
| 694 | 705 | ||
| 695 | eeepc_rfkill_hotplug(); | 706 | eeepc_rfkill_hotplug(true); |
| 696 | } | 707 | } |
| 697 | 708 | ||
| 698 | static void eeepc_hotk_notify(struct acpi_device *device, u32 event) | 709 | static void eeepc_hotk_notify(struct acpi_device *device, u32 event) |
| @@ -850,7 +861,7 @@ static int eeepc_hotk_restore(struct device *device) | |||
| 850 | { | 861 | { |
| 851 | /* Refresh both wlan rfkill state and pci hotplug */ | 862 | /* Refresh both wlan rfkill state and pci hotplug */ |
| 852 | if (ehotk->wlan_rfkill) | 863 | if (ehotk->wlan_rfkill) |
| 853 | eeepc_rfkill_hotplug(); | 864 | eeepc_rfkill_hotplug(true); |
| 854 | 865 | ||
| 855 | if (ehotk->bluetooth_rfkill) | 866 | if (ehotk->bluetooth_rfkill) |
| 856 | rfkill_set_sw_state(ehotk->bluetooth_rfkill, | 867 | rfkill_set_sw_state(ehotk->bluetooth_rfkill, |
| @@ -993,7 +1004,7 @@ static void eeepc_rfkill_exit(void) | |||
| 993 | * Refresh pci hotplug in case the rfkill state was changed after | 1004 | * Refresh pci hotplug in case the rfkill state was changed after |
| 994 | * eeepc_unregister_rfkill_notifier() | 1005 | * eeepc_unregister_rfkill_notifier() |
| 995 | */ | 1006 | */ |
| 996 | eeepc_rfkill_hotplug(); | 1007 | eeepc_rfkill_hotplug(true); |
| 997 | if (ehotk->hotplug_slot) | 1008 | if (ehotk->hotplug_slot) |
| 998 | pci_hp_deregister(ehotk->hotplug_slot); | 1009 | pci_hp_deregister(ehotk->hotplug_slot); |
| 999 | 1010 | ||
| @@ -1109,7 +1120,7 @@ static int eeepc_rfkill_init(struct device *dev) | |||
| 1109 | * Refresh pci hotplug in case the rfkill state was changed during | 1120 | * Refresh pci hotplug in case the rfkill state was changed during |
| 1110 | * setup. | 1121 | * setup. |
| 1111 | */ | 1122 | */ |
| 1112 | eeepc_rfkill_hotplug(); | 1123 | eeepc_rfkill_hotplug(true); |
| 1113 | 1124 | ||
| 1114 | exit: | 1125 | exit: |
| 1115 | if (result && result != -ENODEV) | 1126 | if (result && result != -ENODEV) |
| @@ -1189,7 +1200,7 @@ static int eeepc_input_init(struct device *dev) | |||
| 1189 | return 0; | 1200 | return 0; |
| 1190 | } | 1201 | } |
| 1191 | 1202 | ||
| 1192 | static int eeepc_hotk_add(struct acpi_device *device) | 1203 | static int __devinit eeepc_hotk_add(struct acpi_device *device) |
| 1193 | { | 1204 | { |
| 1194 | struct device *dev; | 1205 | struct device *dev; |
| 1195 | int result; | 1206 | int result; |
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index f35aee5c2149..bcd4ba8be7db 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
| @@ -944,7 +944,7 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) | |||
| 944 | struct fujitsu_hotkey_t *fujitsu_hotkey = acpi_driver_data(device); | 944 | struct fujitsu_hotkey_t *fujitsu_hotkey = acpi_driver_data(device); |
| 945 | struct input_dev *input = fujitsu_hotkey->input; | 945 | struct input_dev *input = fujitsu_hotkey->input; |
| 946 | 946 | ||
| 947 | #ifdef CONFIG_LEDS_CLASS | 947 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) |
| 948 | if (fujitsu_hotkey->logolamp_registered) | 948 | if (fujitsu_hotkey->logolamp_registered) |
| 949 | led_classdev_unregister(&logolamp_led); | 949 | led_classdev_unregister(&logolamp_led); |
| 950 | 950 | ||
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 53b8c255360a..aaccc8ecfa8f 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
| @@ -2533,6 +2533,7 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device, | |||
| 2533 | { | 2533 | { |
| 2534 | struct dasd_ccw_req *cqr; | 2534 | struct dasd_ccw_req *cqr; |
| 2535 | struct ccw1 *ccw; | 2535 | struct ccw1 *ccw; |
| 2536 | unsigned long *idaw; | ||
| 2536 | 2537 | ||
| 2537 | cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device); | 2538 | cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device); |
| 2538 | 2539 | ||
| @@ -2546,9 +2547,17 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device, | |||
| 2546 | 2547 | ||
| 2547 | ccw = cqr->cpaddr; | 2548 | ccw = cqr->cpaddr; |
| 2548 | ccw->cmd_code = CCW_CMD_RDC; | 2549 | ccw->cmd_code = CCW_CMD_RDC; |
| 2549 | ccw->cda = (__u32)(addr_t)rdc_buffer; | 2550 | if (idal_is_needed(rdc_buffer, rdc_buffer_size)) { |
| 2550 | ccw->count = rdc_buffer_size; | 2551 | idaw = (unsigned long *) (cqr->data); |
| 2552 | ccw->cda = (__u32)(addr_t) idaw; | ||
| 2553 | ccw->flags = CCW_FLAG_IDA; | ||
| 2554 | idaw = idal_create_words(idaw, rdc_buffer, rdc_buffer_size); | ||
| 2555 | } else { | ||
| 2556 | ccw->cda = (__u32)(addr_t) rdc_buffer; | ||
| 2557 | ccw->flags = 0; | ||
| 2558 | } | ||
| 2551 | 2559 | ||
| 2560 | ccw->count = rdc_buffer_size; | ||
| 2552 | cqr->startdev = device; | 2561 | cqr->startdev = device; |
| 2553 | cqr->memdev = device; | 2562 | cqr->memdev = device; |
| 2554 | cqr->expires = 10*HZ; | 2563 | cqr->expires = 10*HZ; |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 0be7c15f45c5..417b97cd3f94 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
| @@ -3216,6 +3216,7 @@ int dasd_eckd_restore_device(struct dasd_device *device) | |||
| 3216 | struct dasd_eckd_characteristics temp_rdc_data; | 3216 | struct dasd_eckd_characteristics temp_rdc_data; |
| 3217 | int is_known, rc; | 3217 | int is_known, rc; |
| 3218 | struct dasd_uid temp_uid; | 3218 | struct dasd_uid temp_uid; |
| 3219 | unsigned long flags; | ||
| 3219 | 3220 | ||
| 3220 | private = (struct dasd_eckd_private *) device->private; | 3221 | private = (struct dasd_eckd_private *) device->private; |
| 3221 | 3222 | ||
| @@ -3228,7 +3229,8 @@ int dasd_eckd_restore_device(struct dasd_device *device) | |||
| 3228 | rc = dasd_eckd_generate_uid(device, &private->uid); | 3229 | rc = dasd_eckd_generate_uid(device, &private->uid); |
| 3229 | dasd_get_uid(device->cdev, &temp_uid); | 3230 | dasd_get_uid(device->cdev, &temp_uid); |
| 3230 | if (memcmp(&private->uid, &temp_uid, sizeof(struct dasd_uid)) != 0) | 3231 | if (memcmp(&private->uid, &temp_uid, sizeof(struct dasd_uid)) != 0) |
| 3231 | dev_err(&device->cdev->dev, "The UID of the DASD has changed\n"); | 3232 | dev_err(&device->cdev->dev, "The UID of the DASD has " |
| 3233 | "changed\n"); | ||
| 3232 | if (rc) | 3234 | if (rc) |
| 3233 | goto out_err; | 3235 | goto out_err; |
| 3234 | dasd_set_uid(device->cdev, &private->uid); | 3236 | dasd_set_uid(device->cdev, &private->uid); |
| @@ -3256,9 +3258,9 @@ int dasd_eckd_restore_device(struct dasd_device *device) | |||
| 3256 | "device: %s", rc, dev_name(&device->cdev->dev)); | 3258 | "device: %s", rc, dev_name(&device->cdev->dev)); |
| 3257 | goto out_err; | 3259 | goto out_err; |
| 3258 | } | 3260 | } |
| 3259 | spin_lock(get_ccwdev_lock(device->cdev)); | 3261 | spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); |
| 3260 | memcpy(&private->rdc_data, &temp_rdc_data, sizeof(temp_rdc_data)); | 3262 | memcpy(&private->rdc_data, &temp_rdc_data, sizeof(temp_rdc_data)); |
| 3261 | spin_unlock(get_ccwdev_lock(device->cdev)); | 3263 | spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); |
| 3262 | 3264 | ||
| 3263 | /* add device to alias management */ | 3265 | /* add device to alias management */ |
| 3264 | dasd_alias_add_device(device); | 3266 | dasd_alias_add_device(device); |
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c index daaec185ed36..a4f68e5b9c96 100644 --- a/drivers/s390/char/sclp_async.c +++ b/drivers/s390/char/sclp_async.c | |||
| @@ -62,7 +62,7 @@ static struct notifier_block call_home_panic_nb = { | |||
| 62 | .priority = INT_MAX, | 62 | .priority = INT_MAX, |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | static int proc_handler_callhome(ctl_table *ctl, int write, struct file *filp, | 65 | static int proc_handler_callhome(struct ctl_table *ctl, int write, |
| 66 | void __user *buffer, size_t *count, | 66 | void __user *buffer, size_t *count, |
| 67 | loff_t *ppos) | 67 | loff_t *ppos) |
| 68 | { | 68 | { |
| @@ -100,7 +100,7 @@ static struct ctl_table callhome_table[] = { | |||
| 100 | { | 100 | { |
| 101 | .procname = "callhome", | 101 | .procname = "callhome", |
| 102 | .mode = 0644, | 102 | .mode = 0644, |
| 103 | .proc_handler = &proc_handler_callhome, | 103 | .proc_handler = proc_handler_callhome, |
| 104 | }, | 104 | }, |
| 105 | { .ctl_name = 0 } | 105 | { .ctl_name = 0 } |
| 106 | }; | 106 | }; |
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 178724f2a4c3..b9d2a007e93b 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
| @@ -705,21 +705,6 @@ out_driver: | |||
| 705 | } | 705 | } |
| 706 | __initcall(sclp_vt220_tty_init); | 706 | __initcall(sclp_vt220_tty_init); |
| 707 | 707 | ||
| 708 | #ifdef CONFIG_SCLP_VT220_CONSOLE | ||
| 709 | |||
| 710 | static void | ||
| 711 | sclp_vt220_con_write(struct console *con, const char *buf, unsigned int count) | ||
| 712 | { | ||
| 713 | __sclp_vt220_write((const unsigned char *) buf, count, 1, 1, 0); | ||
| 714 | } | ||
| 715 | |||
| 716 | static struct tty_driver * | ||
| 717 | sclp_vt220_con_device(struct console *c, int *index) | ||
| 718 | { | ||
| 719 | *index = 0; | ||
| 720 | return sclp_vt220_driver; | ||
| 721 | } | ||
| 722 | |||
| 723 | static void __sclp_vt220_flush_buffer(void) | 708 | static void __sclp_vt220_flush_buffer(void) |
| 724 | { | 709 | { |
| 725 | unsigned long flags; | 710 | unsigned long flags; |
| @@ -776,6 +761,21 @@ static void sclp_vt220_pm_event_fn(struct sclp_register *reg, | |||
| 776 | } | 761 | } |
| 777 | } | 762 | } |
| 778 | 763 | ||
| 764 | #ifdef CONFIG_SCLP_VT220_CONSOLE | ||
| 765 | |||
| 766 | static void | ||
| 767 | sclp_vt220_con_write(struct console *con, const char *buf, unsigned int count) | ||
| 768 | { | ||
| 769 | __sclp_vt220_write((const unsigned char *) buf, count, 1, 1, 0); | ||
| 770 | } | ||
| 771 | |||
| 772 | static struct tty_driver * | ||
| 773 | sclp_vt220_con_device(struct console *c, int *index) | ||
| 774 | { | ||
| 775 | *index = 0; | ||
| 776 | return sclp_vt220_driver; | ||
| 777 | } | ||
| 778 | |||
| 779 | static int | 779 | static int |
| 780 | sclp_vt220_notify(struct notifier_block *self, | 780 | sclp_vt220_notify(struct notifier_block *self, |
| 781 | unsigned long event, void *data) | 781 | unsigned long event, void *data) |
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index 64f57ef2763c..0c0705b91c28 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
| @@ -162,9 +162,10 @@ tapeblock_requeue(struct work_struct *work) { | |||
| 162 | spin_lock_irq(&device->blk_data.request_queue_lock); | 162 | spin_lock_irq(&device->blk_data.request_queue_lock); |
| 163 | while ( | 163 | while ( |
| 164 | !blk_queue_plugged(queue) && | 164 | !blk_queue_plugged(queue) && |
| 165 | (req = blk_fetch_request(queue)) && | 165 | blk_peek_request(queue) && |
| 166 | nr_queued < TAPEBLOCK_MIN_REQUEUE | 166 | nr_queued < TAPEBLOCK_MIN_REQUEUE |
| 167 | ) { | 167 | ) { |
| 168 | req = blk_fetch_request(queue); | ||
| 168 | if (rq_data_dir(req) == WRITE) { | 169 | if (rq_data_dir(req) == WRITE) { |
| 169 | DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); | 170 | DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); |
| 170 | spin_unlock_irq(&device->blk_data.request_queue_lock); | 171 | spin_unlock_irq(&device->blk_data.request_queue_lock); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 2ee093ec86e4..2490b741e16a 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
| @@ -1250,8 +1250,7 @@ static int io_subchannel_probe(struct subchannel *sch) | |||
| 1250 | unsigned long flags; | 1250 | unsigned long flags; |
| 1251 | struct ccw_dev_id dev_id; | 1251 | struct ccw_dev_id dev_id; |
| 1252 | 1252 | ||
| 1253 | cdev = sch_get_cdev(sch); | 1253 | if (cio_is_console(sch->schid)) { |
| 1254 | if (cdev) { | ||
| 1255 | rc = sysfs_create_group(&sch->dev.kobj, | 1254 | rc = sysfs_create_group(&sch->dev.kobj, |
| 1256 | &io_subchannel_attr_group); | 1255 | &io_subchannel_attr_group); |
| 1257 | if (rc) | 1256 | if (rc) |
| @@ -1260,13 +1259,13 @@ static int io_subchannel_probe(struct subchannel *sch) | |||
| 1260 | "0.%x.%04x (rc=%d)\n", | 1259 | "0.%x.%04x (rc=%d)\n", |
| 1261 | sch->schid.ssid, sch->schid.sch_no, rc); | 1260 | sch->schid.ssid, sch->schid.sch_no, rc); |
| 1262 | /* | 1261 | /* |
| 1263 | * This subchannel already has an associated ccw_device. | 1262 | * The console subchannel already has an associated ccw_device. |
| 1264 | * Throw the delayed uevent for the subchannel, register | 1263 | * Throw the delayed uevent for the subchannel, register |
| 1265 | * the ccw_device and exit. This happens for all early | 1264 | * the ccw_device and exit. |
| 1266 | * devices, e.g. the console. | ||
| 1267 | */ | 1265 | */ |
| 1268 | dev_set_uevent_suppress(&sch->dev, 0); | 1266 | dev_set_uevent_suppress(&sch->dev, 0); |
| 1269 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); | 1267 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
| 1268 | cdev = sch_get_cdev(sch); | ||
| 1270 | cdev->dev.groups = ccwdev_attr_groups; | 1269 | cdev->dev.groups = ccwdev_attr_groups; |
| 1271 | device_initialize(&cdev->dev); | 1270 | device_initialize(&cdev->dev); |
| 1272 | ccw_device_register(cdev); | 1271 | ccw_device_register(cdev); |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 1689bda1d13b..dcc72444e8e7 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
| @@ -1270,6 +1270,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
| 1270 | 1270 | ||
| 1271 | BUG_ON(!kernel_locked()); | 1271 | BUG_ON(!kernel_locked()); |
| 1272 | 1272 | ||
| 1273 | if (!state) | ||
| 1274 | return; | ||
| 1275 | |||
| 1273 | uport = state->uart_port; | 1276 | uport = state->uart_port; |
| 1274 | port = &state->port; | 1277 | port = &state->port; |
| 1275 | 1278 | ||
| @@ -1316,9 +1319,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
| 1316 | */ | 1319 | */ |
| 1317 | if (port->flags & ASYNC_INITIALIZED) { | 1320 | if (port->flags & ASYNC_INITIALIZED) { |
| 1318 | unsigned long flags; | 1321 | unsigned long flags; |
| 1319 | spin_lock_irqsave(&port->lock, flags); | 1322 | spin_lock_irqsave(&uport->lock, flags); |
| 1320 | uport->ops->stop_rx(uport); | 1323 | uport->ops->stop_rx(uport); |
| 1321 | spin_unlock_irqrestore(&port->lock, flags); | 1324 | spin_unlock_irqrestore(&uport->lock, flags); |
| 1322 | /* | 1325 | /* |
| 1323 | * Before we drop DTR, make sure the UART transmitter | 1326 | * Before we drop DTR, make sure the UART transmitter |
| 1324 | * has completely drained; this is especially | 1327 | * has completely drained; this is especially |
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c index 958a3ffc8987..ff5bbb9c43c9 100644 --- a/drivers/spi/amba-pl022.c +++ b/drivers/spi/amba-pl022.c | |||
| @@ -1826,7 +1826,7 @@ static struct amba_id pl022_ids[] = { | |||
| 1826 | * ST Micro derivative, this has 32bit wide | 1826 | * ST Micro derivative, this has 32bit wide |
| 1827 | * and 32 locations deep TX/RX FIFO | 1827 | * and 32 locations deep TX/RX FIFO |
| 1828 | */ | 1828 | */ |
| 1829 | .id = 0x00108022, | 1829 | .id = 0x01080022, |
| 1830 | .mask = 0xffffffff, | 1830 | .mask = 0xffffffff, |
| 1831 | .data = &vendor_st, | 1831 | .data = &vendor_st, |
| 1832 | }, | 1832 | }, |
diff --git a/drivers/staging/b3dfg/b3dfg.c b/drivers/staging/b3dfg/b3dfg.c index 94c5d27d24d7..cda26bb493b3 100644 --- a/drivers/staging/b3dfg/b3dfg.c +++ b/drivers/staging/b3dfg/b3dfg.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include <linux/wait.h> | 36 | #include <linux/wait.h> |
| 37 | #include <linux/mm.h> | 37 | #include <linux/mm.h> |
| 38 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
| 39 | #include <linux/sched.h> | ||
| 39 | 40 | ||
| 40 | static unsigned int b3dfg_nbuf = 2; | 41 | static unsigned int b3dfg_nbuf = 2; |
| 41 | 42 | ||
diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index 2cda7ad1d32f..80e192d2e77e 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c | |||
| @@ -51,6 +51,7 @@ from http://www.comedi.org | |||
| 51 | */ | 51 | */ |
| 52 | 52 | ||
| 53 | #include <linux/interrupt.h> | 53 | #include <linux/interrupt.h> |
| 54 | #include <linux/sched.h> | ||
| 54 | #include "../comedidev.h" | 55 | #include "../comedidev.h" |
| 55 | 56 | ||
| 56 | #include "comedi_pci.h" | 57 | #include "comedi_pci.h" |
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index e3ffb067ead1..753ee0512342 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c | |||
| @@ -62,6 +62,7 @@ | |||
| 62 | /* #define DEBUG_STATUS_B */ | 62 | /* #define DEBUG_STATUS_B */ |
| 63 | 63 | ||
| 64 | #include <linux/interrupt.h> | 64 | #include <linux/interrupt.h> |
| 65 | #include <linux/sched.h> | ||
| 65 | #include "8255.h" | 66 | #include "8255.h" |
| 66 | #include "mite.h" | 67 | #include "mite.h" |
| 67 | #include "comedi_fc.h" | 68 | #include "comedi_fc.h" |
diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 52b2eca9e73d..d544698f2414 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c | |||
| @@ -70,6 +70,7 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org | |||
| 70 | /* #define DEBUG_FLAGS */ | 70 | /* #define DEBUG_FLAGS */ |
| 71 | 71 | ||
| 72 | #include <linux/interrupt.h> | 72 | #include <linux/interrupt.h> |
| 73 | #include <linux/sched.h> | ||
| 73 | #include "../comedidev.h" | 74 | #include "../comedidev.h" |
| 74 | 75 | ||
| 75 | #include "mite.h" | 76 | #include "mite.h" |
diff --git a/drivers/staging/et131x/et1310_address_map.h b/drivers/staging/et131x/et1310_address_map.h index 6294d3814e72..2c3d65a622a7 100644 --- a/drivers/staging/et131x/et1310_address_map.h +++ b/drivers/staging/et131x/et1310_address_map.h | |||
| @@ -223,7 +223,7 @@ typedef union _TXDMA_PR_NUM_DES_t { | |||
| 223 | 223 | ||
| 224 | extern inline void add_10bit(u32 *v, int n) | 224 | extern inline void add_10bit(u32 *v, int n) |
| 225 | { | 225 | { |
| 226 | *v = INDEX10(*v + n); | 226 | *v = INDEX10(*v + n) | (*v & ET_DMA10_WRAP); |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | /* | 229 | /* |
diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 8f2e91fa0a86..10e21db57ac3 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c | |||
| @@ -1177,12 +1177,20 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev) | |||
| 1177 | 1177 | ||
| 1178 | static inline u32 bump_fbr(u32 *fbr, u32 limit) | 1178 | static inline u32 bump_fbr(u32 *fbr, u32 limit) |
| 1179 | { | 1179 | { |
| 1180 | u32 v = *fbr; | 1180 | u32 v = *fbr; |
| 1181 | add_10bit(&v, 1); | 1181 | v++; |
| 1182 | if (v > limit) | 1182 | /* This works for all cases where limit < 1024. The 1023 case |
| 1183 | v = (*fbr & ~ET_DMA10_MASK) ^ ET_DMA10_WRAP; | 1183 | works because 1023++ is 1024 which means the if condition is not |
| 1184 | *fbr = v; | 1184 | taken but the carry of the bit into the wrap bit toggles the wrap |
| 1185 | return v; | 1185 | value correctly */ |
| 1186 | if ((v & ET_DMA10_MASK) > limit) { | ||
| 1187 | v &= ~ET_DMA10_MASK; | ||
| 1188 | v ^= ET_DMA10_WRAP; | ||
| 1189 | } | ||
| 1190 | /* For the 1023 case */ | ||
| 1191 | v &= (ET_DMA10_MASK|ET_DMA10_WRAP); | ||
| 1192 | *fbr = v; | ||
| 1193 | return v; | ||
| 1186 | } | 1194 | } |
| 1187 | 1195 | ||
| 1188 | /** | 1196 | /** |
diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c index 8fe543bd9910..3a4793a0fd05 100644 --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/ioport.h> | 30 | #include <linux/ioport.h> |
| 31 | #include <linux/irq.h> | 31 | #include <linux/irq.h> |
| 32 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
| 33 | #include <linux/sched.h> | ||
| 33 | #include <linux/wait.h> | 34 | #include <linux/wait.h> |
| 34 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
| 35 | #include <linux/workqueue.h> | 36 | #include <linux/workqueue.h> |
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c index 1fa18f255814..768f44894d08 100644 --- a/drivers/staging/iio/industrialio-core.c +++ b/drivers/staging/iio/industrialio-core.c | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
| 19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
| 20 | #include <linux/poll.h> | 20 | #include <linux/poll.h> |
| 21 | #include <linux/sched.h> | ||
| 22 | #include <linux/wait.h> | ||
| 21 | #include <linux/cdev.h> | 23 | #include <linux/cdev.h> |
| 22 | #include "iio.h" | 24 | #include "iio.h" |
| 23 | #include "trigger_consumer.h" | 25 | #include "trigger_consumer.h" |
diff --git a/drivers/staging/poch/poch.c b/drivers/staging/poch/poch.c index 0d111ddfabb2..2eb8e3d43c4d 100644 --- a/drivers/staging/poch/poch.c +++ b/drivers/staging/poch/poch.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
| 21 | #include <linux/ioctl.h> | 21 | #include <linux/ioctl.h> |
| 22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
| 23 | #include <linux/sched.h> | ||
| 23 | 24 | ||
| 24 | #include "poch.h" | 25 | #include "poch.h" |
| 25 | 26 | ||
diff --git a/drivers/staging/rt2860/common/cmm_data_2860.c b/drivers/staging/rt2860/common/cmm_data_2860.c index fb1735533b74..857ff450b6c9 100644 --- a/drivers/staging/rt2860/common/cmm_data_2860.c +++ b/drivers/staging/rt2860/common/cmm_data_2860.c | |||
| @@ -363,6 +363,8 @@ int RtmpPCIMgmtKickOut( | |||
| 363 | ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; | 363 | ULONG SwIdx = pAd->MgmtRing.TxCpuIdx; |
| 364 | 364 | ||
| 365 | pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa; | 365 | pTxD = (PTXD_STRUC) pAd->MgmtRing.Cell[SwIdx].AllocVa; |
| 366 | if (!pTxD) | ||
| 367 | return 0; | ||
| 366 | 368 | ||
| 367 | pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket; | 369 | pAd->MgmtRing.Cell[SwIdx].pNdisPacket = pPacket; |
| 368 | pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL; | 370 | pAd->MgmtRing.Cell[SwIdx].pNextNdisPacket = NULL; |
diff --git a/drivers/staging/rt2860/common/cmm_info.c b/drivers/staging/rt2860/common/cmm_info.c index 9d589c240ed0..019cc4474ce8 100644 --- a/drivers/staging/rt2860/common/cmm_info.c +++ b/drivers/staging/rt2860/common/cmm_info.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | ************************************************************************* | 25 | ************************************************************************* |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include <linux/sched.h> | ||
| 28 | #include "../rt_config.h" | 29 | #include "../rt_config.h" |
| 29 | 30 | ||
| 30 | INT Show_SSID_Proc( | 31 | INT Show_SSID_Proc( |
diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c index b396a9b570e2..ed27b8545a1b 100644 --- a/drivers/staging/rt2860/rt_linux.c +++ b/drivers/staging/rt2860/rt_linux.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | ************************************************************************* | 25 | ************************************************************************* |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include <linux/sched.h> | ||
| 28 | #include "rt_config.h" | 29 | #include "rt_config.h" |
| 29 | 30 | ||
| 30 | ULONG RTDebugLevel = RT_DEBUG_ERROR; | 31 | ULONG RTDebugLevel = RT_DEBUG_ERROR; |
diff --git a/drivers/staging/rt3090/common/cmm_info.c b/drivers/staging/rt3090/common/cmm_info.c index 5be0714666cb..3e51e98b474c 100644 --- a/drivers/staging/rt3090/common/cmm_info.c +++ b/drivers/staging/rt3090/common/cmm_info.c | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | --------- ---------- ---------------------------------------------- | 34 | --------- ---------- ---------------------------------------------- |
| 35 | */ | 35 | */ |
| 36 | 36 | ||
| 37 | #include <linux/sched.h> | ||
| 37 | #include "../rt_config.h" | 38 | #include "../rt_config.h" |
| 38 | 39 | ||
| 39 | 40 | ||
diff --git a/drivers/staging/rt3090/rt_linux.c b/drivers/staging/rt3090/rt_linux.c index d2241ecdf583..9b94aa6eb904 100644 --- a/drivers/staging/rt3090/rt_linux.c +++ b/drivers/staging/rt3090/rt_linux.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | ************************************************************************* | 25 | ************************************************************************* |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include <linux/sched.h> | ||
| 28 | #include "rt_config.h" | 29 | #include "rt_config.h" |
| 29 | 30 | ||
| 30 | ULONG RTDebugLevel = RT_DEBUG_ERROR; | 31 | ULONG RTDebugLevel = RT_DEBUG_ERROR; |
diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c index 87f8a1192762..f890a16096c0 100644 --- a/drivers/staging/sep/sep_driver.c +++ b/drivers/staging/sep/sep_driver.c | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
| 39 | #include <linux/poll.h> | 39 | #include <linux/poll.h> |
| 40 | #include <linux/wait.h> | 40 | #include <linux/wait.h> |
| 41 | #include <linux/sched.h> | ||
| 41 | #include <linux/pci.h> | 42 | #include <linux/pci.h> |
| 42 | #include <linux/firmware.h> | 43 | #include <linux/firmware.h> |
| 43 | #include <asm/ioctl.h> | 44 | #include <asm/ioctl.h> |
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c index 3d2a84c45829..e139eaeaa174 100644 --- a/drivers/staging/vme/bridges/vme_ca91cx42.c +++ b/drivers/staging/vme/bridges/vme_ca91cx42.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/poll.h> | 25 | #include <linux/poll.h> |
| 26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
| 27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
| 28 | #include <linux/sched.h> | ||
| 28 | #include <asm/time.h> | 29 | #include <asm/time.h> |
| 29 | #include <asm/io.h> | 30 | #include <asm/io.h> |
| 30 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c index 8960fa9ee7aa..00fe0803c21c 100644 --- a/drivers/staging/vme/bridges/vme_tsi148.c +++ b/drivers/staging/vme/bridges/vme_tsi148.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
| 26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
| 27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
| 28 | #include <linux/sched.h> | ||
| 28 | #include <asm/time.h> | 29 | #include <asm/time.h> |
| 29 | #include <asm/io.h> | 30 | #include <asm/io.h> |
| 30 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index f37de283d0ab..167cb2a8ecef 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
| @@ -61,11 +61,6 @@ | |||
| 61 | * simpler, Microsoft pushes their own approach: RNDIS. The published | 61 | * simpler, Microsoft pushes their own approach: RNDIS. The published |
| 62 | * RNDIS specs are ambiguous and appear to be incomplete, and are also | 62 | * RNDIS specs are ambiguous and appear to be incomplete, and are also |
| 63 | * needlessly complex. They borrow more from CDC ACM than CDC ECM. | 63 | * needlessly complex. They borrow more from CDC ACM than CDC ECM. |
| 64 | * | ||
| 65 | * While CDC ECM, CDC Subset, and RNDIS are designed to extend the ethernet | ||
| 66 | * interface to the target, CDC EEM was designed to use ethernet over the USB | ||
| 67 | * link between the host and target. CDC EEM is implemented as an alternative | ||
| 68 | * to those other protocols when that communication model is more appropriate | ||
| 69 | */ | 64 | */ |
| 70 | 65 | ||
| 71 | #define DRIVER_DESC "Ethernet Gadget" | 66 | #define DRIVER_DESC "Ethernet Gadget" |
| @@ -157,8 +152,8 @@ static inline bool has_rndis(void) | |||
| 157 | #define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */ | 152 | #define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */ |
| 158 | 153 | ||
| 159 | /* For EEM gadgets */ | 154 | /* For EEM gadgets */ |
| 160 | #define EEM_VENDOR_NUM 0x0525 /* INVALID - NEEDS TO BE ALLOCATED */ | 155 | #define EEM_VENDOR_NUM 0x1d6b /* Linux Foundation */ |
| 161 | #define EEM_PRODUCT_NUM 0xa4a1 /* INVALID - NEEDS TO BE ALLOCATED */ | 156 | #define EEM_PRODUCT_NUM 0x0102 /* EEM Gadget */ |
| 162 | 157 | ||
| 163 | /*-------------------------------------------------------------------------*/ | 158 | /*-------------------------------------------------------------------------*/ |
| 164 | 159 | ||
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 3efa59b18044..b25cdea93a1f 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
| @@ -1400,6 +1400,10 @@ iso_stream_schedule ( | |||
| 1400 | goto fail; | 1400 | goto fail; |
| 1401 | } | 1401 | } |
| 1402 | 1402 | ||
| 1403 | period = urb->interval; | ||
| 1404 | if (!stream->highspeed) | ||
| 1405 | period <<= 3; | ||
| 1406 | |||
| 1403 | now = ehci_readl(ehci, &ehci->regs->frame_index) % mod; | 1407 | now = ehci_readl(ehci, &ehci->regs->frame_index) % mod; |
| 1404 | 1408 | ||
| 1405 | /* when's the last uframe this urb could start? */ | 1409 | /* when's the last uframe this urb could start? */ |
| @@ -1417,8 +1421,8 @@ iso_stream_schedule ( | |||
| 1417 | 1421 | ||
| 1418 | /* Fell behind (by up to twice the slop amount)? */ | 1422 | /* Fell behind (by up to twice the slop amount)? */ |
| 1419 | if (start >= max - 2 * 8 * SCHEDULE_SLOP) | 1423 | if (start >= max - 2 * 8 * SCHEDULE_SLOP) |
| 1420 | start += stream->interval * DIV_ROUND_UP( | 1424 | start += period * DIV_ROUND_UP( |
| 1421 | max - start, stream->interval) - mod; | 1425 | max - start, period) - mod; |
| 1422 | 1426 | ||
| 1423 | /* Tried to schedule too far into the future? */ | 1427 | /* Tried to schedule too far into the future? */ |
| 1424 | if (unlikely((start + sched->span) >= max)) { | 1428 | if (unlikely((start + sched->span) >= max)) { |
| @@ -1441,10 +1445,6 @@ iso_stream_schedule ( | |||
| 1441 | 1445 | ||
| 1442 | /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */ | 1446 | /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */ |
| 1443 | 1447 | ||
| 1444 | period = urb->interval; | ||
| 1445 | if (!stream->highspeed) | ||
| 1446 | period <<= 3; | ||
| 1447 | |||
| 1448 | /* find a uframe slot with enough bandwidth */ | 1448 | /* find a uframe slot with enough bandwidth */ |
| 1449 | for (; start < (stream->next_uframe + period); start++) { | 1449 | for (; start < (stream->next_uframe + period); start++) { |
| 1450 | int enough_space; | 1450 | int enough_space; |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 23cf3bde4762..83b5f9cea85a 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
| @@ -475,4 +475,4 @@ static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev) | |||
| 475 | else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI) | 475 | else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI) |
| 476 | quirk_usb_handoff_xhci(pdev); | 476 | quirk_usb_handoff_xhci(pdev); |
| 477 | } | 477 | } |
| 478 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff); | 478 | DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff); |
diff --git a/drivers/usb/host/whci/asl.c b/drivers/usb/host/whci/asl.c index c632437c7649..562eba108816 100644 --- a/drivers/usb/host/whci/asl.c +++ b/drivers/usb/host/whci/asl.c | |||
| @@ -115,6 +115,10 @@ static uint32_t process_qset(struct whc *whc, struct whc_qset *qset) | |||
| 115 | if (status & QTD_STS_HALTED) { | 115 | if (status & QTD_STS_HALTED) { |
| 116 | /* Ug, an error. */ | 116 | /* Ug, an error. */ |
| 117 | process_halted_qtd(whc, qset, td); | 117 | process_halted_qtd(whc, qset, td); |
| 118 | /* A halted qTD always triggers an update | ||
| 119 | because the qset was either removed or | ||
| 120 | reactivated. */ | ||
| 121 | update |= WHC_UPDATE_UPDATED; | ||
| 118 | goto done; | 122 | goto done; |
| 119 | } | 123 | } |
| 120 | 124 | ||
| @@ -305,6 +309,7 @@ int asl_urb_dequeue(struct whc *whc, struct urb *urb, int status) | |||
| 305 | struct whc_urb *wurb = urb->hcpriv; | 309 | struct whc_urb *wurb = urb->hcpriv; |
| 306 | struct whc_qset *qset = wurb->qset; | 310 | struct whc_qset *qset = wurb->qset; |
| 307 | struct whc_std *std, *t; | 311 | struct whc_std *std, *t; |
| 312 | bool has_qtd = false; | ||
| 308 | int ret; | 313 | int ret; |
| 309 | unsigned long flags; | 314 | unsigned long flags; |
| 310 | 315 | ||
| @@ -315,17 +320,21 @@ int asl_urb_dequeue(struct whc *whc, struct urb *urb, int status) | |||
| 315 | goto out; | 320 | goto out; |
| 316 | 321 | ||
| 317 | list_for_each_entry_safe(std, t, &qset->stds, list_node) { | 322 | list_for_each_entry_safe(std, t, &qset->stds, list_node) { |
| 318 | if (std->urb == urb) | 323 | if (std->urb == urb) { |
| 324 | if (std->qtd) | ||
| 325 | has_qtd = true; | ||
| 319 | qset_free_std(whc, std); | 326 | qset_free_std(whc, std); |
| 320 | else | 327 | } else |
| 321 | std->qtd = NULL; /* so this std is re-added when the qset is */ | 328 | std->qtd = NULL; /* so this std is re-added when the qset is */ |
| 322 | } | 329 | } |
| 323 | 330 | ||
| 324 | asl_qset_remove(whc, qset); | 331 | if (has_qtd) { |
| 325 | wurb->status = status; | 332 | asl_qset_remove(whc, qset); |
| 326 | wurb->is_async = true; | 333 | wurb->status = status; |
| 327 | queue_work(whc->workqueue, &wurb->dequeue_work); | 334 | wurb->is_async = true; |
| 328 | 335 | queue_work(whc->workqueue, &wurb->dequeue_work); | |
| 336 | } else | ||
| 337 | qset_remove_urb(whc, qset, urb, status); | ||
| 329 | out: | 338 | out: |
| 330 | spin_unlock_irqrestore(&whc->lock, flags); | 339 | spin_unlock_irqrestore(&whc->lock, flags); |
| 331 | 340 | ||
diff --git a/drivers/usb/host/whci/pzl.c b/drivers/usb/host/whci/pzl.c index a9e05bac6646..0db3fb2dc03a 100644 --- a/drivers/usb/host/whci/pzl.c +++ b/drivers/usb/host/whci/pzl.c | |||
| @@ -121,6 +121,10 @@ static enum whc_update pzl_process_qset(struct whc *whc, struct whc_qset *qset) | |||
| 121 | if (status & QTD_STS_HALTED) { | 121 | if (status & QTD_STS_HALTED) { |
| 122 | /* Ug, an error. */ | 122 | /* Ug, an error. */ |
| 123 | process_halted_qtd(whc, qset, td); | 123 | process_halted_qtd(whc, qset, td); |
| 124 | /* A halted qTD always triggers an update | ||
| 125 | because the qset was either removed or | ||
| 126 | reactivated. */ | ||
| 127 | update |= WHC_UPDATE_UPDATED; | ||
| 124 | goto done; | 128 | goto done; |
| 125 | } | 129 | } |
| 126 | 130 | ||
| @@ -333,6 +337,7 @@ int pzl_urb_dequeue(struct whc *whc, struct urb *urb, int status) | |||
| 333 | struct whc_urb *wurb = urb->hcpriv; | 337 | struct whc_urb *wurb = urb->hcpriv; |
| 334 | struct whc_qset *qset = wurb->qset; | 338 | struct whc_qset *qset = wurb->qset; |
| 335 | struct whc_std *std, *t; | 339 | struct whc_std *std, *t; |
| 340 | bool has_qtd = false; | ||
| 336 | int ret; | 341 | int ret; |
| 337 | unsigned long flags; | 342 | unsigned long flags; |
| 338 | 343 | ||
| @@ -343,17 +348,22 @@ int pzl_urb_dequeue(struct whc *whc, struct urb *urb, int status) | |||
| 343 | goto out; | 348 | goto out; |
| 344 | 349 | ||
| 345 | list_for_each_entry_safe(std, t, &qset->stds, list_node) { | 350 | list_for_each_entry_safe(std, t, &qset->stds, list_node) { |
| 346 | if (std->urb == urb) | 351 | if (std->urb == urb) { |
| 352 | if (std->qtd) | ||
| 353 | has_qtd = true; | ||
| 347 | qset_free_std(whc, std); | 354 | qset_free_std(whc, std); |
| 348 | else | 355 | } else |
| 349 | std->qtd = NULL; /* so this std is re-added when the qset is */ | 356 | std->qtd = NULL; /* so this std is re-added when the qset is */ |
| 350 | } | 357 | } |
| 351 | 358 | ||
| 352 | pzl_qset_remove(whc, qset); | 359 | if (has_qtd) { |
| 353 | wurb->status = status; | 360 | pzl_qset_remove(whc, qset); |
| 354 | wurb->is_async = false; | 361 | update_pzl_hw_view(whc); |
| 355 | queue_work(whc->workqueue, &wurb->dequeue_work); | 362 | wurb->status = status; |
| 356 | 363 | wurb->is_async = false; | |
| 364 | queue_work(whc->workqueue, &wurb->dequeue_work); | ||
| 365 | } else | ||
| 366 | qset_remove_urb(whc, qset, urb, status); | ||
| 357 | out: | 367 | out: |
| 358 | spin_unlock_irqrestore(&whc->lock, flags); | 368 | spin_unlock_irqrestore(&whc->lock, flags); |
| 359 | 369 | ||
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 760e7271d17b..b84abd8ee8a5 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
| @@ -9,7 +9,7 @@ comment "Enable Host or Gadget support to see Inventra options" | |||
| 9 | # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller | 9 | # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller |
| 10 | config USB_MUSB_HDRC | 10 | config USB_MUSB_HDRC |
| 11 | depends on (USB || USB_GADGET) | 11 | depends on (USB || USB_GADGET) |
| 12 | depends on !SUPERH | 12 | depends on (ARM || BLACKFIN) |
| 13 | select NOP_USB_XCEIV if ARCH_DAVINCI | 13 | select NOP_USB_XCEIV if ARCH_DAVINCI |
| 14 | select TWL4030_USB if MACH_OMAP_3430SDP | 14 | select TWL4030_USB if MACH_OMAP_3430SDP |
| 15 | select NOP_USB_XCEIV if MACH_OMAP3EVM | 15 | select NOP_USB_XCEIV if MACH_OMAP3EVM |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 43c227027560..65d96b214f95 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -328,6 +328,9 @@ static int option_resume(struct usb_serial *serial); | |||
| 328 | #define ALCATEL_VENDOR_ID 0x1bbb | 328 | #define ALCATEL_VENDOR_ID 0x1bbb |
| 329 | #define ALCATEL_PRODUCT_X060S 0x0000 | 329 | #define ALCATEL_PRODUCT_X060S 0x0000 |
| 330 | 330 | ||
| 331 | /* Airplus products */ | ||
| 332 | #define AIRPLUS_VENDOR_ID 0x1011 | ||
| 333 | #define AIRPLUS_PRODUCT_MCD650 0x3198 | ||
| 331 | 334 | ||
| 332 | static struct usb_device_id option_ids[] = { | 335 | static struct usb_device_id option_ids[] = { |
| 333 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 336 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
| @@ -589,6 +592,7 @@ static struct usb_device_id option_ids[] = { | |||
| 589 | { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, | 592 | { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, |
| 590 | { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, | 593 | { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, |
| 591 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) }, | 594 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) }, |
| 595 | { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, | ||
| 592 | { } /* Terminating entry */ | 596 | { } /* Terminating entry */ |
| 593 | }; | 597 | }; |
| 594 | MODULE_DEVICE_TABLE(usb, option_ids); | 598 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 3a4fb023af72..589f6b4404f0 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
| @@ -696,7 +696,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
| 696 | /* device supports and needs bigger sense buffer */ | 696 | /* device supports and needs bigger sense buffer */ |
| 697 | if (us->fflags & US_FL_SANE_SENSE) | 697 | if (us->fflags & US_FL_SANE_SENSE) |
| 698 | sense_size = ~0; | 698 | sense_size = ~0; |
| 699 | 699 | Retry_Sense: | |
| 700 | US_DEBUGP("Issuing auto-REQUEST_SENSE\n"); | 700 | US_DEBUGP("Issuing auto-REQUEST_SENSE\n"); |
| 701 | 701 | ||
| 702 | scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sense_size); | 702 | scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sense_size); |
| @@ -720,6 +720,21 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
| 720 | srb->result = DID_ABORT << 16; | 720 | srb->result = DID_ABORT << 16; |
| 721 | goto Handle_Errors; | 721 | goto Handle_Errors; |
| 722 | } | 722 | } |
| 723 | |||
| 724 | /* Some devices claim to support larger sense but fail when | ||
| 725 | * trying to request it. When a transport failure happens | ||
| 726 | * using US_FS_SANE_SENSE, we always retry with a standard | ||
| 727 | * (small) sense request. This fixes some USB GSM modems | ||
| 728 | */ | ||
| 729 | if (temp_result == USB_STOR_TRANSPORT_FAILED && | ||
| 730 | (us->fflags & US_FL_SANE_SENSE) && | ||
| 731 | sense_size != US_SENSE_SIZE) { | ||
| 732 | US_DEBUGP("-- auto-sense failure, retry small sense\n"); | ||
| 733 | sense_size = US_SENSE_SIZE; | ||
| 734 | goto Retry_Sense; | ||
| 735 | } | ||
| 736 | |||
| 737 | /* Other failures */ | ||
| 723 | if (temp_result != USB_STOR_TRANSPORT_GOOD) { | 738 | if (temp_result != USB_STOR_TRANSPORT_GOOD) { |
| 724 | US_DEBUGP("-- auto-sense failure\n"); | 739 | US_DEBUGP("-- auto-sense failure\n"); |
| 725 | 740 | ||
diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c index b2f149fedcc5..4516c36436e6 100644 --- a/drivers/usb/wusbcore/security.c +++ b/drivers/usb/wusbcore/security.c | |||
| @@ -200,35 +200,40 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc, | |||
| 200 | { | 200 | { |
| 201 | int result, bytes, secd_size; | 201 | int result, bytes, secd_size; |
| 202 | struct device *dev = &usb_dev->dev; | 202 | struct device *dev = &usb_dev->dev; |
| 203 | struct usb_security_descriptor secd; | 203 | struct usb_security_descriptor *secd; |
| 204 | const struct usb_encryption_descriptor *etd, *ccm1_etd = NULL; | 204 | const struct usb_encryption_descriptor *etd, *ccm1_etd = NULL; |
| 205 | void *secd_buf; | ||
| 206 | const void *itr, *top; | 205 | const void *itr, *top; |
| 207 | char buf[64]; | 206 | char buf[64]; |
| 208 | 207 | ||
| 208 | secd = kmalloc(sizeof(struct usb_security_descriptor), GFP_KERNEL); | ||
| 209 | if (secd == NULL) { | ||
| 210 | result = -ENOMEM; | ||
| 211 | goto out; | ||
| 212 | } | ||
| 213 | |||
| 209 | result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, | 214 | result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, |
| 210 | 0, &secd, sizeof(secd)); | 215 | 0, secd, sizeof(struct usb_security_descriptor)); |
| 211 | if (result < sizeof(secd)) { | 216 | if (result < sizeof(secd)) { |
| 212 | dev_err(dev, "Can't read security descriptor or " | 217 | dev_err(dev, "Can't read security descriptor or " |
| 213 | "not enough data: %d\n", result); | 218 | "not enough data: %d\n", result); |
| 214 | goto error_secd; | 219 | goto out; |
| 215 | } | 220 | } |
| 216 | secd_size = le16_to_cpu(secd.wTotalLength); | 221 | secd_size = le16_to_cpu(secd->wTotalLength); |
| 217 | secd_buf = kmalloc(secd_size, GFP_KERNEL); | 222 | secd = krealloc(secd, secd_size, GFP_KERNEL); |
| 218 | if (secd_buf == NULL) { | 223 | if (secd == NULL) { |
| 219 | dev_err(dev, "Can't allocate space for security descriptors\n"); | 224 | dev_err(dev, "Can't allocate space for security descriptors\n"); |
| 220 | goto error_secd_alloc; | 225 | goto out; |
| 221 | } | 226 | } |
| 222 | result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, | 227 | result = usb_get_descriptor(usb_dev, USB_DT_SECURITY, |
| 223 | 0, secd_buf, secd_size); | 228 | 0, secd, secd_size); |
| 224 | if (result < secd_size) { | 229 | if (result < secd_size) { |
| 225 | dev_err(dev, "Can't read security descriptor or " | 230 | dev_err(dev, "Can't read security descriptor or " |
| 226 | "not enough data: %d\n", result); | 231 | "not enough data: %d\n", result); |
| 227 | goto error_secd_all; | 232 | goto out; |
| 228 | } | 233 | } |
| 229 | bytes = 0; | 234 | bytes = 0; |
| 230 | itr = secd_buf + sizeof(secd); | 235 | itr = &secd[1]; |
| 231 | top = secd_buf + result; | 236 | top = (void *)secd + result; |
| 232 | while (itr < top) { | 237 | while (itr < top) { |
| 233 | etd = itr; | 238 | etd = itr; |
| 234 | if (top - itr < sizeof(*etd)) { | 239 | if (top - itr < sizeof(*etd)) { |
| @@ -259,24 +264,16 @@ int wusb_dev_sec_add(struct wusbhc *wusbhc, | |||
| 259 | dev_err(dev, "WUSB device doesn't support CCM1 encryption, " | 264 | dev_err(dev, "WUSB device doesn't support CCM1 encryption, " |
| 260 | "can't use!\n"); | 265 | "can't use!\n"); |
| 261 | result = -EINVAL; | 266 | result = -EINVAL; |
| 262 | goto error_no_ccm1; | 267 | goto out; |
| 263 | } | 268 | } |
| 264 | wusb_dev->ccm1_etd = *ccm1_etd; | 269 | wusb_dev->ccm1_etd = *ccm1_etd; |
| 265 | dev_dbg(dev, "supported encryption: %s; using %s (0x%02x/%02x)\n", | 270 | dev_dbg(dev, "supported encryption: %s; using %s (0x%02x/%02x)\n", |
| 266 | buf, wusb_et_name(ccm1_etd->bEncryptionType), | 271 | buf, wusb_et_name(ccm1_etd->bEncryptionType), |
| 267 | ccm1_etd->bEncryptionValue, ccm1_etd->bAuthKeyIndex); | 272 | ccm1_etd->bEncryptionValue, ccm1_etd->bAuthKeyIndex); |
| 268 | result = 0; | 273 | result = 0; |
| 269 | kfree(secd_buf); | ||
| 270 | out: | 274 | out: |
| 275 | kfree(secd); | ||
| 271 | return result; | 276 | return result; |
| 272 | |||
| 273 | |||
| 274 | error_no_ccm1: | ||
| 275 | error_secd_all: | ||
| 276 | kfree(secd_buf); | ||
| 277 | error_secd_alloc: | ||
| 278 | error_secd: | ||
| 279 | goto out; | ||
| 280 | } | 277 | } |
| 281 | 278 | ||
| 282 | void wusb_dev_sec_rm(struct wusb_dev *wusb_dev) | 279 | void wusb_dev_sec_rm(struct wusb_dev *wusb_dev) |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 200c22f55130..9dd588042880 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | */ | 19 | */ |
| 20 | //#define DEBUG | 20 | //#define DEBUG |
| 21 | #include <linux/virtio.h> | 21 | #include <linux/virtio.h> |
| 22 | #include <linux/virtio_ids.h> | ||
| 23 | #include <linux/virtio_balloon.h> | 22 | #include <linux/virtio_balloon.h> |
| 24 | #include <linux/swap.h> | 23 | #include <linux/swap.h> |
| 25 | #include <linux/kthread.h> | 24 | #include <linux/kthread.h> |
| @@ -248,7 +247,7 @@ out: | |||
| 248 | return err; | 247 | return err; |
| 249 | } | 248 | } |
| 250 | 249 | ||
| 251 | static void virtballoon_remove(struct virtio_device *vdev) | 250 | static void __devexit virtballoon_remove(struct virtio_device *vdev) |
| 252 | { | 251 | { |
| 253 | struct virtio_balloon *vb = vdev->priv; | 252 | struct virtio_balloon *vb = vdev->priv; |
| 254 | 253 | ||
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index 1e8f02f440e6..d3c824dc2358 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c | |||
| @@ -206,7 +206,7 @@ static int __devinit riowd_probe(struct of_device *op, | |||
| 206 | 206 | ||
| 207 | dev_set_drvdata(&op->dev, p); | 207 | dev_set_drvdata(&op->dev, p); |
| 208 | riowd_device = p; | 208 | riowd_device = p; |
| 209 | err = 0; | 209 | return 0; |
| 210 | 210 | ||
| 211 | out_iounmap: | 211 | out_iounmap: |
| 212 | of_iounmap(&op->resource[0], p->regs, 2); | 212 | of_iounmap(&op->resource[0], p->regs, 2); |
diff --git a/fs/Kconfig b/fs/Kconfig index d4bf8caad8d0..f93d0ed4fe0c 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
| @@ -135,7 +135,7 @@ config TMPFS_POSIX_ACL | |||
| 135 | 135 | ||
| 136 | config HUGETLBFS | 136 | config HUGETLBFS |
| 137 | bool "HugeTLB file system support" | 137 | bool "HugeTLB file system support" |
| 138 | depends on X86 || IA64 || PPC64 || SPARC64 || (SUPERH && MMU) || \ | 138 | depends on X86 || IA64 || PPC_BOOK3S_64 || SPARC64 || (SUPERH && MMU) || \ |
| 139 | (S390 && 64BIT) || SYS_SUPPORTS_HUGETLBFS || BROKEN | 139 | (S390 && 64BIT) || SYS_SUPPORTS_HUGETLBFS || BROKEN |
| 140 | help | 140 | help |
| 141 | hugetlbfs is a filesystem backing for HugeTLB pages, based on | 141 | hugetlbfs is a filesystem backing for HugeTLB pages, based on |
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 69b355ae7f49..361604244271 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | #include "btrfs_inode.h" | 27 | #include "btrfs_inode.h" |
| 28 | #include "xattr.h" | 28 | #include "xattr.h" |
| 29 | 29 | ||
| 30 | #ifdef CONFIG_BTRFS_POSIX_ACL | 30 | #ifdef CONFIG_BTRFS_FS_POSIX_ACL |
| 31 | 31 | ||
| 32 | static struct posix_acl *btrfs_get_acl(struct inode *inode, int type) | 32 | static struct posix_acl *btrfs_get_acl(struct inode *inode, int type) |
| 33 | { | 33 | { |
| @@ -313,7 +313,7 @@ struct xattr_handler btrfs_xattr_acl_access_handler = { | |||
| 313 | .set = btrfs_xattr_acl_access_set, | 313 | .set = btrfs_xattr_acl_access_set, |
| 314 | }; | 314 | }; |
| 315 | 315 | ||
| 316 | #else /* CONFIG_BTRFS_POSIX_ACL */ | 316 | #else /* CONFIG_BTRFS_FS_POSIX_ACL */ |
| 317 | 317 | ||
| 318 | int btrfs_acl_chmod(struct inode *inode) | 318 | int btrfs_acl_chmod(struct inode *inode) |
| 319 | { | 319 | { |
| @@ -325,4 +325,4 @@ int btrfs_init_acl(struct inode *inode, struct inode *dir) | |||
| 325 | return 0; | 325 | return 0; |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | #endif /* CONFIG_BTRFS_POSIX_ACL */ | 328 | #endif /* CONFIG_BTRFS_FS_POSIX_ACL */ |
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index c71abec0ab90..f6783a42f010 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
| @@ -86,6 +86,12 @@ struct btrfs_inode { | |||
| 86 | * transid of the trans_handle that last modified this inode | 86 | * transid of the trans_handle that last modified this inode |
| 87 | */ | 87 | */ |
| 88 | u64 last_trans; | 88 | u64 last_trans; |
| 89 | |||
| 90 | /* | ||
| 91 | * log transid when this inode was last modified | ||
| 92 | */ | ||
| 93 | u64 last_sub_trans; | ||
| 94 | |||
| 89 | /* | 95 | /* |
| 90 | * transid that last logged this inode | 96 | * transid that last logged this inode |
| 91 | */ | 97 | */ |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1bb897ecdeeb..444b3e9b92a4 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
| @@ -1009,6 +1009,7 @@ struct btrfs_root { | |||
| 1009 | atomic_t log_writers; | 1009 | atomic_t log_writers; |
| 1010 | atomic_t log_commit[2]; | 1010 | atomic_t log_commit[2]; |
| 1011 | unsigned long log_transid; | 1011 | unsigned long log_transid; |
| 1012 | unsigned long last_log_commit; | ||
| 1012 | unsigned long log_batch; | 1013 | unsigned long log_batch; |
| 1013 | pid_t log_start_pid; | 1014 | pid_t log_start_pid; |
| 1014 | bool log_multiple_pids; | 1015 | bool log_multiple_pids; |
| @@ -1152,6 +1153,7 @@ struct btrfs_root { | |||
| 1152 | #define BTRFS_MOUNT_FLUSHONCOMMIT (1 << 7) | 1153 | #define BTRFS_MOUNT_FLUSHONCOMMIT (1 << 7) |
| 1153 | #define BTRFS_MOUNT_SSD_SPREAD (1 << 8) | 1154 | #define BTRFS_MOUNT_SSD_SPREAD (1 << 8) |
| 1154 | #define BTRFS_MOUNT_NOSSD (1 << 9) | 1155 | #define BTRFS_MOUNT_NOSSD (1 << 9) |
| 1156 | #define BTRFS_MOUNT_DISCARD (1 << 10) | ||
| 1155 | 1157 | ||
| 1156 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) | 1158 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) |
| 1157 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) | 1159 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) |
| @@ -2373,7 +2375,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options); | |||
| 2373 | int btrfs_sync_fs(struct super_block *sb, int wait); | 2375 | int btrfs_sync_fs(struct super_block *sb, int wait); |
| 2374 | 2376 | ||
| 2375 | /* acl.c */ | 2377 | /* acl.c */ |
| 2376 | #ifdef CONFIG_BTRFS_POSIX_ACL | 2378 | #ifdef CONFIG_BTRFS_FS_POSIX_ACL |
| 2377 | int btrfs_check_acl(struct inode *inode, int mask); | 2379 | int btrfs_check_acl(struct inode *inode, int mask); |
| 2378 | #else | 2380 | #else |
| 2379 | #define btrfs_check_acl NULL | 2381 | #define btrfs_check_acl NULL |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 100551a66c46..02b6afbd7450 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -917,6 +917,7 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize, | |||
| 917 | atomic_set(&root->log_writers, 0); | 917 | atomic_set(&root->log_writers, 0); |
| 918 | root->log_batch = 0; | 918 | root->log_batch = 0; |
| 919 | root->log_transid = 0; | 919 | root->log_transid = 0; |
| 920 | root->last_log_commit = 0; | ||
| 920 | extent_io_tree_init(&root->dirty_log_pages, | 921 | extent_io_tree_init(&root->dirty_log_pages, |
| 921 | fs_info->btree_inode->i_mapping, GFP_NOFS); | 922 | fs_info->btree_inode->i_mapping, GFP_NOFS); |
| 922 | 923 | ||
| @@ -1087,6 +1088,7 @@ int btrfs_add_log_tree(struct btrfs_trans_handle *trans, | |||
| 1087 | WARN_ON(root->log_root); | 1088 | WARN_ON(root->log_root); |
| 1088 | root->log_root = log_root; | 1089 | root->log_root = log_root; |
| 1089 | root->log_transid = 0; | 1090 | root->log_transid = 0; |
| 1091 | root->last_log_commit = 0; | ||
| 1090 | return 0; | 1092 | return 0; |
| 1091 | } | 1093 | } |
| 1092 | 1094 | ||
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index d0c4d584efad..e238a0cdac67 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -1568,23 +1568,23 @@ static int remove_extent_backref(struct btrfs_trans_handle *trans, | |||
| 1568 | return ret; | 1568 | return ret; |
| 1569 | } | 1569 | } |
| 1570 | 1570 | ||
| 1571 | #ifdef BIO_RW_DISCARD | ||
| 1572 | static void btrfs_issue_discard(struct block_device *bdev, | 1571 | static void btrfs_issue_discard(struct block_device *bdev, |
| 1573 | u64 start, u64 len) | 1572 | u64 start, u64 len) |
| 1574 | { | 1573 | { |
| 1575 | blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, | 1574 | blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, |
| 1576 | DISCARD_FL_BARRIER); | 1575 | DISCARD_FL_BARRIER); |
| 1577 | } | 1576 | } |
| 1578 | #endif | ||
| 1579 | 1577 | ||
| 1580 | static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, | 1578 | static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, |
| 1581 | u64 num_bytes) | 1579 | u64 num_bytes) |
| 1582 | { | 1580 | { |
| 1583 | #ifdef BIO_RW_DISCARD | ||
| 1584 | int ret; | 1581 | int ret; |
| 1585 | u64 map_length = num_bytes; | 1582 | u64 map_length = num_bytes; |
| 1586 | struct btrfs_multi_bio *multi = NULL; | 1583 | struct btrfs_multi_bio *multi = NULL; |
| 1587 | 1584 | ||
| 1585 | if (!btrfs_test_opt(root, DISCARD)) | ||
| 1586 | return 0; | ||
| 1587 | |||
| 1588 | /* Tell the block device(s) that the sectors can be discarded */ | 1588 | /* Tell the block device(s) that the sectors can be discarded */ |
| 1589 | ret = btrfs_map_block(&root->fs_info->mapping_tree, READ, | 1589 | ret = btrfs_map_block(&root->fs_info->mapping_tree, READ, |
| 1590 | bytenr, &map_length, &multi, 0); | 1590 | bytenr, &map_length, &multi, 0); |
| @@ -1604,9 +1604,6 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, | |||
| 1604 | } | 1604 | } |
| 1605 | 1605 | ||
| 1606 | return ret; | 1606 | return ret; |
| 1607 | #else | ||
| 1608 | return 0; | ||
| 1609 | #endif | ||
| 1610 | } | 1607 | } |
| 1611 | 1608 | ||
| 1612 | int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | 1609 | int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, |
| @@ -3690,6 +3687,14 @@ static int pin_down_bytes(struct btrfs_trans_handle *trans, | |||
| 3690 | if (is_data) | 3687 | if (is_data) |
| 3691 | goto pinit; | 3688 | goto pinit; |
| 3692 | 3689 | ||
| 3690 | /* | ||
| 3691 | * discard is sloooow, and so triggering discards on | ||
| 3692 | * individual btree blocks isn't a good plan. Just | ||
| 3693 | * pin everything in discard mode. | ||
| 3694 | */ | ||
| 3695 | if (btrfs_test_opt(root, DISCARD)) | ||
| 3696 | goto pinit; | ||
| 3697 | |||
| 3693 | buf = btrfs_find_tree_block(root, bytenr, num_bytes); | 3698 | buf = btrfs_find_tree_block(root, bytenr, num_bytes); |
| 3694 | if (!buf) | 3699 | if (!buf) |
| 3695 | goto pinit; | 3700 | goto pinit; |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 2d623aa0625f..06550affbd27 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
| @@ -1086,8 +1086,10 @@ out_nolock: | |||
| 1086 | btrfs_end_transaction(trans, root); | 1086 | btrfs_end_transaction(trans, root); |
| 1087 | else | 1087 | else |
| 1088 | btrfs_commit_transaction(trans, root); | 1088 | btrfs_commit_transaction(trans, root); |
| 1089 | } else { | 1089 | } else if (ret != BTRFS_NO_LOG_SYNC) { |
| 1090 | btrfs_commit_transaction(trans, root); | 1090 | btrfs_commit_transaction(trans, root); |
| 1091 | } else { | ||
| 1092 | btrfs_end_transaction(trans, root); | ||
| 1091 | } | 1093 | } |
| 1092 | } | 1094 | } |
| 1093 | if (file->f_flags & O_DIRECT) { | 1095 | if (file->f_flags & O_DIRECT) { |
| @@ -1137,6 +1139,13 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
| 1137 | int ret = 0; | 1139 | int ret = 0; |
| 1138 | struct btrfs_trans_handle *trans; | 1140 | struct btrfs_trans_handle *trans; |
| 1139 | 1141 | ||
| 1142 | |||
| 1143 | /* we wait first, since the writeback may change the inode */ | ||
| 1144 | root->log_batch++; | ||
| 1145 | /* the VFS called filemap_fdatawrite for us */ | ||
| 1146 | btrfs_wait_ordered_range(inode, 0, (u64)-1); | ||
| 1147 | root->log_batch++; | ||
| 1148 | |||
| 1140 | /* | 1149 | /* |
| 1141 | * check the transaction that last modified this inode | 1150 | * check the transaction that last modified this inode |
| 1142 | * and see if its already been committed | 1151 | * and see if its already been committed |
| @@ -1144,6 +1153,11 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
| 1144 | if (!BTRFS_I(inode)->last_trans) | 1153 | if (!BTRFS_I(inode)->last_trans) |
| 1145 | goto out; | 1154 | goto out; |
| 1146 | 1155 | ||
| 1156 | /* | ||
| 1157 | * if the last transaction that changed this file was before | ||
| 1158 | * the current transaction, we can bail out now without any | ||
| 1159 | * syncing | ||
| 1160 | */ | ||
| 1147 | mutex_lock(&root->fs_info->trans_mutex); | 1161 | mutex_lock(&root->fs_info->trans_mutex); |
| 1148 | if (BTRFS_I(inode)->last_trans <= | 1162 | if (BTRFS_I(inode)->last_trans <= |
| 1149 | root->fs_info->last_trans_committed) { | 1163 | root->fs_info->last_trans_committed) { |
| @@ -1153,13 +1167,6 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
| 1153 | } | 1167 | } |
| 1154 | mutex_unlock(&root->fs_info->trans_mutex); | 1168 | mutex_unlock(&root->fs_info->trans_mutex); |
| 1155 | 1169 | ||
| 1156 | root->log_batch++; | ||
| 1157 | filemap_fdatawrite(inode->i_mapping); | ||
| 1158 | btrfs_wait_ordered_range(inode, 0, (u64)-1); | ||
| 1159 | root->log_batch++; | ||
| 1160 | |||
| 1161 | if (datasync && !(inode->i_state & I_DIRTY_PAGES)) | ||
| 1162 | goto out; | ||
| 1163 | /* | 1170 | /* |
| 1164 | * ok we haven't committed the transaction yet, lets do a commit | 1171 | * ok we haven't committed the transaction yet, lets do a commit |
| 1165 | */ | 1172 | */ |
| @@ -1188,14 +1195,18 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
| 1188 | */ | 1195 | */ |
| 1189 | mutex_unlock(&dentry->d_inode->i_mutex); | 1196 | mutex_unlock(&dentry->d_inode->i_mutex); |
| 1190 | 1197 | ||
| 1191 | if (ret > 0) { | 1198 | if (ret != BTRFS_NO_LOG_SYNC) { |
| 1192 | ret = btrfs_commit_transaction(trans, root); | 1199 | if (ret > 0) { |
| 1193 | } else { | ||
| 1194 | ret = btrfs_sync_log(trans, root); | ||
| 1195 | if (ret == 0) | ||
| 1196 | ret = btrfs_end_transaction(trans, root); | ||
| 1197 | else | ||
| 1198 | ret = btrfs_commit_transaction(trans, root); | 1200 | ret = btrfs_commit_transaction(trans, root); |
| 1201 | } else { | ||
| 1202 | ret = btrfs_sync_log(trans, root); | ||
| 1203 | if (ret == 0) | ||
| 1204 | ret = btrfs_end_transaction(trans, root); | ||
| 1205 | else | ||
| 1206 | ret = btrfs_commit_transaction(trans, root); | ||
| 1207 | } | ||
| 1208 | } else { | ||
| 1209 | ret = btrfs_end_transaction(trans, root); | ||
| 1199 | } | 1210 | } |
| 1200 | mutex_lock(&dentry->d_inode->i_mutex); | 1211 | mutex_lock(&dentry->d_inode->i_mutex); |
| 1201 | out: | 1212 | out: |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 9e138b793dc7..dae12dc7e159 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -3032,12 +3032,22 @@ static int btrfs_truncate_page(struct address_space *mapping, loff_t from) | |||
| 3032 | 3032 | ||
| 3033 | if ((offset & (blocksize - 1)) == 0) | 3033 | if ((offset & (blocksize - 1)) == 0) |
| 3034 | goto out; | 3034 | goto out; |
| 3035 | ret = btrfs_check_data_free_space(root, inode, PAGE_CACHE_SIZE); | ||
| 3036 | if (ret) | ||
| 3037 | goto out; | ||
| 3038 | |||
| 3039 | ret = btrfs_reserve_metadata_for_delalloc(root, inode, 1); | ||
| 3040 | if (ret) | ||
| 3041 | goto out; | ||
| 3035 | 3042 | ||
| 3036 | ret = -ENOMEM; | 3043 | ret = -ENOMEM; |
| 3037 | again: | 3044 | again: |
| 3038 | page = grab_cache_page(mapping, index); | 3045 | page = grab_cache_page(mapping, index); |
| 3039 | if (!page) | 3046 | if (!page) { |
| 3047 | btrfs_free_reserved_data_space(root, inode, PAGE_CACHE_SIZE); | ||
| 3048 | btrfs_unreserve_metadata_for_delalloc(root, inode, 1); | ||
| 3040 | goto out; | 3049 | goto out; |
| 3050 | } | ||
| 3041 | 3051 | ||
| 3042 | page_start = page_offset(page); | 3052 | page_start = page_offset(page); |
| 3043 | page_end = page_start + PAGE_CACHE_SIZE - 1; | 3053 | page_end = page_start + PAGE_CACHE_SIZE - 1; |
| @@ -3070,6 +3080,10 @@ again: | |||
| 3070 | goto again; | 3080 | goto again; |
| 3071 | } | 3081 | } |
| 3072 | 3082 | ||
| 3083 | clear_extent_bits(&BTRFS_I(inode)->io_tree, page_start, page_end, | ||
| 3084 | EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING, | ||
| 3085 | GFP_NOFS); | ||
| 3086 | |||
| 3073 | ret = btrfs_set_extent_delalloc(inode, page_start, page_end); | 3087 | ret = btrfs_set_extent_delalloc(inode, page_start, page_end); |
| 3074 | if (ret) { | 3088 | if (ret) { |
| 3075 | unlock_extent(io_tree, page_start, page_end, GFP_NOFS); | 3089 | unlock_extent(io_tree, page_start, page_end, GFP_NOFS); |
| @@ -3088,6 +3102,9 @@ again: | |||
| 3088 | unlock_extent(io_tree, page_start, page_end, GFP_NOFS); | 3102 | unlock_extent(io_tree, page_start, page_end, GFP_NOFS); |
| 3089 | 3103 | ||
| 3090 | out_unlock: | 3104 | out_unlock: |
| 3105 | if (ret) | ||
| 3106 | btrfs_free_reserved_data_space(root, inode, PAGE_CACHE_SIZE); | ||
| 3107 | btrfs_unreserve_metadata_for_delalloc(root, inode, 1); | ||
| 3091 | unlock_page(page); | 3108 | unlock_page(page); |
| 3092 | page_cache_release(page); | 3109 | page_cache_release(page); |
| 3093 | out: | 3110 | out: |
| @@ -3111,7 +3128,9 @@ int btrfs_cont_expand(struct inode *inode, loff_t size) | |||
| 3111 | if (size <= hole_start) | 3128 | if (size <= hole_start) |
| 3112 | return 0; | 3129 | return 0; |
| 3113 | 3130 | ||
| 3114 | btrfs_truncate_page(inode->i_mapping, inode->i_size); | 3131 | err = btrfs_truncate_page(inode->i_mapping, inode->i_size); |
| 3132 | if (err) | ||
| 3133 | return err; | ||
| 3115 | 3134 | ||
| 3116 | while (1) { | 3135 | while (1) { |
| 3117 | struct btrfs_ordered_extent *ordered; | 3136 | struct btrfs_ordered_extent *ordered; |
| @@ -3480,6 +3499,7 @@ static noinline void init_btrfs_i(struct inode *inode) | |||
| 3480 | bi->generation = 0; | 3499 | bi->generation = 0; |
| 3481 | bi->sequence = 0; | 3500 | bi->sequence = 0; |
| 3482 | bi->last_trans = 0; | 3501 | bi->last_trans = 0; |
| 3502 | bi->last_sub_trans = 0; | ||
| 3483 | bi->logged_trans = 0; | 3503 | bi->logged_trans = 0; |
| 3484 | bi->delalloc_bytes = 0; | 3504 | bi->delalloc_bytes = 0; |
| 3485 | bi->reserved_bytes = 0; | 3505 | bi->reserved_bytes = 0; |
| @@ -4980,7 +5000,9 @@ again: | |||
| 4980 | set_page_dirty(page); | 5000 | set_page_dirty(page); |
| 4981 | SetPageUptodate(page); | 5001 | SetPageUptodate(page); |
| 4982 | 5002 | ||
| 4983 | BTRFS_I(inode)->last_trans = root->fs_info->generation + 1; | 5003 | BTRFS_I(inode)->last_trans = root->fs_info->generation; |
| 5004 | BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid; | ||
| 5005 | |||
| 4984 | unlock_extent(io_tree, page_start, page_end, GFP_NOFS); | 5006 | unlock_extent(io_tree, page_start, page_end, GFP_NOFS); |
| 4985 | 5007 | ||
| 4986 | out_unlock: | 5008 | out_unlock: |
| @@ -5005,7 +5027,9 @@ static void btrfs_truncate(struct inode *inode) | |||
| 5005 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) | 5027 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) |
| 5006 | return; | 5028 | return; |
| 5007 | 5029 | ||
| 5008 | btrfs_truncate_page(inode->i_mapping, inode->i_size); | 5030 | ret = btrfs_truncate_page(inode->i_mapping, inode->i_size); |
| 5031 | if (ret) | ||
| 5032 | return; | ||
| 5009 | btrfs_wait_ordered_range(inode, inode->i_size & (~mask), (u64)-1); | 5033 | btrfs_wait_ordered_range(inode, inode->i_size & (~mask), (u64)-1); |
| 5010 | 5034 | ||
| 5011 | trans = btrfs_start_transaction(root, 1); | 5035 | trans = btrfs_start_transaction(root, 1); |
| @@ -5100,6 +5124,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb) | |||
| 5100 | if (!ei) | 5124 | if (!ei) |
| 5101 | return NULL; | 5125 | return NULL; |
| 5102 | ei->last_trans = 0; | 5126 | ei->last_trans = 0; |
| 5127 | ei->last_sub_trans = 0; | ||
| 5103 | ei->logged_trans = 0; | 5128 | ei->logged_trans = 0; |
| 5104 | ei->outstanding_extents = 0; | 5129 | ei->outstanding_extents = 0; |
| 5105 | ei->reserved_extents = 0; | 5130 | ei->reserved_extents = 0; |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 9de9b2236419..752a5463bf53 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -66,7 +66,8 @@ enum { | |||
| 66 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, | 66 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, |
| 67 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, | 67 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, |
| 68 | Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, | 68 | Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, |
| 69 | Opt_compress, Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_err, | 69 | Opt_compress, Opt_notreelog, Opt_ratio, Opt_flushoncommit, |
| 70 | Opt_discard, Opt_err, | ||
| 70 | }; | 71 | }; |
| 71 | 72 | ||
| 72 | static match_table_t tokens = { | 73 | static match_table_t tokens = { |
| @@ -88,6 +89,7 @@ static match_table_t tokens = { | |||
| 88 | {Opt_notreelog, "notreelog"}, | 89 | {Opt_notreelog, "notreelog"}, |
| 89 | {Opt_flushoncommit, "flushoncommit"}, | 90 | {Opt_flushoncommit, "flushoncommit"}, |
| 90 | {Opt_ratio, "metadata_ratio=%d"}, | 91 | {Opt_ratio, "metadata_ratio=%d"}, |
| 92 | {Opt_discard, "discard"}, | ||
| 91 | {Opt_err, NULL}, | 93 | {Opt_err, NULL}, |
| 92 | }; | 94 | }; |
| 93 | 95 | ||
| @@ -257,6 +259,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
| 257 | info->metadata_ratio); | 259 | info->metadata_ratio); |
| 258 | } | 260 | } |
| 259 | break; | 261 | break; |
| 262 | case Opt_discard: | ||
| 263 | btrfs_set_opt(info->mount_opt, DISCARD); | ||
| 264 | break; | ||
| 260 | default: | 265 | default: |
| 261 | break; | 266 | break; |
| 262 | } | 267 | } |
| @@ -344,7 +349,7 @@ static int btrfs_fill_super(struct super_block *sb, | |||
| 344 | sb->s_export_op = &btrfs_export_ops; | 349 | sb->s_export_op = &btrfs_export_ops; |
| 345 | sb->s_xattr = btrfs_xattr_handlers; | 350 | sb->s_xattr = btrfs_xattr_handlers; |
| 346 | sb->s_time_gran = 1; | 351 | sb->s_time_gran = 1; |
| 347 | #ifdef CONFIG_BTRFS_POSIX_ACL | 352 | #ifdef CONFIG_BTRFS_FS_POSIX_ACL |
| 348 | sb->s_flags |= MS_POSIXACL; | 353 | sb->s_flags |= MS_POSIXACL; |
| 349 | #endif | 354 | #endif |
| 350 | 355 | ||
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 0b8f36d4400a..bca82a4ca8e6 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
| @@ -344,10 +344,10 @@ int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans, | |||
| 344 | /* | 344 | /* |
| 345 | * when btree blocks are allocated, they have some corresponding bits set for | 345 | * when btree blocks are allocated, they have some corresponding bits set for |
| 346 | * them in one of two extent_io trees. This is used to make sure all of | 346 | * them in one of two extent_io trees. This is used to make sure all of |
| 347 | * those extents are on disk for transaction or log commit | 347 | * those extents are sent to disk but does not wait on them |
| 348 | */ | 348 | */ |
| 349 | int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, | 349 | int btrfs_write_marked_extents(struct btrfs_root *root, |
| 350 | struct extent_io_tree *dirty_pages) | 350 | struct extent_io_tree *dirty_pages) |
| 351 | { | 351 | { |
| 352 | int ret; | 352 | int ret; |
| 353 | int err = 0; | 353 | int err = 0; |
| @@ -394,6 +394,29 @@ int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, | |||
| 394 | page_cache_release(page); | 394 | page_cache_release(page); |
| 395 | } | 395 | } |
| 396 | } | 396 | } |
| 397 | if (err) | ||
| 398 | werr = err; | ||
| 399 | return werr; | ||
| 400 | } | ||
| 401 | |||
| 402 | /* | ||
| 403 | * when btree blocks are allocated, they have some corresponding bits set for | ||
| 404 | * them in one of two extent_io trees. This is used to make sure all of | ||
| 405 | * those extents are on disk for transaction or log commit. We wait | ||
| 406 | * on all the pages and clear them from the dirty pages state tree | ||
| 407 | */ | ||
| 408 | int btrfs_wait_marked_extents(struct btrfs_root *root, | ||
| 409 | struct extent_io_tree *dirty_pages) | ||
| 410 | { | ||
| 411 | int ret; | ||
| 412 | int err = 0; | ||
| 413 | int werr = 0; | ||
| 414 | struct page *page; | ||
| 415 | struct inode *btree_inode = root->fs_info->btree_inode; | ||
| 416 | u64 start = 0; | ||
| 417 | u64 end; | ||
| 418 | unsigned long index; | ||
| 419 | |||
| 397 | while (1) { | 420 | while (1) { |
| 398 | ret = find_first_extent_bit(dirty_pages, 0, &start, &end, | 421 | ret = find_first_extent_bit(dirty_pages, 0, &start, &end, |
| 399 | EXTENT_DIRTY); | 422 | EXTENT_DIRTY); |
| @@ -424,6 +447,22 @@ int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, | |||
| 424 | return werr; | 447 | return werr; |
| 425 | } | 448 | } |
| 426 | 449 | ||
| 450 | /* | ||
| 451 | * when btree blocks are allocated, they have some corresponding bits set for | ||
| 452 | * them in one of two extent_io trees. This is used to make sure all of | ||
| 453 | * those extents are on disk for transaction or log commit | ||
| 454 | */ | ||
| 455 | int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, | ||
| 456 | struct extent_io_tree *dirty_pages) | ||
| 457 | { | ||
| 458 | int ret; | ||
| 459 | int ret2; | ||
| 460 | |||
| 461 | ret = btrfs_write_marked_extents(root, dirty_pages); | ||
| 462 | ret2 = btrfs_wait_marked_extents(root, dirty_pages); | ||
| 463 | return ret || ret2; | ||
| 464 | } | ||
| 465 | |||
| 427 | int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, | 466 | int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, |
| 428 | struct btrfs_root *root) | 467 | struct btrfs_root *root) |
| 429 | { | 468 | { |
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h index 663c67404918..d4e3e7a6938c 100644 --- a/fs/btrfs/transaction.h +++ b/fs/btrfs/transaction.h | |||
| @@ -79,6 +79,7 @@ static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans, | |||
| 79 | struct inode *inode) | 79 | struct inode *inode) |
| 80 | { | 80 | { |
| 81 | BTRFS_I(inode)->last_trans = trans->transaction->transid; | 81 | BTRFS_I(inode)->last_trans = trans->transaction->transid; |
| 82 | BTRFS_I(inode)->last_sub_trans = BTRFS_I(inode)->root->log_transid; | ||
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, | 85 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, |
| @@ -107,5 +108,9 @@ int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans, | |||
| 107 | struct btrfs_root *root); | 108 | struct btrfs_root *root); |
| 108 | int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, | 109 | int btrfs_write_and_wait_marked_extents(struct btrfs_root *root, |
| 109 | struct extent_io_tree *dirty_pages); | 110 | struct extent_io_tree *dirty_pages); |
| 111 | int btrfs_write_marked_extents(struct btrfs_root *root, | ||
| 112 | struct extent_io_tree *dirty_pages); | ||
| 113 | int btrfs_wait_marked_extents(struct btrfs_root *root, | ||
| 114 | struct extent_io_tree *dirty_pages); | ||
| 110 | int btrfs_transaction_in_commit(struct btrfs_fs_info *info); | 115 | int btrfs_transaction_in_commit(struct btrfs_fs_info *info); |
| 111 | #endif | 116 | #endif |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 4edfdc2acc5f..741666a7676a 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
| @@ -1980,6 +1980,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
| 1980 | int ret; | 1980 | int ret; |
| 1981 | struct btrfs_root *log = root->log_root; | 1981 | struct btrfs_root *log = root->log_root; |
| 1982 | struct btrfs_root *log_root_tree = root->fs_info->log_root_tree; | 1982 | struct btrfs_root *log_root_tree = root->fs_info->log_root_tree; |
| 1983 | u64 log_transid = 0; | ||
| 1983 | 1984 | ||
| 1984 | mutex_lock(&root->log_mutex); | 1985 | mutex_lock(&root->log_mutex); |
| 1985 | index1 = root->log_transid % 2; | 1986 | index1 = root->log_transid % 2; |
| @@ -1994,12 +1995,13 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
| 1994 | if (atomic_read(&root->log_commit[(index1 + 1) % 2])) | 1995 | if (atomic_read(&root->log_commit[(index1 + 1) % 2])) |
| 1995 | wait_log_commit(trans, root, root->log_transid - 1); | 1996 | wait_log_commit(trans, root, root->log_transid - 1); |
| 1996 | 1997 | ||
| 1997 | while (root->log_multiple_pids) { | 1998 | while (1) { |
| 1998 | unsigned long batch = root->log_batch; | 1999 | unsigned long batch = root->log_batch; |
| 1999 | mutex_unlock(&root->log_mutex); | 2000 | if (root->log_multiple_pids) { |
| 2000 | schedule_timeout_uninterruptible(1); | 2001 | mutex_unlock(&root->log_mutex); |
| 2001 | mutex_lock(&root->log_mutex); | 2002 | schedule_timeout_uninterruptible(1); |
| 2002 | 2003 | mutex_lock(&root->log_mutex); | |
| 2004 | } | ||
| 2003 | wait_for_writer(trans, root); | 2005 | wait_for_writer(trans, root); |
| 2004 | if (batch == root->log_batch) | 2006 | if (batch == root->log_batch) |
| 2005 | break; | 2007 | break; |
| @@ -2012,12 +2014,16 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
| 2012 | goto out; | 2014 | goto out; |
| 2013 | } | 2015 | } |
| 2014 | 2016 | ||
| 2015 | ret = btrfs_write_and_wait_marked_extents(log, &log->dirty_log_pages); | 2017 | /* we start IO on all the marked extents here, but we don't actually |
| 2018 | * wait for them until later. | ||
| 2019 | */ | ||
| 2020 | ret = btrfs_write_marked_extents(log, &log->dirty_log_pages); | ||
| 2016 | BUG_ON(ret); | 2021 | BUG_ON(ret); |
| 2017 | 2022 | ||
| 2018 | btrfs_set_root_node(&log->root_item, log->node); | 2023 | btrfs_set_root_node(&log->root_item, log->node); |
| 2019 | 2024 | ||
| 2020 | root->log_batch = 0; | 2025 | root->log_batch = 0; |
| 2026 | log_transid = root->log_transid; | ||
| 2021 | root->log_transid++; | 2027 | root->log_transid++; |
| 2022 | log->log_transid = root->log_transid; | 2028 | log->log_transid = root->log_transid; |
| 2023 | root->log_start_pid = 0; | 2029 | root->log_start_pid = 0; |
| @@ -2046,6 +2052,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
| 2046 | 2052 | ||
| 2047 | index2 = log_root_tree->log_transid % 2; | 2053 | index2 = log_root_tree->log_transid % 2; |
| 2048 | if (atomic_read(&log_root_tree->log_commit[index2])) { | 2054 | if (atomic_read(&log_root_tree->log_commit[index2])) { |
| 2055 | btrfs_wait_marked_extents(log, &log->dirty_log_pages); | ||
| 2049 | wait_log_commit(trans, log_root_tree, | 2056 | wait_log_commit(trans, log_root_tree, |
| 2050 | log_root_tree->log_transid); | 2057 | log_root_tree->log_transid); |
| 2051 | mutex_unlock(&log_root_tree->log_mutex); | 2058 | mutex_unlock(&log_root_tree->log_mutex); |
| @@ -2065,6 +2072,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
| 2065 | * check the full commit flag again | 2072 | * check the full commit flag again |
| 2066 | */ | 2073 | */ |
| 2067 | if (root->fs_info->last_trans_log_full_commit == trans->transid) { | 2074 | if (root->fs_info->last_trans_log_full_commit == trans->transid) { |
| 2075 | btrfs_wait_marked_extents(log, &log->dirty_log_pages); | ||
| 2068 | mutex_unlock(&log_root_tree->log_mutex); | 2076 | mutex_unlock(&log_root_tree->log_mutex); |
| 2069 | ret = -EAGAIN; | 2077 | ret = -EAGAIN; |
| 2070 | goto out_wake_log_root; | 2078 | goto out_wake_log_root; |
| @@ -2073,6 +2081,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
| 2073 | ret = btrfs_write_and_wait_marked_extents(log_root_tree, | 2081 | ret = btrfs_write_and_wait_marked_extents(log_root_tree, |
| 2074 | &log_root_tree->dirty_log_pages); | 2082 | &log_root_tree->dirty_log_pages); |
| 2075 | BUG_ON(ret); | 2083 | BUG_ON(ret); |
| 2084 | btrfs_wait_marked_extents(log, &log->dirty_log_pages); | ||
| 2076 | 2085 | ||
| 2077 | btrfs_set_super_log_root(&root->fs_info->super_for_commit, | 2086 | btrfs_set_super_log_root(&root->fs_info->super_for_commit, |
| 2078 | log_root_tree->node->start); | 2087 | log_root_tree->node->start); |
| @@ -2092,9 +2101,14 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
| 2092 | * the running transaction open, so a full commit can't hop | 2101 | * the running transaction open, so a full commit can't hop |
| 2093 | * in and cause problems either. | 2102 | * in and cause problems either. |
| 2094 | */ | 2103 | */ |
| 2095 | write_ctree_super(trans, root->fs_info->tree_root, 2); | 2104 | write_ctree_super(trans, root->fs_info->tree_root, 1); |
| 2096 | ret = 0; | 2105 | ret = 0; |
| 2097 | 2106 | ||
| 2107 | mutex_lock(&root->log_mutex); | ||
| 2108 | if (root->last_log_commit < log_transid) | ||
| 2109 | root->last_log_commit = log_transid; | ||
| 2110 | mutex_unlock(&root->log_mutex); | ||
| 2111 | |||
| 2098 | out_wake_log_root: | 2112 | out_wake_log_root: |
| 2099 | atomic_set(&log_root_tree->log_commit[index2], 0); | 2113 | atomic_set(&log_root_tree->log_commit[index2], 0); |
| 2100 | smp_mb(); | 2114 | smp_mb(); |
| @@ -2862,6 +2876,21 @@ out: | |||
| 2862 | return ret; | 2876 | return ret; |
| 2863 | } | 2877 | } |
| 2864 | 2878 | ||
| 2879 | static int inode_in_log(struct btrfs_trans_handle *trans, | ||
| 2880 | struct inode *inode) | ||
| 2881 | { | ||
| 2882 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
| 2883 | int ret = 0; | ||
| 2884 | |||
| 2885 | mutex_lock(&root->log_mutex); | ||
| 2886 | if (BTRFS_I(inode)->logged_trans == trans->transid && | ||
| 2887 | BTRFS_I(inode)->last_sub_trans <= root->last_log_commit) | ||
| 2888 | ret = 1; | ||
| 2889 | mutex_unlock(&root->log_mutex); | ||
| 2890 | return ret; | ||
| 2891 | } | ||
| 2892 | |||
| 2893 | |||
| 2865 | /* | 2894 | /* |
| 2866 | * helper function around btrfs_log_inode to make sure newly created | 2895 | * helper function around btrfs_log_inode to make sure newly created |
| 2867 | * parent directories also end up in the log. A minimal inode and backref | 2896 | * parent directories also end up in the log. A minimal inode and backref |
| @@ -2901,6 +2930,11 @@ int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
| 2901 | if (ret) | 2930 | if (ret) |
| 2902 | goto end_no_trans; | 2931 | goto end_no_trans; |
| 2903 | 2932 | ||
| 2933 | if (inode_in_log(trans, inode)) { | ||
| 2934 | ret = BTRFS_NO_LOG_SYNC; | ||
| 2935 | goto end_no_trans; | ||
| 2936 | } | ||
| 2937 | |||
| 2904 | start_log_trans(trans, root); | 2938 | start_log_trans(trans, root); |
| 2905 | 2939 | ||
| 2906 | ret = btrfs_log_inode(trans, root, inode, inode_only); | 2940 | ret = btrfs_log_inode(trans, root, inode, inode_only); |
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h index d09c7609e16b..0776eacb5083 100644 --- a/fs/btrfs/tree-log.h +++ b/fs/btrfs/tree-log.h | |||
| @@ -19,6 +19,9 @@ | |||
| 19 | #ifndef __TREE_LOG_ | 19 | #ifndef __TREE_LOG_ |
| 20 | #define __TREE_LOG_ | 20 | #define __TREE_LOG_ |
| 21 | 21 | ||
| 22 | /* return value for btrfs_log_dentry_safe that means we don't need to log it at all */ | ||
| 23 | #define BTRFS_NO_LOG_SYNC 256 | ||
| 24 | |||
| 22 | int btrfs_sync_log(struct btrfs_trans_handle *trans, | 25 | int btrfs_sync_log(struct btrfs_trans_handle *trans, |
| 23 | struct btrfs_root *root); | 26 | struct btrfs_root *root); |
| 24 | int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root); | 27 | int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root); |
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index b0fc93f95fd0..b6dd5967c48a 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c | |||
| @@ -260,7 +260,7 @@ err: | |||
| 260 | * attributes are handled directly. | 260 | * attributes are handled directly. |
| 261 | */ | 261 | */ |
| 262 | struct xattr_handler *btrfs_xattr_handlers[] = { | 262 | struct xattr_handler *btrfs_xattr_handlers[] = { |
| 263 | #ifdef CONFIG_BTRFS_POSIX_ACL | 263 | #ifdef CONFIG_BTRFS_FS_POSIX_ACL |
| 264 | &btrfs_xattr_acl_access_handler, | 264 | &btrfs_xattr_acl_access_handler, |
| 265 | &btrfs_xattr_acl_default_handler, | 265 | &btrfs_xattr_acl_default_handler, |
| 266 | #endif | 266 | #endif |
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 240cef14fe58..70736eb4b516 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
| @@ -316,6 +316,10 @@ int dlm_lowcomms_connect_node(int nodeid) | |||
| 316 | { | 316 | { |
| 317 | struct connection *con; | 317 | struct connection *con; |
| 318 | 318 | ||
| 319 | /* with sctp there's no connecting without sending */ | ||
| 320 | if (dlm_config.ci_protocol != 0) | ||
| 321 | return 0; | ||
| 322 | |||
| 319 | if (nodeid == dlm_our_nodeid()) | 323 | if (nodeid == dlm_our_nodeid()) |
| 320 | return 0; | 324 | return 0; |
| 321 | 325 | ||
| @@ -455,9 +459,9 @@ static void process_sctp_notification(struct connection *con, | |||
| 455 | int prim_len, ret; | 459 | int prim_len, ret; |
| 456 | int addr_len; | 460 | int addr_len; |
| 457 | struct connection *new_con; | 461 | struct connection *new_con; |
| 458 | struct file *file; | ||
| 459 | sctp_peeloff_arg_t parg; | 462 | sctp_peeloff_arg_t parg; |
| 460 | int parglen = sizeof(parg); | 463 | int parglen = sizeof(parg); |
| 464 | int err; | ||
| 461 | 465 | ||
| 462 | /* | 466 | /* |
| 463 | * We get this before any data for an association. | 467 | * We get this before any data for an association. |
| @@ -512,19 +516,22 @@ static void process_sctp_notification(struct connection *con, | |||
| 512 | ret = kernel_getsockopt(con->sock, IPPROTO_SCTP, | 516 | ret = kernel_getsockopt(con->sock, IPPROTO_SCTP, |
| 513 | SCTP_SOCKOPT_PEELOFF, | 517 | SCTP_SOCKOPT_PEELOFF, |
| 514 | (void *)&parg, &parglen); | 518 | (void *)&parg, &parglen); |
| 515 | if (ret) { | 519 | if (ret < 0) { |
| 516 | log_print("Can't peel off a socket for " | 520 | log_print("Can't peel off a socket for " |
| 517 | "connection %d to node %d: err=%d\n", | 521 | "connection %d to node %d: err=%d", |
| 518 | parg.associd, nodeid, ret); | 522 | parg.associd, nodeid, ret); |
| 523 | return; | ||
| 524 | } | ||
| 525 | new_con->sock = sockfd_lookup(parg.sd, &err); | ||
| 526 | if (!new_con->sock) { | ||
| 527 | log_print("sockfd_lookup error %d", err); | ||
| 528 | return; | ||
| 519 | } | 529 | } |
| 520 | file = fget(parg.sd); | ||
| 521 | new_con->sock = SOCKET_I(file->f_dentry->d_inode); | ||
| 522 | add_sock(new_con->sock, new_con); | 530 | add_sock(new_con->sock, new_con); |
| 523 | fput(file); | 531 | sockfd_put(new_con->sock); |
| 524 | put_unused_fd(parg.sd); | ||
| 525 | 532 | ||
| 526 | log_print("got new/restarted association %d nodeid %d", | 533 | log_print("connecting to %d sctp association %d", |
| 527 | (int)sn->sn_assoc_change.sac_assoc_id, nodeid); | 534 | nodeid, (int)sn->sn_assoc_change.sac_assoc_id); |
| 528 | 535 | ||
| 529 | /* Send any pending writes */ | 536 | /* Send any pending writes */ |
| 530 | clear_bit(CF_CONNECT_PENDING, &new_con->flags); | 537 | clear_bit(CF_CONNECT_PENDING, &new_con->flags); |
| @@ -837,8 +844,6 @@ static void sctp_init_assoc(struct connection *con) | |||
| 837 | if (con->retries++ > MAX_CONNECT_RETRIES) | 844 | if (con->retries++ > MAX_CONNECT_RETRIES) |
| 838 | return; | 845 | return; |
| 839 | 846 | ||
| 840 | log_print("Initiating association with node %d", con->nodeid); | ||
| 841 | |||
| 842 | if (nodeid_to_addr(con->nodeid, (struct sockaddr *)&rem_addr)) { | 847 | if (nodeid_to_addr(con->nodeid, (struct sockaddr *)&rem_addr)) { |
| 843 | log_print("no address for nodeid %d", con->nodeid); | 848 | log_print("no address for nodeid %d", con->nodeid); |
| 844 | return; | 849 | return; |
| @@ -855,11 +860,14 @@ static void sctp_init_assoc(struct connection *con) | |||
| 855 | outmessage.msg_flags = MSG_EOR; | 860 | outmessage.msg_flags = MSG_EOR; |
| 856 | 861 | ||
| 857 | spin_lock(&con->writequeue_lock); | 862 | spin_lock(&con->writequeue_lock); |
| 858 | e = list_entry(con->writequeue.next, struct writequeue_entry, | ||
| 859 | list); | ||
| 860 | 863 | ||
| 861 | BUG_ON((struct list_head *) e == &con->writequeue); | 864 | if (list_empty(&con->writequeue)) { |
| 865 | spin_unlock(&con->writequeue_lock); | ||
| 866 | log_print("writequeue empty for nodeid %d", con->nodeid); | ||
| 867 | return; | ||
| 868 | } | ||
| 862 | 869 | ||
| 870 | e = list_first_entry(&con->writequeue, struct writequeue_entry, list); | ||
| 863 | len = e->len; | 871 | len = e->len; |
| 864 | offset = e->offset; | 872 | offset = e->offset; |
| 865 | spin_unlock(&con->writequeue_lock); | 873 | spin_unlock(&con->writequeue_lock); |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 72743d360509..7a520a862f49 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
| @@ -2321,7 +2321,18 @@ static int ext3_commit_super(struct super_block *sb, | |||
| 2321 | 2321 | ||
| 2322 | if (!sbh) | 2322 | if (!sbh) |
| 2323 | return error; | 2323 | return error; |
| 2324 | es->s_wtime = cpu_to_le32(get_seconds()); | 2324 | /* |
| 2325 | * If the file system is mounted read-only, don't update the | ||
| 2326 | * superblock write time. This avoids updating the superblock | ||
| 2327 | * write time when we are mounting the root file system | ||
| 2328 | * read/only but we need to replay the journal; at that point, | ||
| 2329 | * for people who are east of GMT and who make their clock | ||
| 2330 | * tick in localtime for Windows bug-for-bug compatibility, | ||
| 2331 | * the clock is set in the future, and this will cause e2fsck | ||
| 2332 | * to complain and force a full file system check. | ||
| 2333 | */ | ||
| 2334 | if (!(sb->s_flags & MS_RDONLY)) | ||
| 2335 | es->s_wtime = cpu_to_le32(get_seconds()); | ||
| 2325 | es->s_free_blocks_count = cpu_to_le32(ext3_count_free_blocks(sb)); | 2336 | es->s_free_blocks_count = cpu_to_le32(ext3_count_free_blocks(sb)); |
| 2326 | es->s_free_inodes_count = cpu_to_le32(ext3_count_free_inodes(sb)); | 2337 | es->s_free_inodes_count = cpu_to_le32(ext3_count_free_inodes(sb)); |
| 2327 | BUFFER_TRACE(sbh, "marking dirty"); | 2338 | BUFFER_TRACE(sbh, "marking dirty"); |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 6dabf6feec94..90be551b80c1 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
| @@ -1253,6 +1253,7 @@ static int nfs_parse_mount_options(char *raw, | |||
| 1253 | default: | 1253 | default: |
| 1254 | dfprintk(MOUNT, "NFS: unrecognized " | 1254 | dfprintk(MOUNT, "NFS: unrecognized " |
| 1255 | "transport protocol\n"); | 1255 | "transport protocol\n"); |
| 1256 | kfree(string); | ||
| 1256 | return 0; | 1257 | return 0; |
| 1257 | } | 1258 | } |
| 1258 | break; | 1259 | break; |
| @@ -1848,8 +1849,8 @@ nfs_compare_remount_data(struct nfs_server *nfss, | |||
| 1848 | data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || | 1849 | data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || |
| 1849 | data->nfs_server.port != nfss->port || | 1850 | data->nfs_server.port != nfss->port || |
| 1850 | data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || | 1851 | data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || |
| 1851 | !rpc_cmp_addr(&data->nfs_server.address, | 1852 | !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address, |
| 1852 | &nfss->nfs_client->cl_addr)) | 1853 | (struct sockaddr *)&nfss->nfs_client->cl_addr)) |
| 1853 | return -EINVAL; | 1854 | return -EINVAL; |
| 1854 | 1855 | ||
| 1855 | return 0; | 1856 | return 0; |
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c index 828a889be909..7e54e52964dd 100644 --- a/fs/notify/dnotify/dnotify.c +++ b/fs/notify/dnotify/dnotify.c | |||
| @@ -91,6 +91,7 @@ static int dnotify_handle_event(struct fsnotify_group *group, | |||
| 91 | struct dnotify_struct *dn; | 91 | struct dnotify_struct *dn; |
| 92 | struct dnotify_struct **prev; | 92 | struct dnotify_struct **prev; |
| 93 | struct fown_struct *fown; | 93 | struct fown_struct *fown; |
| 94 | __u32 test_mask = event->mask & ~FS_EVENT_ON_CHILD; | ||
| 94 | 95 | ||
| 95 | to_tell = event->to_tell; | 96 | to_tell = event->to_tell; |
| 96 | 97 | ||
| @@ -106,7 +107,7 @@ static int dnotify_handle_event(struct fsnotify_group *group, | |||
| 106 | spin_lock(&entry->lock); | 107 | spin_lock(&entry->lock); |
| 107 | prev = &dnentry->dn; | 108 | prev = &dnentry->dn; |
| 108 | while ((dn = *prev) != NULL) { | 109 | while ((dn = *prev) != NULL) { |
| 109 | if ((dn->dn_mask & event->mask) == 0) { | 110 | if ((dn->dn_mask & test_mask) == 0) { |
| 110 | prev = &dn->dn_next; | 111 | prev = &dn->dn_next; |
| 111 | continue; | 112 | continue; |
| 112 | } | 113 | } |
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c index c8a07c65482b..3165d85aada2 100644 --- a/fs/notify/inode_mark.c +++ b/fs/notify/inode_mark.c | |||
| @@ -324,11 +324,11 @@ int fsnotify_add_mark(struct fsnotify_mark_entry *entry, | |||
| 324 | spin_lock(&group->mark_lock); | 324 | spin_lock(&group->mark_lock); |
| 325 | spin_lock(&inode->i_lock); | 325 | spin_lock(&inode->i_lock); |
| 326 | 326 | ||
| 327 | entry->group = group; | ||
| 328 | entry->inode = inode; | ||
| 329 | |||
| 330 | lentry = fsnotify_find_mark_entry(group, inode); | 327 | lentry = fsnotify_find_mark_entry(group, inode); |
| 331 | if (!lentry) { | 328 | if (!lentry) { |
| 329 | entry->group = group; | ||
| 330 | entry->inode = inode; | ||
| 331 | |||
| 332 | hlist_add_head(&entry->i_list, &inode->i_fsnotify_mark_entries); | 332 | hlist_add_head(&entry->i_list, &inode->i_fsnotify_mark_entries); |
| 333 | list_add(&entry->g_list, &group->mark_entries); | 333 | list_add(&entry->g_list, &group->mark_entries); |
| 334 | 334 | ||
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index 3816d5750dd5..b8bf53b4c108 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c | |||
| @@ -143,7 +143,7 @@ static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new | |||
| 143 | /* remember, after old was put on the wait_q we aren't | 143 | /* remember, after old was put on the wait_q we aren't |
| 144 | * allowed to look at the inode any more, only thing | 144 | * allowed to look at the inode any more, only thing |
| 145 | * left to check was if the file_name is the same */ | 145 | * left to check was if the file_name is the same */ |
| 146 | if (old->name_len && | 146 | if (!old->name_len || |
| 147 | !strcmp(old->file_name, new->file_name)) | 147 | !strcmp(old->file_name, new->file_name)) |
| 148 | return true; | 148 | return true; |
| 149 | break; | 149 | break; |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index f38fee0311a7..7b685e10cbad 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
| @@ -248,11 +248,19 @@ ssize_t part_stat_show(struct device *dev, | |||
| 248 | part_stat_read(p, merges[WRITE]), | 248 | part_stat_read(p, merges[WRITE]), |
| 249 | (unsigned long long)part_stat_read(p, sectors[WRITE]), | 249 | (unsigned long long)part_stat_read(p, sectors[WRITE]), |
| 250 | jiffies_to_msecs(part_stat_read(p, ticks[WRITE])), | 250 | jiffies_to_msecs(part_stat_read(p, ticks[WRITE])), |
| 251 | p->in_flight, | 251 | part_in_flight(p), |
| 252 | jiffies_to_msecs(part_stat_read(p, io_ticks)), | 252 | jiffies_to_msecs(part_stat_read(p, io_ticks)), |
| 253 | jiffies_to_msecs(part_stat_read(p, time_in_queue))); | 253 | jiffies_to_msecs(part_stat_read(p, time_in_queue))); |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | ssize_t part_inflight_show(struct device *dev, | ||
| 257 | struct device_attribute *attr, char *buf) | ||
| 258 | { | ||
| 259 | struct hd_struct *p = dev_to_part(dev); | ||
| 260 | |||
| 261 | return sprintf(buf, "%8u %8u\n", p->in_flight[0], p->in_flight[1]); | ||
| 262 | } | ||
| 263 | |||
| 256 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 264 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
| 257 | ssize_t part_fail_show(struct device *dev, | 265 | ssize_t part_fail_show(struct device *dev, |
| 258 | struct device_attribute *attr, char *buf) | 266 | struct device_attribute *attr, char *buf) |
| @@ -281,6 +289,7 @@ static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL); | |||
| 281 | static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); | 289 | static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); |
| 282 | static DEVICE_ATTR(alignment_offset, S_IRUGO, part_alignment_offset_show, NULL); | 290 | static DEVICE_ATTR(alignment_offset, S_IRUGO, part_alignment_offset_show, NULL); |
| 283 | static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); | 291 | static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); |
| 292 | static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL); | ||
| 284 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 293 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
| 285 | static struct device_attribute dev_attr_fail = | 294 | static struct device_attribute dev_attr_fail = |
| 286 | __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); | 295 | __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); |
| @@ -292,6 +301,7 @@ static struct attribute *part_attrs[] = { | |||
| 292 | &dev_attr_size.attr, | 301 | &dev_attr_size.attr, |
| 293 | &dev_attr_alignment_offset.attr, | 302 | &dev_attr_alignment_offset.attr, |
| 294 | &dev_attr_stat.attr, | 303 | &dev_attr_stat.attr, |
| 304 | &dev_attr_inflight.attr, | ||
| 295 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 305 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
| 296 | &dev_attr_fail.attr, | 306 | &dev_attr_fail.attr, |
| 297 | #endif | 307 | #endif |
| @@ -777,36 +777,55 @@ pipe_rdwr_release(struct inode *inode, struct file *filp) | |||
| 777 | static int | 777 | static int |
| 778 | pipe_read_open(struct inode *inode, struct file *filp) | 778 | pipe_read_open(struct inode *inode, struct file *filp) |
| 779 | { | 779 | { |
| 780 | /* We could have perhaps used atomic_t, but this and friends | 780 | int ret = -ENOENT; |
| 781 | below are the only places. So it doesn't seem worthwhile. */ | 781 | |
| 782 | mutex_lock(&inode->i_mutex); | 782 | mutex_lock(&inode->i_mutex); |
| 783 | inode->i_pipe->readers++; | 783 | |
| 784 | if (inode->i_pipe) { | ||
| 785 | ret = 0; | ||
| 786 | inode->i_pipe->readers++; | ||
| 787 | } | ||
| 788 | |||
| 784 | mutex_unlock(&inode->i_mutex); | 789 | mutex_unlock(&inode->i_mutex); |
| 785 | 790 | ||
| 786 | return 0; | 791 | return ret; |
| 787 | } | 792 | } |
| 788 | 793 | ||
| 789 | static int | 794 | static int |
| 790 | pipe_write_open(struct inode *inode, struct file *filp) | 795 | pipe_write_open(struct inode *inode, struct file *filp) |
| 791 | { | 796 | { |
| 797 | int ret = -ENOENT; | ||
| 798 | |||
| 792 | mutex_lock(&inode->i_mutex); | 799 | mutex_lock(&inode->i_mutex); |
| 793 | inode->i_pipe->writers++; | 800 | |
| 801 | if (inode->i_pipe) { | ||
| 802 | ret = 0; | ||
| 803 | inode->i_pipe->writers++; | ||
| 804 | } | ||
| 805 | |||
| 794 | mutex_unlock(&inode->i_mutex); | 806 | mutex_unlock(&inode->i_mutex); |
| 795 | 807 | ||
| 796 | return 0; | 808 | return ret; |
| 797 | } | 809 | } |
| 798 | 810 | ||
| 799 | static int | 811 | static int |
| 800 | pipe_rdwr_open(struct inode *inode, struct file *filp) | 812 | pipe_rdwr_open(struct inode *inode, struct file *filp) |
| 801 | { | 813 | { |
| 814 | int ret = -ENOENT; | ||
| 815 | |||
| 802 | mutex_lock(&inode->i_mutex); | 816 | mutex_lock(&inode->i_mutex); |
| 803 | if (filp->f_mode & FMODE_READ) | 817 | |
| 804 | inode->i_pipe->readers++; | 818 | if (inode->i_pipe) { |
| 805 | if (filp->f_mode & FMODE_WRITE) | 819 | ret = 0; |
| 806 | inode->i_pipe->writers++; | 820 | if (filp->f_mode & FMODE_READ) |
| 821 | inode->i_pipe->readers++; | ||
| 822 | if (filp->f_mode & FMODE_WRITE) | ||
| 823 | inode->i_pipe->writers++; | ||
| 824 | } | ||
| 825 | |||
| 807 | mutex_unlock(&inode->i_mutex); | 826 | mutex_unlock(&inode->i_mutex); |
| 808 | 827 | ||
| 809 | return 0; | 828 | return ret; |
| 810 | } | 829 | } |
| 811 | 830 | ||
| 812 | /* | 831 | /* |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 0050fc40e8c9..5fad489ce5bc 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
| @@ -894,7 +894,8 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj) | |||
| 894 | 894 | ||
| 895 | mutex_lock(&sysfs_rename_mutex); | 895 | mutex_lock(&sysfs_rename_mutex); |
| 896 | BUG_ON(!sd->s_parent); | 896 | BUG_ON(!sd->s_parent); |
| 897 | new_parent_sd = new_parent_kobj->sd ? new_parent_kobj->sd : &sysfs_root; | 897 | new_parent_sd = (new_parent_kobj && new_parent_kobj->sd) ? |
| 898 | new_parent_kobj->sd : &sysfs_root; | ||
| 898 | 899 | ||
| 899 | error = 0; | 900 | error = 0; |
| 900 | if (sd->s_parent == new_parent_sd) | 901 | if (sd->s_parent == new_parent_sd) |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 561a9c050cef..f5ea4680f15f 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
| @@ -268,7 +268,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd, | |||
| 268 | struct sysfs_open_dirent *od, *new_od = NULL; | 268 | struct sysfs_open_dirent *od, *new_od = NULL; |
| 269 | 269 | ||
| 270 | retry: | 270 | retry: |
| 271 | spin_lock(&sysfs_open_dirent_lock); | 271 | spin_lock_irq(&sysfs_open_dirent_lock); |
| 272 | 272 | ||
| 273 | if (!sd->s_attr.open && new_od) { | 273 | if (!sd->s_attr.open && new_od) { |
| 274 | sd->s_attr.open = new_od; | 274 | sd->s_attr.open = new_od; |
| @@ -281,7 +281,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd, | |||
| 281 | list_add_tail(&buffer->list, &od->buffers); | 281 | list_add_tail(&buffer->list, &od->buffers); |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | spin_unlock(&sysfs_open_dirent_lock); | 284 | spin_unlock_irq(&sysfs_open_dirent_lock); |
| 285 | 285 | ||
| 286 | if (od) { | 286 | if (od) { |
| 287 | kfree(new_od); | 287 | kfree(new_od); |
| @@ -315,8 +315,9 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd, | |||
| 315 | struct sysfs_buffer *buffer) | 315 | struct sysfs_buffer *buffer) |
| 316 | { | 316 | { |
| 317 | struct sysfs_open_dirent *od = sd->s_attr.open; | 317 | struct sysfs_open_dirent *od = sd->s_attr.open; |
| 318 | unsigned long flags; | ||
| 318 | 319 | ||
| 319 | spin_lock(&sysfs_open_dirent_lock); | 320 | spin_lock_irqsave(&sysfs_open_dirent_lock, flags); |
| 320 | 321 | ||
| 321 | list_del(&buffer->list); | 322 | list_del(&buffer->list); |
| 322 | if (atomic_dec_and_test(&od->refcnt)) | 323 | if (atomic_dec_and_test(&od->refcnt)) |
| @@ -324,7 +325,7 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd, | |||
| 324 | else | 325 | else |
| 325 | od = NULL; | 326 | od = NULL; |
| 326 | 327 | ||
| 327 | spin_unlock(&sysfs_open_dirent_lock); | 328 | spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags); |
| 328 | 329 | ||
| 329 | kfree(od); | 330 | kfree(od); |
| 330 | } | 331 | } |
| @@ -456,8 +457,9 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait) | |||
| 456 | void sysfs_notify_dirent(struct sysfs_dirent *sd) | 457 | void sysfs_notify_dirent(struct sysfs_dirent *sd) |
| 457 | { | 458 | { |
| 458 | struct sysfs_open_dirent *od; | 459 | struct sysfs_open_dirent *od; |
| 460 | unsigned long flags; | ||
| 459 | 461 | ||
| 460 | spin_lock(&sysfs_open_dirent_lock); | 462 | spin_lock_irqsave(&sysfs_open_dirent_lock, flags); |
| 461 | 463 | ||
| 462 | od = sd->s_attr.open; | 464 | od = sd->s_attr.open; |
| 463 | if (od) { | 465 | if (od) { |
| @@ -465,7 +467,7 @@ void sysfs_notify_dirent(struct sysfs_dirent *sd) | |||
| 465 | wake_up_interruptible(&od->poll); | 467 | wake_up_interruptible(&od->poll); |
| 466 | } | 468 | } |
| 467 | 469 | ||
| 468 | spin_unlock(&sysfs_open_dirent_lock); | 470 | spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags); |
| 469 | } | 471 | } |
| 470 | EXPORT_SYMBOL_GPL(sysfs_notify_dirent); | 472 | EXPORT_SYMBOL_GPL(sysfs_notify_dirent); |
| 471 | 473 | ||
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 3f384d4b163a..1feed71551c9 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
| @@ -364,6 +364,7 @@ unifdef-y += utsname.h | |||
| 364 | unifdef-y += videodev2.h | 364 | unifdef-y += videodev2.h |
| 365 | unifdef-y += videodev.h | 365 | unifdef-y += videodev.h |
| 366 | unifdef-y += virtio_config.h | 366 | unifdef-y += virtio_config.h |
| 367 | unifdef-y += virtio_ids.h | ||
| 367 | unifdef-y += virtio_blk.h | 368 | unifdef-y += virtio_blk.h |
| 368 | unifdef-y += virtio_net.h | 369 | unifdef-y += virtio_net.h |
| 369 | unifdef-y += virtio_9p.h | 370 | unifdef-y += virtio_9p.h |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 25119041e034..221cecd86bd3 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -1172,11 +1172,7 @@ static inline void put_dev_sector(Sector p) | |||
| 1172 | } | 1172 | } |
| 1173 | 1173 | ||
| 1174 | struct work_struct; | 1174 | struct work_struct; |
| 1175 | struct delayed_work; | ||
| 1176 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); | 1175 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); |
| 1177 | int kblockd_schedule_delayed_work(struct request_queue *q, | ||
| 1178 | struct delayed_work *work, | ||
| 1179 | unsigned long delay); | ||
| 1180 | 1176 | ||
| 1181 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ | 1177 | #define MODULE_ALIAS_BLOCKDEV(major,minor) \ |
| 1182 | MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) | 1178 | MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 7beaa21b3880..297df45ffd0a 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
| @@ -98,7 +98,7 @@ struct hd_struct { | |||
| 98 | int make_it_fail; | 98 | int make_it_fail; |
| 99 | #endif | 99 | #endif |
| 100 | unsigned long stamp; | 100 | unsigned long stamp; |
| 101 | int in_flight; | 101 | int in_flight[2]; |
| 102 | #ifdef CONFIG_SMP | 102 | #ifdef CONFIG_SMP |
| 103 | struct disk_stats *dkstats; | 103 | struct disk_stats *dkstats; |
| 104 | #else | 104 | #else |
| @@ -322,18 +322,23 @@ static inline void free_part_stats(struct hd_struct *part) | |||
| 322 | #define part_stat_sub(cpu, gendiskp, field, subnd) \ | 322 | #define part_stat_sub(cpu, gendiskp, field, subnd) \ |
| 323 | part_stat_add(cpu, gendiskp, field, -subnd) | 323 | part_stat_add(cpu, gendiskp, field, -subnd) |
| 324 | 324 | ||
| 325 | static inline void part_inc_in_flight(struct hd_struct *part) | 325 | static inline void part_inc_in_flight(struct hd_struct *part, int rw) |
| 326 | { | 326 | { |
| 327 | part->in_flight++; | 327 | part->in_flight[rw]++; |
| 328 | if (part->partno) | 328 | if (part->partno) |
| 329 | part_to_disk(part)->part0.in_flight++; | 329 | part_to_disk(part)->part0.in_flight[rw]++; |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | static inline void part_dec_in_flight(struct hd_struct *part) | 332 | static inline void part_dec_in_flight(struct hd_struct *part, int rw) |
| 333 | { | 333 | { |
| 334 | part->in_flight--; | 334 | part->in_flight[rw]--; |
| 335 | if (part->partno) | 335 | if (part->partno) |
| 336 | part_to_disk(part)->part0.in_flight--; | 336 | part_to_disk(part)->part0.in_flight[rw]--; |
| 337 | } | ||
| 338 | |||
| 339 | static inline int part_in_flight(struct hd_struct *part) | ||
| 340 | { | ||
| 341 | return part->in_flight[0] + part->in_flight[1]; | ||
| 337 | } | 342 | } |
| 338 | 343 | ||
| 339 | /* block/blk-core.c */ | 344 | /* block/blk-core.c */ |
| @@ -546,6 +551,8 @@ extern ssize_t part_size_show(struct device *dev, | |||
| 546 | struct device_attribute *attr, char *buf); | 551 | struct device_attribute *attr, char *buf); |
| 547 | extern ssize_t part_stat_show(struct device *dev, | 552 | extern ssize_t part_stat_show(struct device *dev, |
| 548 | struct device_attribute *attr, char *buf); | 553 | struct device_attribute *attr, char *buf); |
| 554 | extern ssize_t part_inflight_show(struct device *dev, | ||
| 555 | struct device_attribute *attr, char *buf); | ||
| 549 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 556 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
| 550 | extern ssize_t part_fail_show(struct device *dev, | 557 | extern ssize_t part_fail_show(struct device *dev, |
| 551 | struct device_attribute *attr, char *buf); | 558 | struct device_attribute *attr, char *buf); |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d3cd23f30039..f4e3184fa054 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -659,6 +659,12 @@ extern int do_sysinfo(struct sysinfo *info); | |||
| 659 | 659 | ||
| 660 | #endif /* __KERNEL__ */ | 660 | #endif /* __KERNEL__ */ |
| 661 | 661 | ||
| 662 | #ifndef __EXPORTED_HEADERS__ | ||
| 663 | #ifndef __KERNEL__ | ||
| 664 | #warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders | ||
| 665 | #endif /* __KERNEL__ */ | ||
| 666 | #endif /* __EXPORTED_HEADERS__ */ | ||
| 667 | |||
| 662 | #define SI_LOAD_SHIFT 16 | 668 | #define SI_LOAD_SHIFT 16 |
| 663 | struct sysinfo { | 669 | struct sysinfo { |
| 664 | long uptime; /* Seconds since boot */ | 670 | long uptime; /* Seconds since boot */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 94958c109761..812a5f3c2abe 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -557,7 +557,7 @@ struct netdev_queue { | |||
| 557 | * Callback uses when the transmitter has not made any progress | 557 | * Callback uses when the transmitter has not made any progress |
| 558 | * for dev->watchdog ticks. | 558 | * for dev->watchdog ticks. |
| 559 | * | 559 | * |
| 560 | * struct net_device_stats* (*get_stats)(struct net_device *dev); | 560 | * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); |
| 561 | * Called when a user wants to get the network device usage | 561 | * Called when a user wants to get the network device usage |
| 562 | * statistics. If not defined, the counters in dev->stats will | 562 | * statistics. If not defined, the counters in dev->stats will |
| 563 | * be used. | 563 | * be used. |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index da1fda8623e0..86257a412732 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -379,9 +379,6 @@ | |||
| 379 | #define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c | 379 | #define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c |
| 380 | #define PCI_DEVICE_ID_ATI_IXP700_SATA 0x4390 | 380 | #define PCI_DEVICE_ID_ATI_IXP700_SATA 0x4390 |
| 381 | #define PCI_DEVICE_ID_ATI_IXP700_IDE 0x439c | 381 | #define PCI_DEVICE_ID_ATI_IXP700_IDE 0x439c |
| 382 | /* AMD SB Chipset */ | ||
| 383 | #define PCI_DEVICE_ID_AMD_SB900_IDE 0x780c | ||
| 384 | #define PCI_DEVICE_ID_AMD_SB900_SATA_IDE 0x7800 | ||
| 385 | 382 | ||
| 386 | #define PCI_VENDOR_ID_VLSI 0x1004 | 383 | #define PCI_VENDOR_ID_VLSI 0x1004 |
| 387 | #define PCI_DEVICE_ID_VLSI_82C592 0x0005 | 384 | #define PCI_DEVICE_ID_VLSI_82C592 0x0005 |
| @@ -553,9 +550,10 @@ | |||
| 553 | #define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096 | 550 | #define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096 |
| 554 | #define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097 | 551 | #define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097 |
| 555 | #define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A | 552 | #define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A |
| 556 | |||
| 557 | #define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 | 553 | #define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 |
| 558 | #define PCI_DEVICE_ID_AMD_LX_AES 0x2082 | 554 | #define PCI_DEVICE_ID_AMD_LX_AES 0x2082 |
| 555 | #define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c | ||
| 556 | #define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE 0x7800 | ||
| 559 | 557 | ||
| 560 | #define PCI_VENDOR_ID_TRIDENT 0x1023 | 558 | #define PCI_VENDOR_ID_TRIDENT 0x1023 |
| 561 | #define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 | 559 | #define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 |
| @@ -776,6 +774,7 @@ | |||
| 776 | #define PCI_DEVICE_ID_TI_X515 0x8036 | 774 | #define PCI_DEVICE_ID_TI_X515 0x8036 |
| 777 | #define PCI_DEVICE_ID_TI_XX12 0x8039 | 775 | #define PCI_DEVICE_ID_TI_XX12 0x8039 |
| 778 | #define PCI_DEVICE_ID_TI_XX12_FM 0x803b | 776 | #define PCI_DEVICE_ID_TI_XX12_FM 0x803b |
| 777 | #define PCI_DEVICE_ID_TI_XIO2000A 0x8231 | ||
| 779 | #define PCI_DEVICE_ID_TI_1130 0xac12 | 778 | #define PCI_DEVICE_ID_TI_1130 0xac12 |
| 780 | #define PCI_DEVICE_ID_TI_1031 0xac13 | 779 | #define PCI_DEVICE_ID_TI_1031 0xac13 |
| 781 | #define PCI_DEVICE_ID_TI_1131 0xac15 | 780 | #define PCI_DEVICE_ID_TI_1131 0xac15 |
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h index ea7226a45acb..095e10d148b4 100644 --- a/include/linux/virtio_9p.h +++ b/include/linux/virtio_9p.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _LINUX_VIRTIO_9P_H | 2 | #define _LINUX_VIRTIO_9P_H |
| 3 | /* This header is BSD licensed so anyone can use the definitions to implement | 3 | /* This header is BSD licensed so anyone can use the definitions to implement |
| 4 | * compatible drivers/servers. */ | 4 | * compatible drivers/servers. */ |
| 5 | #include <linux/virtio_ids.h> | ||
| 5 | #include <linux/virtio_config.h> | 6 | #include <linux/virtio_config.h> |
| 6 | 7 | ||
| 7 | /* Maximum number of virtio channels per partition (1 for now) */ | 8 | /* Maximum number of virtio channels per partition (1 for now) */ |
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h index 09d730085060..1418f048cb34 100644 --- a/include/linux/virtio_balloon.h +++ b/include/linux/virtio_balloon.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _LINUX_VIRTIO_BALLOON_H | 2 | #define _LINUX_VIRTIO_BALLOON_H |
| 3 | /* This header is BSD licensed so anyone can use the definitions to implement | 3 | /* This header is BSD licensed so anyone can use the definitions to implement |
| 4 | * compatible drivers/servers. */ | 4 | * compatible drivers/servers. */ |
| 5 | #include <linux/virtio_ids.h> | ||
| 5 | #include <linux/virtio_config.h> | 6 | #include <linux/virtio_config.h> |
| 6 | 7 | ||
| 7 | /* The feature bitmap for virtio balloon */ | 8 | /* The feature bitmap for virtio balloon */ |
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h index 15cb666581d7..fd294c56d571 100644 --- a/include/linux/virtio_blk.h +++ b/include/linux/virtio_blk.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | /* This header is BSD licensed so anyone can use the definitions to implement | 3 | /* This header is BSD licensed so anyone can use the definitions to implement |
| 4 | * compatible drivers/servers. */ | 4 | * compatible drivers/servers. */ |
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | #include <linux/virtio_ids.h> | ||
| 6 | #include <linux/virtio_config.h> | 7 | #include <linux/virtio_config.h> |
| 7 | 8 | ||
| 8 | /* Feature bits */ | 9 | /* Feature bits */ |
| @@ -13,11 +14,8 @@ | |||
| 13 | #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ | 14 | #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ |
| 14 | #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ | 15 | #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ |
| 15 | #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ | 16 | #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ |
| 16 | #define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */ | ||
| 17 | #define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ | 17 | #define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ |
| 18 | 18 | ||
| 19 | #define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */ | ||
| 20 | |||
| 21 | struct virtio_blk_config { | 19 | struct virtio_blk_config { |
| 22 | /* The capacity (in 512-byte sectors). */ | 20 | /* The capacity (in 512-byte sectors). */ |
| 23 | __u64 capacity; | 21 | __u64 capacity; |
| @@ -33,7 +31,6 @@ struct virtio_blk_config { | |||
| 33 | } geometry; | 31 | } geometry; |
| 34 | /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ | 32 | /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ |
| 35 | __u32 blk_size; | 33 | __u32 blk_size; |
| 36 | __u8 identify[VIRTIO_BLK_ID_BYTES]; | ||
| 37 | } __attribute__((packed)); | 34 | } __attribute__((packed)); |
| 38 | 35 | ||
| 39 | /* | 36 | /* |
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h index b5f519806014..fe885174cc1f 100644 --- a/include/linux/virtio_console.h +++ b/include/linux/virtio_console.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef _LINUX_VIRTIO_CONSOLE_H | 1 | #ifndef _LINUX_VIRTIO_CONSOLE_H |
| 2 | #define _LINUX_VIRTIO_CONSOLE_H | 2 | #define _LINUX_VIRTIO_CONSOLE_H |
| 3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
| 4 | #include <linux/virtio_ids.h> | ||
| 4 | #include <linux/virtio_config.h> | 5 | #include <linux/virtio_config.h> |
| 5 | /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so | 6 | /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so |
| 6 | * anyone can use the definitions to implement compatible drivers/servers. */ | 7 | * anyone can use the definitions to implement compatible drivers/servers. */ |
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index 1f41734bbb77..085e42298ce5 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | /* This header is BSD licensed so anyone can use the definitions to implement | 3 | /* This header is BSD licensed so anyone can use the definitions to implement |
| 4 | * compatible drivers/servers. */ | 4 | * compatible drivers/servers. */ |
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | #include <linux/virtio_ids.h> | ||
| 6 | #include <linux/virtio_config.h> | 7 | #include <linux/virtio_config.h> |
| 7 | #include <linux/if_ether.h> | 8 | #include <linux/if_ether.h> |
| 8 | 9 | ||
diff --git a/include/linux/virtio_rng.h b/include/linux/virtio_rng.h index 48121c3c434b..c4d5de896f0c 100644 --- a/include/linux/virtio_rng.h +++ b/include/linux/virtio_rng.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _LINUX_VIRTIO_RNG_H | 2 | #define _LINUX_VIRTIO_RNG_H |
| 3 | /* This header is BSD licensed so anyone can use the definitions to implement | 3 | /* This header is BSD licensed so anyone can use the definitions to implement |
| 4 | * compatible drivers/servers. */ | 4 | * compatible drivers/servers. */ |
| 5 | #include <linux/virtio_ids.h> | ||
| 5 | #include <linux/virtio_config.h> | 6 | #include <linux/virtio_config.h> |
| 6 | 7 | ||
| 7 | #endif /* _LINUX_VIRTIO_RNG_H */ | 8 | #endif /* _LINUX_VIRTIO_RNG_H */ |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 7ef0c7b94f31..cf24c20de9e4 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
| @@ -207,6 +207,7 @@ extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | |||
| 207 | 207 | ||
| 208 | extern void flush_workqueue(struct workqueue_struct *wq); | 208 | extern void flush_workqueue(struct workqueue_struct *wq); |
| 209 | extern void flush_scheduled_work(void); | 209 | extern void flush_scheduled_work(void); |
| 210 | extern void flush_delayed_work(struct delayed_work *work); | ||
| 210 | 211 | ||
| 211 | extern int schedule_work(struct work_struct *work); | 212 | extern int schedule_work(struct work_struct *work); |
| 212 | extern int schedule_work_on(int cpu, struct work_struct *work); | 213 | extern int schedule_work_on(int cpu, struct work_struct *work); |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index b63b80fac567..f93ad90a601b 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
| @@ -130,11 +130,11 @@ struct inet_timewait_sock { | |||
| 130 | __u16 tw_num; | 130 | __u16 tw_num; |
| 131 | kmemcheck_bitfield_begin(flags); | 131 | kmemcheck_bitfield_begin(flags); |
| 132 | /* And these are ours. */ | 132 | /* And these are ours. */ |
| 133 | __u8 tw_ipv6only:1, | 133 | unsigned int tw_ipv6only : 1, |
| 134 | tw_transparent:1; | 134 | tw_transparent : 1, |
| 135 | /* 14 bits hole, try to pack */ | 135 | tw_pad : 14, /* 14 bits hole */ |
| 136 | tw_ipv6_offset : 16; | ||
| 136 | kmemcheck_bitfield_end(flags); | 137 | kmemcheck_bitfield_end(flags); |
| 137 | __u16 tw_ipv6_offset; | ||
| 138 | unsigned long tw_ttd; | 138 | unsigned long tw_ttd; |
| 139 | struct inet_bind_bucket *tw_tb; | 139 | struct inet_bind_bucket *tw_tb; |
| 140 | struct hlist_node tw_death_node; | 140 | struct hlist_node tw_death_node; |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 466859b285e1..c75b960c8ac8 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -1669,6 +1669,8 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw); | |||
| 1669 | * to this function and ieee80211_rx_irqsafe() may not be mixed for a | 1669 | * to this function and ieee80211_rx_irqsafe() may not be mixed for a |
| 1670 | * single hardware. | 1670 | * single hardware. |
| 1671 | * | 1671 | * |
| 1672 | * Note that right now, this function must be called with softirqs disabled. | ||
| 1673 | * | ||
| 1672 | * @hw: the hardware this frame came in on | 1674 | * @hw: the hardware this frame came in on |
| 1673 | * @skb: the buffer to receive, owned by mac80211 after this call | 1675 | * @skb: the buffer to receive, owned by mac80211 after this call |
| 1674 | */ | 1676 | */ |
diff --git a/include/net/sock.h b/include/net/sock.h index 1621935aad5b..9f96394f694e 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -226,12 +226,12 @@ struct sock { | |||
| 226 | #define sk_prot __sk_common.skc_prot | 226 | #define sk_prot __sk_common.skc_prot |
| 227 | #define sk_net __sk_common.skc_net | 227 | #define sk_net __sk_common.skc_net |
| 228 | kmemcheck_bitfield_begin(flags); | 228 | kmemcheck_bitfield_begin(flags); |
| 229 | unsigned char sk_shutdown : 2, | 229 | unsigned int sk_shutdown : 2, |
| 230 | sk_no_check : 2, | 230 | sk_no_check : 2, |
| 231 | sk_userlocks : 4; | 231 | sk_userlocks : 4, |
| 232 | sk_protocol : 8, | ||
| 233 | sk_type : 16; | ||
| 232 | kmemcheck_bitfield_end(flags); | 234 | kmemcheck_bitfield_end(flags); |
| 233 | unsigned char sk_protocol; | ||
| 234 | unsigned short sk_type; | ||
| 235 | int sk_rcvbuf; | 235 | int sk_rcvbuf; |
| 236 | socket_lock_t sk_lock; | 236 | socket_lock_t sk_lock; |
| 237 | /* | 237 | /* |
diff --git a/init/Kconfig b/init/Kconfig index 09c5c6431f42..f51586406d62 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -297,7 +297,7 @@ config AUDIT | |||
| 297 | 297 | ||
| 298 | config AUDITSYSCALL | 298 | config AUDITSYSCALL |
| 299 | bool "Enable system-call auditing support" | 299 | bool "Enable system-call auditing support" |
| 300 | depends on AUDIT && (X86 || PPC || PPC64 || S390 || IA64 || UML || SPARC64|| SUPERH) | 300 | depends on AUDIT && (X86 || PPC || S390 || IA64 || UML || SPARC64 || SUPERH) |
| 301 | default y if SECURITY_SELINUX | 301 | default y if SECURITY_SELINUX |
| 302 | help | 302 | help |
| 303 | Enable low-overhead system-call auditing infrastructure that | 303 | Enable low-overhead system-call auditing infrastructure that |
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 3815ac1d58b2..9af56723c096 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
| @@ -142,6 +142,11 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock) | |||
| 142 | #ifdef CONFIG_LOCK_STAT | 142 | #ifdef CONFIG_LOCK_STAT |
| 143 | static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], lock_stats); | 143 | static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], lock_stats); |
| 144 | 144 | ||
| 145 | static inline u64 lockstat_clock(void) | ||
| 146 | { | ||
| 147 | return cpu_clock(smp_processor_id()); | ||
| 148 | } | ||
| 149 | |||
| 145 | static int lock_point(unsigned long points[], unsigned long ip) | 150 | static int lock_point(unsigned long points[], unsigned long ip) |
| 146 | { | 151 | { |
| 147 | int i; | 152 | int i; |
| @@ -158,7 +163,7 @@ static int lock_point(unsigned long points[], unsigned long ip) | |||
| 158 | return i; | 163 | return i; |
| 159 | } | 164 | } |
| 160 | 165 | ||
| 161 | static void lock_time_inc(struct lock_time *lt, s64 time) | 166 | static void lock_time_inc(struct lock_time *lt, u64 time) |
| 162 | { | 167 | { |
| 163 | if (time > lt->max) | 168 | if (time > lt->max) |
| 164 | lt->max = time; | 169 | lt->max = time; |
| @@ -234,12 +239,12 @@ static void put_lock_stats(struct lock_class_stats *stats) | |||
| 234 | static void lock_release_holdtime(struct held_lock *hlock) | 239 | static void lock_release_holdtime(struct held_lock *hlock) |
| 235 | { | 240 | { |
| 236 | struct lock_class_stats *stats; | 241 | struct lock_class_stats *stats; |
| 237 | s64 holdtime; | 242 | u64 holdtime; |
| 238 | 243 | ||
| 239 | if (!lock_stat) | 244 | if (!lock_stat) |
| 240 | return; | 245 | return; |
| 241 | 246 | ||
| 242 | holdtime = sched_clock() - hlock->holdtime_stamp; | 247 | holdtime = lockstat_clock() - hlock->holdtime_stamp; |
| 243 | 248 | ||
| 244 | stats = get_lock_stats(hlock_class(hlock)); | 249 | stats = get_lock_stats(hlock_class(hlock)); |
| 245 | if (hlock->read) | 250 | if (hlock->read) |
| @@ -2792,7 +2797,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
| 2792 | hlock->references = references; | 2797 | hlock->references = references; |
| 2793 | #ifdef CONFIG_LOCK_STAT | 2798 | #ifdef CONFIG_LOCK_STAT |
| 2794 | hlock->waittime_stamp = 0; | 2799 | hlock->waittime_stamp = 0; |
| 2795 | hlock->holdtime_stamp = sched_clock(); | 2800 | hlock->holdtime_stamp = lockstat_clock(); |
| 2796 | #endif | 2801 | #endif |
| 2797 | 2802 | ||
| 2798 | if (check == 2 && !mark_irqflags(curr, hlock)) | 2803 | if (check == 2 && !mark_irqflags(curr, hlock)) |
| @@ -3322,7 +3327,7 @@ found_it: | |||
| 3322 | if (hlock->instance != lock) | 3327 | if (hlock->instance != lock) |
| 3323 | return; | 3328 | return; |
| 3324 | 3329 | ||
| 3325 | hlock->waittime_stamp = sched_clock(); | 3330 | hlock->waittime_stamp = lockstat_clock(); |
| 3326 | 3331 | ||
| 3327 | contention_point = lock_point(hlock_class(hlock)->contention_point, ip); | 3332 | contention_point = lock_point(hlock_class(hlock)->contention_point, ip); |
| 3328 | contending_point = lock_point(hlock_class(hlock)->contending_point, | 3333 | contending_point = lock_point(hlock_class(hlock)->contending_point, |
| @@ -3345,8 +3350,7 @@ __lock_acquired(struct lockdep_map *lock, unsigned long ip) | |||
| 3345 | struct held_lock *hlock, *prev_hlock; | 3350 | struct held_lock *hlock, *prev_hlock; |
| 3346 | struct lock_class_stats *stats; | 3351 | struct lock_class_stats *stats; |
| 3347 | unsigned int depth; | 3352 | unsigned int depth; |
| 3348 | u64 now; | 3353 | u64 now, waittime = 0; |
| 3349 | s64 waittime = 0; | ||
| 3350 | int i, cpu; | 3354 | int i, cpu; |
| 3351 | 3355 | ||
| 3352 | depth = curr->lockdep_depth; | 3356 | depth = curr->lockdep_depth; |
| @@ -3374,7 +3378,7 @@ found_it: | |||
| 3374 | 3378 | ||
| 3375 | cpu = smp_processor_id(); | 3379 | cpu = smp_processor_id(); |
| 3376 | if (hlock->waittime_stamp) { | 3380 | if (hlock->waittime_stamp) { |
| 3377 | now = sched_clock(); | 3381 | now = lockstat_clock(); |
| 3378 | waittime = now - hlock->waittime_stamp; | 3382 | waittime = now - hlock->waittime_stamp; |
| 3379 | hlock->holdtime_stamp = now; | 3383 | hlock->holdtime_stamp = now; |
| 3380 | } | 3384 | } |
diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c index 17d8bb1acf9c..25596e450ac7 100644 --- a/kernel/power/suspend_test.c +++ b/kernel/power/suspend_test.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | * The time it takes is system-specific though, so when we test this | 19 | * The time it takes is system-specific though, so when we test this |
| 20 | * during system bootup we allow a LOT of time. | 20 | * during system bootup we allow a LOT of time. |
| 21 | */ | 21 | */ |
| 22 | #define TEST_SUSPEND_SECONDS 5 | 22 | #define TEST_SUSPEND_SECONDS 10 |
| 23 | 23 | ||
| 24 | static unsigned long suspend_test_start_time; | 24 | static unsigned long suspend_test_start_time; |
| 25 | 25 | ||
| @@ -49,7 +49,8 @@ void suspend_test_finish(const char *label) | |||
| 49 | * has some performance issues. The stack dump of a WARN_ON | 49 | * has some performance issues. The stack dump of a WARN_ON |
| 50 | * is more likely to get the right attention than a printk... | 50 | * is more likely to get the right attention than a printk... |
| 51 | */ | 51 | */ |
| 52 | WARN(msec > (TEST_SUSPEND_SECONDS * 1000), "Component: %s\n", label); | 52 | WARN(msec > (TEST_SUSPEND_SECONDS * 1000), |
| 53 | "Component: %s, time: %u\n", label, msec); | ||
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | /* | 56 | /* |
diff --git a/kernel/sched.c b/kernel/sched.c index 76c0e9691fc0..e88689522e66 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -676,6 +676,7 @@ inline void update_rq_clock(struct rq *rq) | |||
| 676 | 676 | ||
| 677 | /** | 677 | /** |
| 678 | * runqueue_is_locked | 678 | * runqueue_is_locked |
| 679 | * @cpu: the processor in question. | ||
| 679 | * | 680 | * |
| 680 | * Returns true if the current cpu runqueue is locked. | 681 | * Returns true if the current cpu runqueue is locked. |
| 681 | * This interface allows printk to be called with the runqueue lock | 682 | * This interface allows printk to be called with the runqueue lock |
| @@ -2311,7 +2312,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, | |||
| 2311 | { | 2312 | { |
| 2312 | int cpu, orig_cpu, this_cpu, success = 0; | 2313 | int cpu, orig_cpu, this_cpu, success = 0; |
| 2313 | unsigned long flags; | 2314 | unsigned long flags; |
| 2314 | struct rq *rq; | 2315 | struct rq *rq, *orig_rq; |
| 2315 | 2316 | ||
| 2316 | if (!sched_feat(SYNC_WAKEUPS)) | 2317 | if (!sched_feat(SYNC_WAKEUPS)) |
| 2317 | wake_flags &= ~WF_SYNC; | 2318 | wake_flags &= ~WF_SYNC; |
| @@ -2319,7 +2320,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, | |||
| 2319 | this_cpu = get_cpu(); | 2320 | this_cpu = get_cpu(); |
| 2320 | 2321 | ||
| 2321 | smp_wmb(); | 2322 | smp_wmb(); |
| 2322 | rq = task_rq_lock(p, &flags); | 2323 | rq = orig_rq = task_rq_lock(p, &flags); |
| 2323 | update_rq_clock(rq); | 2324 | update_rq_clock(rq); |
| 2324 | if (!(p->state & state)) | 2325 | if (!(p->state & state)) |
| 2325 | goto out; | 2326 | goto out; |
| @@ -2350,6 +2351,10 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, | |||
| 2350 | set_task_cpu(p, cpu); | 2351 | set_task_cpu(p, cpu); |
| 2351 | 2352 | ||
| 2352 | rq = task_rq_lock(p, &flags); | 2353 | rq = task_rq_lock(p, &flags); |
| 2354 | |||
| 2355 | if (rq != orig_rq) | ||
| 2356 | update_rq_clock(rq); | ||
| 2357 | |||
| 2353 | WARN_ON(p->state != TASK_WAKING); | 2358 | WARN_ON(p->state != TASK_WAKING); |
| 2354 | cpu = task_cpu(p); | 2359 | cpu = task_cpu(p); |
| 2355 | 2360 | ||
| @@ -3656,6 +3661,7 @@ static void update_group_power(struct sched_domain *sd, int cpu) | |||
| 3656 | 3661 | ||
| 3657 | /** | 3662 | /** |
| 3658 | * update_sg_lb_stats - Update sched_group's statistics for load balancing. | 3663 | * update_sg_lb_stats - Update sched_group's statistics for load balancing. |
| 3664 | * @sd: The sched_domain whose statistics are to be updated. | ||
| 3659 | * @group: sched_group whose statistics are to be updated. | 3665 | * @group: sched_group whose statistics are to be updated. |
| 3660 | * @this_cpu: Cpu for which load balance is currently performed. | 3666 | * @this_cpu: Cpu for which load balance is currently performed. |
| 3661 | * @idle: Idle status of this_cpu | 3667 | * @idle: Idle status of this_cpu |
| @@ -6718,9 +6724,6 @@ EXPORT_SYMBOL(yield); | |||
| 6718 | /* | 6724 | /* |
| 6719 | * This task is about to go to sleep on IO. Increment rq->nr_iowait so | 6725 | * This task is about to go to sleep on IO. Increment rq->nr_iowait so |
| 6720 | * that process accounting knows that this is a task in IO wait state. | 6726 | * that process accounting knows that this is a task in IO wait state. |
| 6721 | * | ||
| 6722 | * But don't do that if it is a deliberate, throttling IO wait (this task | ||
| 6723 | * has set its backing_dev_info: the queue against which it should throttle) | ||
| 6724 | */ | 6727 | */ |
| 6725 | void __sched io_schedule(void) | 6728 | void __sched io_schedule(void) |
| 6726 | { | 6729 | { |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 45068269ebb1..c820b0310a12 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -1393,7 +1393,7 @@ int trace_array_vprintk(struct trace_array *tr, | |||
| 1393 | 1393 | ||
| 1394 | int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | 1394 | int trace_vprintk(unsigned long ip, const char *fmt, va_list args) |
| 1395 | { | 1395 | { |
| 1396 | return trace_array_printk(&global_trace, ip, fmt, args); | 1396 | return trace_array_vprintk(&global_trace, ip, fmt, args); |
| 1397 | } | 1397 | } |
| 1398 | EXPORT_SYMBOL_GPL(trace_vprintk); | 1398 | EXPORT_SYMBOL_GPL(trace_vprintk); |
| 1399 | 1399 | ||
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 23245785927f..98a6cc5c64ed 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
| @@ -933,8 +933,9 @@ static void postfix_clear(struct filter_parse_state *ps) | |||
| 933 | 933 | ||
| 934 | while (!list_empty(&ps->postfix)) { | 934 | while (!list_empty(&ps->postfix)) { |
| 935 | elt = list_first_entry(&ps->postfix, struct postfix_elt, list); | 935 | elt = list_first_entry(&ps->postfix, struct postfix_elt, list); |
| 936 | kfree(elt->operand); | ||
| 937 | list_del(&elt->list); | 936 | list_del(&elt->list); |
| 937 | kfree(elt->operand); | ||
| 938 | kfree(elt); | ||
| 938 | } | 939 | } |
| 939 | } | 940 | } |
| 940 | 941 | ||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index addfe2df93b1..47cdd7e76f2b 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
| @@ -640,6 +640,24 @@ int schedule_delayed_work(struct delayed_work *dwork, | |||
| 640 | EXPORT_SYMBOL(schedule_delayed_work); | 640 | EXPORT_SYMBOL(schedule_delayed_work); |
| 641 | 641 | ||
| 642 | /** | 642 | /** |
| 643 | * flush_delayed_work - block until a dwork_struct's callback has terminated | ||
| 644 | * @dwork: the delayed work which is to be flushed | ||
| 645 | * | ||
| 646 | * Any timeout is cancelled, and any pending work is run immediately. | ||
| 647 | */ | ||
| 648 | void flush_delayed_work(struct delayed_work *dwork) | ||
| 649 | { | ||
| 650 | if (del_timer_sync(&dwork->timer)) { | ||
| 651 | struct cpu_workqueue_struct *cwq; | ||
| 652 | cwq = wq_per_cpu(keventd_wq, get_cpu()); | ||
| 653 | __queue_work(cwq, &dwork->work); | ||
| 654 | put_cpu(); | ||
| 655 | } | ||
| 656 | flush_work(&dwork->work); | ||
| 657 | } | ||
| 658 | EXPORT_SYMBOL(flush_delayed_work); | ||
| 659 | |||
| 660 | /** | ||
| 643 | * schedule_delayed_work_on - queue work in global workqueue on CPU after delay | 661 | * schedule_delayed_work_on - queue work in global workqueue on CPU after delay |
| 644 | * @cpu: cpu to use | 662 | * @cpu: cpu to use |
| 645 | * @dwork: job to be done | 663 | * @dwork: job to be done |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 30df5865ecbe..234ceb10861f 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
| @@ -392,7 +392,7 @@ config DEBUG_KMEMLEAK_TEST | |||
| 392 | 392 | ||
| 393 | config DEBUG_PREEMPT | 393 | config DEBUG_PREEMPT |
| 394 | bool "Debug preemptible kernel" | 394 | bool "Debug preemptible kernel" |
| 395 | depends on DEBUG_KERNEL && PREEMPT && (TRACE_IRQFLAGS_SUPPORT || PPC64) | 395 | depends on DEBUG_KERNEL && PREEMPT && TRACE_IRQFLAGS_SUPPORT |
| 396 | default y | 396 | default y |
| 397 | help | 397 | help |
| 398 | If you say Y here then the kernel will use a debug variant of the | 398 | If you say Y here then the kernel will use a debug variant of the |
diff --git a/mm/Kconfig b/mm/Kconfig index 57963c6063d1..7ca3777bdede 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
| @@ -129,7 +129,7 @@ config MEMORY_HOTPLUG | |||
| 129 | bool "Allow for memory hot-add" | 129 | bool "Allow for memory hot-add" |
| 130 | depends on SPARSEMEM || X86_64_ACPI_NUMA | 130 | depends on SPARSEMEM || X86_64_ACPI_NUMA |
| 131 | depends on HOTPLUG && !(HIBERNATION && !S390) && ARCH_ENABLE_MEMORY_HOTPLUG | 131 | depends on HOTPLUG && !(HIBERNATION && !S390) && ARCH_ENABLE_MEMORY_HOTPLUG |
| 132 | depends on (IA64 || X86 || PPC64 || SUPERH || S390) | 132 | depends on (IA64 || X86 || PPC_BOOK3S_64 || SUPERH || S390) |
| 133 | 133 | ||
| 134 | comment "Memory hotplug is currently incompatible with Software Suspend" | 134 | comment "Memory hotplug is currently incompatible with Software Suspend" |
| 135 | depends on SPARSEMEM && HOTPLUG && HIBERNATION && !S390 | 135 | depends on SPARSEMEM && HOTPLUG && HIBERNATION && !S390 |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 3d3accb1f800..5a37e2055717 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
| @@ -92,7 +92,7 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v) | |||
| 92 | "BdiDirtyThresh: %8lu kB\n" | 92 | "BdiDirtyThresh: %8lu kB\n" |
| 93 | "DirtyThresh: %8lu kB\n" | 93 | "DirtyThresh: %8lu kB\n" |
| 94 | "BackgroundThresh: %8lu kB\n" | 94 | "BackgroundThresh: %8lu kB\n" |
| 95 | "WriteBack threads:%8lu\n" | 95 | "WritebackThreads: %8lu\n" |
| 96 | "b_dirty: %8lu\n" | 96 | "b_dirty: %8lu\n" |
| 97 | "b_io: %8lu\n" | 97 | "b_io: %8lu\n" |
| 98 | "b_more_io: %8lu\n" | 98 | "b_more_io: %8lu\n" |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index a3b14090b1fb..2c5d79236ead 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
| @@ -566,7 +566,8 @@ static void balance_dirty_pages(struct address_space *mapping, | |||
| 566 | if (pages_written >= write_chunk) | 566 | if (pages_written >= write_chunk) |
| 567 | break; /* We've done our duty */ | 567 | break; /* We've done our duty */ |
| 568 | 568 | ||
| 569 | schedule_timeout_interruptible(pause); | 569 | __set_current_state(TASK_INTERRUPTIBLE); |
| 570 | io_schedule_timeout(pause); | ||
| 570 | 571 | ||
| 571 | /* | 572 | /* |
| 572 | * Increase the delay for each loop, up to our previous | 573 | * Increase the delay for each loop, up to our previous |
diff --git a/mm/percpu.c b/mm/percpu.c index 4a048abad043..6af78c1ee704 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
| @@ -1870,13 +1870,14 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, ssize_t dyn_size, | |||
| 1870 | max_distance = 0; | 1870 | max_distance = 0; |
| 1871 | for (group = 0; group < ai->nr_groups; group++) { | 1871 | for (group = 0; group < ai->nr_groups; group++) { |
| 1872 | ai->groups[group].base_offset = areas[group] - base; | 1872 | ai->groups[group].base_offset = areas[group] - base; |
| 1873 | max_distance = max(max_distance, ai->groups[group].base_offset); | 1873 | max_distance = max_t(size_t, max_distance, |
| 1874 | ai->groups[group].base_offset); | ||
| 1874 | } | 1875 | } |
| 1875 | max_distance += ai->unit_size; | 1876 | max_distance += ai->unit_size; |
| 1876 | 1877 | ||
| 1877 | /* warn if maximum distance is further than 75% of vmalloc space */ | 1878 | /* warn if maximum distance is further than 75% of vmalloc space */ |
| 1878 | if (max_distance > (VMALLOC_END - VMALLOC_START) * 3 / 4) { | 1879 | if (max_distance > (VMALLOC_END - VMALLOC_START) * 3 / 4) { |
| 1879 | pr_warning("PERCPU: max_distance=0x%lx too large for vmalloc " | 1880 | pr_warning("PERCPU: max_distance=0x%zx too large for vmalloc " |
| 1880 | "space 0x%lx\n", | 1881 | "space 0x%lx\n", |
| 1881 | max_distance, VMALLOC_END - VMALLOC_START); | 1882 | max_distance, VMALLOC_END - VMALLOC_START); |
| 1882 | #ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK | 1883 | #ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK |
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index b2e07f0dd298..ea1e3daabefe 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
| @@ -43,7 +43,6 @@ | |||
| 43 | #include <net/9p/transport.h> | 43 | #include <net/9p/transport.h> |
| 44 | #include <linux/scatterlist.h> | 44 | #include <linux/scatterlist.h> |
| 45 | #include <linux/virtio.h> | 45 | #include <linux/virtio.h> |
| 46 | #include <linux/virtio_ids.h> | ||
| 47 | #include <linux/virtio_9p.h> | 46 | #include <linux/virtio_9p.h> |
| 48 | 47 | ||
| 49 | #define VIRTQUEUE_NUM 128 | 48 | #define VIRTQUEUE_NUM 128 |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 7f939ce29801..2bc6f6a8de68 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
| @@ -92,6 +92,8 @@ static void add_conn(struct work_struct *work) | |||
| 92 | 92 | ||
| 93 | dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); | 93 | dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); |
| 94 | 94 | ||
| 95 | dev_set_drvdata(&conn->dev, conn); | ||
| 96 | |||
| 95 | if (device_add(&conn->dev) < 0) { | 97 | if (device_add(&conn->dev) < 0) { |
| 96 | BT_ERR("Failed to register connection device"); | 98 | BT_ERR("Failed to register connection device"); |
| 97 | return; | 99 | return; |
| @@ -144,8 +146,6 @@ void hci_conn_init_sysfs(struct hci_conn *conn) | |||
| 144 | conn->dev.class = bt_class; | 146 | conn->dev.class = bt_class; |
| 145 | conn->dev.parent = &hdev->dev; | 147 | conn->dev.parent = &hdev->dev; |
| 146 | 148 | ||
| 147 | dev_set_drvdata(&conn->dev, conn); | ||
| 148 | |||
| 149 | device_initialize(&conn->dev); | 149 | device_initialize(&conn->dev); |
| 150 | 150 | ||
| 151 | INIT_WORK(&conn->work_add, add_conn); | 151 | INIT_WORK(&conn->work_add, add_conn); |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 555d9da1869b..77e9fb130adb 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
| @@ -555,12 +555,12 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status) | |||
| 555 | 555 | ||
| 556 | conn->feat_mask = 0; | 556 | conn->feat_mask = 0; |
| 557 | 557 | ||
| 558 | setup_timer(&conn->info_timer, l2cap_info_timeout, | ||
| 559 | (unsigned long) conn); | ||
| 560 | |||
| 561 | spin_lock_init(&conn->lock); | 558 | spin_lock_init(&conn->lock); |
| 562 | rwlock_init(&conn->chan_list.lock); | 559 | rwlock_init(&conn->chan_list.lock); |
| 563 | 560 | ||
| 561 | setup_timer(&conn->info_timer, l2cap_info_timeout, | ||
| 562 | (unsigned long) conn); | ||
| 563 | |||
| 564 | conn->disc_reason = 0x13; | 564 | conn->disc_reason = 0x13; |
| 565 | 565 | ||
| 566 | return conn; | 566 | return conn; |
| @@ -783,6 +783,9 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent) | |||
| 783 | /* Default config options */ | 783 | /* Default config options */ |
| 784 | pi->conf_len = 0; | 784 | pi->conf_len = 0; |
| 785 | pi->flush_to = L2CAP_DEFAULT_FLUSH_TO; | 785 | pi->flush_to = L2CAP_DEFAULT_FLUSH_TO; |
| 786 | skb_queue_head_init(TX_QUEUE(sk)); | ||
| 787 | skb_queue_head_init(SREJ_QUEUE(sk)); | ||
| 788 | INIT_LIST_HEAD(SREJ_LIST(sk)); | ||
| 786 | } | 789 | } |
| 787 | 790 | ||
| 788 | static struct proto l2cap_proto = { | 791 | static struct proto l2cap_proto = { |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 4351ca2cf0b8..537731b3bcb3 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
| @@ -446,6 +446,28 @@ extern int sysctl_tcp_synack_retries; | |||
| 446 | 446 | ||
| 447 | EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_hash_add); | 447 | EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_hash_add); |
| 448 | 448 | ||
| 449 | /* Decide when to expire the request and when to resend SYN-ACK */ | ||
| 450 | static inline void syn_ack_recalc(struct request_sock *req, const int thresh, | ||
| 451 | const int max_retries, | ||
| 452 | const u8 rskq_defer_accept, | ||
| 453 | int *expire, int *resend) | ||
| 454 | { | ||
| 455 | if (!rskq_defer_accept) { | ||
| 456 | *expire = req->retrans >= thresh; | ||
| 457 | *resend = 1; | ||
| 458 | return; | ||
| 459 | } | ||
| 460 | *expire = req->retrans >= thresh && | ||
| 461 | (!inet_rsk(req)->acked || req->retrans >= max_retries); | ||
| 462 | /* | ||
| 463 | * Do not resend while waiting for data after ACK, | ||
| 464 | * start to resend on end of deferring period to give | ||
| 465 | * last chance for data or ACK to create established socket. | ||
| 466 | */ | ||
| 467 | *resend = !inet_rsk(req)->acked || | ||
| 468 | req->retrans >= rskq_defer_accept - 1; | ||
| 469 | } | ||
| 470 | |||
| 449 | void inet_csk_reqsk_queue_prune(struct sock *parent, | 471 | void inet_csk_reqsk_queue_prune(struct sock *parent, |
| 450 | const unsigned long interval, | 472 | const unsigned long interval, |
| 451 | const unsigned long timeout, | 473 | const unsigned long timeout, |
| @@ -501,9 +523,15 @@ void inet_csk_reqsk_queue_prune(struct sock *parent, | |||
| 501 | reqp=&lopt->syn_table[i]; | 523 | reqp=&lopt->syn_table[i]; |
| 502 | while ((req = *reqp) != NULL) { | 524 | while ((req = *reqp) != NULL) { |
| 503 | if (time_after_eq(now, req->expires)) { | 525 | if (time_after_eq(now, req->expires)) { |
| 504 | if ((req->retrans < thresh || | 526 | int expire = 0, resend = 0; |
| 505 | (inet_rsk(req)->acked && req->retrans < max_retries)) | 527 | |
| 506 | && !req->rsk_ops->rtx_syn_ack(parent, req)) { | 528 | syn_ack_recalc(req, thresh, max_retries, |
| 529 | queue->rskq_defer_accept, | ||
| 530 | &expire, &resend); | ||
| 531 | if (!expire && | ||
| 532 | (!resend || | ||
| 533 | !req->rsk_ops->rtx_syn_ack(parent, req) || | ||
| 534 | inet_rsk(req)->acked)) { | ||
| 507 | unsigned long timeo; | 535 | unsigned long timeo; |
| 508 | 536 | ||
| 509 | if (req->retrans++ == 0) | 537 | if (req->retrans++ == 0) |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 0c0b6e363a20..e982b5c1ee17 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
| @@ -634,17 +634,16 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
| 634 | break; | 634 | break; |
| 635 | } | 635 | } |
| 636 | dev = ip_dev_find(sock_net(sk), mreq.imr_address.s_addr); | 636 | dev = ip_dev_find(sock_net(sk), mreq.imr_address.s_addr); |
| 637 | if (dev) { | 637 | if (dev) |
| 638 | mreq.imr_ifindex = dev->ifindex; | 638 | mreq.imr_ifindex = dev->ifindex; |
| 639 | dev_put(dev); | ||
| 640 | } | ||
| 641 | } else | 639 | } else |
| 642 | dev = __dev_get_by_index(sock_net(sk), mreq.imr_ifindex); | 640 | dev = dev_get_by_index(sock_net(sk), mreq.imr_ifindex); |
| 643 | 641 | ||
| 644 | 642 | ||
| 645 | err = -EADDRNOTAVAIL; | 643 | err = -EADDRNOTAVAIL; |
| 646 | if (!dev) | 644 | if (!dev) |
| 647 | break; | 645 | break; |
| 646 | dev_put(dev); | ||
| 648 | 647 | ||
| 649 | err = -EINVAL; | 648 | err = -EINVAL; |
| 650 | if (sk->sk_bound_dev_if && | 649 | if (sk->sk_bound_dev_if && |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 64d0af675823..90b2e0649bfb 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -326,6 +326,43 @@ void tcp_enter_memory_pressure(struct sock *sk) | |||
| 326 | 326 | ||
| 327 | EXPORT_SYMBOL(tcp_enter_memory_pressure); | 327 | EXPORT_SYMBOL(tcp_enter_memory_pressure); |
| 328 | 328 | ||
| 329 | /* Convert seconds to retransmits based on initial and max timeout */ | ||
| 330 | static u8 secs_to_retrans(int seconds, int timeout, int rto_max) | ||
| 331 | { | ||
| 332 | u8 res = 0; | ||
| 333 | |||
| 334 | if (seconds > 0) { | ||
| 335 | int period = timeout; | ||
| 336 | |||
| 337 | res = 1; | ||
| 338 | while (seconds > period && res < 255) { | ||
| 339 | res++; | ||
| 340 | timeout <<= 1; | ||
| 341 | if (timeout > rto_max) | ||
| 342 | timeout = rto_max; | ||
| 343 | period += timeout; | ||
| 344 | } | ||
| 345 | } | ||
| 346 | return res; | ||
| 347 | } | ||
| 348 | |||
| 349 | /* Convert retransmits to seconds based on initial and max timeout */ | ||
| 350 | static int retrans_to_secs(u8 retrans, int timeout, int rto_max) | ||
| 351 | { | ||
| 352 | int period = 0; | ||
| 353 | |||
| 354 | if (retrans > 0) { | ||
| 355 | period = timeout; | ||
| 356 | while (--retrans) { | ||
| 357 | timeout <<= 1; | ||
| 358 | if (timeout > rto_max) | ||
| 359 | timeout = rto_max; | ||
| 360 | period += timeout; | ||
| 361 | } | ||
| 362 | } | ||
| 363 | return period; | ||
| 364 | } | ||
| 365 | |||
| 329 | /* | 366 | /* |
| 330 | * Wait for a TCP event. | 367 | * Wait for a TCP event. |
| 331 | * | 368 | * |
| @@ -1405,7 +1442,9 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
| 1405 | goto found_ok_skb; | 1442 | goto found_ok_skb; |
| 1406 | if (tcp_hdr(skb)->fin) | 1443 | if (tcp_hdr(skb)->fin) |
| 1407 | goto found_fin_ok; | 1444 | goto found_fin_ok; |
| 1408 | WARN_ON(!(flags & MSG_PEEK)); | 1445 | if (WARN_ON(!(flags & MSG_PEEK))) |
| 1446 | printk(KERN_INFO "recvmsg bug 2: copied %X " | ||
| 1447 | "seq %X\n", *seq, TCP_SKB_CB(skb)->seq); | ||
| 1409 | } | 1448 | } |
| 1410 | 1449 | ||
| 1411 | /* Well, if we have backlog, try to process it now yet. */ | 1450 | /* Well, if we have backlog, try to process it now yet. */ |
| @@ -2163,16 +2202,10 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
| 2163 | break; | 2202 | break; |
| 2164 | 2203 | ||
| 2165 | case TCP_DEFER_ACCEPT: | 2204 | case TCP_DEFER_ACCEPT: |
| 2166 | icsk->icsk_accept_queue.rskq_defer_accept = 0; | 2205 | /* Translate value in seconds to number of retransmits */ |
| 2167 | if (val > 0) { | 2206 | icsk->icsk_accept_queue.rskq_defer_accept = |
| 2168 | /* Translate value in seconds to number of | 2207 | secs_to_retrans(val, TCP_TIMEOUT_INIT / HZ, |
| 2169 | * retransmits */ | 2208 | TCP_RTO_MAX / HZ); |
| 2170 | while (icsk->icsk_accept_queue.rskq_defer_accept < 32 && | ||
| 2171 | val > ((TCP_TIMEOUT_INIT / HZ) << | ||
| 2172 | icsk->icsk_accept_queue.rskq_defer_accept)) | ||
| 2173 | icsk->icsk_accept_queue.rskq_defer_accept++; | ||
| 2174 | icsk->icsk_accept_queue.rskq_defer_accept++; | ||
| 2175 | } | ||
| 2176 | break; | 2209 | break; |
| 2177 | 2210 | ||
| 2178 | case TCP_WINDOW_CLAMP: | 2211 | case TCP_WINDOW_CLAMP: |
| @@ -2353,8 +2386,8 @@ static int do_tcp_getsockopt(struct sock *sk, int level, | |||
| 2353 | val = (val ? : sysctl_tcp_fin_timeout) / HZ; | 2386 | val = (val ? : sysctl_tcp_fin_timeout) / HZ; |
| 2354 | break; | 2387 | break; |
| 2355 | case TCP_DEFER_ACCEPT: | 2388 | case TCP_DEFER_ACCEPT: |
| 2356 | val = !icsk->icsk_accept_queue.rskq_defer_accept ? 0 : | 2389 | val = retrans_to_secs(icsk->icsk_accept_queue.rskq_defer_accept, |
| 2357 | ((TCP_TIMEOUT_INIT / HZ) << (icsk->icsk_accept_queue.rskq_defer_accept - 1)); | 2390 | TCP_TIMEOUT_INIT / HZ, TCP_RTO_MAX / HZ); |
| 2358 | break; | 2391 | break; |
| 2359 | case TCP_WINDOW_CLAMP: | 2392 | case TCP_WINDOW_CLAMP: |
| 2360 | val = tp->window_clamp; | 2393 | val = tp->window_clamp; |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 624c3c9b3c2b..4c03598ed924 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
| @@ -641,8 +641,8 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, | |||
| 641 | if (!(flg & TCP_FLAG_ACK)) | 641 | if (!(flg & TCP_FLAG_ACK)) |
| 642 | return NULL; | 642 | return NULL; |
| 643 | 643 | ||
| 644 | /* If TCP_DEFER_ACCEPT is set, drop bare ACK. */ | 644 | /* While TCP_DEFER_ACCEPT is active, drop bare ACK. */ |
| 645 | if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept && | 645 | if (req->retrans < inet_csk(sk)->icsk_accept_queue.rskq_defer_accept && |
| 646 | TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) { | 646 | TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) { |
| 647 | inet_rsk(req)->acked = 1; | 647 | inet_rsk(req)->acked = 1; |
| 648 | return NULL; | 648 | return NULL; |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 6ec6a8a4a224..d0d436d6216c 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -841,6 +841,42 @@ out: | |||
| 841 | return ret; | 841 | return ret; |
| 842 | } | 842 | } |
| 843 | 843 | ||
| 844 | |||
| 845 | /** | ||
| 846 | * first_packet_length - return length of first packet in receive queue | ||
| 847 | * @sk: socket | ||
| 848 | * | ||
| 849 | * Drops all bad checksum frames, until a valid one is found. | ||
| 850 | * Returns the length of found skb, or 0 if none is found. | ||
| 851 | */ | ||
| 852 | static unsigned int first_packet_length(struct sock *sk) | ||
| 853 | { | ||
| 854 | struct sk_buff_head list_kill, *rcvq = &sk->sk_receive_queue; | ||
| 855 | struct sk_buff *skb; | ||
| 856 | unsigned int res; | ||
| 857 | |||
| 858 | __skb_queue_head_init(&list_kill); | ||
| 859 | |||
| 860 | spin_lock_bh(&rcvq->lock); | ||
| 861 | while ((skb = skb_peek(rcvq)) != NULL && | ||
| 862 | udp_lib_checksum_complete(skb)) { | ||
| 863 | UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, | ||
| 864 | IS_UDPLITE(sk)); | ||
| 865 | __skb_unlink(skb, rcvq); | ||
| 866 | __skb_queue_tail(&list_kill, skb); | ||
| 867 | } | ||
| 868 | res = skb ? skb->len : 0; | ||
| 869 | spin_unlock_bh(&rcvq->lock); | ||
| 870 | |||
| 871 | if (!skb_queue_empty(&list_kill)) { | ||
| 872 | lock_sock(sk); | ||
| 873 | __skb_queue_purge(&list_kill); | ||
| 874 | sk_mem_reclaim_partial(sk); | ||
| 875 | release_sock(sk); | ||
| 876 | } | ||
| 877 | return res; | ||
| 878 | } | ||
| 879 | |||
| 844 | /* | 880 | /* |
| 845 | * IOCTL requests applicable to the UDP protocol | 881 | * IOCTL requests applicable to the UDP protocol |
| 846 | */ | 882 | */ |
| @@ -857,21 +893,16 @@ int udp_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
| 857 | 893 | ||
| 858 | case SIOCINQ: | 894 | case SIOCINQ: |
| 859 | { | 895 | { |
| 860 | struct sk_buff *skb; | 896 | unsigned int amount = first_packet_length(sk); |
| 861 | unsigned long amount; | ||
| 862 | 897 | ||
| 863 | amount = 0; | 898 | if (amount) |
| 864 | spin_lock_bh(&sk->sk_receive_queue.lock); | ||
| 865 | skb = skb_peek(&sk->sk_receive_queue); | ||
| 866 | if (skb != NULL) { | ||
| 867 | /* | 899 | /* |
| 868 | * We will only return the amount | 900 | * We will only return the amount |
| 869 | * of this packet since that is all | 901 | * of this packet since that is all |
| 870 | * that will be read. | 902 | * that will be read. |
| 871 | */ | 903 | */ |
| 872 | amount = skb->len - sizeof(struct udphdr); | 904 | amount -= sizeof(struct udphdr); |
| 873 | } | 905 | |
| 874 | spin_unlock_bh(&sk->sk_receive_queue.lock); | ||
| 875 | return put_user(amount, (int __user *)arg); | 906 | return put_user(amount, (int __user *)arg); |
| 876 | } | 907 | } |
| 877 | 908 | ||
| @@ -1540,29 +1571,11 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
| 1540 | { | 1571 | { |
| 1541 | unsigned int mask = datagram_poll(file, sock, wait); | 1572 | unsigned int mask = datagram_poll(file, sock, wait); |
| 1542 | struct sock *sk = sock->sk; | 1573 | struct sock *sk = sock->sk; |
| 1543 | int is_lite = IS_UDPLITE(sk); | ||
| 1544 | 1574 | ||
| 1545 | /* Check for false positives due to checksum errors */ | 1575 | /* Check for false positives due to checksum errors */ |
| 1546 | if ((mask & POLLRDNORM) && | 1576 | if ((mask & POLLRDNORM) && !(file->f_flags & O_NONBLOCK) && |
| 1547 | !(file->f_flags & O_NONBLOCK) && | 1577 | !(sk->sk_shutdown & RCV_SHUTDOWN) && !first_packet_length(sk)) |
| 1548 | !(sk->sk_shutdown & RCV_SHUTDOWN)) { | 1578 | mask &= ~(POLLIN | POLLRDNORM); |
| 1549 | struct sk_buff_head *rcvq = &sk->sk_receive_queue; | ||
| 1550 | struct sk_buff *skb; | ||
| 1551 | |||
| 1552 | spin_lock_bh(&rcvq->lock); | ||
| 1553 | while ((skb = skb_peek(rcvq)) != NULL && | ||
| 1554 | udp_lib_checksum_complete(skb)) { | ||
| 1555 | UDP_INC_STATS_BH(sock_net(sk), | ||
| 1556 | UDP_MIB_INERRORS, is_lite); | ||
| 1557 | __skb_unlink(skb, rcvq); | ||
| 1558 | kfree_skb(skb); | ||
| 1559 | } | ||
| 1560 | spin_unlock_bh(&rcvq->lock); | ||
| 1561 | |||
| 1562 | /* nothing to see, move along */ | ||
| 1563 | if (skb == NULL) | ||
| 1564 | mask &= ~(POLLIN | POLLRDNORM); | ||
| 1565 | } | ||
| 1566 | 1579 | ||
| 1567 | return mask; | 1580 | return mask; |
| 1568 | 1581 | ||
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 14f54eb5a7fc..4f7aaf6996a3 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
| @@ -496,13 +496,17 @@ done: | |||
| 496 | goto e_inval; | 496 | goto e_inval; |
| 497 | 497 | ||
| 498 | if (val) { | 498 | if (val) { |
| 499 | struct net_device *dev; | ||
| 500 | |||
| 499 | if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val) | 501 | if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val) |
| 500 | goto e_inval; | 502 | goto e_inval; |
| 501 | 503 | ||
| 502 | if (__dev_get_by_index(net, val) == NULL) { | 504 | dev = dev_get_by_index(net, val); |
| 505 | if (!dev) { | ||
| 503 | retv = -ENODEV; | 506 | retv = -ENODEV; |
| 504 | break; | 507 | break; |
| 505 | } | 508 | } |
| 509 | dev_put(dev); | ||
| 506 | } | 510 | } |
| 507 | np->mcast_oif = val; | 511 | np->mcast_oif = val; |
| 508 | retv = 0; | 512 | retv = 0; |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 920ec8792f4b..6eaf69823439 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
| @@ -544,7 +544,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
| 544 | "%pM\n", bss->cbss.bssid, ifibss->bssid); | 544 | "%pM\n", bss->cbss.bssid, ifibss->bssid); |
| 545 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 545 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
| 546 | 546 | ||
| 547 | if (bss && memcmp(ifibss->bssid, bss->cbss.bssid, ETH_ALEN)) { | 547 | if (bss && !memcmp(ifibss->bssid, bss->cbss.bssid, ETH_ALEN)) { |
| 548 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" | 548 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" |
| 549 | " based on configured SSID\n", | 549 | " based on configured SSID\n", |
| 550 | sdata->dev->name, bss->cbss.bssid); | 550 | sdata->dev->name, bss->cbss.bssid); |
| @@ -829,7 +829,7 @@ void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local) | |||
| 829 | if (!sdata->u.ibss.ssid_len) | 829 | if (!sdata->u.ibss.ssid_len) |
| 830 | continue; | 830 | continue; |
| 831 | sdata->u.ibss.last_scan_completed = jiffies; | 831 | sdata->u.ibss.last_scan_completed = jiffies; |
| 832 | ieee80211_sta_find_ibss(sdata); | 832 | mod_timer(&sdata->u.ibss.timer, 0); |
| 833 | } | 833 | } |
| 834 | mutex_unlock(&local->iflist_mtx); | 834 | mutex_unlock(&local->iflist_mtx); |
| 835 | } | 835 | } |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index c01588f9d453..7170bf4565a8 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
| @@ -2164,11 +2164,17 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
| 2164 | 2164 | ||
| 2165 | skb = rx.skb; | 2165 | skb = rx.skb; |
| 2166 | 2166 | ||
| 2167 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 2167 | if (rx.sdata && ieee80211_is_data(hdr->frame_control)) { |
| 2168 | rx.flags |= IEEE80211_RX_RA_MATCH; | ||
| 2169 | prepares = prepare_for_handlers(rx.sdata, &rx, hdr); | ||
| 2170 | if (prepares) | ||
| 2171 | prev = rx.sdata; | ||
| 2172 | } else list_for_each_entry_rcu(sdata, &local->interfaces, list) { | ||
| 2168 | if (!netif_running(sdata->dev)) | 2173 | if (!netif_running(sdata->dev)) |
| 2169 | continue; | 2174 | continue; |
| 2170 | 2175 | ||
| 2171 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) | 2176 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR || |
| 2177 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | ||
| 2172 | continue; | 2178 | continue; |
| 2173 | 2179 | ||
| 2174 | rx.flags |= IEEE80211_RX_RA_MATCH; | 2180 | rx.flags |= IEEE80211_RX_RA_MATCH; |
| @@ -2447,6 +2453,8 @@ void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
| 2447 | struct ieee80211_supported_band *sband; | 2453 | struct ieee80211_supported_band *sband; |
| 2448 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 2454 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
| 2449 | 2455 | ||
| 2456 | WARN_ON_ONCE(softirq_count() == 0); | ||
| 2457 | |||
| 2450 | if (WARN_ON(status->band < 0 || | 2458 | if (WARN_ON(status->band < 0 || |
| 2451 | status->band >= IEEE80211_NUM_BANDS)) | 2459 | status->band >= IEEE80211_NUM_BANDS)) |
| 2452 | goto drop; | 2460 | goto drop; |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index eec001491e66..594f2318c3d8 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
| @@ -361,6 +361,7 @@ int sta_info_insert(struct sta_info *sta) | |||
| 361 | u.ap); | 361 | u.ap); |
| 362 | 362 | ||
| 363 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta); | 363 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_ADD, &sta->sta); |
| 364 | sdata = sta->sdata; | ||
| 364 | } | 365 | } |
| 365 | 366 | ||
| 366 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 367 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
| @@ -496,6 +497,7 @@ static void __sta_info_unlink(struct sta_info **sta) | |||
| 496 | 497 | ||
| 497 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE, | 498 | drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE, |
| 498 | &(*sta)->sta); | 499 | &(*sta)->sta); |
| 500 | sdata = (*sta)->sdata; | ||
| 499 | } | 501 | } |
| 500 | 502 | ||
| 501 | if (ieee80211_vif_is_mesh(&sdata->vif)) { | 503 | if (ieee80211_vif_is_mesh(&sdata->vif)) { |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index fd4028296613..db4bda681ec9 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
| @@ -1704,7 +1704,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
| 1704 | if (!is_multicast_ether_addr(hdr.addr1)) { | 1704 | if (!is_multicast_ether_addr(hdr.addr1)) { |
| 1705 | rcu_read_lock(); | 1705 | rcu_read_lock(); |
| 1706 | sta = sta_info_get(local, hdr.addr1); | 1706 | sta = sta_info_get(local, hdr.addr1); |
| 1707 | if (sta) | 1707 | /* XXX: in the future, use sdata to look up the sta */ |
| 1708 | if (sta && sta->sdata == sdata) | ||
| 1708 | sta_flags = get_sta_flags(sta); | 1709 | sta_flags = get_sta_flags(sta); |
| 1709 | rcu_read_unlock(); | 1710 | rcu_read_unlock(); |
| 1710 | } | 1711 | } |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index dd6564321369..aeb65b3d2295 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
| @@ -339,7 +339,7 @@ void ieee80211_add_pending_skb(struct ieee80211_local *local, | |||
| 339 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 339 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 340 | 340 | ||
| 341 | if (WARN_ON(!info->control.vif)) { | 341 | if (WARN_ON(!info->control.vif)) { |
| 342 | kfree(skb); | 342 | kfree_skb(skb); |
| 343 | return; | 343 | return; |
| 344 | } | 344 | } |
| 345 | 345 | ||
| @@ -367,7 +367,7 @@ int ieee80211_add_pending_skbs(struct ieee80211_local *local, | |||
| 367 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 367 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| 368 | 368 | ||
| 369 | if (WARN_ON(!info->control.vif)) { | 369 | if (WARN_ON(!info->control.vif)) { |
| 370 | kfree(skb); | 370 | kfree_skb(skb); |
| 371 | continue; | 371 | continue; |
| 372 | } | 372 | } |
| 373 | 373 | ||
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 96c0ed115e2a..6b0359a500e6 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
| @@ -34,7 +34,7 @@ static struct tcf_hashinfo pedit_hash_info = { | |||
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = { | 36 | static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = { |
| 37 | [TCA_PEDIT_PARMS] = { .len = sizeof(struct tcf_pedit) }, | 37 | [TCA_PEDIT_PARMS] = { .len = sizeof(struct tc_pedit) }, |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est, | 40 | static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est, |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 6a536949cdc0..7cf6c0fbc7a6 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
| @@ -350,7 +350,7 @@ static int tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, | |||
| 350 | tcm = NLMSG_DATA(nlh); | 350 | tcm = NLMSG_DATA(nlh); |
| 351 | tcm->tcm_family = AF_UNSPEC; | 351 | tcm->tcm_family = AF_UNSPEC; |
| 352 | tcm->tcm__pad1 = 0; | 352 | tcm->tcm__pad1 = 0; |
| 353 | tcm->tcm__pad1 = 0; | 353 | tcm->tcm__pad2 = 0; |
| 354 | tcm->tcm_ifindex = qdisc_dev(tp->q)->ifindex; | 354 | tcm->tcm_ifindex = qdisc_dev(tp->q)->ifindex; |
| 355 | tcm->tcm_parent = tp->classid; | 355 | tcm->tcm_parent = tp->classid; |
| 356 | tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol); | 356 | tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol); |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 51ab497115eb..fc820cd75453 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -1074,6 +1074,8 @@ restart: | |||
| 1074 | err = -ECONNREFUSED; | 1074 | err = -ECONNREFUSED; |
| 1075 | if (other->sk_state != TCP_LISTEN) | 1075 | if (other->sk_state != TCP_LISTEN) |
| 1076 | goto out_unlock; | 1076 | goto out_unlock; |
| 1077 | if (other->sk_shutdown & RCV_SHUTDOWN) | ||
| 1078 | goto out_unlock; | ||
| 1077 | 1079 | ||
| 1078 | if (unix_recvq_full(other)) { | 1080 | if (unix_recvq_full(other)) { |
| 1079 | err = -EAGAIN; | 1081 | err = -EAGAIN; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index eddab097435c..ca3c92a0a14f 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -4029,7 +4029,7 @@ static int nl80211_wiphy_netns(struct sk_buff *skb, struct genl_info *info) | |||
| 4029 | rdev = cfg80211_get_dev_from_info(info); | 4029 | rdev = cfg80211_get_dev_from_info(info); |
| 4030 | if (IS_ERR(rdev)) { | 4030 | if (IS_ERR(rdev)) { |
| 4031 | err = PTR_ERR(rdev); | 4031 | err = PTR_ERR(rdev); |
| 4032 | goto out; | 4032 | goto out_rtnl; |
| 4033 | } | 4033 | } |
| 4034 | 4034 | ||
| 4035 | net = get_net_ns_by_pid(pid); | 4035 | net = get_net_ns_by_pid(pid); |
| @@ -4049,6 +4049,7 @@ static int nl80211_wiphy_netns(struct sk_buff *skb, struct genl_info *info) | |||
| 4049 | put_net(net); | 4049 | put_net(net); |
| 4050 | out: | 4050 | out: |
| 4051 | cfg80211_unlock_rdev(rdev); | 4051 | cfg80211_unlock_rdev(rdev); |
| 4052 | out_rtnl: | ||
| 4052 | rtnl_unlock(); | 4053 | rtnl_unlock(); |
| 4053 | return err; | 4054 | return err; |
| 4054 | } | 4055 | } |
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 4f9c1908593b..c67e73ecd5be 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -100,7 +100,7 @@ as-option = $(call try-run,\ | |||
| 100 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) | 100 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) |
| 101 | 101 | ||
| 102 | as-instr = $(call try-run,\ | 102 | as-instr = $(call try-run,\ |
| 103 | echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) | 103 | /bin/echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) |
| 104 | 104 | ||
| 105 | # cc-option | 105 | # cc-option |
| 106 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) | 106 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7a7778746ea6..ffdafb26f539 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -208,7 +208,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ | |||
| 208 | 208 | ||
| 209 | # Bzip2 and LZMA do not include size in file... so we have to fake that; | 209 | # Bzip2 and LZMA do not include size in file... so we have to fake that; |
| 210 | # append the size as a 32-bit littleendian number as gzip does. | 210 | # append the size as a 32-bit littleendian number as gzip does. |
| 211 | size_append = echo -ne $(shell \ | 211 | size_append = /bin/echo -ne $(shell \ |
| 212 | dec_size=0; \ | 212 | dec_size=0; \ |
| 213 | for F in $1; do \ | 213 | for F in $1; do \ |
| 214 | fsize=$$(stat -c "%s" $$F); \ | 214 | fsize=$$(stat -c "%s" $$F); \ |
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh index 39677c82747a..46be3c5a62b7 100755 --- a/scripts/checkkconfigsymbols.sh +++ b/scripts/checkkconfigsymbols.sh | |||
| @@ -9,7 +9,7 @@ paths="$@" | |||
| 9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. | 9 | # Doing this once at the beginning saves a lot of time, on a cache-hot tree. |
| 10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" | 10 | Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" |
| 11 | 11 | ||
| 12 | echo -e "File list \tundefined symbol used" | 12 | /bin/echo -e "File list \tundefined symbol used" |
| 13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i | 13 | find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i |
| 14 | do | 14 | do |
| 15 | # Output the bare Kconfig variable and the filename; the _MODULE part at | 15 | # Output the bare Kconfig variable and the filename; the _MODULE part at |
| @@ -54,6 +54,6 @@ while read symb files; do | |||
| 54 | # beyond the purpose of this script. | 54 | # beyond the purpose of this script. |
| 55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` | 55 | symb_bare=`echo $symb | sed -e 's/_MODULE//'` |
| 56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then | 56 | if ! grep -q "\<$symb_bare\>" $Kconfigs; then |
| 57 | echo -e "$files: \t$symb" | 57 | /bin/echo -e "$files: \t$symb" |
| 58 | fi | 58 | fi |
| 59 | done|sort | 59 | done|sort |
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index c6ae4052ab43..b89ca2c58fdb 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl | |||
| @@ -20,7 +20,7 @@ use strict; | |||
| 20 | 20 | ||
| 21 | my ($readdir, $installdir, $arch, @files) = @ARGV; | 21 | my ($readdir, $installdir, $arch, @files) = @ARGV; |
| 22 | 22 | ||
| 23 | my $unifdef = "scripts/unifdef -U__KERNEL__"; | 23 | my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__"; |
| 24 | 24 | ||
| 25 | foreach my $file (@files) { | 25 | foreach my $file (@files) { |
| 26 | local *INFILE; | 26 | local *INFILE; |
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 6a12dd9f1181..bce3d0fe6fbd 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 1 | TARGET=$1 | 3 | TARGET=$1 |
| 2 | ARCH=$2 | 4 | ARCH=$2 |
| 3 | SMP=$3 | 5 | SMP=$3 |
| @@ -50,7 +52,7 @@ UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP" | |||
| 50 | # Truncate to maximum length | 52 | # Truncate to maximum length |
| 51 | 53 | ||
| 52 | UTS_LEN=64 | 54 | UTS_LEN=64 |
| 53 | UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" | 55 | UTS_TRUNCATE="cut -b -$UTS_LEN" |
| 54 | 56 | ||
| 55 | # Generate a temporary compile.h | 57 | # Generate a temporary compile.h |
| 56 | 58 | ||
| @@ -66,9 +68,13 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" | |||
| 66 | echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" | 68 | echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" |
| 67 | 69 | ||
| 68 | if [ -x /bin/dnsdomainname ]; then | 70 | if [ -x /bin/dnsdomainname ]; then |
| 69 | echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\" | 71 | domain=`dnsdomainname 2> /dev/null` |
| 70 | elif [ -x /bin/domainname ]; then | 72 | elif [ -x /bin/domainname ]; then |
| 71 | echo \#define LINUX_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\" | 73 | domain=`domainname 2> /dev/null` |
| 74 | fi | ||
| 75 | |||
| 76 | if [ -n "$domain" ]; then | ||
| 77 | echo \#define LINUX_COMPILE_DOMAIN \"`echo $domain | $UTS_TRUNCATE`\" | ||
| 72 | else | 78 | else |
| 73 | echo \#define LINUX_COMPILE_DOMAIN | 79 | echo \#define LINUX_COMPILE_DOMAIN |
| 74 | fi | 80 | fi |
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index fa4a0a17b7e0..f67cc885c807 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
| @@ -18,6 +18,9 @@ | |||
| 18 | # e) generate the rpm files, based on kernel.spec | 18 | # e) generate the rpm files, based on kernel.spec |
| 19 | # - Use /. to avoid tar packing just the symlink | 19 | # - Use /. to avoid tar packing just the symlink |
| 20 | 20 | ||
| 21 | # Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT, | ||
| 22 | # but the binrpm-pkg target can; for some reason O= gets ignored. | ||
| 23 | |||
| 21 | # Do we have rpmbuild, otherwise fall back to the older rpm | 24 | # Do we have rpmbuild, otherwise fall back to the older rpm |
| 22 | RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ | 25 | RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ |
| 23 | else echo rpm; fi) | 26 | else echo rpm; fi) |
| @@ -33,6 +36,12 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile | |||
| 33 | $(CONFIG_SHELL) $(MKSPEC) > $@ | 36 | $(CONFIG_SHELL) $(MKSPEC) > $@ |
| 34 | 37 | ||
| 35 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE | 38 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE |
| 39 | @if test -n "$(KBUILD_OUTPUT)"; then \ | ||
| 40 | echo "Building source + binary RPM is not possible outside the"; \ | ||
| 41 | echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ | ||
| 42 | echo "binrpm-pkg target instead."; \ | ||
| 43 | false; \ | ||
| 44 | fi | ||
| 36 | $(MAKE) clean | 45 | $(MAKE) clean |
| 37 | $(PREV) ln -sf $(srctree) $(KERNELPATH) | 46 | $(PREV) ln -sf $(srctree) $(KERNELPATH) |
| 38 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion | 47 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion |
| @@ -61,7 +70,7 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE | |||
| 61 | set -e; \ | 70 | set -e; \ |
| 62 | mv -f $(objtree)/.tmp_version $(objtree)/.version | 71 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
| 63 | 72 | ||
| 64 | $(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \ | 73 | $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
| 65 | $(UTS_MACHINE) -bb $< | 74 | $(UTS_MACHINE) -bb $< |
| 66 | 75 | ||
| 67 | clean-files += $(objtree)/binkernel.spec | 76 | clean-files += $(objtree)/binkernel.spec |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 3d93f8c81252..47bdd2f99b78 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
| @@ -70,7 +70,7 @@ echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules' | |||
| 70 | echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' | 70 | echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' |
| 71 | echo "%endif" | 71 | echo "%endif" |
| 72 | 72 | ||
| 73 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' | 73 | echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} KBUILD_SRC= modules_install' |
| 74 | echo "%ifarch ia64" | 74 | echo "%ifarch ia64" |
| 75 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" | 75 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" |
| 76 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" | 76 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" |
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 2fb28efc5326..06ec722897be 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c | |||
| @@ -873,7 +873,7 @@ static long get_instantiation_keyring(key_serial_t ringid, | |||
| 873 | /* otherwise specify the destination keyring recorded in the | 873 | /* otherwise specify the destination keyring recorded in the |
| 874 | * authorisation key (any KEY_SPEC_*_KEYRING) */ | 874 | * authorisation key (any KEY_SPEC_*_KEYRING) */ |
| 875 | if (ringid >= KEY_SPEC_REQUESTOR_KEYRING) { | 875 | if (ringid >= KEY_SPEC_REQUESTOR_KEYRING) { |
| 876 | *_dest_keyring = rka->dest_keyring; | 876 | *_dest_keyring = key_get(rka->dest_keyring); |
| 877 | return 0; | 877 | return 0; |
| 878 | } | 878 | } |
| 879 | 879 | ||
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index dc78272fc39f..1f0f8213e2d5 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
| @@ -937,6 +937,7 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci) | |||
| 937 | struct snd_ac97 *ac97; | 937 | struct snd_ac97 *ac97; |
| 938 | int ret; | 938 | int ret; |
| 939 | 939 | ||
| 940 | writel(0, aaci->base + AC97_POWERDOWN); | ||
| 940 | /* | 941 | /* |
| 941 | * Assert AACIRESET for 2us | 942 | * Assert AACIRESET for 2us |
| 942 | */ | 943 | */ |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 24585c6c6d01..4e2b925a94cc 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
| @@ -808,6 +808,8 @@ static struct pci_device_id snd_bt87x_ids[] = { | |||
| 808 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1002, 0x0001, GENERIC), | 808 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1002, 0x0001, GENERIC), |
| 809 | /* Leadtek Winfast tv 2000xp delux */ | 809 | /* Leadtek Winfast tv 2000xp delux */ |
| 810 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x107d, 0x6606, GENERIC), | 810 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x107d, 0x6606, GENERIC), |
| 811 | /* Pinnacle PCTV */ | ||
| 812 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x11bd, 0x0012, GENERIC), | ||
| 811 | /* Voodoo TV 200 */ | 813 | /* Voodoo TV 200 */ |
| 812 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x121a, 0x3000, GENERIC), | 814 | BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x121a, 0x3000, GENERIC), |
| 813 | /* Askey Computer Corp. MagicTView'99 */ | 815 | /* Askey Computer Corp. MagicTView'99 */ |
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index c8435c9a97f9..9fb60276f5c9 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c | |||
| @@ -29,6 +29,9 @@ | |||
| 29 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
| 30 | #include "hda_local.h" | 30 | #include "hda_local.h" |
| 31 | 31 | ||
| 32 | /* define below to restrict the supported rates and formats */ | ||
| 33 | /* #define LIMITED_RATE_FMT_SUPPORT */ | ||
| 34 | |||
| 32 | struct nvhdmi_spec { | 35 | struct nvhdmi_spec { |
| 33 | struct hda_multi_out multiout; | 36 | struct hda_multi_out multiout; |
| 34 | 37 | ||
| @@ -60,6 +63,22 @@ static struct hda_verb nvhdmi_basic_init[] = { | |||
| 60 | {} /* terminator */ | 63 | {} /* terminator */ |
| 61 | }; | 64 | }; |
| 62 | 65 | ||
| 66 | #ifdef LIMITED_RATE_FMT_SUPPORT | ||
| 67 | /* support only the safe format and rate */ | ||
| 68 | #define SUPPORTED_RATES SNDRV_PCM_RATE_48000 | ||
| 69 | #define SUPPORTED_MAXBPS 16 | ||
| 70 | #define SUPPORTED_FORMATS SNDRV_PCM_FMTBIT_S16_LE | ||
| 71 | #else | ||
| 72 | /* support all rates and formats */ | ||
| 73 | #define SUPPORTED_RATES \ | ||
| 74 | (SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ | ||
| 75 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |\ | ||
| 76 | SNDRV_PCM_RATE_192000) | ||
| 77 | #define SUPPORTED_MAXBPS 24 | ||
| 78 | #define SUPPORTED_FORMATS \ | ||
| 79 | (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) | ||
| 80 | #endif | ||
| 81 | |||
| 63 | /* | 82 | /* |
| 64 | * Controls | 83 | * Controls |
| 65 | */ | 84 | */ |
| @@ -258,9 +277,9 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch = { | |||
| 258 | .channels_min = 2, | 277 | .channels_min = 2, |
| 259 | .channels_max = 8, | 278 | .channels_max = 8, |
| 260 | .nid = Nv_Master_Convert_nid, | 279 | .nid = Nv_Master_Convert_nid, |
| 261 | .rates = SNDRV_PCM_RATE_48000, | 280 | .rates = SUPPORTED_RATES, |
| 262 | .maxbps = 16, | 281 | .maxbps = SUPPORTED_MAXBPS, |
| 263 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 282 | .formats = SUPPORTED_FORMATS, |
| 264 | .ops = { | 283 | .ops = { |
| 265 | .open = nvhdmi_dig_playback_pcm_open, | 284 | .open = nvhdmi_dig_playback_pcm_open, |
| 266 | .close = nvhdmi_dig_playback_pcm_close_8ch, | 285 | .close = nvhdmi_dig_playback_pcm_close_8ch, |
| @@ -273,9 +292,9 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_2ch = { | |||
| 273 | .channels_min = 2, | 292 | .channels_min = 2, |
| 274 | .channels_max = 2, | 293 | .channels_max = 2, |
| 275 | .nid = Nv_Master_Convert_nid, | 294 | .nid = Nv_Master_Convert_nid, |
| 276 | .rates = SNDRV_PCM_RATE_48000, | 295 | .rates = SUPPORTED_RATES, |
| 277 | .maxbps = 16, | 296 | .maxbps = SUPPORTED_MAXBPS, |
| 278 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 297 | .formats = SUPPORTED_FORMATS, |
| 279 | .ops = { | 298 | .ops = { |
| 280 | .open = nvhdmi_dig_playback_pcm_open, | 299 | .open = nvhdmi_dig_playback_pcm_open, |
| 281 | .close = nvhdmi_dig_playback_pcm_close_2ch, | 300 | .close = nvhdmi_dig_playback_pcm_close_2ch, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 470fd74a0a1a..c08ca660daba 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -275,7 +275,7 @@ struct alc_spec { | |||
| 275 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | 275 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
| 276 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ | 276 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
| 277 | 277 | ||
| 278 | const struct hda_verb *init_verbs[5]; /* initialization verbs | 278 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
| 279 | * don't forget NULL | 279 | * don't forget NULL |
| 280 | * termination! | 280 | * termination! |
| 281 | */ | 281 | */ |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a9b26828a651..66c0876bf734 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -158,6 +158,7 @@ enum { | |||
| 158 | STAC_D965_5ST_NO_FP, | 158 | STAC_D965_5ST_NO_FP, |
| 159 | STAC_DELL_3ST, | 159 | STAC_DELL_3ST, |
| 160 | STAC_DELL_BIOS, | 160 | STAC_DELL_BIOS, |
| 161 | STAC_927X_VOLKNOB, | ||
| 161 | STAC_927X_MODELS | 162 | STAC_927X_MODELS |
| 162 | }; | 163 | }; |
| 163 | 164 | ||
| @@ -907,6 +908,16 @@ static struct hda_verb d965_core_init[] = { | |||
| 907 | {} | 908 | {} |
| 908 | }; | 909 | }; |
| 909 | 910 | ||
| 911 | static struct hda_verb dell_3st_core_init[] = { | ||
| 912 | /* don't set delta bit */ | ||
| 913 | {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f}, | ||
| 914 | /* unmute node 0x1b */ | ||
| 915 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | ||
| 916 | /* select node 0x03 as DAC */ | ||
| 917 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 918 | {} | ||
| 919 | }; | ||
| 920 | |||
| 910 | static struct hda_verb stac927x_core_init[] = { | 921 | static struct hda_verb stac927x_core_init[] = { |
| 911 | /* set master volume and direct control */ | 922 | /* set master volume and direct control */ |
| 912 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 923 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| @@ -915,6 +926,14 @@ static struct hda_verb stac927x_core_init[] = { | |||
| 915 | {} | 926 | {} |
| 916 | }; | 927 | }; |
| 917 | 928 | ||
| 929 | static struct hda_verb stac927x_volknob_core_init[] = { | ||
| 930 | /* don't set delta bit */ | ||
| 931 | {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f}, | ||
| 932 | /* enable analog pc beep path */ | ||
| 933 | {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, | ||
| 934 | {} | ||
| 935 | }; | ||
| 936 | |||
| 918 | static struct hda_verb stac9205_core_init[] = { | 937 | static struct hda_verb stac9205_core_init[] = { |
| 919 | /* set master volume and direct control */ | 938 | /* set master volume and direct control */ |
| 920 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 939 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| @@ -1999,6 +2018,7 @@ static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { | |||
| 1999 | [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs, | 2018 | [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs, |
| 2000 | [STAC_DELL_3ST] = dell_3st_pin_configs, | 2019 | [STAC_DELL_3ST] = dell_3st_pin_configs, |
| 2001 | [STAC_DELL_BIOS] = NULL, | 2020 | [STAC_DELL_BIOS] = NULL, |
| 2021 | [STAC_927X_VOLKNOB] = NULL, | ||
| 2002 | }; | 2022 | }; |
| 2003 | 2023 | ||
| 2004 | static const char *stac927x_models[STAC_927X_MODELS] = { | 2024 | static const char *stac927x_models[STAC_927X_MODELS] = { |
| @@ -2010,6 +2030,7 @@ static const char *stac927x_models[STAC_927X_MODELS] = { | |||
| 2010 | [STAC_D965_5ST_NO_FP] = "5stack-no-fp", | 2030 | [STAC_D965_5ST_NO_FP] = "5stack-no-fp", |
| 2011 | [STAC_DELL_3ST] = "dell-3stack", | 2031 | [STAC_DELL_3ST] = "dell-3stack", |
| 2012 | [STAC_DELL_BIOS] = "dell-bios", | 2032 | [STAC_DELL_BIOS] = "dell-bios", |
| 2033 | [STAC_927X_VOLKNOB] = "volknob", | ||
| 2013 | }; | 2034 | }; |
| 2014 | 2035 | ||
| 2015 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { | 2036 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { |
| @@ -2045,6 +2066,8 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = { | |||
| 2045 | "Intel D965", STAC_D965_5ST), | 2066 | "Intel D965", STAC_D965_5ST), |
| 2046 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, | 2067 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, |
| 2047 | "Intel D965", STAC_D965_5ST), | 2068 | "Intel D965", STAC_D965_5ST), |
| 2069 | /* volume-knob fixes */ | ||
| 2070 | SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB), | ||
| 2048 | {} /* terminator */ | 2071 | {} /* terminator */ |
| 2049 | }; | 2072 | }; |
| 2050 | 2073 | ||
| @@ -5612,10 +5635,14 @@ static int patch_stac927x(struct hda_codec *codec) | |||
| 5612 | spec->dmic_nids = stac927x_dmic_nids; | 5635 | spec->dmic_nids = stac927x_dmic_nids; |
| 5613 | spec->num_dmics = STAC927X_NUM_DMICS; | 5636 | spec->num_dmics = STAC927X_NUM_DMICS; |
| 5614 | 5637 | ||
| 5615 | spec->init = d965_core_init; | 5638 | spec->init = dell_3st_core_init; |
| 5616 | spec->dmux_nids = stac927x_dmux_nids; | 5639 | spec->dmux_nids = stac927x_dmux_nids; |
| 5617 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); | 5640 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
| 5618 | break; | 5641 | break; |
| 5642 | case STAC_927X_VOLKNOB: | ||
| 5643 | spec->num_dmics = 0; | ||
| 5644 | spec->init = stac927x_volknob_core_init; | ||
| 5645 | break; | ||
| 5619 | default: | 5646 | default: |
| 5620 | spec->num_dmics = 0; | 5647 | spec->num_dmics = 0; |
| 5621 | spec->init = stac927x_core_init; | 5648 | spec->init = stac927x_core_init; |
diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c index 37564300b50d..6da21a2bcade 100644 --- a/sound/pci/ice1712/amp.c +++ b/sound/pci/ice1712/amp.c | |||
| @@ -52,11 +52,13 @@ static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice) | |||
| 52 | 52 | ||
| 53 | /* only use basic functionality for now */ | 53 | /* only use basic functionality for now */ |
| 54 | 54 | ||
| 55 | ice->num_total_dacs = 2; /* only PSDOUT0 is connected */ | 55 | /* VT1616 6ch codec connected to PSDOUT0 using packed mode */ |
| 56 | ice->num_total_dacs = 6; | ||
| 56 | ice->num_total_adcs = 2; | 57 | ice->num_total_adcs = 2; |
| 57 | 58 | ||
| 58 | /* Chaintech AV-710 has another codecs, which need initialization */ | 59 | /* Chaintech AV-710 has another WM8728 codec connected to PSDOUT4 |
| 59 | /* initialize WM8728 codec */ | 60 | (shared with the SPDIF output). Mixer control for this codec |
| 61 | is not yet supported. */ | ||
| 60 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AV710) { | 62 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AV710) { |
| 61 | for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) | 63 | for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) |
| 62 | wm_put(ice, wm_inits[i], wm_inits[i+1]); | 64 | wm_put(ice, wm_inits[i], wm_inits[i+1]); |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 76b717dae4b6..10fc92c05574 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
| @@ -648,7 +648,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, | |||
| 648 | (inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) { | 648 | (inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) { |
| 649 | /* running? we cannot change the rate now... */ | 649 | /* running? we cannot change the rate now... */ |
| 650 | spin_unlock_irqrestore(&ice->reg_lock, flags); | 650 | spin_unlock_irqrestore(&ice->reg_lock, flags); |
| 651 | return -EBUSY; | 651 | return ((rate == ice->cur_rate) && !force) ? 0 : -EBUSY; |
| 652 | } | 652 | } |
| 653 | if (!force && is_pro_rate_locked(ice)) { | 653 | if (!force && is_pro_rate_locked(ice)) { |
| 654 | spin_unlock_irqrestore(&ice->reg_lock, flags); | 654 | spin_unlock_irqrestore(&ice->reg_lock, flags); |
diff --git a/sound/ppc/Kconfig b/sound/ppc/Kconfig index bd2338ab2ced..0519c60f5be1 100644 --- a/sound/ppc/Kconfig +++ b/sound/ppc/Kconfig | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | menuconfig SND_PPC | 3 | menuconfig SND_PPC |
| 4 | bool "PowerPC sound devices" | 4 | bool "PowerPC sound devices" |
| 5 | depends on PPC64 || PPC32 | 5 | depends on PPC |
| 6 | default y | 6 | default y |
| 7 | help | 7 | help |
| 8 | Support for sound devices specific to PowerPC architectures. | 8 | Support for sound devices specific to PowerPC architectures. |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 5881943f0c34..742a32eee8fc 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -157,11 +157,18 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') | |||
| 157 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') | 157 | uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') |
| 158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') | 158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') |
| 159 | 159 | ||
| 160 | # If we're on a 64-bit kernel, use -m64 | 160 | # |
| 161 | ifndef NO_64BIT | 161 | # Add -m32 for cross-builds: |
| 162 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) | 162 | # |
| 163 | M64 := -m64 | 163 | ifdef NO_64BIT |
| 164 | endif | 164 | MBITS := -m32 |
| 165 | else | ||
| 166 | # | ||
| 167 | # If we're on a 64-bit kernel, use -m64: | ||
| 168 | # | ||
| 169 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) | ||
| 170 | MBITS := -m64 | ||
| 171 | endif | ||
| 165 | endif | 172 | endif |
| 166 | 173 | ||
| 167 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 174 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
| @@ -194,7 +201,7 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition | |||
| 194 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes | 201 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes |
| 195 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement | 202 | EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement |
| 196 | 203 | ||
| 197 | CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) | 204 | CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) |
| 198 | LDFLAGS = -lpthread -lrt -lelf -lm | 205 | LDFLAGS = -lpthread -lrt -lelf -lm |
| 199 | ALL_CFLAGS = $(CFLAGS) | 206 | ALL_CFLAGS = $(CFLAGS) |
| 200 | ALL_LDFLAGS = $(LDFLAGS) | 207 | ALL_LDFLAGS = $(LDFLAGS) |
| @@ -416,7 +423,7 @@ ifeq ($(uname_S),Darwin) | |||
| 416 | endif | 423 | endif |
| 417 | 424 | ||
| 418 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) | 425 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) |
| 419 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); | 426 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]); |
| 420 | endif | 427 | endif |
| 421 | 428 | ||
| 422 | ifdef NO_DEMANGLE | 429 | ifdef NO_DEMANGLE |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index ea9c15c0cdfe..ce2d5be4f30e 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
| @@ -1287,7 +1287,7 @@ static struct sort_dimension *available_sorts[] = { | |||
| 1287 | 1287 | ||
| 1288 | static LIST_HEAD(sort_list); | 1288 | static LIST_HEAD(sort_list); |
| 1289 | 1289 | ||
| 1290 | static int sort_dimension__add(char *tok, struct list_head *list) | 1290 | static int sort_dimension__add(const char *tok, struct list_head *list) |
| 1291 | { | 1291 | { |
| 1292 | int i; | 1292 | int i; |
| 1293 | 1293 | ||
| @@ -1917,7 +1917,7 @@ static void setup_sorting(void) | |||
| 1917 | 1917 | ||
| 1918 | free(str); | 1918 | free(str); |
| 1919 | 1919 | ||
| 1920 | sort_dimension__add((char *)"pid", &cmp_pid); | 1920 | sort_dimension__add("pid", &cmp_pid); |
| 1921 | } | 1921 | } |
| 1922 | 1922 | ||
| 1923 | static const char *record_args[] = { | 1923 | static const char *record_args[] = { |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 87c424de79ee..8cfb48cbbea0 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
| @@ -691,7 +691,10 @@ static void store_event_type(const char *orgname) | |||
| 691 | FILE *file; | 691 | FILE *file; |
| 692 | int id; | 692 | int id; |
| 693 | 693 | ||
| 694 | sprintf(filename, "/sys/kernel/debug/tracing/events/%s/id", orgname); | 694 | sprintf(filename, "%s/", debugfs_path); |
| 695 | strncat(filename, orgname, strlen(orgname)); | ||
| 696 | strcat(filename, "/id"); | ||
| 697 | |||
| 695 | c = strchr(filename, ':'); | 698 | c = strchr(filename, ':'); |
| 696 | if (c) | 699 | if (c) |
| 697 | *c = '/'; | 700 | *c = '/'; |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 55b41b9e3834..55c9659a56e2 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
| @@ -618,7 +618,7 @@ static int test_type(enum event_type type, enum event_type expect) | |||
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | static int test_type_token(enum event_type type, char *token, | 620 | static int test_type_token(enum event_type type, char *token, |
| 621 | enum event_type expect, char *expect_tok) | 621 | enum event_type expect, const char *expect_tok) |
| 622 | { | 622 | { |
| 623 | if (type != expect) { | 623 | if (type != expect) { |
| 624 | die("Error: expected type %d but read %d", | 624 | die("Error: expected type %d but read %d", |
| @@ -650,7 +650,7 @@ static int read_expect_type(enum event_type expect, char **tok) | |||
| 650 | return __read_expect_type(expect, tok, 1); | 650 | return __read_expect_type(expect, tok, 1); |
| 651 | } | 651 | } |
| 652 | 652 | ||
| 653 | static int __read_expected(enum event_type expect, char *str, int newline_ok) | 653 | static int __read_expected(enum event_type expect, const char *str, int newline_ok) |
| 654 | { | 654 | { |
| 655 | enum event_type type; | 655 | enum event_type type; |
| 656 | char *token; | 656 | char *token; |
| @@ -668,12 +668,12 @@ static int __read_expected(enum event_type expect, char *str, int newline_ok) | |||
| 668 | return 0; | 668 | return 0; |
| 669 | } | 669 | } |
| 670 | 670 | ||
| 671 | static int read_expected(enum event_type expect, char *str) | 671 | static int read_expected(enum event_type expect, const char *str) |
| 672 | { | 672 | { |
| 673 | return __read_expected(expect, str, 1); | 673 | return __read_expected(expect, str, 1); |
| 674 | } | 674 | } |
| 675 | 675 | ||
| 676 | static int read_expected_item(enum event_type expect, char *str) | 676 | static int read_expected_item(enum event_type expect, const char *str) |
| 677 | { | 677 | { |
| 678 | return __read_expected(expect, str, 0); | 678 | return __read_expected(expect, str, 0); |
| 679 | } | 679 | } |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index b7c78a403dc2..7495ce347344 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
| @@ -2717,8 +2717,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size, | |||
| 2717 | int r; | 2717 | int r; |
| 2718 | int cpu; | 2718 | int cpu; |
| 2719 | 2719 | ||
| 2720 | kvm_init_debug(); | ||
| 2721 | |||
| 2722 | r = kvm_arch_init(opaque); | 2720 | r = kvm_arch_init(opaque); |
| 2723 | if (r) | 2721 | if (r) |
| 2724 | goto out_fail; | 2722 | goto out_fail; |
| @@ -2785,6 +2783,8 @@ int kvm_init(void *opaque, unsigned int vcpu_size, | |||
| 2785 | kvm_preempt_ops.sched_in = kvm_sched_in; | 2783 | kvm_preempt_ops.sched_in = kvm_sched_in; |
| 2786 | kvm_preempt_ops.sched_out = kvm_sched_out; | 2784 | kvm_preempt_ops.sched_out = kvm_sched_out; |
| 2787 | 2785 | ||
| 2786 | kvm_init_debug(); | ||
| 2787 | |||
| 2788 | return 0; | 2788 | return 0; |
| 2789 | 2789 | ||
| 2790 | out_free: | 2790 | out_free: |
| @@ -2807,7 +2807,6 @@ out_free_0: | |||
| 2807 | out: | 2807 | out: |
| 2808 | kvm_arch_exit(); | 2808 | kvm_arch_exit(); |
| 2809 | out_fail: | 2809 | out_fail: |
| 2810 | kvm_exit_debug(); | ||
| 2811 | return r; | 2810 | return r; |
| 2812 | } | 2811 | } |
| 2813 | EXPORT_SYMBOL_GPL(kvm_init); | 2812 | EXPORT_SYMBOL_GPL(kvm_init); |
| @@ -2815,6 +2814,7 @@ EXPORT_SYMBOL_GPL(kvm_init); | |||
| 2815 | void kvm_exit(void) | 2814 | void kvm_exit(void) |
| 2816 | { | 2815 | { |
| 2817 | tracepoint_synchronize_unregister(); | 2816 | tracepoint_synchronize_unregister(); |
| 2817 | kvm_exit_debug(); | ||
| 2818 | misc_deregister(&kvm_dev); | 2818 | misc_deregister(&kvm_dev); |
| 2819 | kmem_cache_destroy(kvm_vcpu_cache); | 2819 | kmem_cache_destroy(kvm_vcpu_cache); |
| 2820 | sysdev_unregister(&kvm_sysdev); | 2820 | sysdev_unregister(&kvm_sysdev); |
| @@ -2824,7 +2824,6 @@ void kvm_exit(void) | |||
| 2824 | on_each_cpu(hardware_disable, NULL, 1); | 2824 | on_each_cpu(hardware_disable, NULL, 1); |
| 2825 | kvm_arch_hardware_unsetup(); | 2825 | kvm_arch_hardware_unsetup(); |
| 2826 | kvm_arch_exit(); | 2826 | kvm_arch_exit(); |
| 2827 | kvm_exit_debug(); | ||
| 2828 | free_cpumask_var(cpus_hardware_enabled); | 2827 | free_cpumask_var(cpus_hardware_enabled); |
| 2829 | __free_page(bad_page); | 2828 | __free_page(bad_page); |
| 2830 | } | 2829 | } |
