diff options
566 files changed, 6420 insertions, 7104 deletions
@@ -508,12 +508,8 @@ D: REINER SCT cyberJack pinpad/e-com USB chipcard reader driver | |||
508 | S: Germany | 508 | S: Germany |
509 | 509 | ||
510 | N: Adrian Bunk | 510 | N: Adrian Bunk |
511 | E: bunk@stusta.de | ||
512 | P: 1024D/4F12B400 B29C E71E FE19 6755 5C8A 84D4 99FC EA98 4F12 B400 | 511 | P: 1024D/4F12B400 B29C E71E FE19 6755 5C8A 84D4 99FC EA98 4F12 B400 |
513 | D: misc kernel hacking and testing | 512 | D: misc kernel hacking and testing |
514 | S: Grasmeierstrasse 11 | ||
515 | S: 80805 Muenchen | ||
516 | S: Germany | ||
517 | 513 | ||
518 | N: Ray Burr | 514 | N: Ray Burr |
519 | E: ryb@nightmare.com | 515 | E: ryb@nightmare.com |
@@ -1124,6 +1120,9 @@ S: 1150 Ringwood Court | |||
1124 | S: San Jose, California 95131 | 1120 | S: San Jose, California 95131 |
1125 | S: USA | 1121 | S: USA |
1126 | 1122 | ||
1123 | N: Adam Fritzler | ||
1124 | E: mid@zigamorph.net | ||
1125 | |||
1127 | N: Fernando Fuganti | 1126 | N: Fernando Fuganti |
1128 | E: fuganti@conectiva.com.br | 1127 | E: fuganti@conectiva.com.br |
1129 | E: fuganti@netbank.com.br | 1128 | E: fuganti@netbank.com.br |
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index c3014df066c4..40ac7759c3bb 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -154,7 +154,7 @@ firmware_class/ | |||
154 | - request_firmware() hotplug interface info. | 154 | - request_firmware() hotplug interface info. |
155 | floppy.txt | 155 | floppy.txt |
156 | - notes and driver options for the floppy disk driver. | 156 | - notes and driver options for the floppy disk driver. |
157 | fujitsu/ | 157 | frv/ |
158 | - Fujitsu FR-V Linux documentation. | 158 | - Fujitsu FR-V Linux documentation. |
159 | gpio.txt | 159 | gpio.txt |
160 | - overview of GPIO (General Purpose Input/Output) access conventions. | 160 | - overview of GPIO (General Purpose Input/Output) access conventions. |
@@ -364,8 +364,6 @@ sharedsubtree.txt | |||
364 | - a description of shared subtrees for namespaces. | 364 | - a description of shared subtrees for namespaces. |
365 | smart-config.txt | 365 | smart-config.txt |
366 | - description of the Smart Config makefile feature. | 366 | - description of the Smart Config makefile feature. |
367 | smp.txt | ||
368 | - a few notes on symmetric multi-processing. | ||
369 | sony-laptop.txt | 367 | sony-laptop.txt |
370 | - Sony Notebook Control Driver (SNC) Readme. | 368 | - Sony Notebook Control Driver (SNC) Readme. |
371 | sonypi.txt | 369 | sonypi.txt |
diff --git a/Documentation/BUG-HUNTING b/Documentation/BUG-HUNTING index 35f5bd243336..6c816751b868 100644 --- a/Documentation/BUG-HUNTING +++ b/Documentation/BUG-HUNTING | |||
@@ -53,7 +53,7 @@ Finding it the old way | |||
53 | 53 | ||
54 | [Sat Mar 2 10:32:33 PST 1996 KERNEL_BUG-HOWTO lm@sgi.com (Larry McVoy)] | 54 | [Sat Mar 2 10:32:33 PST 1996 KERNEL_BUG-HOWTO lm@sgi.com (Larry McVoy)] |
55 | 55 | ||
56 | This is how to track down a bug if you know nothing about kernel hacking. | 56 | This is how to track down a bug if you know nothing about kernel hacking. |
57 | It's a brute force approach but it works pretty well. | 57 | It's a brute force approach but it works pretty well. |
58 | 58 | ||
59 | You need: | 59 | You need: |
@@ -66,12 +66,12 @@ You will then do: | |||
66 | 66 | ||
67 | . Rebuild a revision that you believe works, install, and verify that. | 67 | . Rebuild a revision that you believe works, install, and verify that. |
68 | . Do a binary search over the kernels to figure out which one | 68 | . Do a binary search over the kernels to figure out which one |
69 | introduced the bug. I.e., suppose 1.3.28 didn't have the bug, but | 69 | introduced the bug. I.e., suppose 1.3.28 didn't have the bug, but |
70 | you know that 1.3.69 does. Pick a kernel in the middle and build | 70 | you know that 1.3.69 does. Pick a kernel in the middle and build |
71 | that, like 1.3.50. Build & test; if it works, pick the mid point | 71 | that, like 1.3.50. Build & test; if it works, pick the mid point |
72 | between .50 and .69, else the mid point between .28 and .50. | 72 | between .50 and .69, else the mid point between .28 and .50. |
73 | . You'll narrow it down to the kernel that introduced the bug. You | 73 | . You'll narrow it down to the kernel that introduced the bug. You |
74 | can probably do better than this but it gets tricky. | 74 | can probably do better than this but it gets tricky. |
75 | 75 | ||
76 | . Narrow it down to a subdirectory | 76 | . Narrow it down to a subdirectory |
77 | 77 | ||
@@ -81,27 +81,27 @@ You will then do: | |||
81 | directories: | 81 | directories: |
82 | 82 | ||
83 | Copy the non-working directory next to the working directory | 83 | Copy the non-working directory next to the working directory |
84 | as "dir.63". | 84 | as "dir.63". |
85 | One directory at time, try moving the working directory to | 85 | One directory at time, try moving the working directory to |
86 | "dir.62" and mv dir.63 dir"time, try | 86 | "dir.62" and mv dir.63 dir"time, try |
87 | 87 | ||
88 | mv dir dir.62 | 88 | mv dir dir.62 |
89 | mv dir.63 dir | 89 | mv dir.63 dir |
90 | find dir -name '*.[oa]' -print | xargs rm -f | 90 | find dir -name '*.[oa]' -print | xargs rm -f |
91 | 91 | ||
92 | And then rebuild and retest. Assuming that all related | 92 | And then rebuild and retest. Assuming that all related |
93 | changes were contained in the sub directory, this should | 93 | changes were contained in the sub directory, this should |
94 | isolate the change to a directory. | 94 | isolate the change to a directory. |
95 | 95 | ||
96 | Problems: changes in header files may have occurred; I've | 96 | Problems: changes in header files may have occurred; I've |
97 | found in my case that they were self explanatory - you may | 97 | found in my case that they were self explanatory - you may |
98 | or may not want to give up when that happens. | 98 | or may not want to give up when that happens. |
99 | 99 | ||
100 | . Narrow it down to a file | 100 | . Narrow it down to a file |
101 | 101 | ||
102 | - You can apply the same technique to each file in the directory, | 102 | - You can apply the same technique to each file in the directory, |
103 | hoping that the changes in that file are self contained. | 103 | hoping that the changes in that file are self contained. |
104 | 104 | ||
105 | . Narrow it down to a routine | 105 | . Narrow it down to a routine |
106 | 106 | ||
107 | - You can take the old file and the new file and manually create | 107 | - You can take the old file and the new file and manually create |
@@ -130,7 +130,7 @@ You will then do: | |||
130 | that makes the difference. | 130 | that makes the difference. |
131 | 131 | ||
132 | Finally, you take all the info that you have, kernel revisions, bug | 132 | Finally, you take all the info that you have, kernel revisions, bug |
133 | description, the extent to which you have narrowed it down, and pass | 133 | description, the extent to which you have narrowed it down, and pass |
134 | that off to whomever you believe is the maintainer of that section. | 134 | that off to whomever you believe is the maintainer of that section. |
135 | A post to linux.dev.kernel isn't such a bad idea if you've done some | 135 | A post to linux.dev.kernel isn't such a bad idea if you've done some |
136 | work to narrow it down. | 136 | work to narrow it down. |
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 681e2b36195c..08a1ed1cb5d8 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches | |||
@@ -220,20 +220,8 @@ decreasing the likelihood of your MIME-attached change being accepted. | |||
220 | Exception: If your mailer is mangling patches then someone may ask | 220 | Exception: If your mailer is mangling patches then someone may ask |
221 | you to re-send them using MIME. | 221 | you to re-send them using MIME. |
222 | 222 | ||
223 | 223 | See Documentation/email-clients.txt for hints about configuring | |
224 | WARNING: Some mailers like Mozilla send your messages with | 224 | your e-mail client so that it sends your patches untouched. |
225 | ---- message header ---- | ||
226 | Content-Type: text/plain; charset=us-ascii; format=flowed | ||
227 | ---- message header ---- | ||
228 | The problem is that "format=flowed" makes some of the mailers | ||
229 | on receiving side to replace TABs with spaces and do similar | ||
230 | changes. Thus the patches from you can look corrupted. | ||
231 | |||
232 | To fix this just make your mozilla defaults/pref/mailnews.js file to look like: | ||
233 | pref("mailnews.send_plaintext_flowed", false); // RFC 2646======= | ||
234 | pref("mailnews.display.disable_format_flowed_support", true); | ||
235 | |||
236 | |||
237 | 225 | ||
238 | 8) E-mail size. | 226 | 8) E-mail size. |
239 | 227 | ||
diff --git a/Documentation/arm/Sharp-LH/IOBarrier b/Documentation/arm/Sharp-LH/IOBarrier index c0d8853672dc..2e953e228f4d 100644 --- a/Documentation/arm/Sharp-LH/IOBarrier +++ b/Documentation/arm/Sharp-LH/IOBarrier | |||
@@ -32,7 +32,7 @@ BARRIER IO before the access to the SMC chip because the AEN latch | |||
32 | only needs occurs after the SMC IO write cycle. The routines that | 32 | only needs occurs after the SMC IO write cycle. The routines that |
33 | implement this work-around make an additional concession which is to | 33 | implement this work-around make an additional concession which is to |
34 | disable interrupts during the IO sequence. Other hardware devices | 34 | disable interrupts during the IO sequence. Other hardware devices |
35 | (the LogicPD CPLD) have registers in the same the physical memory | 35 | (the LogicPD CPLD) have registers in the same physical memory |
36 | region as the SMC chip. An interrupt might allow an access to one of | 36 | region as the SMC chip. An interrupt might allow an access to one of |
37 | those registers while SMC IO is being performed. | 37 | those registers while SMC IO is being performed. |
38 | 38 | ||
diff --git a/Documentation/debugging-modules.txt b/Documentation/debugging-modules.txt index 24029f65fc94..172ad4aec493 100644 --- a/Documentation/debugging-modules.txt +++ b/Documentation/debugging-modules.txt | |||
@@ -16,3 +16,7 @@ echo 'echo "$@" >> /tmp/modprobe.log' >> /tmp/modprobe | |||
16 | echo 'exec /sbin/modprobe "$@"' >> /tmp/modprobe | 16 | echo 'exec /sbin/modprobe "$@"' >> /tmp/modprobe |
17 | chmod a+x /tmp/modprobe | 17 | chmod a+x /tmp/modprobe |
18 | echo /tmp/modprobe > /proc/sys/kernel/modprobe | 18 | echo /tmp/modprobe > /proc/sys/kernel/modprobe |
19 | |||
20 | Note that the above applies only when the *kernel* is requesting | ||
21 | that the module be loaded -- it won't have any effect if that module | ||
22 | is being loaded explicitly using "modprobe" from userspace. | ||
diff --git a/Documentation/driver-model/platform.txt b/Documentation/driver-model/platform.txt index 2a97320ee17f..83009fdcbbc8 100644 --- a/Documentation/driver-model/platform.txt +++ b/Documentation/driver-model/platform.txt | |||
@@ -122,15 +122,15 @@ None the less, there are some APIs to support such legacy drivers. Avoid | |||
122 | using these calls except with such hotplug-deficient drivers. | 122 | using these calls except with such hotplug-deficient drivers. |
123 | 123 | ||
124 | struct platform_device *platform_device_alloc( | 124 | struct platform_device *platform_device_alloc( |
125 | char *name, unsigned id); | 125 | const char *name, int id); |
126 | 126 | ||
127 | You can use platform_device_alloc() to dynamically allocate a device, which | 127 | You can use platform_device_alloc() to dynamically allocate a device, which |
128 | you will then initialize with resources and platform_device_register(). | 128 | you will then initialize with resources and platform_device_register(). |
129 | A better solution is usually: | 129 | A better solution is usually: |
130 | 130 | ||
131 | struct platform_device *platform_device_register_simple( | 131 | struct platform_device *platform_device_register_simple( |
132 | char *name, unsigned id, | 132 | const char *name, int id, |
133 | struct resource *res, unsigned nres); | 133 | struct resource *res, unsigned int nres); |
134 | 134 | ||
135 | You can use platform_device_register_simple() as a one-step call to allocate | 135 | You can use platform_device_register_simple() as a one-step call to allocate |
136 | and register a device. | 136 | and register a device. |
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt index d1b98257d000..44c97e6accb2 100644 --- a/Documentation/filesystems/configfs/configfs.txt +++ b/Documentation/filesystems/configfs/configfs.txt | |||
@@ -377,7 +377,7 @@ more explicit to have a method whereby userspace sees this divergence. | |||
377 | Rather than have a group where some items behave differently than | 377 | Rather than have a group where some items behave differently than |
378 | others, configfs provides a method whereby one or many subgroups are | 378 | others, configfs provides a method whereby one or many subgroups are |
379 | automatically created inside the parent at its creation. Thus, | 379 | automatically created inside the parent at its creation. Thus, |
380 | mkdir("parent) results in "parent", "parent/subgroup1", up through | 380 | mkdir("parent") results in "parent", "parent/subgroup1", up through |
381 | "parent/subgroupN". Items of type 1 can now be created in | 381 | "parent/subgroupN". Items of type 1 can now be created in |
382 | "parent/subgroup1", and items of type N can be created in | 382 | "parent/subgroup1", and items of type N can be created in |
383 | "parent/subgroupN". | 383 | "parent/subgroupN". |
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting index dac45c92d872..0f33c77bc14b 100644 --- a/Documentation/filesystems/porting +++ b/Documentation/filesystems/porting | |||
@@ -1,6 +1,6 @@ | |||
1 | Changes since 2.5.0: | 1 | Changes since 2.5.0: |
2 | 2 | ||
3 | --- | 3 | --- |
4 | [recommended] | 4 | [recommended] |
5 | 5 | ||
6 | New helpers: sb_bread(), sb_getblk(), sb_find_get_block(), set_bh(), | 6 | New helpers: sb_bread(), sb_getblk(), sb_find_get_block(), set_bh(), |
@@ -10,7 +10,7 @@ Use them. | |||
10 | 10 | ||
11 | (sb_find_get_block() replaces 2.4's get_hash_table()) | 11 | (sb_find_get_block() replaces 2.4's get_hash_table()) |
12 | 12 | ||
13 | --- | 13 | --- |
14 | [recommended] | 14 | [recommended] |
15 | 15 | ||
16 | New methods: ->alloc_inode() and ->destroy_inode(). | 16 | New methods: ->alloc_inode() and ->destroy_inode(). |
@@ -28,7 +28,7 @@ Declare | |||
28 | 28 | ||
29 | Use FOO_I(inode) instead of &inode->u.foo_inode_i; | 29 | Use FOO_I(inode) instead of &inode->u.foo_inode_i; |
30 | 30 | ||
31 | Add foo_alloc_inode() and foo_destory_inode() - the former should allocate | 31 | Add foo_alloc_inode() and foo_destroy_inode() - the former should allocate |
32 | foo_inode_info and return the address of ->vfs_inode, the latter should free | 32 | foo_inode_info and return the address of ->vfs_inode, the latter should free |
33 | FOO_I(inode) (see in-tree filesystems for examples). | 33 | FOO_I(inode) (see in-tree filesystems for examples). |
34 | 34 | ||
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 194c8f351320..0b1b0c008613 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -216,6 +216,7 @@ Table 1-3: Contents of the stat files (as of 2.6.22-rc3) | |||
216 | priority priority level | 216 | priority priority level |
217 | nice nice level | 217 | nice nice level |
218 | num_threads number of threads | 218 | num_threads number of threads |
219 | it_real_value (obsolete, always 0) | ||
219 | start_time time the process started after system boot | 220 | start_time time the process started after system boot |
220 | vsize virtual memory size | 221 | vsize virtual memory size |
221 | rss resident set memory size | 222 | rss resident set memory size |
diff --git a/Documentation/filesystems/ramfs-rootfs-initramfs.txt b/Documentation/filesystems/ramfs-rootfs-initramfs.txt index 339c6a4f220e..7be232b44ee4 100644 --- a/Documentation/filesystems/ramfs-rootfs-initramfs.txt +++ b/Documentation/filesystems/ramfs-rootfs-initramfs.txt | |||
@@ -118,7 +118,7 @@ All this differs from the old initrd in several ways: | |||
118 | with the new root (cd /newmount; mount --move . /; chroot .), attach | 118 | with the new root (cd /newmount; mount --move . /; chroot .), attach |
119 | stdin/stdout/stderr to the new /dev/console, and exec the new init. | 119 | stdin/stdout/stderr to the new /dev/console, and exec the new init. |
120 | 120 | ||
121 | Since this is a remarkably persnickity process (and involves deleting | 121 | Since this is a remarkably persnickety process (and involves deleting |
122 | commands before you can run them), the klibc package introduced a helper | 122 | commands before you can run them), the klibc package introduced a helper |
123 | program (utils/run_init.c) to do all this for you. Most other packages | 123 | program (utils/run_init.c) to do all this for you. Most other packages |
124 | (such as busybox) have named this command "switch_root". | 124 | (such as busybox) have named this command "switch_root". |
diff --git a/Documentation/filesystems/relay.txt b/Documentation/filesystems/relay.txt index 18d23f9a18c7..094f2d2f38b1 100644 --- a/Documentation/filesystems/relay.txt +++ b/Documentation/filesystems/relay.txt | |||
@@ -140,7 +140,7 @@ close() decrements the channel buffer's refcount. When the refcount | |||
140 | In order for a user application to make use of relay files, the | 140 | In order for a user application to make use of relay files, the |
141 | host filesystem must be mounted. For example, | 141 | host filesystem must be mounted. For example, |
142 | 142 | ||
143 | mount -t debugfs debugfs /debug | 143 | mount -t debugfs debugfs /sys/kernel/debug |
144 | 144 | ||
145 | NOTE: the host filesystem doesn't need to be mounted for kernel | 145 | NOTE: the host filesystem doesn't need to be mounted for kernel |
146 | clients to create or use channels - it only needs to be | 146 | clients to create or use channels - it only needs to be |
diff --git a/Documentation/fujitsu/frv/README.txt b/Documentation/frv/README.txt index a984faa968e8..a984faa968e8 100644 --- a/Documentation/fujitsu/frv/README.txt +++ b/Documentation/frv/README.txt | |||
diff --git a/Documentation/fujitsu/frv/atomic-ops.txt b/Documentation/frv/atomic-ops.txt index 96638e9b9fe0..96638e9b9fe0 100644 --- a/Documentation/fujitsu/frv/atomic-ops.txt +++ b/Documentation/frv/atomic-ops.txt | |||
diff --git a/Documentation/fujitsu/frv/booting.txt b/Documentation/frv/booting.txt index 4e229056ef22..ace200b7c214 100644 --- a/Documentation/fujitsu/frv/booting.txt +++ b/Documentation/frv/booting.txt | |||
@@ -177,5 +177,5 @@ separated by spaces: | |||
177 | (*) vdc=... | 177 | (*) vdc=... |
178 | 178 | ||
179 | This option configures the MB93493 companion chip visual display | 179 | This option configures the MB93493 companion chip visual display |
180 | driver. Please see Documentation/fujitsu/mb93493/vdc.txt for more | 180 | driver. Please see Documentation/frv/mb93493/vdc.txt for more |
181 | information. | 181 | information. |
diff --git a/Documentation/fujitsu/frv/clock.txt b/Documentation/frv/clock.txt index c72d350e177a..c72d350e177a 100644 --- a/Documentation/fujitsu/frv/clock.txt +++ b/Documentation/frv/clock.txt | |||
diff --git a/Documentation/fujitsu/frv/configuring.txt b/Documentation/frv/configuring.txt index 36e76a2336fa..36e76a2336fa 100644 --- a/Documentation/fujitsu/frv/configuring.txt +++ b/Documentation/frv/configuring.txt | |||
diff --git a/Documentation/fujitsu/frv/features.txt b/Documentation/frv/features.txt index fa20c0e72833..fa20c0e72833 100644 --- a/Documentation/fujitsu/frv/features.txt +++ b/Documentation/frv/features.txt | |||
diff --git a/Documentation/fujitsu/frv/gdbinit b/Documentation/frv/gdbinit index 51517b6f307f..51517b6f307f 100644 --- a/Documentation/fujitsu/frv/gdbinit +++ b/Documentation/frv/gdbinit | |||
diff --git a/Documentation/fujitsu/frv/gdbstub.txt b/Documentation/frv/gdbstub.txt index b92bfd902a4e..b92bfd902a4e 100644 --- a/Documentation/fujitsu/frv/gdbstub.txt +++ b/Documentation/frv/gdbstub.txt | |||
diff --git a/Documentation/fujitsu/frv/kernel-ABI.txt b/Documentation/frv/kernel-ABI.txt index aaa1cec86f0b..aaa1cec86f0b 100644 --- a/Documentation/fujitsu/frv/kernel-ABI.txt +++ b/Documentation/frv/kernel-ABI.txt | |||
diff --git a/Documentation/fujitsu/frv/mmu-layout.txt b/Documentation/frv/mmu-layout.txt index db10250df6be..db10250df6be 100644 --- a/Documentation/fujitsu/frv/mmu-layout.txt +++ b/Documentation/frv/mmu-layout.txt | |||
diff --git a/Documentation/ide/ChangeLog.ide-tape.1995-2002 b/Documentation/ide/ChangeLog.ide-tape.1995-2002 new file mode 100644 index 000000000000..877fac8770b3 --- /dev/null +++ b/Documentation/ide/ChangeLog.ide-tape.1995-2002 | |||
@@ -0,0 +1,257 @@ | |||
1 | /* | ||
2 | * Ver 0.1 Nov 1 95 Pre-working code :-) | ||
3 | * Ver 0.2 Nov 23 95 A short backup (few megabytes) and restore procedure | ||
4 | * was successful ! (Using tar cvf ... on the block | ||
5 | * device interface). | ||
6 | * A longer backup resulted in major swapping, bad | ||
7 | * overall Linux performance and eventually failed as | ||
8 | * we received non serial read-ahead requests from the | ||
9 | * buffer cache. | ||
10 | * Ver 0.3 Nov 28 95 Long backups are now possible, thanks to the | ||
11 | * character device interface. Linux's responsiveness | ||
12 | * and performance doesn't seem to be much affected | ||
13 | * from the background backup procedure. | ||
14 | * Some general mtio.h magnetic tape operations are | ||
15 | * now supported by our character device. As a result, | ||
16 | * popular tape utilities are starting to work with | ||
17 | * ide tapes :-) | ||
18 | * The following configurations were tested: | ||
19 | * 1. An IDE ATAPI TAPE shares the same interface | ||
20 | * and irq with an IDE ATAPI CDROM. | ||
21 | * 2. An IDE ATAPI TAPE shares the same interface | ||
22 | * and irq with a normal IDE disk. | ||
23 | * Both configurations seemed to work just fine ! | ||
24 | * However, to be on the safe side, it is meanwhile | ||
25 | * recommended to give the IDE TAPE its own interface | ||
26 | * and irq. | ||
27 | * The one thing which needs to be done here is to | ||
28 | * add a "request postpone" feature to ide.c, | ||
29 | * so that we won't have to wait for the tape to finish | ||
30 | * performing a long media access (DSC) request (such | ||
31 | * as a rewind) before we can access the other device | ||
32 | * on the same interface. This effect doesn't disturb | ||
33 | * normal operation most of the time because read/write | ||
34 | * requests are relatively fast, and once we are | ||
35 | * performing one tape r/w request, a lot of requests | ||
36 | * from the other device can be queued and ide.c will | ||
37 | * service all of them after this single tape request. | ||
38 | * Ver 1.0 Dec 11 95 Integrated into Linux 1.3.46 development tree. | ||
39 | * On each read / write request, we now ask the drive | ||
40 | * if we can transfer a constant number of bytes | ||
41 | * (a parameter of the drive) only to its buffers, | ||
42 | * without causing actual media access. If we can't, | ||
43 | * we just wait until we can by polling the DSC bit. | ||
44 | * This ensures that while we are not transferring | ||
45 | * more bytes than the constant referred to above, the | ||
46 | * interrupt latency will not become too high and | ||
47 | * we won't cause an interrupt timeout, as happened | ||
48 | * occasionally in the previous version. | ||
49 | * While polling for DSC, the current request is | ||
50 | * postponed and ide.c is free to handle requests from | ||
51 | * the other device. This is handled transparently to | ||
52 | * ide.c. The hwgroup locking method which was used | ||
53 | * in the previous version was removed. | ||
54 | * Use of new general features which are provided by | ||
55 | * ide.c for use with atapi devices. | ||
56 | * (Programming done by Mark Lord) | ||
57 | * Few potential bug fixes (Again, suggested by Mark) | ||
58 | * Single character device data transfers are now | ||
59 | * not limited in size, as they were before. | ||
60 | * We are asking the tape about its recommended | ||
61 | * transfer unit and send a larger data transfer | ||
62 | * as several transfers of the above size. | ||
63 | * For best results, use an integral number of this | ||
64 | * basic unit (which is shown during driver | ||
65 | * initialization). I will soon add an ioctl to get | ||
66 | * this important parameter. | ||
67 | * Our data transfer buffer is allocated on startup, | ||
68 | * rather than before each data transfer. This should | ||
69 | * ensure that we will indeed have a data buffer. | ||
70 | * Ver 1.1 Dec 14 95 Fixed random problems which occurred when the tape | ||
71 | * shared an interface with another device. | ||
72 | * (poll_for_dsc was a complete mess). | ||
73 | * Removed some old (non-active) code which had | ||
74 | * to do with supporting buffer cache originated | ||
75 | * requests. | ||
76 | * The block device interface can now be opened, so | ||
77 | * that general ide driver features like the unmask | ||
78 | * interrupts flag can be selected with an ioctl. | ||
79 | * This is the only use of the block device interface. | ||
80 | * New fast pipelined operation mode (currently only on | ||
81 | * writes). When using the pipelined mode, the | ||
82 | * throughput can potentially reach the maximum | ||
83 | * tape supported throughput, regardless of the | ||
84 | * user backup program. On my tape drive, it sometimes | ||
85 | * boosted performance by a factor of 2. Pipelined | ||
86 | * mode is enabled by default, but since it has a few | ||
87 | * downfalls as well, you may want to disable it. | ||
88 | * A short explanation of the pipelined operation mode | ||
89 | * is available below. | ||
90 | * Ver 1.2 Jan 1 96 Eliminated pipelined mode race condition. | ||
91 | * Added pipeline read mode. As a result, restores | ||
92 | * are now as fast as backups. | ||
93 | * Optimized shared interface behavior. The new behavior | ||
94 | * typically results in better IDE bus efficiency and | ||
95 | * higher tape throughput. | ||
96 | * Pre-calculation of the expected read/write request | ||
97 | * service time, based on the tape's parameters. In | ||
98 | * the pipelined operation mode, this allows us to | ||
99 | * adjust our polling frequency to a much lower value, | ||
100 | * and thus to dramatically reduce our load on Linux, | ||
101 | * without any decrease in performance. | ||
102 | * Implemented additional mtio.h operations. | ||
103 | * The recommended user block size is returned by | ||
104 | * the MTIOCGET ioctl. | ||
105 | * Additional minor changes. | ||
106 | * Ver 1.3 Feb 9 96 Fixed pipelined read mode bug which prevented the | ||
107 | * use of some block sizes during a restore procedure. | ||
108 | * The character device interface will now present a | ||
109 | * continuous view of the media - any mix of block sizes | ||
110 | * during a backup/restore procedure is supported. The | ||
111 | * driver will buffer the requests internally and | ||
112 | * convert them to the tape's recommended transfer | ||
113 | * unit, making performance almost independent of the | ||
114 | * chosen user block size. | ||
115 | * Some improvements in error recovery. | ||
116 | * By cooperating with ide-dma.c, bus mastering DMA can | ||
117 | * now sometimes be used with IDE tape drives as well. | ||
118 | * Bus mastering DMA has the potential to dramatically | ||
119 | * reduce the CPU's overhead when accessing the device, | ||
120 | * and can be enabled by using hdparm -d1 on the tape's | ||
121 | * block device interface. For more info, read the | ||
122 | * comments in ide-dma.c. | ||
123 | * Ver 1.4 Mar 13 96 Fixed serialize support. | ||
124 | * Ver 1.5 Apr 12 96 Fixed shared interface operation, broken in 1.3.85. | ||
125 | * Fixed pipelined read mode inefficiency. | ||
126 | * Fixed nasty null dereferencing bug. | ||
127 | * Ver 1.6 Aug 16 96 Fixed FPU usage in the driver. | ||
128 | * Fixed end of media bug. | ||
129 | * Ver 1.7 Sep 10 96 Minor changes for the CONNER CTT8000-A model. | ||
130 | * Ver 1.8 Sep 26 96 Attempt to find a better balance between good | ||
131 | * interactive response and high system throughput. | ||
132 | * Ver 1.9 Nov 5 96 Automatically cross encountered filemarks rather | ||
133 | * than requiring an explicit FSF command. | ||
134 | * Abort pending requests at end of media. | ||
135 | * MTTELL was sometimes returning incorrect results. | ||
136 | * Return the real block size in the MTIOCGET ioctl. | ||
137 | * Some error recovery bug fixes. | ||
138 | * Ver 1.10 Nov 5 96 Major reorganization. | ||
139 | * Reduced CPU overhead a bit by eliminating internal | ||
140 | * bounce buffers. | ||
141 | * Added module support. | ||
142 | * Added multiple tape drives support. | ||
143 | * Added partition support. | ||
144 | * Rewrote DSC handling. | ||
145 | * Some portability fixes. | ||
146 | * Removed ide-tape.h. | ||
147 | * Additional minor changes. | ||
148 | * Ver 1.11 Dec 2 96 Bug fix in previous DSC timeout handling. | ||
149 | * Use ide_stall_queue() for DSC overlap. | ||
150 | * Use the maximum speed rather than the current speed | ||
151 | * to compute the request service time. | ||
152 | * Ver 1.12 Dec 7 97 Fix random memory overwriting and/or last block data | ||
153 | * corruption, which could occur if the total number | ||
154 | * of bytes written to the tape was not an integral | ||
155 | * number of tape blocks. | ||
156 | * Add support for INTERRUPT DRQ devices. | ||
157 | * Ver 1.13 Jan 2 98 Add "speed == 0" work-around for HP COLORADO 5GB | ||
158 | * Ver 1.14 Dec 30 98 Partial fixes for the Sony/AIWA tape drives. | ||
159 | * Replace cli()/sti() with hwgroup spinlocks. | ||
160 | * Ver 1.15 Mar 25 99 Fix SMP race condition by replacing hwgroup | ||
161 | * spinlock with private per-tape spinlock. | ||
162 | * Ver 1.16 Sep 1 99 Add OnStream tape support. | ||
163 | * Abort read pipeline on EOD. | ||
164 | * Wait for the tape to become ready in case it returns | ||
165 | * "in the process of becoming ready" on open(). | ||
166 | * Fix zero padding of the last written block in | ||
167 | * case the tape block size is larger than PAGE_SIZE. | ||
168 | * Decrease the default disconnection time to tn. | ||
169 | * Ver 1.16e Oct 3 99 Minor fixes. | ||
170 | * Ver 1.16e1 Oct 13 99 Patches by Arnold Niessen, | ||
171 | * niessen@iae.nl / arnold.niessen@philips.com | ||
172 | * GO-1) Undefined code in idetape_read_position | ||
173 | * according to Gadi's email | ||
174 | * AJN-1) Minor fix asc == 11 should be asc == 0x11 | ||
175 | * in idetape_issue_packet_command (did effect | ||
176 | * debugging output only) | ||
177 | * AJN-2) Added more debugging output, and | ||
178 | * added ide-tape: where missing. I would also | ||
179 | * like to add tape->name where possible | ||
180 | * AJN-3) Added different debug_level's | ||
181 | * via /proc/ide/hdc/settings | ||
182 | * "debug_level" determines amount of debugging output; | ||
183 | * can be changed using /proc/ide/hdx/settings | ||
184 | * 0 : almost no debugging output | ||
185 | * 1 : 0+output errors only | ||
186 | * 2 : 1+output all sensekey/asc | ||
187 | * 3 : 2+follow all chrdev related procedures | ||
188 | * 4 : 3+follow all procedures | ||
189 | * 5 : 4+include pc_stack rq_stack info | ||
190 | * 6 : 5+USE_COUNT updates | ||
191 | * AJN-4) Fixed timeout for retension in idetape_queue_pc_tail | ||
192 | * from 5 to 10 minutes | ||
193 | * AJN-5) Changed maximum number of blocks to skip when | ||
194 | * reading tapes with multiple consecutive write | ||
195 | * errors from 100 to 1000 in idetape_get_logical_blk | ||
196 | * Proposed changes to code: | ||
197 | * 1) output "logical_blk_num" via /proc | ||
198 | * 2) output "current_operation" via /proc | ||
199 | * 3) Either solve or document the fact that `mt rewind' is | ||
200 | * required after reading from /dev/nhtx to be | ||
201 | * able to rmmod the idetape module; | ||
202 | * Also, sometimes an application finishes but the | ||
203 | * device remains `busy' for some time. Same cause ? | ||
204 | * Proposed changes to release-notes: | ||
205 | * 4) write a simple `quickstart' section in the | ||
206 | * release notes; I volunteer if you don't want to | ||
207 | * 5) include a pointer to video4linux in the doc | ||
208 | * to stimulate video applications | ||
209 | * 6) release notes lines 331 and 362: explain what happens | ||
210 | * if the application data rate is higher than 1100 KB/s; | ||
211 | * similar approach to lower-than-500 kB/s ? | ||
212 | * 7) 6.6 Comparison; wouldn't it be better to allow different | ||
213 | * strategies for read and write ? | ||
214 | * Wouldn't it be better to control the tape buffer | ||
215 | * contents instead of the bandwidth ? | ||
216 | * 8) line 536: replace will by would (if I understand | ||
217 | * this section correctly, a hypothetical and unwanted situation | ||
218 | * is being described) | ||
219 | * Ver 1.16f Dec 15 99 Change place of the secondary OnStream header frames. | ||
220 | * Ver 1.17 Nov 2000 / Jan 2001 Marcel Mol, marcel@mesa.nl | ||
221 | * - Add idetape_onstream_mode_sense_tape_parameter_page | ||
222 | * function to get tape capacity in frames: tape->capacity. | ||
223 | * - Add support for DI-50 drives( or any DI- drive). | ||
224 | * - 'workaround' for read error/blank block around block 3000. | ||
225 | * - Implement Early warning for end of media for Onstream. | ||
226 | * - Cosmetic code changes for readability. | ||
227 | * - Idetape_position_tape should not use SKIP bit during | ||
228 | * Onstream read recovery. | ||
229 | * - Add capacity, logical_blk_num and first/last_frame_position | ||
230 | * to /proc/ide/hd?/settings. | ||
231 | * - Module use count was gone in the Linux 2.4 driver. | ||
232 | * Ver 1.17a Apr 2001 Willem Riede osst@riede.org | ||
233 | * - Get drive's actual block size from mode sense block descriptor | ||
234 | * - Limit size of pipeline | ||
235 | * Ver 1.17b Oct 2002 Alan Stern <stern@rowland.harvard.edu> | ||
236 | * Changed IDETAPE_MIN_PIPELINE_STAGES to 1 and actually used | ||
237 | * it in the code! | ||
238 | * Actually removed aborted stages in idetape_abort_pipeline | ||
239 | * instead of just changing the command code. | ||
240 | * Made the transfer byte count for Request Sense equal to the | ||
241 | * actual length of the data transfer. | ||
242 | * Changed handling of partial data transfers: they do not | ||
243 | * cause DMA errors. | ||
244 | * Moved initiation of DMA transfers to the correct place. | ||
245 | * Removed reference to unallocated memory. | ||
246 | * Made __idetape_discard_read_pipeline return the number of | ||
247 | * sectors skipped, not the number of stages. | ||
248 | * Replaced errant kfree() calls with __idetape_kfree_stage(). | ||
249 | * Fixed off-by-one error in testing the pipeline length. | ||
250 | * Fixed handling of filemarks in the read pipeline. | ||
251 | * Small code optimization for MTBSF and MTBSFM ioctls. | ||
252 | * Don't try to unlock the door during device close if is | ||
253 | * already unlocked! | ||
254 | * Cosmetic fixes to miscellaneous debugging output messages. | ||
255 | * Set the minimum /proc/ide/hd?/settings values for "pipeline", | ||
256 | * "pipeline_min", and "pipeline_max" to 1. | ||
257 | */ | ||
diff --git a/Documentation/ide/ide-tape.txt b/Documentation/ide/ide-tape.txt new file mode 100644 index 000000000000..658f271a373f --- /dev/null +++ b/Documentation/ide/ide-tape.txt | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * IDE ATAPI streaming tape driver. | ||
3 | * | ||
4 | * This driver is a part of the Linux ide driver. | ||
5 | * | ||
6 | * The driver, in co-operation with ide.c, basically traverses the | ||
7 | * request-list for the block device interface. The character device | ||
8 | * interface, on the other hand, creates new requests, adds them | ||
9 | * to the request-list of the block device, and waits for their completion. | ||
10 | * | ||
11 | * Pipelined operation mode is now supported on both reads and writes. | ||
12 | * | ||
13 | * The block device major and minor numbers are determined from the | ||
14 | * tape's relative position in the ide interfaces, as explained in ide.c. | ||
15 | * | ||
16 | * The character device interface consists of the following devices: | ||
17 | * | ||
18 | * ht0 major 37, minor 0 first IDE tape, rewind on close. | ||
19 | * ht1 major 37, minor 1 second IDE tape, rewind on close. | ||
20 | * ... | ||
21 | * nht0 major 37, minor 128 first IDE tape, no rewind on close. | ||
22 | * nht1 major 37, minor 129 second IDE tape, no rewind on close. | ||
23 | * ... | ||
24 | * | ||
25 | * The general magnetic tape commands compatible interface, as defined by | ||
26 | * include/linux/mtio.h, is accessible through the character device. | ||
27 | * | ||
28 | * General ide driver configuration options, such as the interrupt-unmask | ||
29 | * flag, can be configured by issuing an ioctl to the block device interface, | ||
30 | * as any other ide device. | ||
31 | * | ||
32 | * Our own ide-tape ioctl's can be issued to either the block device or | ||
33 | * the character device interface. | ||
34 | * | ||
35 | * Maximal throughput with minimal bus load will usually be achieved in the | ||
36 | * following scenario: | ||
37 | * | ||
38 | * 1. ide-tape is operating in the pipelined operation mode. | ||
39 | * 2. No buffering is performed by the user backup program. | ||
40 | * | ||
41 | * Testing was done with a 2 GB CONNER CTMA 4000 IDE ATAPI Streaming Tape Drive. | ||
42 | * | ||
43 | * Here are some words from the first releases of hd.c, which are quoted | ||
44 | * in ide.c and apply here as well: | ||
45 | * | ||
46 | * | Special care is recommended. Have Fun! | ||
47 | * | ||
48 | * | ||
49 | * An overview of the pipelined operation mode. | ||
50 | * | ||
51 | * In the pipelined write mode, we will usually just add requests to our | ||
52 | * pipeline and return immediately, before we even start to service them. The | ||
53 | * user program will then have enough time to prepare the next request while | ||
54 | * we are still busy servicing previous requests. In the pipelined read mode, | ||
55 | * the situation is similar - we add read-ahead requests into the pipeline, | ||
56 | * before the user even requested them. | ||
57 | * | ||
58 | * The pipeline can be viewed as a "safety net" which will be activated when | ||
59 | * the system load is high and prevents the user backup program from keeping up | ||
60 | * with the current tape speed. At this point, the pipeline will get | ||
61 | * shorter and shorter but the tape will still be streaming at the same speed. | ||
62 | * Assuming we have enough pipeline stages, the system load will hopefully | ||
63 | * decrease before the pipeline is completely empty, and the backup program | ||
64 | * will be able to "catch up" and refill the pipeline again. | ||
65 | * | ||
66 | * When using the pipelined mode, it would be best to disable any type of | ||
67 | * buffering done by the user program, as ide-tape already provides all the | ||
68 | * benefits in the kernel, where it can be done in a more efficient way. | ||
69 | * As we will usually not block the user program on a request, the most | ||
70 | * efficient user code will then be a simple read-write-read-... cycle. | ||
71 | * Any additional logic will usually just slow down the backup process. | ||
72 | * | ||
73 | * Using the pipelined mode, I get a constant over 400 KBps throughput, | ||
74 | * which seems to be the maximum throughput supported by my tape. | ||
75 | * | ||
76 | * However, there are some downfalls: | ||
77 | * | ||
78 | * 1. We use memory (for data buffers) in proportional to the number | ||
79 | * of pipeline stages (each stage is about 26 KB with my tape). | ||
80 | * 2. In the pipelined write mode, we cheat and postpone error codes | ||
81 | * to the user task. In read mode, the actual tape position | ||
82 | * will be a bit further than the last requested block. | ||
83 | * | ||
84 | * Concerning (1): | ||
85 | * | ||
86 | * 1. We allocate stages dynamically only when we need them. When | ||
87 | * we don't need them, we don't consume additional memory. In | ||
88 | * case we can't allocate stages, we just manage without them | ||
89 | * (at the expense of decreased throughput) so when Linux is | ||
90 | * tight in memory, we will not pose additional difficulties. | ||
91 | * | ||
92 | * 2. The maximum number of stages (which is, in fact, the maximum | ||
93 | * amount of memory) which we allocate is limited by the compile | ||
94 | * time parameter IDETAPE_MAX_PIPELINE_STAGES. | ||
95 | * | ||
96 | * 3. The maximum number of stages is a controlled parameter - We | ||
97 | * don't start from the user defined maximum number of stages | ||
98 | * but from the lower IDETAPE_MIN_PIPELINE_STAGES (again, we | ||
99 | * will not even allocate this amount of stages if the user | ||
100 | * program can't handle the speed). We then implement a feedback | ||
101 | * loop which checks if the pipeline is empty, and if it is, we | ||
102 | * increase the maximum number of stages as necessary until we | ||
103 | * reach the optimum value which just manages to keep the tape | ||
104 | * busy with minimum allocated memory or until we reach | ||
105 | * IDETAPE_MAX_PIPELINE_STAGES. | ||
106 | * | ||
107 | * Concerning (2): | ||
108 | * | ||
109 | * In pipelined write mode, ide-tape can not return accurate error codes | ||
110 | * to the user program since we usually just add the request to the | ||
111 | * pipeline without waiting for it to be serviced. In case an error | ||
112 | * occurs, I will report it on the next user request. | ||
113 | * | ||
114 | * In the pipelined read mode, subsequent read requests or forward | ||
115 | * filemark spacing will perform correctly, as we preserve all blocks | ||
116 | * and filemarks which we encountered during our excess read-ahead. | ||
117 | * | ||
118 | * For accurate tape positioning and error reporting, disabling | ||
119 | * pipelined mode might be the best option. | ||
120 | * | ||
121 | * You can enable/disable/tune the pipelined operation mode by adjusting | ||
122 | * the compile time parameters below. | ||
123 | * | ||
124 | * | ||
125 | * Possible improvements. | ||
126 | * | ||
127 | * 1. Support for the ATAPI overlap protocol. | ||
128 | * | ||
129 | * In order to maximize bus throughput, we currently use the DSC | ||
130 | * overlap method which enables ide.c to service requests from the | ||
131 | * other device while the tape is busy executing a command. The | ||
132 | * DSC overlap method involves polling the tape's status register | ||
133 | * for the DSC bit, and servicing the other device while the tape | ||
134 | * isn't ready. | ||
135 | * | ||
136 | * In the current QIC development standard (December 1995), | ||
137 | * it is recommended that new tape drives will *in addition* | ||
138 | * implement the ATAPI overlap protocol, which is used for the | ||
139 | * same purpose - efficient use of the IDE bus, but is interrupt | ||
140 | * driven and thus has much less CPU overhead. | ||
141 | * | ||
142 | * ATAPI overlap is likely to be supported in most new ATAPI | ||
143 | * devices, including new ATAPI cdroms, and thus provides us | ||
144 | * a method by which we can achieve higher throughput when | ||
145 | * sharing a (fast) ATA-2 disk with any (slow) new ATAPI device. | ||
146 | */ | ||
diff --git a/Documentation/initrd.txt b/Documentation/initrd.txt index 74f68b35f7c1..1ba84f3584e3 100644 --- a/Documentation/initrd.txt +++ b/Documentation/initrd.txt | |||
@@ -85,7 +85,7 @@ involve special block devices or loopbacks; you merely create a directory on | |||
85 | disk with the desired initrd content, cd to that directory, and run (as an | 85 | disk with the desired initrd content, cd to that directory, and run (as an |
86 | example): | 86 | example): |
87 | 87 | ||
88 | find . | cpio --quiet -c -o | gzip -9 -n > /boot/imagefile.img | 88 | find . | cpio --quiet -H newc -o | gzip -9 -n > /boot/imagefile.img |
89 | 89 | ||
90 | Examining the contents of an existing image file is just as simple: | 90 | Examining the contents of an existing image file is just as simple: |
91 | 91 | ||
diff --git a/Documentation/ja_JP/stable_kernel_rules.txt b/Documentation/ja_JP/stable_kernel_rules.txt new file mode 100644 index 000000000000..17d87519e468 --- /dev/null +++ b/Documentation/ja_JP/stable_kernel_rules.txt | |||
@@ -0,0 +1,79 @@ | |||
1 | NOTE: | ||
2 | This is Japanese translated version of "Documentation/stable_kernel_rules.txt". | ||
3 | This one is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com> | ||
4 | and JF Project team <www.linux.or.jp/JF>. | ||
5 | If you find difference with original file or problem in translation, | ||
6 | please contact maintainer of this file or JF project. | ||
7 | |||
8 | Please also note that purpose of this file is easier to read for non | ||
9 | English natives and do no intended to fork. So, if you have any | ||
10 | comment or update of this file, please try to update Original(English) | ||
11 | file at first. | ||
12 | |||
13 | ================================== | ||
14 | ããã¯ã | ||
15 | linux-2.6.24/Documentation/stable_kernel_rules.txt | ||
16 | ã®å訳ã§ãã | ||
17 | |||
18 | 翻訳å£ä½ï¼ JF ããã¸ã§ã¯ã < http://www.linux.or.jp/JF/ > | ||
19 | 翻訳æ¥ï¼ 2007/12/30 | ||
20 | 翻訳è ï¼ Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> | ||
21 | æ ¡æ£è ï¼ æ¦äºä¼¸å ããã<takei at webmasters dot gr dot jp> | ||
22 | ããããã (Seiji Kaneko) <skaneko at a2 dot mbn dot or dot jp> | ||
23 | å°æ é å ¸ãã (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> | ||
24 | éå£ãã (Kenji Noguchi) <tokyo246 at gmail dot com> | ||
25 | ç¥å®®ä¿¡å¤ªéãã <jin at libjingu dot jp> | ||
26 | ================================== | ||
27 | |||
28 | ãã£ã¨ç¥ãããã£ã Linux 2.6 -stable ãªãªã¼ã¹ã®å ¨ã¦ | ||
29 | |||
30 | "-stable" ããªã¼ã«ã©ã®ãããªç¨®é¡ã®ããããåãå ¥ããããããã©ã®ãã㪠| ||
31 | ãã®ãåãå ¥ããããªãããã«ã¤ãã¦ã®è¦å- | ||
32 | |||
33 | - æããã«æ£ããããã¹ãããã¦ãããã®ã§ãªããã°ãªããªãã | ||
34 | - æè(å¤æ´è¡ã®åå¾)ãå«ã㦠100 è¡ãã大ããã¦ã¯ãããªãã | ||
35 | - ãã ä¸åã®ãã¨ã ããä¿®æ£ãã¦ããã¹ãã | ||
36 | - çãæ©ã¾ãã¦ããæ¬ç©ã®ãã°ãä¿®æ£ããªããã°ãªããªãã("ããã¯ãã°ã§ | ||
37 | ãããããããªãã..." ã®ãããªãã®ã§ã¯ãªã) | ||
38 | - ãã«ãã¨ã©ã¼(CONFIG_BROKENã«ãªã£ã¦ãããã®ãé¤ã), oops, ãã³ã°ããã¼ | ||
39 | ã¿ç ´å£ãç¾å®ã®ã»ãã¥ãªãã£åé¡ããã®ä» "ãããããã¯ãã¡ã ã"ã¨ãã | ||
40 | ãããªãã®ãä¿®æ£ããªããã°ãªããªããçãè¨ãã°ãé大ãªåé¡ã | ||
41 | - ã©ã®ããã«ç«¶åç¶æ ãçºçãããã®èª¬æãä¸ç·ã«æ¸ããã¦ããªãéãã | ||
42 | "çè«çã«ã¯ç«¶åç¶æ ã«ãªã"ãããªãã®ã¯ä¸å¯ã | ||
43 | - ãããªãäºç´°ãªä¿®æ£ãå«ãããã¨ã¯ã§ããªãã(ã¹ãã«ã®ä¿®æ£ã空ç½ã®ã¯ãªã¼ | ||
44 | ã³ã¢ãããªã©) | ||
45 | - 対å¿ãããµãã·ã¹ãã ã¡ã³ãããåãå ¥ãããã®ã§ãªããã°ãªããªãã | ||
46 | - Documentation/SubmittingPatches ã®è¦åã«å¾ã£ããã®ã§ãªããã°ãªããªãã | ||
47 | |||
48 | -stable ããªã¼ã«ããããéä»ããæç¶ã- | ||
49 | |||
50 | - ä¸è¨ã®è¦åã«å¾ã£ã¦ãããã確èªããå¾ã«ãstable@kernel.org ã«ããã | ||
51 | ãéãã | ||
52 | - éä¿¡è ã¯ãããããã¥ã¼ã«åãä»ããããéã«ã¯ ACK ããå´ä¸ãããå ´å | ||
53 | ã«ã¯ NAK ãåãåãããã®åå¿ã¯éçºè ãã¡ã®ã¹ã±ã¸ã¥ã¼ã«ã«ãã£ã¦ãæ° | ||
54 | æ¥ãããå ´åãããã | ||
55 | - ããåãåããããããããã¯ä»ã®éçºè ãã¡ã®ã¬ãã¥ã¼ã®ããã« | ||
56 | -stable ãã¥ã¼ã«è¿½å ãããã | ||
57 | - ã»ãã¥ãªãã£ãããã¯ãã®ã¨ã¤ãªã¢ã¹ (stable@kernel.org) ã«éãããã¹ | ||
58 | ãã§ã¯ãªãã代ããã« security@kernel.org ã®ã¢ãã¬ã¹ã«éãããã | ||
59 | |||
60 | ã¬ãã¥ã¼ãµã¤ã¯ã«- | ||
61 | |||
62 | - -stable ã¡ã³ãããã¬ãã¥ã¼ãµã¤ã¯ã«ã決ããã¨ãããããã¯ã¬ãã¥ã¼å§ | ||
63 | å¡ä¼ã¨ããããå½±é¿ããé åã®ã¡ã³ãã(æä¾è ããã®é åã®ã¡ã³ããã§ç¡ | ||
64 | ãéã)ã«éãããlinux-kernel ã¡ã¼ãªã³ã°ãªã¹ãã«CCãããã | ||
65 | - ã¬ãã¥ã¼å§å¡ä¼ã¯ 48æéã®éã« ACK ã NAK ãåºãã | ||
66 | - ããããããå§å¡ä¼ã®ã¡ã³ãããå´ä¸ããããã¡ã³ããéãã¡ã³ããæ°ä» | ||
67 | ããªãã£ãåé¡ãæã¡ããããlinux-kernel ã¡ã³ãããããã«ç°è°ãå±ã | ||
68 | ãå ´åã«ã¯ããããã¯ãã¥ã¼ããåé¤ãããã | ||
69 | - ã¬ãã¥ã¼ãµã¤ã¯ã«ã®æå¾ã«ãACK ãåãããããã¯ææ°ã® -stable ãªãªã¼ | ||
70 | ã¹ã«è¿½å ããããã®å¾ã«æ°ãã -stable ãªãªã¼ã¹ãè¡ãããã | ||
71 | - ã»ãã¥ãªãã£ãããã¯ãé常ã®ã¬ãã¥ã¼ãµã¤ã¯ã«ãéãããã»ãã¥ãªã㣠| ||
72 | ã«ã¼ãã«ãã¼ã ããç´æ¥ -stable ããªã¼ã«åãä»ããããã | ||
73 | ãã®æç¶ãã®è©³ç´°ã«ã¤ãã¦ã¯ kernel security ãã¼ã ã«åãåããããã¨ã | ||
74 | |||
75 | ã¬ãã¥ã¼å§å¡ä¼- | ||
76 | |||
77 | - ãã®å§å¡ä¼ã¯ããã®ã¿ã¹ã¯ã«ã¤ãã¦æ´»åããå¤ãã®ãã©ã³ãã£ã¢ã¨ãå°æ°ã® | ||
78 | éãã©ã³ãã£ã¢ã®ã«ã¼ãã«éçºè éã§æ§æããã¦ããã | ||
79 | |||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index cf3868956f1e..9ad4e6fc56fd 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -549,7 +549,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
549 | 1 will print _a lot_ more information - normally | 549 | 1 will print _a lot_ more information - normally |
550 | only useful to kernel developers. | 550 | only useful to kernel developers. |
551 | 551 | ||
552 | decnet= [HW,NET] | 552 | decnet.addr= [HW,NET] |
553 | Format: <area>[,<node>] | 553 | Format: <area>[,<node>] |
554 | See also Documentation/networking/decnet.txt. | 554 | See also Documentation/networking/decnet.txt. |
555 | 555 | ||
@@ -1561,14 +1561,17 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1561 | ramdisk_size= [RAM] Sizes of RAM disks in kilobytes | 1561 | ramdisk_size= [RAM] Sizes of RAM disks in kilobytes |
1562 | See Documentation/ramdisk.txt. | 1562 | See Documentation/ramdisk.txt. |
1563 | 1563 | ||
1564 | rcu.blimit= [KNL,BOOT] Set maximum number of finished | 1564 | rcupdate.blimit= [KNL,BOOT] |
1565 | RCU callbacks to process in one batch. | 1565 | Set maximum number of finished RCU callbacks to process |
1566 | in one batch. | ||
1566 | 1567 | ||
1567 | rcu.qhimark= [KNL,BOOT] Set threshold of queued | 1568 | rcupdate.qhimark= [KNL,BOOT] |
1569 | Set threshold of queued | ||
1568 | RCU callbacks over which batch limiting is disabled. | 1570 | RCU callbacks over which batch limiting is disabled. |
1569 | 1571 | ||
1570 | rcu.qlowmark= [KNL,BOOT] Set threshold of queued | 1572 | rcupdate.qlowmark= [KNL,BOOT] |
1571 | RCU callbacks below which batch limiting is re-enabled. | 1573 | Set threshold of queued RCU callbacks below which |
1574 | batch limiting is re-enabled. | ||
1572 | 1575 | ||
1573 | rdinit= [KNL] | 1576 | rdinit= [KNL] |
1574 | Format: <full_path> | 1577 | Format: <full_path> |
@@ -1888,9 +1891,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1888 | st= [HW,SCSI] SCSI tape parameters (buffers, etc.) | 1891 | st= [HW,SCSI] SCSI tape parameters (buffers, etc.) |
1889 | See Documentation/scsi/st.txt. | 1892 | See Documentation/scsi/st.txt. |
1890 | 1893 | ||
1891 | st0x= [HW,SCSI] | ||
1892 | See header of drivers/scsi/seagate.c. | ||
1893 | |||
1894 | sti= [PARISC,HW] | 1894 | sti= [PARISC,HW] |
1895 | Format: <num> | 1895 | Format: <num> |
1896 | Set the STI (builtin display/keyboard on the HP-PARISC | 1896 | Set the STI (builtin display/keyboard on the HP-PARISC |
@@ -1975,9 +1975,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1975 | tipar.delay= [HW,PPT] | 1975 | tipar.delay= [HW,PPT] |
1976 | Set inter-bit delay in microseconds (default 10). | 1976 | Set inter-bit delay in microseconds (default 10). |
1977 | 1977 | ||
1978 | tmc8xx= [HW,SCSI] | ||
1979 | See header of drivers/scsi/seagate.c. | ||
1980 | |||
1981 | tmscsim= [HW,SCSI] | 1978 | tmscsim= [HW,SCSI] |
1982 | See comment before function dc390_setup() in | 1979 | See comment before function dc390_setup() in |
1983 | drivers/scsi/tmscsim.c. | 1980 | drivers/scsi/tmscsim.c. |
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 6c8a2386cd50..0f23d67f958f 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <zlib.h> | 34 | #include <zlib.h> |
35 | #include <assert.h> | 35 | #include <assert.h> |
36 | #include <sched.h> | 36 | #include <sched.h> |
37 | #include <limits.h> | ||
38 | #include <stddef.h> | ||
37 | #include "linux/lguest_launcher.h" | 39 | #include "linux/lguest_launcher.h" |
38 | #include "linux/virtio_config.h" | 40 | #include "linux/virtio_config.h" |
39 | #include "linux/virtio_net.h" | 41 | #include "linux/virtio_net.h" |
@@ -99,13 +101,11 @@ struct device_list | |||
99 | /* The descriptor page for the devices. */ | 101 | /* The descriptor page for the devices. */ |
100 | u8 *descpage; | 102 | u8 *descpage; |
101 | 103 | ||
102 | /* The tail of the last descriptor. */ | ||
103 | unsigned int desc_used; | ||
104 | |||
105 | /* A single linked list of devices. */ | 104 | /* A single linked list of devices. */ |
106 | struct device *dev; | 105 | struct device *dev; |
107 | /* ... And an end pointer so we can easily append new devices */ | 106 | /* And a pointer to the last device for easy append and also for |
108 | struct device **lastdev; | 107 | * configuration appending. */ |
108 | struct device *lastdev; | ||
109 | }; | 109 | }; |
110 | 110 | ||
111 | /* The list of Guest devices, based on command line arguments. */ | 111 | /* The list of Guest devices, based on command line arguments. */ |
@@ -191,7 +191,14 @@ static void *_convert(struct iovec *iov, size_t size, size_t align, | |||
191 | #define cpu_to_le64(v64) (v64) | 191 | #define cpu_to_le64(v64) (v64) |
192 | #define le16_to_cpu(v16) (v16) | 192 | #define le16_to_cpu(v16) (v16) |
193 | #define le32_to_cpu(v32) (v32) | 193 | #define le32_to_cpu(v32) (v32) |
194 | #define le64_to_cpu(v32) (v64) | 194 | #define le64_to_cpu(v64) (v64) |
195 | |||
196 | /* The device virtqueue descriptors are followed by feature bitmasks. */ | ||
197 | static u8 *get_feature_bits(struct device *dev) | ||
198 | { | ||
199 | return (u8 *)(dev->desc + 1) | ||
200 | + dev->desc->num_vq * sizeof(struct lguest_vqconfig); | ||
201 | } | ||
195 | 202 | ||
196 | /*L:100 The Launcher code itself takes us out into userspace, that scary place | 203 | /*L:100 The Launcher code itself takes us out into userspace, that scary place |
197 | * where pointers run wild and free! Unfortunately, like most userspace | 204 | * where pointers run wild and free! Unfortunately, like most userspace |
@@ -914,21 +921,58 @@ static void enable_fd(int fd, struct virtqueue *vq) | |||
914 | write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); | 921 | write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); |
915 | } | 922 | } |
916 | 923 | ||
924 | /* Resetting a device is fairly easy. */ | ||
925 | static void reset_device(struct device *dev) | ||
926 | { | ||
927 | struct virtqueue *vq; | ||
928 | |||
929 | verbose("Resetting device %s\n", dev->name); | ||
930 | /* Clear the status. */ | ||
931 | dev->desc->status = 0; | ||
932 | |||
933 | /* Clear any features they've acked. */ | ||
934 | memset(get_feature_bits(dev) + dev->desc->feature_len, 0, | ||
935 | dev->desc->feature_len); | ||
936 | |||
937 | /* Zero out the virtqueues. */ | ||
938 | for (vq = dev->vq; vq; vq = vq->next) { | ||
939 | memset(vq->vring.desc, 0, | ||
940 | vring_size(vq->config.num, getpagesize())); | ||
941 | vq->last_avail_idx = 0; | ||
942 | } | ||
943 | } | ||
944 | |||
917 | /* This is the generic routine we call when the Guest uses LHCALL_NOTIFY. */ | 945 | /* This is the generic routine we call when the Guest uses LHCALL_NOTIFY. */ |
918 | static void handle_output(int fd, unsigned long addr) | 946 | static void handle_output(int fd, unsigned long addr) |
919 | { | 947 | { |
920 | struct device *i; | 948 | struct device *i; |
921 | struct virtqueue *vq; | 949 | struct virtqueue *vq; |
922 | 950 | ||
923 | /* Check each virtqueue. */ | 951 | /* Check each device and virtqueue. */ |
924 | for (i = devices.dev; i; i = i->next) { | 952 | for (i = devices.dev; i; i = i->next) { |
953 | /* Notifications to device descriptors reset the device. */ | ||
954 | if (from_guest_phys(addr) == i->desc) { | ||
955 | reset_device(i); | ||
956 | return; | ||
957 | } | ||
958 | |||
959 | /* Notifications to virtqueues mean output has occurred. */ | ||
925 | for (vq = i->vq; vq; vq = vq->next) { | 960 | for (vq = i->vq; vq; vq = vq->next) { |
926 | if (vq->config.pfn == addr/getpagesize() | 961 | if (vq->config.pfn != addr/getpagesize()) |
927 | && vq->handle_output) { | 962 | continue; |
928 | verbose("Output to %s\n", vq->dev->name); | 963 | |
929 | vq->handle_output(fd, vq); | 964 | /* Guest should acknowledge (and set features!) before |
965 | * using the device. */ | ||
966 | if (i->desc->status == 0) { | ||
967 | warnx("%s gave early output", i->name); | ||
930 | return; | 968 | return; |
931 | } | 969 | } |
970 | |||
971 | if (strcmp(vq->dev->name, "console") != 0) | ||
972 | verbose("Output to %s\n", vq->dev->name); | ||
973 | if (vq->handle_output) | ||
974 | vq->handle_output(fd, vq); | ||
975 | return; | ||
932 | } | 976 | } |
933 | } | 977 | } |
934 | 978 | ||
@@ -986,54 +1030,44 @@ static void handle_input(int fd) | |||
986 | * | 1030 | * |
987 | * All devices need a descriptor so the Guest knows it exists, and a "struct | 1031 | * All devices need a descriptor so the Guest knows it exists, and a "struct |
988 | * device" so the Launcher can keep track of it. We have common helper | 1032 | * device" so the Launcher can keep track of it. We have common helper |
989 | * routines to allocate them. | 1033 | * routines to allocate and manage them. */ |
990 | * | ||
991 | * This routine allocates a new "struct lguest_device_desc" from descriptor | ||
992 | * table just above the Guest's normal memory. It returns a pointer to that | ||
993 | * descriptor. */ | ||
994 | static struct lguest_device_desc *new_dev_desc(u16 type) | ||
995 | { | ||
996 | struct lguest_device_desc *d; | ||
997 | 1034 | ||
998 | /* We only have one page for all the descriptors. */ | 1035 | /* The layout of the device page is a "struct lguest_device_desc" followed by a |
999 | if (devices.desc_used + sizeof(*d) > getpagesize()) | 1036 | * number of virtqueue descriptors, then two sets of feature bits, then an |
1000 | errx(1, "Too many devices"); | 1037 | * array of configuration bytes. This routine returns the configuration |
1001 | 1038 | * pointer. */ | |
1002 | /* We don't need to set config_len or status: page is 0 already. */ | 1039 | static u8 *device_config(const struct device *dev) |
1003 | d = (void *)devices.descpage + devices.desc_used; | 1040 | { |
1004 | d->type = type; | 1041 | return (void *)(dev->desc + 1) |
1005 | devices.desc_used += sizeof(*d); | 1042 | + dev->desc->num_vq * sizeof(struct lguest_vqconfig) |
1006 | 1043 | + dev->desc->feature_len * 2; | |
1007 | return d; | ||
1008 | } | 1044 | } |
1009 | 1045 | ||
1010 | /* Each device descriptor is followed by some configuration information. | 1046 | /* This routine allocates a new "struct lguest_device_desc" from descriptor |
1011 | * Each configuration field looks like: u8 type, u8 len, [... len bytes...]. | 1047 | * table page just above the Guest's normal memory. It returns a pointer to |
1012 | * | 1048 | * that descriptor. */ |
1013 | * This routine adds a new field to an existing device's descriptor. It only | 1049 | static struct lguest_device_desc *new_dev_desc(u16 type) |
1014 | * works for the last device, but that's OK because that's how we use it. */ | ||
1015 | static void add_desc_field(struct device *dev, u8 type, u8 len, const void *c) | ||
1016 | { | 1050 | { |
1017 | /* This is the last descriptor, right? */ | 1051 | struct lguest_device_desc d = { .type = type }; |
1018 | assert(devices.descpage + devices.desc_used | 1052 | void *p; |
1019 | == (u8 *)(dev->desc + 1) + dev->desc->config_len); | ||
1020 | 1053 | ||
1021 | /* We only have one page of device descriptions. */ | 1054 | /* Figure out where the next device config is, based on the last one. */ |
1022 | if (devices.desc_used + 2 + len > getpagesize()) | 1055 | if (devices.lastdev) |
1023 | errx(1, "Too many devices"); | 1056 | p = device_config(devices.lastdev) |
1057 | + devices.lastdev->desc->config_len; | ||
1058 | else | ||
1059 | p = devices.descpage; | ||
1024 | 1060 | ||
1025 | /* Copy in the new config header: type then length. */ | 1061 | /* We only have one page for all the descriptors. */ |
1026 | devices.descpage[devices.desc_used++] = type; | 1062 | if (p + sizeof(d) > (void *)devices.descpage + getpagesize()) |
1027 | devices.descpage[devices.desc_used++] = len; | 1063 | errx(1, "Too many devices"); |
1028 | memcpy(devices.descpage + devices.desc_used, c, len); | ||
1029 | devices.desc_used += len; | ||
1030 | 1064 | ||
1031 | /* Update the device descriptor length: two byte head then data. */ | 1065 | /* p might not be aligned, so we memcpy in. */ |
1032 | dev->desc->config_len += 2 + len; | 1066 | return memcpy(p, &d, sizeof(d)); |
1033 | } | 1067 | } |
1034 | 1068 | ||
1035 | /* This routine adds a virtqueue to a device. We specify how many descriptors | 1069 | /* Each device descriptor is followed by the description of its virtqueues. We |
1036 | * the virtqueue is to have. */ | 1070 | * specify how many descriptors the virtqueue is to have. */ |
1037 | static void add_virtqueue(struct device *dev, unsigned int num_descs, | 1071 | static void add_virtqueue(struct device *dev, unsigned int num_descs, |
1038 | void (*handle_output)(int fd, struct virtqueue *me)) | 1072 | void (*handle_output)(int fd, struct virtqueue *me)) |
1039 | { | 1073 | { |
@@ -1059,9 +1093,15 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs, | |||
1059 | /* Initialize the vring. */ | 1093 | /* Initialize the vring. */ |
1060 | vring_init(&vq->vring, num_descs, p, getpagesize()); | 1094 | vring_init(&vq->vring, num_descs, p, getpagesize()); |
1061 | 1095 | ||
1062 | /* Add the configuration information to this device's descriptor. */ | 1096 | /* Append virtqueue to this device's descriptor. We use |
1063 | add_desc_field(dev, VIRTIO_CONFIG_F_VIRTQUEUE, | 1097 | * device_config() to get the end of the device's current virtqueues; |
1064 | sizeof(vq->config), &vq->config); | 1098 | * we check that we haven't added any config or feature information |
1099 | * yet, otherwise we'd be overwriting them. */ | ||
1100 | assert(dev->desc->config_len == 0 && dev->desc->feature_len == 0); | ||
1101 | memcpy(device_config(dev), &vq->config, sizeof(vq->config)); | ||
1102 | dev->desc->num_vq++; | ||
1103 | |||
1104 | verbose("Virtqueue page %#lx\n", to_guest_phys(p)); | ||
1065 | 1105 | ||
1066 | /* Add to tail of list, so dev->vq is first vq, dev->vq->next is | 1106 | /* Add to tail of list, so dev->vq is first vq, dev->vq->next is |
1067 | * second. */ | 1107 | * second. */ |
@@ -1072,11 +1112,41 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs, | |||
1072 | * virtqueue. */ | 1112 | * virtqueue. */ |
1073 | vq->handle_output = handle_output; | 1113 | vq->handle_output = handle_output; |
1074 | 1114 | ||
1075 | /* Set the "Don't Notify Me" flag if we don't have a handler */ | 1115 | /* As an optimization, set the advisory "Don't Notify Me" flag if we |
1116 | * don't have a handler */ | ||
1076 | if (!handle_output) | 1117 | if (!handle_output) |
1077 | vq->vring.used->flags = VRING_USED_F_NO_NOTIFY; | 1118 | vq->vring.used->flags = VRING_USED_F_NO_NOTIFY; |
1078 | } | 1119 | } |
1079 | 1120 | ||
1121 | /* The first half of the feature bitmask is for us to advertise features. The | ||
1122 | * second half if for the Guest to accept features. */ | ||
1123 | static void add_feature(struct device *dev, unsigned bit) | ||
1124 | { | ||
1125 | u8 *features = get_feature_bits(dev); | ||
1126 | |||
1127 | /* We can't extend the feature bits once we've added config bytes */ | ||
1128 | if (dev->desc->feature_len <= bit / CHAR_BIT) { | ||
1129 | assert(dev->desc->config_len == 0); | ||
1130 | dev->desc->feature_len = (bit / CHAR_BIT) + 1; | ||
1131 | } | ||
1132 | |||
1133 | features[bit / CHAR_BIT] |= (1 << (bit % CHAR_BIT)); | ||
1134 | } | ||
1135 | |||
1136 | /* This routine sets the configuration fields for an existing device's | ||
1137 | * descriptor. It only works for the last device, but that's OK because that's | ||
1138 | * how we use it. */ | ||
1139 | static void set_config(struct device *dev, unsigned len, const void *conf) | ||
1140 | { | ||
1141 | /* Check we haven't overflowed our single page. */ | ||
1142 | if (device_config(dev) + len > devices.descpage + getpagesize()) | ||
1143 | errx(1, "Too many devices"); | ||
1144 | |||
1145 | /* Copy in the config information, and store the length. */ | ||
1146 | memcpy(device_config(dev), conf, len); | ||
1147 | dev->desc->config_len = len; | ||
1148 | } | ||
1149 | |||
1080 | /* This routine does all the creation and setup of a new device, including | 1150 | /* This routine does all the creation and setup of a new device, including |
1081 | * calling new_dev_desc() to allocate the descriptor and device memory. */ | 1151 | * calling new_dev_desc() to allocate the descriptor and device memory. */ |
1082 | static struct device *new_device(const char *name, u16 type, int fd, | 1152 | static struct device *new_device(const char *name, u16 type, int fd, |
@@ -1084,14 +1154,6 @@ static struct device *new_device(const char *name, u16 type, int fd, | |||
1084 | { | 1154 | { |
1085 | struct device *dev = malloc(sizeof(*dev)); | 1155 | struct device *dev = malloc(sizeof(*dev)); |
1086 | 1156 | ||
1087 | /* Append to device list. Prepending to a single-linked list is | ||
1088 | * easier, but the user expects the devices to be arranged on the bus | ||
1089 | * in command-line order. The first network device on the command line | ||
1090 | * is eth0, the first block device /dev/vda, etc. */ | ||
1091 | *devices.lastdev = dev; | ||
1092 | dev->next = NULL; | ||
1093 | devices.lastdev = &dev->next; | ||
1094 | |||
1095 | /* Now we populate the fields one at a time. */ | 1157 | /* Now we populate the fields one at a time. */ |
1096 | dev->fd = fd; | 1158 | dev->fd = fd; |
1097 | /* If we have an input handler for this file descriptor, then we add it | 1159 | /* If we have an input handler for this file descriptor, then we add it |
@@ -1102,6 +1164,17 @@ static struct device *new_device(const char *name, u16 type, int fd, | |||
1102 | dev->handle_input = handle_input; | 1164 | dev->handle_input = handle_input; |
1103 | dev->name = name; | 1165 | dev->name = name; |
1104 | dev->vq = NULL; | 1166 | dev->vq = NULL; |
1167 | |||
1168 | /* Append to device list. Prepending to a single-linked list is | ||
1169 | * easier, but the user expects the devices to be arranged on the bus | ||
1170 | * in command-line order. The first network device on the command line | ||
1171 | * is eth0, the first block device /dev/vda, etc. */ | ||
1172 | if (devices.lastdev) | ||
1173 | devices.lastdev->next = dev; | ||
1174 | else | ||
1175 | devices.dev = dev; | ||
1176 | devices.lastdev = dev; | ||
1177 | |||
1105 | return dev; | 1178 | return dev; |
1106 | } | 1179 | } |
1107 | 1180 | ||
@@ -1226,7 +1299,7 @@ static void setup_tun_net(const char *arg) | |||
1226 | int netfd, ipfd; | 1299 | int netfd, ipfd; |
1227 | u32 ip; | 1300 | u32 ip; |
1228 | const char *br_name = NULL; | 1301 | const char *br_name = NULL; |
1229 | u8 hwaddr[6]; | 1302 | struct virtio_net_config conf; |
1230 | 1303 | ||
1231 | /* We open the /dev/net/tun device and tell it we want a tap device. A | 1304 | /* We open the /dev/net/tun device and tell it we want a tap device. A |
1232 | * tap device is like a tun device, only somehow different. To tell | 1305 | * tap device is like a tun device, only somehow different. To tell |
@@ -1265,12 +1338,13 @@ static void setup_tun_net(const char *arg) | |||
1265 | ip = str2ip(arg); | 1338 | ip = str2ip(arg); |
1266 | 1339 | ||
1267 | /* Set up the tun device, and get the mac address for the interface. */ | 1340 | /* Set up the tun device, and get the mac address for the interface. */ |
1268 | configure_device(ipfd, ifr.ifr_name, ip, hwaddr); | 1341 | configure_device(ipfd, ifr.ifr_name, ip, conf.mac); |
1269 | 1342 | ||
1270 | /* Tell Guest what MAC address to use. */ | 1343 | /* Tell Guest what MAC address to use. */ |
1271 | add_desc_field(dev, VIRTIO_CONFIG_NET_MAC_F, sizeof(hwaddr), hwaddr); | 1344 | add_feature(dev, VIRTIO_NET_F_MAC); |
1345 | set_config(dev, sizeof(conf), &conf); | ||
1272 | 1346 | ||
1273 | /* We don't seed the socket any more; setup is done. */ | 1347 | /* We don't need the socket any more; setup is done. */ |
1274 | close(ipfd); | 1348 | close(ipfd); |
1275 | 1349 | ||
1276 | verbose("device %u: tun net %u.%u.%u.%u\n", | 1350 | verbose("device %u: tun net %u.%u.%u.%u\n", |
@@ -1458,8 +1532,7 @@ static void setup_block_file(const char *filename) | |||
1458 | struct device *dev; | 1532 | struct device *dev; |
1459 | struct vblk_info *vblk; | 1533 | struct vblk_info *vblk; |
1460 | void *stack; | 1534 | void *stack; |
1461 | u64 cap; | 1535 | struct virtio_blk_config conf; |
1462 | unsigned int val; | ||
1463 | 1536 | ||
1464 | /* This is the pipe the I/O thread will use to tell us I/O is done. */ | 1537 | /* This is the pipe the I/O thread will use to tell us I/O is done. */ |
1465 | pipe(p); | 1538 | pipe(p); |
@@ -1477,14 +1550,18 @@ static void setup_block_file(const char *filename) | |||
1477 | vblk->fd = open_or_die(filename, O_RDWR|O_LARGEFILE); | 1550 | vblk->fd = open_or_die(filename, O_RDWR|O_LARGEFILE); |
1478 | vblk->len = lseek64(vblk->fd, 0, SEEK_END); | 1551 | vblk->len = lseek64(vblk->fd, 0, SEEK_END); |
1479 | 1552 | ||
1553 | /* We support barriers. */ | ||
1554 | add_feature(dev, VIRTIO_BLK_F_BARRIER); | ||
1555 | |||
1480 | /* Tell Guest how many sectors this device has. */ | 1556 | /* Tell Guest how many sectors this device has. */ |
1481 | cap = cpu_to_le64(vblk->len / 512); | 1557 | conf.capacity = cpu_to_le64(vblk->len / 512); |
1482 | add_desc_field(dev, VIRTIO_CONFIG_BLK_F_CAPACITY, sizeof(cap), &cap); | ||
1483 | 1558 | ||
1484 | /* Tell Guest not to put in too many descriptors at once: two are used | 1559 | /* Tell Guest not to put in too many descriptors at once: two are used |
1485 | * for the in and out elements. */ | 1560 | * for the in and out elements. */ |
1486 | val = cpu_to_le32(VIRTQUEUE_NUM - 2); | 1561 | add_feature(dev, VIRTIO_BLK_F_SEG_MAX); |
1487 | add_desc_field(dev, VIRTIO_CONFIG_BLK_F_SEG_MAX, sizeof(val), &val); | 1562 | conf.seg_max = cpu_to_le32(VIRTQUEUE_NUM - 2); |
1563 | |||
1564 | set_config(dev, sizeof(conf), &conf); | ||
1488 | 1565 | ||
1489 | /* The I/O thread writes to this end of the pipe when done. */ | 1566 | /* The I/O thread writes to this end of the pipe when done. */ |
1490 | vblk->done_fd = p[1]; | 1567 | vblk->done_fd = p[1]; |
@@ -1505,7 +1582,7 @@ static void setup_block_file(const char *filename) | |||
1505 | close(vblk->workpipe[0]); | 1582 | close(vblk->workpipe[0]); |
1506 | 1583 | ||
1507 | verbose("device %u: virtblock %llu sectors\n", | 1584 | verbose("device %u: virtblock %llu sectors\n", |
1508 | devices.device_num, cap); | 1585 | devices.device_num, le64_to_cpu(conf.capacity)); |
1509 | } | 1586 | } |
1510 | /* That's the end of device setup. :*/ | 1587 | /* That's the end of device setup. :*/ |
1511 | 1588 | ||
@@ -1610,12 +1687,12 @@ int main(int argc, char *argv[]) | |||
1610 | /* First we initialize the device list. Since console and network | 1687 | /* First we initialize the device list. Since console and network |
1611 | * device receive input from a file descriptor, we keep an fdset | 1688 | * device receive input from a file descriptor, we keep an fdset |
1612 | * (infds) and the maximum fd number (max_infd) with the head of the | 1689 | * (infds) and the maximum fd number (max_infd) with the head of the |
1613 | * list. We also keep a pointer to the last device, for easy appending | 1690 | * list. We also keep a pointer to the last device. Finally, we keep |
1614 | * to the list. Finally, we keep the next interrupt number to hand out | 1691 | * the next interrupt number to hand out (1: remember that 0 is used by |
1615 | * (1: remember that 0 is used by the timer). */ | 1692 | * the timer). */ |
1616 | FD_ZERO(&devices.infds); | 1693 | FD_ZERO(&devices.infds); |
1617 | devices.max_infd = -1; | 1694 | devices.max_infd = -1; |
1618 | devices.lastdev = &devices.dev; | 1695 | devices.lastdev = NULL; |
1619 | devices.next_irq = 1; | 1696 | devices.next_irq = 1; |
1620 | 1697 | ||
1621 | cpu_id = 0; | 1698 | cpu_id = 0; |
diff --git a/Documentation/networking/decnet.txt b/Documentation/networking/decnet.txt index badb7480ea62..d8968958d839 100644 --- a/Documentation/networking/decnet.txt +++ b/Documentation/networking/decnet.txt | |||
@@ -60,7 +60,7 @@ operation of the local communications in any other way though. | |||
60 | 60 | ||
61 | The kernel command line takes options looking like the following: | 61 | The kernel command line takes options looking like the following: |
62 | 62 | ||
63 | decnet=1,2 | 63 | decnet.addr=1,2 |
64 | 64 | ||
65 | the two numbers are the node address 1,2 = 1.2 For 2.2.xx kernels | 65 | the two numbers are the node address 1,2 = 1.2 For 2.2.xx kernels |
66 | and early 2.3.xx kernels, you must use a comma when specifying the | 66 | and early 2.3.xx kernels, you must use a comma when specifying the |
diff --git a/Documentation/smp.txt b/Documentation/smp.txt deleted file mode 100644 index 82fc50b6305d..000000000000 --- a/Documentation/smp.txt +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | To set up SMP | ||
2 | |||
3 | Configure the kernel and answer Y to CONFIG_SMP. | ||
4 | |||
5 | If you are using LILO, it is handy to have both SMP and non-SMP | ||
6 | kernel images on hand. Edit /etc/lilo.conf to create an entry | ||
7 | for another kernel image called "linux-smp" or something. | ||
8 | |||
9 | The next time you compile the kernel, when running a SMP kernel, | ||
10 | edit linux/Makefile and change "MAKE=make" to "MAKE=make -jN" | ||
11 | (where N = number of CPU + 1, or if you have tons of memory/swap | ||
12 | you can just use "-j" without a number). Feel free to experiment | ||
13 | with this one. | ||
14 | |||
15 | Of course you should time how long each build takes :-) | ||
16 | Example: | ||
17 | make config | ||
18 | time -v sh -c 'make clean install modules modules_install' | ||
19 | |||
20 | If you are using some Compaq MP compliant machines you will need to set | ||
21 | the operating system in the BIOS settings to "Unixware" - don't ask me | ||
22 | why Compaqs don't work otherwise. | ||
diff --git a/Documentation/x86_64/00-INDEX b/Documentation/x86_64/00-INDEX new file mode 100644 index 000000000000..92fc20ab5f0e --- /dev/null +++ b/Documentation/x86_64/00-INDEX | |||
@@ -0,0 +1,16 @@ | |||
1 | 00-INDEX | ||
2 | - This file | ||
3 | boot-options.txt | ||
4 | - AMD64-specific boot options. | ||
5 | cpu-hotplug-spec | ||
6 | - Firmware support for CPU hotplug under Linux/x86-64 | ||
7 | fake-numa-for-cpusets | ||
8 | - Using numa=fake and CPUSets for Resource Management | ||
9 | kernel-stacks | ||
10 | - Context-specific per-processor interrupt stacks. | ||
11 | machinecheck | ||
12 | - Configurable sysfs parameters for the x86-64 machine check code. | ||
13 | mm.txt | ||
14 | - Memory layout of x86-64 (4 level page tables, 46 bits physical). | ||
15 | uefi.txt | ||
16 | - Booting Linux via Unified Extensible Firmware Interface. | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 58b16038baea..da30a72a839c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -84,13 +84,6 @@ S: Status, one of the following: | |||
84 | it has been replaced by a better system and you | 84 | it has been replaced by a better system and you |
85 | should be using that. | 85 | should be using that. |
86 | 86 | ||
87 | 3C359 NETWORK DRIVER | ||
88 | P: Mike Phillips | ||
89 | M: mikep@linuxtr.net | ||
90 | L: netdev@vger.kernel.org | ||
91 | W: http://www.linuxtr.net | ||
92 | S: Maintained | ||
93 | |||
94 | 3C505 NETWORK DRIVER | 87 | 3C505 NETWORK DRIVER |
95 | P: Philip Blundell | 88 | P: Philip Blundell |
96 | M: philb@gnu.org | 89 | M: philb@gnu.org |
@@ -939,8 +932,6 @@ M: maxk@qualcomm.com | |||
939 | S: Maintained | 932 | S: Maintained |
940 | 933 | ||
941 | BONDING DRIVER | 934 | BONDING DRIVER |
942 | P: Chad Tindel | ||
943 | M: ctindel@users.sourceforge.net | ||
944 | P: Jay Vosburgh | 935 | P: Jay Vosburgh |
945 | M: fubar@us.ibm.com | 936 | M: fubar@us.ibm.com |
946 | L: bonding-devel@lists.sourceforge.net | 937 | L: bonding-devel@lists.sourceforge.net |
@@ -2864,15 +2855,6 @@ L: ocfs2-devel@oss.oracle.com | |||
2864 | W: http://oss.oracle.com/projects/ocfs2/ | 2855 | W: http://oss.oracle.com/projects/ocfs2/ |
2865 | S: Supported | 2856 | S: Supported |
2866 | 2857 | ||
2867 | OLYMPIC NETWORK DRIVER | ||
2868 | P: Peter De Shrijver | ||
2869 | M: p2@ace.ulyssis.student.kuleuven.ac.be | ||
2870 | P: Mike Phillips | ||
2871 | M: mikep@linuxtr.net | ||
2872 | L: netdev@vger.kernel.org | ||
2873 | W: http://www.linuxtr.net | ||
2874 | S: Maintained | ||
2875 | |||
2876 | OMNIKEY CARDMAN 4000 DRIVER | 2858 | OMNIKEY CARDMAN 4000 DRIVER |
2877 | P: Harald Welte | 2859 | P: Harald Welte |
2878 | M: laforge@gnumonks.org | 2860 | M: laforge@gnumonks.org |
@@ -3195,7 +3177,7 @@ S: Maintained | |||
3195 | 3177 | ||
3196 | RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER | 3178 | RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER |
3197 | P: Corey Thomas | 3179 | P: Corey Thomas |
3198 | M: corey@world.std.com | 3180 | M: coreythomas@charter.net |
3199 | L: linux-wireless@vger.kernel.org | 3181 | L: linux-wireless@vger.kernel.org |
3200 | S: Maintained | 3182 | S: Maintained |
3201 | 3183 | ||
@@ -3788,13 +3770,6 @@ L: tlan-devel@lists.sourceforge.net (subscribers-only) | |||
3788 | W: http://sourceforge.net/projects/tlan/ | 3770 | W: http://sourceforge.net/projects/tlan/ |
3789 | S: Maintained | 3771 | S: Maintained |
3790 | 3772 | ||
3791 | TOKEN-RING NETWORK DRIVER | ||
3792 | P: Mike Phillips | ||
3793 | M: mikep@linuxtr.net | ||
3794 | L: netdev@vger.kernel.org | ||
3795 | W: http://www.linuxtr.net | ||
3796 | S: Maintained | ||
3797 | |||
3798 | TOSHIBA ACPI EXTRAS DRIVER | 3773 | TOSHIBA ACPI EXTRAS DRIVER |
3799 | P: John Belmonte | 3774 | P: John Belmonte |
3800 | M: toshiba_acpi@memebeam.org | 3775 | M: toshiba_acpi@memebeam.org |
@@ -3815,18 +3790,9 @@ L: linux-kernel@vger.kernel.org | |||
3815 | S: Maintained | 3790 | S: Maintained |
3816 | 3791 | ||
3817 | TRIVIAL PATCHES | 3792 | TRIVIAL PATCHES |
3818 | P: Adrian Bunk | 3793 | P: Jesper Juhl |
3819 | M: trivial@kernel.org | 3794 | M: trivial@kernel.org |
3820 | L: linux-kernel@vger.kernel.org | 3795 | L: linux-kernel@vger.kernel.org |
3821 | W: http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/ | ||
3822 | T: git kernel.org:/pub/scm/linux/kernel/git/bunk/trivial.git | ||
3823 | S: Maintained | ||
3824 | |||
3825 | TMS380 TOKEN-RING NETWORK DRIVER | ||
3826 | P: Adam Fritzler | ||
3827 | M: mid@auk.cx | ||
3828 | L: linux-tr@linuxtr.net | ||
3829 | W: http://www.auk.cx/tms380tr/ | ||
3830 | S: Maintained | 3796 | S: Maintained |
3831 | 3797 | ||
3832 | TULIP NETWORK DRIVER | 3798 | TULIP NETWORK DRIVER |
@@ -1484,7 +1484,7 @@ kernelversion: | |||
1484 | # Single targets | 1484 | # Single targets |
1485 | # --------------------------------------------------------------------------- | 1485 | # --------------------------------------------------------------------------- |
1486 | # Single targets are compatible with: | 1486 | # Single targets are compatible with: |
1487 | # - build whith mixed source and output | 1487 | # - build with mixed source and output |
1488 | # - build with separate output dir 'make O=...' | 1488 | # - build with separate output dir 'make O=...' |
1489 | # - external modules | 1489 | # - external modules |
1490 | # | 1490 | # |
diff --git a/arch/Kconfig b/arch/Kconfig new file mode 100644 index 000000000000..3d72dc3fc8f5 --- /dev/null +++ b/arch/Kconfig | |||
@@ -0,0 +1,31 @@ | |||
1 | # | ||
2 | # General architecture dependent options | ||
3 | # | ||
4 | |||
5 | config OPROFILE | ||
6 | tristate "OProfile system profiling (EXPERIMENTAL)" | ||
7 | depends on PROFILING | ||
8 | depends on HAVE_OPROFILE | ||
9 | help | ||
10 | OProfile is a profiling system capable of profiling the | ||
11 | whole system, include the kernel, kernel modules, libraries, | ||
12 | and applications. | ||
13 | |||
14 | If unsure, say N. | ||
15 | |||
16 | config HAVE_OPROFILE | ||
17 | def_bool n | ||
18 | |||
19 | config KPROBES | ||
20 | bool "Kprobes" | ||
21 | depends on KALLSYMS && MODULES | ||
22 | depends on HAVE_KPROBES | ||
23 | help | ||
24 | Kprobes allows you to trap at almost any kernel address and | ||
25 | execute a callback function. register_kprobe() establishes | ||
26 | a probepoint and specifies the callback. Kprobes is useful | ||
27 | for kernel debugging, non-intrusive instrumentation and testing. | ||
28 | If in doubt, say "N". | ||
29 | |||
30 | config HAVE_KPROBES | ||
31 | def_bool n | ||
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index c613d5fb0daa..01b10ab588a6 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config ALPHA | 5 | config ALPHA |
6 | bool | 6 | bool |
7 | default y | 7 | default y |
8 | select HAVE_OPROFILE | ||
8 | help | 9 | help |
9 | The Alpha is a 64-bit general-purpose processor designed and | 10 | The Alpha is a 64-bit general-purpose processor designed and |
10 | marketed by the Digital Equipment Corporation of blessed memory, | 11 | marketed by the Digital Equipment Corporation of blessed memory, |
@@ -531,8 +532,8 @@ config SMP | |||
531 | singleprocessor machines. On a singleprocessor machine, the kernel | 532 | singleprocessor machines. On a singleprocessor machine, the kernel |
532 | will run faster if you say N here. | 533 | will run faster if you say N here. |
533 | 534 | ||
534 | See also the <file:Documentation/smp.txt>, and the SMP-HOWTO | 535 | See also the SMP-HOWTO available at |
535 | available at <http://www.tldp.org/docs.html#howto>. | 536 | <http://www.tldp.org/docs.html#howto>. |
536 | 537 | ||
537 | If you don't know what to do here, say N. | 538 | If you don't know what to do here, say N. |
538 | 539 | ||
@@ -649,8 +650,6 @@ source "drivers/Kconfig" | |||
649 | 650 | ||
650 | source "fs/Kconfig" | 651 | source "fs/Kconfig" |
651 | 652 | ||
652 | source "kernel/Kconfig.instrumentation" | ||
653 | |||
654 | source "arch/alpha/Kconfig.debug" | 653 | source "arch/alpha/Kconfig.debug" |
655 | 654 | ||
656 | # DUMMY_CONSOLE may be defined in drivers/video/console/Kconfig | 655 | # DUMMY_CONSOLE may be defined in drivers/video/console/Kconfig |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9d8b7f9bca1d..64d19eff3faa 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -10,6 +10,8 @@ config ARM | |||
10 | default y | 10 | default y |
11 | select RTC_LIB | 11 | select RTC_LIB |
12 | select SYS_SUPPORTS_APM_EMULATION | 12 | select SYS_SUPPORTS_APM_EMULATION |
13 | select HAVE_OPROFILE | ||
14 | select HAVE_KPROBES if (!XIP_KERNEL) | ||
13 | help | 15 | help |
14 | The ARM series is a line of low-power-consumption RISC chip designs | 16 | The ARM series is a line of low-power-consumption RISC chip designs |
15 | licensed by ARM Ltd and targeted at embedded applications and | 17 | licensed by ARM Ltd and targeted at embedded applications and |
@@ -140,6 +142,23 @@ config FIQ | |||
140 | config ARCH_MTD_XIP | 142 | config ARCH_MTD_XIP |
141 | bool | 143 | bool |
142 | 144 | ||
145 | if OPROFILE | ||
146 | |||
147 | config OPROFILE_ARMV6 | ||
148 | def_bool y | ||
149 | depends on CPU_V6 && !SMP | ||
150 | select OPROFILE_ARM11_CORE | ||
151 | |||
152 | config OPROFILE_MPCORE | ||
153 | def_bool y | ||
154 | depends on CPU_V6 && SMP | ||
155 | select OPROFILE_ARM11_CORE | ||
156 | |||
157 | config OPROFILE_ARM11_CORE | ||
158 | bool | ||
159 | |||
160 | endif | ||
161 | |||
143 | config VECTORS_BASE | 162 | config VECTORS_BASE |
144 | hex | 163 | hex |
145 | default 0xffff0000 if MMU || CPU_HIGH_VECTOR | 164 | default 0xffff0000 if MMU || CPU_HIGH_VECTOR |
@@ -623,8 +642,7 @@ config SMP | |||
623 | processor machines. On a single processor machine, the kernel will | 642 | processor machines. On a single processor machine, the kernel will |
624 | run faster if you say N here. | 643 | run faster if you say N here. |
625 | 644 | ||
626 | See also the <file:Documentation/smp.txt>, | 645 | See also <file:Documentation/i386/IO-APIC.txt>, |
627 | <file:Documentation/i386/IO-APIC.txt>, | ||
628 | <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at | 646 | <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at |
629 | <http://www.linuxdoc.org/docs.html#howto>. | 647 | <http://www.linuxdoc.org/docs.html#howto>. |
630 | 648 | ||
@@ -1142,8 +1160,6 @@ endmenu | |||
1142 | 1160 | ||
1143 | source "fs/Kconfig" | 1161 | source "fs/Kconfig" |
1144 | 1162 | ||
1145 | source "arch/arm/Kconfig.instrumentation" | ||
1146 | |||
1147 | source "arch/arm/Kconfig.debug" | 1163 | source "arch/arm/Kconfig.debug" |
1148 | 1164 | ||
1149 | source "security/Kconfig" | 1165 | source "security/Kconfig" |
diff --git a/arch/arm/Kconfig.instrumentation b/arch/arm/Kconfig.instrumentation deleted file mode 100644 index 453ad8e15d69..000000000000 --- a/arch/arm/Kconfig.instrumentation +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | menuconfig INSTRUMENTATION | ||
2 | bool "Instrumentation Support" | ||
3 | default y | ||
4 | ---help--- | ||
5 | Say Y here to get to see options related to performance measurement, | ||
6 | system-wide debugging, and testing. This option alone does not add any | ||
7 | kernel code. | ||
8 | |||
9 | If you say N, all options in this submenu will be skipped and | ||
10 | disabled. If you're trying to debug the kernel itself, go see the | ||
11 | Kernel Hacking menu. | ||
12 | |||
13 | if INSTRUMENTATION | ||
14 | |||
15 | config PROFILING | ||
16 | bool "Profiling support (EXPERIMENTAL)" | ||
17 | help | ||
18 | Say Y here to enable the extended profiling support mechanisms used | ||
19 | by profilers such as OProfile. | ||
20 | |||
21 | config OPROFILE | ||
22 | tristate "OProfile system profiling (EXPERIMENTAL)" | ||
23 | depends on PROFILING && !UML | ||
24 | help | ||
25 | OProfile is a profiling system capable of profiling the | ||
26 | whole system, include the kernel, kernel modules, libraries, | ||
27 | and applications. | ||
28 | |||
29 | If unsure, say N. | ||
30 | |||
31 | config OPROFILE_ARMV6 | ||
32 | bool | ||
33 | depends on OPROFILE && CPU_V6 && !SMP | ||
34 | default y | ||
35 | select OPROFILE_ARM11_CORE | ||
36 | |||
37 | config OPROFILE_MPCORE | ||
38 | bool | ||
39 | depends on OPROFILE && CPU_V6 && SMP | ||
40 | default y | ||
41 | select OPROFILE_ARM11_CORE | ||
42 | |||
43 | config OPROFILE_ARM11_CORE | ||
44 | bool | ||
45 | |||
46 | config KPROBES | ||
47 | bool "Kprobes" | ||
48 | depends on KALLSYMS && MODULES && !UML && !XIP_KERNEL | ||
49 | help | ||
50 | Kprobes allows you to trap at almost any kernel address and | ||
51 | execute a callback function. register_kprobe() establishes | ||
52 | a probepoint and specifies the callback. Kprobes is useful | ||
53 | for kernel debugging, non-intrusive instrumentation and testing. | ||
54 | If in doubt, say "N". | ||
55 | |||
56 | config MARKERS | ||
57 | bool "Activate markers" | ||
58 | help | ||
59 | Place an empty function call at each marker site. Can be | ||
60 | dynamically changed for a probe function. | ||
61 | |||
62 | endif # INSTRUMENTATION | ||
diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c index efba65edcd51..31706224a04c 100644 --- a/arch/arm/mach-pxa/corgi_ssp.c +++ b/arch/arm/mach-pxa/corgi_ssp.c | |||
@@ -32,7 +32,7 @@ static struct corgissp_machinfo *ssp_machinfo; | |||
32 | /* | 32 | /* |
33 | * There are three devices connected to the SSP interface: | 33 | * There are three devices connected to the SSP interface: |
34 | * 1. A touchscreen controller (TI ADS7846 compatible) | 34 | * 1. A touchscreen controller (TI ADS7846 compatible) |
35 | * 2. An LCD contoller (with some Backlight functionality) | 35 | * 2. An LCD controller (with some Backlight functionality) |
36 | * 3. A battery monitoring IC (Maxim MAX1111) | 36 | * 3. A battery monitoring IC (Maxim MAX1111) |
37 | * | 37 | * |
38 | * Each device uses a different speed/mode of communication. | 38 | * Each device uses a different speed/mode of communication. |
diff --git a/arch/arm/mach-sa1100/collie_pm.c b/arch/arm/mach-sa1100/collie_pm.c index 1e25b1d19fce..94620be7bfac 100644 --- a/arch/arm/mach-sa1100/collie_pm.c +++ b/arch/arm/mach-sa1100/collie_pm.c | |||
@@ -165,7 +165,7 @@ int collie_read_temp(void) | |||
165 | 165 | ||
166 | ucb1x00_adc_enable(ucb); | 166 | ucb1x00_adc_enable(ucb); |
167 | ucb1x00_io_write(ucb, COLLIE_TC35143_GPIO_TMP_ON, 0); | 167 | ucb1x00_io_write(ucb, COLLIE_TC35143_GPIO_TMP_ON, 0); |
168 | /* >1010 = battery removed, 460 = 22C ?, higer = lower temp ? */ | 168 | /* >1010 = battery removed, 460 = 22C ?, higher = lower temp ? */ |
169 | voltage = ucb1x00_adc_read(ucb, UCB_ADC_INP_AD0, UCB_SYNC); | 169 | voltage = ucb1x00_adc_read(ucb, UCB_ADC_INP_AD0, UCB_SYNC); |
170 | ucb1x00_io_write(ucb, 0, COLLIE_TC35143_GPIO_TMP_ON); | 170 | ucb1x00_io_write(ucb, 0, COLLIE_TC35143_GPIO_TMP_ON); |
171 | ucb1x00_adc_disable(ucb); | 171 | ucb1x00_adc_disable(ucb); |
diff --git a/arch/arm/plat-s3c24xx/irq.c b/arch/arm/plat-s3c24xx/irq.c index d486f5112569..ae2c5d7efc9d 100644 --- a/arch/arm/plat-s3c24xx/irq.c +++ b/arch/arm/plat-s3c24xx/irq.c | |||
@@ -47,7 +47,7 @@ | |||
47 | * Mark IRQ_LCD valid | 47 | * Mark IRQ_LCD valid |
48 | * | 48 | * |
49 | * 25-Jul-2005 Ben Dooks | 49 | * 25-Jul-2005 Ben Dooks |
50 | * Split the S3C2440 IRQ code to seperate file | 50 | * Split the S3C2440 IRQ code to separate file |
51 | */ | 51 | */ |
52 | 52 | ||
53 | #include <linux/init.h> | 53 | #include <linux/init.h> |
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig index e34e2c9c94cb..c816f29154c9 100644 --- a/arch/avr32/Kconfig +++ b/arch/avr32/Kconfig | |||
@@ -10,6 +10,8 @@ config AVR32 | |||
10 | # With EMBEDDED=n, we get lots of stuff automatically selected | 10 | # With EMBEDDED=n, we get lots of stuff automatically selected |
11 | # that we usually don't need on AVR32. | 11 | # that we usually don't need on AVR32. |
12 | select EMBEDDED | 12 | select EMBEDDED |
13 | select HAVE_OPROFILE | ||
14 | select HAVE_KPROBES | ||
13 | help | 15 | help |
14 | AVR32 is a high-performance 32-bit RISC microprocessor core, | 16 | AVR32 is a high-performance 32-bit RISC microprocessor core, |
15 | designed for cost-sensitive embedded applications, with particular | 17 | designed for cost-sensitive embedded applications, with particular |
@@ -54,9 +56,6 @@ config ARCH_HAS_ILOG2_U32 | |||
54 | config ARCH_HAS_ILOG2_U64 | 56 | config ARCH_HAS_ILOG2_U64 |
55 | def_bool n | 57 | def_bool n |
56 | 58 | ||
57 | config ARCH_SUPPORTS_OPROFILE | ||
58 | def_bool y | ||
59 | |||
60 | config GENERIC_HWEIGHT | 59 | config GENERIC_HWEIGHT |
61 | def_bool y | 60 | def_bool y |
62 | 61 | ||
@@ -236,8 +235,6 @@ source "drivers/Kconfig" | |||
236 | 235 | ||
237 | source "fs/Kconfig" | 236 | source "fs/Kconfig" |
238 | 237 | ||
239 | source "kernel/Kconfig.instrumentation" | ||
240 | |||
241 | source "arch/avr32/Kconfig.debug" | 238 | source "arch/avr32/Kconfig.debug" |
242 | 239 | ||
243 | source "security/Kconfig" | 240 | source "security/Kconfig" |
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 4802eb767dc9..ba21e33b8b1f 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -24,6 +24,7 @@ config RWSEM_XCHGADD_ALGORITHM | |||
24 | config BLACKFIN | 24 | config BLACKFIN |
25 | bool | 25 | bool |
26 | default y | 26 | default y |
27 | select HAVE_OPROFILE | ||
27 | 28 | ||
28 | config ZONE_DMA | 29 | config ZONE_DMA |
29 | bool | 30 | bool |
@@ -973,8 +974,6 @@ source "drivers/Kconfig" | |||
973 | 974 | ||
974 | source "fs/Kconfig" | 975 | source "fs/Kconfig" |
975 | 976 | ||
976 | source "kernel/Kconfig.instrumentation" | ||
977 | |||
978 | source "arch/blackfin/Kconfig.debug" | 977 | source "arch/blackfin/Kconfig.debug" |
979 | 978 | ||
980 | source "security/Kconfig" | 979 | source "security/Kconfig" |
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 222da1501f47..7f0be4cd5e9a 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
@@ -213,8 +213,6 @@ source "drivers/pci/Kconfig" | |||
213 | 213 | ||
214 | source "drivers/usb/Kconfig" | 214 | source "drivers/usb/Kconfig" |
215 | 215 | ||
216 | source "kernel/Kconfig.instrumentation" | ||
217 | |||
218 | source "arch/cris/Kconfig.debug" | 216 | source "arch/cris/Kconfig.debug" |
219 | 217 | ||
220 | source "security/Kconfig" | 218 | source "security/Kconfig" |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index e3f965c91e22..bf0468cbe713 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -79,7 +79,7 @@ config FRV_OUTOFLINE_ATOMIC_OPS | |||
79 | Setting this option causes the FR-V atomic operations to be mostly | 79 | Setting this option causes the FR-V atomic operations to be mostly |
80 | implemented out-of-line. | 80 | implemented out-of-line. |
81 | 81 | ||
82 | See Documentation/fujitsu/frv/atomic-ops.txt for more information. | 82 | See Documentation/frv/atomic-ops.txt for more information. |
83 | 83 | ||
84 | config HIGHMEM | 84 | config HIGHMEM |
85 | bool "High memory support" | 85 | bool "High memory support" |
@@ -375,8 +375,6 @@ source "drivers/Kconfig" | |||
375 | 375 | ||
376 | source "fs/Kconfig" | 376 | source "fs/Kconfig" |
377 | 377 | ||
378 | source "kernel/Kconfig.instrumentation" | ||
379 | |||
380 | source "arch/frv/Kconfig.debug" | 378 | source "arch/frv/Kconfig.debug" |
381 | 379 | ||
382 | source "security/Kconfig" | 380 | source "security/Kconfig" |
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S index f926c7094776..99046b1f51c8 100644 --- a/arch/frv/kernel/entry.S +++ b/arch/frv/kernel/entry.S | |||
@@ -253,7 +253,7 @@ __entry_kernel_external_interrupt_reentry: | |||
253 | andi.p gr5,#~PSR_ET,gr5 | 253 | andi.p gr5,#~PSR_ET,gr5 |
254 | 254 | ||
255 | # set CCCR.CC3 to Undefined to abort atomic-modify completion inside the kernel | 255 | # set CCCR.CC3 to Undefined to abort atomic-modify completion inside the kernel |
256 | # - for an explanation of how it works, see: Documentation/fujitsu/frv/atomic-ops.txt | 256 | # - for an explanation of how it works, see: Documentation/frv/atomic-ops.txt |
257 | andi gr25,#~0xc0,gr25 | 257 | andi gr25,#~0xc0,gr25 |
258 | 258 | ||
259 | sti gr20,@(gr28,#REG_TBR) | 259 | sti gr20,@(gr28,#REG_TBR) |
@@ -445,7 +445,7 @@ __entry_kernel_softprog_interrupt_reentry: | |||
445 | sti gr22,@(sp,#REG_SP) | 445 | sti gr22,@(sp,#REG_SP) |
446 | 446 | ||
447 | # set CCCR.CC3 to Undefined to abort atomic-modify completion inside the kernel | 447 | # set CCCR.CC3 to Undefined to abort atomic-modify completion inside the kernel |
448 | # - for an explanation of how it works, see: Documentation/fujitsu/frv/atomic-ops.txt | 448 | # - for an explanation of how it works, see: Documentation/frv/atomic-ops.txt |
449 | movsg cccr,gr20 | 449 | movsg cccr,gr20 |
450 | andi gr20,#~0xc0,gr20 | 450 | andi gr20,#~0xc0,gr20 |
451 | movgs gr20,cccr | 451 | movgs gr20,cccr |
diff --git a/arch/frv/lib/atomic-ops.S b/arch/frv/lib/atomic-ops.S index 545cd325ac57..ee0ac905fb08 100644 --- a/arch/frv/lib/atomic-ops.S +++ b/arch/frv/lib/atomic-ops.S | |||
@@ -1,7 +1,7 @@ | |||
1 | /* atomic-ops.S: kernel atomic operations | 1 | /* atomic-ops.S: kernel atomic operations |
2 | * | 2 | * |
3 | * For an explanation of how atomic ops work in this arch, see: | 3 | * For an explanation of how atomic ops work in this arch, see: |
4 | * Documentation/fujitsu/frv/atomic-ops.txt | 4 | * Documentation/frv/atomic-ops.txt |
5 | * | 5 | * |
6 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | 6 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. |
7 | * Written by David Howells (dhowells@redhat.com) | 7 | * Written by David Howells (dhowells@redhat.com) |
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index ff6a8712bd6d..dc61222e1120 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig | |||
@@ -223,8 +223,6 @@ endmenu | |||
223 | 223 | ||
224 | source "fs/Kconfig" | 224 | source "fs/Kconfig" |
225 | 225 | ||
226 | source "kernel/Kconfig.instrumentation" | ||
227 | |||
228 | source "arch/h8300/Kconfig.debug" | 226 | source "arch/h8300/Kconfig.debug" |
229 | 227 | ||
230 | source "security/Kconfig" | 228 | source "security/Kconfig" |
diff --git a/arch/h8300/platform/h8s/ints.c b/arch/h8300/platform/h8s/ints.c index 551fd5f30d82..ac10b9783850 100644 --- a/arch/h8300/platform/h8s/ints.c +++ b/arch/h8300/platform/h8s/ints.c | |||
@@ -121,7 +121,7 @@ void __init init_IRQ(void) | |||
121 | printk("virtual vector at 0x%08lx\n",(unsigned long)ramvec); | 121 | printk("virtual vector at 0x%08lx\n",(unsigned long)ramvec); |
122 | 122 | ||
123 | #if defined(CONFIG_GDB_DEBUG) | 123 | #if defined(CONFIG_GDB_DEBUG) |
124 | /* save orignal break vector */ | 124 | /* save original break vector */ |
125 | break_vec = ramvec[TRAP3_VEC]; | 125 | break_vec = ramvec[TRAP3_VEC]; |
126 | #else | 126 | #else |
127 | break_vec = VECTOR(trace_break); | 127 | break_vec = VECTOR(trace_break); |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index c9307c99a1dc..b0de1132dfc0 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -15,6 +15,8 @@ config IA64 | |||
15 | select ACPI if (!IA64_HP_SIM) | 15 | select ACPI if (!IA64_HP_SIM) |
16 | select PM if (!IA64_HP_SIM) | 16 | select PM if (!IA64_HP_SIM) |
17 | select ARCH_SUPPORTS_MSI | 17 | select ARCH_SUPPORTS_MSI |
18 | select HAVE_OPROFILE | ||
19 | select HAVE_KPROBES | ||
18 | default y | 20 | default y |
19 | help | 21 | help |
20 | The Itanium Processor Family is Intel's 64-bit successor to | 22 | The Itanium Processor Family is Intel's 64-bit successor to |
@@ -283,8 +285,8 @@ config SMP | |||
283 | single processor systems. On a single processor system, the kernel | 285 | single processor systems. On a single processor system, the kernel |
284 | will run faster if you say N here. | 286 | will run faster if you say N here. |
285 | 287 | ||
286 | See also the <file:Documentation/smp.txt> and the SMP-HOWTO | 288 | See also the SMP-HOWTO available at |
287 | available at <http://www.tldp.org/docs.html#howto>. | 289 | <http://www.tldp.org/docs.html#howto>. |
288 | 290 | ||
289 | If you don't know what to do here, say N. | 291 | If you don't know what to do here, say N. |
290 | 292 | ||
@@ -600,8 +602,6 @@ config IRQ_PER_CPU | |||
600 | 602 | ||
601 | source "arch/ia64/hp/sim/Kconfig" | 603 | source "arch/ia64/hp/sim/Kconfig" |
602 | 604 | ||
603 | source "kernel/Kconfig.instrumentation" | ||
604 | |||
605 | source "arch/ia64/Kconfig.debug" | 605 | source "arch/ia64/Kconfig.debug" |
606 | 606 | ||
607 | source "security/Kconfig" | 607 | source "security/Kconfig" |
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig index 49326e9d4413..795180b8fd8e 100644 --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig | |||
@@ -8,6 +8,7 @@ mainmenu "Linux/M32R Kernel Configuration" | |||
8 | config M32R | 8 | config M32R |
9 | bool | 9 | bool |
10 | default y | 10 | default y |
11 | select HAVE_OPROFILE | ||
11 | 12 | ||
12 | config SBUS | 13 | config SBUS |
13 | bool | 14 | bool |
@@ -302,8 +303,7 @@ config SMP | |||
302 | Y to "Enhanced Real Time Clock Support", below. The "Advanced Power | 303 | Y to "Enhanced Real Time Clock Support", below. The "Advanced Power |
303 | Management" code will be disabled if you say Y here. | 304 | Management" code will be disabled if you say Y here. |
304 | 305 | ||
305 | See also the <file:Documentation/smp.txt>, | 306 | See also the SMP-HOWTO available at |
306 | and the SMP-HOWTO available at | ||
307 | <http://www.linuxdoc.org/docs.html#howto>. | 307 | <http://www.linuxdoc.org/docs.html#howto>. |
308 | 308 | ||
309 | If you don't know what to do here, say N. | 309 | If you don't know what to do here, say N. |
@@ -426,8 +426,6 @@ source "drivers/Kconfig" | |||
426 | 426 | ||
427 | source "fs/Kconfig" | 427 | source "fs/Kconfig" |
428 | 428 | ||
429 | source "kernel/Kconfig.instrumentation" | ||
430 | |||
431 | source "arch/m32r/Kconfig.debug" | 429 | source "arch/m32r/Kconfig.debug" |
432 | 430 | ||
433 | source "security/Kconfig" | 431 | source "security/Kconfig" |
diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c index ed4d0756c5db..9aa615d3a5b2 100644 --- a/arch/m32r/kernel/ptrace.c +++ b/arch/m32r/kernel/ptrace.c | |||
@@ -476,7 +476,7 @@ unregister_debug_trap(struct task_struct *child, unsigned long addr, | |||
476 | return 0; | 476 | return 0; |
477 | } | 477 | } |
478 | 478 | ||
479 | /* Recover orignal instruction code. */ | 479 | /* Recover original instruction code. */ |
480 | *code = p->insn[i]; | 480 | *code = p->insn[i]; |
481 | 481 | ||
482 | /* Shift debug trap entries. */ | 482 | /* Shift debug trap entries. */ |
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 24e6bc09e7a7..8236e42ef711 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -678,8 +678,6 @@ endmenu | |||
678 | 678 | ||
679 | source "fs/Kconfig" | 679 | source "fs/Kconfig" |
680 | 680 | ||
681 | source "kernel/Kconfig.instrumentation" | ||
682 | |||
683 | source "arch/m68k/Kconfig.debug" | 681 | source "arch/m68k/Kconfig.debug" |
684 | 682 | ||
685 | source "security/Kconfig" | 683 | source "security/Kconfig" |
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig index bd9213749ac2..6abbbb8aac5e 100644 --- a/arch/m68knommu/Kconfig +++ b/arch/m68knommu/Kconfig | |||
@@ -711,8 +711,6 @@ source "drivers/Kconfig" | |||
711 | 711 | ||
712 | source "fs/Kconfig" | 712 | source "fs/Kconfig" |
713 | 713 | ||
714 | source "kernel/Kconfig.instrumentation" | ||
715 | |||
716 | source "arch/m68knommu/Kconfig.debug" | 714 | source "arch/m68knommu/Kconfig.debug" |
717 | 715 | ||
718 | source "security/Kconfig" | 716 | source "security/Kconfig" |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 36a4018f71d2..ec78a5762e9e 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config MIPS | 1 | config MIPS |
2 | bool | 2 | bool |
3 | default y | 3 | default y |
4 | select HAVE_OPROFILE | ||
4 | # Horrible source of confusion. Die, die, die ... | 5 | # Horrible source of confusion. Die, die, die ... |
5 | select EMBEDDED | 6 | select EMBEDDED |
6 | select RTC_LIB | 7 | select RTC_LIB |
@@ -1754,8 +1755,8 @@ config SMP | |||
1754 | People using multiprocessor machines who say Y here should also say | 1755 | People using multiprocessor machines who say Y here should also say |
1755 | Y to "Enhanced Real Time Clock Support", below. | 1756 | Y to "Enhanced Real Time Clock Support", below. |
1756 | 1757 | ||
1757 | See also the <file:Documentation/smp.txt> and the SMP-HOWTO | 1758 | See also the SMP-HOWTO available at |
1758 | available at <http://www.tldp.org/docs.html#howto>. | 1759 | <http://www.tldp.org/docs.html#howto>. |
1759 | 1760 | ||
1760 | If you don't know what to do here, say N. | 1761 | If you don't know what to do here, say N. |
1761 | 1762 | ||
@@ -2095,8 +2096,6 @@ source "drivers/Kconfig" | |||
2095 | 2096 | ||
2096 | source "fs/Kconfig" | 2097 | source "fs/Kconfig" |
2097 | 2098 | ||
2098 | source "kernel/Kconfig.instrumentation" | ||
2099 | |||
2100 | source "arch/mips/Kconfig.debug" | 2099 | source "arch/mips/Kconfig.debug" |
2101 | 2100 | ||
2102 | source "security/Kconfig" | 2101 | source "security/Kconfig" |
diff --git a/arch/mips/au1000/mtx-1/board_setup.c b/arch/mips/au1000/mtx-1/board_setup.c index abfc4bcddf7a..310d5dff89fc 100644 --- a/arch/mips/au1000/mtx-1/board_setup.c +++ b/arch/mips/au1000/mtx-1/board_setup.c | |||
@@ -99,7 +99,7 @@ mtx1_pci_idsel(unsigned int devsel, int assert) | |||
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | if (assert && devsel != 0) { | 101 | if (assert && devsel != 0) { |
102 | // supress signal to cardbus | 102 | // suppress signal to cardbus |
103 | au_writel( 0x00000002, SYS_OUTPUTCLR ); // set EXT_IO3 OFF | 103 | au_writel( 0x00000002, SYS_OUTPUTCLR ); // set EXT_IO3 OFF |
104 | } | 104 | } |
105 | else { | 105 | else { |
diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c index 9b34238d41c0..77db3473deab 100644 --- a/arch/mips/kernel/binfmt_elfn32.c +++ b/arch/mips/kernel/binfmt_elfn32.c | |||
@@ -98,7 +98,7 @@ static __inline__ void | |||
98 | jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) | 98 | jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) |
99 | { | 99 | { |
100 | /* | 100 | /* |
101 | * Convert jiffies to nanoseconds and seperate with | 101 | * Convert jiffies to nanoseconds and separate with |
102 | * one divide. | 102 | * one divide. |
103 | */ | 103 | */ |
104 | u64 nsec = (u64)jiffies * TICK_NSEC; | 104 | u64 nsec = (u64)jiffies * TICK_NSEC; |
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c index da41eac195ca..08f4cd781ee3 100644 --- a/arch/mips/kernel/binfmt_elfo32.c +++ b/arch/mips/kernel/binfmt_elfo32.c | |||
@@ -100,7 +100,7 @@ static inline void | |||
100 | jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) | 100 | jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) |
101 | { | 101 | { |
102 | /* | 102 | /* |
103 | * Convert jiffies to nanoseconds and seperate with | 103 | * Convert jiffies to nanoseconds and separate with |
104 | * one divide. | 104 | * one divide. |
105 | */ | 105 | */ |
106 | u64 nsec = (u64)jiffies * TICK_NSEC; | 106 | u64 nsec = (u64)jiffies * TICK_NSEC; |
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c index f6704ab16306..998c4efcce88 100644 --- a/arch/mips/kernel/kspd.c +++ b/arch/mips/kernel/kspd.c | |||
@@ -221,7 +221,7 @@ void sp_work_handle_request(void) | |||
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | /* Run the syscall at the priviledge of the user who loaded the | 224 | /* Run the syscall at the privilege of the user who loaded the |
225 | SP program */ | 225 | SP program */ |
226 | 226 | ||
227 | if (vpe_getuid(tclimit)) | 227 | if (vpe_getuid(tclimit)) |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 269c252d956f..c032409cba9b 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -424,13 +424,13 @@ static void __init bootmem_init(void) | |||
424 | #endif /* CONFIG_SGI_IP27 */ | 424 | #endif /* CONFIG_SGI_IP27 */ |
425 | 425 | ||
426 | /* | 426 | /* |
427 | * arch_mem_init - initialize memory managment subsystem | 427 | * arch_mem_init - initialize memory management subsystem |
428 | * | 428 | * |
429 | * o plat_mem_setup() detects the memory configuration and will record detected | 429 | * o plat_mem_setup() detects the memory configuration and will record detected |
430 | * memory areas using add_memory_region. | 430 | * memory areas using add_memory_region. |
431 | * | 431 | * |
432 | * At this stage the memory configuration of the system is known to the | 432 | * At this stage the memory configuration of the system is known to the |
433 | * kernel but generic memory managment system is still entirely uninitialized. | 433 | * kernel but generic memory management system is still entirely uninitialized. |
434 | * | 434 | * |
435 | * o bootmem_init() | 435 | * o bootmem_init() |
436 | * o sparse_init() | 436 | * o sparse_init() |
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c index 85f700e58131..b42e71c71119 100644 --- a/arch/mips/kernel/smtc.c +++ b/arch/mips/kernel/smtc.c | |||
@@ -65,7 +65,7 @@ asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS]; | |||
65 | static atomic_t ipi_timer_latch[NR_CPUS]; | 65 | static atomic_t ipi_timer_latch[NR_CPUS]; |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Number of InterProcessor Interupt (IPI) message buffers to allocate | 68 | * Number of InterProcessor Interrupt (IPI) message buffers to allocate |
69 | */ | 69 | */ |
70 | 70 | ||
71 | #define IPIBUF_PER_CPU 4 | 71 | #define IPIBUF_PER_CPU 4 |
@@ -780,7 +780,7 @@ void smtc_send_ipi(int cpu, int type, unsigned int action) | |||
780 | if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) { | 780 | if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) { |
781 | if (type == SMTC_CLOCK_TICK) | 781 | if (type == SMTC_CLOCK_TICK) |
782 | atomic_inc(&ipi_timer_latch[cpu]); | 782 | atomic_inc(&ipi_timer_latch[cpu]); |
783 | /* If not on same VPE, enqueue and send cross-VPE interupt */ | 783 | /* If not on same VPE, enqueue and send cross-VPE interrupt */ |
784 | smtc_ipi_nq(&IPIQ[cpu], pipi); | 784 | smtc_ipi_nq(&IPIQ[cpu], pipi); |
785 | LOCK_CORE_PRA(); | 785 | LOCK_CORE_PRA(); |
786 | settc(cpu_data[cpu].tc_id); | 786 | settc(cpu_data[cpu].tc_id); |
@@ -1063,7 +1063,7 @@ static void setup_cross_vpe_interrupts(unsigned int nvpe) | |||
1063 | return; | 1063 | return; |
1064 | 1064 | ||
1065 | if (!cpu_has_vint) | 1065 | if (!cpu_has_vint) |
1066 | panic("SMTC Kernel requires Vectored Interupt support"); | 1066 | panic("SMTC Kernel requires Vectored Interrupt support"); |
1067 | 1067 | ||
1068 | set_vi_handler(MIPS_CPU_IPI_IRQ, ipi_irq_dispatch); | 1068 | set_vi_handler(MIPS_CPU_IPI_IRQ, ipi_irq_dispatch); |
1069 | 1069 | ||
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 02bd180f0e02..53ec05267a98 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -1101,7 +1101,7 @@ static void __init setup_scache(void) | |||
1101 | /* | 1101 | /* |
1102 | * Do the probing thing on R4000SC and R4400SC processors. Other | 1102 | * Do the probing thing on R4000SC and R4400SC processors. Other |
1103 | * processors don't have a S-cache that would be relevant to the | 1103 | * processors don't have a S-cache that would be relevant to the |
1104 | * Linux memory managment. | 1104 | * Linux memory management. |
1105 | */ | 1105 | */ |
1106 | switch (c->cputype) { | 1106 | switch (c->cputype) { |
1107 | case CPU_R4000SC: | 1107 | case CPU_R4000SC: |
diff --git a/arch/mips/sgi-ip27/ip27-hubio.c b/arch/mips/sgi-ip27/ip27-hubio.c index 524b371f9397..a1fa4abb3f6a 100644 --- a/arch/mips/sgi-ip27/ip27-hubio.c +++ b/arch/mips/sgi-ip27/ip27-hubio.c | |||
@@ -168,7 +168,7 @@ static void hub_set_piomode(nasid_t nasid) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * hub_pio_init - PIO-related hub initalization | 171 | * hub_pio_init - PIO-related hub initialization |
172 | * | 172 | * |
173 | * @hub: hubinfo structure for our hub | 173 | * @hub: hubinfo structure for our hub |
174 | */ | 174 | */ |
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 2b649c46631c..028d8a0fdbfd 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -7,6 +7,7 @@ mainmenu "Linux/PA-RISC Kernel Configuration" | |||
7 | 7 | ||
8 | config PARISC | 8 | config PARISC |
9 | def_bool y | 9 | def_bool y |
10 | select HAVE_OPROFILE | ||
10 | help | 11 | help |
11 | The PA-RISC microprocessor is designed by Hewlett-Packard and used | 12 | The PA-RISC microprocessor is designed by Hewlett-Packard and used |
12 | in many of their workstations & servers (HP9000 700 and 800 series, | 13 | in many of their workstations & servers (HP9000 700 and 800 series, |
@@ -205,9 +206,8 @@ config SMP | |||
205 | singleprocessor machines. On a singleprocessor machine, the kernel | 206 | singleprocessor machines. On a singleprocessor machine, the kernel |
206 | will run faster if you say N here. | 207 | will run faster if you say N here. |
207 | 208 | ||
208 | See also the <file:Documentation/smp.txt>, | 209 | See also <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO |
209 | <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available | 210 | available at <http://www.tldp.org/docs.html#howto>. |
210 | at <http://www.tldp.org/docs.html#howto>. | ||
211 | 211 | ||
212 | If you don't know what to do here, say N. | 212 | If you don't know what to do here, say N. |
213 | 213 | ||
@@ -272,8 +272,6 @@ source "drivers/Kconfig" | |||
272 | 272 | ||
273 | source "fs/Kconfig" | 273 | source "fs/Kconfig" |
274 | 274 | ||
275 | source "kernel/Kconfig.instrumentation" | ||
276 | |||
277 | source "arch/parisc/Kconfig.debug" | 275 | source "arch/parisc/Kconfig.debug" |
278 | 276 | ||
279 | source "security/Kconfig" | 277 | source "security/Kconfig" |
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index 395bbce64993..e10d25d2d9c9 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c | |||
@@ -305,7 +305,7 @@ flush_user_cache_page_non_current(struct vm_area_struct *vma, | |||
305 | /* save the current process space and pgd */ | 305 | /* save the current process space and pgd */ |
306 | unsigned long space = mfsp(3), pgd = mfctl(25); | 306 | unsigned long space = mfsp(3), pgd = mfctl(25); |
307 | 307 | ||
308 | /* we don't mind taking interrups since they may not | 308 | /* we don't mind taking interrupts since they may not |
309 | * do anything with user space, but we can't | 309 | * do anything with user space, but we can't |
310 | * be preempted here */ | 310 | * be preempted here */ |
311 | preempt_disable(); | 311 | preempt_disable(); |
diff --git a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c index 04848b2b381c..84b9611a9228 100644 --- a/arch/parisc/kernel/hardware.c +++ b/arch/parisc/kernel/hardware.c | |||
@@ -1187,7 +1187,7 @@ static struct hp_hardware hp_hardware_list[] __devinitdata = { | |||
1187 | {HPHW_FIO, 0x005, 0x000A9, 0x00, "AllegroLow Core PCI USB KB"}, | 1187 | {HPHW_FIO, 0x005, 0x000A9, 0x00, "AllegroLow Core PCI USB KB"}, |
1188 | {HPHW_FIO, 0x006, 0x000A9, 0x00, "AllegroHigh Core PCI SuperIO RS-232"}, | 1188 | {HPHW_FIO, 0x006, 0x000A9, 0x00, "AllegroHigh Core PCI SuperIO RS-232"}, |
1189 | {HPHW_FIO, 0x006, 0x000A9, 0x00, "AllegroHigh Core PCI USB KB"}, | 1189 | {HPHW_FIO, 0x006, 0x000A9, 0x00, "AllegroHigh Core PCI USB KB"}, |
1190 | {HPHW_FIO, 0x007, 0x000A9, 0x0, "Miscelaneous PCI Plug-in"}, | 1190 | {HPHW_FIO, 0x007, 0x000A9, 0x0, "Miscellaneous PCI Plug-in"}, |
1191 | {HPHW_FIO, 0x00A, 0x000A9, 0x0, "Lego 360 Core PCI SuperIO RS-232"}, | 1191 | {HPHW_FIO, 0x00A, 0x000A9, 0x0, "Lego 360 Core PCI SuperIO RS-232"}, |
1192 | {HPHW_FIO, 0x00A, 0x000A9, 0x0, "Lego 360 Core PCI USB KB"}, | 1192 | {HPHW_FIO, 0x00A, 0x000A9, 0x0, "Lego 360 Core PCI USB KB"}, |
1193 | {HPHW_FIO, 0x004, 0x00320, 0x0, "Metheus Frame Buffer"}, | 1193 | {HPHW_FIO, 0x004, 0x00320, 0x0, "Metheus Frame Buffer"}, |
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 2ce3806f02e1..58fccc96d003 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c | |||
@@ -333,7 +333,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
333 | flush_user_icache_range((unsigned long) &frame->tramp[0], | 333 | flush_user_icache_range((unsigned long) &frame->tramp[0], |
334 | (unsigned long) &frame->tramp[TRAMP_SIZE]); | 334 | (unsigned long) &frame->tramp[TRAMP_SIZE]); |
335 | 335 | ||
336 | /* TRAMP Words 0-4, Lenght 5 = SIGRESTARTBLOCK_TRAMP | 336 | /* TRAMP Words 0-4, Length 5 = SIGRESTARTBLOCK_TRAMP |
337 | * TRAMP Words 5-9, Length 4 = SIGRETURN_TRAMP | 337 | * TRAMP Words 5-9, Length 4 = SIGRETURN_TRAMP |
338 | * So the SIGRETURN_TRAMP is at the end of SIGRESTARTBLOCK_TRAMP | 338 | * So the SIGRETURN_TRAMP is at the end of SIGRESTARTBLOCK_TRAMP |
339 | */ | 339 | */ |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 4a22c9928618..b94d4502a477 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -87,6 +87,8 @@ config ARCH_NO_VIRT_TO_BUS | |||
87 | config PPC | 87 | config PPC |
88 | bool | 88 | bool |
89 | default y | 89 | default y |
90 | select HAVE_OPROFILE | ||
91 | select HAVE_KPROBES | ||
90 | 92 | ||
91 | config EARLY_PRINTK | 93 | config EARLY_PRINTK |
92 | bool | 94 | bool |
@@ -713,8 +715,6 @@ source "arch/powerpc/sysdev/qe_lib/Kconfig" | |||
713 | 715 | ||
714 | source "lib/Kconfig" | 716 | source "lib/Kconfig" |
715 | 717 | ||
716 | source "kernel/Kconfig.instrumentation" | ||
717 | |||
718 | source "arch/powerpc/Kconfig.debug" | 718 | source "arch/powerpc/Kconfig.debug" |
719 | 719 | ||
720 | source "security/Kconfig" | 720 | source "security/Kconfig" |
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig index db5934cdafb3..531156f8919c 100644 --- a/arch/ppc/Kconfig +++ b/arch/ppc/Kconfig | |||
@@ -42,6 +42,8 @@ config GENERIC_CALIBRATE_DELAY | |||
42 | config PPC | 42 | config PPC |
43 | bool | 43 | bool |
44 | default y | 44 | default y |
45 | select HAVE_OPROFILE | ||
46 | select HAVE_KPROBES | ||
45 | 47 | ||
46 | config PPC32 | 48 | config PPC32 |
47 | bool | 49 | bool |
@@ -1256,8 +1258,6 @@ endmenu | |||
1256 | 1258 | ||
1257 | source "lib/Kconfig" | 1259 | source "lib/Kconfig" |
1258 | 1260 | ||
1259 | source "kernel/Kconfig.instrumentation" | ||
1260 | |||
1261 | source "arch/ppc/Kconfig.debug" | 1261 | source "arch/ppc/Kconfig.debug" |
1262 | 1262 | ||
1263 | source "security/Kconfig" | 1263 | source "security/Kconfig" |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 6ef54d27fc00..82cbffd03654 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -51,6 +51,8 @@ mainmenu "Linux Kernel Configuration" | |||
51 | 51 | ||
52 | config S390 | 52 | config S390 |
53 | def_bool y | 53 | def_bool y |
54 | select HAVE_OPROFILE | ||
55 | select HAVE_KPROBES | ||
54 | 56 | ||
55 | source "init/Kconfig" | 57 | source "init/Kconfig" |
56 | 58 | ||
@@ -81,8 +83,8 @@ config SMP | |||
81 | singleprocessor machines. On a singleprocessor machine, the kernel | 83 | singleprocessor machines. On a singleprocessor machine, the kernel |
82 | will run faster if you say N here. | 84 | will run faster if you say N here. |
83 | 85 | ||
84 | See also the <file:Documentation/smp.txt> and the SMP-HOWTO | 86 | See also the SMP-HOWTO available at |
85 | available at <http://www.tldp.org/docs.html#howto>. | 87 | <http://www.tldp.org/docs.html#howto>. |
86 | 88 | ||
87 | Even if you don't know what to do here, say Y. | 89 | Even if you don't know what to do here, say Y. |
88 | 90 | ||
@@ -526,8 +528,6 @@ source "drivers/Kconfig" | |||
526 | 528 | ||
527 | source "fs/Kconfig" | 529 | source "fs/Kconfig" |
528 | 530 | ||
529 | source "kernel/Kconfig.instrumentation" | ||
530 | |||
531 | source "arch/s390/Kconfig.debug" | 531 | source "arch/s390/Kconfig.debug" |
532 | 532 | ||
533 | source "security/Kconfig" | 533 | source "security/Kconfig" |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index b30c4c376a83..1c3a90835c7e 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -8,6 +8,7 @@ mainmenu "Linux/SuperH Kernel Configuration" | |||
8 | config SUPERH | 8 | config SUPERH |
9 | def_bool y | 9 | def_bool y |
10 | select EMBEDDED | 10 | select EMBEDDED |
11 | select HAVE_OPROFILE | ||
11 | help | 12 | help |
12 | The SuperH is a RISC processor targeted for use in embedded systems | 13 | The SuperH is a RISC processor targeted for use in embedded systems |
13 | and consumer electronics; it was also used in the Sega Dreamcast | 14 | and consumer electronics; it was also used in the Sega Dreamcast |
@@ -672,9 +673,8 @@ config SMP | |||
672 | People using multiprocessor machines who say Y here should also say | 673 | People using multiprocessor machines who say Y here should also say |
673 | Y to "Enhanced Real Time Clock Support", below. | 674 | Y to "Enhanced Real Time Clock Support", below. |
674 | 675 | ||
675 | See also the <file:Documentation/smp.txt>, | 676 | See also <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO |
676 | <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available | 677 | available at <http://www.tldp.org/docs.html#howto>. |
677 | at <http://www.tldp.org/docs.html#howto>. | ||
678 | 678 | ||
679 | If you don't know what to do here, say N. | 679 | If you don't know what to do here, say N. |
680 | 680 | ||
@@ -896,8 +896,6 @@ source "drivers/Kconfig" | |||
896 | 896 | ||
897 | source "fs/Kconfig" | 897 | source "fs/Kconfig" |
898 | 898 | ||
899 | source "kernel/Kconfig.instrumentation" | ||
900 | |||
901 | source "arch/sh/Kconfig.debug" | 899 | source "arch/sh/Kconfig.debug" |
902 | 900 | ||
903 | source "security/Kconfig" | 901 | source "security/Kconfig" |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 527adc808ad6..99f8971716d2 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -48,9 +48,8 @@ config SMP | |||
48 | Y to "Enhanced Real Time Clock Support", below. The "Advanced Power | 48 | Y to "Enhanced Real Time Clock Support", below. The "Advanced Power |
49 | Management" code will be disabled if you say Y here. | 49 | Management" code will be disabled if you say Y here. |
50 | 50 | ||
51 | See also the <file:Documentation/smp.txt>, | 51 | See also <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO |
52 | <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at | 52 | available at <http://www.tldp.org/docs.html#howto>. |
53 | <http://www.tldp.org/docs.html#howto>. | ||
54 | 53 | ||
55 | If you don't know what to do here, say N. | 54 | If you don't know what to do here, say N. |
56 | 55 | ||
@@ -63,6 +62,7 @@ config NR_CPUS | |||
63 | config SPARC | 62 | config SPARC |
64 | bool | 63 | bool |
65 | default y | 64 | default y |
65 | select HAVE_OPROFILE | ||
66 | 66 | ||
67 | # Identify this as a Sparc32 build | 67 | # Identify this as a Sparc32 build |
68 | config SPARC32 | 68 | config SPARC32 |
@@ -320,8 +320,6 @@ endmenu | |||
320 | 320 | ||
321 | source "fs/Kconfig" | 321 | source "fs/Kconfig" |
322 | 322 | ||
323 | source "kernel/Kconfig.instrumentation" | ||
324 | |||
325 | source "arch/sparc/Kconfig.debug" | 323 | source "arch/sparc/Kconfig.debug" |
326 | 324 | ||
327 | source "security/Kconfig" | 325 | source "security/Kconfig" |
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 97aa50d1e4ae..ad0ede24ca1d 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -305,7 +305,7 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp) | |||
305 | struct resource *res; | 305 | struct resource *res; |
306 | int order; | 306 | int order; |
307 | 307 | ||
308 | /* XXX why are some lenghts signed, others unsigned? */ | 308 | /* XXX why are some lengths signed, others unsigned? */ |
309 | if (len <= 0) { | 309 | if (len <= 0) { |
310 | return NULL; | 310 | return NULL; |
311 | } | 311 | } |
@@ -393,7 +393,7 @@ void sbus_free_consistent(struct sbus_dev *sdev, long n, void *p, u32 ba) | |||
393 | */ | 393 | */ |
394 | dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *va, size_t len, int direction) | 394 | dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *va, size_t len, int direction) |
395 | { | 395 | { |
396 | /* XXX why are some lenghts signed, others unsigned? */ | 396 | /* XXX why are some lengths signed, others unsigned? */ |
397 | if (len <= 0) { | 397 | if (len <= 0) { |
398 | return 0; | 398 | return 0; |
399 | } | 399 | } |
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 158522f51d31..a8c6366f05a1 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -8,6 +8,8 @@ mainmenu "Linux/UltraSPARC Kernel Configuration" | |||
8 | config SPARC | 8 | config SPARC |
9 | bool | 9 | bool |
10 | default y | 10 | default y |
11 | select HAVE_OPROFILE | ||
12 | select HAVE_KPROBES | ||
11 | 13 | ||
12 | config SPARC64 | 14 | config SPARC64 |
13 | bool | 15 | bool |
@@ -166,9 +168,8 @@ config SMP | |||
166 | Y to "Enhanced Real Time Clock Support", below. The "Advanced Power | 168 | Y to "Enhanced Real Time Clock Support", below. The "Advanced Power |
167 | Management" code will be disabled if you say Y here. | 169 | Management" code will be disabled if you say Y here. |
168 | 170 | ||
169 | See also the <file:Documentation/smp.txt>, | 171 | See also <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO |
170 | <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at | 172 | available at <http://www.tldp.org/docs.html#howto>. |
171 | <http://www.tldp.org/docs.html#howto>. | ||
172 | 173 | ||
173 | If you don't know what to do here, say N. | 174 | If you don't know what to do here, say N. |
174 | 175 | ||
@@ -465,8 +466,6 @@ source "drivers/sbus/char/Kconfig" | |||
465 | 466 | ||
466 | source "fs/Kconfig" | 467 | source "fs/Kconfig" |
467 | 468 | ||
468 | source "kernel/Kconfig.instrumentation" | ||
469 | |||
470 | source "arch/sparc64/Kconfig.debug" | 469 | source "arch/sparc64/Kconfig.debug" |
471 | 470 | ||
472 | source "security/Kconfig" | 471 | source "security/Kconfig" |
diff --git a/arch/um/Kconfig b/arch/um/Kconfig index dd1689b814cb..55945db1313c 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig | |||
@@ -289,6 +289,4 @@ config INPUT | |||
289 | bool | 289 | bool |
290 | default n | 290 | default n |
291 | 291 | ||
292 | source "kernel/Kconfig.instrumentation" | ||
293 | |||
294 | source "arch/um/Kconfig.debug" | 292 | source "arch/um/Kconfig.debug" |
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c index 7457436b433a..14070181407b 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c | |||
@@ -112,7 +112,7 @@ static int copy_sc_to_user(struct sigcontext __user *to, | |||
112 | err |= PUTREG(regs, RSI, to, si); | 112 | err |= PUTREG(regs, RSI, to, si); |
113 | err |= PUTREG(regs, RBP, to, bp); | 113 | err |= PUTREG(regs, RBP, to, bp); |
114 | /* | 114 | /* |
115 | * Must use orignal RSP, which is passed in, rather than what's in | 115 | * Must use original RSP, which is passed in, rather than what's in |
116 | * the pt_regs, because that's already been updated to point at the | 116 | * the pt_regs, because that's already been updated to point at the |
117 | * signal frame. | 117 | * signal frame. |
118 | */ | 118 | */ |
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig index b6a50b8b38de..ace479ab273f 100644 --- a/arch/v850/Kconfig +++ b/arch/v850/Kconfig | |||
@@ -331,8 +331,6 @@ source "sound/Kconfig" | |||
331 | 331 | ||
332 | source "drivers/usb/Kconfig" | 332 | source "drivers/usb/Kconfig" |
333 | 333 | ||
334 | source "kernel/Kconfig.instrumentation" | ||
335 | |||
336 | source "arch/v850/Kconfig.debug" | 334 | source "arch/v850/Kconfig.debug" |
337 | 335 | ||
338 | source "security/Kconfig" | 336 | source "security/Kconfig" |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 7109037bdf7c..59eef1c7fdaa 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -18,6 +18,8 @@ config X86_64 | |||
18 | ### Arch settings | 18 | ### Arch settings |
19 | config X86 | 19 | config X86 |
20 | def_bool y | 20 | def_bool y |
21 | select HAVE_OPROFILE | ||
22 | select HAVE_KPROBES | ||
21 | 23 | ||
22 | config GENERIC_LOCKBREAK | 24 | config GENERIC_LOCKBREAK |
23 | def_bool n | 25 | def_bool n |
@@ -106,10 +108,6 @@ config GENERIC_TIME_VSYSCALL | |||
106 | config HAVE_SETUP_PER_CPU_AREA | 108 | config HAVE_SETUP_PER_CPU_AREA |
107 | def_bool X86_64 | 109 | def_bool X86_64 |
108 | 110 | ||
109 | config ARCH_SUPPORTS_OPROFILE | ||
110 | bool | ||
111 | default y | ||
112 | |||
113 | select HAVE_KVM | 111 | select HAVE_KVM |
114 | 112 | ||
115 | config ARCH_HIBERNATION_POSSIBLE | 113 | config ARCH_HIBERNATION_POSSIBLE |
@@ -204,8 +202,7 @@ config SMP | |||
204 | Y to "Enhanced Real Time Clock Support", below. The "Advanced Power | 202 | Y to "Enhanced Real Time Clock Support", below. The "Advanced Power |
205 | Management" code will be disabled if you say Y here. | 203 | Management" code will be disabled if you say Y here. |
206 | 204 | ||
207 | See also the <file:Documentation/smp.txt>, | 205 | See also <file:Documentation/i386/IO-APIC.txt>, |
208 | <file:Documentation/i386/IO-APIC.txt>, | ||
209 | <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at | 206 | <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at |
210 | <http://www.tldp.org/docs.html#howto>. | 207 | <http://www.tldp.org/docs.html#howto>. |
211 | 208 | ||
@@ -309,6 +306,7 @@ config X86_RDC321X | |||
309 | select M486 | 306 | select M486 |
310 | select X86_REBOOTFIXUPS | 307 | select X86_REBOOTFIXUPS |
311 | select GENERIC_GPIO | 308 | select GENERIC_GPIO |
309 | select LEDS_CLASS | ||
312 | select LEDS_GPIO | 310 | select LEDS_GPIO |
313 | help | 311 | help |
314 | This option is needed for RDC R-321x system-on-chip, also known | 312 | This option is needed for RDC R-321x system-on-chip, also known |
@@ -1597,8 +1595,6 @@ source "drivers/firmware/Kconfig" | |||
1597 | 1595 | ||
1598 | source "fs/Kconfig" | 1596 | source "fs/Kconfig" |
1599 | 1597 | ||
1600 | source "kernel/Kconfig.instrumentation" | ||
1601 | |||
1602 | source "arch/x86/Kconfig.debug" | 1598 | source "arch/x86/Kconfig.debug" |
1603 | 1599 | ||
1604 | source "security/Kconfig" | 1600 | source "security/Kconfig" |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 8978e98bed5b..364865b1b08d 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -92,7 +92,6 @@ KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) | |||
92 | KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) | 92 | KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) |
93 | 93 | ||
94 | LDFLAGS := -m elf_$(UTS_MACHINE) | 94 | LDFLAGS := -m elf_$(UTS_MACHINE) |
95 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S | ||
96 | 95 | ||
97 | # Speed up the build | 96 | # Speed up the build |
98 | KBUILD_CFLAGS += -pipe | 97 | KBUILD_CFLAGS += -pipe |
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index 349b81a39c40..f88458e83ef0 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile | |||
@@ -26,7 +26,7 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA | |||
26 | #RAMDISK := -DRAMDISK=512 | 26 | #RAMDISK := -DRAMDISK=512 |
27 | 27 | ||
28 | targets := vmlinux.bin setup.bin setup.elf zImage bzImage | 28 | targets := vmlinux.bin setup.bin setup.elf zImage bzImage |
29 | subdir- := compressed | 29 | subdir- := compressed |
30 | 30 | ||
31 | setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o | 31 | setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o |
32 | setup-y += header.o main.o mca.o memory.o pm.o pmjump.o | 32 | setup-y += header.o main.o mca.o memory.o pm.o pmjump.o |
@@ -43,9 +43,17 @@ setup-y += video-vesa.o | |||
43 | setup-y += video-bios.o | 43 | setup-y += video-bios.o |
44 | 44 | ||
45 | targets += $(setup-y) | 45 | targets += $(setup-y) |
46 | hostprogs-y := tools/build | 46 | hostprogs-y := mkcpustr tools/build |
47 | 47 | ||
48 | HOSTCFLAGS_build.o := $(LINUXINCLUDE) | 48 | HOST_EXTRACFLAGS += $(LINUXINCLUDE) |
49 | |||
50 | $(obj)/cpu.o: $(obj)/cpustr.h | ||
51 | |||
52 | quiet_cmd_cpustr = CPUSTR $@ | ||
53 | cmd_cpustr = $(obj)/mkcpustr > $@ | ||
54 | targets += cpustr.h | ||
55 | $(obj)/cpustr.h: $(obj)/mkcpustr FORCE | ||
56 | $(call if_changed,cpustr) | ||
49 | 57 | ||
50 | # --------------------------------------------------------------------------- | 58 | # --------------------------------------------------------------------------- |
51 | 59 | ||
@@ -80,6 +88,7 @@ $(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \ | |||
80 | $(call if_changed,image) | 88 | $(call if_changed,image) |
81 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' | 89 | @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' |
82 | 90 | ||
91 | OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S | ||
83 | $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE | 92 | $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE |
84 | $(call if_changed,objcopy) | 93 | $(call if_changed,objcopy) |
85 | 94 | ||
@@ -90,7 +99,6 @@ $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE | |||
90 | $(call if_changed,ld) | 99 | $(call if_changed,ld) |
91 | 100 | ||
92 | OBJCOPYFLAGS_setup.bin := -O binary | 101 | OBJCOPYFLAGS_setup.bin := -O binary |
93 | |||
94 | $(obj)/setup.bin: $(obj)/setup.elf FORCE | 102 | $(obj)/setup.bin: $(obj)/setup.elf FORCE |
95 | $(call if_changed,objcopy) | 103 | $(call if_changed,objcopy) |
96 | 104 | ||
@@ -98,7 +106,7 @@ $(obj)/compressed/vmlinux: FORCE | |||
98 | $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ | 106 | $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ |
99 | 107 | ||
100 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel | 108 | # Set this if you want to pass append arguments to the zdisk/fdimage/isoimage kernel |
101 | FDARGS = | 109 | FDARGS = |
102 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel | 110 | # Set this if you want an initrd included with the zdisk/fdimage/isoimage kernel |
103 | FDINITRD = | 111 | FDINITRD = |
104 | 112 | ||
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index fe24ceabd909..d2b9f3bb87c0 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -22,6 +22,7 @@ $(obj)/vmlinux: $(src)/vmlinux_$(BITS).lds $(obj)/head_$(BITS).o $(obj)/misc.o $ | |||
22 | $(call if_changed,ld) | 22 | $(call if_changed,ld) |
23 | @: | 23 | @: |
24 | 24 | ||
25 | OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S | ||
25 | $(obj)/vmlinux.bin: vmlinux FORCE | 26 | $(obj)/vmlinux.bin: vmlinux FORCE |
26 | $(call if_changed,objcopy) | 27 | $(call if_changed,objcopy) |
27 | 28 | ||
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 1ccb38a7f0d2..e8657b98c902 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S | |||
@@ -80,8 +80,8 @@ startup_32: | |||
80 | 80 | ||
81 | #ifdef CONFIG_RELOCATABLE | 81 | #ifdef CONFIG_RELOCATABLE |
82 | movl %ebp, %ebx | 82 | movl %ebp, %ebx |
83 | addl $(LARGE_PAGE_SIZE -1), %ebx | 83 | addl $(PMD_PAGE_SIZE -1), %ebx |
84 | andl $LARGE_PAGE_MASK, %ebx | 84 | andl $PMD_PAGE_MASK, %ebx |
85 | #else | 85 | #else |
86 | movl $CONFIG_PHYSICAL_START, %ebx | 86 | movl $CONFIG_PHYSICAL_START, %ebx |
87 | #endif | 87 | #endif |
@@ -220,8 +220,8 @@ ENTRY(startup_64) | |||
220 | /* Start with the delta to where the kernel will run at. */ | 220 | /* Start with the delta to where the kernel will run at. */ |
221 | #ifdef CONFIG_RELOCATABLE | 221 | #ifdef CONFIG_RELOCATABLE |
222 | leaq startup_32(%rip) /* - $startup_32 */, %rbp | 222 | leaq startup_32(%rip) /* - $startup_32 */, %rbp |
223 | addq $(LARGE_PAGE_SIZE - 1), %rbp | 223 | addq $(PMD_PAGE_SIZE - 1), %rbp |
224 | andq $LARGE_PAGE_MASK, %rbp | 224 | andq $PMD_PAGE_MASK, %rbp |
225 | movq %rbp, %rbx | 225 | movq %rbp, %rbx |
226 | #else | 226 | #else |
227 | movq $CONFIG_PHYSICAL_START, %rbp | 227 | movq $CONFIG_PHYSICAL_START, %rbp |
diff --git a/arch/x86/boot/cpu.c b/arch/x86/boot/cpu.c index 2a5c32da5852..00e19edd852c 100644 --- a/arch/x86/boot/cpu.c +++ b/arch/x86/boot/cpu.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* -*- linux-c -*- ------------------------------------------------------- * | 1 | /* -*- linux-c -*- ------------------------------------------------------- * |
2 | * | 2 | * |
3 | * Copyright (C) 1991, 1992 Linus Torvalds | 3 | * Copyright (C) 1991, 1992 Linus Torvalds |
4 | * Copyright 2007 rPath, Inc. - All Rights Reserved | 4 | * Copyright 2007-2008 rPath, Inc. - All Rights Reserved |
5 | * | 5 | * |
6 | * This file is part of the Linux kernel, and is made available under | 6 | * This file is part of the Linux kernel, and is made available under |
7 | * the terms of the GNU General Public License version 2. | 7 | * the terms of the GNU General Public License version 2. |
@@ -9,7 +9,7 @@ | |||
9 | * ----------------------------------------------------------------------- */ | 9 | * ----------------------------------------------------------------------- */ |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * arch/i386/boot/cpu.c | 12 | * arch/x86/boot/cpu.c |
13 | * | 13 | * |
14 | * Check for obligatory CPU features and abort if the features are not | 14 | * Check for obligatory CPU features and abort if the features are not |
15 | * present. | 15 | * present. |
@@ -19,6 +19,8 @@ | |||
19 | #include "bitops.h" | 19 | #include "bitops.h" |
20 | #include <asm/cpufeature.h> | 20 | #include <asm/cpufeature.h> |
21 | 21 | ||
22 | #include "cpustr.h" | ||
23 | |||
22 | static char *cpu_name(int level) | 24 | static char *cpu_name(int level) |
23 | { | 25 | { |
24 | static char buf[6]; | 26 | static char buf[6]; |
@@ -35,6 +37,7 @@ int validate_cpu(void) | |||
35 | { | 37 | { |
36 | u32 *err_flags; | 38 | u32 *err_flags; |
37 | int cpu_level, req_level; | 39 | int cpu_level, req_level; |
40 | const unsigned char *msg_strs; | ||
38 | 41 | ||
39 | check_cpu(&cpu_level, &req_level, &err_flags); | 42 | check_cpu(&cpu_level, &req_level, &err_flags); |
40 | 43 | ||
@@ -51,13 +54,26 @@ int validate_cpu(void) | |||
51 | puts("This kernel requires the following features " | 54 | puts("This kernel requires the following features " |
52 | "not present on the CPU:\n"); | 55 | "not present on the CPU:\n"); |
53 | 56 | ||
57 | msg_strs = (const unsigned char *)x86_cap_strs; | ||
58 | |||
54 | for (i = 0; i < NCAPINTS; i++) { | 59 | for (i = 0; i < NCAPINTS; i++) { |
55 | u32 e = err_flags[i]; | 60 | u32 e = err_flags[i]; |
56 | 61 | ||
57 | for (j = 0; j < 32; j++) { | 62 | for (j = 0; j < 32; j++) { |
58 | if (e & 1) | 63 | int n = (i << 5)+j; |
59 | printf("%d:%d ", i, j); | 64 | if (*msg_strs < n) { |
60 | 65 | /* Skip to the next string */ | |
66 | do { | ||
67 | msg_strs++; | ||
68 | } while (*msg_strs); | ||
69 | msg_strs++; | ||
70 | } | ||
71 | if (e & 1) { | ||
72 | if (*msg_strs == n && msg_strs[1]) | ||
73 | printf("%s ", msg_strs+1); | ||
74 | else | ||
75 | printf("%d:%d ", i, j); | ||
76 | } | ||
61 | e >>= 1; | 77 | e >>= 1; |
62 | } | 78 | } |
63 | } | 79 | } |
diff --git a/arch/x86/boot/mkcpustr.c b/arch/x86/boot/mkcpustr.c new file mode 100644 index 000000000000..bbe76953bae9 --- /dev/null +++ b/arch/x86/boot/mkcpustr.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /* ----------------------------------------------------------------------- * | ||
2 | * | ||
3 | * Copyright 2008 rPath, Inc. - All Rights Reserved | ||
4 | * | ||
5 | * This file is part of the Linux kernel, and is made available under | ||
6 | * the terms of the GNU General Public License version 2 or (at your | ||
7 | * option) any later version; incorporated herein by reference. | ||
8 | * | ||
9 | * ----------------------------------------------------------------------- */ | ||
10 | |||
11 | /* | ||
12 | * This is a host program to preprocess the CPU strings into a | ||
13 | * compact format suitable for the setup code. | ||
14 | */ | ||
15 | |||
16 | #include <stdio.h> | ||
17 | |||
18 | #include "../kernel/cpu/feature_names.c" | ||
19 | |||
20 | #if NCAPFLAGS > 8 | ||
21 | # error "Need to adjust the boot code handling of CPUID strings" | ||
22 | #endif | ||
23 | |||
24 | int main(void) | ||
25 | { | ||
26 | int i; | ||
27 | const char *str; | ||
28 | |||
29 | printf("static const char x86_cap_strs[] = \n"); | ||
30 | |||
31 | for (i = 0; i < NCAPINTS*32; i++) { | ||
32 | str = x86_cap_flags[i]; | ||
33 | |||
34 | if (i == NCAPINTS*32-1) { | ||
35 | /* The last entry must be unconditional; this | ||
36 | also consumes the compiler-added null character */ | ||
37 | if (!str) | ||
38 | str = ""; | ||
39 | printf("\t\"\\x%02x\"\"%s\"\n", i, str); | ||
40 | } else if (str) { | ||
41 | printf("#if REQUIRED_MASK%d & (1 << %d)\n" | ||
42 | "\t\"\\x%02x\"\"%s\\0\"\n" | ||
43 | "#endif\n", | ||
44 | i >> 5, i & 31, i, str); | ||
45 | } | ||
46 | } | ||
47 | printf("\t;\n"); | ||
48 | return 0; | ||
49 | } | ||
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 6f813009d44b..21dc1a061bf1 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -37,7 +37,8 @@ obj-$(CONFIG_X86_MSR) += msr.o | |||
37 | obj-$(CONFIG_X86_CPUID) += cpuid.o | 37 | obj-$(CONFIG_X86_CPUID) += cpuid.o |
38 | obj-$(CONFIG_MICROCODE) += microcode.o | 38 | obj-$(CONFIG_MICROCODE) += microcode.o |
39 | obj-$(CONFIG_PCI) += early-quirks.o | 39 | obj-$(CONFIG_PCI) += early-quirks.o |
40 | obj-$(CONFIG_APM) += apm_32.o | 40 | apm-y := apm_32.o |
41 | obj-$(CONFIG_APM) += apm.o | ||
41 | obj-$(CONFIG_X86_SMP) += smp_$(BITS).o smpboot_$(BITS).o tsc_sync.o | 42 | obj-$(CONFIG_X86_SMP) += smp_$(BITS).o smpboot_$(BITS).o tsc_sync.o |
42 | obj-$(CONFIG_X86_32_SMP) += smpcommon_32.o | 43 | obj-$(CONFIG_X86_32_SMP) += smpcommon_32.o |
43 | obj-$(CONFIG_X86_64_SMP) += smp_64.o smpboot_64.o tsc_sync.o | 44 | obj-$(CONFIG_X86_64_SMP) += smp_64.o smpboot_64.o tsc_sync.o |
@@ -74,7 +75,8 @@ ifdef CONFIG_INPUT_PCSPKR | |||
74 | obj-y += pcspeaker.o | 75 | obj-y += pcspeaker.o |
75 | endif | 76 | endif |
76 | 77 | ||
77 | obj-$(CONFIG_SCx200) += scx200_32.o | 78 | obj-$(CONFIG_SCx200) += scx200.o |
79 | scx200-y += scx200_32.o | ||
78 | 80 | ||
79 | ### | 81 | ### |
80 | # 64 bit specific files | 82 | # 64 bit specific files |
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index cfdb2f3bd763..a0c4d7c5dbd7 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := intel_cacheinfo.o addon_cpuid_features.o | 5 | obj-y := intel_cacheinfo.o addon_cpuid_features.o |
6 | obj-y += feature_names.o | ||
6 | 7 | ||
7 | obj-$(CONFIG_X86_32) += common.o proc.o bugs.o | 8 | obj-$(CONFIG_X86_32) += common.o proc.o bugs.o |
8 | obj-$(CONFIG_X86_32) += amd.o | 9 | obj-$(CONFIG_X86_32) += amd.o |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index b7b2142b58e7..d9313d9adced 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -623,16 +623,6 @@ cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; | |||
623 | * They will insert themselves into the cpu_devs structure. | 623 | * They will insert themselves into the cpu_devs structure. |
624 | * Then, when cpu_init() is called, we can just iterate over that array. | 624 | * Then, when cpu_init() is called, we can just iterate over that array. |
625 | */ | 625 | */ |
626 | |||
627 | extern int intel_cpu_init(void); | ||
628 | extern int cyrix_init_cpu(void); | ||
629 | extern int nsc_init_cpu(void); | ||
630 | extern int amd_init_cpu(void); | ||
631 | extern int centaur_init_cpu(void); | ||
632 | extern int transmeta_init_cpu(void); | ||
633 | extern int nexgen_init_cpu(void); | ||
634 | extern int umc_init_cpu(void); | ||
635 | |||
636 | void __init early_cpu_init(void) | 626 | void __init early_cpu_init(void) |
637 | { | 627 | { |
638 | intel_cpu_init(); | 628 | intel_cpu_init(); |
diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h index ad6527a5beb1..e0b38c33d842 100644 --- a/arch/x86/kernel/cpu/cpu.h +++ b/arch/x86/kernel/cpu/cpu.h | |||
@@ -27,3 +27,12 @@ extern void display_cacheinfo(struct cpuinfo_x86 *c); | |||
27 | extern void early_init_intel(struct cpuinfo_x86 *c); | 27 | extern void early_init_intel(struct cpuinfo_x86 *c); |
28 | extern void early_init_amd(struct cpuinfo_x86 *c); | 28 | extern void early_init_amd(struct cpuinfo_x86 *c); |
29 | 29 | ||
30 | /* Specific CPU type init functions */ | ||
31 | int intel_cpu_init(void); | ||
32 | int amd_init_cpu(void); | ||
33 | int cyrix_init_cpu(void); | ||
34 | int nsc_init_cpu(void); | ||
35 | int centaur_init_cpu(void); | ||
36 | int transmeta_init_cpu(void); | ||
37 | int nexgen_init_cpu(void); | ||
38 | int umc_init_cpu(void); | ||
diff --git a/arch/x86/kernel/cpu/feature_names.c b/arch/x86/kernel/cpu/feature_names.c new file mode 100644 index 000000000000..ee975ac6bbcb --- /dev/null +++ b/arch/x86/kernel/cpu/feature_names.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Strings for the various x86 capability flags. | ||
3 | * | ||
4 | * This file must not contain any executable code. | ||
5 | */ | ||
6 | |||
7 | #include "asm/cpufeature.h" | ||
8 | |||
9 | /* | ||
10 | * These flag bits must match the definitions in <asm/cpufeature.h>. | ||
11 | * NULL means this bit is undefined or reserved; either way it doesn't | ||
12 | * have meaning as far as Linux is concerned. Note that it's important | ||
13 | * to realize there is a difference between this table and CPUID -- if | ||
14 | * applications want to get the raw CPUID data, they should access | ||
15 | * /dev/cpu/<cpu_nr>/cpuid instead. | ||
16 | */ | ||
17 | const char * const x86_cap_flags[NCAPINTS*32] = { | ||
18 | /* Intel-defined */ | ||
19 | "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", | ||
20 | "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", | ||
21 | "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", | ||
22 | "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", | ||
23 | |||
24 | /* AMD-defined */ | ||
25 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
26 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | ||
27 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, | ||
28 | NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", | ||
29 | "3dnowext", "3dnow", | ||
30 | |||
31 | /* Transmeta-defined */ | ||
32 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | ||
33 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
34 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
35 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
36 | |||
37 | /* Other (Linux-defined) */ | ||
38 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", | ||
39 | NULL, NULL, NULL, NULL, | ||
40 | "constant_tsc", "up", NULL, "arch_perfmon", | ||
41 | "pebs", "bts", NULL, NULL, | ||
42 | "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
43 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
44 | |||
45 | /* Intel-defined (#2) */ | ||
46 | "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", | ||
47 | "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, | ||
48 | NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", | ||
49 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
50 | |||
51 | /* VIA/Cyrix/Centaur-defined */ | ||
52 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", | ||
53 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, | ||
54 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
55 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
56 | |||
57 | /* AMD-defined (#2) */ | ||
58 | "lahf_lm", "cmp_legacy", "svm", "extapic", | ||
59 | "cr8_legacy", "abm", "sse4a", "misalignsse", | ||
60 | "3dnowprefetch", "osvw", "ibs", "sse5", | ||
61 | "skinit", "wdt", NULL, NULL, | ||
62 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
63 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
64 | |||
65 | /* Auxiliary (Linux-defined) */ | ||
66 | "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
67 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
68 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
69 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
70 | }; | ||
71 | |||
72 | const char *const x86_power_flags[32] = { | ||
73 | "ts", /* temperature sensor */ | ||
74 | "fid", /* frequency id control */ | ||
75 | "vid", /* voltage id control */ | ||
76 | "ttp", /* thermal trip */ | ||
77 | "tm", | ||
78 | "stc", | ||
79 | "100mhzsteps", | ||
80 | "hwpstate", | ||
81 | "", /* tsc invariant mapped to constant_tsc */ | ||
82 | /* nothing */ | ||
83 | }; | ||
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index d1c372b018db..fae31ce747bd 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
14 | #include <asm/ptrace.h> | 14 | #include <asm/ptrace.h> |
15 | #include <asm/ds.h> | 15 | #include <asm/ds.h> |
16 | #include <asm/bugs.h> | ||
16 | 17 | ||
17 | #include "cpu.h" | 18 | #include "cpu.h" |
18 | 19 | ||
diff --git a/arch/x86/kernel/cpu/mtrr/cyrix.c b/arch/x86/kernel/cpu/mtrr/cyrix.c index 8e139c70f888..ff14c320040c 100644 --- a/arch/x86/kernel/cpu/mtrr/cyrix.c +++ b/arch/x86/kernel/cpu/mtrr/cyrix.c | |||
@@ -7,8 +7,6 @@ | |||
7 | #include <asm/processor-flags.h> | 7 | #include <asm/processor-flags.h> |
8 | #include "mtrr.h" | 8 | #include "mtrr.h" |
9 | 9 | ||
10 | int arr3_protected; | ||
11 | |||
12 | static void | 10 | static void |
13 | cyrix_get_arr(unsigned int reg, unsigned long *base, | 11 | cyrix_get_arr(unsigned int reg, unsigned long *base, |
14 | unsigned long *size, mtrr_type * type) | 12 | unsigned long *size, mtrr_type * type) |
@@ -99,8 +97,6 @@ cyrix_get_free_region(unsigned long base, unsigned long size, int replace_reg) | |||
99 | case 4: | 97 | case 4: |
100 | return replace_reg; | 98 | return replace_reg; |
101 | case 3: | 99 | case 3: |
102 | if (arr3_protected) | ||
103 | break; | ||
104 | case 2: | 100 | case 2: |
105 | case 1: | 101 | case 1: |
106 | case 0: | 102 | case 0: |
@@ -115,8 +111,6 @@ cyrix_get_free_region(unsigned long base, unsigned long size, int replace_reg) | |||
115 | } else { | 111 | } else { |
116 | for (i = 0; i < 7; i++) { | 112 | for (i = 0; i < 7; i++) { |
117 | cyrix_get_arr(i, &lbase, &lsize, <ype); | 113 | cyrix_get_arr(i, &lbase, &lsize, <ype); |
118 | if ((i == 3) && arr3_protected) | ||
119 | continue; | ||
120 | if (lsize == 0) | 114 | if (lsize == 0) |
121 | return i; | 115 | return i; |
122 | } | 116 | } |
@@ -260,107 +254,6 @@ static void cyrix_set_all(void) | |||
260 | post_set(); | 254 | post_set(); |
261 | } | 255 | } |
262 | 256 | ||
263 | #if 0 | ||
264 | /* | ||
265 | * On Cyrix 6x86(MX) and M II the ARR3 is special: it has connection | ||
266 | * with the SMM (System Management Mode) mode. So we need the following: | ||
267 | * Check whether SMI_LOCK (CCR3 bit 0) is set | ||
268 | * if it is set, write a warning message: ARR3 cannot be changed! | ||
269 | * (it cannot be changed until the next processor reset) | ||
270 | * if it is reset, then we can change it, set all the needed bits: | ||
271 | * - disable access to SMM memory through ARR3 range (CCR1 bit 7 reset) | ||
272 | * - disable access to SMM memory (CCR1 bit 2 reset) | ||
273 | * - disable SMM mode (CCR1 bit 1 reset) | ||
274 | * - disable write protection of ARR3 (CCR6 bit 1 reset) | ||
275 | * - (maybe) disable ARR3 | ||
276 | * Just to be sure, we enable ARR usage by the processor (CCR5 bit 5 set) | ||
277 | */ | ||
278 | static void __init | ||
279 | cyrix_arr_init(void) | ||
280 | { | ||
281 | struct set_mtrr_context ctxt; | ||
282 | unsigned char ccr[7]; | ||
283 | int ccrc[7] = { 0, 0, 0, 0, 0, 0, 0 }; | ||
284 | #ifdef CONFIG_SMP | ||
285 | int i; | ||
286 | #endif | ||
287 | |||
288 | /* flush cache and enable MAPEN */ | ||
289 | set_mtrr_prepare_save(&ctxt); | ||
290 | set_mtrr_cache_disable(&ctxt); | ||
291 | |||
292 | /* Save all CCRs locally */ | ||
293 | ccr[0] = getCx86(CX86_CCR0); | ||
294 | ccr[1] = getCx86(CX86_CCR1); | ||
295 | ccr[2] = getCx86(CX86_CCR2); | ||
296 | ccr[3] = ctxt.ccr3; | ||
297 | ccr[4] = getCx86(CX86_CCR4); | ||
298 | ccr[5] = getCx86(CX86_CCR5); | ||
299 | ccr[6] = getCx86(CX86_CCR6); | ||
300 | |||
301 | if (ccr[3] & 1) { | ||
302 | ccrc[3] = 1; | ||
303 | arr3_protected = 1; | ||
304 | } else { | ||
305 | /* Disable SMM mode (bit 1), access to SMM memory (bit 2) and | ||
306 | * access to SMM memory through ARR3 (bit 7). | ||
307 | */ | ||
308 | if (ccr[1] & 0x80) { | ||
309 | ccr[1] &= 0x7f; | ||
310 | ccrc[1] |= 0x80; | ||
311 | } | ||
312 | if (ccr[1] & 0x04) { | ||
313 | ccr[1] &= 0xfb; | ||
314 | ccrc[1] |= 0x04; | ||
315 | } | ||
316 | if (ccr[1] & 0x02) { | ||
317 | ccr[1] &= 0xfd; | ||
318 | ccrc[1] |= 0x02; | ||
319 | } | ||
320 | arr3_protected = 0; | ||
321 | if (ccr[6] & 0x02) { | ||
322 | ccr[6] &= 0xfd; | ||
323 | ccrc[6] = 1; /* Disable write protection of ARR3 */ | ||
324 | setCx86(CX86_CCR6, ccr[6]); | ||
325 | } | ||
326 | /* Disable ARR3. This is safe now that we disabled SMM. */ | ||
327 | /* cyrix_set_arr_up (3, 0, 0, 0, FALSE); */ | ||
328 | } | ||
329 | /* If we changed CCR1 in memory, change it in the processor, too. */ | ||
330 | if (ccrc[1]) | ||
331 | setCx86(CX86_CCR1, ccr[1]); | ||
332 | |||
333 | /* Enable ARR usage by the processor */ | ||
334 | if (!(ccr[5] & 0x20)) { | ||
335 | ccr[5] |= 0x20; | ||
336 | ccrc[5] = 1; | ||
337 | setCx86(CX86_CCR5, ccr[5]); | ||
338 | } | ||
339 | #ifdef CONFIG_SMP | ||
340 | for (i = 0; i < 7; i++) | ||
341 | ccr_state[i] = ccr[i]; | ||
342 | for (i = 0; i < 8; i++) | ||
343 | cyrix_get_arr(i, | ||
344 | &arr_state[i].base, &arr_state[i].size, | ||
345 | &arr_state[i].type); | ||
346 | #endif | ||
347 | |||
348 | set_mtrr_done(&ctxt); /* flush cache and disable MAPEN */ | ||
349 | |||
350 | if (ccrc[5]) | ||
351 | printk(KERN_INFO "mtrr: ARR usage was not enabled, enabled manually\n"); | ||
352 | if (ccrc[3]) | ||
353 | printk(KERN_INFO "mtrr: ARR3 cannot be changed\n"); | ||
354 | /* | ||
355 | if ( ccrc[1] & 0x80) printk ("mtrr: SMM memory access through ARR3 disabled\n"); | ||
356 | if ( ccrc[1] & 0x04) printk ("mtrr: SMM memory access disabled\n"); | ||
357 | if ( ccrc[1] & 0x02) printk ("mtrr: SMM mode disabled\n"); | ||
358 | */ | ||
359 | if (ccrc[6]) | ||
360 | printk(KERN_INFO "mtrr: ARR3 was write protected, unprotected\n"); | ||
361 | } | ||
362 | #endif | ||
363 | |||
364 | static struct mtrr_ops cyrix_mtrr_ops = { | 257 | static struct mtrr_ops cyrix_mtrr_ops = { |
365 | .vendor = X86_VENDOR_CYRIX, | 258 | .vendor = X86_VENDOR_CYRIX, |
366 | // .init = cyrix_arr_init, | 259 | // .init = cyrix_arr_init, |
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c index 715919582657..1e27b69a7a0e 100644 --- a/arch/x86/kernel/cpu/mtrr/main.c +++ b/arch/x86/kernel/cpu/mtrr/main.c | |||
@@ -59,12 +59,6 @@ struct mtrr_ops * mtrr_if = NULL; | |||
59 | static void set_mtrr(unsigned int reg, unsigned long base, | 59 | static void set_mtrr(unsigned int reg, unsigned long base, |
60 | unsigned long size, mtrr_type type); | 60 | unsigned long size, mtrr_type type); |
61 | 61 | ||
62 | #ifndef CONFIG_X86_64 | ||
63 | extern int arr3_protected; | ||
64 | #else | ||
65 | #define arr3_protected 0 | ||
66 | #endif | ||
67 | |||
68 | void set_mtrr_ops(struct mtrr_ops * ops) | 62 | void set_mtrr_ops(struct mtrr_ops * ops) |
69 | { | 63 | { |
70 | if (ops->vendor && ops->vendor < X86_VENDOR_NUM) | 64 | if (ops->vendor && ops->vendor < X86_VENDOR_NUM) |
@@ -513,12 +507,6 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size) | |||
513 | printk(KERN_WARNING "mtrr: register: %d too big\n", reg); | 507 | printk(KERN_WARNING "mtrr: register: %d too big\n", reg); |
514 | goto out; | 508 | goto out; |
515 | } | 509 | } |
516 | if (is_cpu(CYRIX) && !use_intel()) { | ||
517 | if ((reg == 3) && arr3_protected) { | ||
518 | printk(KERN_WARNING "mtrr: ARR3 cannot be changed\n"); | ||
519 | goto out; | ||
520 | } | ||
521 | } | ||
522 | mtrr_if->get(reg, &lbase, &lsize, <ype); | 510 | mtrr_if->get(reg, &lbase, &lsize, <ype); |
523 | if (lsize < 1) { | 511 | if (lsize < 1) { |
524 | printk(KERN_WARNING "mtrr: MTRR %d not used\n", reg); | 512 | printk(KERN_WARNING "mtrr: MTRR %d not used\n", reg); |
@@ -566,10 +554,6 @@ EXPORT_SYMBOL(mtrr_del); | |||
566 | * These should be called implicitly, but we can't yet until all the initcall | 554 | * These should be called implicitly, but we can't yet until all the initcall |
567 | * stuff is done... | 555 | * stuff is done... |
568 | */ | 556 | */ |
569 | extern void amd_init_mtrr(void); | ||
570 | extern void cyrix_init_mtrr(void); | ||
571 | extern void centaur_init_mtrr(void); | ||
572 | |||
573 | static void __init init_ifs(void) | 557 | static void __init init_ifs(void) |
574 | { | 558 | { |
575 | #ifndef CONFIG_X86_64 | 559 | #ifndef CONFIG_X86_64 |
diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.h b/arch/x86/kernel/cpu/mtrr/mtrr.h index fb74a2c20814..2cc77eb6fea3 100644 --- a/arch/x86/kernel/cpu/mtrr/mtrr.h +++ b/arch/x86/kernel/cpu/mtrr/mtrr.h | |||
@@ -97,3 +97,7 @@ void mtrr_state_warn(void); | |||
97 | const char *mtrr_attrib_to_str(int x); | 97 | const char *mtrr_attrib_to_str(int x); |
98 | void mtrr_wrmsr(unsigned, unsigned, unsigned); | 98 | void mtrr_wrmsr(unsigned, unsigned, unsigned); |
99 | 99 | ||
100 | /* CPU specific mtrr init functions */ | ||
101 | int amd_init_mtrr(void); | ||
102 | int cyrix_init_mtrr(void); | ||
103 | int centaur_init_mtrr(void); | ||
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index 028213260148..af11d31dce0a 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c | |||
@@ -10,80 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | static int show_cpuinfo(struct seq_file *m, void *v) | 11 | static int show_cpuinfo(struct seq_file *m, void *v) |
12 | { | 12 | { |
13 | /* | ||
14 | * These flag bits must match the definitions in <asm/cpufeature.h>. | ||
15 | * NULL means this bit is undefined or reserved; either way it doesn't | ||
16 | * have meaning as far as Linux is concerned. Note that it's important | ||
17 | * to realize there is a difference between this table and CPUID -- if | ||
18 | * applications want to get the raw CPUID data, they should access | ||
19 | * /dev/cpu/<cpu_nr>/cpuid instead. | ||
20 | */ | ||
21 | static const char * const x86_cap_flags[] = { | ||
22 | /* Intel-defined */ | ||
23 | "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", | ||
24 | "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", | ||
25 | "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", | ||
26 | "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", | ||
27 | |||
28 | /* AMD-defined */ | ||
29 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
30 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | ||
31 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, | ||
32 | NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", | ||
33 | "3dnowext", "3dnow", | ||
34 | |||
35 | /* Transmeta-defined */ | ||
36 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | ||
37 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
38 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
39 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
40 | |||
41 | /* Other (Linux-defined) */ | ||
42 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", | ||
43 | NULL, NULL, NULL, NULL, | ||
44 | "constant_tsc", "up", NULL, "arch_perfmon", | ||
45 | "pebs", "bts", NULL, "sync_rdtsc", | ||
46 | "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
47 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
48 | |||
49 | /* Intel-defined (#2) */ | ||
50 | "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", | ||
51 | "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, | ||
52 | NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", | ||
53 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
54 | |||
55 | /* VIA/Cyrix/Centaur-defined */ | ||
56 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", | ||
57 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, | ||
58 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
59 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
60 | |||
61 | /* AMD-defined (#2) */ | ||
62 | "lahf_lm", "cmp_legacy", "svm", "extapic", | ||
63 | "cr8_legacy", "abm", "sse4a", "misalignsse", | ||
64 | "3dnowprefetch", "osvw", "ibs", "sse5", | ||
65 | "skinit", "wdt", NULL, NULL, | ||
66 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
67 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
68 | |||
69 | /* Auxiliary (Linux-defined) */ | ||
70 | "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
71 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
72 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
73 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
74 | }; | ||
75 | static const char * const x86_power_flags[] = { | ||
76 | "ts", /* temperature sensor */ | ||
77 | "fid", /* frequency id control */ | ||
78 | "vid", /* voltage id control */ | ||
79 | "ttp", /* thermal trip */ | ||
80 | "tm", | ||
81 | "stc", | ||
82 | "100mhzsteps", | ||
83 | "hwpstate", | ||
84 | "", /* constant_tsc - moved to flags */ | ||
85 | /* nothing */ | ||
86 | }; | ||
87 | struct cpuinfo_x86 *c = v; | 13 | struct cpuinfo_x86 *c = v; |
88 | int i, n = 0; | 14 | int i, n = 0; |
89 | int fpu_exception; | 15 | int fpu_exception; |
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index a63432d800f9..288e7a6598ac 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* ----------------------------------------------------------------------- * | 1 | /* ----------------------------------------------------------------------- * |
2 | * | 2 | * |
3 | * Copyright 2000 H. Peter Anvin - All Rights Reserved | 3 | * Copyright 2000-2008 H. Peter Anvin - All Rights Reserved |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -17,6 +17,10 @@ | |||
17 | * and then read in chunks of 16 bytes. A larger size means multiple | 17 | * and then read in chunks of 16 bytes. A larger size means multiple |
18 | * reads of consecutive levels. | 18 | * reads of consecutive levels. |
19 | * | 19 | * |
20 | * The lower 32 bits of the file position is used as the incoming %eax, | ||
21 | * and the upper 32 bits of the file position as the incoming %ecx, | ||
22 | * the latter intended for "counting" eax levels like eax=4. | ||
23 | * | ||
20 | * This driver uses /dev/cpu/%d/cpuid where %d is the minor number, and on | 24 | * This driver uses /dev/cpu/%d/cpuid where %d is the minor number, and on |
21 | * an SMP box will direct the access to CPU %d. | 25 | * an SMP box will direct the access to CPU %d. |
22 | */ | 26 | */ |
@@ -43,35 +47,24 @@ | |||
43 | 47 | ||
44 | static struct class *cpuid_class; | 48 | static struct class *cpuid_class; |
45 | 49 | ||
46 | struct cpuid_command { | 50 | struct cpuid_regs { |
47 | u32 reg; | 51 | u32 eax, ebx, ecx, edx; |
48 | u32 *data; | ||
49 | }; | 52 | }; |
50 | 53 | ||
51 | static void cpuid_smp_cpuid(void *cmd_block) | 54 | static void cpuid_smp_cpuid(void *cmd_block) |
52 | { | 55 | { |
53 | struct cpuid_command *cmd = cmd_block; | 56 | struct cpuid_regs *cmd = (struct cpuid_regs *)cmd_block; |
54 | |||
55 | cpuid(cmd->reg, &cmd->data[0], &cmd->data[1], &cmd->data[2], | ||
56 | &cmd->data[3]); | ||
57 | } | ||
58 | |||
59 | static inline void do_cpuid(int cpu, u32 reg, u32 * data) | ||
60 | { | ||
61 | struct cpuid_command cmd; | ||
62 | |||
63 | cmd.reg = reg; | ||
64 | cmd.data = data; | ||
65 | 57 | ||
66 | smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1, 1); | 58 | cpuid_count(cmd->eax, cmd->ecx, |
59 | &cmd->eax, &cmd->ebx, &cmd->ecx, &cmd->edx); | ||
67 | } | 60 | } |
68 | 61 | ||
69 | static loff_t cpuid_seek(struct file *file, loff_t offset, int orig) | 62 | static loff_t cpuid_seek(struct file *file, loff_t offset, int orig) |
70 | { | 63 | { |
71 | loff_t ret; | 64 | loff_t ret; |
65 | struct inode *inode = file->f_mapping->host; | ||
72 | 66 | ||
73 | lock_kernel(); | 67 | mutex_lock(&inode->i_mutex); |
74 | |||
75 | switch (orig) { | 68 | switch (orig) { |
76 | case 0: | 69 | case 0: |
77 | file->f_pos = offset; | 70 | file->f_pos = offset; |
@@ -84,8 +77,7 @@ static loff_t cpuid_seek(struct file *file, loff_t offset, int orig) | |||
84 | default: | 77 | default: |
85 | ret = -EINVAL; | 78 | ret = -EINVAL; |
86 | } | 79 | } |
87 | 80 | mutex_unlock(&inode->i_mutex); | |
88 | unlock_kernel(); | ||
89 | return ret; | 81 | return ret; |
90 | } | 82 | } |
91 | 83 | ||
@@ -93,19 +85,21 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, | |||
93 | size_t count, loff_t * ppos) | 85 | size_t count, loff_t * ppos) |
94 | { | 86 | { |
95 | char __user *tmp = buf; | 87 | char __user *tmp = buf; |
96 | u32 data[4]; | 88 | struct cpuid_regs cmd; |
97 | u32 reg = *ppos; | ||
98 | int cpu = iminor(file->f_path.dentry->d_inode); | 89 | int cpu = iminor(file->f_path.dentry->d_inode); |
90 | u64 pos = *ppos; | ||
99 | 91 | ||
100 | if (count % 16) | 92 | if (count % 16) |
101 | return -EINVAL; /* Invalid chunk size */ | 93 | return -EINVAL; /* Invalid chunk size */ |
102 | 94 | ||
103 | for (; count; count -= 16) { | 95 | for (; count; count -= 16) { |
104 | do_cpuid(cpu, reg, data); | 96 | cmd.eax = pos; |
105 | if (copy_to_user(tmp, &data, 16)) | 97 | cmd.ecx = pos >> 32; |
98 | smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1, 1); | ||
99 | if (copy_to_user(tmp, &cmd, 16)) | ||
106 | return -EFAULT; | 100 | return -EFAULT; |
107 | tmp += 16; | 101 | tmp += 16; |
108 | *ppos = reg++; | 102 | *ppos = ++pos; |
109 | } | 103 | } |
110 | 104 | ||
111 | return tmp - buf; | 105 | return tmp - buf; |
@@ -193,7 +187,7 @@ static int __init cpuid_init(void) | |||
193 | } | 187 | } |
194 | for_each_online_cpu(i) { | 188 | for_each_online_cpu(i) { |
195 | err = cpuid_device_create(i); | 189 | err = cpuid_device_create(i); |
196 | if (err != 0) | 190 | if (err != 0) |
197 | goto out_class; | 191 | goto out_class; |
198 | } | 192 | } |
199 | register_hotcpu_notifier(&cpuid_class_cpu_notifier); | 193 | register_hotcpu_notifier(&cpuid_class_cpu_notifier); |
@@ -208,7 +202,7 @@ out_class: | |||
208 | } | 202 | } |
209 | class_destroy(cpuid_class); | 203 | class_destroy(cpuid_class); |
210 | out_chrdev: | 204 | out_chrdev: |
211 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); | 205 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); |
212 | out: | 206 | out: |
213 | return err; | 207 | return err; |
214 | } | 208 | } |
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c index 1411324a625c..32dd62b36ff7 100644 --- a/arch/x86/kernel/efi.c +++ b/arch/x86/kernel/efi.c | |||
@@ -379,11 +379,9 @@ void __init efi_init(void) | |||
379 | #endif | 379 | #endif |
380 | } | 380 | } |
381 | 381 | ||
382 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) | ||
383 | static void __init runtime_code_page_mkexec(void) | 382 | static void __init runtime_code_page_mkexec(void) |
384 | { | 383 | { |
385 | efi_memory_desc_t *md; | 384 | efi_memory_desc_t *md; |
386 | unsigned long end; | ||
387 | void *p; | 385 | void *p; |
388 | 386 | ||
389 | if (!(__supported_pte_mask & _PAGE_NX)) | 387 | if (!(__supported_pte_mask & _PAGE_NX)) |
@@ -392,18 +390,13 @@ static void __init runtime_code_page_mkexec(void) | |||
392 | /* Make EFI runtime service code area executable */ | 390 | /* Make EFI runtime service code area executable */ |
393 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | 391 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { |
394 | md = p; | 392 | md = p; |
395 | end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT); | 393 | |
396 | if (md->type == EFI_RUNTIME_SERVICES_CODE && | 394 | if (md->type != EFI_RUNTIME_SERVICES_CODE) |
397 | (end >> PAGE_SHIFT) <= max_pfn_mapped) { | 395 | continue; |
398 | set_memory_x(md->virt_addr, md->num_pages); | 396 | |
399 | set_memory_uc(md->virt_addr, md->num_pages); | 397 | set_memory_x(md->virt_addr, md->num_pages << EFI_PAGE_SHIFT); |
400 | } | ||
401 | } | 398 | } |
402 | __flush_tlb_all(); | ||
403 | } | 399 | } |
404 | #else | ||
405 | static inline void __init runtime_code_page_mkexec(void) { } | ||
406 | #endif | ||
407 | 400 | ||
408 | /* | 401 | /* |
409 | * This function will switch the EFI runtime services to virtual mode. | 402 | * This function will switch the EFI runtime services to virtual mode. |
@@ -417,30 +410,40 @@ void __init efi_enter_virtual_mode(void) | |||
417 | { | 410 | { |
418 | efi_memory_desc_t *md; | 411 | efi_memory_desc_t *md; |
419 | efi_status_t status; | 412 | efi_status_t status; |
420 | unsigned long end; | 413 | unsigned long size; |
421 | void *p; | 414 | u64 end, systab; |
415 | void *p, *va; | ||
422 | 416 | ||
423 | efi.systab = NULL; | 417 | efi.systab = NULL; |
424 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | 418 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { |
425 | md = p; | 419 | md = p; |
426 | if (!(md->attribute & EFI_MEMORY_RUNTIME)) | 420 | if (!(md->attribute & EFI_MEMORY_RUNTIME)) |
427 | continue; | 421 | continue; |
428 | end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT); | 422 | |
429 | if ((md->attribute & EFI_MEMORY_WB) && | 423 | size = md->num_pages << EFI_PAGE_SHIFT; |
430 | ((end >> PAGE_SHIFT) <= max_pfn_mapped)) | 424 | end = md->phys_addr + size; |
431 | md->virt_addr = (unsigned long)__va(md->phys_addr); | 425 | |
426 | if ((end >> PAGE_SHIFT) <= max_pfn_mapped) | ||
427 | va = __va(md->phys_addr); | ||
432 | else | 428 | else |
433 | md->virt_addr = (unsigned long) | 429 | va = efi_ioremap(md->phys_addr, size); |
434 | efi_ioremap(md->phys_addr, | 430 | |
435 | md->num_pages << EFI_PAGE_SHIFT); | 431 | if (md->attribute & EFI_MEMORY_WB) |
436 | if (!md->virt_addr) | 432 | set_memory_uc(md->virt_addr, size); |
433 | |||
434 | md->virt_addr = (u64) (unsigned long) va; | ||
435 | |||
436 | if (!va) { | ||
437 | printk(KERN_ERR PFX "ioremap of 0x%llX failed!\n", | 437 | printk(KERN_ERR PFX "ioremap of 0x%llX failed!\n", |
438 | (unsigned long long)md->phys_addr); | 438 | (unsigned long long)md->phys_addr); |
439 | if ((md->phys_addr <= (unsigned long)efi_phys.systab) && | 439 | continue; |
440 | ((unsigned long)efi_phys.systab < end)) | 440 | } |
441 | efi.systab = (efi_system_table_t *)(unsigned long) | 441 | |
442 | (md->virt_addr - md->phys_addr + | 442 | systab = (u64) (unsigned long) efi_phys.systab; |
443 | (unsigned long)efi_phys.systab); | 443 | if (md->phys_addr <= systab && systab < end) { |
444 | systab += md->virt_addr - md->phys_addr; | ||
445 | efi.systab = (efi_system_table_t *) (unsigned long) systab; | ||
446 | } | ||
444 | } | 447 | } |
445 | 448 | ||
446 | BUG_ON(!efi.systab); | 449 | BUG_ON(!efi.systab); |
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c index 674f2379480f..09d5c2330934 100644 --- a/arch/x86/kernel/efi_64.c +++ b/arch/x86/kernel/efi_64.c | |||
@@ -54,10 +54,10 @@ static void __init early_mapping_set_exec(unsigned long start, | |||
54 | else | 54 | else |
55 | set_pte(kpte, __pte((pte_val(*kpte) | _PAGE_NX) & \ | 55 | set_pte(kpte, __pte((pte_val(*kpte) | _PAGE_NX) & \ |
56 | __supported_pte_mask)); | 56 | __supported_pte_mask)); |
57 | if (level == 4) | 57 | if (level == PG_LEVEL_4K) |
58 | start = (start + PMD_SIZE) & PMD_MASK; | ||
59 | else | ||
60 | start = (start + PAGE_SIZE) & PAGE_MASK; | 58 | start = (start + PAGE_SIZE) & PAGE_MASK; |
59 | else | ||
60 | start = (start + PMD_SIZE) & PMD_MASK; | ||
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
@@ -109,23 +109,23 @@ void __init efi_reserve_bootmem(void) | |||
109 | memmap.nr_map * memmap.desc_size); | 109 | memmap.nr_map * memmap.desc_size); |
110 | } | 110 | } |
111 | 111 | ||
112 | void __iomem * __init efi_ioremap(unsigned long offset, | 112 | void __iomem * __init efi_ioremap(unsigned long phys_addr, unsigned long size) |
113 | unsigned long size) | ||
114 | { | 113 | { |
115 | static unsigned pages_mapped; | 114 | static unsigned pages_mapped; |
116 | unsigned long last_addr; | ||
117 | unsigned i, pages; | 115 | unsigned i, pages; |
118 | 116 | ||
119 | last_addr = offset + size - 1; | 117 | /* phys_addr and size must be page aligned */ |
120 | offset &= PAGE_MASK; | 118 | if ((phys_addr & ~PAGE_MASK) || (size & ~PAGE_MASK)) |
121 | pages = (PAGE_ALIGN(last_addr) - offset) >> PAGE_SHIFT; | 119 | return NULL; |
120 | |||
121 | pages = size >> PAGE_SHIFT; | ||
122 | if (pages_mapped + pages > MAX_EFI_IO_PAGES) | 122 | if (pages_mapped + pages > MAX_EFI_IO_PAGES) |
123 | return NULL; | 123 | return NULL; |
124 | 124 | ||
125 | for (i = 0; i < pages; i++) { | 125 | for (i = 0; i < pages; i++) { |
126 | __set_fixmap(FIX_EFI_IO_MAP_FIRST_PAGE - pages_mapped, | 126 | __set_fixmap(FIX_EFI_IO_MAP_FIRST_PAGE - pages_mapped, |
127 | offset, PAGE_KERNEL_EXEC_NOCACHE); | 127 | phys_addr, PAGE_KERNEL); |
128 | offset += PAGE_SIZE; | 128 | phys_addr += PAGE_SIZE; |
129 | pages_mapped++; | 129 | pages_mapped++; |
130 | } | 130 | } |
131 | 131 | ||
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index 1d5a7a361200..4f283ad215ec 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S | |||
@@ -63,7 +63,7 @@ startup_64: | |||
63 | 63 | ||
64 | /* Is the address not 2M aligned? */ | 64 | /* Is the address not 2M aligned? */ |
65 | movq %rbp, %rax | 65 | movq %rbp, %rax |
66 | andl $~LARGE_PAGE_MASK, %eax | 66 | andl $~PMD_PAGE_MASK, %eax |
67 | testl %eax, %eax | 67 | testl %eax, %eax |
68 | jnz bad_address | 68 | jnz bad_address |
69 | 69 | ||
@@ -88,7 +88,7 @@ startup_64: | |||
88 | 88 | ||
89 | /* Add an Identity mapping if I am above 1G */ | 89 | /* Add an Identity mapping if I am above 1G */ |
90 | leaq _text(%rip), %rdi | 90 | leaq _text(%rip), %rdi |
91 | andq $LARGE_PAGE_MASK, %rdi | 91 | andq $PMD_PAGE_MASK, %rdi |
92 | 92 | ||
93 | movq %rdi, %rax | 93 | movq %rdi, %rax |
94 | shrq $PUD_SHIFT, %rax | 94 | shrq $PUD_SHIFT, %rax |
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c index 8a7660c8394a..0224c3637c73 100644 --- a/arch/x86/kernel/ldt.c +++ b/arch/x86/kernel/ldt.c | |||
@@ -35,7 +35,8 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) | |||
35 | if (mincount <= pc->size) | 35 | if (mincount <= pc->size) |
36 | return 0; | 36 | return 0; |
37 | oldsize = pc->size; | 37 | oldsize = pc->size; |
38 | mincount = (mincount + 511) & (~511); | 38 | mincount = (mincount + (PAGE_SIZE / LDT_ENTRY_SIZE - 1)) & |
39 | (~(PAGE_SIZE / LDT_ENTRY_SIZE - 1)); | ||
39 | if (mincount * LDT_ENTRY_SIZE > PAGE_SIZE) | 40 | if (mincount * LDT_ENTRY_SIZE > PAGE_SIZE) |
40 | newldt = vmalloc(mincount * LDT_ENTRY_SIZE); | 41 | newldt = vmalloc(mincount * LDT_ENTRY_SIZE); |
41 | else | 42 | else |
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index bd82850e6519..af51ea8400b2 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* ----------------------------------------------------------------------- * | 1 | /* ----------------------------------------------------------------------- * |
2 | * | 2 | * |
3 | * Copyright 2000 H. Peter Anvin - All Rights Reserved | 3 | * Copyright 2000-2008 H. Peter Anvin - All Rights Reserved |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -45,9 +45,10 @@ static struct class *msr_class; | |||
45 | 45 | ||
46 | static loff_t msr_seek(struct file *file, loff_t offset, int orig) | 46 | static loff_t msr_seek(struct file *file, loff_t offset, int orig) |
47 | { | 47 | { |
48 | loff_t ret = -EINVAL; | 48 | loff_t ret; |
49 | struct inode *inode = file->f_mapping->host; | ||
49 | 50 | ||
50 | lock_kernel(); | 51 | mutex_lock(&inode->i_mutex); |
51 | switch (orig) { | 52 | switch (orig) { |
52 | case 0: | 53 | case 0: |
53 | file->f_pos = offset; | 54 | file->f_pos = offset; |
@@ -56,8 +57,11 @@ static loff_t msr_seek(struct file *file, loff_t offset, int orig) | |||
56 | case 1: | 57 | case 1: |
57 | file->f_pos += offset; | 58 | file->f_pos += offset; |
58 | ret = file->f_pos; | 59 | ret = file->f_pos; |
60 | break; | ||
61 | default: | ||
62 | ret = -EINVAL; | ||
59 | } | 63 | } |
60 | unlock_kernel(); | 64 | mutex_unlock(&inode->i_mutex); |
61 | return ret; | 65 | return ret; |
62 | } | 66 | } |
63 | 67 | ||
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index 4d5cc7181982..845cbecd68e9 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
@@ -501,7 +501,7 @@ static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size) | |||
501 | } | 501 | } |
502 | 502 | ||
503 | a = aper + iommu_size; | 503 | a = aper + iommu_size; |
504 | iommu_size -= round_up(a, LARGE_PAGE_SIZE) - a; | 504 | iommu_size -= round_up(a, PMD_PAGE_SIZE) - a; |
505 | 505 | ||
506 | if (iommu_size < 64*1024*1024) { | 506 | if (iommu_size < 64*1024*1024) { |
507 | printk(KERN_WARNING | 507 | printk(KERN_WARNING |
@@ -731,7 +731,8 @@ void __init gart_iommu_init(void) | |||
731 | * the backing memory. The GART address is only used by PCI | 731 | * the backing memory. The GART address is only used by PCI |
732 | * devices. | 732 | * devices. |
733 | */ | 733 | */ |
734 | clear_kernel_mapping((unsigned long)__va(iommu_bus_base), iommu_size); | 734 | set_memory_np((unsigned long)__va(iommu_bus_base), |
735 | iommu_size >> PAGE_SHIFT); | ||
735 | 736 | ||
736 | /* | 737 | /* |
737 | * Try to workaround a bug (thanks to BenH) | 738 | * Try to workaround a bug (thanks to BenH) |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 968371ab223a..dabdbeff1f77 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -251,7 +251,7 @@ void cpu_idle_wait(void) | |||
251 | * because it has nothing to do. | 251 | * because it has nothing to do. |
252 | * Give all the remaining CPUS a kick. | 252 | * Give all the remaining CPUS a kick. |
253 | */ | 253 | */ |
254 | smp_call_function_mask(map, do_nothing, 0, 0); | 254 | smp_call_function_mask(map, do_nothing, NULL, 0); |
255 | } while (!cpus_empty(map)); | 255 | } while (!cpus_empty(map)); |
256 | 256 | ||
257 | set_cpus_allowed(current, tmp); | 257 | set_cpus_allowed(current, tmp); |
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 18df70c534b9..c8939dfddfba 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
@@ -1068,82 +1068,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1068 | struct cpuinfo_x86 *c = v; | 1068 | struct cpuinfo_x86 *c = v; |
1069 | int cpu = 0, i; | 1069 | int cpu = 0, i; |
1070 | 1070 | ||
1071 | /* | ||
1072 | * These flag bits must match the definitions in <asm/cpufeature.h>. | ||
1073 | * NULL means this bit is undefined or reserved; either way it doesn't | ||
1074 | * have meaning as far as Linux is concerned. Note that it's important | ||
1075 | * to realize there is a difference between this table and CPUID -- if | ||
1076 | * applications want to get the raw CPUID data, they should access | ||
1077 | * /dev/cpu/<cpu_nr>/cpuid instead. | ||
1078 | */ | ||
1079 | static const char *const x86_cap_flags[] = { | ||
1080 | /* Intel-defined */ | ||
1081 | "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", | ||
1082 | "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", | ||
1083 | "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", | ||
1084 | "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", | ||
1085 | |||
1086 | /* AMD-defined */ | ||
1087 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1088 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | ||
1089 | NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL, | ||
1090 | NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", | ||
1091 | "3dnowext", "3dnow", | ||
1092 | |||
1093 | /* Transmeta-defined */ | ||
1094 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | ||
1095 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1096 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1097 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1098 | |||
1099 | /* Other (Linux-defined) */ | ||
1100 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", | ||
1101 | NULL, NULL, NULL, NULL, | ||
1102 | "constant_tsc", "up", NULL, "arch_perfmon", | ||
1103 | "pebs", "bts", NULL, "sync_rdtsc", | ||
1104 | "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1105 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1106 | |||
1107 | /* Intel-defined (#2) */ | ||
1108 | "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", | ||
1109 | "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, | ||
1110 | NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", | ||
1111 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1112 | |||
1113 | /* VIA/Cyrix/Centaur-defined */ | ||
1114 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", | ||
1115 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, | ||
1116 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1117 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1118 | |||
1119 | /* AMD-defined (#2) */ | ||
1120 | "lahf_lm", "cmp_legacy", "svm", "extapic", | ||
1121 | "cr8_legacy", "abm", "sse4a", "misalignsse", | ||
1122 | "3dnowprefetch", "osvw", "ibs", "sse5", | ||
1123 | "skinit", "wdt", NULL, NULL, | ||
1124 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1125 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1126 | |||
1127 | /* Auxiliary (Linux-defined) */ | ||
1128 | "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1129 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1130 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1131 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
1132 | }; | ||
1133 | static const char *const x86_power_flags[] = { | ||
1134 | "ts", /* temperature sensor */ | ||
1135 | "fid", /* frequency id control */ | ||
1136 | "vid", /* voltage id control */ | ||
1137 | "ttp", /* thermal trip */ | ||
1138 | "tm", | ||
1139 | "stc", | ||
1140 | "100mhzsteps", | ||
1141 | "hwpstate", | ||
1142 | "", /* tsc invariant mapped to constant_tsc */ | ||
1143 | /* nothing */ | ||
1144 | }; | ||
1145 | |||
1146 | |||
1147 | #ifdef CONFIG_SMP | 1071 | #ifdef CONFIG_SMP |
1148 | cpu = c->cpu_index; | 1072 | cpu = c->cpu_index; |
1149 | #endif | 1073 | #endif |
diff --git a/arch/x86/kernel/test_nx.c b/arch/x86/kernel/test_nx.c index ae0ef2e304c7..36c100c323aa 100644 --- a/arch/x86/kernel/test_nx.c +++ b/arch/x86/kernel/test_nx.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/sort.h> | 13 | #include <linux/sort.h> |
14 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
15 | #include <asm/asm.h> | ||
15 | 16 | ||
16 | extern int rodata_test_data; | 17 | extern int rodata_test_data; |
17 | 18 | ||
@@ -89,16 +90,7 @@ static noinline int test_address(void *address) | |||
89 | "2: mov %[zero], %[rslt]\n" | 90 | "2: mov %[zero], %[rslt]\n" |
90 | " ret\n" | 91 | " ret\n" |
91 | ".previous\n" | 92 | ".previous\n" |
92 | ".section __ex_table,\"a\"\n" | 93 | _ASM_EXTABLE(0b,2b) |
93 | " .align 8\n" | ||
94 | #ifdef CONFIG_X86_32 | ||
95 | " .long 0b\n" | ||
96 | " .long 2b\n" | ||
97 | #else | ||
98 | " .quad 0b\n" | ||
99 | " .quad 2b\n" | ||
100 | #endif | ||
101 | ".previous\n" | ||
102 | : [rslt] "=r" (result) | 94 | : [rslt] "=r" (result) |
103 | : [fake_code] "r" (address), [zero] "r" (0UL), "0" (result) | 95 | : [fake_code] "r" (address), [zero] "r" (0UL), "0" (result) |
104 | ); | 96 | ); |
diff --git a/arch/x86/kernel/trampoline_32.S b/arch/x86/kernel/trampoline_32.S index 9bcc1c6aca3d..64580679861e 100644 --- a/arch/x86/kernel/trampoline_32.S +++ b/arch/x86/kernel/trampoline_32.S | |||
@@ -11,12 +11,7 @@ | |||
11 | * trampoline page to make our stack and everything else | 11 | * trampoline page to make our stack and everything else |
12 | * is a mystery. | 12 | * is a mystery. |
13 | * | 13 | * |
14 | * In fact we don't actually need a stack so we don't | 14 | * We jump into arch/x86/kernel/head_32.S. |
15 | * set one up. | ||
16 | * | ||
17 | * We jump into the boot/compressed/head.S code. So you'd | ||
18 | * better be running a compressed kernel image or you | ||
19 | * won't get very far. | ||
20 | * | 15 | * |
21 | * On entry to trampoline_data, the processor is in real mode | 16 | * On entry to trampoline_data, the processor is in real mode |
22 | * with 16-bit addressing and 16-bit data. CS has some value | 17 | * with 16-bit addressing and 16-bit data. CS has some value |
diff --git a/arch/x86/kernel/trampoline_64.S b/arch/x86/kernel/trampoline_64.S index e30b67c6a9f5..4aedd0bcee4c 100644 --- a/arch/x86/kernel/trampoline_64.S +++ b/arch/x86/kernel/trampoline_64.S | |||
@@ -10,9 +10,6 @@ | |||
10 | * trampoline page to make our stack and everything else | 10 | * trampoline page to make our stack and everything else |
11 | * is a mystery. | 11 | * is a mystery. |
12 | * | 12 | * |
13 | * In fact we don't actually need a stack so we don't | ||
14 | * set one up. | ||
15 | * | ||
16 | * On entry to trampoline_data, the processor is in real mode | 13 | * On entry to trampoline_data, the processor is in real mode |
17 | * with 16-bit addressing and 16-bit data. CS has some value | 14 | * with 16-bit addressing and 16-bit data. CS has some value |
18 | * and IP is zero. Thus, data addresses need to be absolute | 15 | * and IP is zero. Thus, data addresses need to be absolute |
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c index 4525bc2c2e19..12affe1f9bce 100644 --- a/arch/x86/kernel/vmi_32.c +++ b/arch/x86/kernel/vmi_32.c | |||
@@ -220,21 +220,21 @@ static void vmi_set_tr(void) | |||
220 | static void vmi_write_idt_entry(gate_desc *dt, int entry, const gate_desc *g) | 220 | static void vmi_write_idt_entry(gate_desc *dt, int entry, const gate_desc *g) |
221 | { | 221 | { |
222 | u32 *idt_entry = (u32 *)g; | 222 | u32 *idt_entry = (u32 *)g; |
223 | vmi_ops.write_idt_entry(dt, entry, idt_entry[0], idt_entry[2]); | 223 | vmi_ops.write_idt_entry(dt, entry, idt_entry[0], idt_entry[1]); |
224 | } | 224 | } |
225 | 225 | ||
226 | static void vmi_write_gdt_entry(struct desc_struct *dt, int entry, | 226 | static void vmi_write_gdt_entry(struct desc_struct *dt, int entry, |
227 | const void *desc, int type) | 227 | const void *desc, int type) |
228 | { | 228 | { |
229 | u32 *gdt_entry = (u32 *)desc; | 229 | u32 *gdt_entry = (u32 *)desc; |
230 | vmi_ops.write_gdt_entry(dt, entry, gdt_entry[0], gdt_entry[2]); | 230 | vmi_ops.write_gdt_entry(dt, entry, gdt_entry[0], gdt_entry[1]); |
231 | } | 231 | } |
232 | 232 | ||
233 | static void vmi_write_ldt_entry(struct desc_struct *dt, int entry, | 233 | static void vmi_write_ldt_entry(struct desc_struct *dt, int entry, |
234 | const void *desc) | 234 | const void *desc) |
235 | { | 235 | { |
236 | u32 *ldt_entry = (u32 *)desc; | 236 | u32 *ldt_entry = (u32 *)desc; |
237 | vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[2]); | 237 | vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[1]); |
238 | } | 238 | } |
239 | 239 | ||
240 | static void vmi_load_sp0(struct tss_struct *tss, | 240 | static void vmi_load_sp0(struct tss_struct *tss, |
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig index c83e1c9b5129..41962e793c0f 100644 --- a/arch/x86/kvm/Kconfig +++ b/arch/x86/kvm/Kconfig | |||
@@ -53,5 +53,6 @@ config KVM_AMD | |||
53 | # OK, it's a little counter-intuitive to do this, but it puts it neatly under | 53 | # OK, it's a little counter-intuitive to do this, but it puts it neatly under |
54 | # the virtualization menu. | 54 | # the virtualization menu. |
55 | source drivers/lguest/Kconfig | 55 | source drivers/lguest/Kconfig |
56 | source drivers/virtio/Kconfig | ||
56 | 57 | ||
57 | endif # VIRTUALIZATION | 58 | endif # VIRTUALIZATION |
diff --git a/arch/x86/lib/bitops_32.c b/arch/x86/lib/bitops_32.c index afd0045595d4..b65440459859 100644 --- a/arch/x86/lib/bitops_32.c +++ b/arch/x86/lib/bitops_32.c | |||
@@ -2,7 +2,7 @@ | |||
2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * find_next_bit - find the first set bit in a memory region | 5 | * find_next_bit - find the next set bit in a memory region |
6 | * @addr: The address to base the search on | 6 | * @addr: The address to base the search on |
7 | * @offset: The bitnumber to start searching at | 7 | * @offset: The bitnumber to start searching at |
8 | * @size: The maximum size to search | 8 | * @size: The maximum size to search |
diff --git a/arch/x86/lib/bitops_64.c b/arch/x86/lib/bitops_64.c index 95b6d9639fba..0e8f491e6ccc 100644 --- a/arch/x86/lib/bitops_64.c +++ b/arch/x86/lib/bitops_64.c | |||
@@ -58,7 +58,7 @@ long find_first_zero_bit(const unsigned long * addr, unsigned long size) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * find_next_zero_bit - find the first zero bit in a memory region | 61 | * find_next_zero_bit - find the next zero bit in a memory region |
62 | * @addr: The address to base the search on | 62 | * @addr: The address to base the search on |
63 | * @offset: The bitnumber to start searching at | 63 | * @offset: The bitnumber to start searching at |
64 | * @size: The maximum size to search | 64 | * @size: The maximum size to search |
diff --git a/arch/x86/lib/mmx_32.c b/arch/x86/lib/mmx_32.c index 28084d2e8dd4..cc9b4a4450f3 100644 --- a/arch/x86/lib/mmx_32.c +++ b/arch/x86/lib/mmx_32.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/hardirq.h> | 4 | #include <linux/hardirq.h> |
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
6 | 6 | ||
7 | #include <asm/asm.h> | ||
7 | #include <asm/i387.h> | 8 | #include <asm/i387.h> |
8 | 9 | ||
9 | 10 | ||
@@ -50,10 +51,7 @@ void *_mmx_memcpy(void *to, const void *from, size_t len) | |||
50 | "3: movw $0x1AEB, 1b\n" /* jmp on 26 bytes */ | 51 | "3: movw $0x1AEB, 1b\n" /* jmp on 26 bytes */ |
51 | " jmp 2b\n" | 52 | " jmp 2b\n" |
52 | ".previous\n" | 53 | ".previous\n" |
53 | ".section __ex_table,\"a\"\n" | 54 | _ASM_EXTABLE(1b,3b) |
54 | " .align 4\n" | ||
55 | " .long 1b, 3b\n" | ||
56 | ".previous" | ||
57 | : : "r" (from) ); | 55 | : : "r" (from) ); |
58 | 56 | ||
59 | 57 | ||
@@ -81,10 +79,7 @@ void *_mmx_memcpy(void *to, const void *from, size_t len) | |||
81 | "3: movw $0x05EB, 1b\n" /* jmp on 5 bytes */ | 79 | "3: movw $0x05EB, 1b\n" /* jmp on 5 bytes */ |
82 | " jmp 2b\n" | 80 | " jmp 2b\n" |
83 | ".previous\n" | 81 | ".previous\n" |
84 | ".section __ex_table,\"a\"\n" | 82 | _ASM_EXTABLE(1b,3b) |
85 | " .align 4\n" | ||
86 | " .long 1b, 3b\n" | ||
87 | ".previous" | ||
88 | : : "r" (from), "r" (to) : "memory"); | 83 | : : "r" (from), "r" (to) : "memory"); |
89 | from+=64; | 84 | from+=64; |
90 | to+=64; | 85 | to+=64; |
@@ -181,10 +176,7 @@ static void fast_copy_page(void *to, void *from) | |||
181 | "3: movw $0x1AEB, 1b\n" /* jmp on 26 bytes */ | 176 | "3: movw $0x1AEB, 1b\n" /* jmp on 26 bytes */ |
182 | " jmp 2b\n" | 177 | " jmp 2b\n" |
183 | ".previous\n" | 178 | ".previous\n" |
184 | ".section __ex_table,\"a\"\n" | 179 | _ASM_EXTABLE(1b,3b) |
185 | " .align 4\n" | ||
186 | " .long 1b, 3b\n" | ||
187 | ".previous" | ||
188 | : : "r" (from) ); | 180 | : : "r" (from) ); |
189 | 181 | ||
190 | for(i=0; i<(4096-320)/64; i++) | 182 | for(i=0; i<(4096-320)/64; i++) |
@@ -211,10 +203,7 @@ static void fast_copy_page(void *to, void *from) | |||
211 | "3: movw $0x05EB, 1b\n" /* jmp on 5 bytes */ | 203 | "3: movw $0x05EB, 1b\n" /* jmp on 5 bytes */ |
212 | " jmp 2b\n" | 204 | " jmp 2b\n" |
213 | ".previous\n" | 205 | ".previous\n" |
214 | ".section __ex_table,\"a\"\n" | 206 | _ASM_EXTABLE(1b,3b) |
215 | " .align 4\n" | ||
216 | " .long 1b, 3b\n" | ||
217 | ".previous" | ||
218 | : : "r" (from), "r" (to) : "memory"); | 207 | : : "r" (from), "r" (to) : "memory"); |
219 | from+=64; | 208 | from+=64; |
220 | to+=64; | 209 | to+=64; |
@@ -311,10 +300,7 @@ static void fast_copy_page(void *to, void *from) | |||
311 | "3: movw $0x1AEB, 1b\n" /* jmp on 26 bytes */ | 300 | "3: movw $0x1AEB, 1b\n" /* jmp on 26 bytes */ |
312 | " jmp 2b\n" | 301 | " jmp 2b\n" |
313 | ".previous\n" | 302 | ".previous\n" |
314 | ".section __ex_table,\"a\"\n" | 303 | _ASM_EXTABLE(1b,3b) |
315 | " .align 4\n" | ||
316 | " .long 1b, 3b\n" | ||
317 | ".previous" | ||
318 | : : "r" (from) ); | 304 | : : "r" (from) ); |
319 | 305 | ||
320 | for(i=0; i<4096/64; i++) | 306 | for(i=0; i<4096/64; i++) |
@@ -341,10 +327,7 @@ static void fast_copy_page(void *to, void *from) | |||
341 | "3: movw $0x05EB, 1b\n" /* jmp on 5 bytes */ | 327 | "3: movw $0x05EB, 1b\n" /* jmp on 5 bytes */ |
342 | " jmp 2b\n" | 328 | " jmp 2b\n" |
343 | ".previous\n" | 329 | ".previous\n" |
344 | ".section __ex_table,\"a\"\n" | 330 | _ASM_EXTABLE(1b,3b) |
345 | " .align 4\n" | ||
346 | " .long 1b, 3b\n" | ||
347 | ".previous" | ||
348 | : : "r" (from), "r" (to) : "memory"); | 331 | : : "r" (from), "r" (to) : "memory"); |
349 | from+=64; | 332 | from+=64; |
350 | to+=64; | 333 | to+=64; |
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c index 9c4ffd5bedb2..e849b9998b0e 100644 --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c | |||
@@ -48,10 +48,7 @@ do { \ | |||
48 | "3: movl %5,%0\n" \ | 48 | "3: movl %5,%0\n" \ |
49 | " jmp 2b\n" \ | 49 | " jmp 2b\n" \ |
50 | ".previous\n" \ | 50 | ".previous\n" \ |
51 | ".section __ex_table,\"a\"\n" \ | 51 | _ASM_EXTABLE(0b,3b) \ |
52 | " .align 4\n" \ | ||
53 | " .long 0b,3b\n" \ | ||
54 | ".previous" \ | ||
55 | : "=d"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1), \ | 52 | : "=d"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1), \ |
56 | "=&D" (__d2) \ | 53 | "=&D" (__d2) \ |
57 | : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ | 54 | : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ |
@@ -132,11 +129,8 @@ do { \ | |||
132 | "3: lea 0(%2,%0,4),%0\n" \ | 129 | "3: lea 0(%2,%0,4),%0\n" \ |
133 | " jmp 2b\n" \ | 130 | " jmp 2b\n" \ |
134 | ".previous\n" \ | 131 | ".previous\n" \ |
135 | ".section __ex_table,\"a\"\n" \ | 132 | _ASM_EXTABLE(0b,3b) \ |
136 | " .align 4\n" \ | 133 | _ASM_EXTABLE(1b,2b) \ |
137 | " .long 0b,3b\n" \ | ||
138 | " .long 1b,2b\n" \ | ||
139 | ".previous" \ | ||
140 | : "=&c"(size), "=&D" (__d0) \ | 134 | : "=&c"(size), "=&D" (__d0) \ |
141 | : "r"(size & 3), "0"(size / 4), "1"(addr), "a"(0)); \ | 135 | : "r"(size & 3), "0"(size / 4), "1"(addr), "a"(0)); \ |
142 | } while (0) | 136 | } while (0) |
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c index 893d43f838cc..0c89d1bb0287 100644 --- a/arch/x86/lib/usercopy_64.c +++ b/arch/x86/lib/usercopy_64.c | |||
@@ -31,10 +31,7 @@ do { \ | |||
31 | "3: movq %5,%0\n" \ | 31 | "3: movq %5,%0\n" \ |
32 | " jmp 2b\n" \ | 32 | " jmp 2b\n" \ |
33 | ".previous\n" \ | 33 | ".previous\n" \ |
34 | ".section __ex_table,\"a\"\n" \ | 34 | _ASM_EXTABLE(0b,3b) \ |
35 | " .align 8\n" \ | ||
36 | " .quad 0b,3b\n" \ | ||
37 | ".previous" \ | ||
38 | : "=r"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1), \ | 35 | : "=r"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1), \ |
39 | "=&D" (__d2) \ | 36 | "=&D" (__d2) \ |
40 | : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ | 37 | : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \ |
@@ -87,11 +84,8 @@ unsigned long __clear_user(void __user *addr, unsigned long size) | |||
87 | "3: lea 0(%[size1],%[size8],8),%[size8]\n" | 84 | "3: lea 0(%[size1],%[size8],8),%[size8]\n" |
88 | " jmp 2b\n" | 85 | " jmp 2b\n" |
89 | ".previous\n" | 86 | ".previous\n" |
90 | ".section __ex_table,\"a\"\n" | 87 | _ASM_EXTABLE(0b,3b) |
91 | " .align 8\n" | 88 | _ASM_EXTABLE(1b,2b) |
92 | " .quad 0b,3b\n" | ||
93 | " .quad 1b,2b\n" | ||
94 | ".previous" | ||
95 | : [size8] "=c"(size), [dst] "=&D" (__d0) | 89 | : [size8] "=c"(size), [dst] "=&D" (__d0) |
96 | : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr), | 90 | : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr), |
97 | [zero] "r" (0UL), [eight] "r" (8UL)); | 91 | [zero] "r" (0UL), [eight] "r" (8UL)); |
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index e4440d0abf81..ad8b9733d6b3 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -240,7 +240,8 @@ void dump_pagetable(unsigned long address) | |||
240 | pud = pud_offset(pgd, address); | 240 | pud = pud_offset(pgd, address); |
241 | if (bad_address(pud)) goto bad; | 241 | if (bad_address(pud)) goto bad; |
242 | printk("PUD %lx ", pud_val(*pud)); | 242 | printk("PUD %lx ", pud_val(*pud)); |
243 | if (!pud_present(*pud)) goto ret; | 243 | if (!pud_present(*pud) || pud_large(*pud)) |
244 | goto ret; | ||
244 | 245 | ||
245 | pmd = pmd_offset(pud, address); | 246 | pmd = pmd_offset(pud, address); |
246 | if (bad_address(pmd)) goto bad; | 247 | if (bad_address(pmd)) goto bad; |
@@ -508,6 +509,10 @@ static int vmalloc_fault(unsigned long address) | |||
508 | pmd_t *pmd, *pmd_ref; | 509 | pmd_t *pmd, *pmd_ref; |
509 | pte_t *pte, *pte_ref; | 510 | pte_t *pte, *pte_ref; |
510 | 511 | ||
512 | /* Make sure we are in vmalloc area */ | ||
513 | if (!(address >= VMALLOC_START && address < VMALLOC_END)) | ||
514 | return -1; | ||
515 | |||
511 | /* Copy kernel mappings over when needed. This can also | 516 | /* Copy kernel mappings over when needed. This can also |
512 | happen within a race in page table update. In the later | 517 | happen within a race in page table update. In the later |
513 | case just flush. */ | 518 | case just flush. */ |
@@ -603,6 +608,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
603 | */ | 608 | */ |
604 | #ifdef CONFIG_X86_32 | 609 | #ifdef CONFIG_X86_32 |
605 | if (unlikely(address >= TASK_SIZE)) { | 610 | if (unlikely(address >= TASK_SIZE)) { |
611 | #else | ||
612 | if (unlikely(address >= TASK_SIZE64)) { | ||
613 | #endif | ||
606 | if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) && | 614 | if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) && |
607 | vmalloc_fault(address) >= 0) | 615 | vmalloc_fault(address) >= 0) |
608 | return; | 616 | return; |
@@ -618,6 +626,8 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
618 | goto bad_area_nosemaphore; | 626 | goto bad_area_nosemaphore; |
619 | } | 627 | } |
620 | 628 | ||
629 | |||
630 | #ifdef CONFIG_X86_32 | ||
621 | /* It's safe to allow irq's after cr2 has been saved and the vmalloc | 631 | /* It's safe to allow irq's after cr2 has been saved and the vmalloc |
622 | fault has been handled. */ | 632 | fault has been handled. */ |
623 | if (regs->flags & (X86_EFLAGS_IF|VM_MASK)) | 633 | if (regs->flags & (X86_EFLAGS_IF|VM_MASK)) |
@@ -630,28 +640,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
630 | if (in_atomic() || !mm) | 640 | if (in_atomic() || !mm) |
631 | goto bad_area_nosemaphore; | 641 | goto bad_area_nosemaphore; |
632 | #else /* CONFIG_X86_64 */ | 642 | #else /* CONFIG_X86_64 */ |
633 | if (unlikely(address >= TASK_SIZE64)) { | ||
634 | /* | ||
635 | * Don't check for the module range here: its PML4 | ||
636 | * is always initialized because it's shared with the main | ||
637 | * kernel text. Only vmalloc may need PML4 syncups. | ||
638 | */ | ||
639 | if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) && | ||
640 | ((address >= VMALLOC_START && address < VMALLOC_END))) { | ||
641 | if (vmalloc_fault(address) >= 0) | ||
642 | return; | ||
643 | } | ||
644 | |||
645 | /* Can handle a stale RO->RW TLB */ | ||
646 | if (spurious_fault(address, error_code)) | ||
647 | return; | ||
648 | |||
649 | /* | ||
650 | * Don't take the mm semaphore here. If we fixup a prefetch | ||
651 | * fault we could otherwise deadlock. | ||
652 | */ | ||
653 | goto bad_area_nosemaphore; | ||
654 | } | ||
655 | if (likely(regs->flags & X86_EFLAGS_IF)) | 643 | if (likely(regs->flags & X86_EFLAGS_IF)) |
656 | local_irq_enable(); | 644 | local_irq_enable(); |
657 | 645 | ||
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index f2f36f8dae52..d1bc04006d16 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/initrd.h> | 31 | #include <linux/initrd.h> |
32 | #include <linux/cpumask.h> | 32 | #include <linux/cpumask.h> |
33 | 33 | ||
34 | #include <asm/asm.h> | ||
34 | #include <asm/processor.h> | 35 | #include <asm/processor.h> |
35 | #include <asm/system.h> | 36 | #include <asm/system.h> |
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
@@ -718,10 +719,7 @@ static noinline int do_test_wp_bit(void) | |||
718 | "1: movb %1, %0 \n" | 719 | "1: movb %1, %0 \n" |
719 | " xorl %2, %2 \n" | 720 | " xorl %2, %2 \n" |
720 | "2: \n" | 721 | "2: \n" |
721 | ".section __ex_table, \"a\"\n" | 722 | _ASM_EXTABLE(1b,2b) |
722 | " .align 4 \n" | ||
723 | " .long 1b, 2b \n" | ||
724 | ".previous \n" | ||
725 | :"=m" (*(char *)fix_to_virt(FIX_WP_TEST)), | 723 | :"=m" (*(char *)fix_to_virt(FIX_WP_TEST)), |
726 | "=q" (tmp_reg), | 724 | "=q" (tmp_reg), |
727 | "=r" (flag) | 725 | "=r" (flag) |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index eabcaed76c28..3a98d6f724ab 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -273,7 +273,6 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end) | |||
273 | int i = pmd_index(address); | 273 | int i = pmd_index(address); |
274 | 274 | ||
275 | for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) { | 275 | for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) { |
276 | unsigned long entry; | ||
277 | pmd_t *pmd = pmd_page + pmd_index(address); | 276 | pmd_t *pmd = pmd_page + pmd_index(address); |
278 | 277 | ||
279 | if (address >= end) { | 278 | if (address >= end) { |
@@ -287,9 +286,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end) | |||
287 | if (pmd_val(*pmd)) | 286 | if (pmd_val(*pmd)) |
288 | continue; | 287 | continue; |
289 | 288 | ||
290 | entry = __PAGE_KERNEL_LARGE|_PAGE_GLOBAL|address; | 289 | set_pte((pte_t *)pmd, |
291 | entry &= __supported_pte_mask; | 290 | pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); |
292 | set_pmd(pmd, __pmd(entry)); | ||
293 | } | 291 | } |
294 | } | 292 | } |
295 | 293 | ||
@@ -435,49 +433,6 @@ void __init paging_init(void) | |||
435 | #endif | 433 | #endif |
436 | 434 | ||
437 | /* | 435 | /* |
438 | * Unmap a kernel mapping if it exists. This is useful to avoid | ||
439 | * prefetches from the CPU leading to inconsistent cache lines. | ||
440 | * address and size must be aligned to 2MB boundaries. | ||
441 | * Does nothing when the mapping doesn't exist. | ||
442 | */ | ||
443 | void __init clear_kernel_mapping(unsigned long address, unsigned long size) | ||
444 | { | ||
445 | unsigned long end = address + size; | ||
446 | |||
447 | BUG_ON(address & ~LARGE_PAGE_MASK); | ||
448 | BUG_ON(size & ~LARGE_PAGE_MASK); | ||
449 | |||
450 | for (; address < end; address += LARGE_PAGE_SIZE) { | ||
451 | pgd_t *pgd = pgd_offset_k(address); | ||
452 | pud_t *pud; | ||
453 | pmd_t *pmd; | ||
454 | |||
455 | if (pgd_none(*pgd)) | ||
456 | continue; | ||
457 | |||
458 | pud = pud_offset(pgd, address); | ||
459 | if (pud_none(*pud)) | ||
460 | continue; | ||
461 | |||
462 | pmd = pmd_offset(pud, address); | ||
463 | if (!pmd || pmd_none(*pmd)) | ||
464 | continue; | ||
465 | |||
466 | if (!(pmd_val(*pmd) & _PAGE_PSE)) { | ||
467 | /* | ||
468 | * Could handle this, but it should not happen | ||
469 | * currently: | ||
470 | */ | ||
471 | printk(KERN_ERR "clear_kernel_mapping: " | ||
472 | "mapping has been split. will leak memory\n"); | ||
473 | pmd_ERROR(*pmd); | ||
474 | } | ||
475 | set_pmd(pmd, __pmd(0)); | ||
476 | } | ||
477 | __flush_tlb_all(); | ||
478 | } | ||
479 | |||
480 | /* | ||
481 | * Memory hotplug specific functions | 436 | * Memory hotplug specific functions |
482 | */ | 437 | */ |
483 | void online_page(struct page *page) | 438 | void online_page(struct page *page) |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index c004d94608fd..ee6648fe6b15 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -70,25 +70,12 @@ int page_is_ram(unsigned long pagenr) | |||
70 | * Fix up the linear direct mapping of the kernel to avoid cache attribute | 70 | * Fix up the linear direct mapping of the kernel to avoid cache attribute |
71 | * conflicts. | 71 | * conflicts. |
72 | */ | 72 | */ |
73 | static int ioremap_change_attr(unsigned long paddr, unsigned long size, | 73 | static int ioremap_change_attr(unsigned long vaddr, unsigned long size, |
74 | enum ioremap_mode mode) | 74 | enum ioremap_mode mode) |
75 | { | 75 | { |
76 | unsigned long vaddr = (unsigned long)__va(paddr); | ||
77 | unsigned long nrpages = size >> PAGE_SHIFT; | 76 | unsigned long nrpages = size >> PAGE_SHIFT; |
78 | unsigned int level; | ||
79 | int err; | 77 | int err; |
80 | 78 | ||
81 | /* No change for pages after the last mapping */ | ||
82 | if ((paddr + size - 1) >= (max_pfn_mapped << PAGE_SHIFT)) | ||
83 | return 0; | ||
84 | |||
85 | /* | ||
86 | * If there is no identity map for this address, | ||
87 | * change_page_attr_addr is unnecessary | ||
88 | */ | ||
89 | if (!lookup_address(vaddr, &level)) | ||
90 | return 0; | ||
91 | |||
92 | switch (mode) { | 79 | switch (mode) { |
93 | case IOR_MODE_UNCACHED: | 80 | case IOR_MODE_UNCACHED: |
94 | default: | 81 | default: |
@@ -114,9 +101,8 @@ static int ioremap_change_attr(unsigned long paddr, unsigned long size, | |||
114 | static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, | 101 | static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, |
115 | enum ioremap_mode mode) | 102 | enum ioremap_mode mode) |
116 | { | 103 | { |
117 | void __iomem *addr; | 104 | unsigned long pfn, offset, last_addr, vaddr; |
118 | struct vm_struct *area; | 105 | struct vm_struct *area; |
119 | unsigned long offset, last_addr; | ||
120 | pgprot_t prot; | 106 | pgprot_t prot; |
121 | 107 | ||
122 | /* Don't allow wraparound or zero size */ | 108 | /* Don't allow wraparound or zero size */ |
@@ -133,9 +119,10 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, | |||
133 | /* | 119 | /* |
134 | * Don't allow anybody to remap normal RAM that we're using.. | 120 | * Don't allow anybody to remap normal RAM that we're using.. |
135 | */ | 121 | */ |
136 | for (offset = phys_addr >> PAGE_SHIFT; offset < max_pfn_mapped && | 122 | for (pfn = phys_addr >> PAGE_SHIFT; pfn < max_pfn_mapped && |
137 | (offset << PAGE_SHIFT) < last_addr; offset++) { | 123 | (pfn << PAGE_SHIFT) < last_addr; pfn++) { |
138 | if (page_is_ram(offset)) | 124 | if (page_is_ram(pfn) && pfn_valid(pfn) && |
125 | !PageReserved(pfn_to_page(pfn))) | ||
139 | return NULL; | 126 | return NULL; |
140 | } | 127 | } |
141 | 128 | ||
@@ -163,19 +150,18 @@ static void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, | |||
163 | if (!area) | 150 | if (!area) |
164 | return NULL; | 151 | return NULL; |
165 | area->phys_addr = phys_addr; | 152 | area->phys_addr = phys_addr; |
166 | addr = (void __iomem *) area->addr; | 153 | vaddr = (unsigned long) area->addr; |
167 | if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, | 154 | if (ioremap_page_range(vaddr, vaddr + size, phys_addr, prot)) { |
168 | phys_addr, prot)) { | 155 | remove_vm_area((void *)(vaddr & PAGE_MASK)); |
169 | remove_vm_area((void *)(PAGE_MASK & (unsigned long) addr)); | ||
170 | return NULL; | 156 | return NULL; |
171 | } | 157 | } |
172 | 158 | ||
173 | if (ioremap_change_attr(phys_addr, size, mode) < 0) { | 159 | if (ioremap_change_attr(vaddr, size, mode) < 0) { |
174 | vunmap(addr); | 160 | vunmap(area->addr); |
175 | return NULL; | 161 | return NULL; |
176 | } | 162 | } |
177 | 163 | ||
178 | return (void __iomem *) (offset + (char __iomem *)addr); | 164 | return (void __iomem *) (vaddr + offset); |
179 | } | 165 | } |
180 | 166 | ||
181 | /** | 167 | /** |
@@ -254,9 +240,6 @@ void iounmap(volatile void __iomem *addr) | |||
254 | return; | 240 | return; |
255 | } | 241 | } |
256 | 242 | ||
257 | /* Reset the direct mapping. Can block */ | ||
258 | ioremap_change_attr(p->phys_addr, p->size, IOR_MODE_CACHED); | ||
259 | |||
260 | /* Finally remove it */ | 243 | /* Finally remove it */ |
261 | o = remove_vm_area((void *)addr); | 244 | o = remove_vm_area((void *)addr); |
262 | BUG_ON(p != o || o == NULL); | 245 | BUG_ON(p != o || o == NULL); |
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index a920d09b9194..5a02bf4c91ec 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -202,6 +202,8 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, | |||
202 | if (node_data[nodeid] == NULL) | 202 | if (node_data[nodeid] == NULL) |
203 | return; | 203 | return; |
204 | nodedata_phys = __pa(node_data[nodeid]); | 204 | nodedata_phys = __pa(node_data[nodeid]); |
205 | printk(KERN_INFO " NODE_DATA [%016lx - %016lx]\n", nodedata_phys, | ||
206 | nodedata_phys + pgdat_size - 1); | ||
205 | 207 | ||
206 | memset(NODE_DATA(nodeid), 0, sizeof(pg_data_t)); | 208 | memset(NODE_DATA(nodeid), 0, sizeof(pg_data_t)); |
207 | NODE_DATA(nodeid)->bdata = &plat_node_bdata[nodeid]; | 209 | NODE_DATA(nodeid)->bdata = &plat_node_bdata[nodeid]; |
@@ -225,12 +227,15 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, | |||
225 | return; | 227 | return; |
226 | } | 228 | } |
227 | bootmap_start = __pa(bootmap); | 229 | bootmap_start = __pa(bootmap); |
228 | Dprintk("bootmap start %lu pages %lu\n", bootmap_start, bootmap_pages); | ||
229 | 230 | ||
230 | bootmap_size = init_bootmem_node(NODE_DATA(nodeid), | 231 | bootmap_size = init_bootmem_node(NODE_DATA(nodeid), |
231 | bootmap_start >> PAGE_SHIFT, | 232 | bootmap_start >> PAGE_SHIFT, |
232 | start_pfn, end_pfn); | 233 | start_pfn, end_pfn); |
233 | 234 | ||
235 | printk(KERN_INFO " bootmap [%016lx - %016lx] pages %lx\n", | ||
236 | bootmap_start, bootmap_start + bootmap_size - 1, | ||
237 | bootmap_pages); | ||
238 | |||
234 | free_bootmem_with_active_regions(nodeid, end); | 239 | free_bootmem_with_active_regions(nodeid, end); |
235 | 240 | ||
236 | reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size); | 241 | reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size); |
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c index 7573e786d2f2..398f3a578dde 100644 --- a/arch/x86/mm/pageattr-test.c +++ b/arch/x86/mm/pageattr-test.c | |||
@@ -137,7 +137,8 @@ static __init int exercise_pageattr(void) | |||
137 | 137 | ||
138 | for (k = 0; k < len[i]; k++) { | 138 | for (k = 0; k < len[i]; k++) { |
139 | pte = lookup_address(addr[i] + k*PAGE_SIZE, &level); | 139 | pte = lookup_address(addr[i] + k*PAGE_SIZE, &level); |
140 | if (!pte || pgprot_val(pte_pgprot(*pte)) == 0) { | 140 | if (!pte || pgprot_val(pte_pgprot(*pte)) == 0 || |
141 | !(pte_val(*pte) & _PAGE_PRESENT)) { | ||
141 | addr[i] = 0; | 142 | addr[i] = 0; |
142 | break; | 143 | break; |
143 | } | 144 | } |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index e297bd65e513..bb55a78dcd62 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -16,6 +16,17 @@ | |||
16 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
17 | #include <asm/pgalloc.h> | 17 | #include <asm/pgalloc.h> |
18 | 18 | ||
19 | /* | ||
20 | * The current flushing context - we pass it instead of 5 arguments: | ||
21 | */ | ||
22 | struct cpa_data { | ||
23 | unsigned long vaddr; | ||
24 | pgprot_t mask_set; | ||
25 | pgprot_t mask_clr; | ||
26 | int numpages; | ||
27 | int flushtlb; | ||
28 | }; | ||
29 | |||
19 | static inline int | 30 | static inline int |
20 | within(unsigned long addr, unsigned long start, unsigned long end) | 31 | within(unsigned long addr, unsigned long start, unsigned long end) |
21 | { | 32 | { |
@@ -52,21 +63,23 @@ void clflush_cache_range(void *vaddr, unsigned int size) | |||
52 | 63 | ||
53 | static void __cpa_flush_all(void *arg) | 64 | static void __cpa_flush_all(void *arg) |
54 | { | 65 | { |
66 | unsigned long cache = (unsigned long)arg; | ||
67 | |||
55 | /* | 68 | /* |
56 | * Flush all to work around Errata in early athlons regarding | 69 | * Flush all to work around Errata in early athlons regarding |
57 | * large page flushing. | 70 | * large page flushing. |
58 | */ | 71 | */ |
59 | __flush_tlb_all(); | 72 | __flush_tlb_all(); |
60 | 73 | ||
61 | if (boot_cpu_data.x86_model >= 4) | 74 | if (cache && boot_cpu_data.x86_model >= 4) |
62 | wbinvd(); | 75 | wbinvd(); |
63 | } | 76 | } |
64 | 77 | ||
65 | static void cpa_flush_all(void) | 78 | static void cpa_flush_all(unsigned long cache) |
66 | { | 79 | { |
67 | BUG_ON(irqs_disabled()); | 80 | BUG_ON(irqs_disabled()); |
68 | 81 | ||
69 | on_each_cpu(__cpa_flush_all, NULL, 1, 1); | 82 | on_each_cpu(__cpa_flush_all, (void *) cache, 1, 1); |
70 | } | 83 | } |
71 | 84 | ||
72 | static void __cpa_flush_range(void *arg) | 85 | static void __cpa_flush_range(void *arg) |
@@ -79,7 +92,7 @@ static void __cpa_flush_range(void *arg) | |||
79 | __flush_tlb_all(); | 92 | __flush_tlb_all(); |
80 | } | 93 | } |
81 | 94 | ||
82 | static void cpa_flush_range(unsigned long start, int numpages) | 95 | static void cpa_flush_range(unsigned long start, int numpages, int cache) |
83 | { | 96 | { |
84 | unsigned int i, level; | 97 | unsigned int i, level; |
85 | unsigned long addr; | 98 | unsigned long addr; |
@@ -89,6 +102,9 @@ static void cpa_flush_range(unsigned long start, int numpages) | |||
89 | 102 | ||
90 | on_each_cpu(__cpa_flush_range, NULL, 1, 1); | 103 | on_each_cpu(__cpa_flush_range, NULL, 1, 1); |
91 | 104 | ||
105 | if (!cache) | ||
106 | return; | ||
107 | |||
92 | /* | 108 | /* |
93 | * We only need to flush on one CPU, | 109 | * We only need to flush on one CPU, |
94 | * clflush is a MESI-coherent instruction that | 110 | * clflush is a MESI-coherent instruction that |
@@ -101,11 +117,27 @@ static void cpa_flush_range(unsigned long start, int numpages) | |||
101 | /* | 117 | /* |
102 | * Only flush present addresses: | 118 | * Only flush present addresses: |
103 | */ | 119 | */ |
104 | if (pte && pte_present(*pte)) | 120 | if (pte && (pte_val(*pte) & _PAGE_PRESENT)) |
105 | clflush_cache_range((void *) addr, PAGE_SIZE); | 121 | clflush_cache_range((void *) addr, PAGE_SIZE); |
106 | } | 122 | } |
107 | } | 123 | } |
108 | 124 | ||
125 | #define HIGH_MAP_START __START_KERNEL_map | ||
126 | #define HIGH_MAP_END (__START_KERNEL_map + KERNEL_TEXT_SIZE) | ||
127 | |||
128 | |||
129 | /* | ||
130 | * Converts a virtual address to a X86-64 highmap address | ||
131 | */ | ||
132 | static unsigned long virt_to_highmap(void *address) | ||
133 | { | ||
134 | #ifdef CONFIG_X86_64 | ||
135 | return __pa((unsigned long)address) + HIGH_MAP_START - phys_base; | ||
136 | #else | ||
137 | return (unsigned long)address; | ||
138 | #endif | ||
139 | } | ||
140 | |||
109 | /* | 141 | /* |
110 | * Certain areas of memory on x86 require very specific protection flags, | 142 | * Certain areas of memory on x86 require very specific protection flags, |
111 | * for example the BIOS area or kernel text. Callers don't always get this | 143 | * for example the BIOS area or kernel text. Callers don't always get this |
@@ -129,12 +161,24 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address) | |||
129 | */ | 161 | */ |
130 | if (within(address, (unsigned long)_text, (unsigned long)_etext)) | 162 | if (within(address, (unsigned long)_text, (unsigned long)_etext)) |
131 | pgprot_val(forbidden) |= _PAGE_NX; | 163 | pgprot_val(forbidden) |= _PAGE_NX; |
164 | /* | ||
165 | * Do the same for the x86-64 high kernel mapping | ||
166 | */ | ||
167 | if (within(address, virt_to_highmap(_text), virt_to_highmap(_etext))) | ||
168 | pgprot_val(forbidden) |= _PAGE_NX; | ||
169 | |||
132 | 170 | ||
133 | #ifdef CONFIG_DEBUG_RODATA | 171 | #ifdef CONFIG_DEBUG_RODATA |
134 | /* The .rodata section needs to be read-only */ | 172 | /* The .rodata section needs to be read-only */ |
135 | if (within(address, (unsigned long)__start_rodata, | 173 | if (within(address, (unsigned long)__start_rodata, |
136 | (unsigned long)__end_rodata)) | 174 | (unsigned long)__end_rodata)) |
137 | pgprot_val(forbidden) |= _PAGE_RW; | 175 | pgprot_val(forbidden) |= _PAGE_RW; |
176 | /* | ||
177 | * Do the same for the x86-64 high kernel mapping | ||
178 | */ | ||
179 | if (within(address, virt_to_highmap(__start_rodata), | ||
180 | virt_to_highmap(__end_rodata))) | ||
181 | pgprot_val(forbidden) |= _PAGE_RW; | ||
138 | #endif | 182 | #endif |
139 | 183 | ||
140 | prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden)); | 184 | prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden)); |
@@ -142,6 +186,14 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address) | |||
142 | return prot; | 186 | return prot; |
143 | } | 187 | } |
144 | 188 | ||
189 | /* | ||
190 | * Lookup the page table entry for a virtual address. Return a pointer | ||
191 | * to the entry and the level of the mapping. | ||
192 | * | ||
193 | * Note: We return pud and pmd either when the entry is marked large | ||
194 | * or when the present bit is not set. Otherwise we would return a | ||
195 | * pointer to a nonexisting mapping. | ||
196 | */ | ||
145 | pte_t *lookup_address(unsigned long address, int *level) | 197 | pte_t *lookup_address(unsigned long address, int *level) |
146 | { | 198 | { |
147 | pgd_t *pgd = pgd_offset_k(address); | 199 | pgd_t *pgd = pgd_offset_k(address); |
@@ -152,21 +204,31 @@ pte_t *lookup_address(unsigned long address, int *level) | |||
152 | 204 | ||
153 | if (pgd_none(*pgd)) | 205 | if (pgd_none(*pgd)) |
154 | return NULL; | 206 | return NULL; |
207 | |||
155 | pud = pud_offset(pgd, address); | 208 | pud = pud_offset(pgd, address); |
156 | if (pud_none(*pud)) | 209 | if (pud_none(*pud)) |
157 | return NULL; | 210 | return NULL; |
211 | |||
212 | *level = PG_LEVEL_1G; | ||
213 | if (pud_large(*pud) || !pud_present(*pud)) | ||
214 | return (pte_t *)pud; | ||
215 | |||
158 | pmd = pmd_offset(pud, address); | 216 | pmd = pmd_offset(pud, address); |
159 | if (pmd_none(*pmd)) | 217 | if (pmd_none(*pmd)) |
160 | return NULL; | 218 | return NULL; |
161 | 219 | ||
162 | *level = PG_LEVEL_2M; | 220 | *level = PG_LEVEL_2M; |
163 | if (pmd_large(*pmd)) | 221 | if (pmd_large(*pmd) || !pmd_present(*pmd)) |
164 | return (pte_t *)pmd; | 222 | return (pte_t *)pmd; |
165 | 223 | ||
166 | *level = PG_LEVEL_4K; | 224 | *level = PG_LEVEL_4K; |
225 | |||
167 | return pte_offset_kernel(pmd, address); | 226 | return pte_offset_kernel(pmd, address); |
168 | } | 227 | } |
169 | 228 | ||
229 | /* | ||
230 | * Set the new pmd in all the pgds we know about: | ||
231 | */ | ||
170 | static void __set_pmd_pte(pte_t *kpte, unsigned long address, pte_t pte) | 232 | static void __set_pmd_pte(pte_t *kpte, unsigned long address, pte_t pte) |
171 | { | 233 | { |
172 | /* change init_mm */ | 234 | /* change init_mm */ |
@@ -175,6 +237,7 @@ static void __set_pmd_pte(pte_t *kpte, unsigned long address, pte_t pte) | |||
175 | if (!SHARED_KERNEL_PMD) { | 237 | if (!SHARED_KERNEL_PMD) { |
176 | struct page *page; | 238 | struct page *page; |
177 | 239 | ||
240 | address = __pa(address); | ||
178 | list_for_each_entry(page, &pgd_list, lru) { | 241 | list_for_each_entry(page, &pgd_list, lru) { |
179 | pgd_t *pgd; | 242 | pgd_t *pgd; |
180 | pud_t *pud; | 243 | pud_t *pud; |
@@ -189,18 +252,114 @@ static void __set_pmd_pte(pte_t *kpte, unsigned long address, pte_t pte) | |||
189 | #endif | 252 | #endif |
190 | } | 253 | } |
191 | 254 | ||
255 | static int | ||
256 | try_preserve_large_page(pte_t *kpte, unsigned long address, | ||
257 | struct cpa_data *cpa) | ||
258 | { | ||
259 | unsigned long nextpage_addr, numpages, pmask, psize, flags; | ||
260 | pte_t new_pte, old_pte, *tmp; | ||
261 | pgprot_t old_prot, new_prot; | ||
262 | int level, do_split = 1; | ||
263 | |||
264 | /* | ||
265 | * An Athlon 64 X2 showed hard hangs if we tried to preserve | ||
266 | * largepages and changed the PSE entry from RW to RO. | ||
267 | * | ||
268 | * As AMD CPUs have a long series of erratas in this area, | ||
269 | * (and none of the known ones seem to explain this hang), | ||
270 | * disable this code until the hang can be debugged: | ||
271 | */ | ||
272 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) | ||
273 | return 1; | ||
274 | |||
275 | spin_lock_irqsave(&pgd_lock, flags); | ||
276 | /* | ||
277 | * Check for races, another CPU might have split this page | ||
278 | * up already: | ||
279 | */ | ||
280 | tmp = lookup_address(address, &level); | ||
281 | if (tmp != kpte) | ||
282 | goto out_unlock; | ||
283 | |||
284 | switch (level) { | ||
285 | case PG_LEVEL_2M: | ||
286 | psize = PMD_PAGE_SIZE; | ||
287 | pmask = PMD_PAGE_MASK; | ||
288 | break; | ||
289 | #ifdef CONFIG_X86_64 | ||
290 | case PG_LEVEL_1G: | ||
291 | psize = PMD_PAGE_SIZE; | ||
292 | pmask = PMD_PAGE_MASK; | ||
293 | break; | ||
294 | #endif | ||
295 | default: | ||
296 | do_split = -EINVAL; | ||
297 | goto out_unlock; | ||
298 | } | ||
299 | |||
300 | /* | ||
301 | * Calculate the number of pages, which fit into this large | ||
302 | * page starting at address: | ||
303 | */ | ||
304 | nextpage_addr = (address + psize) & pmask; | ||
305 | numpages = (nextpage_addr - address) >> PAGE_SHIFT; | ||
306 | if (numpages < cpa->numpages) | ||
307 | cpa->numpages = numpages; | ||
308 | |||
309 | /* | ||
310 | * We are safe now. Check whether the new pgprot is the same: | ||
311 | */ | ||
312 | old_pte = *kpte; | ||
313 | old_prot = new_prot = pte_pgprot(old_pte); | ||
314 | |||
315 | pgprot_val(new_prot) &= ~pgprot_val(cpa->mask_clr); | ||
316 | pgprot_val(new_prot) |= pgprot_val(cpa->mask_set); | ||
317 | new_prot = static_protections(new_prot, address); | ||
318 | |||
319 | /* | ||
320 | * If there are no changes, return. maxpages has been updated | ||
321 | * above: | ||
322 | */ | ||
323 | if (pgprot_val(new_prot) == pgprot_val(old_prot)) { | ||
324 | do_split = 0; | ||
325 | goto out_unlock; | ||
326 | } | ||
327 | |||
328 | /* | ||
329 | * We need to change the attributes. Check, whether we can | ||
330 | * change the large page in one go. We request a split, when | ||
331 | * the address is not aligned and the number of pages is | ||
332 | * smaller than the number of pages in the large page. Note | ||
333 | * that we limited the number of possible pages already to | ||
334 | * the number of pages in the large page. | ||
335 | */ | ||
336 | if (address == (nextpage_addr - psize) && cpa->numpages == numpages) { | ||
337 | /* | ||
338 | * The address is aligned and the number of pages | ||
339 | * covers the full page. | ||
340 | */ | ||
341 | new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot)); | ||
342 | __set_pmd_pte(kpte, address, new_pte); | ||
343 | cpa->flushtlb = 1; | ||
344 | do_split = 0; | ||
345 | } | ||
346 | |||
347 | out_unlock: | ||
348 | spin_unlock_irqrestore(&pgd_lock, flags); | ||
349 | |||
350 | return do_split; | ||
351 | } | ||
352 | |||
192 | static int split_large_page(pte_t *kpte, unsigned long address) | 353 | static int split_large_page(pte_t *kpte, unsigned long address) |
193 | { | 354 | { |
194 | pgprot_t ref_prot = pte_pgprot(pte_clrhuge(*kpte)); | 355 | unsigned long flags, pfn, pfninc = 1; |
195 | gfp_t gfp_flags = GFP_KERNEL; | 356 | gfp_t gfp_flags = GFP_KERNEL; |
196 | unsigned long flags; | 357 | unsigned int i, level; |
197 | unsigned long addr; | ||
198 | pte_t *pbase, *tmp; | 358 | pte_t *pbase, *tmp; |
359 | pgprot_t ref_prot; | ||
199 | struct page *base; | 360 | struct page *base; |
200 | unsigned int i, level; | ||
201 | 361 | ||
202 | #ifdef CONFIG_DEBUG_PAGEALLOC | 362 | #ifdef CONFIG_DEBUG_PAGEALLOC |
203 | gfp_flags = __GFP_HIGH | __GFP_NOFAIL | __GFP_NOWARN; | ||
204 | gfp_flags = GFP_ATOMIC | __GFP_NOWARN; | 363 | gfp_flags = GFP_ATOMIC | __GFP_NOWARN; |
205 | #endif | 364 | #endif |
206 | base = alloc_pages(gfp_flags, 0); | 365 | base = alloc_pages(gfp_flags, 0); |
@@ -213,30 +372,41 @@ static int split_large_page(pte_t *kpte, unsigned long address) | |||
213 | * up for us already: | 372 | * up for us already: |
214 | */ | 373 | */ |
215 | tmp = lookup_address(address, &level); | 374 | tmp = lookup_address(address, &level); |
216 | if (tmp != kpte) { | 375 | if (tmp != kpte) |
217 | WARN_ON_ONCE(1); | ||
218 | goto out_unlock; | 376 | goto out_unlock; |
219 | } | ||
220 | 377 | ||
221 | address = __pa(address); | ||
222 | addr = address & LARGE_PAGE_MASK; | ||
223 | pbase = (pte_t *)page_address(base); | 378 | pbase = (pte_t *)page_address(base); |
224 | #ifdef CONFIG_X86_32 | 379 | #ifdef CONFIG_X86_32 |
225 | paravirt_alloc_pt(&init_mm, page_to_pfn(base)); | 380 | paravirt_alloc_pt(&init_mm, page_to_pfn(base)); |
226 | #endif | 381 | #endif |
382 | ref_prot = pte_pgprot(pte_clrhuge(*kpte)); | ||
383 | |||
384 | #ifdef CONFIG_X86_64 | ||
385 | if (level == PG_LEVEL_1G) { | ||
386 | pfninc = PMD_PAGE_SIZE >> PAGE_SHIFT; | ||
387 | pgprot_val(ref_prot) |= _PAGE_PSE; | ||
388 | } | ||
389 | #endif | ||
227 | 390 | ||
228 | pgprot_val(ref_prot) &= ~_PAGE_NX; | 391 | /* |
229 | for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) | 392 | * Get the target pfn from the original entry: |
230 | set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT, ref_prot)); | 393 | */ |
394 | pfn = pte_pfn(*kpte); | ||
395 | for (i = 0; i < PTRS_PER_PTE; i++, pfn += pfninc) | ||
396 | set_pte(&pbase[i], pfn_pte(pfn, ref_prot)); | ||
231 | 397 | ||
232 | /* | 398 | /* |
233 | * Install the new, split up pagetable. Important detail here: | 399 | * Install the new, split up pagetable. Important details here: |
234 | * | 400 | * |
235 | * On Intel the NX bit of all levels must be cleared to make a | 401 | * On Intel the NX bit of all levels must be cleared to make a |
236 | * page executable. See section 4.13.2 of Intel 64 and IA-32 | 402 | * page executable. See section 4.13.2 of Intel 64 and IA-32 |
237 | * Architectures Software Developer's Manual). | 403 | * Architectures Software Developer's Manual). |
404 | * | ||
405 | * Mark the entry present. The current mapping might be | ||
406 | * set to not present, which we preserved above. | ||
238 | */ | 407 | */ |
239 | ref_prot = pte_pgprot(pte_mkexec(pte_clrhuge(*kpte))); | 408 | ref_prot = pte_pgprot(pte_mkexec(pte_clrhuge(*kpte))); |
409 | pgprot_val(ref_prot) |= _PAGE_PRESENT; | ||
240 | __set_pmd_pte(kpte, address, mk_pte(base, ref_prot)); | 410 | __set_pmd_pte(kpte, address, mk_pte(base, ref_prot)); |
241 | base = NULL; | 411 | base = NULL; |
242 | 412 | ||
@@ -249,18 +419,12 @@ out_unlock: | |||
249 | return 0; | 419 | return 0; |
250 | } | 420 | } |
251 | 421 | ||
252 | static int | 422 | static int __change_page_attr(unsigned long address, struct cpa_data *cpa) |
253 | __change_page_attr(unsigned long address, unsigned long pfn, | ||
254 | pgprot_t mask_set, pgprot_t mask_clr) | ||
255 | { | 423 | { |
424 | int level, do_split, err; | ||
256 | struct page *kpte_page; | 425 | struct page *kpte_page; |
257 | int level, err = 0; | ||
258 | pte_t *kpte; | 426 | pte_t *kpte; |
259 | 427 | ||
260 | #ifdef CONFIG_X86_32 | ||
261 | BUG_ON(pfn > max_low_pfn); | ||
262 | #endif | ||
263 | |||
264 | repeat: | 428 | repeat: |
265 | kpte = lookup_address(address, &level); | 429 | kpte = lookup_address(address, &level); |
266 | if (!kpte) | 430 | if (!kpte) |
@@ -271,23 +435,62 @@ repeat: | |||
271 | BUG_ON(PageCompound(kpte_page)); | 435 | BUG_ON(PageCompound(kpte_page)); |
272 | 436 | ||
273 | if (level == PG_LEVEL_4K) { | 437 | if (level == PG_LEVEL_4K) { |
274 | pgprot_t new_prot = pte_pgprot(*kpte); | ||
275 | pte_t new_pte, old_pte = *kpte; | 438 | pte_t new_pte, old_pte = *kpte; |
439 | pgprot_t new_prot = pte_pgprot(old_pte); | ||
440 | |||
441 | if(!pte_val(old_pte)) { | ||
442 | printk(KERN_WARNING "CPA: called for zero pte. " | ||
443 | "vaddr = %lx cpa->vaddr = %lx\n", address, | ||
444 | cpa->vaddr); | ||
445 | WARN_ON(1); | ||
446 | return -EINVAL; | ||
447 | } | ||
276 | 448 | ||
277 | pgprot_val(new_prot) &= ~pgprot_val(mask_clr); | 449 | pgprot_val(new_prot) &= ~pgprot_val(cpa->mask_clr); |
278 | pgprot_val(new_prot) |= pgprot_val(mask_set); | 450 | pgprot_val(new_prot) |= pgprot_val(cpa->mask_set); |
279 | 451 | ||
280 | new_prot = static_protections(new_prot, address); | 452 | new_prot = static_protections(new_prot, address); |
281 | 453 | ||
282 | new_pte = pfn_pte(pfn, canon_pgprot(new_prot)); | 454 | /* |
283 | BUG_ON(pte_pfn(new_pte) != pte_pfn(old_pte)); | 455 | * We need to keep the pfn from the existing PTE, |
456 | * after all we're only going to change it's attributes | ||
457 | * not the memory it points to | ||
458 | */ | ||
459 | new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot)); | ||
460 | |||
461 | /* | ||
462 | * Do we really change anything ? | ||
463 | */ | ||
464 | if (pte_val(old_pte) != pte_val(new_pte)) { | ||
465 | set_pte_atomic(kpte, new_pte); | ||
466 | cpa->flushtlb = 1; | ||
467 | } | ||
468 | cpa->numpages = 1; | ||
469 | return 0; | ||
470 | } | ||
471 | |||
472 | /* | ||
473 | * Check, whether we can keep the large page intact | ||
474 | * and just change the pte: | ||
475 | */ | ||
476 | do_split = try_preserve_large_page(kpte, address, cpa); | ||
477 | /* | ||
478 | * When the range fits into the existing large page, | ||
479 | * return. cp->numpages and cpa->tlbflush have been updated in | ||
480 | * try_large_page: | ||
481 | */ | ||
482 | if (do_split <= 0) | ||
483 | return do_split; | ||
284 | 484 | ||
285 | set_pte_atomic(kpte, new_pte); | 485 | /* |
286 | } else { | 486 | * We have to split the large page: |
287 | err = split_large_page(kpte, address); | 487 | */ |
288 | if (!err) | 488 | err = split_large_page(kpte, address); |
289 | goto repeat; | 489 | if (!err) { |
490 | cpa->flushtlb = 1; | ||
491 | goto repeat; | ||
290 | } | 492 | } |
493 | |||
291 | return err; | 494 | return err; |
292 | } | 495 | } |
293 | 496 | ||
@@ -304,19 +507,14 @@ repeat: | |||
304 | * | 507 | * |
305 | * Modules and drivers should use the set_memory_* APIs instead. | 508 | * Modules and drivers should use the set_memory_* APIs instead. |
306 | */ | 509 | */ |
307 | 510 | static int change_page_attr_addr(struct cpa_data *cpa) | |
308 | #define HIGH_MAP_START __START_KERNEL_map | ||
309 | #define HIGH_MAP_END (__START_KERNEL_map + KERNEL_TEXT_SIZE) | ||
310 | |||
311 | static int | ||
312 | change_page_attr_addr(unsigned long address, pgprot_t mask_set, | ||
313 | pgprot_t mask_clr) | ||
314 | { | 511 | { |
315 | unsigned long phys_addr = __pa(address); | ||
316 | unsigned long pfn = phys_addr >> PAGE_SHIFT; | ||
317 | int err; | 512 | int err; |
513 | unsigned long address = cpa->vaddr; | ||
318 | 514 | ||
319 | #ifdef CONFIG_X86_64 | 515 | #ifdef CONFIG_X86_64 |
516 | unsigned long phys_addr = __pa(address); | ||
517 | |||
320 | /* | 518 | /* |
321 | * If we are inside the high mapped kernel range, then we | 519 | * If we are inside the high mapped kernel range, then we |
322 | * fixup the low mapping first. __va() returns the virtual | 520 | * fixup the low mapping first. __va() returns the virtual |
@@ -326,7 +524,7 @@ change_page_attr_addr(unsigned long address, pgprot_t mask_set, | |||
326 | address = (unsigned long) __va(phys_addr); | 524 | address = (unsigned long) __va(phys_addr); |
327 | #endif | 525 | #endif |
328 | 526 | ||
329 | err = __change_page_attr(address, pfn, mask_set, mask_clr); | 527 | err = __change_page_attr(address, cpa); |
330 | if (err) | 528 | if (err) |
331 | return err; | 529 | return err; |
332 | 530 | ||
@@ -339,42 +537,89 @@ change_page_attr_addr(unsigned long address, pgprot_t mask_set, | |||
339 | /* | 537 | /* |
340 | * Calc the high mapping address. See __phys_addr() | 538 | * Calc the high mapping address. See __phys_addr() |
341 | * for the non obvious details. | 539 | * for the non obvious details. |
540 | * | ||
541 | * Note that NX and other required permissions are | ||
542 | * checked in static_protections(). | ||
342 | */ | 543 | */ |
343 | address = phys_addr + HIGH_MAP_START - phys_base; | 544 | address = phys_addr + HIGH_MAP_START - phys_base; |
344 | /* Make sure the kernel mappings stay executable */ | ||
345 | pgprot_val(mask_clr) |= _PAGE_NX; | ||
346 | 545 | ||
347 | /* | 546 | /* |
348 | * Our high aliases are imprecise, because we check | 547 | * Our high aliases are imprecise, because we check |
349 | * everything between 0 and KERNEL_TEXT_SIZE, so do | 548 | * everything between 0 and KERNEL_TEXT_SIZE, so do |
350 | * not propagate lookup failures back to users: | 549 | * not propagate lookup failures back to users: |
351 | */ | 550 | */ |
352 | __change_page_attr(address, pfn, mask_set, mask_clr); | 551 | __change_page_attr(address, cpa); |
353 | } | 552 | } |
354 | #endif | 553 | #endif |
355 | return err; | 554 | return err; |
356 | } | 555 | } |
357 | 556 | ||
358 | static int __change_page_attr_set_clr(unsigned long addr, int numpages, | 557 | static int __change_page_attr_set_clr(struct cpa_data *cpa) |
359 | pgprot_t mask_set, pgprot_t mask_clr) | ||
360 | { | 558 | { |
361 | unsigned int i; | 559 | int ret, numpages = cpa->numpages; |
362 | int ret; | ||
363 | 560 | ||
364 | for (i = 0; i < numpages ; i++, addr += PAGE_SIZE) { | 561 | while (numpages) { |
365 | ret = change_page_attr_addr(addr, mask_set, mask_clr); | 562 | /* |
563 | * Store the remaining nr of pages for the large page | ||
564 | * preservation check. | ||
565 | */ | ||
566 | cpa->numpages = numpages; | ||
567 | ret = change_page_attr_addr(cpa); | ||
366 | if (ret) | 568 | if (ret) |
367 | return ret; | 569 | return ret; |
368 | } | ||
369 | 570 | ||
571 | /* | ||
572 | * Adjust the number of pages with the result of the | ||
573 | * CPA operation. Either a large page has been | ||
574 | * preserved or a single page update happened. | ||
575 | */ | ||
576 | BUG_ON(cpa->numpages > numpages); | ||
577 | numpages -= cpa->numpages; | ||
578 | cpa->vaddr += cpa->numpages * PAGE_SIZE; | ||
579 | } | ||
370 | return 0; | 580 | return 0; |
371 | } | 581 | } |
372 | 582 | ||
583 | static inline int cache_attr(pgprot_t attr) | ||
584 | { | ||
585 | return pgprot_val(attr) & | ||
586 | (_PAGE_PAT | _PAGE_PAT_LARGE | _PAGE_PWT | _PAGE_PCD); | ||
587 | } | ||
588 | |||
373 | static int change_page_attr_set_clr(unsigned long addr, int numpages, | 589 | static int change_page_attr_set_clr(unsigned long addr, int numpages, |
374 | pgprot_t mask_set, pgprot_t mask_clr) | 590 | pgprot_t mask_set, pgprot_t mask_clr) |
375 | { | 591 | { |
376 | int ret = __change_page_attr_set_clr(addr, numpages, mask_set, | 592 | struct cpa_data cpa; |
377 | mask_clr); | 593 | int ret, cache; |
594 | |||
595 | /* | ||
596 | * Check, if we are requested to change a not supported | ||
597 | * feature: | ||
598 | */ | ||
599 | mask_set = canon_pgprot(mask_set); | ||
600 | mask_clr = canon_pgprot(mask_clr); | ||
601 | if (!pgprot_val(mask_set) && !pgprot_val(mask_clr)) | ||
602 | return 0; | ||
603 | |||
604 | cpa.vaddr = addr; | ||
605 | cpa.numpages = numpages; | ||
606 | cpa.mask_set = mask_set; | ||
607 | cpa.mask_clr = mask_clr; | ||
608 | cpa.flushtlb = 0; | ||
609 | |||
610 | ret = __change_page_attr_set_clr(&cpa); | ||
611 | |||
612 | /* | ||
613 | * Check whether we really changed something: | ||
614 | */ | ||
615 | if (!cpa.flushtlb) | ||
616 | return ret; | ||
617 | |||
618 | /* | ||
619 | * No need to flush, when we did not set any of the caching | ||
620 | * attributes: | ||
621 | */ | ||
622 | cache = cache_attr(mask_set); | ||
378 | 623 | ||
379 | /* | 624 | /* |
380 | * On success we use clflush, when the CPU supports it to | 625 | * On success we use clflush, when the CPU supports it to |
@@ -383,9 +628,9 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages, | |||
383 | * wbindv): | 628 | * wbindv): |
384 | */ | 629 | */ |
385 | if (!ret && cpu_has_clflush) | 630 | if (!ret && cpu_has_clflush) |
386 | cpa_flush_range(addr, numpages); | 631 | cpa_flush_range(addr, numpages, cache); |
387 | else | 632 | else |
388 | cpa_flush_all(); | 633 | cpa_flush_all(cache); |
389 | 634 | ||
390 | return ret; | 635 | return ret; |
391 | } | 636 | } |
@@ -489,37 +734,26 @@ int set_pages_rw(struct page *page, int numpages) | |||
489 | return set_memory_rw(addr, numpages); | 734 | return set_memory_rw(addr, numpages); |
490 | } | 735 | } |
491 | 736 | ||
492 | |||
493 | #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_CPA_DEBUG) | ||
494 | static inline int __change_page_attr_set(unsigned long addr, int numpages, | ||
495 | pgprot_t mask) | ||
496 | { | ||
497 | return __change_page_attr_set_clr(addr, numpages, mask, __pgprot(0)); | ||
498 | } | ||
499 | |||
500 | static inline int __change_page_attr_clear(unsigned long addr, int numpages, | ||
501 | pgprot_t mask) | ||
502 | { | ||
503 | return __change_page_attr_set_clr(addr, numpages, __pgprot(0), mask); | ||
504 | } | ||
505 | #endif | ||
506 | |||
507 | #ifdef CONFIG_DEBUG_PAGEALLOC | 737 | #ifdef CONFIG_DEBUG_PAGEALLOC |
508 | 738 | ||
509 | static int __set_pages_p(struct page *page, int numpages) | 739 | static int __set_pages_p(struct page *page, int numpages) |
510 | { | 740 | { |
511 | unsigned long addr = (unsigned long)page_address(page); | 741 | struct cpa_data cpa = { .vaddr = (unsigned long) page_address(page), |
742 | .numpages = numpages, | ||
743 | .mask_set = __pgprot(_PAGE_PRESENT | _PAGE_RW), | ||
744 | .mask_clr = __pgprot(0)}; | ||
512 | 745 | ||
513 | return __change_page_attr_set(addr, numpages, | 746 | return __change_page_attr_set_clr(&cpa); |
514 | __pgprot(_PAGE_PRESENT | _PAGE_RW)); | ||
515 | } | 747 | } |
516 | 748 | ||
517 | static int __set_pages_np(struct page *page, int numpages) | 749 | static int __set_pages_np(struct page *page, int numpages) |
518 | { | 750 | { |
519 | unsigned long addr = (unsigned long)page_address(page); | 751 | struct cpa_data cpa = { .vaddr = (unsigned long) page_address(page), |
752 | .numpages = numpages, | ||
753 | .mask_set = __pgprot(0), | ||
754 | .mask_clr = __pgprot(_PAGE_PRESENT | _PAGE_RW)}; | ||
520 | 755 | ||
521 | return __change_page_attr_clear(addr, numpages, | 756 | return __change_page_attr_set_clr(&cpa); |
522 | __pgprot(_PAGE_PRESENT)); | ||
523 | } | 757 | } |
524 | 758 | ||
525 | void kernel_map_pages(struct page *page, int numpages, int enable) | 759 | void kernel_map_pages(struct page *page, int numpages, int enable) |
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c index cb3aa470249b..c7db504be1ea 100644 --- a/arch/x86/mm/pgtable_32.c +++ b/arch/x86/mm/pgtable_32.c | |||
@@ -219,50 +219,39 @@ static inline void pgd_list_del(pgd_t *pgd) | |||
219 | list_del(&page->lru); | 219 | list_del(&page->lru); |
220 | } | 220 | } |
221 | 221 | ||
222 | #define UNSHARED_PTRS_PER_PGD \ | ||
223 | (SHARED_KERNEL_PMD ? USER_PTRS_PER_PGD : PTRS_PER_PGD) | ||
222 | 224 | ||
223 | 225 | static void pgd_ctor(void *p) | |
224 | #if (PTRS_PER_PMD == 1) | ||
225 | /* Non-PAE pgd constructor */ | ||
226 | static void pgd_ctor(void *pgd) | ||
227 | { | 226 | { |
227 | pgd_t *pgd = p; | ||
228 | unsigned long flags; | 228 | unsigned long flags; |
229 | 229 | ||
230 | /* !PAE, no pagetable sharing */ | 230 | /* Clear usermode parts of PGD */ |
231 | memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t)); | 231 | memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t)); |
232 | 232 | ||
233 | spin_lock_irqsave(&pgd_lock, flags); | 233 | spin_lock_irqsave(&pgd_lock, flags); |
234 | 234 | ||
235 | /* must happen under lock */ | 235 | /* If the pgd points to a shared pagetable level (either the |
236 | clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD, | 236 | ptes in non-PAE, or shared PMD in PAE), then just copy the |
237 | swapper_pg_dir + USER_PTRS_PER_PGD, | 237 | references from swapper_pg_dir. */ |
238 | KERNEL_PGD_PTRS); | 238 | if (PAGETABLE_LEVELS == 2 || |
239 | paravirt_alloc_pd_clone(__pa(pgd) >> PAGE_SHIFT, | 239 | (PAGETABLE_LEVELS == 3 && SHARED_KERNEL_PMD)) { |
240 | __pa(swapper_pg_dir) >> PAGE_SHIFT, | 240 | clone_pgd_range(pgd + USER_PTRS_PER_PGD, |
241 | USER_PTRS_PER_PGD, | ||
242 | KERNEL_PGD_PTRS); | ||
243 | pgd_list_add(pgd); | ||
244 | spin_unlock_irqrestore(&pgd_lock, flags); | ||
245 | } | ||
246 | #else /* PTRS_PER_PMD > 1 */ | ||
247 | /* PAE pgd constructor */ | ||
248 | static void pgd_ctor(void *pgd) | ||
249 | { | ||
250 | /* PAE, kernel PMD may be shared */ | ||
251 | |||
252 | if (SHARED_KERNEL_PMD) { | ||
253 | clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD, | ||
254 | swapper_pg_dir + USER_PTRS_PER_PGD, | 241 | swapper_pg_dir + USER_PTRS_PER_PGD, |
255 | KERNEL_PGD_PTRS); | 242 | KERNEL_PGD_PTRS); |
256 | } else { | 243 | paravirt_alloc_pd_clone(__pa(pgd) >> PAGE_SHIFT, |
257 | unsigned long flags; | 244 | __pa(swapper_pg_dir) >> PAGE_SHIFT, |
245 | USER_PTRS_PER_PGD, | ||
246 | KERNEL_PGD_PTRS); | ||
247 | } | ||
258 | 248 | ||
259 | memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t)); | 249 | /* list required to sync kernel mapping updates */ |
260 | spin_lock_irqsave(&pgd_lock, flags); | 250 | if (!SHARED_KERNEL_PMD) |
261 | pgd_list_add(pgd); | 251 | pgd_list_add(pgd); |
262 | spin_unlock_irqrestore(&pgd_lock, flags); | 252 | |
263 | } | 253 | spin_unlock_irqrestore(&pgd_lock, flags); |
264 | } | 254 | } |
265 | #endif /* PTRS_PER_PMD */ | ||
266 | 255 | ||
267 | static void pgd_dtor(void *pgd) | 256 | static void pgd_dtor(void *pgd) |
268 | { | 257 | { |
@@ -276,9 +265,6 @@ static void pgd_dtor(void *pgd) | |||
276 | spin_unlock_irqrestore(&pgd_lock, flags); | 265 | spin_unlock_irqrestore(&pgd_lock, flags); |
277 | } | 266 | } |
278 | 267 | ||
279 | #define UNSHARED_PTRS_PER_PGD \ | ||
280 | (SHARED_KERNEL_PMD ? USER_PTRS_PER_PGD : PTRS_PER_PGD) | ||
281 | |||
282 | #ifdef CONFIG_X86_PAE | 268 | #ifdef CONFIG_X86_PAE |
283 | /* | 269 | /* |
284 | * Mop up any pmd pages which may still be attached to the pgd. | 270 | * Mop up any pmd pages which may still be attached to the pgd. |
@@ -387,13 +373,6 @@ void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte) | |||
387 | 373 | ||
388 | void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) | 374 | void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) |
389 | { | 375 | { |
390 | /* This is called just after the pmd has been detached from | ||
391 | the pgd, which requires a full tlb flush to be recognized | ||
392 | by the CPU. Rather than incurring multiple tlb flushes | ||
393 | while the address space is being pulled down, make the tlb | ||
394 | gathering machinery do a full flush when we're done. */ | ||
395 | tlb->fullmm = 1; | ||
396 | |||
397 | paravirt_release_pd(__pa(pmd) >> PAGE_SHIFT); | 376 | paravirt_release_pd(__pa(pmd) >> PAGE_SHIFT); |
398 | tlb_remove_page(tlb, virt_to_page(pmd)); | 377 | tlb_remove_page(tlb, virt_to_page(pmd)); |
399 | } | 378 | } |
diff --git a/arch/x86/pci/numa.c b/arch/x86/pci/numa.c index f5f165f69e0c..55270c26237c 100644 --- a/arch/x86/pci/numa.c +++ b/arch/x86/pci/numa.c | |||
@@ -5,36 +5,62 @@ | |||
5 | #include <linux/pci.h> | 5 | #include <linux/pci.h> |
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/nodemask.h> | 7 | #include <linux/nodemask.h> |
8 | #include <mach_apic.h> | ||
8 | #include "pci.h" | 9 | #include "pci.h" |
9 | 10 | ||
11 | #define XQUAD_PORTIO_BASE 0xfe400000 | ||
12 | #define XQUAD_PORTIO_QUAD 0x40000 /* 256k per quad. */ | ||
13 | |||
10 | #define BUS2QUAD(global) (mp_bus_id_to_node[global]) | 14 | #define BUS2QUAD(global) (mp_bus_id_to_node[global]) |
11 | #define BUS2LOCAL(global) (mp_bus_id_to_local[global]) | 15 | #define BUS2LOCAL(global) (mp_bus_id_to_local[global]) |
12 | #define QUADLOCAL2BUS(quad,local) (quad_local_to_mp_bus_id[quad][local]) | 16 | #define QUADLOCAL2BUS(quad,local) (quad_local_to_mp_bus_id[quad][local]) |
13 | 17 | ||
18 | extern void *xquad_portio; /* Where the IO area was mapped */ | ||
19 | #define XQUAD_PORT_ADDR(port, quad) (xquad_portio + (XQUAD_PORTIO_QUAD*quad) + port) | ||
20 | |||
14 | #define PCI_CONF1_MQ_ADDRESS(bus, devfn, reg) \ | 21 | #define PCI_CONF1_MQ_ADDRESS(bus, devfn, reg) \ |
15 | (0x80000000 | (BUS2LOCAL(bus) << 16) | (devfn << 8) | (reg & ~3)) | 22 | (0x80000000 | (BUS2LOCAL(bus) << 16) | (devfn << 8) | (reg & ~3)) |
16 | 23 | ||
24 | static void write_cf8(unsigned bus, unsigned devfn, unsigned reg) | ||
25 | { | ||
26 | unsigned val = PCI_CONF1_MQ_ADDRESS(bus, devfn, reg); | ||
27 | if (xquad_portio) | ||
28 | writel(val, XQUAD_PORT_ADDR(0xcf8, BUS2QUAD(bus))); | ||
29 | else | ||
30 | outl(val, 0xCF8); | ||
31 | } | ||
32 | |||
17 | static int pci_conf1_mq_read(unsigned int seg, unsigned int bus, | 33 | static int pci_conf1_mq_read(unsigned int seg, unsigned int bus, |
18 | unsigned int devfn, int reg, int len, u32 *value) | 34 | unsigned int devfn, int reg, int len, u32 *value) |
19 | { | 35 | { |
20 | unsigned long flags; | 36 | unsigned long flags; |
37 | void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus)); | ||
21 | 38 | ||
22 | if (!value || (bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) | 39 | if (!value || (bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) |
23 | return -EINVAL; | 40 | return -EINVAL; |
24 | 41 | ||
25 | spin_lock_irqsave(&pci_config_lock, flags); | 42 | spin_lock_irqsave(&pci_config_lock, flags); |
26 | 43 | ||
27 | outl_quad(PCI_CONF1_MQ_ADDRESS(bus, devfn, reg), 0xCF8, BUS2QUAD(bus)); | 44 | write_cf8(bus, devfn, reg); |
28 | 45 | ||
29 | switch (len) { | 46 | switch (len) { |
30 | case 1: | 47 | case 1: |
31 | *value = inb_quad(0xCFC + (reg & 3), BUS2QUAD(bus)); | 48 | if (xquad_portio) |
49 | *value = readb(adr + (reg & 3)); | ||
50 | else | ||
51 | *value = inb(0xCFC + (reg & 3)); | ||
32 | break; | 52 | break; |
33 | case 2: | 53 | case 2: |
34 | *value = inw_quad(0xCFC + (reg & 2), BUS2QUAD(bus)); | 54 | if (xquad_portio) |
55 | *value = readw(adr + (reg & 2)); | ||
56 | else | ||
57 | *value = inw(0xCFC + (reg & 2)); | ||
35 | break; | 58 | break; |
36 | case 4: | 59 | case 4: |
37 | *value = inl_quad(0xCFC, BUS2QUAD(bus)); | 60 | if (xquad_portio) |
61 | *value = readl(adr); | ||
62 | else | ||
63 | *value = inl(0xCFC); | ||
38 | break; | 64 | break; |
39 | } | 65 | } |
40 | 66 | ||
@@ -47,23 +73,33 @@ static int pci_conf1_mq_write(unsigned int seg, unsigned int bus, | |||
47 | unsigned int devfn, int reg, int len, u32 value) | 73 | unsigned int devfn, int reg, int len, u32 value) |
48 | { | 74 | { |
49 | unsigned long flags; | 75 | unsigned long flags; |
76 | void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus)); | ||
50 | 77 | ||
51 | if ((bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) | 78 | if ((bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) |
52 | return -EINVAL; | 79 | return -EINVAL; |
53 | 80 | ||
54 | spin_lock_irqsave(&pci_config_lock, flags); | 81 | spin_lock_irqsave(&pci_config_lock, flags); |
55 | 82 | ||
56 | outl_quad(PCI_CONF1_MQ_ADDRESS(bus, devfn, reg), 0xCF8, BUS2QUAD(bus)); | 83 | write_cf8(bus, devfn, reg); |
57 | 84 | ||
58 | switch (len) { | 85 | switch (len) { |
59 | case 1: | 86 | case 1: |
60 | outb_quad((u8)value, 0xCFC + (reg & 3), BUS2QUAD(bus)); | 87 | if (xquad_portio) |
88 | writeb(value, adr + (reg & 3)); | ||
89 | else | ||
90 | outb((u8)value, 0xCFC + (reg & 3)); | ||
61 | break; | 91 | break; |
62 | case 2: | 92 | case 2: |
63 | outw_quad((u16)value, 0xCFC + (reg & 2), BUS2QUAD(bus)); | 93 | if (xquad_portio) |
94 | writew(value, adr + (reg & 2)); | ||
95 | else | ||
96 | outw((u16)value, 0xCFC + (reg & 2)); | ||
64 | break; | 97 | break; |
65 | case 4: | 98 | case 4: |
66 | outl_quad((u32)value, 0xCFC, BUS2QUAD(bus)); | 99 | if (xquad_portio) |
100 | writel(value, adr + reg); | ||
101 | else | ||
102 | outl((u32)value, 0xCFC); | ||
67 | break; | 103 | break; |
68 | } | 104 | } |
69 | 105 | ||
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 844721e8e3dd..5d5546ce88fe 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -246,8 +246,6 @@ config EMBEDDED_RAMDISK_IMAGE | |||
246 | provide one yourself. | 246 | provide one yourself. |
247 | endmenu | 247 | endmenu |
248 | 248 | ||
249 | source "kernel/Kconfig.instrumentation" | ||
250 | |||
251 | source "arch/xtensa/Kconfig.debug" | 249 | source "arch/xtensa/Kconfig.debug" |
252 | 250 | ||
253 | source "security/Kconfig" | 251 | source "security/Kconfig" |
diff --git a/drivers/Kconfig b/drivers/Kconfig index 08d4ae201597..3f8a231fe754 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -91,6 +91,4 @@ source "drivers/dca/Kconfig" | |||
91 | source "drivers/auxdisplay/Kconfig" | 91 | source "drivers/auxdisplay/Kconfig" |
92 | 92 | ||
93 | source "drivers/uio/Kconfig" | 93 | source "drivers/uio/Kconfig" |
94 | |||
95 | source "drivers/virtio/Kconfig" | ||
96 | endmenu | 94 | endmenu |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index cbfe9ae7a9e5..d9d531cce27f 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -830,7 +830,7 @@ static int acpi_bus_get_flags(struct acpi_device *device) | |||
830 | if (ACPI_SUCCESS(status)) | 830 | if (ACPI_SUCCESS(status)) |
831 | device->flags.wake_capable = 1; | 831 | device->flags.wake_capable = 1; |
832 | 832 | ||
833 | /* TBD: Peformance management */ | 833 | /* TBD: Performance management */ |
834 | 834 | ||
835 | return 0; | 835 | return 0; |
836 | } | 836 | } |
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index cbbd3315a1e2..b630ee137ee1 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | * | 2 | * |
3 | * Module Name: utresrc - Resource managment utilities | 3 | * Module Name: utresrc - Resource management utilities |
4 | * | 4 | * |
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 47892e6f5ded..4b99ed0c59bb 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -837,7 +837,7 @@ static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
837 | if (is_slave) { | 837 | if (is_slave) { |
838 | /* clear TIME1|IE1|PPE1|DTE1 */ | 838 | /* clear TIME1|IE1|PPE1|DTE1 */ |
839 | master_data &= 0xff0f; | 839 | master_data &= 0xff0f; |
840 | /* Enable SITRE (seperate slave timing register) */ | 840 | /* Enable SITRE (separate slave timing register) */ |
841 | master_data |= 0x4000; | 841 | master_data |= 0x4000; |
842 | /* enable PPE1, IE1 and TIME1 as needed */ | 842 | /* enable PPE1, IE1 and TIME1 as needed */ |
843 | master_data |= (control << 4); | 843 | master_data |= (control << 4); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index bdbd55af7022..361cf50cbdea 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3097,7 +3097,7 @@ static int ata_dev_set_mode(struct ata_device *dev) | |||
3097 | /** | 3097 | /** |
3098 | * ata_do_set_mode - Program timings and issue SET FEATURES - XFER | 3098 | * ata_do_set_mode - Program timings and issue SET FEATURES - XFER |
3099 | * @link: link on which timings will be programmed | 3099 | * @link: link on which timings will be programmed |
3100 | * @r_failed_dev: out paramter for failed device | 3100 | * @r_failed_dev: out parameter for failed device |
3101 | * | 3101 | * |
3102 | * Standard implementation of the function used to tune and set | 3102 | * Standard implementation of the function used to tune and set |
3103 | * ATA device disk transfer mode (PIO3, UDMA6, etc.). If | 3103 | * ATA device disk transfer mode (PIO3, UDMA6, etc.). If |
diff --git a/drivers/ata/pata_at32.c b/drivers/ata/pata_at32.c index 67e574de31e8..db057b183d60 100644 --- a/drivers/ata/pata_at32.c +++ b/drivers/ata/pata_at32.c | |||
@@ -324,7 +324,7 @@ static int __init pata_at32_probe(struct platform_device *pdev) | |||
324 | if (irq < 0) | 324 | if (irq < 0) |
325 | return irq; | 325 | return irq; |
326 | 326 | ||
327 | /* Setup struct containing private infomation */ | 327 | /* Setup struct containing private information */ |
328 | info = kzalloc(sizeof(struct at32_ide_info), GFP_KERNEL); | 328 | info = kzalloc(sizeof(struct at32_ide_info), GFP_KERNEL); |
329 | if (!info) | 329 | if (!info) |
330 | return -ENOMEM; | 330 | return -ENOMEM; |
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c index 043dcd35106c..dc33220fe5b2 100644 --- a/drivers/ata/pata_efar.c +++ b/drivers/ata/pata_efar.c | |||
@@ -135,7 +135,7 @@ static void efar_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
135 | idetm_data &= 0xCC0F; | 135 | idetm_data &= 0xCC0F; |
136 | idetm_data |= (control << 4); | 136 | idetm_data |= (control << 4); |
137 | 137 | ||
138 | /* Slave timing in seperate register */ | 138 | /* Slave timing in separate register */ |
139 | pci_read_config_byte(dev, 0x44, &slave_data); | 139 | pci_read_config_byte(dev, 0x44, &slave_data); |
140 | slave_data &= 0x0F << shift; | 140 | slave_data &= 0x0F << shift; |
141 | slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << shift; | 141 | slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << shift; |
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c index 1eda821e5e39..e0c2cc29d0ca 100644 --- a/drivers/ata/pata_it8213.c +++ b/drivers/ata/pata_it8213.c | |||
@@ -128,7 +128,7 @@ static void it8213_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
128 | idetm_data &= 0xCC0F; | 128 | idetm_data &= 0xCC0F; |
129 | idetm_data |= (control << 4); | 129 | idetm_data |= (control << 4); |
130 | 130 | ||
131 | /* Slave timing in seperate register */ | 131 | /* Slave timing in separate register */ |
132 | pci_read_config_byte(dev, 0x44, &slave_data); | 132 | pci_read_config_byte(dev, 0x44, &slave_data); |
133 | slave_data &= 0xF0; | 133 | slave_data &= 0xF0; |
134 | slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << 4; | 134 | slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << 4; |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index 87546d9f1ca0..dc7e91562e43 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -345,7 +345,7 @@ static void sis_old_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
345 | 345 | ||
346 | if (adev->dma_mode < XFER_UDMA_0) { | 346 | if (adev->dma_mode < XFER_UDMA_0) { |
347 | /* bits 3-0 hold recovery timing bits 8-10 active timing and | 347 | /* bits 3-0 hold recovery timing bits 8-10 active timing and |
348 | the higer bits are dependant on the device */ | 348 | the higher bits are dependant on the device */ |
349 | timing &= ~0x870F; | 349 | timing &= ~0x870F; |
350 | timing |= mwdma_bits[speed]; | 350 | timing |= mwdma_bits[speed]; |
351 | } else { | 351 | } else { |
@@ -385,7 +385,7 @@ static void sis_66_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
385 | 385 | ||
386 | if (adev->dma_mode < XFER_UDMA_0) { | 386 | if (adev->dma_mode < XFER_UDMA_0) { |
387 | /* bits 3-0 hold recovery timing bits 8-10 active timing and | 387 | /* bits 3-0 hold recovery timing bits 8-10 active timing and |
388 | the higer bits are dependant on the device, bit 15 udma */ | 388 | the higher bits are dependant on the device, bit 15 udma */ |
389 | timing &= ~0x870F; | 389 | timing &= ~0x870F; |
390 | timing |= mwdma_bits[speed]; | 390 | timing |= mwdma_bits[speed]; |
391 | } else { | 391 | } else { |
diff --git a/drivers/base/core.c b/drivers/base/core.c index b1727876182c..9c0070b5bd3e 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -423,10 +423,8 @@ struct kset *devices_kset; | |||
423 | int device_create_file(struct device *dev, struct device_attribute *attr) | 423 | int device_create_file(struct device *dev, struct device_attribute *attr) |
424 | { | 424 | { |
425 | int error = 0; | 425 | int error = 0; |
426 | if (get_device(dev)) { | 426 | if (dev) |
427 | error = sysfs_create_file(&dev->kobj, &attr->attr); | 427 | error = sysfs_create_file(&dev->kobj, &attr->attr); |
428 | put_device(dev); | ||
429 | } | ||
430 | return error; | 428 | return error; |
431 | } | 429 | } |
432 | 430 | ||
@@ -437,10 +435,8 @@ int device_create_file(struct device *dev, struct device_attribute *attr) | |||
437 | */ | 435 | */ |
438 | void device_remove_file(struct device *dev, struct device_attribute *attr) | 436 | void device_remove_file(struct device *dev, struct device_attribute *attr) |
439 | { | 437 | { |
440 | if (get_device(dev)) { | 438 | if (dev) |
441 | sysfs_remove_file(&dev->kobj, &attr->attr); | 439 | sysfs_remove_file(&dev->kobj, &attr->attr); |
442 | put_device(dev); | ||
443 | } | ||
444 | } | 440 | } |
445 | 441 | ||
446 | /** | 442 | /** |
@@ -1144,25 +1140,11 @@ error: | |||
1144 | } | 1140 | } |
1145 | EXPORT_SYMBOL_GPL(device_create); | 1141 | EXPORT_SYMBOL_GPL(device_create); |
1146 | 1142 | ||
1147 | /** | 1143 | static int __match_devt(struct device *dev, void *data) |
1148 | * find_device - finds a device that was created with device_create() | ||
1149 | * @class: pointer to the struct class that this device was registered with | ||
1150 | * @devt: the dev_t of the device that was previously registered | ||
1151 | */ | ||
1152 | static struct device *find_device(struct class *class, dev_t devt) | ||
1153 | { | 1144 | { |
1154 | struct device *dev = NULL; | 1145 | dev_t *devt = data; |
1155 | struct device *dev_tmp; | ||
1156 | 1146 | ||
1157 | down(&class->sem); | 1147 | return dev->devt == *devt; |
1158 | list_for_each_entry(dev_tmp, &class->devices, node) { | ||
1159 | if (dev_tmp->devt == devt) { | ||
1160 | dev = dev_tmp; | ||
1161 | break; | ||
1162 | } | ||
1163 | } | ||
1164 | up(&class->sem); | ||
1165 | return dev; | ||
1166 | } | 1148 | } |
1167 | 1149 | ||
1168 | /** | 1150 | /** |
@@ -1177,9 +1159,11 @@ void device_destroy(struct class *class, dev_t devt) | |||
1177 | { | 1159 | { |
1178 | struct device *dev; | 1160 | struct device *dev; |
1179 | 1161 | ||
1180 | dev = find_device(class, devt); | 1162 | dev = class_find_device(class, &devt, __match_devt); |
1181 | if (dev) | 1163 | if (dev) { |
1164 | put_device(dev); | ||
1182 | device_unregister(dev); | 1165 | device_unregister(dev); |
1166 | } | ||
1183 | } | 1167 | } |
1184 | EXPORT_SYMBOL_GPL(device_destroy); | 1168 | EXPORT_SYMBOL_GPL(device_destroy); |
1185 | 1169 | ||
@@ -1203,9 +1187,11 @@ void destroy_suspended_device(struct class *class, dev_t devt) | |||
1203 | { | 1187 | { |
1204 | struct device *dev; | 1188 | struct device *dev; |
1205 | 1189 | ||
1206 | dev = find_device(class, devt); | 1190 | dev = class_find_device(class, &devt, __match_devt); |
1207 | if (dev) | 1191 | if (dev) { |
1208 | device_pm_schedule_removal(dev); | 1192 | device_pm_schedule_removal(dev); |
1193 | put_device(dev); | ||
1194 | } | ||
1209 | } | 1195 | } |
1210 | EXPORT_SYMBOL_GPL(destroy_suspended_device); | 1196 | EXPORT_SYMBOL_GPL(destroy_suspended_device); |
1211 | #endif /* CONFIG_PM_SLEEP */ | 1197 | #endif /* CONFIG_PM_SLEEP */ |
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index a35f04121a00..ba75184c653c 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -97,10 +97,9 @@ int driver_create_file(struct device_driver *drv, | |||
97 | struct driver_attribute *attr) | 97 | struct driver_attribute *attr) |
98 | { | 98 | { |
99 | int error; | 99 | int error; |
100 | if (get_driver(drv)) { | 100 | if (drv) |
101 | error = sysfs_create_file(&drv->p->kobj, &attr->attr); | 101 | error = sysfs_create_file(&drv->p->kobj, &attr->attr); |
102 | put_driver(drv); | 102 | else |
103 | } else | ||
104 | error = -EINVAL; | 103 | error = -EINVAL; |
105 | return error; | 104 | return error; |
106 | } | 105 | } |
@@ -114,10 +113,8 @@ EXPORT_SYMBOL_GPL(driver_create_file); | |||
114 | void driver_remove_file(struct device_driver *drv, | 113 | void driver_remove_file(struct device_driver *drv, |
115 | struct driver_attribute *attr) | 114 | struct driver_attribute *attr) |
116 | { | 115 | { |
117 | if (get_driver(drv)) { | 116 | if (drv) |
118 | sysfs_remove_file(&drv->p->kobj, &attr->attr); | 117 | sysfs_remove_file(&drv->p->kobj, &attr->attr); |
119 | put_driver(drv); | ||
120 | } | ||
121 | } | 118 | } |
122 | EXPORT_SYMBOL_GPL(driver_remove_file); | 119 | EXPORT_SYMBOL_GPL(driver_remove_file); |
123 | 120 | ||
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 200ed5fafd50..bdc03f7e8424 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -129,6 +129,7 @@ void device_pm_schedule_removal(struct device *dev) | |||
129 | list_move_tail(&dev->power.entry, &dpm_destroy); | 129 | list_move_tail(&dev->power.entry, &dpm_destroy); |
130 | mutex_unlock(&dpm_list_mtx); | 130 | mutex_unlock(&dpm_list_mtx); |
131 | } | 131 | } |
132 | EXPORT_SYMBOL_GPL(device_pm_schedule_removal); | ||
132 | 133 | ||
133 | /** | 134 | /** |
134 | * pm_sleep_lock - mutual exclusion for registration and suspend | 135 | * pm_sleep_lock - mutual exclusion for registration and suspend |
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index 6f0dfca8ebdd..e32d3bdb92c1 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h | |||
@@ -13,7 +13,6 @@ static inline struct device *to_device(struct list_head *entry) | |||
13 | 13 | ||
14 | extern void device_pm_add(struct device *); | 14 | extern void device_pm_add(struct device *); |
15 | extern void device_pm_remove(struct device *); | 15 | extern void device_pm_remove(struct device *); |
16 | extern void device_pm_schedule_removal(struct device *); | ||
17 | extern int pm_sleep_lock(void); | 16 | extern int pm_sleep_lock(void); |
18 | extern void pm_sleep_unlock(void); | 17 | extern void pm_sleep_unlock(void); |
19 | 18 | ||
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index f2122855d4ec..64e5148d82bc 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -440,6 +440,7 @@ config VIRTIO_BLK | |||
440 | tristate "Virtio block driver (EXPERIMENTAL)" | 440 | tristate "Virtio block driver (EXPERIMENTAL)" |
441 | depends on EXPERIMENTAL && VIRTIO | 441 | depends on EXPERIMENTAL && VIRTIO |
442 | ---help--- | 442 | ---help--- |
443 | This is the virtual block driver for lguest. Say Y or M. | 443 | This is the virtual block driver for virtio. It can be used with |
444 | lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. | ||
444 | 445 | ||
445 | endif # BLK_DEV | 446 | endif # BLK_DEV |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index 63ee6c076cb3..55178e9973a0 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -1453,7 +1453,7 @@ static int cciss_eh_device_reset_handler(struct scsi_cmnd *scsicmd) | |||
1453 | rc = sendcmd(CCISS_RESET_MSG, ctlr, NULL, 0, 2, 0, 0, | 1453 | rc = sendcmd(CCISS_RESET_MSG, ctlr, NULL, 0, 2, 0, 0, |
1454 | (unsigned char *) &cmd_in_trouble->Header.LUN.LunAddrBytes[0], | 1454 | (unsigned char *) &cmd_in_trouble->Header.LUN.LunAddrBytes[0], |
1455 | TYPE_MSG); | 1455 | TYPE_MSG); |
1456 | /* sendcmd turned off interrputs on the board, turn 'em back on. */ | 1456 | /* sendcmd turned off interrupts on the board, turn 'em back on. */ |
1457 | (*c)->access.set_intr_mask(*c, CCISS_INTR_ON); | 1457 | (*c)->access.set_intr_mask(*c, CCISS_INTR_ON); |
1458 | if (rc == 0) | 1458 | if (rc == 0) |
1459 | return SUCCESS; | 1459 | return SUCCESS; |
@@ -1483,7 +1483,7 @@ static int cciss_eh_abort_handler(struct scsi_cmnd *scsicmd) | |||
1483 | 0, 2, 0, 0, | 1483 | 0, 2, 0, 0, |
1484 | (unsigned char *) &cmd_to_abort->Header.LUN.LunAddrBytes[0], | 1484 | (unsigned char *) &cmd_to_abort->Header.LUN.LunAddrBytes[0], |
1485 | TYPE_MSG); | 1485 | TYPE_MSG); |
1486 | /* sendcmd turned off interrputs on the board, turn 'em back on. */ | 1486 | /* sendcmd turned off interrupts on the board, turn 'em back on. */ |
1487 | (*c)->access.set_intr_mask(*c, CCISS_INTR_ON); | 1487 | (*c)->access.set_intr_mask(*c, CCISS_INTR_ON); |
1488 | if (rc == 0) | 1488 | if (rc == 0) |
1489 | return SUCCESS; | 1489 | return SUCCESS; |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 924ddd8bccd2..3b1a68d6eddb 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -7,8 +7,10 @@ | |||
7 | #include <linux/scatterlist.h> | 7 | #include <linux/scatterlist.h> |
8 | 8 | ||
9 | #define VIRTIO_MAX_SG (3+MAX_PHYS_SEGMENTS) | 9 | #define VIRTIO_MAX_SG (3+MAX_PHYS_SEGMENTS) |
10 | #define PART_BITS 4 | ||
11 | |||
12 | static int major, index; | ||
10 | 13 | ||
11 | static unsigned char virtblk_index = 'a'; | ||
12 | struct virtio_blk | 14 | struct virtio_blk |
13 | { | 15 | { |
14 | spinlock_t lock; | 16 | spinlock_t lock; |
@@ -36,7 +38,7 @@ struct virtblk_req | |||
36 | struct virtio_blk_inhdr in_hdr; | 38 | struct virtio_blk_inhdr in_hdr; |
37 | }; | 39 | }; |
38 | 40 | ||
39 | static bool blk_done(struct virtqueue *vq) | 41 | static void blk_done(struct virtqueue *vq) |
40 | { | 42 | { |
41 | struct virtio_blk *vblk = vq->vdev->priv; | 43 | struct virtio_blk *vblk = vq->vdev->priv; |
42 | struct virtblk_req *vbr; | 44 | struct virtblk_req *vbr; |
@@ -65,7 +67,6 @@ static bool blk_done(struct virtqueue *vq) | |||
65 | /* In case queue is stopped waiting for more buffers. */ | 67 | /* In case queue is stopped waiting for more buffers. */ |
66 | blk_start_queue(vblk->disk->queue); | 68 | blk_start_queue(vblk->disk->queue); |
67 | spin_unlock_irqrestore(&vblk->lock, flags); | 69 | spin_unlock_irqrestore(&vblk->lock, flags); |
68 | return true; | ||
69 | } | 70 | } |
70 | 71 | ||
71 | static bool do_req(struct request_queue *q, struct virtio_blk *vblk, | 72 | static bool do_req(struct request_queue *q, struct virtio_blk *vblk, |
@@ -153,20 +154,37 @@ static int virtblk_ioctl(struct inode *inode, struct file *filp, | |||
153 | (void __user *)data); | 154 | (void __user *)data); |
154 | } | 155 | } |
155 | 156 | ||
157 | /* We provide getgeo only to please some old bootloader/partitioning tools */ | ||
158 | static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo) | ||
159 | { | ||
160 | /* some standard values, similar to sd */ | ||
161 | geo->heads = 1 << 6; | ||
162 | geo->sectors = 1 << 5; | ||
163 | geo->cylinders = get_capacity(bd->bd_disk) >> 11; | ||
164 | return 0; | ||
165 | } | ||
166 | |||
156 | static struct block_device_operations virtblk_fops = { | 167 | static struct block_device_operations virtblk_fops = { |
157 | .ioctl = virtblk_ioctl, | 168 | .ioctl = virtblk_ioctl, |
158 | .owner = THIS_MODULE, | 169 | .owner = THIS_MODULE, |
170 | .getgeo = virtblk_getgeo, | ||
159 | }; | 171 | }; |
160 | 172 | ||
173 | static int index_to_minor(int index) | ||
174 | { | ||
175 | return index << PART_BITS; | ||
176 | } | ||
177 | |||
161 | static int virtblk_probe(struct virtio_device *vdev) | 178 | static int virtblk_probe(struct virtio_device *vdev) |
162 | { | 179 | { |
163 | struct virtio_blk *vblk; | 180 | struct virtio_blk *vblk; |
164 | int err, major; | 181 | int err; |
165 | void *token; | ||
166 | unsigned int len; | ||
167 | u64 cap; | 182 | u64 cap; |
168 | u32 v; | 183 | u32 v; |
169 | 184 | ||
185 | if (index_to_minor(index) >= 1 << MINORBITS) | ||
186 | return -ENOSPC; | ||
187 | |||
170 | vdev->priv = vblk = kmalloc(sizeof(*vblk), GFP_KERNEL); | 188 | vdev->priv = vblk = kmalloc(sizeof(*vblk), GFP_KERNEL); |
171 | if (!vblk) { | 189 | if (!vblk) { |
172 | err = -ENOMEM; | 190 | err = -ENOMEM; |
@@ -178,7 +196,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
178 | vblk->vdev = vdev; | 196 | vblk->vdev = vdev; |
179 | 197 | ||
180 | /* We expect one virtqueue, for output. */ | 198 | /* We expect one virtqueue, for output. */ |
181 | vblk->vq = vdev->config->find_vq(vdev, blk_done); | 199 | vblk->vq = vdev->config->find_vq(vdev, 0, blk_done); |
182 | if (IS_ERR(vblk->vq)) { | 200 | if (IS_ERR(vblk->vq)) { |
183 | err = PTR_ERR(vblk->vq); | 201 | err = PTR_ERR(vblk->vq); |
184 | goto out_free_vblk; | 202 | goto out_free_vblk; |
@@ -190,17 +208,11 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
190 | goto out_free_vq; | 208 | goto out_free_vq; |
191 | } | 209 | } |
192 | 210 | ||
193 | major = register_blkdev(0, "virtblk"); | ||
194 | if (major < 0) { | ||
195 | err = major; | ||
196 | goto out_mempool; | ||
197 | } | ||
198 | |||
199 | /* FIXME: How many partitions? How long is a piece of string? */ | 211 | /* FIXME: How many partitions? How long is a piece of string? */ |
200 | vblk->disk = alloc_disk(1 << 4); | 212 | vblk->disk = alloc_disk(1 << PART_BITS); |
201 | if (!vblk->disk) { | 213 | if (!vblk->disk) { |
202 | err = -ENOMEM; | 214 | err = -ENOMEM; |
203 | goto out_unregister_blkdev; | 215 | goto out_mempool; |
204 | } | 216 | } |
205 | 217 | ||
206 | vblk->disk->queue = blk_init_queue(do_virtblk_request, &vblk->lock); | 218 | vblk->disk->queue = blk_init_queue(do_virtblk_request, &vblk->lock); |
@@ -209,22 +221,32 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
209 | goto out_put_disk; | 221 | goto out_put_disk; |
210 | } | 222 | } |
211 | 223 | ||
212 | sprintf(vblk->disk->disk_name, "vd%c", virtblk_index++); | 224 | if (index < 26) { |
225 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); | ||
226 | } else if (index < (26 + 1) * 26) { | ||
227 | sprintf(vblk->disk->disk_name, "vd%c%c", | ||
228 | 'a' + index / 26 - 1, 'a' + index % 26); | ||
229 | } else { | ||
230 | const unsigned int m1 = (index / 26 - 1) / 26 - 1; | ||
231 | const unsigned int m2 = (index / 26 - 1) % 26; | ||
232 | const unsigned int m3 = index % 26; | ||
233 | sprintf(vblk->disk->disk_name, "vd%c%c%c", | ||
234 | 'a' + m1, 'a' + m2, 'a' + m3); | ||
235 | } | ||
236 | |||
213 | vblk->disk->major = major; | 237 | vblk->disk->major = major; |
214 | vblk->disk->first_minor = 0; | 238 | vblk->disk->first_minor = index_to_minor(index); |
215 | vblk->disk->private_data = vblk; | 239 | vblk->disk->private_data = vblk; |
216 | vblk->disk->fops = &virtblk_fops; | 240 | vblk->disk->fops = &virtblk_fops; |
241 | index++; | ||
217 | 242 | ||
218 | /* If barriers are supported, tell block layer that queue is ordered */ | 243 | /* If barriers are supported, tell block layer that queue is ordered */ |
219 | token = vdev->config->find(vdev, VIRTIO_CONFIG_BLK_F, &len); | 244 | if (vdev->config->feature(vdev, VIRTIO_BLK_F_BARRIER)) |
220 | if (virtio_use_bit(vdev, token, len, VIRTIO_BLK_F_BARRIER)) | ||
221 | blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL); | 245 | blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL); |
222 | 246 | ||
223 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap); | 247 | /* Host must always specify the capacity. */ |
224 | if (err) { | 248 | __virtio_config_val(vdev, offsetof(struct virtio_blk_config, capacity), |
225 | dev_err(&vdev->dev, "Bad/missing capacity in config\n"); | 249 | &cap); |
226 | goto out_cleanup_queue; | ||
227 | } | ||
228 | 250 | ||
229 | /* If capacity is too big, truncate with warning. */ | 251 | /* If capacity is too big, truncate with warning. */ |
230 | if ((sector_t)cap != cap) { | 252 | if ((sector_t)cap != cap) { |
@@ -234,31 +256,25 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
234 | } | 256 | } |
235 | set_capacity(vblk->disk, cap); | 257 | set_capacity(vblk->disk, cap); |
236 | 258 | ||
237 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SIZE_MAX, &v); | 259 | /* Host can optionally specify maximum segment size and number of |
260 | * segments. */ | ||
261 | err = virtio_config_val(vdev, VIRTIO_BLK_F_SIZE_MAX, | ||
262 | offsetof(struct virtio_blk_config, size_max), | ||
263 | &v); | ||
238 | if (!err) | 264 | if (!err) |
239 | blk_queue_max_segment_size(vblk->disk->queue, v); | 265 | blk_queue_max_segment_size(vblk->disk->queue, v); |
240 | else if (err != -ENOENT) { | ||
241 | dev_err(&vdev->dev, "Bad SIZE_MAX in config\n"); | ||
242 | goto out_cleanup_queue; | ||
243 | } | ||
244 | 266 | ||
245 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v); | 267 | err = virtio_config_val(vdev, VIRTIO_BLK_F_SEG_MAX, |
268 | offsetof(struct virtio_blk_config, seg_max), | ||
269 | &v); | ||
246 | if (!err) | 270 | if (!err) |
247 | blk_queue_max_hw_segments(vblk->disk->queue, v); | 271 | blk_queue_max_hw_segments(vblk->disk->queue, v); |
248 | else if (err != -ENOENT) { | ||
249 | dev_err(&vdev->dev, "Bad SEG_MAX in config\n"); | ||
250 | goto out_cleanup_queue; | ||
251 | } | ||
252 | 272 | ||
253 | add_disk(vblk->disk); | 273 | add_disk(vblk->disk); |
254 | return 0; | 274 | return 0; |
255 | 275 | ||
256 | out_cleanup_queue: | ||
257 | blk_cleanup_queue(vblk->disk->queue); | ||
258 | out_put_disk: | 276 | out_put_disk: |
259 | put_disk(vblk->disk); | 277 | put_disk(vblk->disk); |
260 | out_unregister_blkdev: | ||
261 | unregister_blkdev(major, "virtblk"); | ||
262 | out_mempool: | 278 | out_mempool: |
263 | mempool_destroy(vblk->pool); | 279 | mempool_destroy(vblk->pool); |
264 | out_free_vq: | 280 | out_free_vq: |
@@ -274,12 +290,16 @@ static void virtblk_remove(struct virtio_device *vdev) | |||
274 | struct virtio_blk *vblk = vdev->priv; | 290 | struct virtio_blk *vblk = vdev->priv; |
275 | int major = vblk->disk->major; | 291 | int major = vblk->disk->major; |
276 | 292 | ||
293 | /* Nothing should be pending. */ | ||
277 | BUG_ON(!list_empty(&vblk->reqs)); | 294 | BUG_ON(!list_empty(&vblk->reqs)); |
295 | |||
296 | /* Stop all the virtqueues. */ | ||
297 | vdev->config->reset(vdev); | ||
298 | |||
278 | blk_cleanup_queue(vblk->disk->queue); | 299 | blk_cleanup_queue(vblk->disk->queue); |
279 | put_disk(vblk->disk); | 300 | put_disk(vblk->disk); |
280 | unregister_blkdev(major, "virtblk"); | 301 | unregister_blkdev(major, "virtblk"); |
281 | mempool_destroy(vblk->pool); | 302 | mempool_destroy(vblk->pool); |
282 | /* There should be nothing in the queue now, so no need to shutdown */ | ||
283 | vdev->config->del_vq(vblk->vq); | 303 | vdev->config->del_vq(vblk->vq); |
284 | kfree(vblk); | 304 | kfree(vblk); |
285 | } | 305 | } |
@@ -299,11 +319,15 @@ static struct virtio_driver virtio_blk = { | |||
299 | 319 | ||
300 | static int __init init(void) | 320 | static int __init init(void) |
301 | { | 321 | { |
322 | major = register_blkdev(0, "virtblk"); | ||
323 | if (major < 0) | ||
324 | return major; | ||
302 | return register_virtio_driver(&virtio_blk); | 325 | return register_virtio_driver(&virtio_blk); |
303 | } | 326 | } |
304 | 327 | ||
305 | static void __exit fini(void) | 328 | static void __exit fini(void) |
306 | { | 329 | { |
330 | unregister_blkdev(major, "virtblk"); | ||
307 | unregister_virtio_driver(&virtio_blk); | 331 | unregister_virtio_driver(&virtio_blk); |
308 | } | 332 | } |
309 | module_init(init); | 333 | module_init(init); |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 08f48d577aba..dade1626865b 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -383,7 +383,7 @@ static void btuart_change_speed(btuart_info_t *info, unsigned int speed) | |||
383 | outb(lcr, iobase + UART_LCR); /* Set 8N1 */ | 383 | outb(lcr, iobase + UART_LCR); /* Set 8N1 */ |
384 | outb(fcr, iobase + UART_FCR); /* Enable FIFO's */ | 384 | outb(fcr, iobase + UART_FCR); /* Enable FIFO's */ |
385 | 385 | ||
386 | /* Turn on interrups */ | 386 | /* Turn on interrupts */ |
387 | outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER); | 387 | outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER); |
388 | 388 | ||
389 | spin_unlock_irqrestore(&(info->lock), flags); | 389 | spin_unlock_irqrestore(&(info->lock), flags); |
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c index e8d50af58201..ef5e6b130c48 100644 --- a/drivers/char/drm/drm_vm.c +++ b/drivers/char/drm/drm_vm.c | |||
@@ -506,6 +506,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) | |||
506 | vma->vm_ops = &drm_vm_dma_ops; | 506 | vma->vm_ops = &drm_vm_dma_ops; |
507 | 507 | ||
508 | vma->vm_flags |= VM_RESERVED; /* Don't swap */ | 508 | vma->vm_flags |= VM_RESERVED; /* Don't swap */ |
509 | vma->vm_flags |= VM_DONTEXPAND; | ||
509 | 510 | ||
510 | vma->vm_file = filp; /* Needed for drm_vm_open() */ | 511 | vma->vm_file = filp; /* Needed for drm_vm_open() */ |
511 | drm_vm_open_locked(vma); | 512 | drm_vm_open_locked(vma); |
@@ -655,6 +656,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) | |||
655 | return -EINVAL; /* This should never happen. */ | 656 | return -EINVAL; /* This should never happen. */ |
656 | } | 657 | } |
657 | vma->vm_flags |= VM_RESERVED; /* Don't swap */ | 658 | vma->vm_flags |= VM_RESERVED; /* Don't swap */ |
659 | vma->vm_flags |= VM_DONTEXPAND; | ||
658 | 660 | ||
659 | vma->vm_file = filp; /* Needed for drm_vm_open() */ | 661 | vma->vm_file = filp; /* Needed for drm_vm_open() */ |
660 | drm_vm_open_locked(vma); | 662 | drm_vm_open_locked(vma); |
diff --git a/drivers/char/drm/r300_reg.h b/drivers/char/drm/r300_reg.h index 3ae57ecc7afd..fa194a46c1e4 100644 --- a/drivers/char/drm/r300_reg.h +++ b/drivers/char/drm/r300_reg.h | |||
@@ -584,7 +584,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
584 | #define R300_RE_FOG_START 0x4298 | 584 | #define R300_RE_FOG_START 0x4298 |
585 | 585 | ||
586 | /* Not sure why there are duplicate of factor and constant values. | 586 | /* Not sure why there are duplicate of factor and constant values. |
587 | * My best guess so far is that there are seperate zbiases for test and write. | 587 | * My best guess so far is that there are separate zbiases for test and write. |
588 | * Ordering might be wrong. | 588 | * Ordering might be wrong. |
589 | * Some of the tests indicate that fgl has a fallback implementation of zbias | 589 | * Some of the tests indicate that fgl has a fallback implementation of zbias |
590 | * via pixel shaders. | 590 | * via pixel shaders. |
diff --git a/drivers/char/drm/via_dma.c b/drivers/char/drm/via_dma.c index 75d6b748c2c0..7009dbddac43 100644 --- a/drivers/char/drm/via_dma.c +++ b/drivers/char/drm/via_dma.c | |||
@@ -400,7 +400,7 @@ static inline uint32_t *via_align_buffer(drm_via_private_t * dev_priv, | |||
400 | } | 400 | } |
401 | 401 | ||
402 | /* | 402 | /* |
403 | * This function is used internally by ring buffer mangement code. | 403 | * This function is used internally by ring buffer management code. |
404 | * | 404 | * |
405 | * Returns virtual pointer to ring buffer. | 405 | * Returns virtual pointer to ring buffer. |
406 | */ | 406 | */ |
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c index 004141d535a2..49233f589874 100644 --- a/drivers/char/efirtc.c +++ b/drivers/char/efirtc.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * | 18 | * |
19 | * NOTES: | 19 | * NOTES: |
20 | * - Locking is required for safe execution of EFI calls with regards | 20 | * - Locking is required for safe execution of EFI calls with regards |
21 | * to interrrupts and SMP. | 21 | * to interrupts and SMP. |
22 | * | 22 | * |
23 | * TODO (December 1999): | 23 | * TODO (December 1999): |
24 | * - provide the API to set/get the WakeUp Alarm (different from the | 24 | * - provide the API to set/get the WakeUp Alarm (different from the |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index ffcecde9e2a5..ffd747c5dff0 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -1797,7 +1797,7 @@ static unsigned termios2digi_c(struct channel *ch, unsigned cflag) | |||
1797 | res |= cflag & ((CBAUD ^ CBAUDEX) | PARODD | PARENB | CSTOPB | CSIZE); | 1797 | res |= cflag & ((CBAUD ^ CBAUDEX) | PARODD | PARENB | CSTOPB | CSIZE); |
1798 | /* | 1798 | /* |
1799 | * This gets a little confusing. The Digi cards have their own | 1799 | * This gets a little confusing. The Digi cards have their own |
1800 | * representation of c_cflags controling baud rate. For the most part | 1800 | * representation of c_cflags controlling baud rate. For the most part |
1801 | * this is identical to the Linux implementation. However; Digi | 1801 | * this is identical to the Linux implementation. However; Digi |
1802 | * supports one rate (76800) that Linux doesn't. This means that the | 1802 | * supports one rate (76800) that Linux doesn't. This means that the |
1803 | * c_cflag entry that would normally mean 76800 for Digi actually means | 1803 | * c_cflag entry that would normally mean 76800 for Digi actually means |
@@ -2068,7 +2068,7 @@ static int info_ioctl(struct tty_struct *tty, struct file *file, | |||
2068 | { | 2068 | { |
2069 | /* | 2069 | /* |
2070 | * This call is made by the apps to complete the | 2070 | * This call is made by the apps to complete the |
2071 | * initilization of the board(s). This routine is | 2071 | * initialization of the board(s). This routine is |
2072 | * responsible for setting the card to its initial | 2072 | * responsible for setting the card to its initial |
2073 | * state and setting the drivers control fields to the | 2073 | * state and setting the drivers control fields to the |
2074 | * sutianle settings for the card in question. | 2074 | * sutianle settings for the card in question. |
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c index 0e8ceea5ea78..712d9f271aa6 100644 --- a/drivers/char/hangcheck-timer.c +++ b/drivers/char/hangcheck-timer.c | |||
@@ -26,7 +26,7 @@ | |||
26 | * The hangcheck-timer driver uses the TSC to catch delays that | 26 | * The hangcheck-timer driver uses the TSC to catch delays that |
27 | * jiffies does not notice. A timer is set. When the timer fires, it | 27 | * jiffies does not notice. A timer is set. When the timer fires, it |
28 | * checks whether it was delayed and if that delay exceeds a given | 28 | * checks whether it was delayed and if that delay exceeds a given |
29 | * margin of error. The hangcheck_tick module paramter takes the timer | 29 | * margin of error. The hangcheck_tick module parameter takes the timer |
30 | * duration in seconds. The hangcheck_margin parameter defines the | 30 | * duration in seconds. The hangcheck_margin parameter defines the |
31 | * margin of error, in seconds. The defaults are 60 seconds for the | 31 | * margin of error, in seconds. The defaults are 60 seconds for the |
32 | * timer and 180 seconds for the margin of error. IOW, a timer is set | 32 | * timer and 180 seconds for the margin of error. IOW, a timer is set |
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index fd7559084b82..3402def22007 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -838,7 +838,7 @@ static int __devexit hvcs_remove(struct vio_dev *dev) | |||
838 | if (!hvcsd) | 838 | if (!hvcsd) |
839 | return -ENODEV; | 839 | return -ENODEV; |
840 | 840 | ||
841 | /* By this time the vty-server won't be getting any more interrups */ | 841 | /* By this time the vty-server won't be getting any more interrupts */ |
842 | 842 | ||
843 | spin_lock_irqsave(&hvcsd->lock, flags); | 843 | spin_lock_irqsave(&hvcsd->lock, flags); |
844 | 844 | ||
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c index e46120d05b68..d6567b32fb5c 100644 --- a/drivers/char/ip2/i2lib.c +++ b/drivers/char/ip2/i2lib.c | |||
@@ -661,7 +661,7 @@ i2QueueCommands(int type, i2ChanStrPtr pCh, int timeout, int nCommands, | |||
661 | if (!in_interrupt()) { | 661 | if (!in_interrupt()) { |
662 | schedule_timeout_interruptible(1); // short nap | 662 | schedule_timeout_interruptible(1); // short nap |
663 | } else { | 663 | } else { |
664 | // we cannot sched/sleep in interrrupt silly | 664 | // we cannot sched/sleep in interrupt silly |
665 | return 0; | 665 | return 0; |
666 | } | 666 | } |
667 | if (signal_pending(current)) { | 667 | if (signal_pending(current)) { |
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index e04e66cf2c68..0f49ccf02a7f 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -1251,7 +1251,7 @@ ip2_poll(unsigned long arg) | |||
1251 | 1251 | ||
1252 | // Just polled boards, IRQ = 0 will hit all non-interrupt boards. | 1252 | // Just polled boards, IRQ = 0 will hit all non-interrupt boards. |
1253 | // It will NOT poll boards handled by hard interrupts. | 1253 | // It will NOT poll boards handled by hard interrupts. |
1254 | // The issue of queued BH interrups is handled in ip2_interrupt(). | 1254 | // The issue of queued BH interrupts is handled in ip2_interrupt(). |
1255 | ip2_polled_interrupt(); | 1255 | ip2_polled_interrupt(); |
1256 | 1256 | ||
1257 | PollTimer.expires = POLL_TIMEOUT; | 1257 | PollTimer.expires = POLL_TIMEOUT; |
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c index 82f2e27dca7d..ff146c2b08fd 100644 --- a/drivers/char/mspec.c +++ b/drivers/char/mspec.c | |||
@@ -283,7 +283,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma, | |||
283 | vdata->refcnt = ATOMIC_INIT(1); | 283 | vdata->refcnt = ATOMIC_INIT(1); |
284 | vma->vm_private_data = vdata; | 284 | vma->vm_private_data = vdata; |
285 | 285 | ||
286 | vma->vm_flags |= (VM_IO | VM_RESERVED | VM_PFNMAP); | 286 | vma->vm_flags |= (VM_IO | VM_RESERVED | VM_PFNMAP | VM_DONTEXPAND); |
287 | if (vdata->type == MSPEC_FETCHOP || vdata->type == MSPEC_UNCACHED) | 287 | if (vdata->type == MSPEC_FETCHOP || vdata->type == MSPEC_UNCACHED) |
288 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 288 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
289 | vma->vm_ops = &mspec_vm_ops; | 289 | vma->vm_ops = &mspec_vm_ops; |
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index 6076e662886a..dfaab2322de3 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * nozomi.c -- HSDPA driver Broadband Wireless Data Card - Globe Trotter | 2 | * nozomi.c -- HSDPA driver Broadband Wireless Data Card - Globe Trotter |
3 | * | 3 | * |
4 | * Written by: Ulf Jakobsson, | 4 | * Written by: Ulf Jakobsson, |
5 | * Jan �erfeldt, | 5 | * Jan Åkerfeldt, |
6 | * Stefan Thomasson, | 6 | * Stefan Thomasson, |
7 | * | 7 | * |
8 | * Maintained by: Paul Hardwick (p.hardwick@option.com) | 8 | * Maintained by: Paul Hardwick (p.hardwick@option.com) |
@@ -38,60 +38,6 @@ | |||
38 | * -------------------------------------------------------------------------- | 38 | * -------------------------------------------------------------------------- |
39 | */ | 39 | */ |
40 | 40 | ||
41 | /* | ||
42 | * CHANGELOG | ||
43 | * Version 2.1d | ||
44 | * 11-November-2007 Jiri Slaby, Frank Seidel | ||
45 | * - Big rework of multicard support by Jiri | ||
46 | * - Major cleanups (semaphore to mutex, endianess, no major reservation) | ||
47 | * - Optimizations | ||
48 | * | ||
49 | * Version 2.1c | ||
50 | * 30-October-2007 Frank Seidel | ||
51 | * - Completed multicard support | ||
52 | * - Minor cleanups | ||
53 | * | ||
54 | * Version 2.1b | ||
55 | * 07-August-2007 Frank Seidel | ||
56 | * - Minor cleanups | ||
57 | * - theoretical multicard support | ||
58 | * | ||
59 | * Version 2.1 | ||
60 | * 03-July-2006 Paul Hardwick | ||
61 | * | ||
62 | * - Stability Improvements. Incorporated spinlock wraps patch. | ||
63 | * - Updated for newer 2.6.14+ kernels (tty_buffer_request_room) | ||
64 | * - using __devexit macro for tty | ||
65 | * | ||
66 | * | ||
67 | * Version 2.0 | ||
68 | * 08-feb-2006 15:34:10:Ulf | ||
69 | * | ||
70 | * -Fixed issue when not waking up line disipine layer, could probably result | ||
71 | * in better uplink performance for 2.4. | ||
72 | * | ||
73 | * -Fixed issue with big endian during initalization, now proper toggle flags | ||
74 | * are handled between preloader and maincode. | ||
75 | * | ||
76 | * -Fixed flow control issue. | ||
77 | * | ||
78 | * -Added support for setting DTR. | ||
79 | * | ||
80 | * -For 2.4 kernels, removing temporary buffer that's not needed. | ||
81 | * | ||
82 | * -Reading CTS only for modem port (only port that supports it). | ||
83 | * | ||
84 | * -Return 0 in write_room instead of netative value, it's not handled in | ||
85 | * upper layer. | ||
86 | * | ||
87 | * -------------------------------------------------------------------------- | ||
88 | * Version 1.0 | ||
89 | * | ||
90 | * First version of driver, only tested with card of type F32_2. | ||
91 | * Works fine with 2.4 and 2.6 kernels. | ||
92 | * Driver also support big endian architecture. | ||
93 | */ | ||
94 | |||
95 | /* Enable this to have a lot of debug printouts */ | 41 | /* Enable this to have a lot of debug printouts */ |
96 | #define DEBUG | 42 | #define DEBUG |
97 | 43 | ||
@@ -143,8 +89,9 @@ do { \ | |||
143 | /* Do we need this settable at runtime? */ | 89 | /* Do we need this settable at runtime? */ |
144 | static int debug = NOZOMI_DEBUG_LEVEL; | 90 | static int debug = NOZOMI_DEBUG_LEVEL; |
145 | 91 | ||
146 | #define D(lvl, args...) do {if (lvl & debug) NFO(KERN_DEBUG, ##args); } \ | 92 | #define D(lvl, args...) do \ |
147 | while (0) | 93 | {if (lvl & debug) NFO(KERN_DEBUG, ##args); } \ |
94 | while (0) | ||
148 | #define D_(lvl, args...) D(lvl, ##args) | 95 | #define D_(lvl, args...) D(lvl, ##args) |
149 | 96 | ||
150 | /* These printouts are always printed */ | 97 | /* These printouts are always printed */ |
@@ -273,13 +220,13 @@ enum port_type { | |||
273 | /* Big endian */ | 220 | /* Big endian */ |
274 | 221 | ||
275 | struct toggles { | 222 | struct toggles { |
276 | unsigned enabled:5; /* | 223 | unsigned int enabled:5; /* |
277 | * Toggle fields are valid if enabled is 0, | 224 | * Toggle fields are valid if enabled is 0, |
278 | * else A-channels must always be used. | 225 | * else A-channels must always be used. |
279 | */ | 226 | */ |
280 | unsigned diag_dl:1; | 227 | unsigned int diag_dl:1; |
281 | unsigned mdm_dl:1; | 228 | unsigned int mdm_dl:1; |
282 | unsigned mdm_ul:1; | 229 | unsigned int mdm_ul:1; |
283 | } __attribute__ ((packed)); | 230 | } __attribute__ ((packed)); |
284 | 231 | ||
285 | /* Configuration table to read at startup of card */ | 232 | /* Configuration table to read at startup of card */ |
@@ -320,19 +267,19 @@ struct config_table { | |||
320 | /* This stores all control downlink flags */ | 267 | /* This stores all control downlink flags */ |
321 | struct ctrl_dl { | 268 | struct ctrl_dl { |
322 | u8 port; | 269 | u8 port; |
323 | unsigned reserved:4; | 270 | unsigned int reserved:4; |
324 | unsigned CTS:1; | 271 | unsigned int CTS:1; |
325 | unsigned RI:1; | 272 | unsigned int RI:1; |
326 | unsigned DCD:1; | 273 | unsigned int DCD:1; |
327 | unsigned DSR:1; | 274 | unsigned int DSR:1; |
328 | } __attribute__ ((packed)); | 275 | } __attribute__ ((packed)); |
329 | 276 | ||
330 | /* This stores all control uplink flags */ | 277 | /* This stores all control uplink flags */ |
331 | struct ctrl_ul { | 278 | struct ctrl_ul { |
332 | u8 port; | 279 | u8 port; |
333 | unsigned reserved:6; | 280 | unsigned int reserved:6; |
334 | unsigned RTS:1; | 281 | unsigned int RTS:1; |
335 | unsigned DTR:1; | 282 | unsigned int DTR:1; |
336 | } __attribute__ ((packed)); | 283 | } __attribute__ ((packed)); |
337 | 284 | ||
338 | #else | 285 | #else |
@@ -340,10 +287,10 @@ struct ctrl_ul { | |||
340 | 287 | ||
341 | /* This represents the toggle information */ | 288 | /* This represents the toggle information */ |
342 | struct toggles { | 289 | struct toggles { |
343 | unsigned mdm_ul:1; | 290 | unsigned int mdm_ul:1; |
344 | unsigned mdm_dl:1; | 291 | unsigned int mdm_dl:1; |
345 | unsigned diag_dl:1; | 292 | unsigned int diag_dl:1; |
346 | unsigned enabled:5; /* | 293 | unsigned int enabled:5; /* |
347 | * Toggle fields are valid if enabled is 0, | 294 | * Toggle fields are valid if enabled is 0, |
348 | * else A-channels must always be used. | 295 | * else A-channels must always be used. |
349 | */ | 296 | */ |
@@ -379,19 +326,19 @@ struct config_table { | |||
379 | 326 | ||
380 | /* This stores all control downlink flags */ | 327 | /* This stores all control downlink flags */ |
381 | struct ctrl_dl { | 328 | struct ctrl_dl { |
382 | unsigned DSR:1; | 329 | unsigned int DSR:1; |
383 | unsigned DCD:1; | 330 | unsigned int DCD:1; |
384 | unsigned RI:1; | 331 | unsigned int RI:1; |
385 | unsigned CTS:1; | 332 | unsigned int CTS:1; |
386 | unsigned reserverd:4; | 333 | unsigned int reserverd:4; |
387 | u8 port; | 334 | u8 port; |
388 | } __attribute__ ((packed)); | 335 | } __attribute__ ((packed)); |
389 | 336 | ||
390 | /* This stores all control uplink flags */ | 337 | /* This stores all control uplink flags */ |
391 | struct ctrl_ul { | 338 | struct ctrl_ul { |
392 | unsigned DTR:1; | 339 | unsigned int DTR:1; |
393 | unsigned RTS:1; | 340 | unsigned int RTS:1; |
394 | unsigned reserved:6; | 341 | unsigned int reserved:6; |
395 | u8 port; | 342 | u8 port; |
396 | } __attribute__ ((packed)); | 343 | } __attribute__ ((packed)); |
397 | #endif | 344 | #endif |
@@ -448,7 +395,7 @@ struct buffer { | |||
448 | } __attribute__ ((packed)); | 395 | } __attribute__ ((packed)); |
449 | 396 | ||
450 | /* Global variables */ | 397 | /* Global variables */ |
451 | static struct pci_device_id nozomi_pci_tbl[] = { | 398 | static const struct pci_device_id nozomi_pci_tbl[] __devinitconst = { |
452 | {PCI_DEVICE(VENDOR1, DEVICE1)}, | 399 | {PCI_DEVICE(VENDOR1, DEVICE1)}, |
453 | {}, | 400 | {}, |
454 | }; | 401 | }; |
@@ -524,12 +471,12 @@ out: | |||
524 | * -Optimize | 471 | * -Optimize |
525 | * -Rewrite cleaner | 472 | * -Rewrite cleaner |
526 | */ | 473 | */ |
527 | static u32 write_mem32(void __iomem *mem_addr_start, u32 *buf, | 474 | static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf, |
528 | u32 size_bytes) | 475 | u32 size_bytes) |
529 | { | 476 | { |
530 | u32 i = 0; | 477 | u32 i = 0; |
531 | u32 *ptr = (__force u32 *) mem_addr_start; | 478 | u32 *ptr = (__force u32 *) mem_addr_start; |
532 | u16 *buf16; | 479 | const u16 *buf16; |
533 | 480 | ||
534 | if (unlikely(!ptr || !buf)) | 481 | if (unlikely(!ptr || !buf)) |
535 | return 0; | 482 | return 0; |
@@ -537,7 +484,7 @@ static u32 write_mem32(void __iomem *mem_addr_start, u32 *buf, | |||
537 | /* shortcut for extremely often used cases */ | 484 | /* shortcut for extremely often used cases */ |
538 | switch (size_bytes) { | 485 | switch (size_bytes) { |
539 | case 2: /* 2 bytes */ | 486 | case 2: /* 2 bytes */ |
540 | buf16 = (u16 *) buf; | 487 | buf16 = (const u16 *)buf; |
541 | writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); | 488 | writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); |
542 | return 2; | 489 | return 2; |
543 | break; | 490 | break; |
@@ -554,7 +501,7 @@ static u32 write_mem32(void __iomem *mem_addr_start, u32 *buf, | |||
554 | while (i < size_bytes) { | 501 | while (i < size_bytes) { |
555 | if (size_bytes - i == 2) { | 502 | if (size_bytes - i == 2) { |
556 | /* 2 bytes */ | 503 | /* 2 bytes */ |
557 | buf16 = (u16 *) buf; | 504 | buf16 = (const u16 *)buf; |
558 | writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); | 505 | writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); |
559 | i += 2; | 506 | i += 2; |
560 | } else { | 507 | } else { |
@@ -694,7 +641,7 @@ static void dump_table(const struct nozomi *dc) | |||
694 | dc->config_table.ul_ctrl_len); | 641 | dc->config_table.ul_ctrl_len); |
695 | } | 642 | } |
696 | #else | 643 | #else |
697 | static __inline__ void dump_table(const struct nozomi *dc) { } | 644 | static inline void dump_table(const struct nozomi *dc) { } |
698 | #endif | 645 | #endif |
699 | 646 | ||
700 | /* | 647 | /* |
@@ -776,8 +723,7 @@ static int nozomi_read_config_table(struct nozomi *dc) | |||
776 | /* Enable uplink interrupts */ | 723 | /* Enable uplink interrupts */ |
777 | static void enable_transmit_ul(enum port_type port, struct nozomi *dc) | 724 | static void enable_transmit_ul(enum port_type port, struct nozomi *dc) |
778 | { | 725 | { |
779 | u16 mask[NOZOMI_MAX_PORTS] = \ | 726 | static const u16 mask[] = {MDM_UL, DIAG_UL, APP1_UL, APP2_UL, CTRL_UL}; |
780 | {MDM_UL, DIAG_UL, APP1_UL, APP2_UL, CTRL_UL}; | ||
781 | 727 | ||
782 | if (port < NOZOMI_MAX_PORTS) { | 728 | if (port < NOZOMI_MAX_PORTS) { |
783 | dc->last_ier |= mask[port]; | 729 | dc->last_ier |= mask[port]; |
@@ -790,8 +736,8 @@ static void enable_transmit_ul(enum port_type port, struct nozomi *dc) | |||
790 | /* Disable uplink interrupts */ | 736 | /* Disable uplink interrupts */ |
791 | static void disable_transmit_ul(enum port_type port, struct nozomi *dc) | 737 | static void disable_transmit_ul(enum port_type port, struct nozomi *dc) |
792 | { | 738 | { |
793 | u16 mask[NOZOMI_MAX_PORTS] = \ | 739 | static const u16 mask[] = |
794 | {~MDM_UL, ~DIAG_UL, ~APP1_UL, ~APP2_UL, ~CTRL_UL}; | 740 | {~MDM_UL, ~DIAG_UL, ~APP1_UL, ~APP2_UL, ~CTRL_UL}; |
795 | 741 | ||
796 | if (port < NOZOMI_MAX_PORTS) { | 742 | if (port < NOZOMI_MAX_PORTS) { |
797 | dc->last_ier &= mask[port]; | 743 | dc->last_ier &= mask[port]; |
@@ -804,8 +750,7 @@ static void disable_transmit_ul(enum port_type port, struct nozomi *dc) | |||
804 | /* Enable downlink interrupts */ | 750 | /* Enable downlink interrupts */ |
805 | static void enable_transmit_dl(enum port_type port, struct nozomi *dc) | 751 | static void enable_transmit_dl(enum port_type port, struct nozomi *dc) |
806 | { | 752 | { |
807 | u16 mask[NOZOMI_MAX_PORTS] = \ | 753 | static const u16 mask[] = {MDM_DL, DIAG_DL, APP1_DL, APP2_DL, CTRL_DL}; |
808 | {MDM_DL, DIAG_DL, APP1_DL, APP2_DL, CTRL_DL}; | ||
809 | 754 | ||
810 | if (port < NOZOMI_MAX_PORTS) { | 755 | if (port < NOZOMI_MAX_PORTS) { |
811 | dc->last_ier |= mask[port]; | 756 | dc->last_ier |= mask[port]; |
@@ -818,8 +763,8 @@ static void enable_transmit_dl(enum port_type port, struct nozomi *dc) | |||
818 | /* Disable downlink interrupts */ | 763 | /* Disable downlink interrupts */ |
819 | static void disable_transmit_dl(enum port_type port, struct nozomi *dc) | 764 | static void disable_transmit_dl(enum port_type port, struct nozomi *dc) |
820 | { | 765 | { |
821 | u16 mask[NOZOMI_MAX_PORTS] = \ | 766 | static const u16 mask[] = |
822 | {~MDM_DL, ~DIAG_DL, ~APP1_DL, ~APP2_DL, ~CTRL_DL}; | 767 | {~MDM_DL, ~DIAG_DL, ~APP1_DL, ~APP2_DL, ~CTRL_DL}; |
823 | 768 | ||
824 | if (port < NOZOMI_MAX_PORTS) { | 769 | if (port < NOZOMI_MAX_PORTS) { |
825 | dc->last_ier &= mask[port]; | 770 | dc->last_ier &= mask[port]; |
@@ -833,13 +778,13 @@ static void disable_transmit_dl(enum port_type port, struct nozomi *dc) | |||
833 | * Return 1 - send buffer to card and ack. | 778 | * Return 1 - send buffer to card and ack. |
834 | * Return 0 - don't ack, don't send buffer to card. | 779 | * Return 0 - don't ack, don't send buffer to card. |
835 | */ | 780 | */ |
836 | static int send_data(enum port_type index, struct nozomi *dc) | 781 | static int send_data(enum port_type index, const struct nozomi *dc) |
837 | { | 782 | { |
838 | u32 size = 0; | 783 | u32 size = 0; |
839 | struct port *port = &dc->port[index]; | 784 | const struct port *port = &dc->port[index]; |
840 | u8 toggle = port->toggle_ul; | 785 | const u8 toggle = port->toggle_ul; |
841 | void __iomem *addr = port->ul_addr[toggle]; | 786 | void __iomem *addr = port->ul_addr[toggle]; |
842 | u32 ul_size = port->ul_size[toggle]; | 787 | const u32 ul_size = port->ul_size[toggle]; |
843 | struct tty_struct *tty = port->tty; | 788 | struct tty_struct *tty = port->tty; |
844 | 789 | ||
845 | /* Get data from tty and place in buf for now */ | 790 | /* Get data from tty and place in buf for now */ |
@@ -1102,7 +1047,7 @@ static int send_flow_control(struct nozomi *dc) | |||
1102 | } | 1047 | } |
1103 | 1048 | ||
1104 | /* | 1049 | /* |
1105 | * Handle donlink data, ports that are handled are modem and diagnostics | 1050 | * Handle downlink data, ports that are handled are modem and diagnostics |
1106 | * Return 1 - ok | 1051 | * Return 1 - ok |
1107 | * Return 0 - toggle fields are out of sync | 1052 | * Return 0 - toggle fields are out of sync |
1108 | */ | 1053 | */ |
@@ -1359,20 +1304,20 @@ static void nozomi_setup_private_data(struct nozomi *dc) | |||
1359 | static ssize_t card_type_show(struct device *dev, struct device_attribute *attr, | 1304 | static ssize_t card_type_show(struct device *dev, struct device_attribute *attr, |
1360 | char *buf) | 1305 | char *buf) |
1361 | { | 1306 | { |
1362 | struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); | 1307 | const struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); |
1363 | 1308 | ||
1364 | return sprintf(buf, "%d\n", dc->card_type); | 1309 | return sprintf(buf, "%d\n", dc->card_type); |
1365 | } | 1310 | } |
1366 | static DEVICE_ATTR(card_type, 0444, card_type_show, NULL); | 1311 | static DEVICE_ATTR(card_type, S_IRUGO, card_type_show, NULL); |
1367 | 1312 | ||
1368 | static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr, | 1313 | static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr, |
1369 | char *buf) | 1314 | char *buf) |
1370 | { | 1315 | { |
1371 | struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); | 1316 | const struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); |
1372 | 1317 | ||
1373 | return sprintf(buf, "%u\n", dc->open_ttys); | 1318 | return sprintf(buf, "%u\n", dc->open_ttys); |
1374 | } | 1319 | } |
1375 | static DEVICE_ATTR(open_ttys, 0444, open_ttys_show, NULL); | 1320 | static DEVICE_ATTR(open_ttys, S_IRUGO, open_ttys_show, NULL); |
1376 | 1321 | ||
1377 | static void make_sysfs_files(struct nozomi *dc) | 1322 | static void make_sysfs_files(struct nozomi *dc) |
1378 | { | 1323 | { |
@@ -1735,7 +1680,7 @@ static int ntty_write_room(struct tty_struct *tty) | |||
1735 | { | 1680 | { |
1736 | struct port *port = tty->driver_data; | 1681 | struct port *port = tty->driver_data; |
1737 | int room = 0; | 1682 | int room = 0; |
1738 | struct nozomi *dc = get_dc_by_tty(tty); | 1683 | const struct nozomi *dc = get_dc_by_tty(tty); |
1739 | 1684 | ||
1740 | if (!dc || !port) | 1685 | if (!dc || !port) |
1741 | return 0; | 1686 | return 0; |
@@ -1755,9 +1700,9 @@ exit: | |||
1755 | /* Gets io control parameters */ | 1700 | /* Gets io control parameters */ |
1756 | static int ntty_tiocmget(struct tty_struct *tty, struct file *file) | 1701 | static int ntty_tiocmget(struct tty_struct *tty, struct file *file) |
1757 | { | 1702 | { |
1758 | struct port *port = tty->driver_data; | 1703 | const struct port *port = tty->driver_data; |
1759 | struct ctrl_dl *ctrl_dl = &port->ctrl_dl; | 1704 | const struct ctrl_dl *ctrl_dl = &port->ctrl_dl; |
1760 | struct ctrl_ul *ctrl_ul = &port->ctrl_ul; | 1705 | const struct ctrl_ul *ctrl_ul = &port->ctrl_ul; |
1761 | 1706 | ||
1762 | return (ctrl_ul->RTS ? TIOCM_RTS : 0) | | 1707 | return (ctrl_ul->RTS ? TIOCM_RTS : 0) | |
1763 | (ctrl_ul->DTR ? TIOCM_DTR : 0) | | 1708 | (ctrl_ul->DTR ? TIOCM_DTR : 0) | |
@@ -1787,7 +1732,7 @@ static int ntty_tiocmset(struct tty_struct *tty, struct file *file, | |||
1787 | static int ntty_cflags_changed(struct port *port, unsigned long flags, | 1732 | static int ntty_cflags_changed(struct port *port, unsigned long flags, |
1788 | struct async_icount *cprev) | 1733 | struct async_icount *cprev) |
1789 | { | 1734 | { |
1790 | struct async_icount cnow = port->tty_icount; | 1735 | const struct async_icount cnow = port->tty_icount; |
1791 | int ret; | 1736 | int ret; |
1792 | 1737 | ||
1793 | ret = ((flags & TIOCM_RNG) && (cnow.rng != cprev->rng)) || | 1738 | ret = ((flags & TIOCM_RNG) && (cnow.rng != cprev->rng)) || |
@@ -1802,7 +1747,7 @@ static int ntty_cflags_changed(struct port *port, unsigned long flags, | |||
1802 | 1747 | ||
1803 | static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp) | 1748 | static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp) |
1804 | { | 1749 | { |
1805 | struct async_icount cnow = port->tty_icount; | 1750 | const struct async_icount cnow = port->tty_icount; |
1806 | struct serial_icounter_struct icount; | 1751 | struct serial_icounter_struct icount; |
1807 | 1752 | ||
1808 | icount.cts = cnow.cts; | 1753 | icount.cts = cnow.cts; |
@@ -1882,7 +1827,10 @@ static void ntty_throttle(struct tty_struct *tty) | |||
1882 | /* just to discard single character writes */ | 1827 | /* just to discard single character writes */ |
1883 | static void ntty_put_char(struct tty_struct *tty, unsigned char c) | 1828 | static void ntty_put_char(struct tty_struct *tty, unsigned char c) |
1884 | { | 1829 | { |
1885 | /* FIXME !!! */ | 1830 | /* |
1831 | * card does not react correct when we write single chars | ||
1832 | * to the card, so we discard them | ||
1833 | */ | ||
1886 | DBG2("PUT CHAR Function: %c", c); | 1834 | DBG2("PUT CHAR Function: %c", c); |
1887 | } | 1835 | } |
1888 | 1836 | ||
@@ -1910,7 +1858,7 @@ exit_in_buffer: | |||
1910 | return rval; | 1858 | return rval; |
1911 | } | 1859 | } |
1912 | 1860 | ||
1913 | static struct tty_operations tty_ops = { | 1861 | static const struct tty_operations tty_ops = { |
1914 | .ioctl = ntty_ioctl, | 1862 | .ioctl = ntty_ioctl, |
1915 | .open = ntty_open, | 1863 | .open = ntty_open, |
1916 | .close = ntty_close, | 1864 | .close = ntty_close, |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 905d1f51a7bf..d010ed95ed3b 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -1544,7 +1544,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info ) | |||
1544 | 1544 | ||
1545 | /* mgsl_isr_misc() | 1545 | /* mgsl_isr_misc() |
1546 | * | 1546 | * |
1547 | * Service a miscellaneos interrupt source. | 1547 | * Service a miscellaneous interrupt source. |
1548 | * | 1548 | * |
1549 | * Arguments: info pointer to device extension (instance data) | 1549 | * Arguments: info pointer to device extension (instance data) |
1550 | * Return Value: None | 1550 | * Return Value: None |
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index 5422f999636f..ce5ebe3b168f 100644 --- a/drivers/char/toshiba.c +++ b/drivers/char/toshiba.c | |||
@@ -505,7 +505,7 @@ static int __init toshiba_init(void) | |||
505 | if (tosh_probe()) | 505 | if (tosh_probe()) |
506 | return -ENODEV; | 506 | return -ENODEV; |
507 | 507 | ||
508 | printk(KERN_INFO "Toshiba System Managment Mode driver v" TOSH_VERSION "\n"); | 508 | printk(KERN_INFO "Toshiba System Management Mode driver v" TOSH_VERSION "\n"); |
509 | 509 | ||
510 | /* set the port to use for Fn status if not specified as a parameter */ | 510 | /* set the port to use for Fn status if not specified as a parameter */ |
511 | if (tosh_fn==0x00) | 511 | if (tosh_fn==0x00) |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index e34da5c97196..dc17fe3a88bc 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -158,13 +158,13 @@ static int __devinit virtcons_probe(struct virtio_device *dev) | |||
158 | /* Find the input queue. */ | 158 | /* Find the input queue. */ |
159 | /* FIXME: This is why we want to wean off hvc: we do nothing | 159 | /* FIXME: This is why we want to wean off hvc: we do nothing |
160 | * when input comes in. */ | 160 | * when input comes in. */ |
161 | in_vq = vdev->config->find_vq(vdev, NULL); | 161 | in_vq = vdev->config->find_vq(vdev, 0, NULL); |
162 | if (IS_ERR(in_vq)) { | 162 | if (IS_ERR(in_vq)) { |
163 | err = PTR_ERR(in_vq); | 163 | err = PTR_ERR(in_vq); |
164 | goto free; | 164 | goto free; |
165 | } | 165 | } |
166 | 166 | ||
167 | out_vq = vdev->config->find_vq(vdev, NULL); | 167 | out_vq = vdev->config->find_vq(vdev, 1, NULL); |
168 | if (IS_ERR(out_vq)) { | 168 | if (IS_ERR(out_vq)) { |
169 | err = PTR_ERR(out_vq); | 169 | err = PTR_ERR(out_vq); |
170 | goto free_in_vq; | 170 | goto free_in_vq; |
diff --git a/drivers/dio/dio-driver.c b/drivers/dio/dio-driver.c index e4c48e329367..8cd8507b1a8a 100644 --- a/drivers/dio/dio-driver.c +++ b/drivers/dio/dio-driver.c | |||
@@ -15,16 +15,15 @@ | |||
15 | #include <linux/dio.h> | 15 | #include <linux/dio.h> |
16 | 16 | ||
17 | 17 | ||
18 | /** | 18 | /** |
19 | * dio_match_device - Tell if a DIO device structure has a matching | 19 | * dio_match_device - Tell if a DIO device structure has a matching DIO device id structure |
20 | * DIO device id structure | 20 | * @ids: array of DIO device id structures to search in |
21 | * @ids: array of DIO device id structures to search in | 21 | * @d: the DIO device structure to match against |
22 | * @dev: the DIO device structure to match against | 22 | * |
23 | * | 23 | * Used by a driver to check whether a DIO device present in the |
24 | * Used by a driver to check whether a DIO device present in the | 24 | * system is in its list of supported devices. Returns the matching |
25 | * system is in its list of supported devices. Returns the matching | 25 | * dio_device_id structure or %NULL if there is no match. |
26 | * dio_device_id structure or %NULL if there is no match. | 26 | */ |
27 | */ | ||
28 | 27 | ||
29 | const struct dio_device_id * | 28 | const struct dio_device_id * |
30 | dio_match_device(const struct dio_device_id *ids, | 29 | dio_match_device(const struct dio_device_id *ids, |
@@ -66,13 +65,13 @@ static int dio_device_probe(struct device *dev) | |||
66 | } | 65 | } |
67 | 66 | ||
68 | 67 | ||
69 | /** | 68 | /** |
70 | * dio_register_driver - register a new DIO driver | 69 | * dio_register_driver - register a new DIO driver |
71 | * @drv: the driver structure to register | 70 | * @drv: the driver structure to register |
72 | * | 71 | * |
73 | * Adds the driver structure to the list of registered drivers | 72 | * Adds the driver structure to the list of registered drivers |
74 | * Returns zero or a negative error value. | 73 | * Returns zero or a negative error value. |
75 | */ | 74 | */ |
76 | 75 | ||
77 | int dio_register_driver(struct dio_driver *drv) | 76 | int dio_register_driver(struct dio_driver *drv) |
78 | { | 77 | { |
@@ -85,15 +84,15 @@ int dio_register_driver(struct dio_driver *drv) | |||
85 | } | 84 | } |
86 | 85 | ||
87 | 86 | ||
88 | /** | 87 | /** |
89 | * dio_unregister_driver - unregister a DIO driver | 88 | * dio_unregister_driver - unregister a DIO driver |
90 | * @drv: the driver structure to unregister | 89 | * @drv: the driver structure to unregister |
91 | * | 90 | * |
92 | * Deletes the driver structure from the list of registered DIO drivers, | 91 | * Deletes the driver structure from the list of registered DIO drivers, |
93 | * gives it a chance to clean up by calling its remove() function for | 92 | * gives it a chance to clean up by calling its remove() function for |
94 | * each device it was responsible for, and marks those devices as | 93 | * each device it was responsible for, and marks those devices as |
95 | * driverless. | 94 | * driverless. |
96 | */ | 95 | */ |
97 | 96 | ||
98 | void dio_unregister_driver(struct dio_driver *drv) | 97 | void dio_unregister_driver(struct dio_driver *drv) |
99 | { | 98 | { |
@@ -101,16 +100,15 @@ void dio_unregister_driver(struct dio_driver *drv) | |||
101 | } | 100 | } |
102 | 101 | ||
103 | 102 | ||
104 | /** | 103 | /** |
105 | * dio_bus_match - Tell if a DIO device structure has a matching DIO | 104 | * dio_bus_match - Tell if a DIO device structure has a matching DIO device id structure |
106 | * device id structure | 105 | * @dev: the DIO device structure to match against |
107 | * @ids: array of DIO device id structures to search in | 106 | * @drv: the &device_driver that points to the array of DIO device id structures to search |
108 | * @dev: the DIO device structure to match against | 107 | * |
109 | * | 108 | * Used by a driver to check whether a DIO device present in the |
110 | * Used by a driver to check whether a DIO device present in the | 109 | * system is in its list of supported devices. Returns the matching |
111 | * system is in its list of supported devices. Returns the matching | 110 | * dio_device_id structure or %NULL if there is no match. |
112 | * dio_device_id structure or %NULL if there is no match. | 111 | */ |
113 | */ | ||
114 | 112 | ||
115 | static int dio_bus_match(struct device *dev, struct device_driver *drv) | 113 | static int dio_bus_match(struct device *dev, struct device_driver *drv) |
116 | { | 114 | { |
diff --git a/drivers/edac/edac_pci.c b/drivers/edac/edac_pci.c index 5dee9f50414b..e0b47b74ec45 100644 --- a/drivers/edac/edac_pci.c +++ b/drivers/edac/edac_pci.c | |||
@@ -73,7 +73,7 @@ EXPORT_SYMBOL_GPL(edac_pci_alloc_ctl_info); | |||
73 | * | 73 | * |
74 | * Last action on the pci control structure. | 74 | * Last action on the pci control structure. |
75 | * | 75 | * |
76 | * call the remove sysfs informaton, which will unregister | 76 | * call the remove sysfs information, which will unregister |
77 | * this control struct's kobj. When that kobj's ref count | 77 | * this control struct's kobj. When that kobj's ref count |
78 | * goes to zero, its release function will be call and then | 78 | * goes to zero, its release function will be call and then |
79 | * kfree() the memory. | 79 | * kfree() the memory. |
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c index a1f24c42d5ff..5a852017c17a 100644 --- a/drivers/edac/i5000_edac.c +++ b/drivers/edac/i5000_edac.c | |||
@@ -351,7 +351,7 @@ struct i5000_pvt { | |||
351 | u16 b1_ambpresent0; /* Branch 1, Channel 8 */ | 351 | u16 b1_ambpresent0; /* Branch 1, Channel 8 */ |
352 | u16 b1_ambpresent1; /* Branch 1, Channel 1 */ | 352 | u16 b1_ambpresent1; /* Branch 1, Channel 1 */ |
353 | 353 | ||
354 | /* DIMM infomation matrix, allocating architecture maximums */ | 354 | /* DIMM information matrix, allocating architecture maximums */ |
355 | struct i5000_dimm_info dimm_info[MAX_CSROWS][MAX_CHANNELS]; | 355 | struct i5000_dimm_info dimm_info[MAX_CSROWS][MAX_CHANNELS]; |
356 | 356 | ||
357 | /* Actual values for this controller */ | 357 | /* Actual values for this controller */ |
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c index d168223db159..744011989044 100644 --- a/drivers/firmware/edd.c +++ b/drivers/firmware/edd.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * | 11 | * |
12 | * This code takes information provided by BIOS EDD calls | 12 | * This code takes information provided by BIOS EDD calls |
13 | * fn41 - Check Extensions Present and | 13 | * fn41 - Check Extensions Present and |
14 | * fn48 - Get Device Parametes with EDD extensions | 14 | * fn48 - Get Device Parameters with EDD extensions |
15 | * made in setup.S, copied to safe structures in setup.c, | 15 | * made in setup.S, copied to safe structures in setup.c, |
16 | * and presents it in sysfs. | 16 | * and presents it in sysfs. |
17 | * | 17 | * |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index e42a465f5717..45b26ed351cf 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -216,8 +216,7 @@ config BLK_DEV_IDECD_VERBOSE_ERRORS | |||
216 | memory, though. | 216 | memory, though. |
217 | 217 | ||
218 | config BLK_DEV_IDETAPE | 218 | config BLK_DEV_IDETAPE |
219 | tristate "Include IDE/ATAPI TAPE support (EXPERIMENTAL)" | 219 | tristate "Include IDE/ATAPI TAPE support" |
220 | depends on EXPERIMENTAL | ||
221 | help | 220 | help |
222 | If you have an IDE tape drive using the ATAPI protocol, say Y. | 221 | If you have an IDE tape drive using the ATAPI protocol, say Y. |
223 | ATAPI is a newer protocol used by IDE tape and CD-ROM drives, | 222 | ATAPI is a newer protocol used by IDE tape and CD-ROM drives, |
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c index 037300fa284c..0e7574c0ee60 100644 --- a/drivers/ide/arm/bast-ide.c +++ b/drivers/ide/arm/bast-ide.c | |||
@@ -28,8 +28,10 @@ static int __init | |||
28 | bastide_register(unsigned int base, unsigned int aux, int irq, | 28 | bastide_register(unsigned int base, unsigned int aux, int irq, |
29 | ide_hwif_t **hwif) | 29 | ide_hwif_t **hwif) |
30 | { | 30 | { |
31 | ide_hwif_t *hwif; | ||
31 | hw_regs_t hw; | 32 | hw_regs_t hw; |
32 | int i; | 33 | int i; |
34 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
33 | 35 | ||
34 | memset(&hw, 0, sizeof(hw)); | 36 | memset(&hw, 0, sizeof(hw)); |
35 | 37 | ||
@@ -44,8 +46,24 @@ bastide_register(unsigned int base, unsigned int aux, int irq, | |||
44 | hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); | 46 | hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); |
45 | hw.irq = irq; | 47 | hw.irq = irq; |
46 | 48 | ||
47 | ide_register_hw(&hw, NULL, hwif); | 49 | hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
50 | if (hwif == NULL) | ||
51 | goto out; | ||
48 | 52 | ||
53 | i = hwif->index; | ||
54 | |||
55 | if (hwif->present) | ||
56 | ide_unregister(i, 0, 0); | ||
57 | else if (!hwif->hold) | ||
58 | ide_init_port_data(hwif, i); | ||
59 | |||
60 | ide_init_port_hw(hwif, &hw); | ||
61 | hwif->quirkproc = NULL; | ||
62 | |||
63 | idx[0] = i; | ||
64 | |||
65 | ide_device_add(idx, NULL); | ||
66 | out: | ||
49 | return 0; | 67 | return 0; |
50 | } | 68 | } |
51 | 69 | ||
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 8d2cc47a362e..fb00f3827ecd 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -377,9 +377,6 @@ static void icside_dma_lost_irq(ide_drive_t *drive) | |||
377 | 377 | ||
378 | static void icside_dma_init(ide_hwif_t *hwif) | 378 | static void icside_dma_init(ide_hwif_t *hwif) |
379 | { | 379 | { |
380 | hwif->mwdma_mask = 7; /* MW0..2 */ | ||
381 | hwif->swdma_mask = 7; /* SW0..2 */ | ||
382 | |||
383 | hwif->dmatable_cpu = NULL; | 380 | hwif->dmatable_cpu = NULL; |
384 | hwif->dmatable_dma = 0; | 381 | hwif->dmatable_dma = 0; |
385 | hwif->set_dma_mode = icside_set_dma_mode; | 382 | hwif->set_dma_mode = icside_set_dma_mode; |
@@ -459,11 +456,19 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
459 | 456 | ||
460 | idx[0] = hwif->index; | 457 | idx[0] = hwif->index; |
461 | 458 | ||
462 | ide_device_add(idx); | 459 | ide_device_add(idx, NULL); |
463 | 460 | ||
464 | return 0; | 461 | return 0; |
465 | } | 462 | } |
466 | 463 | ||
464 | static const struct ide_port_info icside_v6_port_info __initdata = { | ||
465 | .host_flags = IDE_HFLAG_SERIALIZE | | ||
466 | IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ | ||
467 | IDE_HFLAG_NO_AUTOTUNE, | ||
468 | .mwdma_mask = ATA_MWDMA2, | ||
469 | .swdma_mask = ATA_SWDMA2, | ||
470 | }; | ||
471 | |||
467 | static int __init | 472 | static int __init |
468 | icside_register_v6(struct icside_state *state, struct expansion_card *ec) | 473 | icside_register_v6(struct icside_state *state, struct expansion_card *ec) |
469 | { | 474 | { |
@@ -472,6 +477,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
472 | unsigned int sel = 0; | 477 | unsigned int sel = 0; |
473 | int ret; | 478 | int ret; |
474 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 479 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
480 | struct ide_port_info d = icside_v6_port_info; | ||
475 | 481 | ||
476 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); | 482 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
477 | if (!ioc_base) { | 483 | if (!ioc_base) { |
@@ -521,30 +527,25 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
521 | state->hwif[1] = mate; | 527 | state->hwif[1] = mate; |
522 | 528 | ||
523 | hwif->maskproc = icside_maskproc; | 529 | hwif->maskproc = icside_maskproc; |
524 | hwif->channel = 0; | ||
525 | hwif->hwif_data = state; | 530 | hwif->hwif_data = state; |
526 | hwif->mate = mate; | ||
527 | hwif->serialized = 1; | ||
528 | hwif->config_data = (unsigned long)ioc_base; | 531 | hwif->config_data = (unsigned long)ioc_base; |
529 | hwif->select_data = sel; | 532 | hwif->select_data = sel; |
530 | 533 | ||
531 | mate->maskproc = icside_maskproc; | 534 | mate->maskproc = icside_maskproc; |
532 | mate->channel = 1; | ||
533 | mate->hwif_data = state; | 535 | mate->hwif_data = state; |
534 | mate->mate = hwif; | ||
535 | mate->serialized = 1; | ||
536 | mate->config_data = (unsigned long)ioc_base; | 536 | mate->config_data = (unsigned long)ioc_base; |
537 | mate->select_data = sel | 1; | 537 | mate->select_data = sel | 1; |
538 | 538 | ||
539 | if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { | 539 | if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { |
540 | icside_dma_init(hwif); | 540 | icside_dma_init(hwif); |
541 | icside_dma_init(mate); | 541 | icside_dma_init(mate); |
542 | } | 542 | } else |
543 | d.mwdma_mask = d.swdma_mask = 0; | ||
543 | 544 | ||
544 | idx[0] = hwif->index; | 545 | idx[0] = hwif->index; |
545 | idx[1] = mate->index; | 546 | idx[1] = mate->index; |
546 | 547 | ||
547 | ide_device_add(idx); | 548 | ide_device_add(idx, &d); |
548 | 549 | ||
549 | return 0; | 550 | return 0; |
550 | 551 | ||
diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c index 60f2497542c0..43a70e91363e 100644 --- a/drivers/ide/arm/ide_arm.c +++ b/drivers/ide/arm/ide_arm.c | |||
@@ -39,7 +39,7 @@ static int __init ide_arm_init(void) | |||
39 | ide_init_port_hw(hwif, &hw); | 39 | ide_init_port_hw(hwif, &hw); |
40 | idx[0] = hwif->index; | 40 | idx[0] = hwif->index; |
41 | 41 | ||
42 | ide_device_add(idx); | 42 | ide_device_add(idx, NULL); |
43 | } | 43 | } |
44 | 44 | ||
45 | return 0; | 45 | return 0; |
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c index c8b6581e624e..efba00d2fc37 100644 --- a/drivers/ide/arm/rapide.c +++ b/drivers/ide/arm/rapide.c | |||
@@ -58,7 +58,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
58 | 58 | ||
59 | idx[0] = hwif->index; | 59 | idx[0] = hwif->index; |
60 | 60 | ||
61 | ide_device_add(idx); | 61 | ide_device_add(idx, NULL); |
62 | 62 | ||
63 | ecard_set_drvdata(ec, hwif); | 63 | ecard_set_drvdata(ec, hwif); |
64 | goto out; | 64 | goto out; |
@@ -76,7 +76,7 @@ static void __devexit rapide_remove(struct expansion_card *ec) | |||
76 | 76 | ||
77 | ecard_set_drvdata(ec, NULL); | 77 | ecard_set_drvdata(ec, NULL); |
78 | 78 | ||
79 | ide_unregister(hwif->index); | 79 | ide_unregister(hwif->index, 0, 0); |
80 | 80 | ||
81 | ecard_release_resources(ec); | 81 | ecard_release_resources(ec); |
82 | } | 82 | } |
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 0640a38ff127..00587a8c2ba1 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
@@ -753,6 +753,15 @@ static void cris_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
753 | cris_ide_set_speed(TYPE_DMA, 0, strobe, hold); | 753 | cris_ide_set_speed(TYPE_DMA, 0, strobe, hold); |
754 | } | 754 | } |
755 | 755 | ||
756 | static const struct ide_port_info cris_port_info __initdata = { | ||
757 | .chipset = ide_etrax100, | ||
758 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | | ||
759 | IDE_HFLAG_NO_DMA, /* no SFF-style DMA */ | ||
760 | .pio_mask = ATA_PIO4, | ||
761 | .udma_mask = cris_ultra_mask, | ||
762 | .mwdma_mask = ATA_MWDMA2, | ||
763 | }; | ||
764 | |||
756 | static int __init init_e100_ide(void) | 765 | static int __init init_e100_ide(void) |
757 | { | 766 | { |
758 | hw_regs_t hw; | 767 | hw_regs_t hw; |
@@ -780,7 +789,6 @@ static int __init init_e100_ide(void) | |||
780 | ide_init_port_data(hwif, hwif->index); | 789 | ide_init_port_data(hwif, hwif->index); |
781 | ide_init_port_hw(hwif, &hw); | 790 | ide_init_port_hw(hwif, &hw); |
782 | hwif->mmio = 1; | 791 | hwif->mmio = 1; |
783 | hwif->chipset = ide_etrax100; | ||
784 | hwif->set_pio_mode = &cris_set_pio_mode; | 792 | hwif->set_pio_mode = &cris_set_pio_mode; |
785 | hwif->set_dma_mode = &cris_set_dma_mode; | 793 | hwif->set_dma_mode = &cris_set_dma_mode; |
786 | hwif->ata_input_data = &cris_ide_input_data; | 794 | hwif->ata_input_data = &cris_ide_input_data; |
@@ -799,12 +807,6 @@ static int __init init_e100_ide(void) | |||
799 | hwif->INB = &cris_ide_inb; | 807 | hwif->INB = &cris_ide_inb; |
800 | hwif->INW = &cris_ide_inw; | 808 | hwif->INW = &cris_ide_inw; |
801 | hwif->cbl = ATA_CBL_PATA40; | 809 | hwif->cbl = ATA_CBL_PATA40; |
802 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | ||
803 | hwif->pio_mask = ATA_PIO4, | ||
804 | hwif->drives[0].autotune = 1; | ||
805 | hwif->drives[1].autotune = 1; | ||
806 | hwif->ultra_mask = cris_ultra_mask; | ||
807 | hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */ | ||
808 | 810 | ||
809 | idx[h] = hwif->index; | 811 | idx[h] = hwif->index; |
810 | } | 812 | } |
@@ -820,7 +822,7 @@ static int __init init_e100_ide(void) | |||
820 | cris_ide_set_speed(TYPE_DMA, 0, ATA_DMA2_STROBE, ATA_DMA2_HOLD); | 822 | cris_ide_set_speed(TYPE_DMA, 0, ATA_DMA2_STROBE, ATA_DMA2_HOLD); |
821 | cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0); | 823 | cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0); |
822 | 824 | ||
823 | ide_device_add(idx); | 825 | ide_device_add(idx, &cris_port_info); |
824 | 826 | ||
825 | return 0; | 827 | return 0; |
826 | } | 828 | } |
@@ -1032,11 +1034,7 @@ static int cris_dma_setup(ide_drive_t *drive) | |||
1032 | 1034 | ||
1033 | static void cris_dma_exec_cmd(ide_drive_t *drive, u8 command) | 1035 | static void cris_dma_exec_cmd(ide_drive_t *drive, u8 command) |
1034 | { | 1036 | { |
1035 | /* set the irq handler which will finish the request when DMA is done */ | 1037 | ide_execute_command(drive, command, &cris_dma_intr, WAIT_CMD, NULL); |
1036 | ide_set_handler(drive, &cris_dma_intr, WAIT_CMD, NULL); | ||
1037 | |||
1038 | /* issue cmd to drive */ | ||
1039 | cris_ide_outb(command, IDE_COMMAND_REG); | ||
1040 | } | 1038 | } |
1041 | 1039 | ||
1042 | static void cris_dma_start(ide_drive_t *drive) | 1040 | static void cris_dma_start(ide_drive_t *drive) |
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c index 02432958dfe1..520aec075700 100644 --- a/drivers/ide/h8300/ide-h8300.c +++ b/drivers/ide/h8300/ide-h8300.c | |||
@@ -114,7 +114,7 @@ static int __init h8300_ide_init(void) | |||
114 | 114 | ||
115 | idx[0] = index; | 115 | idx[0] = index; |
116 | 116 | ||
117 | ide_device_add(idx); | 117 | ide_device_add(idx, NULL); |
118 | 118 | ||
119 | return 0; | 119 | return 0; |
120 | 120 | ||
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 68bc61844780..25aaeae1e830 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -39,7 +39,6 @@ struct GTM_buffer { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | struct ide_acpi_drive_link { | 41 | struct ide_acpi_drive_link { |
42 | ide_drive_t *drive; | ||
43 | acpi_handle obj_handle; | 42 | acpi_handle obj_handle; |
44 | u8 idbuff[512]; | 43 | u8 idbuff[512]; |
45 | }; | 44 | }; |
@@ -280,16 +279,6 @@ static int do_drive_get_GTF(ide_drive_t *drive, | |||
280 | 279 | ||
281 | port = hwif->channel ? drive->dn - 2: drive->dn; | 280 | port = hwif->channel ? drive->dn - 2: drive->dn; |
282 | 281 | ||
283 | if (!drive->acpidata) { | ||
284 | if (port == 0) { | ||
285 | drive->acpidata = &hwif->acpidata->master; | ||
286 | hwif->acpidata->master.drive = drive; | ||
287 | } else { | ||
288 | drive->acpidata = &hwif->acpidata->slave; | ||
289 | hwif->acpidata->slave.drive = drive; | ||
290 | } | ||
291 | } | ||
292 | |||
293 | DEBPRINT("ENTER: %s at %s, port#: %d, hard_port#: %d\n", | 282 | DEBPRINT("ENTER: %s at %s, port#: %d, hard_port#: %d\n", |
294 | hwif->name, dev->bus_id, port, hwif->channel); | 283 | hwif->name, dev->bus_id, port, hwif->channel); |
295 | 284 | ||
@@ -494,7 +483,6 @@ int ide_acpi_exec_tfs(ide_drive_t *drive) | |||
494 | 483 | ||
495 | return ret; | 484 | return ret; |
496 | } | 485 | } |
497 | EXPORT_SYMBOL_GPL(ide_acpi_exec_tfs); | ||
498 | 486 | ||
499 | /** | 487 | /** |
500 | * ide_acpi_get_timing - get the channel (controller) timings | 488 | * ide_acpi_get_timing - get the channel (controller) timings |
@@ -580,7 +568,6 @@ void ide_acpi_get_timing(ide_hwif_t *hwif) | |||
580 | 568 | ||
581 | kfree(output.pointer); | 569 | kfree(output.pointer); |
582 | } | 570 | } |
583 | EXPORT_SYMBOL_GPL(ide_acpi_get_timing); | ||
584 | 571 | ||
585 | /** | 572 | /** |
586 | * ide_acpi_push_timing - set the channel (controller) timings | 573 | * ide_acpi_push_timing - set the channel (controller) timings |
@@ -634,7 +621,6 @@ void ide_acpi_push_timing(ide_hwif_t *hwif) | |||
634 | } | 621 | } |
635 | DEBPRINT("_STM status: %d\n", status); | 622 | DEBPRINT("_STM status: %d\n", status); |
636 | } | 623 | } |
637 | EXPORT_SYMBOL_GPL(ide_acpi_push_timing); | ||
638 | 624 | ||
639 | /** | 625 | /** |
640 | * ide_acpi_set_state - set the channel power state | 626 | * ide_acpi_set_state - set the channel power state |
@@ -688,11 +674,6 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on) | |||
688 | */ | 674 | */ |
689 | void ide_acpi_init(ide_hwif_t *hwif) | 675 | void ide_acpi_init(ide_hwif_t *hwif) |
690 | { | 676 | { |
691 | int unit; | ||
692 | int err; | ||
693 | struct ide_acpi_drive_link *master; | ||
694 | struct ide_acpi_drive_link *slave; | ||
695 | |||
696 | ide_acpi_blacklist(); | 677 | ide_acpi_blacklist(); |
697 | 678 | ||
698 | hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); | 679 | hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); |
@@ -704,40 +685,38 @@ void ide_acpi_init(ide_hwif_t *hwif) | |||
704 | DEBPRINT("no ACPI object for %s found\n", hwif->name); | 685 | DEBPRINT("no ACPI object for %s found\n", hwif->name); |
705 | kfree(hwif->acpidata); | 686 | kfree(hwif->acpidata); |
706 | hwif->acpidata = NULL; | 687 | hwif->acpidata = NULL; |
707 | return; | ||
708 | } | 688 | } |
689 | } | ||
690 | |||
691 | void ide_acpi_port_init_devices(ide_hwif_t *hwif) | ||
692 | { | ||
693 | ide_drive_t *drive; | ||
694 | int i, err; | ||
695 | |||
696 | if (hwif->acpidata == NULL) | ||
697 | return; | ||
709 | 698 | ||
710 | /* | 699 | /* |
711 | * The ACPI spec mandates that we send information | 700 | * The ACPI spec mandates that we send information |
712 | * for both drives, regardless whether they are connected | 701 | * for both drives, regardless whether they are connected |
713 | * or not. | 702 | * or not. |
714 | */ | 703 | */ |
715 | hwif->acpidata->master.drive = &hwif->drives[0]; | ||
716 | hwif->drives[0].acpidata = &hwif->acpidata->master; | 704 | hwif->drives[0].acpidata = &hwif->acpidata->master; |
717 | master = &hwif->acpidata->master; | ||
718 | |||
719 | hwif->acpidata->slave.drive = &hwif->drives[1]; | ||
720 | hwif->drives[1].acpidata = &hwif->acpidata->slave; | 705 | hwif->drives[1].acpidata = &hwif->acpidata->slave; |
721 | slave = &hwif->acpidata->slave; | ||
722 | |||
723 | 706 | ||
724 | /* | 707 | /* |
725 | * Send IDENTIFY for each drive | 708 | * Send IDENTIFY for each drive |
726 | */ | 709 | */ |
727 | if (master->drive->present) { | 710 | for (i = 0; i < MAX_DRIVES; i++) { |
728 | err = taskfile_lib_get_identify(master->drive, master->idbuff); | 711 | drive = &hwif->drives[i]; |
729 | if (err) { | 712 | |
730 | DEBPRINT("identify device %s failed (%d)\n", | 713 | if (!drive->present) |
731 | master->drive->name, err); | 714 | continue; |
732 | } | ||
733 | } | ||
734 | 715 | ||
735 | if (slave->drive->present) { | 716 | err = taskfile_lib_get_identify(drive, drive->acpidata->idbuff); |
736 | err = taskfile_lib_get_identify(slave->drive, slave->idbuff); | 717 | if (err) |
737 | if (err) { | ||
738 | DEBPRINT("identify device %s failed (%d)\n", | 718 | DEBPRINT("identify device %s failed (%d)\n", |
739 | slave->drive->name, err); | 719 | drive->name, err); |
740 | } | ||
741 | } | 720 | } |
742 | 721 | ||
743 | if (ide_noacpionboot) { | 722 | if (ide_noacpionboot) { |
@@ -753,13 +732,11 @@ void ide_acpi_init(ide_hwif_t *hwif) | |||
753 | ide_acpi_get_timing(hwif); | 732 | ide_acpi_get_timing(hwif); |
754 | ide_acpi_push_timing(hwif); | 733 | ide_acpi_push_timing(hwif); |
755 | 734 | ||
756 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 735 | for (i = 0; i < MAX_DRIVES; i++) { |
757 | ide_drive_t *drive = &hwif->drives[unit]; | 736 | drive = &hwif->drives[i]; |
758 | 737 | ||
759 | if (drive->present) { | 738 | if (drive->present) |
760 | /* Execute ACPI startup code */ | 739 | /* Execute ACPI startup code */ |
761 | ide_acpi_exec_tfs(drive); | 740 | ide_acpi_exec_tfs(drive); |
762 | } | ||
763 | } | 741 | } |
764 | } | 742 | } |
765 | EXPORT_SYMBOL_GPL(ide_acpi_init); | ||
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 23074e84472e..ee4d458e2bbf 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -604,8 +604,6 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive, | |||
604 | * Block read functions. | 604 | * Block read functions. |
605 | */ | 605 | */ |
606 | 606 | ||
607 | typedef void (xfer_func_t)(ide_drive_t *, void *, u32); | ||
608 | |||
609 | static void ide_cd_pad_transfer(ide_drive_t *drive, xfer_func_t *xf, int len) | 607 | static void ide_cd_pad_transfer(ide_drive_t *drive, xfer_func_t *xf, int len) |
610 | { | 608 | { |
611 | while (len > 0) { | 609 | while (len > 0) { |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 7beaf1e9be12..3cf59f2c3928 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -819,6 +819,26 @@ int ide_set_dma(ide_drive_t *drive) | |||
819 | return 0; | 819 | return 0; |
820 | } | 820 | } |
821 | 821 | ||
822 | void ide_check_dma_crc(ide_drive_t *drive) | ||
823 | { | ||
824 | u8 mode; | ||
825 | |||
826 | ide_dma_off_quietly(drive); | ||
827 | drive->crc_count = 0; | ||
828 | mode = drive->current_speed; | ||
829 | /* | ||
830 | * Don't try non Ultra-DMA modes without iCRC's. Force the | ||
831 | * device to PIO and make the user enable SWDMA/MWDMA modes. | ||
832 | */ | ||
833 | if (mode > XFER_UDMA_0 && mode <= XFER_UDMA_7) | ||
834 | mode--; | ||
835 | else | ||
836 | mode = XFER_PIO_4; | ||
837 | ide_set_xfer_rate(drive, mode); | ||
838 | if (drive->current_speed >= XFER_SW_DMA_0) | ||
839 | ide_dma_on(drive); | ||
840 | } | ||
841 | |||
822 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 842 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
823 | void ide_dma_lost_irq (ide_drive_t *drive) | 843 | void ide_dma_lost_irq (ide_drive_t *drive) |
824 | { | 844 | { |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 3512637ae8d4..f8fe6ee128f3 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -4,11 +4,6 @@ | |||
4 | * Copyright (C) 1996-1999 Gadi Oxman <gadio@netvision.net.il> | 4 | * Copyright (C) 1996-1999 Gadi Oxman <gadio@netvision.net.il> |
5 | * Copyright (C) 2000-2002 Paul Bristow <paul@paulbristow.net> | 5 | * Copyright (C) 2000-2002 Paul Bristow <paul@paulbristow.net> |
6 | * Copyright (C) 2005 Bartlomiej Zolnierkiewicz | 6 | * Copyright (C) 2005 Bartlomiej Zolnierkiewicz |
7 | */ | ||
8 | |||
9 | /* | ||
10 | * The driver currently doesn't have any fancy features, just the bare | ||
11 | * minimum read/write support. | ||
12 | * | 7 | * |
13 | * This driver supports the following IDE floppy drives: | 8 | * This driver supports the following IDE floppy drives: |
14 | * | 9 | * |
@@ -20,7 +15,7 @@ | |||
20 | * Documentation/ide/ChangeLog.ide-floppy.1996-2002 | 15 | * Documentation/ide/ChangeLog.ide-floppy.1996-2002 |
21 | */ | 16 | */ |
22 | 17 | ||
23 | #define IDEFLOPPY_VERSION "0.99.newide" | 18 | #define IDEFLOPPY_VERSION "1.00" |
24 | 19 | ||
25 | #include <linux/module.h> | 20 | #include <linux/module.h> |
26 | #include <linux/types.h> | 21 | #include <linux/types.h> |
@@ -42,179 +37,91 @@ | |||
42 | #include <scsi/scsi_ioctl.h> | 37 | #include <scsi/scsi_ioctl.h> |
43 | 38 | ||
44 | #include <asm/byteorder.h> | 39 | #include <asm/byteorder.h> |
45 | #include <asm/irq.h> | 40 | #include <linux/irq.h> |
46 | #include <asm/uaccess.h> | 41 | #include <linux/uaccess.h> |
47 | #include <asm/io.h> | 42 | #include <linux/io.h> |
48 | #include <asm/unaligned.h> | 43 | #include <asm/unaligned.h> |
49 | 44 | ||
50 | /* | 45 | /* define to see debug info */ |
51 | * The following are used to debug the driver. | ||
52 | */ | ||
53 | #define IDEFLOPPY_DEBUG_LOG 0 | 46 | #define IDEFLOPPY_DEBUG_LOG 0 |
54 | #define IDEFLOPPY_DEBUG_INFO 0 | ||
55 | #define IDEFLOPPY_DEBUG_BUGS 1 | ||
56 | 47 | ||
57 | /* #define IDEFLOPPY_DEBUG(fmt, args...) printk(KERN_INFO fmt, ## args) */ | 48 | /* #define IDEFLOPPY_DEBUG(fmt, args...) printk(KERN_INFO fmt, ## args) */ |
58 | #define IDEFLOPPY_DEBUG( fmt, args... ) | 49 | #define IDEFLOPPY_DEBUG(fmt, args...) |
59 | 50 | ||
60 | #if IDEFLOPPY_DEBUG_LOG | 51 | #if IDEFLOPPY_DEBUG_LOG |
61 | #define debug_log printk | 52 | #define debug_log(fmt, args...) \ |
53 | printk(KERN_INFO "ide-floppy: " fmt, ## args) | ||
62 | #else | 54 | #else |
63 | #define debug_log(fmt, args... ) do {} while(0) | 55 | #define debug_log(fmt, args...) do {} while (0) |
64 | #endif | 56 | #endif |
65 | 57 | ||
66 | 58 | ||
67 | /* | 59 | /* Some drives require a longer irq timeout. */ |
68 | * Some drives require a longer irq timeout. | ||
69 | */ | ||
70 | #define IDEFLOPPY_WAIT_CMD (5 * WAIT_CMD) | 60 | #define IDEFLOPPY_WAIT_CMD (5 * WAIT_CMD) |
71 | 61 | ||
72 | /* | 62 | /* |
73 | * After each failed packet command we issue a request sense command | 63 | * After each failed packet command we issue a request sense command and retry |
74 | * and retry the packet command IDEFLOPPY_MAX_PC_RETRIES times. | 64 | * the packet command IDEFLOPPY_MAX_PC_RETRIES times. |
75 | */ | 65 | */ |
76 | #define IDEFLOPPY_MAX_PC_RETRIES 3 | 66 | #define IDEFLOPPY_MAX_PC_RETRIES 3 |
77 | 67 | ||
78 | /* | 68 | /* |
79 | * With each packet command, we allocate a buffer of | 69 | * With each packet command, we allocate a buffer of IDEFLOPPY_PC_BUFFER_SIZE |
80 | * IDEFLOPPY_PC_BUFFER_SIZE bytes. | 70 | * bytes. |
81 | */ | 71 | */ |
82 | #define IDEFLOPPY_PC_BUFFER_SIZE 256 | 72 | #define IDEFLOPPY_PC_BUFFER_SIZE 256 |
83 | 73 | ||
84 | /* | 74 | /* |
85 | * In various places in the driver, we need to allocate storage | 75 | * In various places in the driver, we need to allocate storage for packet |
86 | * for packet commands and requests, which will remain valid while | 76 | * commands and requests, which will remain valid while we leave the driver to |
87 | * we leave the driver to wait for an interrupt or a timeout event. | 77 | * wait for an interrupt or a timeout event. |
88 | */ | 78 | */ |
89 | #define IDEFLOPPY_PC_STACK (10 + IDEFLOPPY_MAX_PC_RETRIES) | 79 | #define IDEFLOPPY_PC_STACK (10 + IDEFLOPPY_MAX_PC_RETRIES) |
90 | 80 | ||
91 | /* | ||
92 | * Our view of a packet command. | ||
93 | */ | ||
94 | typedef struct idefloppy_packet_command_s { | 81 | typedef struct idefloppy_packet_command_s { |
95 | u8 c[12]; /* Actual packet bytes */ | 82 | u8 c[12]; /* Actual packet bytes */ |
96 | int retries; /* On each retry, we increment retries */ | 83 | int retries; /* On each retry, we increment |
84 | retries */ | ||
97 | int error; /* Error code */ | 85 | int error; /* Error code */ |
98 | int request_transfer; /* Bytes to transfer */ | 86 | int request_transfer; /* Bytes to transfer */ |
99 | int actually_transferred; /* Bytes actually transferred */ | 87 | int actually_transferred; /* Bytes actually transferred */ |
100 | int buffer_size; /* Size of our data buffer */ | 88 | int buffer_size; /* Size of our data buffer */ |
101 | int b_count; /* Missing/Available data on the current buffer */ | 89 | int b_count; /* Missing/Available data on |
90 | the current buffer */ | ||
102 | struct request *rq; /* The corresponding request */ | 91 | struct request *rq; /* The corresponding request */ |
103 | u8 *buffer; /* Data buffer */ | 92 | u8 *buffer; /* Data buffer */ |
104 | u8 *current_position; /* Pointer into the above buffer */ | 93 | u8 *current_position; /* Pointer into above buffer */ |
105 | void (*callback) (ide_drive_t *); /* Called when this packet command is completed */ | 94 | void (*callback) (ide_drive_t *); /* Called when this packet |
95 | command is completed */ | ||
106 | u8 pc_buffer[IDEFLOPPY_PC_BUFFER_SIZE]; /* Temporary buffer */ | 96 | u8 pc_buffer[IDEFLOPPY_PC_BUFFER_SIZE]; /* Temporary buffer */ |
107 | unsigned long flags; /* Status/Action bit flags: long for set_bit */ | 97 | unsigned long flags; /* Status/Action bit flags: long |
98 | for set_bit */ | ||
108 | } idefloppy_pc_t; | 99 | } idefloppy_pc_t; |
109 | 100 | ||
110 | /* | 101 | /* Packet command flag bits. */ |
111 | * Packet command flag bits. | 102 | enum { |
112 | */ | 103 | /* 1 when we prefer to use DMA if possible */ |
113 | #define PC_ABORT 0 /* Set when an error is considered normal - We won't retry */ | 104 | PC_FLAG_DMA_RECOMMENDED = (1 << 0), |
114 | #define PC_DMA_RECOMMENDED 2 /* 1 when we prefer to use DMA if possible */ | 105 | /* 1 while DMA in progress */ |
115 | #define PC_DMA_IN_PROGRESS 3 /* 1 while DMA in progress */ | 106 | PC_FLAG_DMA_IN_PROGRESS = (1 << 1), |
116 | #define PC_DMA_ERROR 4 /* 1 when encountered problem during DMA */ | 107 | /* 1 when encountered problem during DMA */ |
117 | #define PC_WRITING 5 /* Data direction */ | 108 | PC_FLAG_DMA_ERROR = (1 << 2), |
118 | 109 | /* Data direction */ | |
119 | #define PC_SUPPRESS_ERROR 6 /* Suppress error reporting */ | 110 | PC_FLAG_WRITING = (1 << 3), |
120 | 111 | /* Suppress error reporting */ | |
121 | /* | 112 | PC_FLAG_SUPPRESS_ERROR = (1 << 4), |
122 | * Removable Block Access Capabilities Page | 113 | }; |
123 | */ | ||
124 | typedef struct { | ||
125 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
126 | unsigned page_code :6; /* Page code - Should be 0x1b */ | ||
127 | unsigned reserved1_6 :1; /* Reserved */ | ||
128 | unsigned ps :1; /* Should be 0 */ | ||
129 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
130 | unsigned ps :1; /* Should be 0 */ | ||
131 | unsigned reserved1_6 :1; /* Reserved */ | ||
132 | unsigned page_code :6; /* Page code - Should be 0x1b */ | ||
133 | #else | ||
134 | #error "Bitfield endianness not defined! Check your byteorder.h" | ||
135 | #endif | ||
136 | u8 page_length; /* Page Length - Should be 0xa */ | ||
137 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
138 | unsigned reserved2 :6; | ||
139 | unsigned srfp :1; /* Supports reporting progress of format */ | ||
140 | unsigned sflp :1; /* System floppy type device */ | ||
141 | unsigned tlun :3; /* Total logical units supported by the device */ | ||
142 | unsigned reserved3 :3; | ||
143 | unsigned sml :1; /* Single / Multiple lun supported */ | ||
144 | unsigned ncd :1; /* Non cd optical device */ | ||
145 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
146 | unsigned sflp :1; /* System floppy type device */ | ||
147 | unsigned srfp :1; /* Supports reporting progress of format */ | ||
148 | unsigned reserved2 :6; | ||
149 | unsigned ncd :1; /* Non cd optical device */ | ||
150 | unsigned sml :1; /* Single / Multiple lun supported */ | ||
151 | unsigned reserved3 :3; | ||
152 | unsigned tlun :3; /* Total logical units supported by the device */ | ||
153 | #else | ||
154 | #error "Bitfield endianness not defined! Check your byteorder.h" | ||
155 | #endif | ||
156 | u8 reserved[8]; | ||
157 | } idefloppy_capabilities_page_t; | ||
158 | |||
159 | /* | ||
160 | * Flexible disk page. | ||
161 | */ | ||
162 | typedef struct { | ||
163 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
164 | unsigned page_code :6; /* Page code - Should be 0x5 */ | ||
165 | unsigned reserved1_6 :1; /* Reserved */ | ||
166 | unsigned ps :1; /* The device is capable of saving the page */ | ||
167 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
168 | unsigned ps :1; /* The device is capable of saving the page */ | ||
169 | unsigned reserved1_6 :1; /* Reserved */ | ||
170 | unsigned page_code :6; /* Page code - Should be 0x5 */ | ||
171 | #else | ||
172 | #error "Bitfield endianness not defined! Check your byteorder.h" | ||
173 | #endif | ||
174 | u8 page_length; /* Page Length - Should be 0x1e */ | ||
175 | u16 transfer_rate; /* In kilobits per second */ | ||
176 | u8 heads, sectors; /* Number of heads, Number of sectors per track */ | ||
177 | u16 sector_size; /* Byes per sector */ | ||
178 | u16 cyls; /* Number of cylinders */ | ||
179 | u8 reserved10[10]; | ||
180 | u8 motor_delay; /* Motor off delay */ | ||
181 | u8 reserved21[7]; | ||
182 | u16 rpm; /* Rotations per minute */ | ||
183 | u8 reserved30[2]; | ||
184 | } idefloppy_flexible_disk_page_t; | ||
185 | |||
186 | /* | ||
187 | * Format capacity | ||
188 | */ | ||
189 | typedef struct { | ||
190 | u8 reserved[3]; | ||
191 | u8 length; /* Length of the following descriptors in bytes */ | ||
192 | } idefloppy_capacity_header_t; | ||
193 | |||
194 | typedef struct { | ||
195 | u32 blocks; /* Number of blocks */ | ||
196 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
197 | unsigned dc :2; /* Descriptor Code */ | ||
198 | unsigned reserved :6; | ||
199 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
200 | unsigned reserved :6; | ||
201 | unsigned dc :2; /* Descriptor Code */ | ||
202 | #else | ||
203 | #error "Bitfield endianness not defined! Check your byteorder.h" | ||
204 | #endif | ||
205 | u8 length_msb; /* Block Length (MSB)*/ | ||
206 | u16 length; /* Block Length */ | ||
207 | } idefloppy_capacity_descriptor_t; | ||
208 | 114 | ||
115 | /* format capacities descriptor codes */ | ||
209 | #define CAPACITY_INVALID 0x00 | 116 | #define CAPACITY_INVALID 0x00 |
210 | #define CAPACITY_UNFORMATTED 0x01 | 117 | #define CAPACITY_UNFORMATTED 0x01 |
211 | #define CAPACITY_CURRENT 0x02 | 118 | #define CAPACITY_CURRENT 0x02 |
212 | #define CAPACITY_NO_CARTRIDGE 0x03 | 119 | #define CAPACITY_NO_CARTRIDGE 0x03 |
213 | 120 | ||
214 | /* | 121 | /* |
215 | * Most of our global data which we need to save even as we leave the | 122 | * Most of our global data which we need to save even as we leave the driver |
216 | * driver due to an interrupt or a timer event is stored in a variable | 123 | * due to an interrupt or a timer event is stored in a variable of type |
217 | * of type idefloppy_floppy_t, defined below. | 124 | * idefloppy_floppy_t, defined below. |
218 | */ | 125 | */ |
219 | typedef struct ide_floppy_obj { | 126 | typedef struct ide_floppy_obj { |
220 | ide_drive_t *drive; | 127 | ide_drive_t *drive; |
@@ -235,23 +142,19 @@ typedef struct ide_floppy_obj { | |||
235 | /* We implement a circular array */ | 142 | /* We implement a circular array */ |
236 | int rq_stack_index; | 143 | int rq_stack_index; |
237 | 144 | ||
238 | /* | 145 | /* Last error information */ |
239 | * Last error information | ||
240 | */ | ||
241 | u8 sense_key, asc, ascq; | 146 | u8 sense_key, asc, ascq; |
242 | /* delay this long before sending packet command */ | 147 | /* delay this long before sending packet command */ |
243 | u8 ticks; | 148 | u8 ticks; |
244 | int progress_indication; | 149 | int progress_indication; |
245 | 150 | ||
246 | /* | 151 | /* Device information */ |
247 | * Device information | ||
248 | */ | ||
249 | /* Current format */ | 152 | /* Current format */ |
250 | int blocks, block_size, bs_factor; | 153 | int blocks, block_size, bs_factor; |
251 | /* Last format capacity */ | 154 | /* Last format capacity descriptor */ |
252 | idefloppy_capacity_descriptor_t capacity; | 155 | u8 cap_desc[8]; |
253 | /* Copy of the flexible disk page */ | 156 | /* Copy of the flexible disk page */ |
254 | idefloppy_flexible_disk_page_t flexible_disk_page; | 157 | u8 flexible_disk_page[32]; |
255 | /* Write protect */ | 158 | /* Write protect */ |
256 | int wp; | 159 | int wp; |
257 | /* Supports format progress report */ | 160 | /* Supports format progress report */ |
@@ -262,64 +165,40 @@ typedef struct ide_floppy_obj { | |||
262 | 165 | ||
263 | #define IDEFLOPPY_TICKS_DELAY HZ/20 /* default delay for ZIP 100 (50ms) */ | 166 | #define IDEFLOPPY_TICKS_DELAY HZ/20 /* default delay for ZIP 100 (50ms) */ |
264 | 167 | ||
265 | /* | 168 | /* Floppy flag bits values. */ |
266 | * Floppy flag bits values. | 169 | enum { |
267 | */ | 170 | /* DRQ interrupt device */ |
268 | #define IDEFLOPPY_DRQ_INTERRUPT 0 /* DRQ interrupt device */ | 171 | IDEFLOPPY_FLAG_DRQ_INTERRUPT = (1 << 0), |
269 | #define IDEFLOPPY_MEDIA_CHANGED 1 /* Media may have changed */ | 172 | /* Media may have changed */ |
270 | #define IDEFLOPPY_USE_READ12 2 /* Use READ12/WRITE12 or READ10/WRITE10 */ | 173 | IDEFLOPPY_FLAG_MEDIA_CHANGED = (1 << 1), |
271 | #define IDEFLOPPY_FORMAT_IN_PROGRESS 3 /* Format in progress */ | 174 | /* Format in progress */ |
272 | #define IDEFLOPPY_CLIK_DRIVE 4 /* Avoid commands not supported in Clik drive */ | 175 | IDEFLOPPY_FLAG_FORMAT_IN_PROGRESS = (1 << 2), |
273 | #define IDEFLOPPY_ZIP_DRIVE 5 /* Requires BH algorithm for packets */ | 176 | /* Avoid commands not supported in Clik drive */ |
274 | 177 | IDEFLOPPY_FLAG_CLIK_DRIVE = (1 << 3), | |
275 | /* | 178 | /* Requires BH algorithm for packets */ |
276 | * ATAPI floppy drive packet commands | 179 | IDEFLOPPY_FLAG_ZIP_DRIVE = (1 << 4), |
277 | */ | 180 | }; |
278 | #define IDEFLOPPY_FORMAT_UNIT_CMD 0x04 | ||
279 | #define IDEFLOPPY_INQUIRY_CMD 0x12 | ||
280 | #define IDEFLOPPY_MODE_SELECT_CMD 0x55 | ||
281 | #define IDEFLOPPY_MODE_SENSE_CMD 0x5a | ||
282 | #define IDEFLOPPY_READ10_CMD 0x28 | ||
283 | #define IDEFLOPPY_READ12_CMD 0xa8 | ||
284 | #define IDEFLOPPY_READ_CAPACITY_CMD 0x23 | ||
285 | #define IDEFLOPPY_REQUEST_SENSE_CMD 0x03 | ||
286 | #define IDEFLOPPY_PREVENT_REMOVAL_CMD 0x1e | ||
287 | #define IDEFLOPPY_SEEK_CMD 0x2b | ||
288 | #define IDEFLOPPY_START_STOP_CMD 0x1b | ||
289 | #define IDEFLOPPY_TEST_UNIT_READY_CMD 0x00 | ||
290 | #define IDEFLOPPY_VERIFY_CMD 0x2f | ||
291 | #define IDEFLOPPY_WRITE10_CMD 0x2a | ||
292 | #define IDEFLOPPY_WRITE12_CMD 0xaa | ||
293 | #define IDEFLOPPY_WRITE_VERIFY_CMD 0x2e | ||
294 | 181 | ||
295 | /* | 182 | /* Defines for the MODE SENSE command */ |
296 | * Defines for the mode sense command | ||
297 | */ | ||
298 | #define MODE_SENSE_CURRENT 0x00 | 183 | #define MODE_SENSE_CURRENT 0x00 |
299 | #define MODE_SENSE_CHANGEABLE 0x01 | 184 | #define MODE_SENSE_CHANGEABLE 0x01 |
300 | #define MODE_SENSE_DEFAULT 0x02 | 185 | #define MODE_SENSE_DEFAULT 0x02 |
301 | #define MODE_SENSE_SAVED 0x03 | 186 | #define MODE_SENSE_SAVED 0x03 |
302 | 187 | ||
303 | /* | 188 | /* IOCTLs used in low-level formatting. */ |
304 | * IOCTLs used in low-level formatting. | ||
305 | */ | ||
306 | |||
307 | #define IDEFLOPPY_IOCTL_FORMAT_SUPPORTED 0x4600 | 189 | #define IDEFLOPPY_IOCTL_FORMAT_SUPPORTED 0x4600 |
308 | #define IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY 0x4601 | 190 | #define IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY 0x4601 |
309 | #define IDEFLOPPY_IOCTL_FORMAT_START 0x4602 | 191 | #define IDEFLOPPY_IOCTL_FORMAT_START 0x4602 |
310 | #define IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS 0x4603 | 192 | #define IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS 0x4603 |
311 | 193 | ||
312 | /* | 194 | /* Error code returned in rq->errors to the higher part of the driver. */ |
313 | * Error codes which are returned in rq->errors to the higher part | ||
314 | * of the driver. | ||
315 | */ | ||
316 | #define IDEFLOPPY_ERROR_GENERAL 101 | 195 | #define IDEFLOPPY_ERROR_GENERAL 101 |
317 | 196 | ||
318 | /* | 197 | /* |
319 | * The following is used to format the general configuration word of | 198 | * The following is used to format the general configuration word of the |
320 | * the ATAPI IDENTIFY DEVICE command. | 199 | * ATAPI IDENTIFY DEVICE command. |
321 | */ | 200 | */ |
322 | struct idefloppy_id_gcw { | 201 | struct idefloppy_id_gcw { |
323 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 202 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
324 | unsigned packet_size :2; /* Packet Size */ | 203 | unsigned packet_size :2; /* Packet Size */ |
325 | unsigned reserved234 :3; /* Reserved */ | 204 | unsigned reserved234 :3; /* Reserved */ |
@@ -342,103 +221,12 @@ struct idefloppy_id_gcw { | |||
342 | }; | 221 | }; |
343 | 222 | ||
344 | /* | 223 | /* |
345 | * INQUIRY packet command - Data Format | 224 | * Pages of the SELECT SENSE / MODE SENSE packet commands. |
346 | */ | 225 | * See SFF-8070i spec. |
347 | typedef struct { | ||
348 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
349 | unsigned device_type :5; /* Peripheral Device Type */ | ||
350 | unsigned reserved0_765 :3; /* Peripheral Qualifier - Reserved */ | ||
351 | unsigned reserved1_6t0 :7; /* Reserved */ | ||
352 | unsigned rmb :1; /* Removable Medium Bit */ | ||
353 | unsigned ansi_version :3; /* ANSI Version */ | ||
354 | unsigned ecma_version :3; /* ECMA Version */ | ||
355 | unsigned iso_version :2; /* ISO Version */ | ||
356 | unsigned response_format :4; /* Response Data Format */ | ||
357 | unsigned reserved3_45 :2; /* Reserved */ | ||
358 | unsigned reserved3_6 :1; /* TrmIOP - Reserved */ | ||
359 | unsigned reserved3_7 :1; /* AENC - Reserved */ | ||
360 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
361 | unsigned reserved0_765 :3; /* Peripheral Qualifier - Reserved */ | ||
362 | unsigned device_type :5; /* Peripheral Device Type */ | ||
363 | unsigned rmb :1; /* Removable Medium Bit */ | ||
364 | unsigned reserved1_6t0 :7; /* Reserved */ | ||
365 | unsigned iso_version :2; /* ISO Version */ | ||
366 | unsigned ecma_version :3; /* ECMA Version */ | ||
367 | unsigned ansi_version :3; /* ANSI Version */ | ||
368 | unsigned reserved3_7 :1; /* AENC - Reserved */ | ||
369 | unsigned reserved3_6 :1; /* TrmIOP - Reserved */ | ||
370 | unsigned reserved3_45 :2; /* Reserved */ | ||
371 | unsigned response_format :4; /* Response Data Format */ | ||
372 | #else | ||
373 | #error "Bitfield endianness not defined! Check your byteorder.h" | ||
374 | #endif | ||
375 | u8 additional_length; /* Additional Length (total_length-4) */ | ||
376 | u8 rsv5, rsv6, rsv7; /* Reserved */ | ||
377 | u8 vendor_id[8]; /* Vendor Identification */ | ||
378 | u8 product_id[16]; /* Product Identification */ | ||
379 | u8 revision_level[4]; /* Revision Level */ | ||
380 | u8 vendor_specific[20]; /* Vendor Specific - Optional */ | ||
381 | u8 reserved56t95[40]; /* Reserved - Optional */ | ||
382 | /* Additional information may be returned */ | ||
383 | } idefloppy_inquiry_result_t; | ||
384 | |||
385 | /* | ||
386 | * REQUEST SENSE packet command result - Data Format. | ||
387 | */ | ||
388 | typedef struct { | ||
389 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
390 | unsigned error_code :7; /* Current error (0x70) */ | ||
391 | unsigned valid :1; /* The information field conforms to SFF-8070i */ | ||
392 | u8 reserved1 :8; /* Reserved */ | ||
393 | unsigned sense_key :4; /* Sense Key */ | ||
394 | unsigned reserved2_4 :1; /* Reserved */ | ||
395 | unsigned ili :1; /* Incorrect Length Indicator */ | ||
396 | unsigned reserved2_67 :2; | ||
397 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
398 | unsigned valid :1; /* The information field conforms to SFF-8070i */ | ||
399 | unsigned error_code :7; /* Current error (0x70) */ | ||
400 | u8 reserved1 :8; /* Reserved */ | ||
401 | unsigned reserved2_67 :2; | ||
402 | unsigned ili :1; /* Incorrect Length Indicator */ | ||
403 | unsigned reserved2_4 :1; /* Reserved */ | ||
404 | unsigned sense_key :4; /* Sense Key */ | ||
405 | #else | ||
406 | #error "Bitfield endianness not defined! Check your byteorder.h" | ||
407 | #endif | ||
408 | u32 information __attribute__ ((packed)); | ||
409 | u8 asl; /* Additional sense length (n-7) */ | ||
410 | u32 command_specific; /* Additional command specific information */ | ||
411 | u8 asc; /* Additional Sense Code */ | ||
412 | u8 ascq; /* Additional Sense Code Qualifier */ | ||
413 | u8 replaceable_unit_code; /* Field Replaceable Unit Code */ | ||
414 | u8 sksv[3]; | ||
415 | u8 pad[2]; /* Padding to 20 bytes */ | ||
416 | } idefloppy_request_sense_result_t; | ||
417 | |||
418 | /* | ||
419 | * Pages of the SELECT SENSE / MODE SENSE packet commands. | ||
420 | */ | 226 | */ |
421 | #define IDEFLOPPY_CAPABILITIES_PAGE 0x1b | 227 | #define IDEFLOPPY_CAPABILITIES_PAGE 0x1b |
422 | #define IDEFLOPPY_FLEXIBLE_DISK_PAGE 0x05 | 228 | #define IDEFLOPPY_FLEXIBLE_DISK_PAGE 0x05 |
423 | 229 | ||
424 | /* | ||
425 | * Mode Parameter Header for the MODE SENSE packet command | ||
426 | */ | ||
427 | typedef struct { | ||
428 | u16 mode_data_length; /* Length of the following data transfer */ | ||
429 | u8 medium_type; /* Medium Type */ | ||
430 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
431 | unsigned reserved3 :7; | ||
432 | unsigned wp :1; /* Write protect */ | ||
433 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
434 | unsigned wp :1; /* Write protect */ | ||
435 | unsigned reserved3 :7; | ||
436 | #else | ||
437 | #error "Bitfield endianness not defined! Check your byteorder.h" | ||
438 | #endif | ||
439 | u8 reserved[4]; | ||
440 | } idefloppy_mode_parameter_header_t; | ||
441 | |||
442 | static DEFINE_MUTEX(idefloppy_ref_mutex); | 230 | static DEFINE_MUTEX(idefloppy_ref_mutex); |
443 | 231 | ||
444 | #define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref) | 232 | #define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref) |
@@ -458,39 +246,35 @@ static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk) | |||
458 | return floppy; | 246 | return floppy; |
459 | } | 247 | } |
460 | 248 | ||
461 | static void ide_floppy_release(struct kref *); | 249 | static void idefloppy_cleanup_obj(struct kref *); |
462 | 250 | ||
463 | static void ide_floppy_put(struct ide_floppy_obj *floppy) | 251 | static void ide_floppy_put(struct ide_floppy_obj *floppy) |
464 | { | 252 | { |
465 | mutex_lock(&idefloppy_ref_mutex); | 253 | mutex_lock(&idefloppy_ref_mutex); |
466 | kref_put(&floppy->kref, ide_floppy_release); | 254 | kref_put(&floppy->kref, idefloppy_cleanup_obj); |
467 | mutex_unlock(&idefloppy_ref_mutex); | 255 | mutex_unlock(&idefloppy_ref_mutex); |
468 | } | 256 | } |
469 | 257 | ||
470 | /* | 258 | /* |
471 | * Too bad. The drive wants to send us data which we are not ready to accept. | 259 | * Too bad. The drive wants to send us data which we are not ready to accept. |
472 | * Just throw it away. | 260 | * Just throw it away. |
473 | */ | 261 | */ |
474 | static void idefloppy_discard_data (ide_drive_t *drive, unsigned int bcount) | 262 | static void idefloppy_discard_data(ide_drive_t *drive, unsigned int bcount) |
475 | { | 263 | { |
476 | while (bcount--) | 264 | while (bcount--) |
477 | (void) HWIF(drive)->INB(IDE_DATA_REG); | 265 | (void) HWIF(drive)->INB(IDE_DATA_REG); |
478 | } | 266 | } |
479 | 267 | ||
480 | #if IDEFLOPPY_DEBUG_BUGS | 268 | static void idefloppy_write_zeros(ide_drive_t *drive, unsigned int bcount) |
481 | static void idefloppy_write_zeros (ide_drive_t *drive, unsigned int bcount) | ||
482 | { | 269 | { |
483 | while (bcount--) | 270 | while (bcount--) |
484 | HWIF(drive)->OUTB(0, IDE_DATA_REG); | 271 | HWIF(drive)->OUTB(0, IDE_DATA_REG); |
485 | } | 272 | } |
486 | #endif /* IDEFLOPPY_DEBUG_BUGS */ | ||
487 | 273 | ||
488 | 274 | ||
489 | /* | 275 | /* |
490 | * idefloppy_do_end_request is used to finish servicing a request. | 276 | * Used to finish servicing a request. For read/write requests, we will call |
491 | * | 277 | * ide_end_request to pass to the next buffer. |
492 | * For read/write requests, we will call ide_end_request to pass to the | ||
493 | * next buffer. | ||
494 | */ | 278 | */ |
495 | static int idefloppy_do_end_request(ide_drive_t *drive, int uptodate, int nsecs) | 279 | static int idefloppy_do_end_request(ide_drive_t *drive, int uptodate, int nsecs) |
496 | { | 280 | { |
@@ -498,12 +282,12 @@ static int idefloppy_do_end_request(ide_drive_t *drive, int uptodate, int nsecs) | |||
498 | struct request *rq = HWGROUP(drive)->rq; | 282 | struct request *rq = HWGROUP(drive)->rq; |
499 | int error; | 283 | int error; |
500 | 284 | ||
501 | debug_log(KERN_INFO "Reached idefloppy_end_request\n"); | 285 | debug_log("Reached %s\n", __func__); |
502 | 286 | ||
503 | switch (uptodate) { | 287 | switch (uptodate) { |
504 | case 0: error = IDEFLOPPY_ERROR_GENERAL; break; | 288 | case 0: error = IDEFLOPPY_ERROR_GENERAL; break; |
505 | case 1: error = 0; break; | 289 | case 1: error = 0; break; |
506 | default: error = uptodate; | 290 | default: error = uptodate; |
507 | } | 291 | } |
508 | if (error) | 292 | if (error) |
509 | floppy->failed_pc = NULL; | 293 | floppy->failed_pc = NULL; |
@@ -521,39 +305,8 @@ static int idefloppy_do_end_request(ide_drive_t *drive, int uptodate, int nsecs) | |||
521 | return 0; | 305 | return 0; |
522 | } | 306 | } |
523 | 307 | ||
524 | static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount) | 308 | static void ide_floppy_io_buffers(ide_drive_t *drive, idefloppy_pc_t *pc, |
525 | { | 309 | unsigned int bcount, int direction) |
526 | struct request *rq = pc->rq; | ||
527 | struct bio_vec *bvec; | ||
528 | struct req_iterator iter; | ||
529 | unsigned long flags; | ||
530 | char *data; | ||
531 | int count, done = 0; | ||
532 | |||
533 | rq_for_each_segment(bvec, rq, iter) { | ||
534 | if (!bcount) | ||
535 | break; | ||
536 | |||
537 | count = min(bvec->bv_len, bcount); | ||
538 | |||
539 | data = bvec_kmap_irq(bvec, &flags); | ||
540 | drive->hwif->atapi_input_bytes(drive, data, count); | ||
541 | bvec_kunmap_irq(data, &flags); | ||
542 | |||
543 | bcount -= count; | ||
544 | pc->b_count += count; | ||
545 | done += count; | ||
546 | } | ||
547 | |||
548 | idefloppy_do_end_request(drive, 1, done >> 9); | ||
549 | |||
550 | if (bcount) { | ||
551 | printk(KERN_ERR "%s: leftover data in idefloppy_input_buffers, bcount == %d\n", drive->name, bcount); | ||
552 | idefloppy_discard_data(drive, bcount); | ||
553 | } | ||
554 | } | ||
555 | |||
556 | static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount) | ||
557 | { | 310 | { |
558 | struct request *rq = pc->rq; | 311 | struct request *rq = pc->rq; |
559 | struct req_iterator iter; | 312 | struct req_iterator iter; |
@@ -569,7 +322,10 @@ static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, un | |||
569 | count = min(bvec->bv_len, bcount); | 322 | count = min(bvec->bv_len, bcount); |
570 | 323 | ||
571 | data = bvec_kmap_irq(bvec, &flags); | 324 | data = bvec_kmap_irq(bvec, &flags); |
572 | drive->hwif->atapi_output_bytes(drive, data, count); | 325 | if (direction) |
326 | drive->hwif->atapi_output_bytes(drive, data, count); | ||
327 | else | ||
328 | drive->hwif->atapi_input_bytes(drive, data, count); | ||
573 | bvec_kunmap_irq(data, &flags); | 329 | bvec_kunmap_irq(data, &flags); |
574 | 330 | ||
575 | bcount -= count; | 331 | bcount -= count; |
@@ -579,15 +335,18 @@ static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, un | |||
579 | 335 | ||
580 | idefloppy_do_end_request(drive, 1, done >> 9); | 336 | idefloppy_do_end_request(drive, 1, done >> 9); |
581 | 337 | ||
582 | #if IDEFLOPPY_DEBUG_BUGS | ||
583 | if (bcount) { | 338 | if (bcount) { |
584 | printk(KERN_ERR "%s: leftover data in idefloppy_output_buffers, bcount == %d\n", drive->name, bcount); | 339 | printk(KERN_ERR "%s: leftover data in %s, bcount == %d\n", |
585 | idefloppy_write_zeros(drive, bcount); | 340 | drive->name, __func__, bcount); |
341 | if (direction) | ||
342 | idefloppy_write_zeros(drive, bcount); | ||
343 | else | ||
344 | idefloppy_discard_data(drive, bcount); | ||
345 | |||
586 | } | 346 | } |
587 | #endif | ||
588 | } | 347 | } |
589 | 348 | ||
590 | static void idefloppy_update_buffers (ide_drive_t *drive, idefloppy_pc_t *pc) | 349 | static void idefloppy_update_buffers(ide_drive_t *drive, idefloppy_pc_t *pc) |
591 | { | 350 | { |
592 | struct request *rq = pc->rq; | 351 | struct request *rq = pc->rq; |
593 | struct bio *bio = rq->bio; | 352 | struct bio *bio = rq->bio; |
@@ -597,11 +356,12 @@ static void idefloppy_update_buffers (ide_drive_t *drive, idefloppy_pc_t *pc) | |||
597 | } | 356 | } |
598 | 357 | ||
599 | /* | 358 | /* |
600 | * idefloppy_queue_pc_head generates a new packet command request in front | 359 | * Generate a new packet command request in front of the request queue, before |
601 | * of the request queue, before the current request, so that it will be | 360 | * the current request so that it will be processed immediately, on the next |
602 | * processed immediately, on the next pass through the driver. | 361 | * pass through the driver. |
603 | */ | 362 | */ |
604 | static void idefloppy_queue_pc_head (ide_drive_t *drive,idefloppy_pc_t *pc,struct request *rq) | 363 | static void idefloppy_queue_pc_head(ide_drive_t *drive, idefloppy_pc_t *pc, |
364 | struct request *rq) | ||
605 | { | 365 | { |
606 | struct ide_floppy_obj *floppy = drive->driver_data; | 366 | struct ide_floppy_obj *floppy = drive->driver_data; |
607 | 367 | ||
@@ -612,16 +372,16 @@ static void idefloppy_queue_pc_head (ide_drive_t *drive,idefloppy_pc_t *pc,struc | |||
612 | (void) ide_do_drive_cmd(drive, rq, ide_preempt); | 372 | (void) ide_do_drive_cmd(drive, rq, ide_preempt); |
613 | } | 373 | } |
614 | 374 | ||
615 | static idefloppy_pc_t *idefloppy_next_pc_storage (ide_drive_t *drive) | 375 | static idefloppy_pc_t *idefloppy_next_pc_storage(ide_drive_t *drive) |
616 | { | 376 | { |
617 | idefloppy_floppy_t *floppy = drive->driver_data; | 377 | idefloppy_floppy_t *floppy = drive->driver_data; |
618 | 378 | ||
619 | if (floppy->pc_stack_index == IDEFLOPPY_PC_STACK) | 379 | if (floppy->pc_stack_index == IDEFLOPPY_PC_STACK) |
620 | floppy->pc_stack_index=0; | 380 | floppy->pc_stack_index = 0; |
621 | return (&floppy->pc_stack[floppy->pc_stack_index++]); | 381 | return (&floppy->pc_stack[floppy->pc_stack_index++]); |
622 | } | 382 | } |
623 | 383 | ||
624 | static struct request *idefloppy_next_rq_storage (ide_drive_t *drive) | 384 | static struct request *idefloppy_next_rq_storage(ide_drive_t *drive) |
625 | { | 385 | { |
626 | idefloppy_floppy_t *floppy = drive->driver_data; | 386 | idefloppy_floppy_t *floppy = drive->driver_data; |
627 | 387 | ||
@@ -630,60 +390,53 @@ static struct request *idefloppy_next_rq_storage (ide_drive_t *drive) | |||
630 | return (&floppy->rq_stack[floppy->rq_stack_index++]); | 390 | return (&floppy->rq_stack[floppy->rq_stack_index++]); |
631 | } | 391 | } |
632 | 392 | ||
633 | /* | 393 | static void idefloppy_request_sense_callback(ide_drive_t *drive) |
634 | * idefloppy_analyze_error is called on each failed packet command retry | ||
635 | * to analyze the request sense. | ||
636 | */ | ||
637 | static void idefloppy_analyze_error (ide_drive_t *drive,idefloppy_request_sense_result_t *result) | ||
638 | { | 394 | { |
639 | idefloppy_floppy_t *floppy = drive->driver_data; | 395 | idefloppy_floppy_t *floppy = drive->driver_data; |
396 | u8 *buf = floppy->pc->buffer; | ||
640 | 397 | ||
641 | floppy->sense_key = result->sense_key; | 398 | debug_log("Reached %s\n", __func__); |
642 | floppy->asc = result->asc; | ||
643 | floppy->ascq = result->ascq; | ||
644 | floppy->progress_indication = result->sksv[0] & 0x80 ? | ||
645 | (u16)get_unaligned((u16 *)(result->sksv+1)):0x10000; | ||
646 | if (floppy->failed_pc) | ||
647 | debug_log(KERN_INFO "ide-floppy: pc = %x, sense key = %x, " | ||
648 | "asc = %x, ascq = %x\n", floppy->failed_pc->c[0], | ||
649 | result->sense_key, result->asc, result->ascq); | ||
650 | else | ||
651 | debug_log(KERN_INFO "ide-floppy: sense key = %x, asc = %x, " | ||
652 | "ascq = %x\n", result->sense_key, | ||
653 | result->asc, result->ascq); | ||
654 | } | ||
655 | |||
656 | static void idefloppy_request_sense_callback (ide_drive_t *drive) | ||
657 | { | ||
658 | idefloppy_floppy_t *floppy = drive->driver_data; | ||
659 | 399 | ||
660 | debug_log(KERN_INFO "ide-floppy: Reached %s\n", __FUNCTION__); | ||
661 | |||
662 | if (!floppy->pc->error) { | 400 | if (!floppy->pc->error) { |
663 | idefloppy_analyze_error(drive,(idefloppy_request_sense_result_t *) floppy->pc->buffer); | 401 | floppy->sense_key = buf[2] & 0x0F; |
402 | floppy->asc = buf[12]; | ||
403 | floppy->ascq = buf[13]; | ||
404 | floppy->progress_indication = buf[15] & 0x80 ? | ||
405 | (u16)get_unaligned((u16 *)&buf[16]) : 0x10000; | ||
406 | |||
407 | if (floppy->failed_pc) | ||
408 | debug_log("pc = %x, sense key = %x, asc = %x," | ||
409 | " ascq = %x\n", | ||
410 | floppy->failed_pc->c[0], | ||
411 | floppy->sense_key, | ||
412 | floppy->asc, | ||
413 | floppy->ascq); | ||
414 | else | ||
415 | debug_log("sense key = %x, asc = %x, ascq = %x\n", | ||
416 | floppy->sense_key, | ||
417 | floppy->asc, | ||
418 | floppy->ascq); | ||
419 | |||
420 | |||
664 | idefloppy_do_end_request(drive, 1, 0); | 421 | idefloppy_do_end_request(drive, 1, 0); |
665 | } else { | 422 | } else { |
666 | printk(KERN_ERR "Error in REQUEST SENSE itself - Aborting request!\n"); | 423 | printk(KERN_ERR "Error in REQUEST SENSE itself - Aborting" |
424 | " request!\n"); | ||
667 | idefloppy_do_end_request(drive, 0, 0); | 425 | idefloppy_do_end_request(drive, 0, 0); |
668 | } | 426 | } |
669 | } | 427 | } |
670 | 428 | ||
671 | /* | 429 | /* General packet command callback function. */ |
672 | * General packet command callback function. | 430 | static void idefloppy_pc_callback(ide_drive_t *drive) |
673 | */ | ||
674 | static void idefloppy_pc_callback (ide_drive_t *drive) | ||
675 | { | 431 | { |
676 | idefloppy_floppy_t *floppy = drive->driver_data; | 432 | idefloppy_floppy_t *floppy = drive->driver_data; |
677 | 433 | ||
678 | debug_log(KERN_INFO "ide-floppy: Reached %s\n", __FUNCTION__); | 434 | debug_log("Reached %s\n", __func__); |
679 | 435 | ||
680 | idefloppy_do_end_request(drive, floppy->pc->error ? 0 : 1, 0); | 436 | idefloppy_do_end_request(drive, floppy->pc->error ? 0 : 1, 0); |
681 | } | 437 | } |
682 | 438 | ||
683 | /* | 439 | static void idefloppy_init_pc(idefloppy_pc_t *pc) |
684 | * idefloppy_init_pc initializes a packet command. | ||
685 | */ | ||
686 | static void idefloppy_init_pc (idefloppy_pc_t *pc) | ||
687 | { | 440 | { |
688 | memset(pc->c, 0, 12); | 441 | memset(pc->c, 0, 12); |
689 | pc->retries = 0; | 442 | pc->retries = 0; |
@@ -694,21 +447,20 @@ static void idefloppy_init_pc (idefloppy_pc_t *pc) | |||
694 | pc->callback = &idefloppy_pc_callback; | 447 | pc->callback = &idefloppy_pc_callback; |
695 | } | 448 | } |
696 | 449 | ||
697 | static void idefloppy_create_request_sense_cmd (idefloppy_pc_t *pc) | 450 | static void idefloppy_create_request_sense_cmd(idefloppy_pc_t *pc) |
698 | { | 451 | { |
699 | idefloppy_init_pc(pc); | 452 | idefloppy_init_pc(pc); |
700 | pc->c[0] = IDEFLOPPY_REQUEST_SENSE_CMD; | 453 | pc->c[0] = GPCMD_REQUEST_SENSE; |
701 | pc->c[4] = 255; | 454 | pc->c[4] = 255; |
702 | pc->request_transfer = 18; | 455 | pc->request_transfer = 18; |
703 | pc->callback = &idefloppy_request_sense_callback; | 456 | pc->callback = &idefloppy_request_sense_callback; |
704 | } | 457 | } |
705 | 458 | ||
706 | /* | 459 | /* |
707 | * idefloppy_retry_pc is called when an error was detected during the | 460 | * Called when an error was detected during the last packet command. We queue a |
708 | * last packet command. We queue a request sense packet command in | 461 | * request sense packet command in the head of the request list. |
709 | * the head of the request list. | ||
710 | */ | 462 | */ |
711 | static void idefloppy_retry_pc (ide_drive_t *drive) | 463 | static void idefloppy_retry_pc(ide_drive_t *drive) |
712 | { | 464 | { |
713 | idefloppy_pc_t *pc; | 465 | idefloppy_pc_t *pc; |
714 | struct request *rq; | 466 | struct request *rq; |
@@ -720,49 +472,50 @@ static void idefloppy_retry_pc (ide_drive_t *drive) | |||
720 | idefloppy_queue_pc_head(drive, pc, rq); | 472 | idefloppy_queue_pc_head(drive, pc, rq); |
721 | } | 473 | } |
722 | 474 | ||
723 | /* | 475 | /* The usual interrupt handler called during a packet command. */ |
724 | * idefloppy_pc_intr is the usual interrupt handler which will be called | ||
725 | * during a packet command. | ||
726 | */ | ||
727 | static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | 476 | static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) |
728 | { | 477 | { |
729 | idefloppy_floppy_t *floppy = drive->driver_data; | 478 | idefloppy_floppy_t *floppy = drive->driver_data; |
730 | ide_hwif_t *hwif = drive->hwif; | 479 | ide_hwif_t *hwif = drive->hwif; |
731 | idefloppy_pc_t *pc = floppy->pc; | 480 | idefloppy_pc_t *pc = floppy->pc; |
732 | struct request *rq = pc->rq; | 481 | struct request *rq = pc->rq; |
482 | xfer_func_t *xferfunc; | ||
733 | unsigned int temp; | 483 | unsigned int temp; |
484 | int dma_error = 0; | ||
734 | u16 bcount; | 485 | u16 bcount; |
735 | u8 stat, ireason; | 486 | u8 stat, ireason; |
736 | 487 | ||
737 | debug_log(KERN_INFO "ide-floppy: Reached %s interrupt handler\n", | 488 | debug_log("Reached %s interrupt handler\n", __func__); |
738 | __FUNCTION__); | ||
739 | 489 | ||
740 | if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) { | 490 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { |
741 | if (HWIF(drive)->ide_dma_end(drive)) { | 491 | dma_error = hwif->ide_dma_end(drive); |
742 | set_bit(PC_DMA_ERROR, &pc->flags); | 492 | if (dma_error) { |
493 | printk(KERN_ERR "%s: DMA %s error\n", drive->name, | ||
494 | rq_data_dir(rq) ? "write" : "read"); | ||
495 | pc->flags |= PC_FLAG_DMA_ERROR; | ||
743 | } else { | 496 | } else { |
744 | pc->actually_transferred = pc->request_transfer; | 497 | pc->actually_transferred = pc->request_transfer; |
745 | idefloppy_update_buffers(drive, pc); | 498 | idefloppy_update_buffers(drive, pc); |
746 | } | 499 | } |
747 | debug_log(KERN_INFO "ide-floppy: DMA finished\n"); | 500 | debug_log("DMA finished\n"); |
748 | } | 501 | } |
749 | 502 | ||
750 | /* Clear the interrupt */ | 503 | /* Clear the interrupt */ |
751 | stat = drive->hwif->INB(IDE_STATUS_REG); | 504 | stat = drive->hwif->INB(IDE_STATUS_REG); |
752 | 505 | ||
753 | if ((stat & DRQ_STAT) == 0) { /* No more interrupts */ | 506 | /* No more interrupts */ |
754 | debug_log(KERN_INFO "Packet command completed, %d bytes " | 507 | if ((stat & DRQ_STAT) == 0) { |
755 | "transferred\n", pc->actually_transferred); | 508 | debug_log("Packet command completed, %d bytes transferred\n", |
756 | clear_bit(PC_DMA_IN_PROGRESS, &pc->flags); | 509 | pc->actually_transferred); |
510 | pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS; | ||
757 | 511 | ||
758 | local_irq_enable_in_hardirq(); | 512 | local_irq_enable_in_hardirq(); |
759 | 513 | ||
760 | if ((stat & ERR_STAT) || test_bit(PC_DMA_ERROR, &pc->flags)) { | 514 | if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) { |
761 | /* Error detected */ | 515 | /* Error detected */ |
762 | debug_log(KERN_INFO "ide-floppy: %s: I/O error\n", | 516 | debug_log("%s: I/O error\n", drive->name); |
763 | drive->name); | ||
764 | rq->errors++; | 517 | rq->errors++; |
765 | if (pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) { | 518 | if (pc->c[0] == GPCMD_REQUEST_SENSE) { |
766 | printk(KERN_ERR "ide-floppy: I/O error in " | 519 | printk(KERN_ERR "ide-floppy: I/O error in " |
767 | "request sense command\n"); | 520 | "request sense command\n"); |
768 | return ide_do_reset(drive); | 521 | return ide_do_reset(drive); |
@@ -780,7 +533,8 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
780 | return ide_stopped; | 533 | return ide_stopped; |
781 | } | 534 | } |
782 | 535 | ||
783 | if (test_and_clear_bit(PC_DMA_IN_PROGRESS, &pc->flags)) { | 536 | if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) { |
537 | pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS; | ||
784 | printk(KERN_ERR "ide-floppy: The floppy wants to issue " | 538 | printk(KERN_ERR "ide-floppy: The floppy wants to issue " |
785 | "more interrupts in DMA mode\n"); | 539 | "more interrupts in DMA mode\n"); |
786 | ide_dma_off(drive); | 540 | ide_dma_off(drive); |
@@ -794,10 +548,10 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
794 | ireason = hwif->INB(IDE_IREASON_REG); | 548 | ireason = hwif->INB(IDE_IREASON_REG); |
795 | 549 | ||
796 | if (ireason & CD) { | 550 | if (ireason & CD) { |
797 | printk(KERN_ERR "ide-floppy: CoD != 0 in idefloppy_pc_intr\n"); | 551 | printk(KERN_ERR "ide-floppy: CoD != 0 in %s\n", __func__); |
798 | return ide_do_reset(drive); | 552 | return ide_do_reset(drive); |
799 | } | 553 | } |
800 | if (((ireason & IO) == IO) == test_bit(PC_WRITING, &pc->flags)) { | 554 | if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) { |
801 | /* Hopefully, we will never get here */ | 555 | /* Hopefully, we will never get here */ |
802 | printk(KERN_ERR "ide-floppy: We wanted to %s, ", | 556 | printk(KERN_ERR "ide-floppy: We wanted to %s, ", |
803 | (ireason & IO) ? "Write" : "Read"); | 557 | (ireason & IO) ? "Write" : "Read"); |
@@ -805,7 +559,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
805 | (ireason & IO) ? "Read" : "Write"); | 559 | (ireason & IO) ? "Read" : "Write"); |
806 | return ide_do_reset(drive); | 560 | return ide_do_reset(drive); |
807 | } | 561 | } |
808 | if (!test_bit(PC_WRITING, &pc->flags)) { | 562 | if (!(pc->flags & PC_FLAG_WRITING)) { |
809 | /* Reading - Check that we have enough space */ | 563 | /* Reading - Check that we have enough space */ |
810 | temp = pc->actually_transferred + bcount; | 564 | temp = pc->actually_transferred + bcount; |
811 | if (temp > pc->request_transfer) { | 565 | if (temp > pc->request_transfer) { |
@@ -814,39 +568,34 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
814 | "to send us more data than expected " | 568 | "to send us more data than expected " |
815 | "- discarding data\n"); | 569 | "- discarding data\n"); |
816 | idefloppy_discard_data(drive, bcount); | 570 | idefloppy_discard_data(drive, bcount); |
817 | BUG_ON(HWGROUP(drive)->handler != NULL); | 571 | |
818 | ide_set_handler(drive, | 572 | ide_set_handler(drive, |
819 | &idefloppy_pc_intr, | 573 | &idefloppy_pc_intr, |
820 | IDEFLOPPY_WAIT_CMD, | 574 | IDEFLOPPY_WAIT_CMD, |
821 | NULL); | 575 | NULL); |
822 | return ide_started; | 576 | return ide_started; |
823 | } | 577 | } |
824 | debug_log(KERN_NOTICE "ide-floppy: The floppy wants to " | 578 | debug_log("The floppy wants to send us more data than" |
825 | "send us more data than expected - " | 579 | " expected - allowing transfer\n"); |
826 | "allowing transfer\n"); | ||
827 | } | 580 | } |
828 | } | 581 | } |
829 | if (test_bit(PC_WRITING, &pc->flags)) { | 582 | if (pc->flags & PC_FLAG_WRITING) |
830 | if (pc->buffer != NULL) | 583 | xferfunc = hwif->atapi_output_bytes; |
831 | /* Write the current buffer */ | 584 | else |
832 | hwif->atapi_output_bytes(drive, pc->current_position, | 585 | xferfunc = hwif->atapi_input_bytes; |
833 | bcount); | 586 | |
834 | else | 587 | if (pc->buffer) |
835 | idefloppy_output_buffers(drive, pc, bcount); | 588 | xferfunc(drive, pc->current_position, bcount); |
836 | } else { | 589 | else |
837 | if (pc->buffer != NULL) | 590 | ide_floppy_io_buffers(drive, pc, bcount, |
838 | /* Read the current buffer */ | 591 | !!(pc->flags & PC_FLAG_WRITING)); |
839 | hwif->atapi_input_bytes(drive, pc->current_position, | 592 | |
840 | bcount); | ||
841 | else | ||
842 | idefloppy_input_buffers(drive, pc, bcount); | ||
843 | } | ||
844 | /* Update the current position */ | 593 | /* Update the current position */ |
845 | pc->actually_transferred += bcount; | 594 | pc->actually_transferred += bcount; |
846 | pc->current_position += bcount; | 595 | pc->current_position += bcount; |
847 | 596 | ||
848 | BUG_ON(HWGROUP(drive)->handler != NULL); | 597 | /* And set the interrupt handler again */ |
849 | ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */ | 598 | ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); |
850 | return ide_started; | 599 | return ide_started; |
851 | } | 600 | } |
852 | 601 | ||
@@ -855,7 +604,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive) | |||
855 | * It fails at high speeds on the Iomega ZIP drive, so there's a slower version | 604 | * It fails at high speeds on the Iomega ZIP drive, so there's a slower version |
856 | * for that drive below. The algorithm is chosen based on drive type | 605 | * for that drive below. The algorithm is chosen based on drive type |
857 | */ | 606 | */ |
858 | static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive) | 607 | static ide_startstop_t idefloppy_transfer_pc(ide_drive_t *drive) |
859 | { | 608 | { |
860 | ide_startstop_t startstop; | 609 | ide_startstop_t startstop; |
861 | idefloppy_floppy_t *floppy = drive->driver_data; | 610 | idefloppy_floppy_t *floppy = drive->driver_data; |
@@ -872,7 +621,7 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive) | |||
872 | "issuing a packet command\n"); | 621 | "issuing a packet command\n"); |
873 | return ide_do_reset(drive); | 622 | return ide_do_reset(drive); |
874 | } | 623 | } |
875 | BUG_ON(HWGROUP(drive)->handler != NULL); | 624 | |
876 | /* Set the interrupt routine */ | 625 | /* Set the interrupt routine */ |
877 | ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); | 626 | ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); |
878 | /* Send the actual packet */ | 627 | /* Send the actual packet */ |
@@ -882,18 +631,16 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive) | |||
882 | 631 | ||
883 | 632 | ||
884 | /* | 633 | /* |
885 | * What we have here is a classic case of a top half / bottom half | 634 | * What we have here is a classic case of a top half / bottom half interrupt |
886 | * interrupt service routine. In interrupt mode, the device sends | 635 | * service routine. In interrupt mode, the device sends an interrupt to signal |
887 | * an interrupt to signal it's ready to receive a packet. However, | 636 | * that it is ready to receive a packet. However, we need to delay about 2-3 |
888 | * we need to delay about 2-3 ticks before issuing the packet or we | 637 | * ticks before issuing the packet or we gets in trouble. |
889 | * gets in trouble. | ||
890 | * | 638 | * |
891 | * So, follow carefully. transfer_pc1 is called as an interrupt (or | 639 | * So, follow carefully. transfer_pc1 is called as an interrupt (or directly). |
892 | * directly). In either case, when the device says it's ready for a | 640 | * In either case, when the device says it's ready for a packet, we schedule |
893 | * packet, we schedule the packet transfer to occur about 2-3 ticks | 641 | * the packet transfer to occur about 2-3 ticks later in transfer_pc2. |
894 | * later in transfer_pc2. | ||
895 | */ | 642 | */ |
896 | static int idefloppy_transfer_pc2 (ide_drive_t *drive) | 643 | static int idefloppy_transfer_pc2(ide_drive_t *drive) |
897 | { | 644 | { |
898 | idefloppy_floppy_t *floppy = drive->driver_data; | 645 | idefloppy_floppy_t *floppy = drive->driver_data; |
899 | 646 | ||
@@ -903,7 +650,7 @@ static int idefloppy_transfer_pc2 (ide_drive_t *drive) | |||
903 | return IDEFLOPPY_WAIT_CMD; | 650 | return IDEFLOPPY_WAIT_CMD; |
904 | } | 651 | } |
905 | 652 | ||
906 | static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive) | 653 | static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t *drive) |
907 | { | 654 | { |
908 | idefloppy_floppy_t *floppy = drive->driver_data; | 655 | idefloppy_floppy_t *floppy = drive->driver_data; |
909 | ide_startstop_t startstop; | 656 | ide_startstop_t startstop; |
@@ -920,7 +667,7 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive) | |||
920 | "while issuing a packet command\n"); | 667 | "while issuing a packet command\n"); |
921 | return ide_do_reset(drive); | 668 | return ide_do_reset(drive); |
922 | } | 669 | } |
923 | /* | 670 | /* |
924 | * The following delay solves a problem with ATAPI Zip 100 drives | 671 | * The following delay solves a problem with ATAPI Zip 100 drives |
925 | * where the Busy flag was apparently being deasserted before the | 672 | * where the Busy flag was apparently being deasserted before the |
926 | * unit was ready to receive data. This was happening on a | 673 | * unit was ready to receive data. This was happening on a |
@@ -928,32 +675,30 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive) | |||
928 | * 40 and 50msec work well. idefloppy_pc_intr will not be actually | 675 | * 40 and 50msec work well. idefloppy_pc_intr will not be actually |
929 | * used until after the packet is moved in about 50 msec. | 676 | * used until after the packet is moved in about 50 msec. |
930 | */ | 677 | */ |
931 | BUG_ON(HWGROUP(drive)->handler != NULL); | 678 | |
932 | ide_set_handler(drive, | 679 | ide_set_handler(drive, &idefloppy_pc_intr, floppy->ticks, |
933 | &idefloppy_pc_intr, /* service routine for packet command */ | 680 | &idefloppy_transfer_pc2); |
934 | floppy->ticks, /* wait this long before "failing" */ | ||
935 | &idefloppy_transfer_pc2); /* fail == transfer_pc2 */ | ||
936 | return ide_started; | 681 | return ide_started; |
937 | } | 682 | } |
938 | 683 | ||
939 | /** | 684 | static void ide_floppy_report_error(idefloppy_floppy_t *floppy, |
940 | * idefloppy_should_report_error() | 685 | idefloppy_pc_t *pc) |
941 | * | ||
942 | * Supresses error messages resulting from Medium not present | ||
943 | */ | ||
944 | static inline int idefloppy_should_report_error(idefloppy_floppy_t *floppy) | ||
945 | { | 686 | { |
687 | /* supress error messages resulting from Medium not present */ | ||
946 | if (floppy->sense_key == 0x02 && | 688 | if (floppy->sense_key == 0x02 && |
947 | floppy->asc == 0x3a && | 689 | floppy->asc == 0x3a && |
948 | floppy->ascq == 0x00) | 690 | floppy->ascq == 0x00) |
949 | return 0; | 691 | return; |
950 | return 1; | 692 | |
693 | printk(KERN_ERR "ide-floppy: %s: I/O error, pc = %2x, key = %2x, " | ||
694 | "asc = %2x, ascq = %2x\n", | ||
695 | floppy->drive->name, pc->c[0], floppy->sense_key, | ||
696 | floppy->asc, floppy->ascq); | ||
697 | |||
951 | } | 698 | } |
952 | 699 | ||
953 | /* | 700 | static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, |
954 | * Issue a packet command | 701 | idefloppy_pc_t *pc) |
955 | */ | ||
956 | static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *pc) | ||
957 | { | 702 | { |
958 | idefloppy_floppy_t *floppy = drive->driver_data; | 703 | idefloppy_floppy_t *floppy = drive->driver_data; |
959 | ide_hwif_t *hwif = drive->hwif; | 704 | ide_hwif_t *hwif = drive->hwif; |
@@ -962,36 +707,23 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p | |||
962 | u8 dma; | 707 | u8 dma; |
963 | 708 | ||
964 | if (floppy->failed_pc == NULL && | 709 | if (floppy->failed_pc == NULL && |
965 | pc->c[0] != IDEFLOPPY_REQUEST_SENSE_CMD) | 710 | pc->c[0] != GPCMD_REQUEST_SENSE) |
966 | floppy->failed_pc = pc; | 711 | floppy->failed_pc = pc; |
967 | /* Set the current packet command */ | 712 | /* Set the current packet command */ |
968 | floppy->pc = pc; | 713 | floppy->pc = pc; |
969 | 714 | ||
970 | if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES || | 715 | if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES) { |
971 | test_bit(PC_ABORT, &pc->flags)) { | 716 | if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) |
972 | /* | 717 | ide_floppy_report_error(floppy, pc); |
973 | * We will "abort" retrying a packet command in case | 718 | /* Giving up */ |
974 | * a legitimate error code was received. | 719 | pc->error = IDEFLOPPY_ERROR_GENERAL; |
975 | */ | 720 | |
976 | if (!test_bit(PC_ABORT, &pc->flags)) { | ||
977 | if (!test_bit(PC_SUPPRESS_ERROR, &pc->flags)) { | ||
978 | if (idefloppy_should_report_error(floppy)) | ||
979 | printk(KERN_ERR "ide-floppy: %s: I/O error, " | ||
980 | "pc = %2x, key = %2x, " | ||
981 | "asc = %2x, ascq = %2x\n", | ||
982 | drive->name, pc->c[0], | ||
983 | floppy->sense_key, | ||
984 | floppy->asc, floppy->ascq); | ||
985 | } | ||
986 | /* Giving up */ | ||
987 | pc->error = IDEFLOPPY_ERROR_GENERAL; | ||
988 | } | ||
989 | floppy->failed_pc = NULL; | 721 | floppy->failed_pc = NULL; |
990 | pc->callback(drive); | 722 | pc->callback(drive); |
991 | return ide_stopped; | 723 | return ide_stopped; |
992 | } | 724 | } |
993 | 725 | ||
994 | debug_log(KERN_INFO "Retry number - %d\n",pc->retries); | 726 | debug_log("Retry number - %d\n", pc->retries); |
995 | 727 | ||
996 | pc->retries++; | 728 | pc->retries++; |
997 | /* We haven't transferred any data yet */ | 729 | /* We haven't transferred any data yet */ |
@@ -999,24 +731,26 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p | |||
999 | pc->current_position = pc->buffer; | 731 | pc->current_position = pc->buffer; |
1000 | bcount = min(pc->request_transfer, 63 * 1024); | 732 | bcount = min(pc->request_transfer, 63 * 1024); |
1001 | 733 | ||
1002 | if (test_and_clear_bit(PC_DMA_ERROR, &pc->flags)) | 734 | if (pc->flags & PC_FLAG_DMA_ERROR) { |
735 | pc->flags &= ~PC_FLAG_DMA_ERROR; | ||
1003 | ide_dma_off(drive); | 736 | ide_dma_off(drive); |
1004 | 737 | } | |
1005 | dma = 0; | 738 | dma = 0; |
1006 | 739 | ||
1007 | if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) | 740 | if ((pc->flags & PC_FLAG_DMA_RECOMMENDED) && drive->using_dma) |
1008 | dma = !hwif->dma_setup(drive); | 741 | dma = !hwif->dma_setup(drive); |
1009 | 742 | ||
1010 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK | | 743 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK | |
1011 | IDE_TFLAG_OUT_DEVICE, bcount, dma); | 744 | IDE_TFLAG_OUT_DEVICE, bcount, dma); |
1012 | 745 | ||
1013 | if (dma) { /* Begin DMA, if necessary */ | 746 | if (dma) { |
1014 | set_bit(PC_DMA_IN_PROGRESS, &pc->flags); | 747 | /* Begin DMA, if necessary */ |
748 | pc->flags |= PC_FLAG_DMA_IN_PROGRESS; | ||
1015 | hwif->dma_start(drive); | 749 | hwif->dma_start(drive); |
1016 | } | 750 | } |
1017 | 751 | ||
1018 | /* Can we transfer the packet when we get the interrupt or wait? */ | 752 | /* Can we transfer the packet when we get the interrupt or wait? */ |
1019 | if (test_bit(IDEFLOPPY_ZIP_DRIVE, &floppy->flags)) { | 753 | if (floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE) { |
1020 | /* wait */ | 754 | /* wait */ |
1021 | pkt_xfer_routine = &idefloppy_transfer_pc1; | 755 | pkt_xfer_routine = &idefloppy_transfer_pc1; |
1022 | } else { | 756 | } else { |
@@ -1024,7 +758,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p | |||
1024 | pkt_xfer_routine = &idefloppy_transfer_pc; | 758 | pkt_xfer_routine = &idefloppy_transfer_pc; |
1025 | } | 759 | } |
1026 | 760 | ||
1027 | if (test_bit (IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags)) { | 761 | if (floppy->flags & IDEFLOPPY_FLAG_DRQ_INTERRUPT) { |
1028 | /* Issue the packet command */ | 762 | /* Issue the packet command */ |
1029 | ide_execute_command(drive, WIN_PACKETCMD, | 763 | ide_execute_command(drive, WIN_PACKETCMD, |
1030 | pkt_xfer_routine, | 764 | pkt_xfer_routine, |
@@ -1038,38 +772,37 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p | |||
1038 | } | 772 | } |
1039 | } | 773 | } |
1040 | 774 | ||
1041 | static void idefloppy_rw_callback (ide_drive_t *drive) | 775 | static void idefloppy_rw_callback(ide_drive_t *drive) |
1042 | { | 776 | { |
1043 | debug_log(KERN_INFO "ide-floppy: Reached idefloppy_rw_callback\n"); | 777 | debug_log("Reached %s\n", __func__); |
1044 | 778 | ||
1045 | idefloppy_do_end_request(drive, 1, 0); | 779 | idefloppy_do_end_request(drive, 1, 0); |
1046 | return; | 780 | return; |
1047 | } | 781 | } |
1048 | 782 | ||
1049 | static void idefloppy_create_prevent_cmd (idefloppy_pc_t *pc, int prevent) | 783 | static void idefloppy_create_prevent_cmd(idefloppy_pc_t *pc, int prevent) |
1050 | { | 784 | { |
1051 | debug_log(KERN_INFO "ide-floppy: creating prevent removal command, " | 785 | debug_log("creating prevent removal command, prevent = %d\n", prevent); |
1052 | "prevent = %d\n", prevent); | ||
1053 | 786 | ||
1054 | idefloppy_init_pc(pc); | 787 | idefloppy_init_pc(pc); |
1055 | pc->c[0] = IDEFLOPPY_PREVENT_REMOVAL_CMD; | 788 | pc->c[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL; |
1056 | pc->c[4] = prevent; | 789 | pc->c[4] = prevent; |
1057 | } | 790 | } |
1058 | 791 | ||
1059 | static void idefloppy_create_read_capacity_cmd (idefloppy_pc_t *pc) | 792 | static void idefloppy_create_read_capacity_cmd(idefloppy_pc_t *pc) |
1060 | { | 793 | { |
1061 | idefloppy_init_pc(pc); | 794 | idefloppy_init_pc(pc); |
1062 | pc->c[0] = IDEFLOPPY_READ_CAPACITY_CMD; | 795 | pc->c[0] = GPCMD_READ_FORMAT_CAPACITIES; |
1063 | pc->c[7] = 255; | 796 | pc->c[7] = 255; |
1064 | pc->c[8] = 255; | 797 | pc->c[8] = 255; |
1065 | pc->request_transfer = 255; | 798 | pc->request_transfer = 255; |
1066 | } | 799 | } |
1067 | 800 | ||
1068 | static void idefloppy_create_format_unit_cmd (idefloppy_pc_t *pc, int b, int l, | 801 | static void idefloppy_create_format_unit_cmd(idefloppy_pc_t *pc, int b, int l, |
1069 | int flags) | 802 | int flags) |
1070 | { | 803 | { |
1071 | idefloppy_init_pc(pc); | 804 | idefloppy_init_pc(pc); |
1072 | pc->c[0] = IDEFLOPPY_FORMAT_UNIT_CMD; | 805 | pc->c[0] = GPCMD_FORMAT_UNIT; |
1073 | pc->c[1] = 0x17; | 806 | pc->c[1] = 0x17; |
1074 | 807 | ||
1075 | memset(pc->buffer, 0, 12); | 808 | memset(pc->buffer, 0, 12); |
@@ -1080,83 +813,79 @@ static void idefloppy_create_format_unit_cmd (idefloppy_pc_t *pc, int b, int l, | |||
1080 | pc->buffer[1] ^= 0x20; /* ... turn off DCRT bit */ | 813 | pc->buffer[1] ^= 0x20; /* ... turn off DCRT bit */ |
1081 | pc->buffer[3] = 8; | 814 | pc->buffer[3] = 8; |
1082 | 815 | ||
1083 | put_unaligned(htonl(b), (unsigned int *)(&pc->buffer[4])); | 816 | put_unaligned(cpu_to_be32(b), (unsigned int *)(&pc->buffer[4])); |
1084 | put_unaligned(htonl(l), (unsigned int *)(&pc->buffer[8])); | 817 | put_unaligned(cpu_to_be32(l), (unsigned int *)(&pc->buffer[8])); |
1085 | pc->buffer_size=12; | 818 | pc->buffer_size = 12; |
1086 | set_bit(PC_WRITING, &pc->flags); | 819 | pc->flags |= PC_FLAG_WRITING; |
1087 | } | 820 | } |
1088 | 821 | ||
1089 | /* | 822 | /* A mode sense command is used to "sense" floppy parameters. */ |
1090 | * A mode sense command is used to "sense" floppy parameters. | 823 | static void idefloppy_create_mode_sense_cmd(idefloppy_pc_t *pc, u8 page_code, |
1091 | */ | 824 | u8 type) |
1092 | static void idefloppy_create_mode_sense_cmd (idefloppy_pc_t *pc, u8 page_code, u8 type) | ||
1093 | { | 825 | { |
1094 | u16 length = sizeof(idefloppy_mode_parameter_header_t); | 826 | u16 length = 8; /* sizeof(Mode Parameter Header) = 8 Bytes */ |
1095 | 827 | ||
1096 | idefloppy_init_pc(pc); | 828 | idefloppy_init_pc(pc); |
1097 | pc->c[0] = IDEFLOPPY_MODE_SENSE_CMD; | 829 | pc->c[0] = GPCMD_MODE_SENSE_10; |
1098 | pc->c[1] = 0; | 830 | pc->c[1] = 0; |
1099 | pc->c[2] = page_code + (type << 6); | 831 | pc->c[2] = page_code + (type << 6); |
1100 | 832 | ||
1101 | switch (page_code) { | 833 | switch (page_code) { |
1102 | case IDEFLOPPY_CAPABILITIES_PAGE: | 834 | case IDEFLOPPY_CAPABILITIES_PAGE: |
1103 | length += 12; | 835 | length += 12; |
1104 | break; | 836 | break; |
1105 | case IDEFLOPPY_FLEXIBLE_DISK_PAGE: | 837 | case IDEFLOPPY_FLEXIBLE_DISK_PAGE: |
1106 | length += 32; | 838 | length += 32; |
1107 | break; | 839 | break; |
1108 | default: | 840 | default: |
1109 | printk(KERN_ERR "ide-floppy: unsupported page code " | 841 | printk(KERN_ERR "ide-floppy: unsupported page code " |
1110 | "in create_mode_sense_cmd\n"); | 842 | "in create_mode_sense_cmd\n"); |
1111 | } | 843 | } |
1112 | put_unaligned(htons(length), (u16 *) &pc->c[7]); | 844 | put_unaligned(cpu_to_be16(length), (u16 *) &pc->c[7]); |
1113 | pc->request_transfer = length; | 845 | pc->request_transfer = length; |
1114 | } | 846 | } |
1115 | 847 | ||
1116 | static void idefloppy_create_start_stop_cmd (idefloppy_pc_t *pc, int start) | 848 | static void idefloppy_create_start_stop_cmd(idefloppy_pc_t *pc, int start) |
1117 | { | 849 | { |
1118 | idefloppy_init_pc(pc); | 850 | idefloppy_init_pc(pc); |
1119 | pc->c[0] = IDEFLOPPY_START_STOP_CMD; | 851 | pc->c[0] = GPCMD_START_STOP_UNIT; |
1120 | pc->c[4] = start; | 852 | pc->c[4] = start; |
1121 | } | 853 | } |
1122 | 854 | ||
1123 | static void idefloppy_create_test_unit_ready_cmd(idefloppy_pc_t *pc) | 855 | static void idefloppy_create_test_unit_ready_cmd(idefloppy_pc_t *pc) |
1124 | { | 856 | { |
1125 | idefloppy_init_pc(pc); | 857 | idefloppy_init_pc(pc); |
1126 | pc->c[0] = IDEFLOPPY_TEST_UNIT_READY_CMD; | 858 | pc->c[0] = GPCMD_TEST_UNIT_READY; |
1127 | } | 859 | } |
1128 | 860 | ||
1129 | static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, struct request *rq, unsigned long sector) | 861 | static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, |
862 | idefloppy_pc_t *pc, struct request *rq, | ||
863 | unsigned long sector) | ||
1130 | { | 864 | { |
1131 | int block = sector / floppy->bs_factor; | 865 | int block = sector / floppy->bs_factor; |
1132 | int blocks = rq->nr_sectors / floppy->bs_factor; | 866 | int blocks = rq->nr_sectors / floppy->bs_factor; |
1133 | int cmd = rq_data_dir(rq); | 867 | int cmd = rq_data_dir(rq); |
1134 | 868 | ||
1135 | debug_log("create_rw1%d_cmd: block == %d, blocks == %d\n", | 869 | debug_log("create_rw10_cmd: block == %d, blocks == %d\n", |
1136 | 2 * test_bit (IDEFLOPPY_USE_READ12, &floppy->flags), | ||
1137 | block, blocks); | 870 | block, blocks); |
1138 | 871 | ||
1139 | idefloppy_init_pc(pc); | 872 | idefloppy_init_pc(pc); |
1140 | if (test_bit(IDEFLOPPY_USE_READ12, &floppy->flags)) { | 873 | pc->c[0] = cmd == READ ? GPCMD_READ_10 : GPCMD_WRITE_10; |
1141 | pc->c[0] = cmd == READ ? IDEFLOPPY_READ12_CMD : IDEFLOPPY_WRITE12_CMD; | 874 | put_unaligned(cpu_to_be16(blocks), (unsigned short *)&pc->c[7]); |
1142 | put_unaligned(htonl(blocks), (unsigned int *) &pc->c[6]); | 875 | put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[2]); |
1143 | } else { | 876 | |
1144 | pc->c[0] = cmd == READ ? IDEFLOPPY_READ10_CMD : IDEFLOPPY_WRITE10_CMD; | ||
1145 | put_unaligned(htons(blocks), (unsigned short *) &pc->c[7]); | ||
1146 | } | ||
1147 | put_unaligned(htonl(block), (unsigned int *) &pc->c[2]); | ||
1148 | pc->callback = &idefloppy_rw_callback; | 877 | pc->callback = &idefloppy_rw_callback; |
1149 | pc->rq = rq; | 878 | pc->rq = rq; |
1150 | pc->b_count = cmd == READ ? 0 : rq->bio->bi_size; | 879 | pc->b_count = cmd == READ ? 0 : rq->bio->bi_size; |
1151 | if (rq->cmd_flags & REQ_RW) | 880 | if (rq->cmd_flags & REQ_RW) |
1152 | set_bit(PC_WRITING, &pc->flags); | 881 | pc->flags |= PC_FLAG_WRITING; |
1153 | pc->buffer = NULL; | 882 | pc->buffer = NULL; |
1154 | pc->request_transfer = pc->buffer_size = blocks * floppy->block_size; | 883 | pc->request_transfer = pc->buffer_size = blocks * floppy->block_size; |
1155 | set_bit(PC_DMA_RECOMMENDED, &pc->flags); | 884 | pc->flags |= PC_FLAG_DMA_RECOMMENDED; |
1156 | } | 885 | } |
1157 | 886 | ||
1158 | static void | 887 | static void idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy, |
1159 | idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, struct request *rq) | 888 | idefloppy_pc_t *pc, struct request *rq) |
1160 | { | 889 | { |
1161 | idefloppy_init_pc(pc); | 890 | idefloppy_init_pc(pc); |
1162 | pc->callback = &idefloppy_rw_callback; | 891 | pc->callback = &idefloppy_rw_callback; |
@@ -1164,11 +893,10 @@ idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, struct req | |||
1164 | pc->rq = rq; | 893 | pc->rq = rq; |
1165 | pc->b_count = rq->data_len; | 894 | pc->b_count = rq->data_len; |
1166 | if (rq->data_len && rq_data_dir(rq) == WRITE) | 895 | if (rq->data_len && rq_data_dir(rq) == WRITE) |
1167 | set_bit(PC_WRITING, &pc->flags); | 896 | pc->flags |= PC_FLAG_WRITING; |
1168 | pc->buffer = rq->data; | 897 | pc->buffer = rq->data; |
1169 | if (rq->bio) | 898 | if (rq->bio) |
1170 | set_bit(PC_DMA_RECOMMENDED, &pc->flags); | 899 | pc->flags |= PC_FLAG_DMA_RECOMMENDED; |
1171 | |||
1172 | /* | 900 | /* |
1173 | * possibly problematic, doesn't look like ide-floppy correctly | 901 | * possibly problematic, doesn't look like ide-floppy correctly |
1174 | * handled scattered requests if dma fails... | 902 | * handled scattered requests if dma fails... |
@@ -1176,30 +904,23 @@ idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, struct req | |||
1176 | pc->request_transfer = pc->buffer_size = rq->data_len; | 904 | pc->request_transfer = pc->buffer_size = rq->data_len; |
1177 | } | 905 | } |
1178 | 906 | ||
1179 | /* | 907 | static ide_startstop_t idefloppy_do_request(ide_drive_t *drive, |
1180 | * idefloppy_do_request is our request handling function. | 908 | struct request *rq, sector_t block_s) |
1181 | */ | ||
1182 | static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request *rq, sector_t block_s) | ||
1183 | { | 909 | { |
1184 | idefloppy_floppy_t *floppy = drive->driver_data; | 910 | idefloppy_floppy_t *floppy = drive->driver_data; |
1185 | idefloppy_pc_t *pc; | 911 | idefloppy_pc_t *pc; |
1186 | unsigned long block = (unsigned long)block_s; | 912 | unsigned long block = (unsigned long)block_s; |
1187 | 913 | ||
1188 | debug_log(KERN_INFO "dev: %s, flags: %lx, errors: %d\n", | 914 | debug_log("dev: %s, cmd_type: %x, errors: %d\n", |
1189 | rq->rq_disk ? rq->rq_disk->disk_name : "?", | 915 | rq->rq_disk ? rq->rq_disk->disk_name : "?", |
1190 | rq->flags, rq->errors); | 916 | rq->cmd_type, rq->errors); |
1191 | debug_log(KERN_INFO "sector: %ld, nr_sectors: %ld, " | 917 | debug_log("sector: %ld, nr_sectors: %ld, " |
1192 | "current_nr_sectors: %d\n", (long)rq->sector, | 918 | "current_nr_sectors: %d\n", (long)rq->sector, |
1193 | rq->nr_sectors, rq->current_nr_sectors); | 919 | rq->nr_sectors, rq->current_nr_sectors); |
1194 | 920 | ||
1195 | if (rq->errors >= ERROR_MAX) { | 921 | if (rq->errors >= ERROR_MAX) { |
1196 | if (floppy->failed_pc != NULL) { | 922 | if (floppy->failed_pc) |
1197 | if (idefloppy_should_report_error(floppy)) | 923 | ide_floppy_report_error(floppy, floppy->failed_pc); |
1198 | printk(KERN_ERR "ide-floppy: %s: I/O error, pc = %2x," | ||
1199 | " key = %2x, asc = %2x, ascq = %2x\n", | ||
1200 | drive->name, floppy->failed_pc->c[0], | ||
1201 | floppy->sense_key, floppy->asc, floppy->ascq); | ||
1202 | } | ||
1203 | else | 924 | else |
1204 | printk(KERN_ERR "ide-floppy: %s: I/O error\n", | 925 | printk(KERN_ERR "ide-floppy: %s: I/O error\n", |
1205 | drive->name); | 926 | drive->name); |
@@ -1209,8 +930,8 @@ static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request | |||
1209 | if (blk_fs_request(rq)) { | 930 | if (blk_fs_request(rq)) { |
1210 | if (((long)rq->sector % floppy->bs_factor) || | 931 | if (((long)rq->sector % floppy->bs_factor) || |
1211 | (rq->nr_sectors % floppy->bs_factor)) { | 932 | (rq->nr_sectors % floppy->bs_factor)) { |
1212 | printk("%s: unsupported r/w request size\n", | 933 | printk(KERN_ERR "%s: unsupported r/w request size\n", |
1213 | drive->name); | 934 | drive->name); |
1214 | idefloppy_do_end_request(drive, 0, 0); | 935 | idefloppy_do_end_request(drive, 0, 0); |
1215 | return ide_stopped; | 936 | return ide_stopped; |
1216 | } | 937 | } |
@@ -1233,15 +954,15 @@ static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request | |||
1233 | } | 954 | } |
1234 | 955 | ||
1235 | /* | 956 | /* |
1236 | * idefloppy_queue_pc_tail adds a special packet command request to the | 957 | * Add a special packet command request to the tail of the request queue, |
1237 | * tail of the request queue, and waits for it to be serviced. | 958 | * and wait for it to be serviced. |
1238 | */ | 959 | */ |
1239 | static int idefloppy_queue_pc_tail (ide_drive_t *drive,idefloppy_pc_t *pc) | 960 | static int idefloppy_queue_pc_tail(ide_drive_t *drive, idefloppy_pc_t *pc) |
1240 | { | 961 | { |
1241 | struct ide_floppy_obj *floppy = drive->driver_data; | 962 | struct ide_floppy_obj *floppy = drive->driver_data; |
1242 | struct request rq; | 963 | struct request rq; |
1243 | 964 | ||
1244 | ide_init_drive_cmd (&rq); | 965 | ide_init_drive_cmd(&rq); |
1245 | rq.buffer = (char *) pc; | 966 | rq.buffer = (char *) pc; |
1246 | rq.cmd_type = REQ_TYPE_SPECIAL; | 967 | rq.cmd_type = REQ_TYPE_SPECIAL; |
1247 | rq.rq_disk = floppy->disk; | 968 | rq.rq_disk = floppy->disk; |
@@ -1250,88 +971,90 @@ static int idefloppy_queue_pc_tail (ide_drive_t *drive,idefloppy_pc_t *pc) | |||
1250 | } | 971 | } |
1251 | 972 | ||
1252 | /* | 973 | /* |
1253 | * Look at the flexible disk page parameters. We will ignore the CHS | 974 | * Look at the flexible disk page parameters. We ignore the CHS capacity |
1254 | * capacity parameters and use the LBA parameters instead. | 975 | * parameters and use the LBA parameters instead. |
1255 | */ | 976 | */ |
1256 | static int idefloppy_get_flexible_disk_page (ide_drive_t *drive) | 977 | static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) |
1257 | { | 978 | { |
1258 | idefloppy_floppy_t *floppy = drive->driver_data; | 979 | idefloppy_floppy_t *floppy = drive->driver_data; |
1259 | idefloppy_pc_t pc; | 980 | idefloppy_pc_t pc; |
1260 | idefloppy_mode_parameter_header_t *header; | 981 | u8 *page; |
1261 | idefloppy_flexible_disk_page_t *page; | ||
1262 | int capacity, lba_capacity; | 982 | int capacity, lba_capacity; |
983 | u16 transfer_rate, sector_size, cyls, rpm; | ||
984 | u8 heads, sectors; | ||
985 | |||
986 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE, | ||
987 | MODE_SENSE_CURRENT); | ||
1263 | 988 | ||
1264 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE, MODE_SENSE_CURRENT); | 989 | if (idefloppy_queue_pc_tail(drive, &pc)) { |
1265 | if (idefloppy_queue_pc_tail(drive,&pc)) { | 990 | printk(KERN_ERR "ide-floppy: Can't get flexible disk page" |
1266 | printk(KERN_ERR "ide-floppy: Can't get flexible disk " | 991 | " parameters\n"); |
1267 | "page parameters\n"); | ||
1268 | return 1; | 992 | return 1; |
1269 | } | 993 | } |
1270 | header = (idefloppy_mode_parameter_header_t *) pc.buffer; | 994 | floppy->wp = !!(pc.buffer[3] & 0x80); |
1271 | floppy->wp = header->wp; | ||
1272 | set_disk_ro(floppy->disk, floppy->wp); | 995 | set_disk_ro(floppy->disk, floppy->wp); |
1273 | page = (idefloppy_flexible_disk_page_t *) (header + 1); | 996 | page = &pc.buffer[8]; |
1274 | 997 | ||
1275 | page->transfer_rate = ntohs(page->transfer_rate); | 998 | transfer_rate = be16_to_cpu(*(u16 *)&pc.buffer[8 + 2]); |
1276 | page->sector_size = ntohs(page->sector_size); | 999 | sector_size = be16_to_cpu(*(u16 *)&pc.buffer[8 + 6]); |
1277 | page->cyls = ntohs(page->cyls); | 1000 | cyls = be16_to_cpu(*(u16 *)&pc.buffer[8 + 8]); |
1278 | page->rpm = ntohs(page->rpm); | 1001 | rpm = be16_to_cpu(*(u16 *)&pc.buffer[8 + 28]); |
1279 | capacity = page->cyls * page->heads * page->sectors * page->sector_size; | 1002 | heads = pc.buffer[8 + 4]; |
1280 | if (memcmp (page, &floppy->flexible_disk_page, sizeof (idefloppy_flexible_disk_page_t))) | 1003 | sectors = pc.buffer[8 + 5]; |
1004 | |||
1005 | capacity = cyls * heads * sectors * sector_size; | ||
1006 | |||
1007 | if (memcmp(page, &floppy->flexible_disk_page, 32)) | ||
1281 | printk(KERN_INFO "%s: %dkB, %d/%d/%d CHS, %d kBps, " | 1008 | printk(KERN_INFO "%s: %dkB, %d/%d/%d CHS, %d kBps, " |
1282 | "%d sector size, %d rpm\n", | 1009 | "%d sector size, %d rpm\n", |
1283 | drive->name, capacity / 1024, page->cyls, | 1010 | drive->name, capacity / 1024, cyls, heads, |
1284 | page->heads, page->sectors, | 1011 | sectors, transfer_rate / 8, sector_size, rpm); |
1285 | page->transfer_rate / 8, page->sector_size, page->rpm); | 1012 | |
1286 | 1013 | memcpy(&floppy->flexible_disk_page, page, 32); | |
1287 | floppy->flexible_disk_page = *page; | 1014 | drive->bios_cyl = cyls; |
1288 | drive->bios_cyl = page->cyls; | 1015 | drive->bios_head = heads; |
1289 | drive->bios_head = page->heads; | 1016 | drive->bios_sect = sectors; |
1290 | drive->bios_sect = page->sectors; | ||
1291 | lba_capacity = floppy->blocks * floppy->block_size; | 1017 | lba_capacity = floppy->blocks * floppy->block_size; |
1018 | |||
1292 | if (capacity < lba_capacity) { | 1019 | if (capacity < lba_capacity) { |
1293 | printk(KERN_NOTICE "%s: The disk reports a capacity of %d " | 1020 | printk(KERN_NOTICE "%s: The disk reports a capacity of %d " |
1294 | "bytes, but the drive only handles %d\n", | 1021 | "bytes, but the drive only handles %d\n", |
1295 | drive->name, lba_capacity, capacity); | 1022 | drive->name, lba_capacity, capacity); |
1296 | floppy->blocks = floppy->block_size ? capacity / floppy->block_size : 0; | 1023 | floppy->blocks = floppy->block_size ? |
1024 | capacity / floppy->block_size : 0; | ||
1297 | } | 1025 | } |
1298 | return 0; | 1026 | return 0; |
1299 | } | 1027 | } |
1300 | 1028 | ||
1301 | static int idefloppy_get_capability_page(ide_drive_t *drive) | 1029 | static int idefloppy_get_sfrp_bit(ide_drive_t *drive) |
1302 | { | 1030 | { |
1303 | idefloppy_floppy_t *floppy = drive->driver_data; | 1031 | idefloppy_floppy_t *floppy = drive->driver_data; |
1304 | idefloppy_pc_t pc; | 1032 | idefloppy_pc_t pc; |
1305 | idefloppy_mode_parameter_header_t *header; | ||
1306 | idefloppy_capabilities_page_t *page; | ||
1307 | 1033 | ||
1308 | floppy->srfp = 0; | 1034 | floppy->srfp = 0; |
1309 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE, | 1035 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE, |
1310 | MODE_SENSE_CURRENT); | 1036 | MODE_SENSE_CURRENT); |
1311 | 1037 | ||
1312 | set_bit(PC_SUPPRESS_ERROR, &pc.flags); | 1038 | pc.flags |= PC_FLAG_SUPPRESS_ERROR; |
1313 | if (idefloppy_queue_pc_tail(drive,&pc)) { | 1039 | if (idefloppy_queue_pc_tail(drive, &pc)) |
1314 | return 1; | 1040 | return 1; |
1315 | } | ||
1316 | 1041 | ||
1317 | header = (idefloppy_mode_parameter_header_t *) pc.buffer; | 1042 | floppy->srfp = pc.buffer[8 + 2] & 0x40; |
1318 | page= (idefloppy_capabilities_page_t *)(header+1); | ||
1319 | floppy->srfp = page->srfp; | ||
1320 | return (0); | 1043 | return (0); |
1321 | } | 1044 | } |
1322 | 1045 | ||
1323 | /* | 1046 | /* |
1324 | * Determine if a media is present in the floppy drive, and if so, | 1047 | * Determine if a media is present in the floppy drive, and if so, its LBA |
1325 | * its LBA capacity. | 1048 | * capacity. |
1326 | */ | 1049 | */ |
1327 | static int idefloppy_get_capacity (ide_drive_t *drive) | 1050 | static int ide_floppy_get_capacity(ide_drive_t *drive) |
1328 | { | 1051 | { |
1329 | idefloppy_floppy_t *floppy = drive->driver_data; | 1052 | idefloppy_floppy_t *floppy = drive->driver_data; |
1330 | idefloppy_pc_t pc; | 1053 | idefloppy_pc_t pc; |
1331 | idefloppy_capacity_header_t *header; | 1054 | u8 *cap_desc; |
1332 | idefloppy_capacity_descriptor_t *descriptor; | 1055 | u8 header_len, desc_cnt; |
1333 | int i, descriptors, rc = 1, blocks, length; | 1056 | int i, rc = 1, blocks, length; |
1334 | 1057 | ||
1335 | drive->bios_cyl = 0; | 1058 | drive->bios_cyl = 0; |
1336 | drive->bios_head = drive->bios_sect = 0; | 1059 | drive->bios_head = drive->bios_sect = 0; |
1337 | floppy->blocks = 0; | 1060 | floppy->blocks = 0; |
@@ -1343,44 +1066,55 @@ static int idefloppy_get_capacity (ide_drive_t *drive) | |||
1343 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); | 1066 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); |
1344 | return 1; | 1067 | return 1; |
1345 | } | 1068 | } |
1346 | header = (idefloppy_capacity_header_t *) pc.buffer; | 1069 | header_len = pc.buffer[3]; |
1347 | descriptors = header->length / sizeof(idefloppy_capacity_descriptor_t); | 1070 | cap_desc = &pc.buffer[4]; |
1348 | descriptor = (idefloppy_capacity_descriptor_t *) (header + 1); | 1071 | desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */ |
1072 | |||
1073 | for (i = 0; i < desc_cnt; i++) { | ||
1074 | unsigned int desc_start = 4 + i*8; | ||
1075 | |||
1076 | blocks = be32_to_cpu(*(u32 *)&pc.buffer[desc_start]); | ||
1077 | length = be16_to_cpu(*(u16 *)&pc.buffer[desc_start + 6]); | ||
1349 | 1078 | ||
1350 | for (i = 0; i < descriptors; i++, descriptor++) { | 1079 | debug_log("Descriptor %d: %dkB, %d blocks, %d sector size\n", |
1351 | blocks = descriptor->blocks = ntohl(descriptor->blocks); | 1080 | i, blocks * length / 1024, blocks, length); |
1352 | length = descriptor->length = ntohs(descriptor->length); | ||
1353 | 1081 | ||
1354 | if (!i) | 1082 | if (i) |
1355 | { | 1083 | continue; |
1356 | switch (descriptor->dc) { | 1084 | /* |
1085 | * the code below is valid only for the 1st descriptor, ie i=0 | ||
1086 | */ | ||
1087 | |||
1088 | switch (pc.buffer[desc_start + 4] & 0x03) { | ||
1357 | /* Clik! drive returns this instead of CAPACITY_CURRENT */ | 1089 | /* Clik! drive returns this instead of CAPACITY_CURRENT */ |
1358 | case CAPACITY_UNFORMATTED: | 1090 | case CAPACITY_UNFORMATTED: |
1359 | if (!test_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags)) | 1091 | if (!(floppy->flags & IDEFLOPPY_FLAG_CLIK_DRIVE)) |
1360 | /* | 1092 | /* |
1361 | * If it is not a clik drive, break out | 1093 | * If it is not a clik drive, break out |
1362 | * (maintains previous driver behaviour) | 1094 | * (maintains previous driver behaviour) |
1363 | */ | 1095 | */ |
1364 | break; | 1096 | break; |
1365 | case CAPACITY_CURRENT: | 1097 | case CAPACITY_CURRENT: |
1366 | /* Normal Zip/LS-120 disks */ | 1098 | /* Normal Zip/LS-120 disks */ |
1367 | if (memcmp(descriptor, &floppy->capacity, sizeof (idefloppy_capacity_descriptor_t))) | 1099 | if (memcmp(cap_desc, &floppy->cap_desc, 8)) |
1368 | printk(KERN_INFO "%s: %dkB, %d blocks, %d " | 1100 | printk(KERN_INFO "%s: %dkB, %d blocks, %d " |
1369 | "sector size\n", drive->name, | 1101 | "sector size\n", drive->name, |
1370 | blocks * length / 1024, blocks, length); | 1102 | blocks * length / 1024, blocks, length); |
1371 | floppy->capacity = *descriptor; | 1103 | memcpy(&floppy->cap_desc, cap_desc, 8); |
1104 | |||
1372 | if (!length || length % 512) { | 1105 | if (!length || length % 512) { |
1373 | printk(KERN_NOTICE "%s: %d bytes block size " | 1106 | printk(KERN_NOTICE "%s: %d bytes block size " |
1374 | "not supported\n", drive->name, length); | 1107 | "not supported\n", drive->name, length); |
1375 | } else { | 1108 | } else { |
1376 | floppy->blocks = blocks; | 1109 | floppy->blocks = blocks; |
1377 | floppy->block_size = length; | 1110 | floppy->block_size = length; |
1378 | if ((floppy->bs_factor = length / 512) != 1) | 1111 | floppy->bs_factor = length / 512; |
1379 | printk(KERN_NOTICE "%s: warning: non " | 1112 | if (floppy->bs_factor != 1) |
1113 | printk(KERN_NOTICE "%s: warning: non " | ||
1380 | "512 bytes block size not " | 1114 | "512 bytes block size not " |
1381 | "fully supported\n", | 1115 | "fully supported\n", |
1382 | drive->name); | 1116 | drive->name); |
1383 | rc = 0; | 1117 | rc = 0; |
1384 | } | 1118 | } |
1385 | break; | 1119 | break; |
1386 | case CAPACITY_NO_CARTRIDGE: | 1120 | case CAPACITY_NO_CARTRIDGE: |
@@ -1395,54 +1129,42 @@ static int idefloppy_get_capacity (ide_drive_t *drive) | |||
1395 | "in drive\n", drive->name); | 1129 | "in drive\n", drive->name); |
1396 | break; | 1130 | break; |
1397 | } | 1131 | } |
1398 | } | 1132 | debug_log("Descriptor 0 Code: %d\n", |
1399 | if (!i) { | 1133 | pc.buffer[desc_start + 4] & 0x03); |
1400 | debug_log( "Descriptor 0 Code: %d\n", | ||
1401 | descriptor->dc); | ||
1402 | } | ||
1403 | debug_log( "Descriptor %d: %dkB, %d blocks, %d " | ||
1404 | "sector size\n", i, blocks * length / 1024, blocks, | ||
1405 | length); | ||
1406 | } | 1134 | } |
1407 | 1135 | ||
1408 | /* Clik! disk does not support get_flexible_disk_page */ | 1136 | /* Clik! disk does not support get_flexible_disk_page */ |
1409 | if (!test_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags)) { | 1137 | if (!(floppy->flags & IDEFLOPPY_FLAG_CLIK_DRIVE)) |
1410 | (void) idefloppy_get_flexible_disk_page(drive); | 1138 | (void) ide_floppy_get_flexible_disk_page(drive); |
1411 | } | ||
1412 | 1139 | ||
1413 | set_capacity(floppy->disk, floppy->blocks * floppy->bs_factor); | 1140 | set_capacity(floppy->disk, floppy->blocks * floppy->bs_factor); |
1414 | return rc; | 1141 | return rc; |
1415 | } | 1142 | } |
1416 | 1143 | ||
1417 | /* | 1144 | /* |
1418 | ** Obtain the list of formattable capacities. | 1145 | * Obtain the list of formattable capacities. |
1419 | ** Very similar to idefloppy_get_capacity, except that we push the capacity | 1146 | * Very similar to ide_floppy_get_capacity, except that we push the capacity |
1420 | ** descriptors to userland, instead of our own structures. | 1147 | * descriptors to userland, instead of our own structures. |
1421 | ** | 1148 | * |
1422 | ** Userland gives us the following structure: | 1149 | * Userland gives us the following structure: |
1423 | ** | 1150 | * |
1424 | ** struct idefloppy_format_capacities { | 1151 | * struct idefloppy_format_capacities { |
1425 | ** int nformats; | 1152 | * int nformats; |
1426 | ** struct { | 1153 | * struct { |
1427 | ** int nblocks; | 1154 | * int nblocks; |
1428 | ** int blocksize; | 1155 | * int blocksize; |
1429 | ** } formats[]; | 1156 | * } formats[]; |
1430 | ** } ; | 1157 | * }; |
1431 | ** | 1158 | * |
1432 | ** userland initializes nformats to the number of allocated formats[] | 1159 | * userland initializes nformats to the number of allocated formats[] records. |
1433 | ** records. On exit we set nformats to the number of records we've | 1160 | * On exit we set nformats to the number of records we've actually initialized. |
1434 | ** actually initialized. | 1161 | */ |
1435 | ** | 1162 | |
1436 | */ | 1163 | static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg) |
1437 | |||
1438 | static int idefloppy_get_format_capacities(ide_drive_t *drive, int __user *arg) | ||
1439 | { | 1164 | { |
1440 | idefloppy_pc_t pc; | 1165 | idefloppy_pc_t pc; |
1441 | idefloppy_capacity_header_t *header; | 1166 | u8 header_len, desc_cnt; |
1442 | idefloppy_capacity_descriptor_t *descriptor; | 1167 | int i, blocks, length, u_array_size, u_index; |
1443 | int i, descriptors, blocks, length; | ||
1444 | int u_array_size; | ||
1445 | int u_index; | ||
1446 | int __user *argp; | 1168 | int __user *argp; |
1447 | 1169 | ||
1448 | if (get_user(u_array_size, arg)) | 1170 | if (get_user(u_array_size, arg)) |
@@ -1454,30 +1176,27 @@ static int idefloppy_get_format_capacities(ide_drive_t *drive, int __user *arg) | |||
1454 | idefloppy_create_read_capacity_cmd(&pc); | 1176 | idefloppy_create_read_capacity_cmd(&pc); |
1455 | if (idefloppy_queue_pc_tail(drive, &pc)) { | 1177 | if (idefloppy_queue_pc_tail(drive, &pc)) { |
1456 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); | 1178 | printk(KERN_ERR "ide-floppy: Can't get floppy parameters\n"); |
1457 | return (-EIO); | 1179 | return (-EIO); |
1458 | } | 1180 | } |
1459 | header = (idefloppy_capacity_header_t *) pc.buffer; | 1181 | header_len = pc.buffer[3]; |
1460 | descriptors = header->length / | 1182 | desc_cnt = header_len / 8; /* capacity descriptor of 8 bytes */ |
1461 | sizeof(idefloppy_capacity_descriptor_t); | ||
1462 | descriptor = (idefloppy_capacity_descriptor_t *) (header + 1); | ||
1463 | 1183 | ||
1464 | u_index = 0; | 1184 | u_index = 0; |
1465 | argp = arg + 1; | 1185 | argp = arg + 1; |
1466 | 1186 | ||
1467 | /* | 1187 | /* |
1468 | ** We always skip the first capacity descriptor. That's the | 1188 | * We always skip the first capacity descriptor. That's the current |
1469 | ** current capacity. We are interested in the remaining descriptors, | 1189 | * capacity. We are interested in the remaining descriptors, the |
1470 | ** the formattable capacities. | 1190 | * formattable capacities. |
1471 | */ | 1191 | */ |
1192 | for (i = 1; i < desc_cnt; i++) { | ||
1193 | unsigned int desc_start = 4 + i*8; | ||
1472 | 1194 | ||
1473 | for (i=0; i<descriptors; i++, descriptor++) { | ||
1474 | if (u_index >= u_array_size) | 1195 | if (u_index >= u_array_size) |
1475 | break; /* User-supplied buffer too small */ | 1196 | break; /* User-supplied buffer too small */ |
1476 | if (i == 0) | ||
1477 | continue; /* Skip the first descriptor */ | ||
1478 | 1197 | ||
1479 | blocks = ntohl(descriptor->blocks); | 1198 | blocks = be32_to_cpu(*(u32 *)&pc.buffer[desc_start]); |
1480 | length = ntohs(descriptor->length); | 1199 | length = be16_to_cpu(*(u16 *)&pc.buffer[desc_start + 6]); |
1481 | 1200 | ||
1482 | if (put_user(blocks, argp)) | 1201 | if (put_user(blocks, argp)) |
1483 | return(-EFAULT); | 1202 | return(-EFAULT); |
@@ -1496,53 +1215,14 @@ static int idefloppy_get_format_capacities(ide_drive_t *drive, int __user *arg) | |||
1496 | } | 1215 | } |
1497 | 1216 | ||
1498 | /* | 1217 | /* |
1499 | ** Send ATAPI_FORMAT_UNIT to the drive. | 1218 | * Get ATAPI_FORMAT_UNIT progress indication. |
1500 | ** | 1219 | * |
1501 | ** Userland gives us the following structure: | 1220 | * Userland gives a pointer to an int. The int is set to a progress |
1502 | ** | 1221 | * indicator 0-65536, with 65536=100%. |
1503 | ** struct idefloppy_format_command { | 1222 | * |
1504 | ** int nblocks; | 1223 | * If the drive does not support format progress indication, we just check |
1505 | ** int blocksize; | 1224 | * the dsc bit, and return either 0 or 65536. |
1506 | ** int flags; | 1225 | */ |
1507 | ** } ; | ||
1508 | ** | ||
1509 | ** flags is a bitmask, currently, the only defined flag is: | ||
1510 | ** | ||
1511 | ** 0x01 - verify media after format. | ||
1512 | */ | ||
1513 | |||
1514 | static int idefloppy_begin_format(ide_drive_t *drive, int __user *arg) | ||
1515 | { | ||
1516 | int blocks; | ||
1517 | int length; | ||
1518 | int flags; | ||
1519 | idefloppy_pc_t pc; | ||
1520 | |||
1521 | if (get_user(blocks, arg) || | ||
1522 | get_user(length, arg+1) || | ||
1523 | get_user(flags, arg+2)) { | ||
1524 | return (-EFAULT); | ||
1525 | } | ||
1526 | |||
1527 | /* Get the SFRP bit */ | ||
1528 | (void) idefloppy_get_capability_page(drive); | ||
1529 | idefloppy_create_format_unit_cmd(&pc, blocks, length, flags); | ||
1530 | if (idefloppy_queue_pc_tail(drive, &pc)) { | ||
1531 | return (-EIO); | ||
1532 | } | ||
1533 | |||
1534 | return (0); | ||
1535 | } | ||
1536 | |||
1537 | /* | ||
1538 | ** Get ATAPI_FORMAT_UNIT progress indication. | ||
1539 | ** | ||
1540 | ** Userland gives a pointer to an int. The int is set to a progress | ||
1541 | ** indicator 0-65536, with 65536=100%. | ||
1542 | ** | ||
1543 | ** If the drive does not support format progress indication, we just check | ||
1544 | ** the dsc bit, and return either 0 or 65536. | ||
1545 | */ | ||
1546 | 1226 | ||
1547 | static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg) | 1227 | static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg) |
1548 | { | 1228 | { |
@@ -1552,17 +1232,15 @@ static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg) | |||
1552 | 1232 | ||
1553 | if (floppy->srfp) { | 1233 | if (floppy->srfp) { |
1554 | idefloppy_create_request_sense_cmd(&pc); | 1234 | idefloppy_create_request_sense_cmd(&pc); |
1555 | if (idefloppy_queue_pc_tail(drive, &pc)) { | 1235 | if (idefloppy_queue_pc_tail(drive, &pc)) |
1556 | return (-EIO); | 1236 | return (-EIO); |
1557 | } | ||
1558 | 1237 | ||
1559 | if (floppy->sense_key == 2 && | 1238 | if (floppy->sense_key == 2 && |
1560 | floppy->asc == 4 && | 1239 | floppy->asc == 4 && |
1561 | floppy->ascq == 4) { | 1240 | floppy->ascq == 4) |
1562 | progress_indication = floppy->progress_indication; | 1241 | progress_indication = floppy->progress_indication; |
1563 | } | 1242 | |
1564 | /* Else assume format_unit has finished, and we're | 1243 | /* Else assume format_unit has finished, and we're at 0x10000 */ |
1565 | ** at 0x10000 */ | ||
1566 | } else { | 1244 | } else { |
1567 | unsigned long flags; | 1245 | unsigned long flags; |
1568 | u8 stat; | 1246 | u8 stat; |
@@ -1579,10 +1257,7 @@ static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg) | |||
1579 | return (0); | 1257 | return (0); |
1580 | } | 1258 | } |
1581 | 1259 | ||
1582 | /* | 1260 | static sector_t idefloppy_capacity(ide_drive_t *drive) |
1583 | * Return the current floppy capacity. | ||
1584 | */ | ||
1585 | static sector_t idefloppy_capacity (ide_drive_t *drive) | ||
1586 | { | 1261 | { |
1587 | idefloppy_floppy_t *floppy = drive->driver_data; | 1262 | idefloppy_floppy_t *floppy = drive->driver_data; |
1588 | unsigned long capacity = floppy->blocks * floppy->bs_factor; | 1263 | unsigned long capacity = floppy->blocks * floppy->bs_factor; |
@@ -1591,15 +1266,12 @@ static sector_t idefloppy_capacity (ide_drive_t *drive) | |||
1591 | } | 1266 | } |
1592 | 1267 | ||
1593 | /* | 1268 | /* |
1594 | * idefloppy_identify_device checks if we can support a drive, | 1269 | * Check whether we can support a drive, based on the ATAPI IDENTIFY command |
1595 | * based on the ATAPI IDENTIFY command results. | 1270 | * results. |
1596 | */ | 1271 | */ |
1597 | static int idefloppy_identify_device (ide_drive_t *drive,struct hd_driveid *id) | 1272 | static int idefloppy_identify_device(ide_drive_t *drive, struct hd_driveid *id) |
1598 | { | 1273 | { |
1599 | struct idefloppy_id_gcw gcw; | 1274 | struct idefloppy_id_gcw gcw; |
1600 | #if IDEFLOPPY_DEBUG_INFO | ||
1601 | char buffer[80]; | ||
1602 | #endif /* IDEFLOPPY_DEBUG_INFO */ | ||
1603 | 1275 | ||
1604 | *((u16 *) &gcw) = id->config; | 1276 | *((u16 *) &gcw) = id->config; |
1605 | 1277 | ||
@@ -1608,54 +1280,23 @@ static int idefloppy_identify_device (ide_drive_t *drive,struct hd_driveid *id) | |||
1608 | if ((gcw.device_type == 5) && | 1280 | if ((gcw.device_type == 5) && |
1609 | !strstr(id->model, "CD-ROM") && | 1281 | !strstr(id->model, "CD-ROM") && |
1610 | strstr(id->model, "ZIP")) | 1282 | strstr(id->model, "ZIP")) |
1611 | gcw.device_type = 0; | 1283 | gcw.device_type = 0; |
1612 | #endif | 1284 | #endif |
1613 | 1285 | ||
1614 | #if IDEFLOPPY_DEBUG_INFO | ||
1615 | printk(KERN_INFO "Dumping ATAPI Identify Device floppy parameters\n"); | ||
1616 | switch (gcw.protocol) { | ||
1617 | case 0: case 1: sprintf(buffer, "ATA");break; | ||
1618 | case 2: sprintf(buffer, "ATAPI");break; | ||
1619 | case 3: sprintf(buffer, "Reserved (Unknown to ide-floppy)");break; | ||
1620 | } | ||
1621 | printk(KERN_INFO "Protocol Type: %s\n", buffer); | ||
1622 | switch (gcw.device_type) { | ||
1623 | case 0: sprintf(buffer, "Direct-access Device");break; | ||
1624 | case 1: sprintf(buffer, "Streaming Tape Device");break; | ||
1625 | case 2: case 3: case 4: sprintf (buffer, "Reserved");break; | ||
1626 | case 5: sprintf(buffer, "CD-ROM Device");break; | ||
1627 | case 6: sprintf(buffer, "Reserved"); | ||
1628 | case 7: sprintf(buffer, "Optical memory Device");break; | ||
1629 | case 0x1f: sprintf(buffer, "Unknown or no Device type");break; | ||
1630 | default: sprintf(buffer, "Reserved"); | ||
1631 | } | ||
1632 | printk(KERN_INFO "Device Type: %x - %s\n", gcw.device_type, buffer); | ||
1633 | printk(KERN_INFO "Removable: %s\n",gcw.removable ? "Yes":"No"); | ||
1634 | switch (gcw.drq_type) { | ||
1635 | case 0: sprintf(buffer, "Microprocessor DRQ");break; | ||
1636 | case 1: sprintf(buffer, "Interrupt DRQ");break; | ||
1637 | case 2: sprintf(buffer, "Accelerated DRQ");break; | ||
1638 | case 3: sprintf(buffer, "Reserved");break; | ||
1639 | } | ||
1640 | printk(KERN_INFO "Command Packet DRQ Type: %s\n", buffer); | ||
1641 | switch (gcw.packet_size) { | ||
1642 | case 0: sprintf(buffer, "12 bytes");break; | ||
1643 | case 1: sprintf(buffer, "16 bytes");break; | ||
1644 | default: sprintf(buffer, "Reserved");break; | ||
1645 | } | ||
1646 | printk(KERN_INFO "Command Packet Size: %s\n", buffer); | ||
1647 | #endif /* IDEFLOPPY_DEBUG_INFO */ | ||
1648 | |||
1649 | if (gcw.protocol != 2) | 1286 | if (gcw.protocol != 2) |
1650 | printk(KERN_ERR "ide-floppy: Protocol is not ATAPI\n"); | 1287 | printk(KERN_ERR "ide-floppy: Protocol (0x%02x) is not ATAPI\n", |
1288 | gcw.protocol); | ||
1651 | else if (gcw.device_type != 0) | 1289 | else if (gcw.device_type != 0) |
1652 | printk(KERN_ERR "ide-floppy: Device type is not set to floppy\n"); | 1290 | printk(KERN_ERR "ide-floppy: Device type (0x%02x) is not set " |
1291 | "to floppy\n", gcw.device_type); | ||
1653 | else if (!gcw.removable) | 1292 | else if (!gcw.removable) |
1654 | printk(KERN_ERR "ide-floppy: The removable flag is not set\n"); | 1293 | printk(KERN_ERR "ide-floppy: The removable flag is not set\n"); |
1655 | else if (gcw.drq_type == 3) { | 1294 | else if (gcw.drq_type == 3) { |
1656 | printk(KERN_ERR "ide-floppy: Sorry, DRQ type %d not supported\n", gcw.drq_type); | 1295 | printk(KERN_ERR "ide-floppy: Sorry, DRQ type (0x%02x) not " |
1296 | "supported\n", gcw.drq_type); | ||
1657 | } else if (gcw.packet_size != 0) { | 1297 | } else if (gcw.packet_size != 0) { |
1658 | printk(KERN_ERR "ide-floppy: Packet size is not 12 bytes long\n"); | 1298 | printk(KERN_ERR "ide-floppy: Packet size (0x%02x) is not 12 " |
1299 | "bytes long\n", gcw.packet_size); | ||
1659 | } else | 1300 | } else |
1660 | return 1; | 1301 | return 1; |
1661 | return 0; | 1302 | return 0; |
@@ -1666,59 +1307,53 @@ static void idefloppy_add_settings(ide_drive_t *drive) | |||
1666 | { | 1307 | { |
1667 | idefloppy_floppy_t *floppy = drive->driver_data; | 1308 | idefloppy_floppy_t *floppy = drive->driver_data; |
1668 | 1309 | ||
1669 | /* | 1310 | ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 1023, 1, 1, |
1670 | * drive setting name read/write data type min max mul_factor div_factor data pointer set function | 1311 | &drive->bios_cyl, NULL); |
1671 | */ | 1312 | ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, |
1672 | ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 1023, 1, 1, &drive->bios_cyl, NULL); | 1313 | &drive->bios_head, NULL); |
1673 | ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL); | 1314 | ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, |
1674 | ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL); | 1315 | &drive->bios_sect, NULL); |
1675 | ide_add_setting(drive, "ticks", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &floppy->ticks, NULL); | 1316 | ide_add_setting(drive, "ticks", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, |
1317 | &floppy->ticks, NULL); | ||
1676 | } | 1318 | } |
1677 | #else | 1319 | #else |
1678 | static inline void idefloppy_add_settings(ide_drive_t *drive) { ; } | 1320 | static inline void idefloppy_add_settings(ide_drive_t *drive) { ; } |
1679 | #endif | 1321 | #endif |
1680 | 1322 | ||
1681 | /* | 1323 | static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy) |
1682 | * Driver initialization. | ||
1683 | */ | ||
1684 | static void idefloppy_setup (ide_drive_t *drive, idefloppy_floppy_t *floppy) | ||
1685 | { | 1324 | { |
1686 | struct idefloppy_id_gcw gcw; | 1325 | struct idefloppy_id_gcw gcw; |
1687 | 1326 | ||
1688 | *((u16 *) &gcw) = drive->id->config; | 1327 | *((u16 *) &gcw) = drive->id->config; |
1689 | floppy->pc = floppy->pc_stack; | 1328 | floppy->pc = floppy->pc_stack; |
1690 | if (gcw.drq_type == 1) | 1329 | if (gcw.drq_type == 1) |
1691 | set_bit(IDEFLOPPY_DRQ_INTERRUPT, &floppy->flags); | 1330 | floppy->flags |= IDEFLOPPY_FLAG_DRQ_INTERRUPT; |
1692 | /* | 1331 | /* |
1693 | * We used to check revisions here. At this point however | 1332 | * We used to check revisions here. At this point however I'm giving up. |
1694 | * I'm giving up. Just assume they are all broken, its easier. | 1333 | * Just assume they are all broken, its easier. |
1695 | * | 1334 | * |
1696 | * The actual reason for the workarounds was likely | 1335 | * The actual reason for the workarounds was likely a driver bug after |
1697 | * a driver bug after all rather than a firmware bug, | 1336 | * all rather than a firmware bug, and the workaround below used to hide |
1698 | * and the workaround below used to hide it. It should | 1337 | * it. It should be fixed as of version 1.9, but to be on the safe side |
1699 | * be fixed as of version 1.9, but to be on the safe side | 1338 | * we'll leave the limitation below for the 2.2.x tree. |
1700 | * we'll leave the limitation below for the 2.2.x tree. | ||
1701 | */ | 1339 | */ |
1702 | |||
1703 | if (!strncmp(drive->id->model, "IOMEGA ZIP 100 ATAPI", 20)) { | 1340 | if (!strncmp(drive->id->model, "IOMEGA ZIP 100 ATAPI", 20)) { |
1704 | set_bit(IDEFLOPPY_ZIP_DRIVE, &floppy->flags); | 1341 | floppy->flags |= IDEFLOPPY_FLAG_ZIP_DRIVE; |
1705 | /* This value will be visible in the /proc/ide/hdx/settings */ | 1342 | /* This value will be visible in the /proc/ide/hdx/settings */ |
1706 | floppy->ticks = IDEFLOPPY_TICKS_DELAY; | 1343 | floppy->ticks = IDEFLOPPY_TICKS_DELAY; |
1707 | blk_queue_max_sectors(drive->queue, 64); | 1344 | blk_queue_max_sectors(drive->queue, 64); |
1708 | } | 1345 | } |
1709 | 1346 | ||
1710 | /* | 1347 | /* |
1711 | * Guess what? The IOMEGA Clik! drive also needs the | 1348 | * Guess what? The IOMEGA Clik! drive also needs the above fix. It makes |
1712 | * above fix. It makes nasty clicking noises without | 1349 | * nasty clicking noises without it, so please don't remove this. |
1713 | * it, so please don't remove this. | 1350 | */ |
1714 | */ | ||
1715 | if (strncmp(drive->id->model, "IOMEGA Clik!", 11) == 0) { | 1351 | if (strncmp(drive->id->model, "IOMEGA Clik!", 11) == 0) { |
1716 | blk_queue_max_sectors(drive->queue, 64); | 1352 | blk_queue_max_sectors(drive->queue, 64); |
1717 | set_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags); | 1353 | floppy->flags |= IDEFLOPPY_FLAG_CLIK_DRIVE; |
1718 | } | 1354 | } |
1719 | 1355 | ||
1720 | 1356 | (void) ide_floppy_get_capacity(drive); | |
1721 | (void) idefloppy_get_capacity(drive); | ||
1722 | idefloppy_add_settings(drive); | 1357 | idefloppy_add_settings(drive); |
1723 | } | 1358 | } |
1724 | 1359 | ||
@@ -1734,7 +1369,7 @@ static void ide_floppy_remove(ide_drive_t *drive) | |||
1734 | ide_floppy_put(floppy); | 1369 | ide_floppy_put(floppy); |
1735 | } | 1370 | } |
1736 | 1371 | ||
1737 | static void ide_floppy_release(struct kref *kref) | 1372 | static void idefloppy_cleanup_obj(struct kref *kref) |
1738 | { | 1373 | { |
1739 | struct ide_floppy_obj *floppy = to_ide_floppy(kref); | 1374 | struct ide_floppy_obj *floppy = to_ide_floppy(kref); |
1740 | ide_drive_t *drive = floppy->drive; | 1375 | ide_drive_t *drive = floppy->drive; |
@@ -1747,19 +1382,19 @@ static void ide_floppy_release(struct kref *kref) | |||
1747 | } | 1382 | } |
1748 | 1383 | ||
1749 | #ifdef CONFIG_IDE_PROC_FS | 1384 | #ifdef CONFIG_IDE_PROC_FS |
1750 | static int proc_idefloppy_read_capacity | 1385 | static int proc_idefloppy_read_capacity(char *page, char **start, off_t off, |
1751 | (char *page, char **start, off_t off, int count, int *eof, void *data) | 1386 | int count, int *eof, void *data) |
1752 | { | 1387 | { |
1753 | ide_drive_t*drive = (ide_drive_t *)data; | 1388 | ide_drive_t*drive = (ide_drive_t *)data; |
1754 | int len; | 1389 | int len; |
1755 | 1390 | ||
1756 | len = sprintf(page,"%llu\n", (long long)idefloppy_capacity(drive)); | 1391 | len = sprintf(page, "%llu\n", (long long)idefloppy_capacity(drive)); |
1757 | PROC_IDE_READ_RETURN(page,start,off,count,eof,len); | 1392 | PROC_IDE_READ_RETURN(page, start, off, count, eof, len); |
1758 | } | 1393 | } |
1759 | 1394 | ||
1760 | static ide_proc_entry_t idefloppy_proc[] = { | 1395 | static ide_proc_entry_t idefloppy_proc[] = { |
1761 | { "capacity", S_IFREG|S_IRUGO, proc_idefloppy_read_capacity, NULL }, | 1396 | { "capacity", S_IFREG|S_IRUGO, proc_idefloppy_read_capacity, NULL }, |
1762 | { "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL }, | 1397 | { "geometry", S_IFREG|S_IRUGO, proc_ide_read_geometry, NULL }, |
1763 | { NULL, 0, NULL, NULL } | 1398 | { NULL, 0, NULL, NULL } |
1764 | }; | 1399 | }; |
1765 | #endif /* CONFIG_IDE_PROC_FS */ | 1400 | #endif /* CONFIG_IDE_PROC_FS */ |
@@ -1794,9 +1429,10 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
1794 | idefloppy_pc_t pc; | 1429 | idefloppy_pc_t pc; |
1795 | int ret = 0; | 1430 | int ret = 0; |
1796 | 1431 | ||
1797 | debug_log(KERN_INFO "Reached idefloppy_open\n"); | 1432 | debug_log("Reached %s\n", __func__); |
1798 | 1433 | ||
1799 | if (!(floppy = ide_floppy_get(disk))) | 1434 | floppy = ide_floppy_get(disk); |
1435 | if (!floppy) | ||
1800 | return -ENXIO; | 1436 | return -ENXIO; |
1801 | 1437 | ||
1802 | drive = floppy->drive; | 1438 | drive = floppy->drive; |
@@ -1804,7 +1440,7 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
1804 | floppy->openers++; | 1440 | floppy->openers++; |
1805 | 1441 | ||
1806 | if (floppy->openers == 1) { | 1442 | if (floppy->openers == 1) { |
1807 | clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); | 1443 | floppy->flags &= ~IDEFLOPPY_FLAG_FORMAT_IN_PROGRESS; |
1808 | /* Just in case */ | 1444 | /* Just in case */ |
1809 | 1445 | ||
1810 | idefloppy_create_test_unit_ready_cmd(&pc); | 1446 | idefloppy_create_test_unit_ready_cmd(&pc); |
@@ -1813,13 +1449,13 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
1813 | (void) idefloppy_queue_pc_tail(drive, &pc); | 1449 | (void) idefloppy_queue_pc_tail(drive, &pc); |
1814 | } | 1450 | } |
1815 | 1451 | ||
1816 | if (idefloppy_get_capacity (drive) | 1452 | if (ide_floppy_get_capacity(drive) |
1817 | && (filp->f_flags & O_NDELAY) == 0 | 1453 | && (filp->f_flags & O_NDELAY) == 0 |
1818 | /* | 1454 | /* |
1819 | ** Allow O_NDELAY to open a drive without a disk, or with | 1455 | * Allow O_NDELAY to open a drive without a disk, or with an |
1820 | ** an unreadable disk, so that we can get the format | 1456 | * unreadable disk, so that we can get the format capacity |
1821 | ** capacity of the drive or begin the format - Sam | 1457 | * of the drive or begin the format - Sam |
1822 | */ | 1458 | */ |
1823 | ) { | 1459 | ) { |
1824 | ret = -EIO; | 1460 | ret = -EIO; |
1825 | goto out_put_floppy; | 1461 | goto out_put_floppy; |
@@ -1829,14 +1465,14 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
1829 | ret = -EROFS; | 1465 | ret = -EROFS; |
1830 | goto out_put_floppy; | 1466 | goto out_put_floppy; |
1831 | } | 1467 | } |
1832 | set_bit(IDEFLOPPY_MEDIA_CHANGED, &floppy->flags); | 1468 | floppy->flags |= IDEFLOPPY_FLAG_MEDIA_CHANGED; |
1833 | /* IOMEGA Clik! drives do not support lock/unlock commands */ | 1469 | /* IOMEGA Clik! drives do not support lock/unlock commands */ |
1834 | if (!test_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags)) { | 1470 | if (!(floppy->flags & IDEFLOPPY_FLAG_CLIK_DRIVE)) { |
1835 | idefloppy_create_prevent_cmd(&pc, 1); | 1471 | idefloppy_create_prevent_cmd(&pc, 1); |
1836 | (void) idefloppy_queue_pc_tail(drive, &pc); | 1472 | (void) idefloppy_queue_pc_tail(drive, &pc); |
1837 | } | 1473 | } |
1838 | check_disk_change(inode->i_bdev); | 1474 | check_disk_change(inode->i_bdev); |
1839 | } else if (test_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags)) { | 1475 | } else if (floppy->flags & IDEFLOPPY_FLAG_FORMAT_IN_PROGRESS) { |
1840 | ret = -EBUSY; | 1476 | ret = -EBUSY; |
1841 | goto out_put_floppy; | 1477 | goto out_put_floppy; |
1842 | } | 1478 | } |
@@ -1854,17 +1490,17 @@ static int idefloppy_release(struct inode *inode, struct file *filp) | |||
1854 | struct ide_floppy_obj *floppy = ide_floppy_g(disk); | 1490 | struct ide_floppy_obj *floppy = ide_floppy_g(disk); |
1855 | ide_drive_t *drive = floppy->drive; | 1491 | ide_drive_t *drive = floppy->drive; |
1856 | idefloppy_pc_t pc; | 1492 | idefloppy_pc_t pc; |
1857 | 1493 | ||
1858 | debug_log(KERN_INFO "Reached idefloppy_release\n"); | 1494 | debug_log("Reached %s\n", __func__); |
1859 | 1495 | ||
1860 | if (floppy->openers == 1) { | 1496 | if (floppy->openers == 1) { |
1861 | /* IOMEGA Clik! drives do not support lock/unlock commands */ | 1497 | /* IOMEGA Clik! drives do not support lock/unlock commands */ |
1862 | if (!test_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags)) { | 1498 | if (!(floppy->flags & IDEFLOPPY_FLAG_CLIK_DRIVE)) { |
1863 | idefloppy_create_prevent_cmd(&pc, 0); | 1499 | idefloppy_create_prevent_cmd(&pc, 0); |
1864 | (void) idefloppy_queue_pc_tail(drive, &pc); | 1500 | (void) idefloppy_queue_pc_tail(drive, &pc); |
1865 | } | 1501 | } |
1866 | 1502 | ||
1867 | clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); | 1503 | floppy->flags &= ~IDEFLOPPY_FLAG_FORMAT_IN_PROGRESS; |
1868 | } | 1504 | } |
1869 | 1505 | ||
1870 | floppy->openers--; | 1506 | floppy->openers--; |
@@ -1885,64 +1521,105 @@ static int idefloppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
1885 | return 0; | 1521 | return 0; |
1886 | } | 1522 | } |
1887 | 1523 | ||
1524 | static int ide_floppy_lockdoor(idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, | ||
1525 | unsigned long arg, unsigned int cmd) | ||
1526 | { | ||
1527 | if (floppy->openers > 1) | ||
1528 | return -EBUSY; | ||
1529 | |||
1530 | /* The IOMEGA Clik! Drive doesn't support this command - | ||
1531 | * no room for an eject mechanism */ | ||
1532 | if (!(floppy->flags & IDEFLOPPY_FLAG_CLIK_DRIVE)) { | ||
1533 | int prevent = arg ? 1 : 0; | ||
1534 | |||
1535 | if (cmd == CDROMEJECT) | ||
1536 | prevent = 0; | ||
1537 | |||
1538 | idefloppy_create_prevent_cmd(pc, prevent); | ||
1539 | (void) idefloppy_queue_pc_tail(floppy->drive, pc); | ||
1540 | } | ||
1541 | |||
1542 | if (cmd == CDROMEJECT) { | ||
1543 | idefloppy_create_start_stop_cmd(pc, 2); | ||
1544 | (void) idefloppy_queue_pc_tail(floppy->drive, pc); | ||
1545 | } | ||
1546 | |||
1547 | return 0; | ||
1548 | } | ||
1549 | |||
1550 | static int ide_floppy_format_unit(idefloppy_floppy_t *floppy, | ||
1551 | int __user *arg) | ||
1552 | { | ||
1553 | int blocks, length, flags, err = 0; | ||
1554 | idefloppy_pc_t pc; | ||
1555 | |||
1556 | if (floppy->openers > 1) { | ||
1557 | /* Don't format if someone is using the disk */ | ||
1558 | floppy->flags &= ~IDEFLOPPY_FLAG_FORMAT_IN_PROGRESS; | ||
1559 | return -EBUSY; | ||
1560 | } | ||
1561 | |||
1562 | floppy->flags |= IDEFLOPPY_FLAG_FORMAT_IN_PROGRESS; | ||
1563 | |||
1564 | /* | ||
1565 | * Send ATAPI_FORMAT_UNIT to the drive. | ||
1566 | * | ||
1567 | * Userland gives us the following structure: | ||
1568 | * | ||
1569 | * struct idefloppy_format_command { | ||
1570 | * int nblocks; | ||
1571 | * int blocksize; | ||
1572 | * int flags; | ||
1573 | * } ; | ||
1574 | * | ||
1575 | * flags is a bitmask, currently, the only defined flag is: | ||
1576 | * | ||
1577 | * 0x01 - verify media after format. | ||
1578 | */ | ||
1579 | if (get_user(blocks, arg) || | ||
1580 | get_user(length, arg+1) || | ||
1581 | get_user(flags, arg+2)) { | ||
1582 | err = -EFAULT; | ||
1583 | goto out; | ||
1584 | } | ||
1585 | |||
1586 | (void) idefloppy_get_sfrp_bit(floppy->drive); | ||
1587 | idefloppy_create_format_unit_cmd(&pc, blocks, length, flags); | ||
1588 | |||
1589 | if (idefloppy_queue_pc_tail(floppy->drive, &pc)) | ||
1590 | err = -EIO; | ||
1591 | |||
1592 | out: | ||
1593 | if (err) | ||
1594 | floppy->flags &= ~IDEFLOPPY_FLAG_FORMAT_IN_PROGRESS; | ||
1595 | return err; | ||
1596 | } | ||
1597 | |||
1598 | |||
1888 | static int idefloppy_ioctl(struct inode *inode, struct file *file, | 1599 | static int idefloppy_ioctl(struct inode *inode, struct file *file, |
1889 | unsigned int cmd, unsigned long arg) | 1600 | unsigned int cmd, unsigned long arg) |
1890 | { | 1601 | { |
1891 | struct block_device *bdev = inode->i_bdev; | 1602 | struct block_device *bdev = inode->i_bdev; |
1892 | struct ide_floppy_obj *floppy = ide_floppy_g(bdev->bd_disk); | 1603 | struct ide_floppy_obj *floppy = ide_floppy_g(bdev->bd_disk); |
1893 | ide_drive_t *drive = floppy->drive; | 1604 | ide_drive_t *drive = floppy->drive; |
1605 | idefloppy_pc_t pc; | ||
1894 | void __user *argp = (void __user *)arg; | 1606 | void __user *argp = (void __user *)arg; |
1895 | int err; | 1607 | int err; |
1896 | int prevent = (arg) ? 1 : 0; | ||
1897 | idefloppy_pc_t pc; | ||
1898 | 1608 | ||
1899 | switch (cmd) { | 1609 | switch (cmd) { |
1900 | case CDROMEJECT: | 1610 | case CDROMEJECT: |
1901 | prevent = 0; | ||
1902 | /* fall through */ | 1611 | /* fall through */ |
1903 | case CDROM_LOCKDOOR: | 1612 | case CDROM_LOCKDOOR: |
1904 | if (floppy->openers > 1) | 1613 | return ide_floppy_lockdoor(floppy, &pc, arg, cmd); |
1905 | return -EBUSY; | ||
1906 | |||
1907 | /* The IOMEGA Clik! Drive doesn't support this command - no room for an eject mechanism */ | ||
1908 | if (!test_bit(IDEFLOPPY_CLIK_DRIVE, &floppy->flags)) { | ||
1909 | idefloppy_create_prevent_cmd(&pc, prevent); | ||
1910 | (void) idefloppy_queue_pc_tail(drive, &pc); | ||
1911 | } | ||
1912 | if (cmd == CDROMEJECT) { | ||
1913 | idefloppy_create_start_stop_cmd(&pc, 2); | ||
1914 | (void) idefloppy_queue_pc_tail(drive, &pc); | ||
1915 | } | ||
1916 | return 0; | ||
1917 | case IDEFLOPPY_IOCTL_FORMAT_SUPPORTED: | 1614 | case IDEFLOPPY_IOCTL_FORMAT_SUPPORTED: |
1918 | return 0; | 1615 | return 0; |
1919 | case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY: | 1616 | case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY: |
1920 | return idefloppy_get_format_capacities(drive, argp); | 1617 | return ide_floppy_get_format_capacities(drive, argp); |
1921 | case IDEFLOPPY_IOCTL_FORMAT_START: | 1618 | case IDEFLOPPY_IOCTL_FORMAT_START: |
1922 | |||
1923 | if (!(file->f_mode & 2)) | 1619 | if (!(file->f_mode & 2)) |
1924 | return -EPERM; | 1620 | return -EPERM; |
1925 | 1621 | ||
1926 | if (floppy->openers > 1) { | 1622 | return ide_floppy_format_unit(floppy, (int __user *)arg); |
1927 | /* Don't format if someone is using the disk */ | ||
1928 | |||
1929 | clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, | ||
1930 | &floppy->flags); | ||
1931 | return -EBUSY; | ||
1932 | } | ||
1933 | |||
1934 | set_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); | ||
1935 | |||
1936 | err = idefloppy_begin_format(drive, argp); | ||
1937 | if (err) | ||
1938 | clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags); | ||
1939 | return err; | ||
1940 | /* | ||
1941 | ** Note, the bit will be cleared when the device is | ||
1942 | ** closed. This is the cleanest way to handle the | ||
1943 | ** situation where the drive does not support | ||
1944 | ** format progress reporting. | ||
1945 | */ | ||
1946 | case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS: | 1623 | case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS: |
1947 | return idefloppy_get_format_progress(drive, argp); | 1624 | return idefloppy_get_format_progress(drive, argp); |
1948 | } | 1625 | } |
@@ -1967,13 +1644,16 @@ static int idefloppy_media_changed(struct gendisk *disk) | |||
1967 | { | 1644 | { |
1968 | struct ide_floppy_obj *floppy = ide_floppy_g(disk); | 1645 | struct ide_floppy_obj *floppy = ide_floppy_g(disk); |
1969 | ide_drive_t *drive = floppy->drive; | 1646 | ide_drive_t *drive = floppy->drive; |
1647 | int ret; | ||
1970 | 1648 | ||
1971 | /* do not scan partitions twice if this is a removable device */ | 1649 | /* do not scan partitions twice if this is a removable device */ |
1972 | if (drive->attach) { | 1650 | if (drive->attach) { |
1973 | drive->attach = 0; | 1651 | drive->attach = 0; |
1974 | return 0; | 1652 | return 0; |
1975 | } | 1653 | } |
1976 | return test_and_clear_bit(IDEFLOPPY_MEDIA_CHANGED, &floppy->flags); | 1654 | ret = !!(floppy->flags & IDEFLOPPY_FLAG_MEDIA_CHANGED); |
1655 | floppy->flags &= ~IDEFLOPPY_FLAG_MEDIA_CHANGED; | ||
1656 | return ret; | ||
1977 | } | 1657 | } |
1978 | 1658 | ||
1979 | static int idefloppy_revalidate_disk(struct gendisk *disk) | 1659 | static int idefloppy_revalidate_disk(struct gendisk *disk) |
@@ -2004,16 +1684,20 @@ static int ide_floppy_probe(ide_drive_t *drive) | |||
2004 | goto failed; | 1684 | goto failed; |
2005 | if (drive->media != ide_floppy) | 1685 | if (drive->media != ide_floppy) |
2006 | goto failed; | 1686 | goto failed; |
2007 | if (!idefloppy_identify_device (drive, drive->id)) { | 1687 | if (!idefloppy_identify_device(drive, drive->id)) { |
2008 | printk (KERN_ERR "ide-floppy: %s: not supported by this version of ide-floppy\n", drive->name); | 1688 | printk(KERN_ERR "ide-floppy: %s: not supported by this version" |
1689 | " of ide-floppy\n", drive->name); | ||
2009 | goto failed; | 1690 | goto failed; |
2010 | } | 1691 | } |
2011 | if (drive->scsi) { | 1692 | if (drive->scsi) { |
2012 | printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name); | 1693 | printk(KERN_INFO "ide-floppy: passing drive %s to ide-scsi" |
1694 | " emulation.\n", drive->name); | ||
2013 | goto failed; | 1695 | goto failed; |
2014 | } | 1696 | } |
2015 | if ((floppy = kzalloc(sizeof (idefloppy_floppy_t), GFP_KERNEL)) == NULL) { | 1697 | floppy = kzalloc(sizeof(idefloppy_floppy_t), GFP_KERNEL); |
2016 | printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name); | 1698 | if (!floppy) { |
1699 | printk(KERN_ERR "ide-floppy: %s: Can't allocate a floppy" | ||
1700 | " structure\n", drive->name); | ||
2017 | goto failed; | 1701 | goto failed; |
2018 | } | 1702 | } |
2019 | 1703 | ||
@@ -2035,7 +1719,7 @@ static int ide_floppy_probe(ide_drive_t *drive) | |||
2035 | 1719 | ||
2036 | drive->driver_data = floppy; | 1720 | drive->driver_data = floppy; |
2037 | 1721 | ||
2038 | idefloppy_setup (drive, floppy); | 1722 | idefloppy_setup(drive, floppy); |
2039 | 1723 | ||
2040 | g->minors = 1 << PARTN_BITS; | 1724 | g->minors = 1 << PARTN_BITS; |
2041 | g->driverfs_dev = &drive->gendev; | 1725 | g->driverfs_dev = &drive->gendev; |
@@ -2051,9 +1735,7 @@ failed: | |||
2051 | return -ENODEV; | 1735 | return -ENODEV; |
2052 | } | 1736 | } |
2053 | 1737 | ||
2054 | MODULE_DESCRIPTION("ATAPI FLOPPY Driver"); | 1738 | static void __exit idefloppy_exit(void) |
2055 | |||
2056 | static void __exit idefloppy_exit (void) | ||
2057 | { | 1739 | { |
2058 | driver_unregister(&idefloppy_driver.gen_driver); | 1740 | driver_unregister(&idefloppy_driver.gen_driver); |
2059 | } | 1741 | } |
@@ -2068,3 +1750,5 @@ MODULE_ALIAS("ide:*m-floppy*"); | |||
2068 | module_init(idefloppy_init); | 1750 | module_init(idefloppy_init); |
2069 | module_exit(idefloppy_exit); | 1751 | module_exit(idefloppy_exit); |
2070 | MODULE_LICENSE("GPL"); | 1752 | MODULE_LICENSE("GPL"); |
1753 | MODULE_DESCRIPTION("ATAPI FLOPPY Driver"); | ||
1754 | |||
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c index bb30c29f6ec0..be469dbbe8fb 100644 --- a/drivers/ide/ide-generic.c +++ b/drivers/ide/ide-generic.c | |||
@@ -23,7 +23,7 @@ static int __init ide_generic_init(void) | |||
23 | for (i = 0; i < MAX_HWIFS; i++) | 23 | for (i = 0; i < MAX_HWIFS; i++) |
24 | idx[i] = ide_hwifs[i].present ? 0xff : i; | 24 | idx[i] = ide_hwifs[i].present ? 0xff : i; |
25 | 25 | ||
26 | ide_device_add_all(idx); | 26 | ide_device_add_all(idx, NULL); |
27 | 27 | ||
28 | if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) | 28 | if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) |
29 | ide_release_lock(); /* for atari only */ | 29 | ide_release_lock(); /* for atari only */ |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 16b1f6e12781..a95178f5e1bb 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -163,8 +163,6 @@ void SELECT_DRIVE (ide_drive_t *drive) | |||
163 | HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG); | 163 | HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG); |
164 | } | 164 | } |
165 | 165 | ||
166 | EXPORT_SYMBOL(SELECT_DRIVE); | ||
167 | |||
168 | void SELECT_MASK (ide_drive_t *drive, int mask) | 166 | void SELECT_MASK (ide_drive_t *drive, int mask) |
169 | { | 167 | { |
170 | if (HWIF(drive)->maskproc) | 168 | if (HWIF(drive)->maskproc) |
@@ -614,66 +612,6 @@ no_80w: | |||
614 | return 0; | 612 | return 0; |
615 | } | 613 | } |
616 | 614 | ||
617 | int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) | ||
618 | { | ||
619 | if (args->tf.command == WIN_SETFEATURES && | ||
620 | args->tf.nsect > XFER_UDMA_2 && | ||
621 | args->tf.feature == SETFEATURES_XFER) { | ||
622 | if (eighty_ninty_three(drive) == 0) { | ||
623 | printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " | ||
624 | "be set\n", drive->name); | ||
625 | return 1; | ||
626 | } | ||
627 | } | ||
628 | |||
629 | return 0; | ||
630 | } | ||
631 | |||
632 | /* | ||
633 | * Backside of HDIO_DRIVE_CMD call of SETFEATURES_XFER. | ||
634 | * 1 : Safe to update drive->id DMA registers. | ||
635 | * 0 : OOPs not allowed. | ||
636 | */ | ||
637 | int set_transfer (ide_drive_t *drive, ide_task_t *args) | ||
638 | { | ||
639 | if (args->tf.command == WIN_SETFEATURES && | ||
640 | args->tf.nsect >= XFER_SW_DMA_0 && | ||
641 | args->tf.feature == SETFEATURES_XFER && | ||
642 | (drive->id->dma_ultra || | ||
643 | drive->id->dma_mword || | ||
644 | drive->id->dma_1word)) | ||
645 | return 1; | ||
646 | |||
647 | return 0; | ||
648 | } | ||
649 | |||
650 | #ifdef CONFIG_BLK_DEV_IDEDMA | ||
651 | static u8 ide_auto_reduce_xfer (ide_drive_t *drive) | ||
652 | { | ||
653 | if (!drive->crc_count) | ||
654 | return drive->current_speed; | ||
655 | drive->crc_count = 0; | ||
656 | |||
657 | switch(drive->current_speed) { | ||
658 | case XFER_UDMA_7: return XFER_UDMA_6; | ||
659 | case XFER_UDMA_6: return XFER_UDMA_5; | ||
660 | case XFER_UDMA_5: return XFER_UDMA_4; | ||
661 | case XFER_UDMA_4: return XFER_UDMA_3; | ||
662 | case XFER_UDMA_3: return XFER_UDMA_2; | ||
663 | case XFER_UDMA_2: return XFER_UDMA_1; | ||
664 | case XFER_UDMA_1: return XFER_UDMA_0; | ||
665 | /* | ||
666 | * OOPS we do not goto non Ultra DMA modes | ||
667 | * without iCRC's available we force | ||
668 | * the system to PIO and make the user | ||
669 | * invoke the ATA-1 ATA-2 DMA modes. | ||
670 | */ | ||
671 | case XFER_UDMA_0: | ||
672 | default: return XFER_PIO_4; | ||
673 | } | ||
674 | } | ||
675 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | ||
676 | |||
677 | int ide_driveid_update(ide_drive_t *drive) | 615 | int ide_driveid_update(ide_drive_t *drive) |
678 | { | 616 | { |
679 | ide_hwif_t *hwif = drive->hwif; | 617 | ide_hwif_t *hwif = drive->hwif; |
@@ -882,22 +820,17 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | |||
882 | unsigned long flags; | 820 | unsigned long flags; |
883 | ide_hwgroup_t *hwgroup = HWGROUP(drive); | 821 | ide_hwgroup_t *hwgroup = HWGROUP(drive); |
884 | ide_hwif_t *hwif = HWIF(drive); | 822 | ide_hwif_t *hwif = HWIF(drive); |
885 | 823 | ||
886 | spin_lock_irqsave(&ide_lock, flags); | 824 | spin_lock_irqsave(&ide_lock, flags); |
887 | |||
888 | BUG_ON(hwgroup->handler); | 825 | BUG_ON(hwgroup->handler); |
889 | hwgroup->handler = handler; | 826 | __ide_set_handler(drive, handler, timeout, expiry); |
890 | hwgroup->expiry = expiry; | ||
891 | hwgroup->timer.expires = jiffies + timeout; | ||
892 | hwgroup->req_gen_timer = hwgroup->req_gen; | ||
893 | add_timer(&hwgroup->timer); | ||
894 | hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); | 827 | hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); |
895 | /* Drive takes 400nS to respond, we must avoid the IRQ being | 828 | /* |
896 | serviced before that. | 829 | * Drive takes 400nS to respond, we must avoid the IRQ being |
897 | 830 | * serviced before that. | |
898 | FIXME: we could skip this delay with care on non shared | 831 | * |
899 | devices | 832 | * FIXME: we could skip this delay with care on non shared devices |
900 | */ | 833 | */ |
901 | ndelay(400); | 834 | ndelay(400); |
902 | spin_unlock_irqrestore(&ide_lock, flags); | 835 | spin_unlock_irqrestore(&ide_lock, flags); |
903 | } | 836 | } |
@@ -1005,19 +938,6 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) | |||
1005 | return ide_stopped; | 938 | return ide_stopped; |
1006 | } | 939 | } |
1007 | 940 | ||
1008 | static void check_dma_crc(ide_drive_t *drive) | ||
1009 | { | ||
1010 | #ifdef CONFIG_BLK_DEV_IDEDMA | ||
1011 | if (drive->crc_count) { | ||
1012 | ide_dma_off_quietly(drive); | ||
1013 | ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive)); | ||
1014 | if (drive->current_speed >= XFER_SW_DMA_0) | ||
1015 | ide_dma_on(drive); | ||
1016 | } else | ||
1017 | ide_dma_off(drive); | ||
1018 | #endif | ||
1019 | } | ||
1020 | |||
1021 | static void ide_disk_pre_reset(ide_drive_t *drive) | 941 | static void ide_disk_pre_reset(ide_drive_t *drive) |
1022 | { | 942 | { |
1023 | int legacy = (drive->id->cfs_enable_2 & 0x0400) ? 0 : 1; | 943 | int legacy = (drive->id->cfs_enable_2 & 0x0400) ? 0 : 1; |
@@ -1039,17 +959,20 @@ static void pre_reset(ide_drive_t *drive) | |||
1039 | else | 959 | else |
1040 | drive->post_reset = 1; | 960 | drive->post_reset = 1; |
1041 | 961 | ||
962 | if (drive->using_dma) { | ||
963 | if (drive->crc_count) | ||
964 | ide_check_dma_crc(drive); | ||
965 | else | ||
966 | ide_dma_off(drive); | ||
967 | } | ||
968 | |||
1042 | if (!drive->keep_settings) { | 969 | if (!drive->keep_settings) { |
1043 | if (drive->using_dma) { | 970 | if (!drive->using_dma) { |
1044 | check_dma_crc(drive); | ||
1045 | } else { | ||
1046 | drive->unmask = 0; | 971 | drive->unmask = 0; |
1047 | drive->io_32bit = 0; | 972 | drive->io_32bit = 0; |
1048 | } | 973 | } |
1049 | return; | 974 | return; |
1050 | } | 975 | } |
1051 | if (drive->using_dma) | ||
1052 | check_dma_crc(drive); | ||
1053 | 976 | ||
1054 | if (HWIF(drive)->pre_reset != NULL) | 977 | if (HWIF(drive)->pre_reset != NULL) |
1055 | HWIF(drive)->pre_reset(drive); | 978 | HWIF(drive)->pre_reset(drive); |
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index 4bda5cf2be37..b163b2e52212 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c | |||
@@ -49,7 +49,7 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id | |||
49 | printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); | 49 | printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); |
50 | pnp_set_drvdata(dev,hwif); | 50 | pnp_set_drvdata(dev,hwif); |
51 | 51 | ||
52 | ide_device_add(idx); | 52 | ide_device_add(idx, NULL); |
53 | 53 | ||
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
@@ -60,9 +60,10 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id | |||
60 | static void idepnp_remove(struct pnp_dev * dev) | 60 | static void idepnp_remove(struct pnp_dev * dev) |
61 | { | 61 | { |
62 | ide_hwif_t *hwif = pnp_get_drvdata(dev); | 62 | ide_hwif_t *hwif = pnp_get_drvdata(dev); |
63 | if (hwif) { | 63 | |
64 | ide_unregister(hwif->index); | 64 | if (hwif) |
65 | } else | 65 | ide_unregister(hwif->index, 0, 0); |
66 | else | ||
66 | printk(KERN_ERR "idepnp: Unable to remove device, please report.\n"); | 67 | printk(KERN_ERR "idepnp: Unable to remove device, please report.\n"); |
67 | } | 68 | } |
68 | 69 | ||
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 98a8af44bf64..9c07bdb68d1a 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -423,8 +423,9 @@ static int ide_busy_sleep(ide_hwif_t *hwif) | |||
423 | 423 | ||
424 | static int do_probe (ide_drive_t *drive, u8 cmd) | 424 | static int do_probe (ide_drive_t *drive, u8 cmd) |
425 | { | 425 | { |
426 | int rc; | ||
427 | ide_hwif_t *hwif = HWIF(drive); | 426 | ide_hwif_t *hwif = HWIF(drive); |
427 | int rc; | ||
428 | u8 stat; | ||
428 | 429 | ||
429 | if (drive->present) { | 430 | if (drive->present) { |
430 | /* avoid waiting for inappropriate probes */ | 431 | /* avoid waiting for inappropriate probes */ |
@@ -461,15 +462,17 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
461 | /* failed: try again */ | 462 | /* failed: try again */ |
462 | rc = try_to_identify(drive,cmd); | 463 | rc = try_to_identify(drive,cmd); |
463 | } | 464 | } |
464 | if (hwif->INB(IDE_STATUS_REG) == (BUSY_STAT|READY_STAT)) | 465 | |
466 | stat = hwif->INB(IDE_STATUS_REG); | ||
467 | |||
468 | if (stat == (BUSY_STAT | READY_STAT)) | ||
465 | return 4; | 469 | return 4; |
466 | 470 | ||
467 | if ((rc == 1 && cmd == WIN_PIDENTIFY) && | 471 | if ((rc == 1 && cmd == WIN_PIDENTIFY) && |
468 | ((drive->autotune == IDE_TUNE_DEFAULT) || | 472 | ((drive->autotune == IDE_TUNE_DEFAULT) || |
469 | (drive->autotune == IDE_TUNE_AUTO))) { | 473 | (drive->autotune == IDE_TUNE_AUTO))) { |
470 | printk("%s: no response (status = 0x%02x), " | 474 | printk(KERN_ERR "%s: no response (status = 0x%02x), " |
471 | "resetting drive\n", drive->name, | 475 | "resetting drive\n", drive->name, stat); |
472 | hwif->INB(IDE_STATUS_REG)); | ||
473 | msleep(50); | 476 | msleep(50); |
474 | hwif->OUTB(drive->select.all, IDE_SELECT_REG); | 477 | hwif->OUTB(drive->select.all, IDE_SELECT_REG); |
475 | msleep(50); | 478 | msleep(50); |
@@ -477,11 +480,13 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
477 | (void)ide_busy_sleep(hwif); | 480 | (void)ide_busy_sleep(hwif); |
478 | rc = try_to_identify(drive, cmd); | 481 | rc = try_to_identify(drive, cmd); |
479 | } | 482 | } |
483 | |||
484 | /* ensure drive IRQ is clear */ | ||
485 | stat = hwif->INB(IDE_STATUS_REG); | ||
486 | |||
480 | if (rc == 1) | 487 | if (rc == 1) |
481 | printk("%s: no response (status = 0x%02x)\n", | 488 | printk(KERN_ERR "%s: no response (status = 0x%02x)\n", |
482 | drive->name, hwif->INB(IDE_STATUS_REG)); | 489 | drive->name, stat); |
483 | /* ensure drive irq is clear */ | ||
484 | (void) hwif->INB(IDE_STATUS_REG); | ||
485 | } else { | 490 | } else { |
486 | /* not present or maybe ATAPI */ | 491 | /* not present or maybe ATAPI */ |
487 | rc = 3; | 492 | rc = 3; |
@@ -502,6 +507,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
502 | static void enable_nest (ide_drive_t *drive) | 507 | static void enable_nest (ide_drive_t *drive) |
503 | { | 508 | { |
504 | ide_hwif_t *hwif = HWIF(drive); | 509 | ide_hwif_t *hwif = HWIF(drive); |
510 | u8 stat; | ||
505 | 511 | ||
506 | printk("%s: enabling %s -- ", hwif->name, drive->id->model); | 512 | printk("%s: enabling %s -- ", hwif->name, drive->id->model); |
507 | SELECT_DRIVE(drive); | 513 | SELECT_DRIVE(drive); |
@@ -515,11 +521,12 @@ static void enable_nest (ide_drive_t *drive) | |||
515 | 521 | ||
516 | msleep(50); | 522 | msleep(50); |
517 | 523 | ||
518 | if (!OK_STAT((hwif->INB(IDE_STATUS_REG)), 0, BAD_STAT)) { | 524 | stat = hwif->INB(IDE_STATUS_REG); |
519 | printk("failed (status = 0x%02x)\n", hwif->INB(IDE_STATUS_REG)); | 525 | |
520 | } else { | 526 | if (!OK_STAT(stat, 0, BAD_STAT)) |
521 | printk("success\n"); | 527 | printk(KERN_CONT "failed (status = 0x%02x)\n", stat); |
522 | } | 528 | else |
529 | printk(KERN_CONT "success\n"); | ||
523 | 530 | ||
524 | /* if !(success||timed-out) */ | 531 | /* if !(success||timed-out) */ |
525 | if (do_probe(drive, WIN_IDENTIFY) >= 2) { | 532 | if (do_probe(drive, WIN_IDENTIFY) >= 2) { |
@@ -822,7 +829,7 @@ static void ide_port_tune_devices(ide_hwif_t *hwif) | |||
822 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 829 | for (unit = 0; unit < MAX_DRIVES; ++unit) { |
823 | ide_drive_t *drive = &hwif->drives[unit]; | 830 | ide_drive_t *drive = &hwif->drives[unit]; |
824 | 831 | ||
825 | if (hwif->no_io_32bit) | 832 | if (hwif->host_flags & IDE_HFLAG_NO_IO_32BIT) |
826 | drive->no_io_32bit = 1; | 833 | drive->no_io_32bit = 1; |
827 | else | 834 | else |
828 | drive->no_io_32bit = drive->id->dword_io ? 1 : 0; | 835 | drive->no_io_32bit = drive->id->dword_io ? 1 : 0; |
@@ -881,13 +888,6 @@ static int ide_init_queue(ide_drive_t *drive) | |||
881 | q->queuedata = drive; | 888 | q->queuedata = drive; |
882 | blk_queue_segment_boundary(q, 0xffff); | 889 | blk_queue_segment_boundary(q, 0xffff); |
883 | 890 | ||
884 | if (!hwif->rqsize) { | ||
885 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) || | ||
886 | (hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA)) | ||
887 | hwif->rqsize = 256; | ||
888 | else | ||
889 | hwif->rqsize = 65536; | ||
890 | } | ||
891 | if (hwif->rqsize < max_sectors) | 891 | if (hwif->rqsize < max_sectors) |
892 | max_sectors = hwif->rqsize; | 892 | max_sectors = hwif->rqsize; |
893 | blk_queue_max_sectors(q, max_sectors); | 893 | blk_queue_max_sectors(q, max_sectors); |
@@ -918,6 +918,48 @@ static int ide_init_queue(ide_drive_t *drive) | |||
918 | return 0; | 918 | return 0; |
919 | } | 919 | } |
920 | 920 | ||
921 | static void ide_add_drive_to_hwgroup(ide_drive_t *drive) | ||
922 | { | ||
923 | ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; | ||
924 | |||
925 | spin_lock_irq(&ide_lock); | ||
926 | if (!hwgroup->drive) { | ||
927 | /* first drive for hwgroup. */ | ||
928 | drive->next = drive; | ||
929 | hwgroup->drive = drive; | ||
930 | hwgroup->hwif = HWIF(hwgroup->drive); | ||
931 | } else { | ||
932 | drive->next = hwgroup->drive->next; | ||
933 | hwgroup->drive->next = drive; | ||
934 | } | ||
935 | spin_unlock_irq(&ide_lock); | ||
936 | } | ||
937 | |||
938 | /* | ||
939 | * For any present drive: | ||
940 | * - allocate the block device queue | ||
941 | * - link drive into the hwgroup | ||
942 | */ | ||
943 | static void ide_port_setup_devices(ide_hwif_t *hwif) | ||
944 | { | ||
945 | int i; | ||
946 | |||
947 | for (i = 0; i < MAX_DRIVES; i++) { | ||
948 | ide_drive_t *drive = &hwif->drives[i]; | ||
949 | |||
950 | if (!drive->present) | ||
951 | continue; | ||
952 | |||
953 | if (ide_init_queue(drive)) { | ||
954 | printk(KERN_ERR "ide: failed to init %s\n", | ||
955 | drive->name); | ||
956 | continue; | ||
957 | } | ||
958 | |||
959 | ide_add_drive_to_hwgroup(drive); | ||
960 | } | ||
961 | } | ||
962 | |||
921 | /* | 963 | /* |
922 | * This routine sets up the irq for an ide interface, and creates a new | 964 | * This routine sets up the irq for an ide interface, and creates a new |
923 | * hwgroup for the irq/hwif if none was previously assigned. | 965 | * hwgroup for the irq/hwif if none was previously assigned. |
@@ -1019,30 +1061,12 @@ static int init_irq (ide_hwif_t *hwif) | |||
1019 | goto out_unlink; | 1061 | goto out_unlink; |
1020 | } | 1062 | } |
1021 | 1063 | ||
1022 | /* | 1064 | if (!hwif->rqsize) { |
1023 | * For any present drive: | 1065 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) || |
1024 | * - allocate the block device queue | 1066 | (hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA)) |
1025 | * - link drive into the hwgroup | 1067 | hwif->rqsize = 256; |
1026 | */ | 1068 | else |
1027 | for (index = 0; index < MAX_DRIVES; ++index) { | 1069 | hwif->rqsize = 65536; |
1028 | ide_drive_t *drive = &hwif->drives[index]; | ||
1029 | if (!drive->present) | ||
1030 | continue; | ||
1031 | if (ide_init_queue(drive)) { | ||
1032 | printk(KERN_ERR "ide: failed to init %s\n",drive->name); | ||
1033 | continue; | ||
1034 | } | ||
1035 | spin_lock_irq(&ide_lock); | ||
1036 | if (!hwgroup->drive) { | ||
1037 | /* first drive for hwgroup. */ | ||
1038 | drive->next = drive; | ||
1039 | hwgroup->drive = drive; | ||
1040 | hwgroup->hwif = HWIF(hwgroup->drive); | ||
1041 | } else { | ||
1042 | drive->next = hwgroup->drive->next; | ||
1043 | hwgroup->drive->next = drive; | ||
1044 | } | ||
1045 | spin_unlock_irq(&ide_lock); | ||
1046 | } | 1070 | } |
1047 | 1071 | ||
1048 | #if !defined(__mc68000__) && !defined(CONFIG_APUS) | 1072 | #if !defined(__mc68000__) && !defined(CONFIG_APUS) |
@@ -1058,6 +1082,9 @@ static int init_irq (ide_hwif_t *hwif) | |||
1058 | printk(" (%sed with %s)", | 1082 | printk(" (%sed with %s)", |
1059 | hwif->sharing_irq ? "shar" : "serializ", match->name); | 1083 | hwif->sharing_irq ? "shar" : "serializ", match->name); |
1060 | printk("\n"); | 1084 | printk("\n"); |
1085 | |||
1086 | ide_port_setup_devices(hwif); | ||
1087 | |||
1061 | mutex_unlock(&ide_cfg_mtx); | 1088 | mutex_unlock(&ide_cfg_mtx); |
1062 | return 0; | 1089 | return 0; |
1063 | out_unlink: | 1090 | out_unlink: |
@@ -1182,30 +1209,6 @@ static void drive_release_dev (struct device *dev) | |||
1182 | complete(&drive->gendev_rel_comp); | 1209 | complete(&drive->gendev_rel_comp); |
1183 | } | 1210 | } |
1184 | 1211 | ||
1185 | /* | ||
1186 | * init_gendisk() (as opposed to ide_geninit) is called for each major device, | ||
1187 | * after probing for drives, to allocate partition tables and other data | ||
1188 | * structures needed for the routines in genhd.c. ide_geninit() gets called | ||
1189 | * somewhat later, during the partition check. | ||
1190 | */ | ||
1191 | static void init_gendisk (ide_hwif_t *hwif) | ||
1192 | { | ||
1193 | unsigned int unit; | ||
1194 | |||
1195 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | ||
1196 | ide_drive_t * drive = &hwif->drives[unit]; | ||
1197 | ide_add_generic_settings(drive); | ||
1198 | snprintf(drive->gendev.bus_id,BUS_ID_SIZE,"%u.%u", | ||
1199 | hwif->index,unit); | ||
1200 | drive->gendev.parent = &hwif->gendev; | ||
1201 | drive->gendev.bus = &ide_bus_type; | ||
1202 | drive->gendev.driver_data = drive; | ||
1203 | drive->gendev.release = drive_release_dev; | ||
1204 | } | ||
1205 | blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS, | ||
1206 | THIS_MODULE, ata_probe, ata_lock, hwif); | ||
1207 | } | ||
1208 | |||
1209 | static int hwif_init(ide_hwif_t *hwif) | 1212 | static int hwif_init(ide_hwif_t *hwif) |
1210 | { | 1213 | { |
1211 | int old_irq; | 1214 | int old_irq; |
@@ -1262,8 +1265,8 @@ static int hwif_init(ide_hwif_t *hwif) | |||
1262 | hwif->name, hwif->irq); | 1265 | hwif->name, hwif->irq); |
1263 | 1266 | ||
1264 | done: | 1267 | done: |
1265 | init_gendisk(hwif); | 1268 | blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS, |
1266 | ide_acpi_init(hwif); | 1269 | THIS_MODULE, ata_probe, ata_lock, hwif); |
1267 | return 1; | 1270 | return 1; |
1268 | 1271 | ||
1269 | out: | 1272 | out: |
@@ -1277,24 +1280,119 @@ static void hwif_register_devices(ide_hwif_t *hwif) | |||
1277 | 1280 | ||
1278 | for (i = 0; i < MAX_DRIVES; i++) { | 1281 | for (i = 0; i < MAX_DRIVES; i++) { |
1279 | ide_drive_t *drive = &hwif->drives[i]; | 1282 | ide_drive_t *drive = &hwif->drives[i]; |
1283 | struct device *dev = &drive->gendev; | ||
1284 | int ret; | ||
1280 | 1285 | ||
1281 | if (drive->present) { | 1286 | if (!drive->present) |
1282 | int ret = device_register(&drive->gendev); | 1287 | continue; |
1283 | 1288 | ||
1284 | if (ret < 0) | 1289 | ide_add_generic_settings(drive); |
1285 | printk(KERN_WARNING "IDE: %s: " | 1290 | |
1286 | "device_register error: %d\n", | 1291 | snprintf(dev->bus_id, BUS_ID_SIZE, "%u.%u", hwif->index, i); |
1287 | __FUNCTION__, ret); | 1292 | dev->parent = &hwif->gendev; |
1288 | } | 1293 | dev->bus = &ide_bus_type; |
1294 | dev->driver_data = drive; | ||
1295 | dev->release = drive_release_dev; | ||
1296 | |||
1297 | ret = device_register(dev); | ||
1298 | if (ret < 0) | ||
1299 | printk(KERN_WARNING "IDE: %s: device_register error: " | ||
1300 | "%d\n", __func__, ret); | ||
1301 | } | ||
1302 | } | ||
1303 | |||
1304 | static void ide_port_init_devices(ide_hwif_t *hwif) | ||
1305 | { | ||
1306 | int i; | ||
1307 | |||
1308 | for (i = 0; i < MAX_DRIVES; i++) { | ||
1309 | ide_drive_t *drive = &hwif->drives[i]; | ||
1310 | |||
1311 | if (hwif->host_flags & IDE_HFLAG_IO_32BIT) | ||
1312 | drive->io_32bit = 1; | ||
1313 | if (hwif->host_flags & IDE_HFLAG_UNMASK_IRQS) | ||
1314 | drive->unmask = 1; | ||
1315 | if (hwif->host_flags & IDE_HFLAG_NO_UNMASK_IRQS) | ||
1316 | drive->no_unmask = 1; | ||
1317 | if ((hwif->host_flags & IDE_HFLAG_NO_AUTOTUNE) == 0) | ||
1318 | drive->autotune = 1; | ||
1319 | } | ||
1320 | |||
1321 | if (hwif->port_init_devs) | ||
1322 | hwif->port_init_devs(hwif); | ||
1323 | } | ||
1324 | |||
1325 | static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | ||
1326 | const struct ide_port_info *d) | ||
1327 | { | ||
1328 | if (d->chipset != ide_etrax100) | ||
1329 | hwif->channel = port; | ||
1330 | |||
1331 | if (d->chipset) | ||
1332 | hwif->chipset = d->chipset; | ||
1333 | |||
1334 | if (d->init_iops) | ||
1335 | d->init_iops(hwif); | ||
1336 | |||
1337 | if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) | ||
1338 | ide_hwif_setup_dma(hwif, d); | ||
1339 | |||
1340 | if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) || | ||
1341 | (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) | ||
1342 | hwif->irq = port ? 15 : 14; | ||
1343 | |||
1344 | hwif->host_flags = d->host_flags; | ||
1345 | hwif->pio_mask = d->pio_mask; | ||
1346 | |||
1347 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) | ||
1348 | hwif->mate->serialized = hwif->serialized = 1; | ||
1349 | |||
1350 | hwif->swdma_mask = d->swdma_mask; | ||
1351 | hwif->mwdma_mask = d->mwdma_mask; | ||
1352 | hwif->ultra_mask = d->udma_mask; | ||
1353 | |||
1354 | /* reset DMA masks only for SFF-style DMA controllers */ | ||
1355 | if ((d->host_flags && IDE_HFLAG_NO_DMA) == 0 && hwif->dma_base == 0) | ||
1356 | hwif->swdma_mask = hwif->mwdma_mask = hwif->ultra_mask = 0; | ||
1357 | |||
1358 | if (d->host_flags & IDE_HFLAG_RQSIZE_256) | ||
1359 | hwif->rqsize = 256; | ||
1360 | |||
1361 | /* call chipset specific routine for each enabled port */ | ||
1362 | if (d->init_hwif) | ||
1363 | d->init_hwif(hwif); | ||
1364 | |||
1365 | if (hwif->cable_detect && (hwif->ultra_mask & 0x78)) { | ||
1366 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
1367 | hwif->cbl = hwif->cable_detect(hwif); | ||
1289 | } | 1368 | } |
1290 | } | 1369 | } |
1291 | 1370 | ||
1292 | int ide_device_add_all(u8 *idx) | 1371 | int ide_device_add_all(u8 *idx, const struct ide_port_info *d) |
1293 | { | 1372 | { |
1294 | ide_hwif_t *hwif; | 1373 | ide_hwif_t *hwif, *mate = NULL; |
1295 | int i, rc = 0; | 1374 | int i, rc = 0; |
1296 | 1375 | ||
1297 | for (i = 0; i < MAX_HWIFS; i++) { | 1376 | for (i = 0; i < MAX_HWIFS; i++) { |
1377 | if (d == NULL || idx[i] == 0xff) { | ||
1378 | mate = NULL; | ||
1379 | continue; | ||
1380 | } | ||
1381 | |||
1382 | hwif = &ide_hwifs[idx[i]]; | ||
1383 | |||
1384 | if (d->chipset != ide_etrax100 && (i & 1) && mate) { | ||
1385 | hwif->mate = mate; | ||
1386 | mate->mate = hwif; | ||
1387 | } | ||
1388 | |||
1389 | mate = (i & 1) ? NULL : hwif; | ||
1390 | |||
1391 | ide_init_port(hwif, i & 1, d); | ||
1392 | ide_port_init_devices(hwif); | ||
1393 | } | ||
1394 | |||
1395 | for (i = 0; i < MAX_HWIFS; i++) { | ||
1298 | if (idx[i] == 0xff) | 1396 | if (idx[i] == 0xff) |
1299 | continue; | 1397 | continue; |
1300 | 1398 | ||
@@ -1337,6 +1435,9 @@ int ide_device_add_all(u8 *idx) | |||
1337 | rc = -1; | 1435 | rc = -1; |
1338 | continue; | 1436 | continue; |
1339 | } | 1437 | } |
1438 | |||
1439 | ide_acpi_init(hwif); | ||
1440 | ide_acpi_port_init_devices(hwif); | ||
1340 | } | 1441 | } |
1341 | 1442 | ||
1342 | for (i = 0; i < MAX_HWIFS; i++) { | 1443 | for (i = 0; i < MAX_HWIFS; i++) { |
@@ -1354,15 +1455,22 @@ int ide_device_add_all(u8 *idx) | |||
1354 | } | 1455 | } |
1355 | 1456 | ||
1356 | for (i = 0; i < MAX_HWIFS; i++) { | 1457 | for (i = 0; i < MAX_HWIFS; i++) { |
1357 | if (idx[i] != 0xff) | 1458 | if (idx[i] == 0xff) |
1358 | ide_proc_register_port(&ide_hwifs[idx[i]]); | 1459 | continue; |
1460 | |||
1461 | hwif = &ide_hwifs[idx[i]]; | ||
1462 | |||
1463 | if (hwif->present) { | ||
1464 | ide_proc_register_port(hwif); | ||
1465 | ide_proc_port_register_devices(hwif); | ||
1466 | } | ||
1359 | } | 1467 | } |
1360 | 1468 | ||
1361 | return rc; | 1469 | return rc; |
1362 | } | 1470 | } |
1363 | EXPORT_SYMBOL_GPL(ide_device_add_all); | 1471 | EXPORT_SYMBOL_GPL(ide_device_add_all); |
1364 | 1472 | ||
1365 | int ide_device_add(u8 idx[4]) | 1473 | int ide_device_add(u8 idx[4], const struct ide_port_info *d) |
1366 | { | 1474 | { |
1367 | u8 idx_all[MAX_HWIFS]; | 1475 | u8 idx_all[MAX_HWIFS]; |
1368 | int i; | 1476 | int i; |
@@ -1370,6 +1478,6 @@ int ide_device_add(u8 idx[4]) | |||
1370 | for (i = 0; i < MAX_HWIFS; i++) | 1478 | for (i = 0; i < MAX_HWIFS; i++) |
1371 | idx_all[i] = (i < 4) ? idx[i] : 0xff; | 1479 | idx_all[i] = (i < 4) ? idx[i] : 0xff; |
1372 | 1480 | ||
1373 | return ide_device_add_all(idx_all); | 1481 | return ide_device_add_all(idx_all, d); |
1374 | } | 1482 | } |
1375 | EXPORT_SYMBOL_GPL(ide_device_add); | 1483 | EXPORT_SYMBOL_GPL(ide_device_add); |
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 00c249cba236..975c0ff0f438 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -739,7 +739,7 @@ void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) | |||
739 | 739 | ||
740 | EXPORT_SYMBOL(ide_proc_unregister_driver); | 740 | EXPORT_SYMBOL(ide_proc_unregister_driver); |
741 | 741 | ||
742 | static void create_proc_ide_drives(ide_hwif_t *hwif) | 742 | void ide_proc_port_register_devices(ide_hwif_t *hwif) |
743 | { | 743 | { |
744 | int d; | 744 | int d; |
745 | struct proc_dir_entry *ent; | 745 | struct proc_dir_entry *ent; |
@@ -793,9 +793,6 @@ static ide_proc_entry_t hwif_entries[] = { | |||
793 | 793 | ||
794 | void ide_proc_register_port(ide_hwif_t *hwif) | 794 | void ide_proc_register_port(ide_hwif_t *hwif) |
795 | { | 795 | { |
796 | if (!hwif->present) | ||
797 | return; | ||
798 | |||
799 | if (!hwif->proc) { | 796 | if (!hwif->proc) { |
800 | hwif->proc = proc_mkdir(hwif->name, proc_ide_root); | 797 | hwif->proc = proc_mkdir(hwif->name, proc_ide_root); |
801 | 798 | ||
@@ -804,8 +801,6 @@ void ide_proc_register_port(ide_hwif_t *hwif) | |||
804 | 801 | ||
805 | ide_add_proc_entries(hwif->proc, hwif_entries, hwif); | 802 | ide_add_proc_entries(hwif->proc, hwif_entries, hwif); |
806 | } | 803 | } |
807 | |||
808 | create_proc_ide_drives(hwif); | ||
809 | } | 804 | } |
810 | 805 | ||
811 | #ifdef CONFIG_BLK_DEV_IDEPCI | 806 | #ifdef CONFIG_BLK_DEV_IDEPCI |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 5aef63acf1e8..bf40d8c824ad 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -1,424 +1,18 @@ | |||
1 | /* | 1 | /* |
2 | * IDE ATAPI streaming tape driver. | ||
3 | * | ||
2 | * Copyright (C) 1995-1999 Gadi Oxman <gadio@netvision.net.il> | 4 | * Copyright (C) 1995-1999 Gadi Oxman <gadio@netvision.net.il> |
3 | * Copyright (C) 2003-2005 Bartlomiej Zolnierkiewicz | 5 | * Copyright (C) 2003-2005 Bartlomiej Zolnierkiewicz |
4 | * | 6 | * |
5 | * $Header$ | ||
6 | * | ||
7 | * This driver was constructed as a student project in the software laboratory | 7 | * This driver was constructed as a student project in the software laboratory |
8 | * of the faculty of electrical engineering in the Technion - Israel's | 8 | * of the faculty of electrical engineering in the Technion - Israel's |
9 | * Institute Of Technology, with the guide of Avner Lottem and Dr. Ilana David. | 9 | * Institute Of Technology, with the guide of Avner Lottem and Dr. Ilana David. |
10 | * | 10 | * |
11 | * It is hereby placed under the terms of the GNU general public license. | 11 | * It is hereby placed under the terms of the GNU general public license. |
12 | * (See linux/COPYING). | 12 | * (See linux/COPYING). |
13 | */ | ||
14 | |||
15 | /* | ||
16 | * IDE ATAPI streaming tape driver. | ||
17 | * | ||
18 | * This driver is a part of the Linux ide driver and works in co-operation | ||
19 | * with linux/drivers/block/ide.c. | ||
20 | * | ||
21 | * The driver, in co-operation with ide.c, basically traverses the | ||
22 | * request-list for the block device interface. The character device | ||
23 | * interface, on the other hand, creates new requests, adds them | ||
24 | * to the request-list of the block device, and waits for their completion. | ||
25 | * | ||
26 | * Pipelined operation mode is now supported on both reads and writes. | ||
27 | * | ||
28 | * The block device major and minor numbers are determined from the | ||
29 | * tape's relative position in the ide interfaces, as explained in ide.c. | ||
30 | * | ||
31 | * The character device interface consists of the following devices: | ||
32 | * | ||
33 | * ht0 major 37, minor 0 first IDE tape, rewind on close. | ||
34 | * ht1 major 37, minor 1 second IDE tape, rewind on close. | ||
35 | * ... | ||
36 | * nht0 major 37, minor 128 first IDE tape, no rewind on close. | ||
37 | * nht1 major 37, minor 129 second IDE tape, no rewind on close. | ||
38 | * ... | ||
39 | * | ||
40 | * Run linux/scripts/MAKEDEV.ide to create the above entries. | ||
41 | * | ||
42 | * The general magnetic tape commands compatible interface, as defined by | ||
43 | * include/linux/mtio.h, is accessible through the character device. | ||
44 | * | ||
45 | * General ide driver configuration options, such as the interrupt-unmask | ||
46 | * flag, can be configured by issuing an ioctl to the block device interface, | ||
47 | * as any other ide device. | ||
48 | * | ||
49 | * Our own ide-tape ioctl's can be issued to either the block device or | ||
50 | * the character device interface. | ||
51 | * | ||
52 | * Maximal throughput with minimal bus load will usually be achieved in the | ||
53 | * following scenario: | ||
54 | * | ||
55 | * 1. ide-tape is operating in the pipelined operation mode. | ||
56 | * 2. No buffering is performed by the user backup program. | ||
57 | * | ||
58 | * Testing was done with a 2 GB CONNER CTMA 4000 IDE ATAPI Streaming Tape Drive. | ||
59 | * | ||
60 | * Ver 0.1 Nov 1 95 Pre-working code :-) | ||
61 | * Ver 0.2 Nov 23 95 A short backup (few megabytes) and restore procedure | ||
62 | * was successful ! (Using tar cvf ... on the block | ||
63 | * device interface). | ||
64 | * A longer backup resulted in major swapping, bad | ||
65 | * overall Linux performance and eventually failed as | ||
66 | * we received non serial read-ahead requests from the | ||
67 | * buffer cache. | ||
68 | * Ver 0.3 Nov 28 95 Long backups are now possible, thanks to the | ||
69 | * character device interface. Linux's responsiveness | ||
70 | * and performance doesn't seem to be much affected | ||
71 | * from the background backup procedure. | ||
72 | * Some general mtio.h magnetic tape operations are | ||
73 | * now supported by our character device. As a result, | ||
74 | * popular tape utilities are starting to work with | ||
75 | * ide tapes :-) | ||
76 | * The following configurations were tested: | ||
77 | * 1. An IDE ATAPI TAPE shares the same interface | ||
78 | * and irq with an IDE ATAPI CDROM. | ||
79 | * 2. An IDE ATAPI TAPE shares the same interface | ||
80 | * and irq with a normal IDE disk. | ||
81 | * Both configurations seemed to work just fine ! | ||
82 | * However, to be on the safe side, it is meanwhile | ||
83 | * recommended to give the IDE TAPE its own interface | ||
84 | * and irq. | ||
85 | * The one thing which needs to be done here is to | ||
86 | * add a "request postpone" feature to ide.c, | ||
87 | * so that we won't have to wait for the tape to finish | ||
88 | * performing a long media access (DSC) request (such | ||
89 | * as a rewind) before we can access the other device | ||
90 | * on the same interface. This effect doesn't disturb | ||
91 | * normal operation most of the time because read/write | ||
92 | * requests are relatively fast, and once we are | ||
93 | * performing one tape r/w request, a lot of requests | ||
94 | * from the other device can be queued and ide.c will | ||
95 | * service all of them after this single tape request. | ||
96 | * Ver 1.0 Dec 11 95 Integrated into Linux 1.3.46 development tree. | ||
97 | * On each read / write request, we now ask the drive | ||
98 | * if we can transfer a constant number of bytes | ||
99 | * (a parameter of the drive) only to its buffers, | ||
100 | * without causing actual media access. If we can't, | ||
101 | * we just wait until we can by polling the DSC bit. | ||
102 | * This ensures that while we are not transferring | ||
103 | * more bytes than the constant referred to above, the | ||
104 | * interrupt latency will not become too high and | ||
105 | * we won't cause an interrupt timeout, as happened | ||
106 | * occasionally in the previous version. | ||
107 | * While polling for DSC, the current request is | ||
108 | * postponed and ide.c is free to handle requests from | ||
109 | * the other device. This is handled transparently to | ||
110 | * ide.c. The hwgroup locking method which was used | ||
111 | * in the previous version was removed. | ||
112 | * Use of new general features which are provided by | ||
113 | * ide.c for use with atapi devices. | ||
114 | * (Programming done by Mark Lord) | ||
115 | * Few potential bug fixes (Again, suggested by Mark) | ||
116 | * Single character device data transfers are now | ||
117 | * not limited in size, as they were before. | ||
118 | * We are asking the tape about its recommended | ||
119 | * transfer unit and send a larger data transfer | ||
120 | * as several transfers of the above size. | ||
121 | * For best results, use an integral number of this | ||
122 | * basic unit (which is shown during driver | ||
123 | * initialization). I will soon add an ioctl to get | ||
124 | * this important parameter. | ||
125 | * Our data transfer buffer is allocated on startup, | ||
126 | * rather than before each data transfer. This should | ||
127 | * ensure that we will indeed have a data buffer. | ||
128 | * Ver 1.1 Dec 14 95 Fixed random problems which occurred when the tape | ||
129 | * shared an interface with another device. | ||
130 | * (poll_for_dsc was a complete mess). | ||
131 | * Removed some old (non-active) code which had | ||
132 | * to do with supporting buffer cache originated | ||
133 | * requests. | ||
134 | * The block device interface can now be opened, so | ||
135 | * that general ide driver features like the unmask | ||
136 | * interrupts flag can be selected with an ioctl. | ||
137 | * This is the only use of the block device interface. | ||
138 | * New fast pipelined operation mode (currently only on | ||
139 | * writes). When using the pipelined mode, the | ||
140 | * throughput can potentially reach the maximum | ||
141 | * tape supported throughput, regardless of the | ||
142 | * user backup program. On my tape drive, it sometimes | ||
143 | * boosted performance by a factor of 2. Pipelined | ||
144 | * mode is enabled by default, but since it has a few | ||
145 | * downfalls as well, you may want to disable it. | ||
146 | * A short explanation of the pipelined operation mode | ||
147 | * is available below. | ||
148 | * Ver 1.2 Jan 1 96 Eliminated pipelined mode race condition. | ||
149 | * Added pipeline read mode. As a result, restores | ||
150 | * are now as fast as backups. | ||
151 | * Optimized shared interface behavior. The new behavior | ||
152 | * typically results in better IDE bus efficiency and | ||
153 | * higher tape throughput. | ||
154 | * Pre-calculation of the expected read/write request | ||
155 | * service time, based on the tape's parameters. In | ||
156 | * the pipelined operation mode, this allows us to | ||
157 | * adjust our polling frequency to a much lower value, | ||
158 | * and thus to dramatically reduce our load on Linux, | ||
159 | * without any decrease in performance. | ||
160 | * Implemented additional mtio.h operations. | ||
161 | * The recommended user block size is returned by | ||
162 | * the MTIOCGET ioctl. | ||
163 | * Additional minor changes. | ||
164 | * Ver 1.3 Feb 9 96 Fixed pipelined read mode bug which prevented the | ||
165 | * use of some block sizes during a restore procedure. | ||
166 | * The character device interface will now present a | ||
167 | * continuous view of the media - any mix of block sizes | ||
168 | * during a backup/restore procedure is supported. The | ||
169 | * driver will buffer the requests internally and | ||
170 | * convert them to the tape's recommended transfer | ||
171 | * unit, making performance almost independent of the | ||
172 | * chosen user block size. | ||
173 | * Some improvements in error recovery. | ||
174 | * By cooperating with ide-dma.c, bus mastering DMA can | ||
175 | * now sometimes be used with IDE tape drives as well. | ||
176 | * Bus mastering DMA has the potential to dramatically | ||
177 | * reduce the CPU's overhead when accessing the device, | ||
178 | * and can be enabled by using hdparm -d1 on the tape's | ||
179 | * block device interface. For more info, read the | ||
180 | * comments in ide-dma.c. | ||
181 | * Ver 1.4 Mar 13 96 Fixed serialize support. | ||
182 | * Ver 1.5 Apr 12 96 Fixed shared interface operation, broken in 1.3.85. | ||
183 | * Fixed pipelined read mode inefficiency. | ||
184 | * Fixed nasty null dereferencing bug. | ||
185 | * Ver 1.6 Aug 16 96 Fixed FPU usage in the driver. | ||
186 | * Fixed end of media bug. | ||
187 | * Ver 1.7 Sep 10 96 Minor changes for the CONNER CTT8000-A model. | ||
188 | * Ver 1.8 Sep 26 96 Attempt to find a better balance between good | ||
189 | * interactive response and high system throughput. | ||
190 | * Ver 1.9 Nov 5 96 Automatically cross encountered filemarks rather | ||
191 | * than requiring an explicit FSF command. | ||
192 | * Abort pending requests at end of media. | ||
193 | * MTTELL was sometimes returning incorrect results. | ||
194 | * Return the real block size in the MTIOCGET ioctl. | ||
195 | * Some error recovery bug fixes. | ||
196 | * Ver 1.10 Nov 5 96 Major reorganization. | ||
197 | * Reduced CPU overhead a bit by eliminating internal | ||
198 | * bounce buffers. | ||
199 | * Added module support. | ||
200 | * Added multiple tape drives support. | ||
201 | * Added partition support. | ||
202 | * Rewrote DSC handling. | ||
203 | * Some portability fixes. | ||
204 | * Removed ide-tape.h. | ||
205 | * Additional minor changes. | ||
206 | * Ver 1.11 Dec 2 96 Bug fix in previous DSC timeout handling. | ||
207 | * Use ide_stall_queue() for DSC overlap. | ||
208 | * Use the maximum speed rather than the current speed | ||
209 | * to compute the request service time. | ||
210 | * Ver 1.12 Dec 7 97 Fix random memory overwriting and/or last block data | ||
211 | * corruption, which could occur if the total number | ||
212 | * of bytes written to the tape was not an integral | ||
213 | * number of tape blocks. | ||
214 | * Add support for INTERRUPT DRQ devices. | ||
215 | * Ver 1.13 Jan 2 98 Add "speed == 0" work-around for HP COLORADO 5GB | ||
216 | * Ver 1.14 Dec 30 98 Partial fixes for the Sony/AIWA tape drives. | ||
217 | * Replace cli()/sti() with hwgroup spinlocks. | ||
218 | * Ver 1.15 Mar 25 99 Fix SMP race condition by replacing hwgroup | ||
219 | * spinlock with private per-tape spinlock. | ||
220 | * Ver 1.16 Sep 1 99 Add OnStream tape support. | ||
221 | * Abort read pipeline on EOD. | ||
222 | * Wait for the tape to become ready in case it returns | ||
223 | * "in the process of becoming ready" on open(). | ||
224 | * Fix zero padding of the last written block in | ||
225 | * case the tape block size is larger than PAGE_SIZE. | ||
226 | * Decrease the default disconnection time to tn. | ||
227 | * Ver 1.16e Oct 3 99 Minor fixes. | ||
228 | * Ver 1.16e1 Oct 13 99 Patches by Arnold Niessen, | ||
229 | * niessen@iae.nl / arnold.niessen@philips.com | ||
230 | * GO-1) Undefined code in idetape_read_position | ||
231 | * according to Gadi's email | ||
232 | * AJN-1) Minor fix asc == 11 should be asc == 0x11 | ||
233 | * in idetape_issue_packet_command (did effect | ||
234 | * debugging output only) | ||
235 | * AJN-2) Added more debugging output, and | ||
236 | * added ide-tape: where missing. I would also | ||
237 | * like to add tape->name where possible | ||
238 | * AJN-3) Added different debug_level's | ||
239 | * via /proc/ide/hdc/settings | ||
240 | * "debug_level" determines amount of debugging output; | ||
241 | * can be changed using /proc/ide/hdx/settings | ||
242 | * 0 : almost no debugging output | ||
243 | * 1 : 0+output errors only | ||
244 | * 2 : 1+output all sensekey/asc | ||
245 | * 3 : 2+follow all chrdev related procedures | ||
246 | * 4 : 3+follow all procedures | ||
247 | * 5 : 4+include pc_stack rq_stack info | ||
248 | * 6 : 5+USE_COUNT updates | ||
249 | * AJN-4) Fixed timeout for retension in idetape_queue_pc_tail | ||
250 | * from 5 to 10 minutes | ||
251 | * AJN-5) Changed maximum number of blocks to skip when | ||
252 | * reading tapes with multiple consecutive write | ||
253 | * errors from 100 to 1000 in idetape_get_logical_blk | ||
254 | * Proposed changes to code: | ||
255 | * 1) output "logical_blk_num" via /proc | ||
256 | * 2) output "current_operation" via /proc | ||
257 | * 3) Either solve or document the fact that `mt rewind' is | ||
258 | * required after reading from /dev/nhtx to be | ||
259 | * able to rmmod the idetape module; | ||
260 | * Also, sometimes an application finishes but the | ||
261 | * device remains `busy' for some time. Same cause ? | ||
262 | * Proposed changes to release-notes: | ||
263 | * 4) write a simple `quickstart' section in the | ||
264 | * release notes; I volunteer if you don't want to | ||
265 | * 5) include a pointer to video4linux in the doc | ||
266 | * to stimulate video applications | ||
267 | * 6) release notes lines 331 and 362: explain what happens | ||
268 | * if the application data rate is higher than 1100 KB/s; | ||
269 | * similar approach to lower-than-500 kB/s ? | ||
270 | * 7) 6.6 Comparison; wouldn't it be better to allow different | ||
271 | * strategies for read and write ? | ||
272 | * Wouldn't it be better to control the tape buffer | ||
273 | * contents instead of the bandwidth ? | ||
274 | * 8) line 536: replace will by would (if I understand | ||
275 | * this section correctly, a hypothetical and unwanted situation | ||
276 | * is being described) | ||
277 | * Ver 1.16f Dec 15 99 Change place of the secondary OnStream header frames. | ||
278 | * Ver 1.17 Nov 2000 / Jan 2001 Marcel Mol, marcel@mesa.nl | ||
279 | * - Add idetape_onstream_mode_sense_tape_parameter_page | ||
280 | * function to get tape capacity in frames: tape->capacity. | ||
281 | * - Add support for DI-50 drives( or any DI- drive). | ||
282 | * - 'workaround' for read error/blank block around block 3000. | ||
283 | * - Implement Early warning for end of media for Onstream. | ||
284 | * - Cosmetic code changes for readability. | ||
285 | * - Idetape_position_tape should not use SKIP bit during | ||
286 | * Onstream read recovery. | ||
287 | * - Add capacity, logical_blk_num and first/last_frame_position | ||
288 | * to /proc/ide/hd?/settings. | ||
289 | * - Module use count was gone in the Linux 2.4 driver. | ||
290 | * Ver 1.17a Apr 2001 Willem Riede osst@riede.org | ||
291 | * - Get drive's actual block size from mode sense block descriptor | ||
292 | * - Limit size of pipeline | ||
293 | * Ver 1.17b Oct 2002 Alan Stern <stern@rowland.harvard.edu> | ||
294 | * Changed IDETAPE_MIN_PIPELINE_STAGES to 1 and actually used | ||
295 | * it in the code! | ||
296 | * Actually removed aborted stages in idetape_abort_pipeline | ||
297 | * instead of just changing the command code. | ||
298 | * Made the transfer byte count for Request Sense equal to the | ||
299 | * actual length of the data transfer. | ||
300 | * Changed handling of partial data transfers: they do not | ||
301 | * cause DMA errors. | ||
302 | * Moved initiation of DMA transfers to the correct place. | ||
303 | * Removed reference to unallocated memory. | ||
304 | * Made __idetape_discard_read_pipeline return the number of | ||
305 | * sectors skipped, not the number of stages. | ||
306 | * Replaced errant kfree() calls with __idetape_kfree_stage(). | ||
307 | * Fixed off-by-one error in testing the pipeline length. | ||
308 | * Fixed handling of filemarks in the read pipeline. | ||
309 | * Small code optimization for MTBSF and MTBSFM ioctls. | ||
310 | * Don't try to unlock the door during device close if is | ||
311 | * already unlocked! | ||
312 | * Cosmetic fixes to miscellaneous debugging output messages. | ||
313 | * Set the minimum /proc/ide/hd?/settings values for "pipeline", | ||
314 | * "pipeline_min", and "pipeline_max" to 1. | ||
315 | * | ||
316 | * Here are some words from the first releases of hd.c, which are quoted | ||
317 | * in ide.c and apply here as well: | ||
318 | * | ||
319 | * | Special care is recommended. Have Fun! | ||
320 | * | 13 | * |
321 | */ | 14 | * For a historical changelog see |
322 | 15 | * Documentation/ide/ChangeLog.ide-tape.1995-2002 | |
323 | /* | ||
324 | * An overview of the pipelined operation mode. | ||
325 | * | ||
326 | * In the pipelined write mode, we will usually just add requests to our | ||
327 | * pipeline and return immediately, before we even start to service them. The | ||
328 | * user program will then have enough time to prepare the next request while | ||
329 | * we are still busy servicing previous requests. In the pipelined read mode, | ||
330 | * the situation is similar - we add read-ahead requests into the pipeline, | ||
331 | * before the user even requested them. | ||
332 | * | ||
333 | * The pipeline can be viewed as a "safety net" which will be activated when | ||
334 | * the system load is high and prevents the user backup program from keeping up | ||
335 | * with the current tape speed. At this point, the pipeline will get | ||
336 | * shorter and shorter but the tape will still be streaming at the same speed. | ||
337 | * Assuming we have enough pipeline stages, the system load will hopefully | ||
338 | * decrease before the pipeline is completely empty, and the backup program | ||
339 | * will be able to "catch up" and refill the pipeline again. | ||
340 | * | ||
341 | * When using the pipelined mode, it would be best to disable any type of | ||
342 | * buffering done by the user program, as ide-tape already provides all the | ||
343 | * benefits in the kernel, where it can be done in a more efficient way. | ||
344 | * As we will usually not block the user program on a request, the most | ||
345 | * efficient user code will then be a simple read-write-read-... cycle. | ||
346 | * Any additional logic will usually just slow down the backup process. | ||
347 | * | ||
348 | * Using the pipelined mode, I get a constant over 400 KBps throughput, | ||
349 | * which seems to be the maximum throughput supported by my tape. | ||
350 | * | ||
351 | * However, there are some downfalls: | ||
352 | * | ||
353 | * 1. We use memory (for data buffers) in proportional to the number | ||
354 | * of pipeline stages (each stage is about 26 KB with my tape). | ||
355 | * 2. In the pipelined write mode, we cheat and postpone error codes | ||
356 | * to the user task. In read mode, the actual tape position | ||
357 | * will be a bit further than the last requested block. | ||
358 | * | ||
359 | * Concerning (1): | ||
360 | * | ||
361 | * 1. We allocate stages dynamically only when we need them. When | ||
362 | * we don't need them, we don't consume additional memory. In | ||
363 | * case we can't allocate stages, we just manage without them | ||
364 | * (at the expense of decreased throughput) so when Linux is | ||
365 | * tight in memory, we will not pose additional difficulties. | ||
366 | * | ||
367 | * 2. The maximum number of stages (which is, in fact, the maximum | ||
368 | * amount of memory) which we allocate is limited by the compile | ||
369 | * time parameter IDETAPE_MAX_PIPELINE_STAGES. | ||
370 | * | ||
371 | * 3. The maximum number of stages is a controlled parameter - We | ||
372 | * don't start from the user defined maximum number of stages | ||
373 | * but from the lower IDETAPE_MIN_PIPELINE_STAGES (again, we | ||
374 | * will not even allocate this amount of stages if the user | ||
375 | * program can't handle the speed). We then implement a feedback | ||
376 | * loop which checks if the pipeline is empty, and if it is, we | ||
377 | * increase the maximum number of stages as necessary until we | ||
378 | * reach the optimum value which just manages to keep the tape | ||
379 | * busy with minimum allocated memory or until we reach | ||
380 | * IDETAPE_MAX_PIPELINE_STAGES. | ||
381 | * | ||
382 | * Concerning (2): | ||
383 | * | ||
384 | * In pipelined write mode, ide-tape can not return accurate error codes | ||
385 | * to the user program since we usually just add the request to the | ||
386 | * pipeline without waiting for it to be serviced. In case an error | ||
387 | * occurs, I will report it on the next user request. | ||
388 | * | ||
389 | * In the pipelined read mode, subsequent read requests or forward | ||
390 | * filemark spacing will perform correctly, as we preserve all blocks | ||
391 | * and filemarks which we encountered during our excess read-ahead. | ||
392 | * | ||
393 | * For accurate tape positioning and error reporting, disabling | ||
394 | * pipelined mode might be the best option. | ||
395 | * | ||
396 | * You can enable/disable/tune the pipelined operation mode by adjusting | ||
397 | * the compile time parameters below. | ||
398 | */ | ||
399 | |||
400 | /* | ||
401 | * Possible improvements. | ||
402 | * | ||
403 | * 1. Support for the ATAPI overlap protocol. | ||
404 | * | ||
405 | * In order to maximize bus throughput, we currently use the DSC | ||
406 | * overlap method which enables ide.c to service requests from the | ||
407 | * other device while the tape is busy executing a command. The | ||
408 | * DSC overlap method involves polling the tape's status register | ||
409 | * for the DSC bit, and servicing the other device while the tape | ||
410 | * isn't ready. | ||
411 | * | ||
412 | * In the current QIC development standard (December 1995), | ||
413 | * it is recommended that new tape drives will *in addition* | ||
414 | * implement the ATAPI overlap protocol, which is used for the | ||
415 | * same purpose - efficient use of the IDE bus, but is interrupt | ||
416 | * driven and thus has much less CPU overhead. | ||
417 | * | ||
418 | * ATAPI overlap is likely to be supported in most new ATAPI | ||
419 | * devices, including new ATAPI cdroms, and thus provides us | ||
420 | * a method by which we can achieve higher throughput when | ||
421 | * sharing a (fast) ATA-2 disk with any (slow) new ATAPI device. | ||
422 | */ | 16 | */ |
423 | 17 | ||
424 | #define IDETAPE_VERSION "1.19" | 18 | #define IDETAPE_VERSION "1.19" |
@@ -442,49 +36,13 @@ | |||
442 | #include <linux/completion.h> | 36 | #include <linux/completion.h> |
443 | #include <linux/bitops.h> | 37 | #include <linux/bitops.h> |
444 | #include <linux/mutex.h> | 38 | #include <linux/mutex.h> |
39 | #include <scsi/scsi.h> | ||
445 | 40 | ||
446 | #include <asm/byteorder.h> | 41 | #include <asm/byteorder.h> |
447 | #include <asm/irq.h> | 42 | #include <asm/irq.h> |
448 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
449 | #include <asm/io.h> | 44 | #include <asm/io.h> |
450 | #include <asm/unaligned.h> | 45 | #include <asm/unaligned.h> |
451 | |||
452 | /* | ||
453 | * partition | ||
454 | */ | ||
455 | typedef struct os_partition_s { | ||
456 | __u8 partition_num; | ||
457 | __u8 par_desc_ver; | ||
458 | __u16 wrt_pass_cntr; | ||
459 | __u32 first_frame_addr; | ||
460 | __u32 last_frame_addr; | ||
461 | __u32 eod_frame_addr; | ||
462 | } os_partition_t; | ||
463 | |||
464 | /* | ||
465 | * DAT entry | ||
466 | */ | ||
467 | typedef struct os_dat_entry_s { | ||
468 | __u32 blk_sz; | ||
469 | __u16 blk_cnt; | ||
470 | __u8 flags; | ||
471 | __u8 reserved; | ||
472 | } os_dat_entry_t; | ||
473 | |||
474 | /* | ||
475 | * DAT | ||
476 | */ | ||
477 | #define OS_DAT_FLAGS_DATA (0xc) | ||
478 | #define OS_DAT_FLAGS_MARK (0x1) | ||
479 | |||
480 | typedef struct os_dat_s { | ||
481 | __u8 dat_sz; | ||
482 | __u8 reserved1; | ||
483 | __u8 entry_cnt; | ||
484 | __u8 reserved3; | ||
485 | os_dat_entry_t dat_list[16]; | ||
486 | } os_dat_t; | ||
487 | |||
488 | #include <linux/mtio.h> | 46 | #include <linux/mtio.h> |
489 | 47 | ||
490 | /**************************** Tunable parameters *****************************/ | 48 | /**************************** Tunable parameters *****************************/ |
@@ -512,10 +70,7 @@ typedef struct os_dat_s { | |||
512 | /* | 70 | /* |
513 | * The following are used to debug the driver: | 71 | * The following are used to debug the driver: |
514 | * | 72 | * |
515 | * Setting IDETAPE_DEBUG_INFO to 1 will report device capabilities. | ||
516 | * Setting IDETAPE_DEBUG_LOG to 1 will log driver flow control. | 73 | * Setting IDETAPE_DEBUG_LOG to 1 will log driver flow control. |
517 | * Setting IDETAPE_DEBUG_BUGS to 1 will enable self-sanity checks in | ||
518 | * some places. | ||
519 | * | 74 | * |
520 | * Setting them to 0 will restore normal operation mode: | 75 | * Setting them to 0 will restore normal operation mode: |
521 | * | 76 | * |
@@ -527,9 +82,7 @@ typedef struct os_dat_s { | |||
527 | * is verified to be stable enough. This will make it much more | 82 | * is verified to be stable enough. This will make it much more |
528 | * esthetic. | 83 | * esthetic. |
529 | */ | 84 | */ |
530 | #define IDETAPE_DEBUG_INFO 0 | ||
531 | #define IDETAPE_DEBUG_LOG 0 | 85 | #define IDETAPE_DEBUG_LOG 0 |
532 | #define IDETAPE_DEBUG_BUGS 1 | ||
533 | 86 | ||
534 | /* | 87 | /* |
535 | * After each failed packet command we issue a request sense command | 88 | * After each failed packet command we issue a request sense command |
@@ -671,65 +224,6 @@ typedef struct idetape_packet_command_s { | |||
671 | #define PC_WRITING 5 | 224 | #define PC_WRITING 5 |
672 | 225 | ||
673 | /* | 226 | /* |
674 | * Capabilities and Mechanical Status Page | ||
675 | */ | ||
676 | typedef struct { | ||
677 | unsigned page_code :6; /* Page code - Should be 0x2a */ | ||
678 | __u8 reserved0_6 :1; | ||
679 | __u8 ps :1; /* parameters saveable */ | ||
680 | __u8 page_length; /* Page Length - Should be 0x12 */ | ||
681 | __u8 reserved2, reserved3; | ||
682 | unsigned ro :1; /* Read Only Mode */ | ||
683 | unsigned reserved4_1234 :4; | ||
684 | unsigned sprev :1; /* Supports SPACE in the reverse direction */ | ||
685 | unsigned reserved4_67 :2; | ||
686 | unsigned reserved5_012 :3; | ||
687 | unsigned efmt :1; /* Supports ERASE command initiated formatting */ | ||
688 | unsigned reserved5_4 :1; | ||
689 | unsigned qfa :1; /* Supports the QFA two partition formats */ | ||
690 | unsigned reserved5_67 :2; | ||
691 | unsigned lock :1; /* Supports locking the volume */ | ||
692 | unsigned locked :1; /* The volume is locked */ | ||
693 | unsigned prevent :1; /* The device defaults in the prevent state after power up */ | ||
694 | unsigned eject :1; /* The device can eject the volume */ | ||
695 | __u8 disconnect :1; /* The device can break request > ctl */ | ||
696 | __u8 reserved6_5 :1; | ||
697 | unsigned ecc :1; /* Supports error correction */ | ||
698 | unsigned cmprs :1; /* Supports data compression */ | ||
699 | unsigned reserved7_0 :1; | ||
700 | unsigned blk512 :1; /* Supports 512 bytes block size */ | ||
701 | unsigned blk1024 :1; /* Supports 1024 bytes block size */ | ||
702 | unsigned reserved7_3_6 :4; | ||
703 | unsigned blk32768 :1; /* slowb - the device restricts the byte count for PIO */ | ||
704 | /* transfers for slow buffer memory ??? */ | ||
705 | /* Also 32768 block size in some cases */ | ||
706 | __u16 max_speed; /* Maximum speed supported in KBps */ | ||
707 | __u8 reserved10, reserved11; | ||
708 | __u16 ctl; /* Continuous Transfer Limit in blocks */ | ||
709 | __u16 speed; /* Current Speed, in KBps */ | ||
710 | __u16 buffer_size; /* Buffer Size, in 512 bytes */ | ||
711 | __u8 reserved18, reserved19; | ||
712 | } idetape_capabilities_page_t; | ||
713 | |||
714 | /* | ||
715 | * Block Size Page | ||
716 | */ | ||
717 | typedef struct { | ||
718 | unsigned page_code :6; /* Page code - Should be 0x30 */ | ||
719 | unsigned reserved1_6 :1; | ||
720 | unsigned ps :1; | ||
721 | __u8 page_length; /* Page Length - Should be 2 */ | ||
722 | __u8 reserved2; | ||
723 | unsigned play32 :1; | ||
724 | unsigned play32_5 :1; | ||
725 | unsigned reserved2_23 :2; | ||
726 | unsigned record32 :1; | ||
727 | unsigned record32_5 :1; | ||
728 | unsigned reserved2_6 :1; | ||
729 | unsigned one :1; | ||
730 | } idetape_block_size_page_t; | ||
731 | |||
732 | /* | ||
733 | * A pipeline stage. | 227 | * A pipeline stage. |
734 | */ | 228 | */ |
735 | typedef struct idetape_stage_s { | 229 | typedef struct idetape_stage_s { |
@@ -739,32 +233,6 @@ typedef struct idetape_stage_s { | |||
739 | } idetape_stage_t; | 233 | } idetape_stage_t; |
740 | 234 | ||
741 | /* | 235 | /* |
742 | * REQUEST SENSE packet command result - Data Format. | ||
743 | */ | ||
744 | typedef struct { | ||
745 | unsigned error_code :7; /* Current of deferred errors */ | ||
746 | unsigned valid :1; /* The information field conforms to QIC-157C */ | ||
747 | __u8 reserved1 :8; /* Segment Number - Reserved */ | ||
748 | unsigned sense_key :4; /* Sense Key */ | ||
749 | unsigned reserved2_4 :1; /* Reserved */ | ||
750 | unsigned ili :1; /* Incorrect Length Indicator */ | ||
751 | unsigned eom :1; /* End Of Medium */ | ||
752 | unsigned filemark :1; /* Filemark */ | ||
753 | __u32 information __attribute__ ((packed)); | ||
754 | __u8 asl; /* Additional sense length (n-7) */ | ||
755 | __u32 command_specific; /* Additional command specific information */ | ||
756 | __u8 asc; /* Additional Sense Code */ | ||
757 | __u8 ascq; /* Additional Sense Code Qualifier */ | ||
758 | __u8 replaceable_unit_code; /* Field Replaceable Unit Code */ | ||
759 | unsigned sk_specific1 :7; /* Sense Key Specific */ | ||
760 | unsigned sksv :1; /* Sense Key Specific information is valid */ | ||
761 | __u8 sk_specific2; /* Sense Key Specific */ | ||
762 | __u8 sk_specific3; /* Sense Key Specific */ | ||
763 | __u8 pad[2]; /* Padding to 20 bytes */ | ||
764 | } idetape_request_sense_result_t; | ||
765 | |||
766 | |||
767 | /* | ||
768 | * Most of our global data which we need to save even as we leave the | 236 | * Most of our global data which we need to save even as we leave the |
769 | * driver due to an interrupt or a timer event is stored in a variable | 237 | * driver due to an interrupt or a timer event is stored in a variable |
770 | * of type idetape_tape_t, defined below. | 238 | * of type idetape_tape_t, defined below. |
@@ -854,8 +322,9 @@ typedef struct ide_tape_obj { | |||
854 | /* Usually 512 or 1024 bytes */ | 322 | /* Usually 512 or 1024 bytes */ |
855 | unsigned short tape_block_size; | 323 | unsigned short tape_block_size; |
856 | int user_bs_factor; | 324 | int user_bs_factor; |
325 | |||
857 | /* Copy of the tape's Capabilities and Mechanical Page */ | 326 | /* Copy of the tape's Capabilities and Mechanical Page */ |
858 | idetape_capabilities_page_t capabilities; | 327 | u8 caps[20]; |
859 | 328 | ||
860 | /* | 329 | /* |
861 | * Active data transfer request parameters. | 330 | * Active data transfer request parameters. |
@@ -918,9 +387,6 @@ typedef struct ide_tape_obj { | |||
918 | int avg_size; | 387 | int avg_size; |
919 | int avg_speed; | 388 | int avg_speed; |
920 | 389 | ||
921 | /* last sense information */ | ||
922 | idetape_request_sense_result_t sense; | ||
923 | |||
924 | char vendor_id[10]; | 390 | char vendor_id[10]; |
925 | char product_id[18]; | 391 | char product_id[18]; |
926 | char firmware_revision[6]; | 392 | char firmware_revision[6]; |
@@ -1052,27 +518,6 @@ static void ide_tape_put(struct ide_tape_obj *tape) | |||
1052 | #define IDETAPE_MEDIUM_PRESENT 9 | 518 | #define IDETAPE_MEDIUM_PRESENT 9 |
1053 | 519 | ||
1054 | /* | 520 | /* |
1055 | * Supported ATAPI tape drives packet commands | ||
1056 | */ | ||
1057 | #define IDETAPE_TEST_UNIT_READY_CMD 0x00 | ||
1058 | #define IDETAPE_REWIND_CMD 0x01 | ||
1059 | #define IDETAPE_REQUEST_SENSE_CMD 0x03 | ||
1060 | #define IDETAPE_READ_CMD 0x08 | ||
1061 | #define IDETAPE_WRITE_CMD 0x0a | ||
1062 | #define IDETAPE_WRITE_FILEMARK_CMD 0x10 | ||
1063 | #define IDETAPE_SPACE_CMD 0x11 | ||
1064 | #define IDETAPE_INQUIRY_CMD 0x12 | ||
1065 | #define IDETAPE_ERASE_CMD 0x19 | ||
1066 | #define IDETAPE_MODE_SENSE_CMD 0x1a | ||
1067 | #define IDETAPE_MODE_SELECT_CMD 0x15 | ||
1068 | #define IDETAPE_LOAD_UNLOAD_CMD 0x1b | ||
1069 | #define IDETAPE_PREVENT_CMD 0x1e | ||
1070 | #define IDETAPE_LOCATE_CMD 0x2b | ||
1071 | #define IDETAPE_READ_POSITION_CMD 0x34 | ||
1072 | #define IDETAPE_READ_BUFFER_CMD 0x3c | ||
1073 | #define IDETAPE_SET_SPEED_CMD 0xbb | ||
1074 | |||
1075 | /* | ||
1076 | * Some defines for the READ BUFFER command | 521 | * Some defines for the READ BUFFER command |
1077 | */ | 522 | */ |
1078 | #define IDETAPE_RETRIEVE_FAULTY_BLOCK 6 | 523 | #define IDETAPE_RETRIEVE_FAULTY_BLOCK 6 |
@@ -1129,31 +574,6 @@ struct idetape_id_gcw { | |||
1129 | }; | 574 | }; |
1130 | 575 | ||
1131 | /* | 576 | /* |
1132 | * INQUIRY packet command - Data Format (From Table 6-8 of QIC-157C) | ||
1133 | */ | ||
1134 | typedef struct { | ||
1135 | unsigned device_type :5; /* Peripheral Device Type */ | ||
1136 | unsigned reserved0_765 :3; /* Peripheral Qualifier - Reserved */ | ||
1137 | unsigned reserved1_6t0 :7; /* Reserved */ | ||
1138 | unsigned rmb :1; /* Removable Medium Bit */ | ||
1139 | unsigned ansi_version :3; /* ANSI Version */ | ||
1140 | unsigned ecma_version :3; /* ECMA Version */ | ||
1141 | unsigned iso_version :2; /* ISO Version */ | ||
1142 | unsigned response_format :4; /* Response Data Format */ | ||
1143 | unsigned reserved3_45 :2; /* Reserved */ | ||
1144 | unsigned reserved3_6 :1; /* TrmIOP - Reserved */ | ||
1145 | unsigned reserved3_7 :1; /* AENC - Reserved */ | ||
1146 | __u8 additional_length; /* Additional Length (total_length-4) */ | ||
1147 | __u8 rsv5, rsv6, rsv7; /* Reserved */ | ||
1148 | __u8 vendor_id[8]; /* Vendor Identification */ | ||
1149 | __u8 product_id[16]; /* Product Identification */ | ||
1150 | __u8 revision_level[4]; /* Revision Level */ | ||
1151 | __u8 vendor_specific[20]; /* Vendor Specific - Optional */ | ||
1152 | __u8 reserved56t95[40]; /* Reserved - Optional */ | ||
1153 | /* Additional information may be returned */ | ||
1154 | } idetape_inquiry_result_t; | ||
1155 | |||
1156 | /* | ||
1157 | * READ POSITION packet command - Data Format (From Table 6-57) | 577 | * READ POSITION packet command - Data Format (From Table 6-57) |
1158 | */ | 578 | */ |
1159 | typedef struct { | 579 | typedef struct { |
@@ -1171,100 +591,9 @@ typedef struct { | |||
1171 | u32 bytes_in_buffer; /* Bytes In Buffer (Optional) */ | 591 | u32 bytes_in_buffer; /* Bytes In Buffer (Optional) */ |
1172 | } idetape_read_position_result_t; | 592 | } idetape_read_position_result_t; |
1173 | 593 | ||
1174 | /* | 594 | /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ |
1175 | * Follows structures which are related to the SELECT SENSE / MODE SENSE | ||
1176 | * packet commands. Those packet commands are still not supported | ||
1177 | * by ide-tape. | ||
1178 | */ | ||
1179 | #define IDETAPE_BLOCK_DESCRIPTOR 0 | 595 | #define IDETAPE_BLOCK_DESCRIPTOR 0 |
1180 | #define IDETAPE_CAPABILITIES_PAGE 0x2a | 596 | #define IDETAPE_CAPABILITIES_PAGE 0x2a |
1181 | #define IDETAPE_PARAMTR_PAGE 0x2b /* Onstream DI-x0 only */ | ||
1182 | #define IDETAPE_BLOCK_SIZE_PAGE 0x30 | ||
1183 | #define IDETAPE_BUFFER_FILLING_PAGE 0x33 | ||
1184 | |||
1185 | /* | ||
1186 | * Mode Parameter Header for the MODE SENSE packet command | ||
1187 | */ | ||
1188 | typedef struct { | ||
1189 | __u8 mode_data_length; /* Length of the following data transfer */ | ||
1190 | __u8 medium_type; /* Medium Type */ | ||
1191 | __u8 dsp; /* Device Specific Parameter */ | ||
1192 | __u8 bdl; /* Block Descriptor Length */ | ||
1193 | #if 0 | ||
1194 | /* data transfer page */ | ||
1195 | __u8 page_code :6; | ||
1196 | __u8 reserved0_6 :1; | ||
1197 | __u8 ps :1; /* parameters saveable */ | ||
1198 | __u8 page_length; /* page Length == 0x02 */ | ||
1199 | __u8 reserved2; | ||
1200 | __u8 read32k :1; /* 32k blk size (data only) */ | ||
1201 | __u8 read32k5 :1; /* 32.5k blk size (data&AUX) */ | ||
1202 | __u8 reserved3_23 :2; | ||
1203 | __u8 write32k :1; /* 32k blk size (data only) */ | ||
1204 | __u8 write32k5 :1; /* 32.5k blk size (data&AUX) */ | ||
1205 | __u8 reserved3_6 :1; | ||
1206 | __u8 streaming :1; /* streaming mode enable */ | ||
1207 | #endif | ||
1208 | } idetape_mode_parameter_header_t; | ||
1209 | |||
1210 | /* | ||
1211 | * Mode Parameter Block Descriptor the MODE SENSE packet command | ||
1212 | * | ||
1213 | * Support for block descriptors is optional. | ||
1214 | */ | ||
1215 | typedef struct { | ||
1216 | __u8 density_code; /* Medium density code */ | ||
1217 | __u8 blocks[3]; /* Number of blocks */ | ||
1218 | __u8 reserved4; /* Reserved */ | ||
1219 | __u8 length[3]; /* Block Length */ | ||
1220 | } idetape_parameter_block_descriptor_t; | ||
1221 | |||
1222 | /* | ||
1223 | * The Data Compression Page, as returned by the MODE SENSE packet command. | ||
1224 | */ | ||
1225 | typedef struct { | ||
1226 | unsigned page_code :6; /* Page Code - Should be 0xf */ | ||
1227 | unsigned reserved0 :1; /* Reserved */ | ||
1228 | unsigned ps :1; | ||
1229 | __u8 page_length; /* Page Length - Should be 14 */ | ||
1230 | unsigned reserved2 :6; /* Reserved */ | ||
1231 | unsigned dcc :1; /* Data Compression Capable */ | ||
1232 | unsigned dce :1; /* Data Compression Enable */ | ||
1233 | unsigned reserved3 :5; /* Reserved */ | ||
1234 | unsigned red :2; /* Report Exception on Decompression */ | ||
1235 | unsigned dde :1; /* Data Decompression Enable */ | ||
1236 | __u32 ca; /* Compression Algorithm */ | ||
1237 | __u32 da; /* Decompression Algorithm */ | ||
1238 | __u8 reserved[4]; /* Reserved */ | ||
1239 | } idetape_data_compression_page_t; | ||
1240 | |||
1241 | /* | ||
1242 | * The Medium Partition Page, as returned by the MODE SENSE packet command. | ||
1243 | */ | ||
1244 | typedef struct { | ||
1245 | unsigned page_code :6; /* Page Code - Should be 0x11 */ | ||
1246 | unsigned reserved1_6 :1; /* Reserved */ | ||
1247 | unsigned ps :1; | ||
1248 | __u8 page_length; /* Page Length - Should be 6 */ | ||
1249 | __u8 map; /* Maximum Additional Partitions - Should be 0 */ | ||
1250 | __u8 apd; /* Additional Partitions Defined - Should be 0 */ | ||
1251 | unsigned reserved4_012 :3; /* Reserved */ | ||
1252 | unsigned psum :2; /* Should be 0 */ | ||
1253 | unsigned idp :1; /* Should be 0 */ | ||
1254 | unsigned sdp :1; /* Should be 0 */ | ||
1255 | unsigned fdp :1; /* Fixed Data Partitions */ | ||
1256 | __u8 mfr; /* Medium Format Recognition */ | ||
1257 | __u8 reserved[2]; /* Reserved */ | ||
1258 | } idetape_medium_partition_page_t; | ||
1259 | |||
1260 | /* | ||
1261 | * Run time configurable parameters. | ||
1262 | */ | ||
1263 | typedef struct { | ||
1264 | int dsc_rw_frequency; | ||
1265 | int dsc_media_access_frequency; | ||
1266 | int nr_stages; | ||
1267 | } idetape_config_t; | ||
1268 | 597 | ||
1269 | /* | 598 | /* |
1270 | * The variables below are used for the character device interface. | 599 | * The variables below are used for the character device interface. |
@@ -1309,14 +638,12 @@ static void idetape_input_buffers (ide_drive_t *drive, idetape_pc_t *pc, unsigne | |||
1309 | int count; | 638 | int count; |
1310 | 639 | ||
1311 | while (bcount) { | 640 | while (bcount) { |
1312 | #if IDETAPE_DEBUG_BUGS | ||
1313 | if (bh == NULL) { | 641 | if (bh == NULL) { |
1314 | printk(KERN_ERR "ide-tape: bh == NULL in " | 642 | printk(KERN_ERR "ide-tape: bh == NULL in " |
1315 | "idetape_input_buffers\n"); | 643 | "idetape_input_buffers\n"); |
1316 | idetape_discard_data(drive, bcount); | 644 | idetape_discard_data(drive, bcount); |
1317 | return; | 645 | return; |
1318 | } | 646 | } |
1319 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1320 | count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), bcount); | 647 | count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), bcount); |
1321 | HWIF(drive)->atapi_input_bytes(drive, bh->b_data + atomic_read(&bh->b_count), count); | 648 | HWIF(drive)->atapi_input_bytes(drive, bh->b_data + atomic_read(&bh->b_count), count); |
1322 | bcount -= count; | 649 | bcount -= count; |
@@ -1336,13 +663,11 @@ static void idetape_output_buffers (ide_drive_t *drive, idetape_pc_t *pc, unsign | |||
1336 | int count; | 663 | int count; |
1337 | 664 | ||
1338 | while (bcount) { | 665 | while (bcount) { |
1339 | #if IDETAPE_DEBUG_BUGS | ||
1340 | if (bh == NULL) { | 666 | if (bh == NULL) { |
1341 | printk(KERN_ERR "ide-tape: bh == NULL in " | 667 | printk(KERN_ERR "ide-tape: bh == NULL in " |
1342 | "idetape_output_buffers\n"); | 668 | "idetape_output_buffers\n"); |
1343 | return; | 669 | return; |
1344 | } | 670 | } |
1345 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1346 | count = min((unsigned int)pc->b_count, (unsigned int)bcount); | 671 | count = min((unsigned int)pc->b_count, (unsigned int)bcount); |
1347 | HWIF(drive)->atapi_output_bytes(drive, pc->b_data, count); | 672 | HWIF(drive)->atapi_output_bytes(drive, pc->b_data, count); |
1348 | bcount -= count; | 673 | bcount -= count; |
@@ -1367,13 +692,11 @@ static void idetape_update_buffers (idetape_pc_t *pc) | |||
1367 | if (test_bit(PC_WRITING, &pc->flags)) | 692 | if (test_bit(PC_WRITING, &pc->flags)) |
1368 | return; | 693 | return; |
1369 | while (bcount) { | 694 | while (bcount) { |
1370 | #if IDETAPE_DEBUG_BUGS | ||
1371 | if (bh == NULL) { | 695 | if (bh == NULL) { |
1372 | printk(KERN_ERR "ide-tape: bh == NULL in " | 696 | printk(KERN_ERR "ide-tape: bh == NULL in " |
1373 | "idetape_update_buffers\n"); | 697 | "idetape_update_buffers\n"); |
1374 | return; | 698 | return; |
1375 | } | 699 | } |
1376 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1377 | count = min((unsigned int)bh->b_size, (unsigned int)bcount); | 700 | count = min((unsigned int)bh->b_size, (unsigned int)bcount); |
1378 | atomic_set(&bh->b_count, count); | 701 | atomic_set(&bh->b_count, count); |
1379 | if (atomic_read(&bh->b_count) == bh->b_size) | 702 | if (atomic_read(&bh->b_count) == bh->b_size) |
@@ -1446,36 +769,34 @@ static void idetape_init_pc (idetape_pc_t *pc) | |||
1446 | } | 769 | } |
1447 | 770 | ||
1448 | /* | 771 | /* |
1449 | * idetape_analyze_error is called on each failed packet command retry | 772 | * called on each failed packet command retry to analyze the request sense. We |
1450 | * to analyze the request sense. We currently do not utilize this | 773 | * currently do not utilize this information. |
1451 | * information. | ||
1452 | */ | 774 | */ |
1453 | static void idetape_analyze_error (ide_drive_t *drive, idetape_request_sense_result_t *result) | 775 | static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) |
1454 | { | 776 | { |
1455 | idetape_tape_t *tape = drive->driver_data; | 777 | idetape_tape_t *tape = drive->driver_data; |
1456 | idetape_pc_t *pc = tape->failed_pc; | 778 | idetape_pc_t *pc = tape->failed_pc; |
1457 | 779 | ||
1458 | tape->sense = *result; | 780 | tape->sense_key = sense[2] & 0xF; |
1459 | tape->sense_key = result->sense_key; | 781 | tape->asc = sense[12]; |
1460 | tape->asc = result->asc; | 782 | tape->ascq = sense[13]; |
1461 | tape->ascq = result->ascq; | ||
1462 | #if IDETAPE_DEBUG_LOG | 783 | #if IDETAPE_DEBUG_LOG |
1463 | /* | 784 | /* |
1464 | * Without debugging, we only log an error if we decided to | 785 | * Without debugging, we only log an error if we decided to give up |
1465 | * give up retrying. | 786 | * retrying. |
1466 | */ | 787 | */ |
1467 | if (tape->debug_level >= 1) | 788 | if (tape->debug_level >= 1) |
1468 | printk(KERN_INFO "ide-tape: pc = %x, sense key = %x, " | 789 | printk(KERN_INFO "ide-tape: pc = %x, sense key = %x, " |
1469 | "asc = %x, ascq = %x\n", | 790 | "asc = %x, ascq = %x\n", |
1470 | pc->c[0], result->sense_key, | 791 | pc->c[0], tape->sense_key, |
1471 | result->asc, result->ascq); | 792 | tape->asc, tape->ascq); |
1472 | #endif /* IDETAPE_DEBUG_LOG */ | 793 | #endif /* IDETAPE_DEBUG_LOG */ |
1473 | 794 | ||
1474 | /* | 795 | /* Correct pc->actually_transferred by asking the tape. */ |
1475 | * Correct pc->actually_transferred by asking the tape. | ||
1476 | */ | ||
1477 | if (test_bit(PC_DMA_ERROR, &pc->flags)) { | 796 | if (test_bit(PC_DMA_ERROR, &pc->flags)) { |
1478 | pc->actually_transferred = pc->request_transfer - tape->tape_block_size * ntohl(get_unaligned(&result->information)); | 797 | pc->actually_transferred = pc->request_transfer - |
798 | tape->tape_block_size * | ||
799 | be32_to_cpu(get_unaligned((u32 *)&sense[3])); | ||
1479 | idetape_update_buffers(pc); | 800 | idetape_update_buffers(pc); |
1480 | } | 801 | } |
1481 | 802 | ||
@@ -1484,29 +805,29 @@ static void idetape_analyze_error (ide_drive_t *drive, idetape_request_sense_res | |||
1484 | * with sense key=5, asc=0x22, ascq=0, let it slide. Some drives | 805 | * with sense key=5, asc=0x22, ascq=0, let it slide. Some drives |
1485 | * (i.e. Seagate STT3401A Travan) don't support 0-length read/writes. | 806 | * (i.e. Seagate STT3401A Travan) don't support 0-length read/writes. |
1486 | */ | 807 | */ |
1487 | if ((pc->c[0] == IDETAPE_READ_CMD || pc->c[0] == IDETAPE_WRITE_CMD) | 808 | if ((pc->c[0] == READ_6 || pc->c[0] == WRITE_6) |
1488 | && pc->c[4] == 0 && pc->c[3] == 0 && pc->c[2] == 0) { /* length==0 */ | 809 | /* length == 0 */ |
1489 | if (result->sense_key == 5) { | 810 | && pc->c[4] == 0 && pc->c[3] == 0 && pc->c[2] == 0) { |
811 | if (tape->sense_key == 5) { | ||
1490 | /* don't report an error, everything's ok */ | 812 | /* don't report an error, everything's ok */ |
1491 | pc->error = 0; | 813 | pc->error = 0; |
1492 | /* don't retry read/write */ | 814 | /* don't retry read/write */ |
1493 | set_bit(PC_ABORT, &pc->flags); | 815 | set_bit(PC_ABORT, &pc->flags); |
1494 | } | 816 | } |
1495 | } | 817 | } |
1496 | if (pc->c[0] == IDETAPE_READ_CMD && result->filemark) { | 818 | if (pc->c[0] == READ_6 && (sense[2] & 0x80)) { |
1497 | pc->error = IDETAPE_ERROR_FILEMARK; | 819 | pc->error = IDETAPE_ERROR_FILEMARK; |
1498 | set_bit(PC_ABORT, &pc->flags); | 820 | set_bit(PC_ABORT, &pc->flags); |
1499 | } | 821 | } |
1500 | if (pc->c[0] == IDETAPE_WRITE_CMD) { | 822 | if (pc->c[0] == WRITE_6) { |
1501 | if (result->eom || | 823 | if ((sense[2] & 0x40) || (tape->sense_key == 0xd |
1502 | (result->sense_key == 0xd && result->asc == 0x0 && | 824 | && tape->asc == 0x0 && tape->ascq == 0x2)) { |
1503 | result->ascq == 0x2)) { | ||
1504 | pc->error = IDETAPE_ERROR_EOD; | 825 | pc->error = IDETAPE_ERROR_EOD; |
1505 | set_bit(PC_ABORT, &pc->flags); | 826 | set_bit(PC_ABORT, &pc->flags); |
1506 | } | 827 | } |
1507 | } | 828 | } |
1508 | if (pc->c[0] == IDETAPE_READ_CMD || pc->c[0] == IDETAPE_WRITE_CMD) { | 829 | if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { |
1509 | if (result->sense_key == 8) { | 830 | if (tape->sense_key == 8) { |
1510 | pc->error = IDETAPE_ERROR_EOD; | 831 | pc->error = IDETAPE_ERROR_EOD; |
1511 | set_bit(PC_ABORT, &pc->flags); | 832 | set_bit(PC_ABORT, &pc->flags); |
1512 | } | 833 | } |
@@ -1516,10 +837,7 @@ static void idetape_analyze_error (ide_drive_t *drive, idetape_request_sense_res | |||
1516 | } | 837 | } |
1517 | } | 838 | } |
1518 | 839 | ||
1519 | /* | 840 | static void idetape_activate_next_stage(ide_drive_t *drive) |
1520 | * idetape_active_next_stage will declare the next stage as "active". | ||
1521 | */ | ||
1522 | static void idetape_active_next_stage (ide_drive_t *drive) | ||
1523 | { | 841 | { |
1524 | idetape_tape_t *tape = drive->driver_data; | 842 | idetape_tape_t *tape = drive->driver_data; |
1525 | idetape_stage_t *stage = tape->next_stage; | 843 | idetape_stage_t *stage = tape->next_stage; |
@@ -1529,12 +847,10 @@ static void idetape_active_next_stage (ide_drive_t *drive) | |||
1529 | if (tape->debug_level >= 4) | 847 | if (tape->debug_level >= 4) |
1530 | printk(KERN_INFO "ide-tape: Reached idetape_active_next_stage\n"); | 848 | printk(KERN_INFO "ide-tape: Reached idetape_active_next_stage\n"); |
1531 | #endif /* IDETAPE_DEBUG_LOG */ | 849 | #endif /* IDETAPE_DEBUG_LOG */ |
1532 | #if IDETAPE_DEBUG_BUGS | ||
1533 | if (stage == NULL) { | 850 | if (stage == NULL) { |
1534 | printk(KERN_ERR "ide-tape: bug: Trying to activate a non existing stage\n"); | 851 | printk(KERN_ERR "ide-tape: bug: Trying to activate a non existing stage\n"); |
1535 | return; | 852 | return; |
1536 | } | 853 | } |
1537 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1538 | 854 | ||
1539 | rq->rq_disk = tape->disk; | 855 | rq->rq_disk = tape->disk; |
1540 | rq->buffer = NULL; | 856 | rq->buffer = NULL; |
@@ -1609,28 +925,24 @@ static void idetape_remove_stage_head (ide_drive_t *drive) | |||
1609 | if (tape->debug_level >= 4) | 925 | if (tape->debug_level >= 4) |
1610 | printk(KERN_INFO "ide-tape: Reached idetape_remove_stage_head\n"); | 926 | printk(KERN_INFO "ide-tape: Reached idetape_remove_stage_head\n"); |
1611 | #endif /* IDETAPE_DEBUG_LOG */ | 927 | #endif /* IDETAPE_DEBUG_LOG */ |
1612 | #if IDETAPE_DEBUG_BUGS | ||
1613 | if (tape->first_stage == NULL) { | 928 | if (tape->first_stage == NULL) { |
1614 | printk(KERN_ERR "ide-tape: bug: tape->first_stage is NULL\n"); | 929 | printk(KERN_ERR "ide-tape: bug: tape->first_stage is NULL\n"); |
1615 | return; | 930 | return; |
1616 | } | 931 | } |
1617 | if (tape->active_stage == tape->first_stage) { | 932 | if (tape->active_stage == tape->first_stage) { |
1618 | printk(KERN_ERR "ide-tape: bug: Trying to free our active pipeline stage\n"); | 933 | printk(KERN_ERR "ide-tape: bug: Trying to free our active pipeline stage\n"); |
1619 | return; | 934 | return; |
1620 | } | 935 | } |
1621 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1622 | stage = tape->first_stage; | 936 | stage = tape->first_stage; |
1623 | tape->first_stage = stage->next; | 937 | tape->first_stage = stage->next; |
1624 | idetape_kfree_stage(tape, stage); | 938 | idetape_kfree_stage(tape, stage); |
1625 | tape->nr_stages--; | 939 | tape->nr_stages--; |
1626 | if (tape->first_stage == NULL) { | 940 | if (tape->first_stage == NULL) { |
1627 | tape->last_stage = NULL; | 941 | tape->last_stage = NULL; |
1628 | #if IDETAPE_DEBUG_BUGS | ||
1629 | if (tape->next_stage != NULL) | 942 | if (tape->next_stage != NULL) |
1630 | printk(KERN_ERR "ide-tape: bug: tape->next_stage != NULL\n"); | 943 | printk(KERN_ERR "ide-tape: bug: tape->next_stage != NULL\n"); |
1631 | if (tape->nr_stages) | 944 | if (tape->nr_stages) |
1632 | printk(KERN_ERR "ide-tape: bug: nr_stages should be 0 now\n"); | 945 | printk(KERN_ERR "ide-tape: bug: nr_stages should be 0 now\n"); |
1633 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
1634 | } | 946 | } |
1635 | } | 947 | } |
1636 | 948 | ||
@@ -1716,7 +1028,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) | |||
1716 | } | 1028 | } |
1717 | } | 1029 | } |
1718 | if (tape->next_stage != NULL) { | 1030 | if (tape->next_stage != NULL) { |
1719 | idetape_active_next_stage(drive); | 1031 | idetape_activate_next_stage(drive); |
1720 | 1032 | ||
1721 | /* | 1033 | /* |
1722 | * Insert the next request into the request queue. | 1034 | * Insert the next request into the request queue. |
@@ -1748,7 +1060,7 @@ static ide_startstop_t idetape_request_sense_callback (ide_drive_t *drive) | |||
1748 | printk(KERN_INFO "ide-tape: Reached idetape_request_sense_callback\n"); | 1060 | printk(KERN_INFO "ide-tape: Reached idetape_request_sense_callback\n"); |
1749 | #endif /* IDETAPE_DEBUG_LOG */ | 1061 | #endif /* IDETAPE_DEBUG_LOG */ |
1750 | if (!tape->pc->error) { | 1062 | if (!tape->pc->error) { |
1751 | idetape_analyze_error(drive, (idetape_request_sense_result_t *) tape->pc->buffer); | 1063 | idetape_analyze_error(drive, tape->pc->buffer); |
1752 | idetape_end_request(drive, 1, 0); | 1064 | idetape_end_request(drive, 1, 0); |
1753 | } else { | 1065 | } else { |
1754 | printk(KERN_ERR "ide-tape: Error in REQUEST SENSE itself - Aborting request!\n"); | 1066 | printk(KERN_ERR "ide-tape: Error in REQUEST SENSE itself - Aborting request!\n"); |
@@ -1760,7 +1072,7 @@ static ide_startstop_t idetape_request_sense_callback (ide_drive_t *drive) | |||
1760 | static void idetape_create_request_sense_cmd (idetape_pc_t *pc) | 1072 | static void idetape_create_request_sense_cmd (idetape_pc_t *pc) |
1761 | { | 1073 | { |
1762 | idetape_init_pc(pc); | 1074 | idetape_init_pc(pc); |
1763 | pc->c[0] = IDETAPE_REQUEST_SENSE_CMD; | 1075 | pc->c[0] = REQUEST_SENSE; |
1764 | pc->c[4] = 20; | 1076 | pc->c[4] = 20; |
1765 | pc->request_transfer = 20; | 1077 | pc->request_transfer = 20; |
1766 | pc->callback = &idetape_request_sense_callback; | 1078 | pc->callback = &idetape_request_sense_callback; |
@@ -1913,15 +1225,14 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) | |||
1913 | local_irq_enable(); | 1225 | local_irq_enable(); |
1914 | 1226 | ||
1915 | #if SIMULATE_ERRORS | 1227 | #if SIMULATE_ERRORS |
1916 | if ((pc->c[0] == IDETAPE_WRITE_CMD || | 1228 | if ((pc->c[0] == WRITE_6 || pc->c[0] == READ_6) && |
1917 | pc->c[0] == IDETAPE_READ_CMD) && | ||
1918 | (++error_sim_count % 100) == 0) { | 1229 | (++error_sim_count % 100) == 0) { |
1919 | printk(KERN_INFO "ide-tape: %s: simulating error\n", | 1230 | printk(KERN_INFO "ide-tape: %s: simulating error\n", |
1920 | tape->name); | 1231 | tape->name); |
1921 | stat |= ERR_STAT; | 1232 | stat |= ERR_STAT; |
1922 | } | 1233 | } |
1923 | #endif | 1234 | #endif |
1924 | if ((stat & ERR_STAT) && pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) | 1235 | if ((stat & ERR_STAT) && pc->c[0] == REQUEST_SENSE) |
1925 | stat &= ~ERR_STAT; | 1236 | stat &= ~ERR_STAT; |
1926 | if ((stat & ERR_STAT) || test_bit(PC_DMA_ERROR, &pc->flags)) { | 1237 | if ((stat & ERR_STAT) || test_bit(PC_DMA_ERROR, &pc->flags)) { |
1927 | /* Error detected */ | 1238 | /* Error detected */ |
@@ -1930,7 +1241,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive) | |||
1930 | printk(KERN_INFO "ide-tape: %s: I/O error\n", | 1241 | printk(KERN_INFO "ide-tape: %s: I/O error\n", |
1931 | tape->name); | 1242 | tape->name); |
1932 | #endif /* IDETAPE_DEBUG_LOG */ | 1243 | #endif /* IDETAPE_DEBUG_LOG */ |
1933 | if (pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) { | 1244 | if (pc->c[0] == REQUEST_SENSE) { |
1934 | printk(KERN_ERR "ide-tape: I/O error in request sense command\n"); | 1245 | printk(KERN_ERR "ide-tape: I/O error in request sense command\n"); |
1935 | return ide_do_reset(drive); | 1246 | return ide_do_reset(drive); |
1936 | } | 1247 | } |
@@ -2118,15 +1429,13 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape | |||
2118 | int dma_ok = 0; | 1429 | int dma_ok = 0; |
2119 | u16 bcount; | 1430 | u16 bcount; |
2120 | 1431 | ||
2121 | #if IDETAPE_DEBUG_BUGS | 1432 | if (tape->pc->c[0] == REQUEST_SENSE && |
2122 | if (tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD && | 1433 | pc->c[0] == REQUEST_SENSE) { |
2123 | pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) { | ||
2124 | printk(KERN_ERR "ide-tape: possible ide-tape.c bug - " | 1434 | printk(KERN_ERR "ide-tape: possible ide-tape.c bug - " |
2125 | "Two request sense in serial were issued\n"); | 1435 | "Two request sense in serial were issued\n"); |
2126 | } | 1436 | } |
2127 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2128 | 1437 | ||
2129 | if (tape->failed_pc == NULL && pc->c[0] != IDETAPE_REQUEST_SENSE_CMD) | 1438 | if (tape->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) |
2130 | tape->failed_pc = pc; | 1439 | tape->failed_pc = pc; |
2131 | /* Set the current packet command */ | 1440 | /* Set the current packet command */ |
2132 | tape->pc = pc; | 1441 | tape->pc = pc; |
@@ -2139,7 +1448,7 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape | |||
2139 | * filemark, or end of the media, for example). | 1448 | * filemark, or end of the media, for example). |
2140 | */ | 1449 | */ |
2141 | if (!test_bit(PC_ABORT, &pc->flags)) { | 1450 | if (!test_bit(PC_ABORT, &pc->flags)) { |
2142 | if (!(pc->c[0] == IDETAPE_TEST_UNIT_READY_CMD && | 1451 | if (!(pc->c[0] == TEST_UNIT_READY && |
2143 | tape->sense_key == 2 && tape->asc == 4 && | 1452 | tape->sense_key == 2 && tape->asc == 4 && |
2144 | (tape->ascq == 1 || tape->ascq == 8))) { | 1453 | (tape->ascq == 1 || tape->ascq == 8))) { |
2145 | printk(KERN_ERR "ide-tape: %s: I/O error, " | 1454 | printk(KERN_ERR "ide-tape: %s: I/O error, " |
@@ -2181,8 +1490,8 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape | |||
2181 | if (dma_ok) /* Will begin DMA later */ | 1490 | if (dma_ok) /* Will begin DMA later */ |
2182 | set_bit(PC_DMA_IN_PROGRESS, &pc->flags); | 1491 | set_bit(PC_DMA_IN_PROGRESS, &pc->flags); |
2183 | if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) { | 1492 | if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) { |
2184 | ide_set_handler(drive, &idetape_transfer_pc, IDETAPE_WAIT_CMD, NULL); | 1493 | ide_execute_command(drive, WIN_PACKETCMD, &idetape_transfer_pc, |
2185 | hwif->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG); | 1494 | IDETAPE_WAIT_CMD, NULL); |
2186 | return ide_started; | 1495 | return ide_started; |
2187 | } else { | 1496 | } else { |
2188 | hwif->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG); | 1497 | hwif->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG); |
@@ -2212,7 +1521,7 @@ static ide_startstop_t idetape_pc_callback (ide_drive_t *drive) | |||
2212 | static void idetape_create_mode_sense_cmd (idetape_pc_t *pc, u8 page_code) | 1521 | static void idetape_create_mode_sense_cmd (idetape_pc_t *pc, u8 page_code) |
2213 | { | 1522 | { |
2214 | idetape_init_pc(pc); | 1523 | idetape_init_pc(pc); |
2215 | pc->c[0] = IDETAPE_MODE_SENSE_CMD; | 1524 | pc->c[0] = MODE_SENSE; |
2216 | if (page_code != IDETAPE_BLOCK_DESCRIPTOR) | 1525 | if (page_code != IDETAPE_BLOCK_DESCRIPTOR) |
2217 | pc->c[1] = 8; /* DBD = 1 - Don't return block descriptors */ | 1526 | pc->c[1] = 8; /* DBD = 1 - Don't return block descriptors */ |
2218 | pc->c[2] = page_code; | 1527 | pc->c[2] = page_code; |
@@ -2293,7 +1602,7 @@ static ide_startstop_t idetape_media_access_finished (ide_drive_t *drive) | |||
2293 | if (stat & SEEK_STAT) { | 1602 | if (stat & SEEK_STAT) { |
2294 | if (stat & ERR_STAT) { | 1603 | if (stat & ERR_STAT) { |
2295 | /* Error detected */ | 1604 | /* Error detected */ |
2296 | if (pc->c[0] != IDETAPE_TEST_UNIT_READY_CMD) | 1605 | if (pc->c[0] != TEST_UNIT_READY) |
2297 | printk(KERN_ERR "ide-tape: %s: I/O error, ", | 1606 | printk(KERN_ERR "ide-tape: %s: I/O error, ", |
2298 | tape->name); | 1607 | tape->name); |
2299 | /* Retry operation */ | 1608 | /* Retry operation */ |
@@ -2350,8 +1659,8 @@ static ide_startstop_t idetape_rw_callback (ide_drive_t *drive) | |||
2350 | static void idetape_create_read_cmd(idetape_tape_t *tape, idetape_pc_t *pc, unsigned int length, struct idetape_bh *bh) | 1659 | static void idetape_create_read_cmd(idetape_tape_t *tape, idetape_pc_t *pc, unsigned int length, struct idetape_bh *bh) |
2351 | { | 1660 | { |
2352 | idetape_init_pc(pc); | 1661 | idetape_init_pc(pc); |
2353 | pc->c[0] = IDETAPE_READ_CMD; | 1662 | pc->c[0] = READ_6; |
2354 | put_unaligned(htonl(length), (unsigned int *) &pc->c[1]); | 1663 | put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); |
2355 | pc->c[1] = 1; | 1664 | pc->c[1] = 1; |
2356 | pc->callback = &idetape_rw_callback; | 1665 | pc->callback = &idetape_rw_callback; |
2357 | pc->bh = bh; | 1666 | pc->bh = bh; |
@@ -2368,7 +1677,7 @@ static void idetape_create_read_buffer_cmd(idetape_tape_t *tape, idetape_pc_t *p | |||
2368 | struct idetape_bh *p = bh; | 1677 | struct idetape_bh *p = bh; |
2369 | 1678 | ||
2370 | idetape_init_pc(pc); | 1679 | idetape_init_pc(pc); |
2371 | pc->c[0] = IDETAPE_READ_BUFFER_CMD; | 1680 | pc->c[0] = READ_BUFFER; |
2372 | pc->c[1] = IDETAPE_RETRIEVE_FAULTY_BLOCK; | 1681 | pc->c[1] = IDETAPE_RETRIEVE_FAULTY_BLOCK; |
2373 | pc->c[7] = size >> 8; | 1682 | pc->c[7] = size >> 8; |
2374 | pc->c[8] = size & 0xff; | 1683 | pc->c[8] = size & 0xff; |
@@ -2386,8 +1695,8 @@ static void idetape_create_read_buffer_cmd(idetape_tape_t *tape, idetape_pc_t *p | |||
2386 | static void idetape_create_write_cmd(idetape_tape_t *tape, idetape_pc_t *pc, unsigned int length, struct idetape_bh *bh) | 1695 | static void idetape_create_write_cmd(idetape_tape_t *tape, idetape_pc_t *pc, unsigned int length, struct idetape_bh *bh) |
2387 | { | 1696 | { |
2388 | idetape_init_pc(pc); | 1697 | idetape_init_pc(pc); |
2389 | pc->c[0] = IDETAPE_WRITE_CMD; | 1698 | pc->c[0] = WRITE_6; |
2390 | put_unaligned(htonl(length), (unsigned int *) &pc->c[1]); | 1699 | put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]); |
2391 | pc->c[1] = 1; | 1700 | pc->c[1] = 1; |
2392 | pc->callback = &idetape_rw_callback; | 1701 | pc->callback = &idetape_rw_callback; |
2393 | set_bit(PC_WRITING, &pc->flags); | 1702 | set_bit(PC_WRITING, &pc->flags); |
@@ -2412,12 +1721,6 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
2412 | u8 stat; | 1721 | u8 stat; |
2413 | 1722 | ||
2414 | #if IDETAPE_DEBUG_LOG | 1723 | #if IDETAPE_DEBUG_LOG |
2415 | #if 0 | ||
2416 | if (tape->debug_level >= 5) | ||
2417 | printk(KERN_INFO "ide-tape: %d, " | ||
2418 | "dev: %s, cmd: %ld, errors: %d\n", | ||
2419 | rq->rq_disk->disk_name, rq->cmd[0], rq->errors); | ||
2420 | #endif | ||
2421 | if (tape->debug_level >= 2) | 1724 | if (tape->debug_level >= 2) |
2422 | printk(KERN_INFO "ide-tape: sector: %ld, " | 1725 | printk(KERN_INFO "ide-tape: sector: %ld, " |
2423 | "nr_sectors: %ld, current_nr_sectors: %d\n", | 1726 | "nr_sectors: %ld, current_nr_sectors: %d\n", |
@@ -2438,10 +1741,9 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
2438 | * Retry a failed packet command | 1741 | * Retry a failed packet command |
2439 | */ | 1742 | */ |
2440 | if (tape->failed_pc != NULL && | 1743 | if (tape->failed_pc != NULL && |
2441 | tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) { | 1744 | tape->pc->c[0] == REQUEST_SENSE) { |
2442 | return idetape_issue_packet_command(drive, tape->failed_pc); | 1745 | return idetape_issue_packet_command(drive, tape->failed_pc); |
2443 | } | 1746 | } |
2444 | #if IDETAPE_DEBUG_BUGS | ||
2445 | if (postponed_rq != NULL) | 1747 | if (postponed_rq != NULL) |
2446 | if (rq != postponed_rq) { | 1748 | if (rq != postponed_rq) { |
2447 | printk(KERN_ERR "ide-tape: ide-tape.c bug - " | 1749 | printk(KERN_ERR "ide-tape: ide-tape.c bug - " |
@@ -2449,7 +1751,6 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
2449 | idetape_end_request(drive, 0, 0); | 1751 | idetape_end_request(drive, 0, 0); |
2450 | return ide_stopped; | 1752 | return ide_stopped; |
2451 | } | 1753 | } |
2452 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2453 | 1754 | ||
2454 | tape->postponed_rq = NULL; | 1755 | tape->postponed_rq = NULL; |
2455 | 1756 | ||
@@ -2636,13 +1937,11 @@ static int idetape_copy_stage_from_user (idetape_tape_t *tape, idetape_stage_t * | |||
2636 | int ret = 0; | 1937 | int ret = 0; |
2637 | 1938 | ||
2638 | while (n) { | 1939 | while (n) { |
2639 | #if IDETAPE_DEBUG_BUGS | ||
2640 | if (bh == NULL) { | 1940 | if (bh == NULL) { |
2641 | printk(KERN_ERR "ide-tape: bh == NULL in " | 1941 | printk(KERN_ERR "ide-tape: bh == NULL in " |
2642 | "idetape_copy_stage_from_user\n"); | 1942 | "idetape_copy_stage_from_user\n"); |
2643 | return 1; | 1943 | return 1; |
2644 | } | 1944 | } |
2645 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2646 | count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), (unsigned int)n); | 1945 | count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), (unsigned int)n); |
2647 | if (copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count)) | 1946 | if (copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count)) |
2648 | ret = 1; | 1947 | ret = 1; |
@@ -2666,13 +1965,11 @@ static int idetape_copy_stage_to_user (idetape_tape_t *tape, char __user *buf, i | |||
2666 | int ret = 0; | 1965 | int ret = 0; |
2667 | 1966 | ||
2668 | while (n) { | 1967 | while (n) { |
2669 | #if IDETAPE_DEBUG_BUGS | ||
2670 | if (bh == NULL) { | 1968 | if (bh == NULL) { |
2671 | printk(KERN_ERR "ide-tape: bh == NULL in " | 1969 | printk(KERN_ERR "ide-tape: bh == NULL in " |
2672 | "idetape_copy_stage_to_user\n"); | 1970 | "idetape_copy_stage_to_user\n"); |
2673 | return 1; | 1971 | return 1; |
2674 | } | 1972 | } |
2675 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2676 | count = min(tape->b_count, n); | 1973 | count = min(tape->b_count, n); |
2677 | if (copy_to_user(buf, tape->b_data, count)) | 1974 | if (copy_to_user(buf, tape->b_data, count)) |
2678 | ret = 1; | 1975 | ret = 1; |
@@ -2752,12 +2049,10 @@ static void idetape_wait_for_request (ide_drive_t *drive, struct request *rq) | |||
2752 | DECLARE_COMPLETION_ONSTACK(wait); | 2049 | DECLARE_COMPLETION_ONSTACK(wait); |
2753 | idetape_tape_t *tape = drive->driver_data; | 2050 | idetape_tape_t *tape = drive->driver_data; |
2754 | 2051 | ||
2755 | #if IDETAPE_DEBUG_BUGS | ||
2756 | if (rq == NULL || !blk_special_request(rq)) { | 2052 | if (rq == NULL || !blk_special_request(rq)) { |
2757 | printk (KERN_ERR "ide-tape: bug: Trying to sleep on non-valid request\n"); | 2053 | printk (KERN_ERR "ide-tape: bug: Trying to sleep on non-valid request\n"); |
2758 | return; | 2054 | return; |
2759 | } | 2055 | } |
2760 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
2761 | rq->end_io_data = &wait; | 2056 | rq->end_io_data = &wait; |
2762 | rq->end_io = blk_end_sync_rq; | 2057 | rq->end_io = blk_end_sync_rq; |
2763 | spin_unlock_irq(&tape->spinlock); | 2058 | spin_unlock_irq(&tape->spinlock); |
@@ -2817,7 +2112,7 @@ static ide_startstop_t idetape_read_position_callback (ide_drive_t *drive) | |||
2817 | static void idetape_create_write_filemark_cmd (ide_drive_t *drive, idetape_pc_t *pc,int write_filemark) | 2112 | static void idetape_create_write_filemark_cmd (ide_drive_t *drive, idetape_pc_t *pc,int write_filemark) |
2818 | { | 2113 | { |
2819 | idetape_init_pc(pc); | 2114 | idetape_init_pc(pc); |
2820 | pc->c[0] = IDETAPE_WRITE_FILEMARK_CMD; | 2115 | pc->c[0] = WRITE_FILEMARKS; |
2821 | pc->c[4] = write_filemark; | 2116 | pc->c[4] = write_filemark; |
2822 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 2117 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); |
2823 | pc->callback = &idetape_pc_callback; | 2118 | pc->callback = &idetape_pc_callback; |
@@ -2826,7 +2121,7 @@ static void idetape_create_write_filemark_cmd (ide_drive_t *drive, idetape_pc_t | |||
2826 | static void idetape_create_test_unit_ready_cmd(idetape_pc_t *pc) | 2121 | static void idetape_create_test_unit_ready_cmd(idetape_pc_t *pc) |
2827 | { | 2122 | { |
2828 | idetape_init_pc(pc); | 2123 | idetape_init_pc(pc); |
2829 | pc->c[0] = IDETAPE_TEST_UNIT_READY_CMD; | 2124 | pc->c[0] = TEST_UNIT_READY; |
2830 | pc->callback = &idetape_pc_callback; | 2125 | pc->callback = &idetape_pc_callback; |
2831 | } | 2126 | } |
2832 | 2127 | ||
@@ -2864,7 +2159,7 @@ static int __idetape_queue_pc_tail (ide_drive_t *drive, idetape_pc_t *pc) | |||
2864 | static void idetape_create_load_unload_cmd (ide_drive_t *drive, idetape_pc_t *pc,int cmd) | 2159 | static void idetape_create_load_unload_cmd (ide_drive_t *drive, idetape_pc_t *pc,int cmd) |
2865 | { | 2160 | { |
2866 | idetape_init_pc(pc); | 2161 | idetape_init_pc(pc); |
2867 | pc->c[0] = IDETAPE_LOAD_UNLOAD_CMD; | 2162 | pc->c[0] = START_STOP; |
2868 | pc->c[4] = cmd; | 2163 | pc->c[4] = cmd; |
2869 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 2164 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); |
2870 | pc->callback = &idetape_pc_callback; | 2165 | pc->callback = &idetape_pc_callback; |
@@ -2921,7 +2216,7 @@ static int idetape_flush_tape_buffers (ide_drive_t *drive) | |||
2921 | static void idetape_create_read_position_cmd (idetape_pc_t *pc) | 2216 | static void idetape_create_read_position_cmd (idetape_pc_t *pc) |
2922 | { | 2217 | { |
2923 | idetape_init_pc(pc); | 2218 | idetape_init_pc(pc); |
2924 | pc->c[0] = IDETAPE_READ_POSITION_CMD; | 2219 | pc->c[0] = READ_POSITION; |
2925 | pc->request_transfer = 20; | 2220 | pc->request_transfer = 20; |
2926 | pc->callback = &idetape_read_position_callback; | 2221 | pc->callback = &idetape_read_position_callback; |
2927 | } | 2222 | } |
@@ -2947,9 +2242,9 @@ static int idetape_read_position (ide_drive_t *drive) | |||
2947 | static void idetape_create_locate_cmd (ide_drive_t *drive, idetape_pc_t *pc, unsigned int block, u8 partition, int skip) | 2242 | static void idetape_create_locate_cmd (ide_drive_t *drive, idetape_pc_t *pc, unsigned int block, u8 partition, int skip) |
2948 | { | 2243 | { |
2949 | idetape_init_pc(pc); | 2244 | idetape_init_pc(pc); |
2950 | pc->c[0] = IDETAPE_LOCATE_CMD; | 2245 | pc->c[0] = POSITION_TO_ELEMENT; |
2951 | pc->c[1] = 2; | 2246 | pc->c[1] = 2; |
2952 | put_unaligned(htonl(block), (unsigned int *) &pc->c[3]); | 2247 | put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[3]); |
2953 | pc->c[8] = partition; | 2248 | pc->c[8] = partition; |
2954 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 2249 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); |
2955 | pc->callback = &idetape_pc_callback; | 2250 | pc->callback = &idetape_pc_callback; |
@@ -2959,11 +2254,12 @@ static int idetape_create_prevent_cmd (ide_drive_t *drive, idetape_pc_t *pc, int | |||
2959 | { | 2254 | { |
2960 | idetape_tape_t *tape = drive->driver_data; | 2255 | idetape_tape_t *tape = drive->driver_data; |
2961 | 2256 | ||
2962 | if (!tape->capabilities.lock) | 2257 | /* device supports locking according to capabilities page */ |
2258 | if (!(tape->caps[6] & 0x01)) | ||
2963 | return 0; | 2259 | return 0; |
2964 | 2260 | ||
2965 | idetape_init_pc(pc); | 2261 | idetape_init_pc(pc); |
2966 | pc->c[0] = IDETAPE_PREVENT_CMD; | 2262 | pc->c[0] = ALLOW_MEDIUM_REMOVAL; |
2967 | pc->c[4] = prevent; | 2263 | pc->c[4] = prevent; |
2968 | pc->callback = &idetape_pc_callback; | 2264 | pc->callback = &idetape_pc_callback; |
2969 | return 1; | 2265 | return 1; |
@@ -3072,12 +2368,10 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks, struct | |||
3072 | if (tape->debug_level >= 2) | 2368 | if (tape->debug_level >= 2) |
3073 | printk(KERN_INFO "ide-tape: idetape_queue_rw_tail: cmd=%d\n",cmd); | 2369 | printk(KERN_INFO "ide-tape: idetape_queue_rw_tail: cmd=%d\n",cmd); |
3074 | #endif /* IDETAPE_DEBUG_LOG */ | 2370 | #endif /* IDETAPE_DEBUG_LOG */ |
3075 | #if IDETAPE_DEBUG_BUGS | ||
3076 | if (idetape_pipeline_active(tape)) { | 2371 | if (idetape_pipeline_active(tape)) { |
3077 | printk(KERN_ERR "ide-tape: bug: the pipeline is active in idetape_queue_rw_tail\n"); | 2372 | printk(KERN_ERR "ide-tape: bug: the pipeline is active in idetape_queue_rw_tail\n"); |
3078 | return (0); | 2373 | return (0); |
3079 | } | 2374 | } |
3080 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
3081 | 2375 | ||
3082 | idetape_init_rq(&rq, cmd); | 2376 | idetape_init_rq(&rq, cmd); |
3083 | rq.rq_disk = tape->disk; | 2377 | rq.rq_disk = tape->disk; |
@@ -3108,7 +2402,7 @@ static void idetape_insert_pipeline_into_queue (ide_drive_t *drive) | |||
3108 | return; | 2402 | return; |
3109 | if (!idetape_pipeline_active(tape)) { | 2403 | if (!idetape_pipeline_active(tape)) { |
3110 | set_bit(IDETAPE_PIPELINE_ACTIVE, &tape->flags); | 2404 | set_bit(IDETAPE_PIPELINE_ACTIVE, &tape->flags); |
3111 | idetape_active_next_stage(drive); | 2405 | idetape_activate_next_stage(drive); |
3112 | (void) ide_do_drive_cmd(drive, tape->active_data_request, ide_end); | 2406 | (void) ide_do_drive_cmd(drive, tape->active_data_request, ide_end); |
3113 | } | 2407 | } |
3114 | } | 2408 | } |
@@ -3116,7 +2410,7 @@ static void idetape_insert_pipeline_into_queue (ide_drive_t *drive) | |||
3116 | static void idetape_create_inquiry_cmd (idetape_pc_t *pc) | 2410 | static void idetape_create_inquiry_cmd (idetape_pc_t *pc) |
3117 | { | 2411 | { |
3118 | idetape_init_pc(pc); | 2412 | idetape_init_pc(pc); |
3119 | pc->c[0] = IDETAPE_INQUIRY_CMD; | 2413 | pc->c[0] = INQUIRY; |
3120 | pc->c[4] = pc->request_transfer = 254; | 2414 | pc->c[4] = pc->request_transfer = 254; |
3121 | pc->callback = &idetape_pc_callback; | 2415 | pc->callback = &idetape_pc_callback; |
3122 | } | 2416 | } |
@@ -3124,28 +2418,15 @@ static void idetape_create_inquiry_cmd (idetape_pc_t *pc) | |||
3124 | static void idetape_create_rewind_cmd (ide_drive_t *drive, idetape_pc_t *pc) | 2418 | static void idetape_create_rewind_cmd (ide_drive_t *drive, idetape_pc_t *pc) |
3125 | { | 2419 | { |
3126 | idetape_init_pc(pc); | 2420 | idetape_init_pc(pc); |
3127 | pc->c[0] = IDETAPE_REWIND_CMD; | 2421 | pc->c[0] = REZERO_UNIT; |
3128 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 2422 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); |
3129 | pc->callback = &idetape_pc_callback; | 2423 | pc->callback = &idetape_pc_callback; |
3130 | } | 2424 | } |
3131 | 2425 | ||
3132 | #if 0 | ||
3133 | static void idetape_create_mode_select_cmd (idetape_pc_t *pc, int length) | ||
3134 | { | ||
3135 | idetape_init_pc(pc); | ||
3136 | set_bit(PC_WRITING, &pc->flags); | ||
3137 | pc->c[0] = IDETAPE_MODE_SELECT_CMD; | ||
3138 | pc->c[1] = 0x10; | ||
3139 | put_unaligned(htons(length), (unsigned short *) &pc->c[3]); | ||
3140 | pc->request_transfer = 255; | ||
3141 | pc->callback = &idetape_pc_callback; | ||
3142 | } | ||
3143 | #endif | ||
3144 | |||
3145 | static void idetape_create_erase_cmd (idetape_pc_t *pc) | 2426 | static void idetape_create_erase_cmd (idetape_pc_t *pc) |
3146 | { | 2427 | { |
3147 | idetape_init_pc(pc); | 2428 | idetape_init_pc(pc); |
3148 | pc->c[0] = IDETAPE_ERASE_CMD; | 2429 | pc->c[0] = ERASE; |
3149 | pc->c[1] = 1; | 2430 | pc->c[1] = 1; |
3150 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 2431 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); |
3151 | pc->callback = &idetape_pc_callback; | 2432 | pc->callback = &idetape_pc_callback; |
@@ -3154,8 +2435,8 @@ static void idetape_create_erase_cmd (idetape_pc_t *pc) | |||
3154 | static void idetape_create_space_cmd (idetape_pc_t *pc,int count, u8 cmd) | 2435 | static void idetape_create_space_cmd (idetape_pc_t *pc,int count, u8 cmd) |
3155 | { | 2436 | { |
3156 | idetape_init_pc(pc); | 2437 | idetape_init_pc(pc); |
3157 | pc->c[0] = IDETAPE_SPACE_CMD; | 2438 | pc->c[0] = SPACE; |
3158 | put_unaligned(htonl(count), (unsigned int *) &pc->c[1]); | 2439 | put_unaligned(cpu_to_be32(count), (unsigned int *) &pc->c[1]); |
3159 | pc->c[1] = cmd; | 2440 | pc->c[1] = cmd; |
3160 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); | 2441 | set_bit(PC_WAIT_FOR_DSC, &pc->flags); |
3161 | pc->callback = &idetape_pc_callback; | 2442 | pc->callback = &idetape_pc_callback; |
@@ -3275,8 +2556,7 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive) | |||
3275 | idetape_tape_t *tape = drive->driver_data; | 2556 | idetape_tape_t *tape = drive->driver_data; |
3276 | int blocks, min; | 2557 | int blocks, min; |
3277 | struct idetape_bh *bh; | 2558 | struct idetape_bh *bh; |
3278 | 2559 | ||
3279 | #if IDETAPE_DEBUG_BUGS | ||
3280 | if (tape->chrdev_direction != idetape_direction_write) { | 2560 | if (tape->chrdev_direction != idetape_direction_write) { |
3281 | printk(KERN_ERR "ide-tape: bug: Trying to empty write pipeline, but we are not writing.\n"); | 2561 | printk(KERN_ERR "ide-tape: bug: Trying to empty write pipeline, but we are not writing.\n"); |
3282 | return; | 2562 | return; |
@@ -3285,7 +2565,6 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive) | |||
3285 | printk(KERN_ERR "ide-tape: bug: merge_buffer too big\n"); | 2565 | printk(KERN_ERR "ide-tape: bug: merge_buffer too big\n"); |
3286 | tape->merge_stage_size = tape->stage_size; | 2566 | tape->merge_stage_size = tape->stage_size; |
3287 | } | 2567 | } |
3288 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
3289 | if (tape->merge_stage_size) { | 2568 | if (tape->merge_stage_size) { |
3290 | blocks = tape->merge_stage_size / tape->tape_block_size; | 2569 | blocks = tape->merge_stage_size / tape->tape_block_size; |
3291 | if (tape->merge_stage_size % tape->tape_block_size) { | 2570 | if (tape->merge_stage_size % tape->tape_block_size) { |
@@ -3330,7 +2609,6 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive) | |||
3330 | * can be totally different on the next backup). | 2609 | * can be totally different on the next backup). |
3331 | */ | 2610 | */ |
3332 | tape->max_stages = tape->min_pipeline; | 2611 | tape->max_stages = tape->min_pipeline; |
3333 | #if IDETAPE_DEBUG_BUGS | ||
3334 | if (tape->first_stage != NULL || | 2612 | if (tape->first_stage != NULL || |
3335 | tape->next_stage != NULL || | 2613 | tape->next_stage != NULL || |
3336 | tape->last_stage != NULL || | 2614 | tape->last_stage != NULL || |
@@ -3341,7 +2619,6 @@ static void idetape_empty_write_pipeline (ide_drive_t *drive) | |||
3341 | tape->first_stage, tape->next_stage, | 2619 | tape->first_stage, tape->next_stage, |
3342 | tape->last_stage, tape->nr_stages); | 2620 | tape->last_stage, tape->nr_stages); |
3343 | } | 2621 | } |
3344 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
3345 | } | 2622 | } |
3346 | 2623 | ||
3347 | static void idetape_restart_speed_control (ide_drive_t *drive) | 2624 | static void idetape_restart_speed_control (ide_drive_t *drive) |
@@ -3364,7 +2641,7 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages) | |||
3364 | idetape_stage_t *new_stage; | 2641 | idetape_stage_t *new_stage; |
3365 | struct request rq; | 2642 | struct request rq; |
3366 | int bytes_read; | 2643 | int bytes_read; |
3367 | int blocks = tape->capabilities.ctl; | 2644 | u16 blocks = *(u16 *)&tape->caps[12]; |
3368 | 2645 | ||
3369 | /* Initialize read operation */ | 2646 | /* Initialize read operation */ |
3370 | if (tape->chrdev_direction != idetape_direction_read) { | 2647 | if (tape->chrdev_direction != idetape_direction_read) { |
@@ -3372,12 +2649,10 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages) | |||
3372 | idetape_empty_write_pipeline(drive); | 2649 | idetape_empty_write_pipeline(drive); |
3373 | idetape_flush_tape_buffers(drive); | 2650 | idetape_flush_tape_buffers(drive); |
3374 | } | 2651 | } |
3375 | #if IDETAPE_DEBUG_BUGS | ||
3376 | if (tape->merge_stage || tape->merge_stage_size) { | 2652 | if (tape->merge_stage || tape->merge_stage_size) { |
3377 | printk (KERN_ERR "ide-tape: merge_stage_size should be 0 now\n"); | 2653 | printk (KERN_ERR "ide-tape: merge_stage_size should be 0 now\n"); |
3378 | tape->merge_stage_size = 0; | 2654 | tape->merge_stage_size = 0; |
3379 | } | 2655 | } |
3380 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
3381 | if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL) | 2656 | if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL) |
3382 | return -ENOMEM; | 2657 | return -ENOMEM; |
3383 | tape->chrdev_direction = idetape_direction_read; | 2658 | tape->chrdev_direction = idetape_direction_read; |
@@ -3478,12 +2753,10 @@ static int idetape_add_chrdev_read_request (ide_drive_t *drive,int blocks) | |||
3478 | tape->pipeline_head++; | 2753 | tape->pipeline_head++; |
3479 | calculate_speeds(drive); | 2754 | calculate_speeds(drive); |
3480 | } | 2755 | } |
3481 | #if IDETAPE_DEBUG_BUGS | ||
3482 | if (bytes_read > blocks * tape->tape_block_size) { | 2756 | if (bytes_read > blocks * tape->tape_block_size) { |
3483 | printk(KERN_ERR "ide-tape: bug: trying to return more bytes than requested\n"); | 2757 | printk(KERN_ERR "ide-tape: bug: trying to return more bytes than requested\n"); |
3484 | bytes_read = blocks * tape->tape_block_size; | 2758 | bytes_read = blocks * tape->tape_block_size; |
3485 | } | 2759 | } |
3486 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
3487 | return (bytes_read); | 2760 | return (bytes_read); |
3488 | } | 2761 | } |
3489 | 2762 | ||
@@ -3567,16 +2840,21 @@ static int idetape_rewind_tape (ide_drive_t *drive) | |||
3567 | static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, unsigned long arg) | 2840 | static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, unsigned long arg) |
3568 | { | 2841 | { |
3569 | idetape_tape_t *tape = drive->driver_data; | 2842 | idetape_tape_t *tape = drive->driver_data; |
3570 | idetape_config_t config; | ||
3571 | void __user *argp = (void __user *)arg; | 2843 | void __user *argp = (void __user *)arg; |
3572 | 2844 | ||
2845 | struct idetape_config { | ||
2846 | int dsc_rw_frequency; | ||
2847 | int dsc_media_access_frequency; | ||
2848 | int nr_stages; | ||
2849 | } config; | ||
2850 | |||
3573 | #if IDETAPE_DEBUG_LOG | 2851 | #if IDETAPE_DEBUG_LOG |
3574 | if (tape->debug_level >= 4) | 2852 | if (tape->debug_level >= 4) |
3575 | printk(KERN_INFO "ide-tape: Reached idetape_blkdev_ioctl\n"); | 2853 | printk(KERN_INFO "ide-tape: Reached idetape_blkdev_ioctl\n"); |
3576 | #endif /* IDETAPE_DEBUG_LOG */ | 2854 | #endif /* IDETAPE_DEBUG_LOG */ |
3577 | switch (cmd) { | 2855 | switch (cmd) { |
3578 | case 0x0340: | 2856 | case 0x0340: |
3579 | if (copy_from_user(&config, argp, sizeof (idetape_config_t))) | 2857 | if (copy_from_user(&config, argp, sizeof(config))) |
3580 | return -EFAULT; | 2858 | return -EFAULT; |
3581 | tape->best_dsc_rw_frequency = config.dsc_rw_frequency; | 2859 | tape->best_dsc_rw_frequency = config.dsc_rw_frequency; |
3582 | tape->max_stages = config.nr_stages; | 2860 | tape->max_stages = config.nr_stages; |
@@ -3584,7 +2862,7 @@ static int idetape_blkdev_ioctl(ide_drive_t *drive, unsigned int cmd, unsigned l | |||
3584 | case 0x0350: | 2862 | case 0x0350: |
3585 | config.dsc_rw_frequency = (int) tape->best_dsc_rw_frequency; | 2863 | config.dsc_rw_frequency = (int) tape->best_dsc_rw_frequency; |
3586 | config.nr_stages = tape->max_stages; | 2864 | config.nr_stages = tape->max_stages; |
3587 | if (copy_to_user(argp, &config, sizeof (idetape_config_t))) | 2865 | if (copy_to_user(argp, &config, sizeof(config))) |
3588 | return -EFAULT; | 2866 | return -EFAULT; |
3589 | break; | 2867 | break; |
3590 | default: | 2868 | default: |
@@ -3608,11 +2886,12 @@ static int idetape_space_over_filemarks (ide_drive_t *drive,short mt_op,int mt_c | |||
3608 | idetape_pc_t pc; | 2886 | idetape_pc_t pc; |
3609 | unsigned long flags; | 2887 | unsigned long flags; |
3610 | int retval,count=0; | 2888 | int retval,count=0; |
2889 | int sprev = !!(tape->caps[4] & 0x20); | ||
3611 | 2890 | ||
3612 | if (mt_count == 0) | 2891 | if (mt_count == 0) |
3613 | return 0; | 2892 | return 0; |
3614 | if (MTBSF == mt_op || MTBSFM == mt_op) { | 2893 | if (MTBSF == mt_op || MTBSFM == mt_op) { |
3615 | if (!tape->capabilities.sprev) | 2894 | if (!sprev) |
3616 | return -EIO; | 2895 | return -EIO; |
3617 | mt_count = - mt_count; | 2896 | mt_count = - mt_count; |
3618 | } | 2897 | } |
@@ -3666,7 +2945,7 @@ static int idetape_space_over_filemarks (ide_drive_t *drive,short mt_op,int mt_c | |||
3666 | return (idetape_queue_pc_tail(drive, &pc)); | 2945 | return (idetape_queue_pc_tail(drive, &pc)); |
3667 | case MTFSFM: | 2946 | case MTFSFM: |
3668 | case MTBSFM: | 2947 | case MTBSFM: |
3669 | if (!tape->capabilities.sprev) | 2948 | if (!sprev) |
3670 | return (-EIO); | 2949 | return (-EIO); |
3671 | retval = idetape_space_over_filemarks(drive, MTFSF, mt_count-count); | 2950 | retval = idetape_space_over_filemarks(drive, MTFSF, mt_count-count); |
3672 | if (retval) return (retval); | 2951 | if (retval) return (retval); |
@@ -3703,6 +2982,7 @@ static ssize_t idetape_chrdev_read (struct file *file, char __user *buf, | |||
3703 | ide_drive_t *drive = tape->drive; | 2982 | ide_drive_t *drive = tape->drive; |
3704 | ssize_t bytes_read,temp, actually_read = 0, rc; | 2983 | ssize_t bytes_read,temp, actually_read = 0, rc; |
3705 | ssize_t ret = 0; | 2984 | ssize_t ret = 0; |
2985 | u16 ctl = *(u16 *)&tape->caps[12]; | ||
3706 | 2986 | ||
3707 | #if IDETAPE_DEBUG_LOG | 2987 | #if IDETAPE_DEBUG_LOG |
3708 | if (tape->debug_level >= 3) | 2988 | if (tape->debug_level >= 3) |
@@ -3728,7 +3008,7 @@ static ssize_t idetape_chrdev_read (struct file *file, char __user *buf, | |||
3728 | count -= actually_read; | 3008 | count -= actually_read; |
3729 | } | 3009 | } |
3730 | while (count >= tape->stage_size) { | 3010 | while (count >= tape->stage_size) { |
3731 | bytes_read = idetape_add_chrdev_read_request(drive, tape->capabilities.ctl); | 3011 | bytes_read = idetape_add_chrdev_read_request(drive, ctl); |
3732 | if (bytes_read <= 0) | 3012 | if (bytes_read <= 0) |
3733 | goto finish; | 3013 | goto finish; |
3734 | if (idetape_copy_stage_to_user(tape, buf, tape->merge_stage, bytes_read)) | 3014 | if (idetape_copy_stage_to_user(tape, buf, tape->merge_stage, bytes_read)) |
@@ -3738,7 +3018,7 @@ static ssize_t idetape_chrdev_read (struct file *file, char __user *buf, | |||
3738 | actually_read += bytes_read; | 3018 | actually_read += bytes_read; |
3739 | } | 3019 | } |
3740 | if (count) { | 3020 | if (count) { |
3741 | bytes_read = idetape_add_chrdev_read_request(drive, tape->capabilities.ctl); | 3021 | bytes_read = idetape_add_chrdev_read_request(drive, ctl); |
3742 | if (bytes_read <= 0) | 3022 | if (bytes_read <= 0) |
3743 | goto finish; | 3023 | goto finish; |
3744 | temp = min((unsigned long)count, (unsigned long)bytes_read); | 3024 | temp = min((unsigned long)count, (unsigned long)bytes_read); |
@@ -3767,6 +3047,7 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf, | |||
3767 | ide_drive_t *drive = tape->drive; | 3047 | ide_drive_t *drive = tape->drive; |
3768 | ssize_t actually_written = 0; | 3048 | ssize_t actually_written = 0; |
3769 | ssize_t ret = 0; | 3049 | ssize_t ret = 0; |
3050 | u16 ctl = *(u16 *)&tape->caps[12]; | ||
3770 | 3051 | ||
3771 | /* The drive is write protected. */ | 3052 | /* The drive is write protected. */ |
3772 | if (tape->write_prot) | 3053 | if (tape->write_prot) |
@@ -3782,13 +3063,11 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf, | |||
3782 | if (tape->chrdev_direction != idetape_direction_write) { | 3063 | if (tape->chrdev_direction != idetape_direction_write) { |
3783 | if (tape->chrdev_direction == idetape_direction_read) | 3064 | if (tape->chrdev_direction == idetape_direction_read) |
3784 | idetape_discard_read_pipeline(drive, 1); | 3065 | idetape_discard_read_pipeline(drive, 1); |
3785 | #if IDETAPE_DEBUG_BUGS | ||
3786 | if (tape->merge_stage || tape->merge_stage_size) { | 3066 | if (tape->merge_stage || tape->merge_stage_size) { |
3787 | printk(KERN_ERR "ide-tape: merge_stage_size " | 3067 | printk(KERN_ERR "ide-tape: merge_stage_size " |
3788 | "should be 0 now\n"); | 3068 | "should be 0 now\n"); |
3789 | tape->merge_stage_size = 0; | 3069 | tape->merge_stage_size = 0; |
3790 | } | 3070 | } |
3791 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
3792 | if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL) | 3071 | if ((tape->merge_stage = __idetape_kmalloc_stage(tape, 0, 0)) == NULL) |
3793 | return -ENOMEM; | 3072 | return -ENOMEM; |
3794 | tape->chrdev_direction = idetape_direction_write; | 3073 | tape->chrdev_direction = idetape_direction_write; |
@@ -3816,12 +3095,10 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf, | |||
3816 | if (tape->restart_speed_control_req) | 3095 | if (tape->restart_speed_control_req) |
3817 | idetape_restart_speed_control(drive); | 3096 | idetape_restart_speed_control(drive); |
3818 | if (tape->merge_stage_size) { | 3097 | if (tape->merge_stage_size) { |
3819 | #if IDETAPE_DEBUG_BUGS | ||
3820 | if (tape->merge_stage_size >= tape->stage_size) { | 3098 | if (tape->merge_stage_size >= tape->stage_size) { |
3821 | printk(KERN_ERR "ide-tape: bug: merge buffer too big\n"); | 3099 | printk(KERN_ERR "ide-tape: bug: merge buffer too big\n"); |
3822 | tape->merge_stage_size = 0; | 3100 | tape->merge_stage_size = 0; |
3823 | } | 3101 | } |
3824 | #endif /* IDETAPE_DEBUG_BUGS */ | ||
3825 | actually_written = min((unsigned int)(tape->stage_size - tape->merge_stage_size), (unsigned int)count); | 3102 | actually_written = min((unsigned int)(tape->stage_size - tape->merge_stage_size), (unsigned int)count); |
3826 | if (idetape_copy_stage_from_user(tape, tape->merge_stage, buf, actually_written)) | 3103 | if (idetape_copy_stage_from_user(tape, tape->merge_stage, buf, actually_written)) |
3827 | ret = -EFAULT; | 3104 | ret = -EFAULT; |
@@ -3832,7 +3109,7 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf, | |||
3832 | if (tape->merge_stage_size == tape->stage_size) { | 3109 | if (tape->merge_stage_size == tape->stage_size) { |
3833 | ssize_t retval; | 3110 | ssize_t retval; |
3834 | tape->merge_stage_size = 0; | 3111 | tape->merge_stage_size = 0; |
3835 | retval = idetape_add_chrdev_write_request(drive, tape->capabilities.ctl); | 3112 | retval = idetape_add_chrdev_write_request(drive, ctl); |
3836 | if (retval <= 0) | 3113 | if (retval <= 0) |
3837 | return (retval); | 3114 | return (retval); |
3838 | } | 3115 | } |
@@ -3843,7 +3120,7 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf, | |||
3843 | ret = -EFAULT; | 3120 | ret = -EFAULT; |
3844 | buf += tape->stage_size; | 3121 | buf += tape->stage_size; |
3845 | count -= tape->stage_size; | 3122 | count -= tape->stage_size; |
3846 | retval = idetape_add_chrdev_write_request(drive, tape->capabilities.ctl); | 3123 | retval = idetape_add_chrdev_write_request(drive, ctl); |
3847 | actually_written += tape->stage_size; | 3124 | actually_written += tape->stage_size; |
3848 | if (retval <= 0) | 3125 | if (retval <= 0) |
3849 | return (retval); | 3126 | return (retval); |
@@ -3871,69 +3148,20 @@ static int idetape_write_filemark (ide_drive_t *drive) | |||
3871 | } | 3148 | } |
3872 | 3149 | ||
3873 | /* | 3150 | /* |
3874 | * idetape_mtioctop is called from idetape_chrdev_ioctl when | 3151 | * Called from idetape_chrdev_ioctl when the general mtio MTIOCTOP ioctl is |
3875 | * the general mtio MTIOCTOP ioctl is requested. | 3152 | * requested. |
3876 | * | ||
3877 | * We currently support the following mtio.h operations: | ||
3878 | * | 3153 | * |
3879 | * MTFSF - Space over mt_count filemarks in the positive direction. | 3154 | * Note: MTBSF and MTBSFM are not supported when the tape doesn't support |
3880 | * The tape is positioned after the last spaced filemark. | 3155 | * spacing over filemarks in the reverse direction. In this case, MTFSFM is also |
3156 | * usually not supported (it is supported in the rare case in which we crossed | ||
3157 | * the filemark during our read-ahead pipelined operation mode). | ||
3881 | * | 3158 | * |
3882 | * MTFSFM - Same as MTFSF, but the tape is positioned before the | 3159 | * The following commands are currently not supported: |
3883 | * last filemark. | ||
3884 | * | 3160 | * |
3885 | * MTBSF - Steps background over mt_count filemarks, tape is | 3161 | * MTFSS, MTBSS, MTWSM, MTSETDENSITY, MTSETDRVBUFFER, MT_ST_BOOLEANS, |
3886 | * positioned before the last filemark. | 3162 | * MT_ST_WRITE_THRESHOLD. |
3887 | * | ||
3888 | * MTBSFM - Like MTBSF, only tape is positioned after the last filemark. | ||
3889 | * | ||
3890 | * Note: | ||
3891 | * | ||
3892 | * MTBSF and MTBSFM are not supported when the tape doesn't | ||
3893 | * support spacing over filemarks in the reverse direction. | ||
3894 | * In this case, MTFSFM is also usually not supported (it is | ||
3895 | * supported in the rare case in which we crossed the filemark | ||
3896 | * during our read-ahead pipelined operation mode). | ||
3897 | * | ||
3898 | * MTWEOF - Writes mt_count filemarks. Tape is positioned after | ||
3899 | * the last written filemark. | ||
3900 | * | ||
3901 | * MTREW - Rewinds tape. | ||
3902 | * | ||
3903 | * MTLOAD - Loads the tape. | ||
3904 | * | ||
3905 | * MTOFFL - Puts the tape drive "Offline": Rewinds the tape and | ||
3906 | * MTUNLOAD prevents further access until the media is replaced. | ||
3907 | * | ||
3908 | * MTNOP - Flushes tape buffers. | ||
3909 | * | ||
3910 | * MTRETEN - Retension media. This typically consists of one end | ||
3911 | * to end pass on the media. | ||
3912 | * | ||
3913 | * MTEOM - Moves to the end of recorded data. | ||
3914 | * | ||
3915 | * MTERASE - Erases tape. | ||
3916 | * | ||
3917 | * MTSETBLK - Sets the user block size to mt_count bytes. If | ||
3918 | * mt_count is 0, we will attempt to autodetect | ||
3919 | * the block size. | ||
3920 | * | ||
3921 | * MTSEEK - Positions the tape in a specific block number, where | ||
3922 | * each block is assumed to contain which user_block_size | ||
3923 | * bytes. | ||
3924 | * | ||
3925 | * MTSETPART - Switches to another tape partition. | ||
3926 | * | ||
3927 | * MTLOCK - Locks the tape door. | ||
3928 | * | ||
3929 | * MTUNLOCK - Unlocks the tape door. | ||
3930 | * | ||
3931 | * The following commands are currently not supported: | ||
3932 | * | ||
3933 | * MTFSS, MTBSS, MTWSM, MTSETDENSITY, | ||
3934 | * MTSETDRVBUFFER, MT_ST_BOOLEANS, MT_ST_WRITE_THRESHOLD. | ||
3935 | */ | 3163 | */ |
3936 | static int idetape_mtioctop (ide_drive_t *drive,short mt_op,int mt_count) | 3164 | static int idetape_mtioctop(ide_drive_t *drive, short mt_op, int mt_count) |
3937 | { | 3165 | { |
3938 | idetape_tape_t *tape = drive->driver_data; | 3166 | idetape_tape_t *tape = drive->driver_data; |
3939 | idetape_pc_t pc; | 3167 | idetape_pc_t pc; |
@@ -4048,29 +3276,12 @@ static int idetape_mtioctop (ide_drive_t *drive,short mt_op,int mt_count) | |||
4048 | } | 3276 | } |
4049 | 3277 | ||
4050 | /* | 3278 | /* |
4051 | * Our character device ioctls. | 3279 | * Our character device ioctls. General mtio.h magnetic io commands are |
4052 | * | 3280 | * supported here, and not in the corresponding block interface. Our own |
4053 | * General mtio.h magnetic io commands are supported here, and not in | 3281 | * ide-tape ioctls are supported on both interfaces. |
4054 | * the corresponding block interface. | ||
4055 | * | ||
4056 | * The following ioctls are supported: | ||
4057 | * | ||
4058 | * MTIOCTOP - Refer to idetape_mtioctop for detailed description. | ||
4059 | * | ||
4060 | * MTIOCGET - The mt_dsreg field in the returned mtget structure | ||
4061 | * will be set to (user block size in bytes << | ||
4062 | * MT_ST_BLKSIZE_SHIFT) & MT_ST_BLKSIZE_MASK. | ||
4063 | * | ||
4064 | * The mt_blkno is set to the current user block number. | ||
4065 | * The other mtget fields are not supported. | ||
4066 | * | ||
4067 | * MTIOCPOS - The current tape "block position" is returned. We | ||
4068 | * assume that each block contains user_block_size | ||
4069 | * bytes. | ||
4070 | * | ||
4071 | * Our own ide-tape ioctls are supported on both interfaces. | ||
4072 | */ | 3282 | */ |
4073 | static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | 3283 | static int idetape_chrdev_ioctl(struct inode *inode, struct file *file, |
3284 | unsigned int cmd, unsigned long arg) | ||
4074 | { | 3285 | { |
4075 | struct ide_tape_obj *tape = ide_tape_f(file); | 3286 | struct ide_tape_obj *tape = ide_tape_f(file); |
4076 | ide_drive_t *drive = tape->drive; | 3287 | ide_drive_t *drive = tape->drive; |
@@ -4124,7 +3335,30 @@ static int idetape_chrdev_ioctl (struct inode *inode, struct file *file, unsigne | |||
4124 | } | 3335 | } |
4125 | } | 3336 | } |
4126 | 3337 | ||
4127 | static void idetape_get_blocksize_from_block_descriptor(ide_drive_t *drive); | 3338 | /* |
3339 | * Do a mode sense page 0 with block descriptor and if it succeeds set the tape | ||
3340 | * block size with the reported value. | ||
3341 | */ | ||
3342 | static void ide_tape_get_bsize_from_bdesc(ide_drive_t *drive) | ||
3343 | { | ||
3344 | idetape_tape_t *tape = drive->driver_data; | ||
3345 | idetape_pc_t pc; | ||
3346 | |||
3347 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); | ||
3348 | if (idetape_queue_pc_tail(drive, &pc)) { | ||
3349 | printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); | ||
3350 | if (tape->tape_block_size == 0) { | ||
3351 | printk(KERN_WARNING "ide-tape: Cannot deal with zero " | ||
3352 | "block size, assuming 32k\n"); | ||
3353 | tape->tape_block_size = 32768; | ||
3354 | } | ||
3355 | return; | ||
3356 | } | ||
3357 | tape->tape_block_size = (pc.buffer[4 + 5] << 16) + | ||
3358 | (pc.buffer[4 + 6] << 8) + | ||
3359 | pc.buffer[4 + 7]; | ||
3360 | tape->drv_write_prot = (pc.buffer[2] & 0x80) >> 7; | ||
3361 | } | ||
4128 | 3362 | ||
4129 | /* | 3363 | /* |
4130 | * Our character device open function. | 3364 | * Our character device open function. |
@@ -4178,7 +3412,7 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp) | |||
4178 | clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags); | 3412 | clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags); |
4179 | 3413 | ||
4180 | /* Read block size and write protect status from drive. */ | 3414 | /* Read block size and write protect status from drive. */ |
4181 | idetape_get_blocksize_from_block_descriptor(drive); | 3415 | ide_tape_get_bsize_from_bdesc(drive); |
4182 | 3416 | ||
4183 | /* Set write protect flag if device is opened as read-only. */ | 3417 | /* Set write protect flag if device is opened as read-only. */ |
4184 | if ((filp->f_flags & O_ACCMODE) == O_RDONLY) | 3418 | if ((filp->f_flags & O_ACCMODE) == O_RDONLY) |
@@ -4296,190 +3530,100 @@ static int idetape_identify_device (ide_drive_t *drive) | |||
4296 | 3530 | ||
4297 | *((unsigned short *) &gcw) = id->config; | 3531 | *((unsigned short *) &gcw) = id->config; |
4298 | 3532 | ||
4299 | #if IDETAPE_DEBUG_INFO | ||
4300 | printk(KERN_INFO "ide-tape: Dumping ATAPI Identify Device tape parameters\n"); | ||
4301 | printk(KERN_INFO "ide-tape: Protocol Type: "); | ||
4302 | switch (gcw.protocol) { | ||
4303 | case 0: case 1: printk("ATA\n");break; | ||
4304 | case 2: printk("ATAPI\n");break; | ||
4305 | case 3: printk("Reserved (Unknown to ide-tape)\n");break; | ||
4306 | } | ||
4307 | printk(KERN_INFO "ide-tape: Device Type: %x - ",gcw.device_type); | ||
4308 | switch (gcw.device_type) { | ||
4309 | case 0: printk("Direct-access Device\n");break; | ||
4310 | case 1: printk("Streaming Tape Device\n");break; | ||
4311 | case 2: case 3: case 4: printk("Reserved\n");break; | ||
4312 | case 5: printk("CD-ROM Device\n");break; | ||
4313 | case 6: printk("Reserved\n"); | ||
4314 | case 7: printk("Optical memory Device\n");break; | ||
4315 | case 0x1f: printk("Unknown or no Device type\n");break; | ||
4316 | default: printk("Reserved\n"); | ||
4317 | } | ||
4318 | printk(KERN_INFO "ide-tape: Removable: %s",gcw.removable ? "Yes\n":"No\n"); | ||
4319 | printk(KERN_INFO "ide-tape: Command Packet DRQ Type: "); | ||
4320 | switch (gcw.drq_type) { | ||
4321 | case 0: printk("Microprocessor DRQ\n");break; | ||
4322 | case 1: printk("Interrupt DRQ\n");break; | ||
4323 | case 2: printk("Accelerated DRQ\n");break; | ||
4324 | case 3: printk("Reserved\n");break; | ||
4325 | } | ||
4326 | printk(KERN_INFO "ide-tape: Command Packet Size: "); | ||
4327 | switch (gcw.packet_size) { | ||
4328 | case 0: printk("12 bytes\n");break; | ||
4329 | case 1: printk("16 bytes\n");break; | ||
4330 | default: printk("Reserved\n");break; | ||
4331 | } | ||
4332 | #endif /* IDETAPE_DEBUG_INFO */ | ||
4333 | |||
4334 | /* Check that we can support this device */ | 3533 | /* Check that we can support this device */ |
4335 | 3534 | ||
4336 | if (gcw.protocol !=2 ) | 3535 | if (gcw.protocol != 2) |
4337 | printk(KERN_ERR "ide-tape: Protocol is not ATAPI\n"); | 3536 | printk(KERN_ERR "ide-tape: Protocol (0x%02x) is not ATAPI\n", |
3537 | gcw.protocol); | ||
4338 | else if (gcw.device_type != 1) | 3538 | else if (gcw.device_type != 1) |
4339 | printk(KERN_ERR "ide-tape: Device type is not set to tape\n"); | 3539 | printk(KERN_ERR "ide-tape: Device type (0x%02x) is not set " |
3540 | "to tape\n", gcw.device_type); | ||
4340 | else if (!gcw.removable) | 3541 | else if (!gcw.removable) |
4341 | printk(KERN_ERR "ide-tape: The removable flag is not set\n"); | 3542 | printk(KERN_ERR "ide-tape: The removable flag is not set\n"); |
4342 | else if (gcw.packet_size != 0) { | 3543 | else if (gcw.packet_size != 0) { |
4343 | printk(KERN_ERR "ide-tape: Packet size is not 12 bytes long\n"); | 3544 | printk(KERN_ERR "ide-tape: Packet size (0x%02x) is not 12 " |
4344 | if (gcw.packet_size == 1) | 3545 | "bytes long\n", gcw.packet_size); |
4345 | printk(KERN_ERR "ide-tape: Sorry, padding to 16 bytes is still not supported\n"); | ||
4346 | } else | 3546 | } else |
4347 | return 1; | 3547 | return 1; |
4348 | return 0; | 3548 | return 0; |
4349 | } | 3549 | } |
4350 | 3550 | ||
4351 | /* | 3551 | static void idetape_get_inquiry_results(ide_drive_t *drive) |
4352 | * Use INQUIRY to get the firmware revision | ||
4353 | */ | ||
4354 | static void idetape_get_inquiry_results (ide_drive_t *drive) | ||
4355 | { | 3552 | { |
4356 | char *r; | 3553 | char *r; |
4357 | idetape_tape_t *tape = drive->driver_data; | 3554 | idetape_tape_t *tape = drive->driver_data; |
4358 | idetape_pc_t pc; | 3555 | idetape_pc_t pc; |
4359 | idetape_inquiry_result_t *inquiry; | 3556 | |
4360 | |||
4361 | idetape_create_inquiry_cmd(&pc); | 3557 | idetape_create_inquiry_cmd(&pc); |
4362 | if (idetape_queue_pc_tail(drive, &pc)) { | 3558 | if (idetape_queue_pc_tail(drive, &pc)) { |
4363 | printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", tape->name); | 3559 | printk(KERN_ERR "ide-tape: %s: can't get INQUIRY results\n", |
3560 | tape->name); | ||
4364 | return; | 3561 | return; |
4365 | } | 3562 | } |
4366 | inquiry = (idetape_inquiry_result_t *) pc.buffer; | 3563 | memcpy(tape->vendor_id, &pc.buffer[8], 8); |
4367 | memcpy(tape->vendor_id, inquiry->vendor_id, 8); | 3564 | memcpy(tape->product_id, &pc.buffer[16], 16); |
4368 | memcpy(tape->product_id, inquiry->product_id, 16); | 3565 | memcpy(tape->firmware_revision, &pc.buffer[32], 4); |
4369 | memcpy(tape->firmware_revision, inquiry->revision_level, 4); | 3566 | |
4370 | ide_fixstring(tape->vendor_id, 10, 0); | 3567 | ide_fixstring(tape->vendor_id, 10, 0); |
4371 | ide_fixstring(tape->product_id, 18, 0); | 3568 | ide_fixstring(tape->product_id, 18, 0); |
4372 | ide_fixstring(tape->firmware_revision, 6, 0); | 3569 | ide_fixstring(tape->firmware_revision, 6, 0); |
4373 | r = tape->firmware_revision; | 3570 | r = tape->firmware_revision; |
4374 | if (*(r + 1) == '.') | 3571 | if (*(r + 1) == '.') |
4375 | tape->firmware_revision_num = (*r - '0') * 100 + (*(r + 2) - '0') * 10 + *(r + 3) - '0'; | 3572 | tape->firmware_revision_num = (*r - '0') * 100 + |
4376 | printk(KERN_INFO "ide-tape: %s <-> %s: %s %s rev %s\n", drive->name, tape->name, tape->vendor_id, tape->product_id, tape->firmware_revision); | 3573 | (*(r + 2) - '0') * 10 + *(r + 3) - '0'; |
3574 | printk(KERN_INFO "ide-tape: %s <-> %s: %s %s rev %s\n", | ||
3575 | drive->name, tape->name, tape->vendor_id, | ||
3576 | tape->product_id, tape->firmware_revision); | ||
4377 | } | 3577 | } |
4378 | 3578 | ||
4379 | /* | 3579 | /* |
4380 | * idetape_get_mode_sense_results asks the tape about its various | 3580 | * Ask the tape about its various parameters. In particular, we will adjust our |
4381 | * parameters. In particular, we will adjust our data transfer buffer | 3581 | * data transfer buffer size to the recommended value as returned by the tape. |
4382 | * size to the recommended value as returned by the tape. | ||
4383 | */ | 3582 | */ |
4384 | static void idetape_get_mode_sense_results (ide_drive_t *drive) | 3583 | static void idetape_get_mode_sense_results (ide_drive_t *drive) |
4385 | { | 3584 | { |
4386 | idetape_tape_t *tape = drive->driver_data; | 3585 | idetape_tape_t *tape = drive->driver_data; |
4387 | idetape_pc_t pc; | 3586 | idetape_pc_t pc; |
4388 | idetape_mode_parameter_header_t *header; | 3587 | u8 *caps; |
4389 | idetape_capabilities_page_t *capabilities; | 3588 | u8 speed, max_speed; |
4390 | 3589 | ||
4391 | idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); | 3590 | idetape_create_mode_sense_cmd(&pc, IDETAPE_CAPABILITIES_PAGE); |
4392 | if (idetape_queue_pc_tail(drive, &pc)) { | 3591 | if (idetape_queue_pc_tail(drive, &pc)) { |
4393 | printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming some default values\n"); | 3592 | printk(KERN_ERR "ide-tape: Can't get tape parameters - assuming" |
3593 | " some default values\n"); | ||
4394 | tape->tape_block_size = 512; | 3594 | tape->tape_block_size = 512; |
4395 | tape->capabilities.ctl = 52; | 3595 | put_unaligned(52, (u16 *)&tape->caps[12]); |
4396 | tape->capabilities.speed = 450; | 3596 | put_unaligned(540, (u16 *)&tape->caps[14]); |
4397 | tape->capabilities.buffer_size = 6 * 52; | 3597 | put_unaligned(6*52, (u16 *)&tape->caps[16]); |
4398 | return; | 3598 | return; |
4399 | } | 3599 | } |
4400 | header = (idetape_mode_parameter_header_t *) pc.buffer; | 3600 | caps = pc.buffer + 4 + pc.buffer[3]; |
4401 | capabilities = (idetape_capabilities_page_t *) (pc.buffer + sizeof(idetape_mode_parameter_header_t) + header->bdl); | ||
4402 | 3601 | ||
4403 | capabilities->max_speed = ntohs(capabilities->max_speed); | 3602 | /* convert to host order and save for later use */ |
4404 | capabilities->ctl = ntohs(capabilities->ctl); | 3603 | speed = be16_to_cpu(*(u16 *)&caps[14]); |
4405 | capabilities->speed = ntohs(capabilities->speed); | 3604 | max_speed = be16_to_cpu(*(u16 *)&caps[8]); |
4406 | capabilities->buffer_size = ntohs(capabilities->buffer_size); | ||
4407 | 3605 | ||
4408 | if (!capabilities->speed) { | 3606 | put_unaligned(max_speed, (u16 *)&caps[8]); |
4409 | printk(KERN_INFO "ide-tape: %s: overriding capabilities->speed (assuming 650KB/sec)\n", drive->name); | 3607 | put_unaligned(be16_to_cpu(*(u16 *)&caps[12]), (u16 *)&caps[12]); |
4410 | capabilities->speed = 650; | 3608 | put_unaligned(speed, (u16 *)&caps[14]); |
3609 | put_unaligned(be16_to_cpu(*(u16 *)&caps[16]), (u16 *)&caps[16]); | ||
3610 | |||
3611 | if (!speed) { | ||
3612 | printk(KERN_INFO "ide-tape: %s: invalid tape speed " | ||
3613 | "(assuming 650KB/sec)\n", drive->name); | ||
3614 | put_unaligned(650, (u16 *)&caps[14]); | ||
4411 | } | 3615 | } |
4412 | if (!capabilities->max_speed) { | 3616 | if (!max_speed) { |
4413 | printk(KERN_INFO "ide-tape: %s: overriding capabilities->max_speed (assuming 650KB/sec)\n", drive->name); | 3617 | printk(KERN_INFO "ide-tape: %s: invalid max_speed " |
4414 | capabilities->max_speed = 650; | 3618 | "(assuming 650KB/sec)\n", drive->name); |
3619 | put_unaligned(650, (u16 *)&caps[8]); | ||
4415 | } | 3620 | } |
4416 | 3621 | ||
4417 | tape->capabilities = *capabilities; /* Save us a copy */ | 3622 | memcpy(&tape->caps, caps, 20); |
4418 | if (capabilities->blk512) | 3623 | if (caps[7] & 0x02) |
4419 | tape->tape_block_size = 512; | 3624 | tape->tape_block_size = 512; |
4420 | else if (capabilities->blk1024) | 3625 | else if (caps[7] & 0x04) |
4421 | tape->tape_block_size = 1024; | 3626 | tape->tape_block_size = 1024; |
4422 | |||
4423 | #if IDETAPE_DEBUG_INFO | ||
4424 | printk(KERN_INFO "ide-tape: Dumping the results of the MODE SENSE packet command\n"); | ||
4425 | printk(KERN_INFO "ide-tape: Mode Parameter Header:\n"); | ||
4426 | printk(KERN_INFO "ide-tape: Mode Data Length - %d\n",header->mode_data_length); | ||
4427 | printk(KERN_INFO "ide-tape: Medium Type - %d\n",header->medium_type); | ||
4428 | printk(KERN_INFO "ide-tape: Device Specific Parameter - %d\n",header->dsp); | ||
4429 | printk(KERN_INFO "ide-tape: Block Descriptor Length - %d\n",header->bdl); | ||
4430 | |||
4431 | printk(KERN_INFO "ide-tape: Capabilities and Mechanical Status Page:\n"); | ||
4432 | printk(KERN_INFO "ide-tape: Page code - %d\n",capabilities->page_code); | ||
4433 | printk(KERN_INFO "ide-tape: Page length - %d\n",capabilities->page_length); | ||
4434 | printk(KERN_INFO "ide-tape: Read only - %s\n",capabilities->ro ? "Yes":"No"); | ||
4435 | printk(KERN_INFO "ide-tape: Supports reverse space - %s\n",capabilities->sprev ? "Yes":"No"); | ||
4436 | printk(KERN_INFO "ide-tape: Supports erase initiated formatting - %s\n",capabilities->efmt ? "Yes":"No"); | ||
4437 | printk(KERN_INFO "ide-tape: Supports QFA two Partition format - %s\n",capabilities->qfa ? "Yes":"No"); | ||
4438 | printk(KERN_INFO "ide-tape: Supports locking the medium - %s\n",capabilities->lock ? "Yes":"No"); | ||
4439 | printk(KERN_INFO "ide-tape: The volume is currently locked - %s\n",capabilities->locked ? "Yes":"No"); | ||
4440 | printk(KERN_INFO "ide-tape: The device defaults in the prevent state - %s\n",capabilities->prevent ? "Yes":"No"); | ||
4441 | printk(KERN_INFO "ide-tape: Supports ejecting the medium - %s\n",capabilities->eject ? "Yes":"No"); | ||
4442 | printk(KERN_INFO "ide-tape: Supports error correction - %s\n",capabilities->ecc ? "Yes":"No"); | ||
4443 | printk(KERN_INFO "ide-tape: Supports data compression - %s\n",capabilities->cmprs ? "Yes":"No"); | ||
4444 | printk(KERN_INFO "ide-tape: Supports 512 bytes block size - %s\n",capabilities->blk512 ? "Yes":"No"); | ||
4445 | printk(KERN_INFO "ide-tape: Supports 1024 bytes block size - %s\n",capabilities->blk1024 ? "Yes":"No"); | ||
4446 | printk(KERN_INFO "ide-tape: Supports 32768 bytes block size / Restricted byte count for PIO transfers - %s\n",capabilities->blk32768 ? "Yes":"No"); | ||
4447 | printk(KERN_INFO "ide-tape: Maximum supported speed in KBps - %d\n",capabilities->max_speed); | ||
4448 | printk(KERN_INFO "ide-tape: Continuous transfer limits in blocks - %d\n",capabilities->ctl); | ||
4449 | printk(KERN_INFO "ide-tape: Current speed in KBps - %d\n",capabilities->speed); | ||
4450 | printk(KERN_INFO "ide-tape: Buffer size - %d\n",capabilities->buffer_size*512); | ||
4451 | #endif /* IDETAPE_DEBUG_INFO */ | ||
4452 | } | ||
4453 | |||
4454 | /* | ||
4455 | * ide_get_blocksize_from_block_descriptor does a mode sense page 0 with block descriptor | ||
4456 | * and if it succeeds sets the tape block size with the reported value | ||
4457 | */ | ||
4458 | static void idetape_get_blocksize_from_block_descriptor(ide_drive_t *drive) | ||
4459 | { | ||
4460 | |||
4461 | idetape_tape_t *tape = drive->driver_data; | ||
4462 | idetape_pc_t pc; | ||
4463 | idetape_mode_parameter_header_t *header; | ||
4464 | idetape_parameter_block_descriptor_t *block_descrp; | ||
4465 | |||
4466 | idetape_create_mode_sense_cmd(&pc, IDETAPE_BLOCK_DESCRIPTOR); | ||
4467 | if (idetape_queue_pc_tail(drive, &pc)) { | ||
4468 | printk(KERN_ERR "ide-tape: Can't get block descriptor\n"); | ||
4469 | if (tape->tape_block_size == 0) { | ||
4470 | printk(KERN_WARNING "ide-tape: Cannot deal with zero block size, assume 32k\n"); | ||
4471 | tape->tape_block_size = 32768; | ||
4472 | } | ||
4473 | return; | ||
4474 | } | ||
4475 | header = (idetape_mode_parameter_header_t *) pc.buffer; | ||
4476 | block_descrp = (idetape_parameter_block_descriptor_t *) (pc.buffer + sizeof(idetape_mode_parameter_header_t)); | ||
4477 | tape->tape_block_size =( block_descrp->length[0]<<16) + (block_descrp->length[1]<<8) + block_descrp->length[2]; | ||
4478 | tape->drv_write_prot = (header->dsp & 0x80) >> 7; | ||
4479 | |||
4480 | #if IDETAPE_DEBUG_INFO | ||
4481 | printk(KERN_INFO "ide-tape: Adjusted block size - %d\n", tape->tape_block_size); | ||
4482 | #endif /* IDETAPE_DEBUG_INFO */ | ||
4483 | } | 3627 | } |
4484 | 3628 | ||
4485 | #ifdef CONFIG_IDE_PROC_FS | 3629 | #ifdef CONFIG_IDE_PROC_FS |
@@ -4490,13 +3634,15 @@ static void idetape_add_settings (ide_drive_t *drive) | |||
4490 | /* | 3634 | /* |
4491 | * drive setting name read/write data type min max mul_factor div_factor data pointer set function | 3635 | * drive setting name read/write data type min max mul_factor div_factor data pointer set function |
4492 | */ | 3636 | */ |
4493 | ide_add_setting(drive, "buffer", SETTING_READ, TYPE_SHORT, 0, 0xffff, 1, 2, &tape->capabilities.buffer_size, NULL); | 3637 | ide_add_setting(drive, "buffer", SETTING_READ, TYPE_SHORT, 0, 0xffff, |
3638 | 1, 2, (u16 *)&tape->caps[16], NULL); | ||
4494 | ide_add_setting(drive, "pipeline_min", SETTING_RW, TYPE_INT, 1, 0xffff, tape->stage_size / 1024, 1, &tape->min_pipeline, NULL); | 3639 | ide_add_setting(drive, "pipeline_min", SETTING_RW, TYPE_INT, 1, 0xffff, tape->stage_size / 1024, 1, &tape->min_pipeline, NULL); |
4495 | ide_add_setting(drive, "pipeline", SETTING_RW, TYPE_INT, 1, 0xffff, tape->stage_size / 1024, 1, &tape->max_stages, NULL); | 3640 | ide_add_setting(drive, "pipeline", SETTING_RW, TYPE_INT, 1, 0xffff, tape->stage_size / 1024, 1, &tape->max_stages, NULL); |
4496 | ide_add_setting(drive, "pipeline_max", SETTING_RW, TYPE_INT, 1, 0xffff, tape->stage_size / 1024, 1, &tape->max_pipeline, NULL); | 3641 | ide_add_setting(drive, "pipeline_max", SETTING_RW, TYPE_INT, 1, 0xffff, tape->stage_size / 1024, 1, &tape->max_pipeline, NULL); |
4497 | ide_add_setting(drive, "pipeline_used", SETTING_READ, TYPE_INT, 0, 0xffff, tape->stage_size / 1024, 1, &tape->nr_stages, NULL); | 3642 | ide_add_setting(drive, "pipeline_used", SETTING_READ, TYPE_INT, 0, 0xffff, tape->stage_size / 1024, 1, &tape->nr_stages, NULL); |
4498 | ide_add_setting(drive, "pipeline_pending", SETTING_READ, TYPE_INT, 0, 0xffff, tape->stage_size / 1024, 1, &tape->nr_pending_stages, NULL); | 3643 | ide_add_setting(drive, "pipeline_pending", SETTING_READ, TYPE_INT, 0, 0xffff, tape->stage_size / 1024, 1, &tape->nr_pending_stages, NULL); |
4499 | ide_add_setting(drive, "speed", SETTING_READ, TYPE_SHORT, 0, 0xffff, 1, 1, &tape->capabilities.speed, NULL); | 3644 | ide_add_setting(drive, "speed", SETTING_READ, TYPE_SHORT, 0, 0xffff, |
3645 | 1, 1, (u16 *)&tape->caps[14], NULL); | ||
4500 | ide_add_setting(drive, "stage", SETTING_READ, TYPE_INT, 0, 0xffff, 1, 1024, &tape->stage_size, NULL); | 3646 | ide_add_setting(drive, "stage", SETTING_READ, TYPE_INT, 0, 0xffff, 1, 1024, &tape->stage_size, NULL); |
4501 | ide_add_setting(drive, "tdsc", SETTING_RW, TYPE_INT, IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX, 1000, HZ, &tape->best_dsc_rw_frequency, NULL); | 3647 | ide_add_setting(drive, "tdsc", SETTING_RW, TYPE_INT, IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX, 1000, HZ, &tape->best_dsc_rw_frequency, NULL); |
4502 | ide_add_setting(drive, "dsc_overlap", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->dsc_overlap, NULL); | 3648 | ide_add_setting(drive, "dsc_overlap", SETTING_RW, TYPE_BYTE, 0, 1, 1, 1, &drive->dsc_overlap, NULL); |
@@ -4528,6 +3674,7 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
4528 | struct idetape_id_gcw gcw; | 3674 | struct idetape_id_gcw gcw; |
4529 | int stage_size; | 3675 | int stage_size; |
4530 | struct sysinfo si; | 3676 | struct sysinfo si; |
3677 | u16 *ctl = (u16 *)&tape->caps[12]; | ||
4531 | 3678 | ||
4532 | spin_lock_init(&tape->spinlock); | 3679 | spin_lock_init(&tape->spinlock); |
4533 | drive->dsc_overlap = 1; | 3680 | drive->dsc_overlap = 1; |
@@ -4555,13 +3702,13 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
4555 | 3702 | ||
4556 | idetape_get_inquiry_results(drive); | 3703 | idetape_get_inquiry_results(drive); |
4557 | idetape_get_mode_sense_results(drive); | 3704 | idetape_get_mode_sense_results(drive); |
4558 | idetape_get_blocksize_from_block_descriptor(drive); | 3705 | ide_tape_get_bsize_from_bdesc(drive); |
4559 | tape->user_bs_factor = 1; | 3706 | tape->user_bs_factor = 1; |
4560 | tape->stage_size = tape->capabilities.ctl * tape->tape_block_size; | 3707 | tape->stage_size = *ctl * tape->tape_block_size; |
4561 | while (tape->stage_size > 0xffff) { | 3708 | while (tape->stage_size > 0xffff) { |
4562 | printk(KERN_NOTICE "ide-tape: decreasing stage size\n"); | 3709 | printk(KERN_NOTICE "ide-tape: decreasing stage size\n"); |
4563 | tape->capabilities.ctl /= 2; | 3710 | *ctl /= 2; |
4564 | tape->stage_size = tape->capabilities.ctl * tape->tape_block_size; | 3711 | tape->stage_size = *ctl * tape->tape_block_size; |
4565 | } | 3712 | } |
4566 | stage_size = tape->stage_size; | 3713 | stage_size = tape->stage_size; |
4567 | tape->pages_per_stage = stage_size / PAGE_SIZE; | 3714 | tape->pages_per_stage = stage_size / PAGE_SIZE; |
@@ -4570,11 +3717,8 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
4570 | tape->excess_bh_size = PAGE_SIZE - stage_size % PAGE_SIZE; | 3717 | tape->excess_bh_size = PAGE_SIZE - stage_size % PAGE_SIZE; |
4571 | } | 3718 | } |
4572 | 3719 | ||
4573 | /* | 3720 | /* Select the "best" DSC read/write polling freq and pipeline size. */ |
4574 | * Select the "best" DSC read/write polling frequency | 3721 | speed = max(*(u16 *)&tape->caps[14], *(u16 *)&tape->caps[8]); |
4575 | * and pipeline size. | ||
4576 | */ | ||
4577 | speed = max(tape->capabilities.speed, tape->capabilities.max_speed); | ||
4578 | 3722 | ||
4579 | tape->max_stages = speed * 1000 * 10 / tape->stage_size; | 3723 | tape->max_stages = speed * 1000 * 10 / tape->stage_size; |
4580 | 3724 | ||
@@ -4591,7 +3735,7 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
4591 | tape->max_stages = tape->min_pipeline = tape->max_pipeline = 1; | 3735 | tape->max_stages = tape->min_pipeline = tape->max_pipeline = 1; |
4592 | 3736 | ||
4593 | t1 = (tape->stage_size * HZ) / (speed * 1000); | 3737 | t1 = (tape->stage_size * HZ) / (speed * 1000); |
4594 | tmid = (tape->capabilities.buffer_size * 32 * HZ) / (speed * 125); | 3738 | tmid = (*(u16 *)&tape->caps[16] * 32 * HZ) / (speed * 125); |
4595 | tn = (IDETAPE_FIFO_THRESHOLD * tape->stage_size * HZ) / (speed * 1000); | 3739 | tn = (IDETAPE_FIFO_THRESHOLD * tape->stage_size * HZ) / (speed * 1000); |
4596 | 3740 | ||
4597 | if (tape->max_stages) | 3741 | if (tape->max_stages) |
@@ -4606,8 +3750,8 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
4606 | tape->best_dsc_rw_frequency = max_t(unsigned long, min_t(unsigned long, t, IDETAPE_DSC_RW_MAX), IDETAPE_DSC_RW_MIN); | 3750 | tape->best_dsc_rw_frequency = max_t(unsigned long, min_t(unsigned long, t, IDETAPE_DSC_RW_MAX), IDETAPE_DSC_RW_MIN); |
4607 | printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, " | 3751 | printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, " |
4608 | "%dkB pipeline, %lums tDSC%s\n", | 3752 | "%dkB pipeline, %lums tDSC%s\n", |
4609 | drive->name, tape->name, tape->capabilities.speed, | 3753 | drive->name, tape->name, *(u16 *)&tape->caps[14], |
4610 | (tape->capabilities.buffer_size * 512) / tape->stage_size, | 3754 | (*(u16 *)&tape->caps[16] * 512) / tape->stage_size, |
4611 | tape->stage_size / 1024, | 3755 | tape->stage_size / 1024, |
4612 | tape->max_stages * tape->stage_size / 1024, | 3756 | tape->max_stages * tape->stage_size / 1024, |
4613 | tape->best_dsc_rw_frequency * 1000 / HZ, | 3757 | tape->best_dsc_rw_frequency * 1000 / HZ, |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 16a9a581d089..4e1da1c78cb5 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -755,6 +755,7 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
755 | u8 args[4], xfer_rate = 0; | 755 | u8 args[4], xfer_rate = 0; |
756 | ide_task_t tfargs; | 756 | ide_task_t tfargs; |
757 | struct ide_taskfile *tf = &tfargs.tf; | 757 | struct ide_taskfile *tf = &tfargs.tf; |
758 | struct hd_driveid *id = drive->id; | ||
758 | 759 | ||
759 | if (NULL == (void *) arg) { | 760 | if (NULL == (void *) arg) { |
760 | struct request rq; | 761 | struct request rq; |
@@ -792,10 +793,16 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
792 | return -ENOMEM; | 793 | return -ENOMEM; |
793 | } | 794 | } |
794 | 795 | ||
795 | if (set_transfer(drive, &tfargs)) { | 796 | if (tf->command == WIN_SETFEATURES && |
797 | tf->feature == SETFEATURES_XFER && | ||
798 | tf->nsect >= XFER_SW_DMA_0 && | ||
799 | (id->dma_ultra || id->dma_mword || id->dma_1word)) { | ||
796 | xfer_rate = args[1]; | 800 | xfer_rate = args[1]; |
797 | if (ide_ata66_check(drive, &tfargs)) | 801 | if (tf->nsect > XFER_UDMA_2 && !eighty_ninty_three(drive)) { |
802 | printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " | ||
803 | "be set\n", drive->name); | ||
798 | goto abort; | 804 | goto abort; |
805 | } | ||
799 | } | 806 | } |
800 | 807 | ||
801 | err = ide_raw_taskfile(drive, &tfargs, buf, args[3]); | 808 | err = ide_raw_taskfile(drive, &tfargs, buf, args[3]); |
diff --git a/drivers/ide/ide-timing.h b/drivers/ide/ide-timing.h index adeda7626529..3b12ffe77071 100644 --- a/drivers/ide/ide-timing.h +++ b/drivers/ide/ide-timing.h | |||
@@ -199,7 +199,7 @@ static int ide_timing_compute(ide_drive_t *drive, short speed, struct ide_timing | |||
199 | } | 199 | } |
200 | 200 | ||
201 | /* | 201 | /* |
202 | * Lenghten active & recovery time so that cycle time is correct. | 202 | * Lengthen active & recovery time so that cycle time is correct. |
203 | */ | 203 | */ |
204 | 204 | ||
205 | if (t->act8b + t->rec8b < t->cyc8b) { | 205 | if (t->act8b + t->rec8b < t->cyc8b) { |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index ab9ca2b5b66c..ac6136001615 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -499,6 +499,8 @@ void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | |||
499 | /** | 499 | /** |
500 | * ide_unregister - free an IDE interface | 500 | * ide_unregister - free an IDE interface |
501 | * @index: index of interface (will change soon to a pointer) | 501 | * @index: index of interface (will change soon to a pointer) |
502 | * @init_default: init default hwif flag | ||
503 | * @restore: restore hwif flag | ||
502 | * | 504 | * |
503 | * Perform the final unregister of an IDE interface. At the moment | 505 | * Perform the final unregister of an IDE interface. At the moment |
504 | * we don't refcount interfaces so this will also get split up. | 506 | * we don't refcount interfaces so this will also get split up. |
@@ -518,7 +520,7 @@ void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | |||
518 | * This is raving bonkers. | 520 | * This is raving bonkers. |
519 | */ | 521 | */ |
520 | 522 | ||
521 | void ide_unregister(unsigned int index) | 523 | void ide_unregister(unsigned int index, int init_default, int restore) |
522 | { | 524 | { |
523 | ide_drive_t *drive; | 525 | ide_drive_t *drive; |
524 | ide_hwif_t *hwif, *g; | 526 | ide_hwif_t *hwif, *g; |
@@ -602,9 +604,12 @@ void ide_unregister(unsigned int index) | |||
602 | 604 | ||
603 | /* restore hwif data to pristine status */ | 605 | /* restore hwif data to pristine status */ |
604 | ide_init_port_data(hwif, index); | 606 | ide_init_port_data(hwif, index); |
605 | init_hwif_default(hwif, index); | ||
606 | 607 | ||
607 | ide_hwif_restore(hwif, &tmp_hwif); | 608 | if (init_default) |
609 | init_hwif_default(hwif, index); | ||
610 | |||
611 | if (restore) | ||
612 | ide_hwif_restore(hwif, &tmp_hwif); | ||
608 | 613 | ||
609 | abort: | 614 | abort: |
610 | spin_unlock_irq(&ide_lock); | 615 | spin_unlock_irq(&ide_lock); |
@@ -678,6 +683,31 @@ void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw) | |||
678 | } | 683 | } |
679 | EXPORT_SYMBOL_GPL(ide_init_port_hw); | 684 | EXPORT_SYMBOL_GPL(ide_init_port_hw); |
680 | 685 | ||
686 | ide_hwif_t *ide_deprecated_find_port(unsigned long base) | ||
687 | { | ||
688 | ide_hwif_t *hwif; | ||
689 | int i; | ||
690 | |||
691 | for (i = 0; i < MAX_HWIFS; i++) { | ||
692 | hwif = &ide_hwifs[i]; | ||
693 | if (hwif->io_ports[IDE_DATA_OFFSET] == base) | ||
694 | goto found; | ||
695 | } | ||
696 | |||
697 | for (i = 0; i < MAX_HWIFS; i++) { | ||
698 | hwif = &ide_hwifs[i]; | ||
699 | if (hwif->hold) | ||
700 | continue; | ||
701 | if (!hwif->present && hwif->mate == NULL) | ||
702 | goto found; | ||
703 | } | ||
704 | |||
705 | hwif = NULL; | ||
706 | found: | ||
707 | return hwif; | ||
708 | } | ||
709 | EXPORT_SYMBOL_GPL(ide_deprecated_find_port); | ||
710 | |||
681 | /** | 711 | /** |
682 | * ide_register_hw - register IDE interface | 712 | * ide_register_hw - register IDE interface |
683 | * @hw: hardware registers | 713 | * @hw: hardware registers |
@@ -697,38 +727,26 @@ int ide_register_hw(hw_regs_t *hw, void (*quirkproc)(ide_drive_t *), | |||
697 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 727 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
698 | 728 | ||
699 | do { | 729 | do { |
700 | for (index = 0; index < MAX_HWIFS; ++index) { | 730 | hwif = ide_deprecated_find_port(hw->io_ports[IDE_DATA_OFFSET]); |
701 | hwif = &ide_hwifs[index]; | 731 | index = hwif->index; |
702 | if (hwif->io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET]) | 732 | if (hwif) |
703 | goto found; | 733 | goto found; |
704 | } | ||
705 | for (index = 0; index < MAX_HWIFS; ++index) { | ||
706 | hwif = &ide_hwifs[index]; | ||
707 | if (hwif->hold) | ||
708 | continue; | ||
709 | if (!hwif->present && hwif->mate == NULL) | ||
710 | goto found; | ||
711 | } | ||
712 | for (index = 0; index < MAX_HWIFS; index++) | 734 | for (index = 0; index < MAX_HWIFS; index++) |
713 | ide_unregister(index); | 735 | ide_unregister(index, 1, 1); |
714 | } while (retry--); | 736 | } while (retry--); |
715 | return -1; | 737 | return -1; |
716 | found: | 738 | found: |
717 | if (hwif->present) | 739 | if (hwif->present) |
718 | ide_unregister(index); | 740 | ide_unregister(index, 0, 1); |
719 | else if (!hwif->hold) { | 741 | else if (!hwif->hold) |
720 | ide_init_port_data(hwif, index); | 742 | ide_init_port_data(hwif, index); |
721 | init_hwif_default(hwif, index); | ||
722 | } | ||
723 | if (hwif->present) | ||
724 | return -1; | ||
725 | 743 | ||
726 | ide_init_port_hw(hwif, hw); | 744 | ide_init_port_hw(hwif, hw); |
727 | hwif->quirkproc = quirkproc; | 745 | hwif->quirkproc = quirkproc; |
728 | 746 | ||
729 | idx[0] = index; | 747 | idx[0] = index; |
730 | 748 | ||
731 | ide_device_add(idx); | 749 | ide_device_add(idx, NULL); |
732 | 750 | ||
733 | if (hwifp) | 751 | if (hwifp) |
734 | *hwifp = hwif; | 752 | *hwifp = hwif; |
@@ -791,10 +809,6 @@ int set_io_32bit(ide_drive_t *drive, int arg) | |||
791 | return -EBUSY; | 809 | return -EBUSY; |
792 | 810 | ||
793 | drive->io_32bit = arg; | 811 | drive->io_32bit = arg; |
794 | #ifdef CONFIG_BLK_DEV_DTC2278 | ||
795 | if (HWIF(drive)->chipset == ide_dtc2278) | ||
796 | HWIF(drive)->drives[!drive->select.b.unit].io_32bit = arg; | ||
797 | #endif /* CONFIG_BLK_DEV_DTC2278 */ | ||
798 | 812 | ||
799 | spin_unlock_irq(&ide_lock); | 813 | spin_unlock_irq(&ide_lock); |
800 | 814 | ||
@@ -1021,11 +1035,8 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device | |||
1021 | case HDIO_GET_NICE: | 1035 | case HDIO_GET_NICE: |
1022 | return put_user(drive->dsc_overlap << IDE_NICE_DSC_OVERLAP | | 1036 | return put_user(drive->dsc_overlap << IDE_NICE_DSC_OVERLAP | |
1023 | drive->atapi_overlap << IDE_NICE_ATAPI_OVERLAP | | 1037 | drive->atapi_overlap << IDE_NICE_ATAPI_OVERLAP | |
1024 | drive->nice0 << IDE_NICE_0 | | 1038 | drive->nice1 << IDE_NICE_1, |
1025 | drive->nice1 << IDE_NICE_1 | | ||
1026 | drive->nice2 << IDE_NICE_2, | ||
1027 | (long __user *) arg); | 1039 | (long __user *) arg); |
1028 | |||
1029 | #ifdef CONFIG_IDE_TASK_IOCTL | 1040 | #ifdef CONFIG_IDE_TASK_IOCTL |
1030 | case HDIO_DRIVE_TASKFILE: | 1041 | case HDIO_DRIVE_TASKFILE: |
1031 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) | 1042 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) |
@@ -1066,7 +1077,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device | |||
1066 | case HDIO_UNREGISTER_HWIF: | 1077 | case HDIO_UNREGISTER_HWIF: |
1067 | if (!capable(CAP_SYS_RAWIO)) return -EACCES; | 1078 | if (!capable(CAP_SYS_RAWIO)) return -EACCES; |
1068 | /* (arg > MAX_HWIFS) checked in function */ | 1079 | /* (arg > MAX_HWIFS) checked in function */ |
1069 | ide_unregister(arg); | 1080 | ide_unregister(arg, 1, 1); |
1070 | return 0; | 1081 | return 0; |
1071 | case HDIO_SET_NICE: | 1082 | case HDIO_SET_NICE: |
1072 | if (!capable(CAP_SYS_ADMIN)) return -EACCES; | 1083 | if (!capable(CAP_SYS_ADMIN)) return -EACCES; |
@@ -1711,7 +1722,7 @@ void __exit cleanup_module (void) | |||
1711 | int index; | 1722 | int index; |
1712 | 1723 | ||
1713 | for (index = 0; index < MAX_HWIFS; ++index) | 1724 | for (index = 0; index < MAX_HWIFS; ++index) |
1714 | ide_unregister(index); | 1725 | ide_unregister(index, 0, 0); |
1715 | 1726 | ||
1716 | proc_ide_destroy(); | 1727 | proc_ide_destroy(); |
1717 | 1728 | ||
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index e3ea2096804a..d4d1a6bea599 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c | |||
@@ -191,9 +191,14 @@ static int __init initRegisters (void) { | |||
191 | return t; | 191 | return t; |
192 | } | 192 | } |
193 | 193 | ||
194 | static const struct ide_port_info ali14xx_port_info = { | ||
195 | .chipset = ide_ali14xx, | ||
196 | .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE, | ||
197 | .pio_mask = ATA_PIO4, | ||
198 | }; | ||
199 | |||
194 | static int __init ali14xx_probe(void) | 200 | static int __init ali14xx_probe(void) |
195 | { | 201 | { |
196 | ide_hwif_t *hwif, *mate; | ||
197 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | 202 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; |
198 | 203 | ||
199 | printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", | 204 | printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", |
@@ -205,21 +210,10 @@ static int __init ali14xx_probe(void) | |||
205 | return 1; | 210 | return 1; |
206 | } | 211 | } |
207 | 212 | ||
208 | hwif = &ide_hwifs[0]; | 213 | ide_hwifs[0].set_pio_mode = &ali14xx_set_pio_mode; |
209 | mate = &ide_hwifs[1]; | 214 | ide_hwifs[1].set_pio_mode = &ali14xx_set_pio_mode; |
210 | |||
211 | hwif->chipset = ide_ali14xx; | ||
212 | hwif->pio_mask = ATA_PIO4; | ||
213 | hwif->set_pio_mode = &ali14xx_set_pio_mode; | ||
214 | hwif->mate = mate; | ||
215 | |||
216 | mate->chipset = ide_ali14xx; | ||
217 | mate->pio_mask = ATA_PIO4; | ||
218 | mate->set_pio_mode = &ali14xx_set_pio_mode; | ||
219 | mate->mate = hwif; | ||
220 | mate->channel = 1; | ||
221 | 215 | ||
222 | ide_device_add(idx); | 216 | ide_device_add(idx, &ali14xx_port_info); |
223 | 217 | ||
224 | return 0; | 218 | return 0; |
225 | } | 219 | } |
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c index dd3d198ade47..8bdb79da17e8 100644 --- a/drivers/ide/legacy/buddha.c +++ b/drivers/ide/legacy/buddha.c | |||
@@ -232,7 +232,7 @@ fail_base2: | |||
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | ide_device_add(idx); | 235 | ide_device_add(idx, NULL); |
236 | } | 236 | } |
237 | 237 | ||
238 | return 0; | 238 | return 0; |
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index 611c9705a3ae..73396f70f2b7 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c | |||
@@ -84,14 +84,20 @@ static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
84 | /* Actually we do - there is a data sheet available for the | 84 | /* Actually we do - there is a data sheet available for the |
85 | Winbond but does anyone actually care */ | 85 | Winbond but does anyone actually care */ |
86 | } | 86 | } |
87 | |||
88 | /* | ||
89 | * 32bit I/O has to be enabled for *both* drives at the same time. | ||
90 | */ | ||
91 | drive->io_32bit = 1; | ||
92 | HWIF(drive)->drives[!drive->select.b.unit].io_32bit = 1; | ||
93 | } | 87 | } |
94 | 88 | ||
89 | static const struct ide_port_info dtc2278_port_info __initdata = { | ||
90 | .chipset = ide_dtc2278, | ||
91 | .host_flags = IDE_HFLAG_SERIALIZE | | ||
92 | IDE_HFLAG_NO_UNMASK_IRQS | | ||
93 | IDE_HFLAG_IO_32BIT | | ||
94 | /* disallow ->io_32bit changes */ | ||
95 | IDE_HFLAG_NO_IO_32BIT | | ||
96 | IDE_HFLAG_NO_DMA | | ||
97 | IDE_HFLAG_NO_AUTOTUNE, | ||
98 | .pio_mask = ATA_PIO4, | ||
99 | }; | ||
100 | |||
95 | static int __init dtc2278_probe(void) | 101 | static int __init dtc2278_probe(void) |
96 | { | 102 | { |
97 | unsigned long flags; | 103 | unsigned long flags; |
@@ -122,23 +128,9 @@ static int __init dtc2278_probe(void) | |||
122 | #endif | 128 | #endif |
123 | local_irq_restore(flags); | 129 | local_irq_restore(flags); |
124 | 130 | ||
125 | hwif->serialized = 1; | ||
126 | hwif->chipset = ide_dtc2278; | ||
127 | hwif->pio_mask = ATA_PIO4; | ||
128 | hwif->set_pio_mode = &dtc2278_set_pio_mode; | 131 | hwif->set_pio_mode = &dtc2278_set_pio_mode; |
129 | hwif->drives[0].no_unmask = 1; | 132 | |
130 | hwif->drives[1].no_unmask = 1; | 133 | ide_device_add(idx, &dtc2278_port_info); |
131 | hwif->mate = mate; | ||
132 | |||
133 | mate->serialized = 1; | ||
134 | mate->chipset = ide_dtc2278; | ||
135 | mate->pio_mask = ATA_PIO4; | ||
136 | mate->drives[0].no_unmask = 1; | ||
137 | mate->drives[1].no_unmask = 1; | ||
138 | mate->mate = hwif; | ||
139 | mate->channel = 1; | ||
140 | |||
141 | ide_device_add(idx); | ||
142 | 134 | ||
143 | return 0; | 135 | return 0; |
144 | } | 136 | } |
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c index c9bd6bfb1f3b..85b69a82825f 100644 --- a/drivers/ide/legacy/falconide.c +++ b/drivers/ide/legacy/falconide.c | |||
@@ -83,7 +83,7 @@ static int __init falconide_init(void) | |||
83 | ide_init_port_data(hwif, index); | 83 | ide_init_port_data(hwif, index); |
84 | ide_init_port_hw(hwif, &hw); | 84 | ide_init_port_hw(hwif, &hw); |
85 | 85 | ||
86 | ide_device_add(idx); | 86 | ide_device_add(idx, NULL); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c index f67c51a2c84a..fc29ce75aff1 100644 --- a/drivers/ide/legacy/gayle.c +++ b/drivers/ide/legacy/gayle.c | |||
@@ -186,7 +186,7 @@ found: | |||
186 | release_mem_region(res_start, res_n); | 186 | release_mem_region(res_start, res_n); |
187 | } | 187 | } |
188 | 188 | ||
189 | ide_device_add(idx); | 189 | ide_device_add(idx, NULL); |
190 | 190 | ||
191 | return 0; | 191 | return 0; |
192 | } | 192 | } |
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 57bc15cddca0..02d12c74764a 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c | |||
@@ -300,16 +300,36 @@ static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
300 | #endif | 300 | #endif |
301 | } | 301 | } |
302 | 302 | ||
303 | static void __init ht6560b_port_init_devs(ide_hwif_t *hwif) | ||
304 | { | ||
305 | /* Setting default configurations for drives. */ | ||
306 | int t = (HT_CONFIG_DEFAULT << 8) | HT_TIMING_DEFAULT; | ||
307 | |||
308 | if (hwif->channel) | ||
309 | t |= (HT_SECONDARY_IF << 8); | ||
310 | |||
311 | hwif->drives[0].drive_data = t; | ||
312 | hwif->drives[1].drive_data = t; | ||
313 | } | ||
314 | |||
303 | int probe_ht6560b = 0; | 315 | int probe_ht6560b = 0; |
304 | 316 | ||
305 | module_param_named(probe, probe_ht6560b, bool, 0); | 317 | module_param_named(probe, probe_ht6560b, bool, 0); |
306 | MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); | 318 | MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); |
307 | 319 | ||
320 | static const struct ide_port_info ht6560b_port_info __initdata = { | ||
321 | .chipset = ide_ht6560b, | ||
322 | .host_flags = IDE_HFLAG_SERIALIZE | /* is this needed? */ | ||
323 | IDE_HFLAG_NO_DMA | | ||
324 | IDE_HFLAG_NO_AUTOTUNE | | ||
325 | IDE_HFLAG_ABUSE_PREFETCH, | ||
326 | .pio_mask = ATA_PIO5, | ||
327 | }; | ||
328 | |||
308 | static int __init ht6560b_init(void) | 329 | static int __init ht6560b_init(void) |
309 | { | 330 | { |
310 | ide_hwif_t *hwif, *mate; | 331 | ide_hwif_t *hwif, *mate; |
311 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | 332 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; |
312 | int t; | ||
313 | 333 | ||
314 | if (probe_ht6560b == 0) | 334 | if (probe_ht6560b == 0) |
315 | return -ENODEV; | 335 | return -ENODEV; |
@@ -328,36 +348,16 @@ static int __init ht6560b_init(void) | |||
328 | goto release_region; | 348 | goto release_region; |
329 | } | 349 | } |
330 | 350 | ||
331 | hwif->chipset = ide_ht6560b; | ||
332 | hwif->selectproc = &ht6560b_selectproc; | 351 | hwif->selectproc = &ht6560b_selectproc; |
333 | hwif->host_flags = IDE_HFLAG_ABUSE_PREFETCH; | ||
334 | hwif->pio_mask = ATA_PIO5; | ||
335 | hwif->set_pio_mode = &ht6560b_set_pio_mode; | 352 | hwif->set_pio_mode = &ht6560b_set_pio_mode; |
336 | hwif->serialized = 1; /* is this needed? */ | ||
337 | hwif->mate = mate; | ||
338 | 353 | ||
339 | mate->chipset = ide_ht6560b; | ||
340 | mate->selectproc = &ht6560b_selectproc; | 354 | mate->selectproc = &ht6560b_selectproc; |
341 | mate->host_flags = IDE_HFLAG_ABUSE_PREFETCH; | ||
342 | mate->pio_mask = ATA_PIO5; | ||
343 | mate->set_pio_mode = &ht6560b_set_pio_mode; | 355 | mate->set_pio_mode = &ht6560b_set_pio_mode; |
344 | mate->serialized = 1; /* is this needed? */ | ||
345 | mate->mate = hwif; | ||
346 | mate->channel = 1; | ||
347 | |||
348 | /* | ||
349 | * Setting default configurations for drives | ||
350 | */ | ||
351 | t = (HT_CONFIG_DEFAULT << 8); | ||
352 | t |= HT_TIMING_DEFAULT; | ||
353 | hwif->drives[0].drive_data = t; | ||
354 | hwif->drives[1].drive_data = t; | ||
355 | 356 | ||
356 | t |= (HT_SECONDARY_IF << 8); | 357 | hwif->port_init_devs = ht6560b_port_init_devs; |
357 | mate->drives[0].drive_data = t; | 358 | mate->port_init_devs = ht6560b_port_init_devs; |
358 | mate->drives[1].drive_data = t; | ||
359 | 359 | ||
360 | ide_device_add(idx); | 360 | ide_device_add(idx, &ht6560b_port_info); |
361 | 361 | ||
362 | return 0; | 362 | return 0; |
363 | 363 | ||
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 3bd29676ef6a..15ccf6944ae2 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -145,13 +145,36 @@ static void ide_detach(struct pcmcia_device *link) | |||
145 | 145 | ||
146 | static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle) | 146 | static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle) |
147 | { | 147 | { |
148 | ide_hwif_t *hwif; | ||
148 | hw_regs_t hw; | 149 | hw_regs_t hw; |
150 | int i; | ||
151 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
152 | |||
149 | memset(&hw, 0, sizeof(hw)); | 153 | memset(&hw, 0, sizeof(hw)); |
150 | ide_init_hwif_ports(&hw, io, ctl, NULL); | 154 | ide_std_init_ports(&hw, io, ctl); |
151 | hw.irq = irq; | 155 | hw.irq = irq; |
152 | hw.chipset = ide_pci; | 156 | hw.chipset = ide_pci; |
153 | hw.dev = &handle->dev; | 157 | hw.dev = &handle->dev; |
154 | return ide_register_hw(&hw, &ide_undecoded_slave, NULL); | 158 | |
159 | hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]); | ||
160 | if (hwif == NULL) | ||
161 | return -1; | ||
162 | |||
163 | i = hwif->index; | ||
164 | |||
165 | if (hwif->present) | ||
166 | ide_unregister(i, 0, 0); | ||
167 | else if (!hwif->hold) | ||
168 | ide_init_port_data(hwif, i); | ||
169 | |||
170 | ide_init_port_hw(hwif, &hw); | ||
171 | hwif->quirkproc = &ide_undecoded_slave; | ||
172 | |||
173 | idx[0] = i; | ||
174 | |||
175 | ide_device_add(idx, NULL); | ||
176 | |||
177 | return hwif->present ? i : -1; | ||
155 | } | 178 | } |
156 | 179 | ||
157 | /*====================================================================== | 180 | /*====================================================================== |
@@ -337,7 +360,7 @@ void ide_release(struct pcmcia_device *link) | |||
337 | if (info->ndev) { | 360 | if (info->ndev) { |
338 | /* FIXME: if this fails we need to queue the cleanup somehow | 361 | /* FIXME: if this fails we need to queue the cleanup somehow |
339 | -- need to investigate the required PCMCIA magic */ | 362 | -- need to investigate the required PCMCIA magic */ |
340 | ide_unregister(info->hd); | 363 | ide_unregister(info->hd, 0, 0); |
341 | } | 364 | } |
342 | info->ndev = 0; | 365 | info->ndev = 0; |
343 | 366 | ||
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 7c3231a21d17..26c82ce602de 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
@@ -108,7 +108,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
108 | 108 | ||
109 | idx[0] = hwif->index; | 109 | idx[0] = hwif->index; |
110 | 110 | ||
111 | ide_device_add(idx); | 111 | ide_device_add(idx, NULL); |
112 | 112 | ||
113 | platform_set_drvdata(pdev, hwif); | 113 | platform_set_drvdata(pdev, hwif); |
114 | 114 | ||
@@ -122,7 +122,7 @@ static int __devexit plat_ide_remove(struct platform_device *pdev) | |||
122 | { | 122 | { |
123 | ide_hwif_t *hwif = pdev->dev.driver_data; | 123 | ide_hwif_t *hwif = pdev->dev.driver_data; |
124 | 124 | ||
125 | ide_unregister(hwif->index); | 125 | ide_unregister(hwif->index, 0, 0); |
126 | 126 | ||
127 | return 0; | 127 | return 0; |
128 | } | 128 | } |
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index c54d07ff64fe..06df8df857a3 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c | |||
@@ -123,19 +123,9 @@ static int __init macide_init(void) | |||
123 | ide_init_port_data(hwif, index); | 123 | ide_init_port_data(hwif, index); |
124 | ide_init_port_hw(hwif, &hw); | 124 | ide_init_port_hw(hwif, &hw); |
125 | 125 | ||
126 | if (macintosh_config->ide_type == MAC_IDE_BABOON && | ||
127 | macintosh_config->ident == MAC_MODEL_PB190) { | ||
128 | /* Fix breakage in ide-disk.c: drive capacity */ | ||
129 | /* is not initialized for drives without a */ | ||
130 | /* hardware ID, and we can't get that without */ | ||
131 | /* probing the drive which freezes a 190. */ | ||
132 | ide_drive_t *drive = &hwif->drives[0]; | ||
133 | drive->capacity64 = drive->cyl*drive->head*drive->sect; | ||
134 | } | ||
135 | |||
136 | hwif->mmio = 1; | 126 | hwif->mmio = 1; |
137 | 127 | ||
138 | ide_device_add(idx); | 128 | ide_device_add(idx, NULL); |
139 | } | 129 | } |
140 | 130 | ||
141 | return 0; | 131 | return 0; |
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index a9c6b0609c54..2f0b34d892a1 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c | |||
@@ -154,7 +154,7 @@ static int __init q40ide_init(void) | |||
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | ide_device_add(idx); | 157 | ide_device_add(idx, NULL); |
158 | 158 | ||
159 | return 0; | 159 | return 0; |
160 | } | 160 | } |
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 37534bb483a7..bba29df5f21d 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -305,18 +305,33 @@ static int __init qd_testreg(int port) | |||
305 | * called to setup an ata channel : adjusts attributes & links for tuning | 305 | * called to setup an ata channel : adjusts attributes & links for tuning |
306 | */ | 306 | */ |
307 | 307 | ||
308 | static void __init qd_setup(ide_hwif_t *hwif, int base, int config, | 308 | static void __init qd_setup(ide_hwif_t *hwif, int base, int config) |
309 | unsigned int data0, unsigned int data1) | ||
310 | { | 309 | { |
311 | hwif->chipset = ide_qd65xx; | ||
312 | hwif->channel = hwif->index; | ||
313 | hwif->select_data = base; | 310 | hwif->select_data = base; |
314 | hwif->config_data = config; | 311 | hwif->config_data = config; |
315 | hwif->drives[0].drive_data = data0; | 312 | } |
316 | hwif->drives[1].drive_data = data1; | 313 | |
317 | hwif->drives[0].io_32bit = | 314 | static void __init qd6500_port_init_devs(ide_hwif_t *hwif) |
318 | hwif->drives[1].io_32bit = 1; | 315 | { |
319 | hwif->pio_mask = ATA_PIO4; | 316 | u8 base = hwif->select_data, config = QD_CONFIG(hwif); |
317 | |||
318 | hwif->drives[0].drive_data = QD6500_DEF_DATA; | ||
319 | hwif->drives[1].drive_data = QD6500_DEF_DATA; | ||
320 | } | ||
321 | |||
322 | static void __init qd6580_port_init_devs(ide_hwif_t *hwif) | ||
323 | { | ||
324 | u16 t1, t2; | ||
325 | u8 base = hwif->select_data, config = QD_CONFIG(hwif); | ||
326 | |||
327 | if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { | ||
328 | t1 = QD6580_DEF_DATA; | ||
329 | t2 = QD6580_DEF_DATA2; | ||
330 | } else | ||
331 | t2 = t1 = hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA; | ||
332 | |||
333 | hwif->drives[0].drive_data = t1; | ||
334 | hwif->drives[1].drive_data = t2; | ||
320 | } | 335 | } |
321 | 336 | ||
322 | /* | 337 | /* |
@@ -356,6 +371,14 @@ static void __exit qd_unsetup(ide_hwif_t *hwif) | |||
356 | } | 371 | } |
357 | */ | 372 | */ |
358 | 373 | ||
374 | static const struct ide_port_info qd65xx_port_info __initdata = { | ||
375 | .chipset = ide_qd65xx, | ||
376 | .host_flags = IDE_HFLAG_IO_32BIT | | ||
377 | IDE_HFLAG_NO_DMA | | ||
378 | IDE_HFLAG_NO_AUTOTUNE, | ||
379 | .pio_mask = ATA_PIO4, | ||
380 | }; | ||
381 | |||
359 | /* | 382 | /* |
360 | * qd_probe: | 383 | * qd_probe: |
361 | * | 384 | * |
@@ -393,13 +416,14 @@ static int __init qd_probe(int base) | |||
393 | return 1; | 416 | return 1; |
394 | } | 417 | } |
395 | 418 | ||
396 | qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA); | 419 | qd_setup(hwif, base, config); |
397 | 420 | ||
421 | hwif->port_init_devs = qd6500_port_init_devs; | ||
398 | hwif->set_pio_mode = &qd6500_set_pio_mode; | 422 | hwif->set_pio_mode = &qd6500_set_pio_mode; |
399 | 423 | ||
400 | idx[0] = unit; | 424 | idx[unit] = unit; |
401 | 425 | ||
402 | ide_device_add(idx); | 426 | ide_device_add(idx, &qd65xx_port_info); |
403 | 427 | ||
404 | return 1; | 428 | return 1; |
405 | } | 429 | } |
@@ -426,14 +450,15 @@ static int __init qd_probe(int base) | |||
426 | hwif = &ide_hwifs[unit]; | 450 | hwif = &ide_hwifs[unit]; |
427 | printk(KERN_INFO "%s: qd6580: single IDE board\n", | 451 | printk(KERN_INFO "%s: qd6580: single IDE board\n", |
428 | hwif->name); | 452 | hwif->name); |
429 | qd_setup(hwif, base, config | (control << 8), | ||
430 | QD6580_DEF_DATA, QD6580_DEF_DATA2); | ||
431 | 453 | ||
454 | qd_setup(hwif, base, config | (control << 8)); | ||
455 | |||
456 | hwif->port_init_devs = qd6580_port_init_devs; | ||
432 | hwif->set_pio_mode = &qd6580_set_pio_mode; | 457 | hwif->set_pio_mode = &qd6580_set_pio_mode; |
433 | 458 | ||
434 | idx[0] = unit; | 459 | idx[unit] = unit; |
435 | 460 | ||
436 | ide_device_add(idx); | 461 | ide_device_add(idx, &qd65xx_port_info); |
437 | 462 | ||
438 | outb(QD_DEF_CONTR, QD_CONTROL_PORT); | 463 | outb(QD_DEF_CONTR, QD_CONTROL_PORT); |
439 | 464 | ||
@@ -447,20 +472,20 @@ static int __init qd_probe(int base) | |||
447 | printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n", | 472 | printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n", |
448 | hwif->name, mate->name); | 473 | hwif->name, mate->name); |
449 | 474 | ||
450 | qd_setup(hwif, base, config | (control << 8), | 475 | qd_setup(hwif, base, config | (control << 8)); |
451 | QD6580_DEF_DATA, QD6580_DEF_DATA); | ||
452 | 476 | ||
477 | hwif->port_init_devs = qd6580_port_init_devs; | ||
453 | hwif->set_pio_mode = &qd6580_set_pio_mode; | 478 | hwif->set_pio_mode = &qd6580_set_pio_mode; |
454 | 479 | ||
455 | qd_setup(mate, base, config | (control << 8), | 480 | qd_setup(mate, base, config | (control << 8)); |
456 | QD6580_DEF_DATA2, QD6580_DEF_DATA2); | ||
457 | 481 | ||
482 | mate->port_init_devs = qd6580_port_init_devs; | ||
458 | mate->set_pio_mode = &qd6580_set_pio_mode; | 483 | mate->set_pio_mode = &qd6580_set_pio_mode; |
459 | 484 | ||
460 | idx[0] = 0; | 485 | idx[0] = 0; |
461 | idx[1] = 1; | 486 | idx[1] = 1; |
462 | 487 | ||
463 | ide_device_add(idx); | 488 | ide_device_add(idx, &qd65xx_port_info); |
464 | 489 | ||
465 | outb(QD_DEF_CONTR, QD_CONTROL_PORT); | 490 | outb(QD_DEF_CONTR, QD_CONTROL_PORT); |
466 | 491 | ||
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index 26f38ce58776..5696ba026005 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c | |||
@@ -120,9 +120,14 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
120 | spin_unlock_irqrestore(&ide_lock, flags); | 120 | spin_unlock_irqrestore(&ide_lock, flags); |
121 | } | 121 | } |
122 | 122 | ||
123 | static const struct ide_port_info umc8672_port_info __initdata = { | ||
124 | .chipset = ide_umc8672, | ||
125 | .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_NO_AUTOTUNE, | ||
126 | .pio_mask = ATA_PIO4, | ||
127 | }; | ||
128 | |||
123 | static int __init umc8672_probe(void) | 129 | static int __init umc8672_probe(void) |
124 | { | 130 | { |
125 | ide_hwif_t *hwif, *mate; | ||
126 | unsigned long flags; | 131 | unsigned long flags; |
127 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; | 132 | static u8 idx[4] = { 0, 1, 0xff, 0xff }; |
128 | 133 | ||
@@ -143,21 +148,10 @@ static int __init umc8672_probe(void) | |||
143 | umc_set_speeds (current_speeds); | 148 | umc_set_speeds (current_speeds); |
144 | local_irq_restore(flags); | 149 | local_irq_restore(flags); |
145 | 150 | ||
146 | hwif = &ide_hwifs[0]; | 151 | ide_hwifs[0].set_pio_mode = &umc_set_pio_mode; |
147 | mate = &ide_hwifs[1]; | 152 | ide_hwifs[1].set_pio_mode = &umc_set_pio_mode; |
148 | |||
149 | hwif->chipset = ide_umc8672; | ||
150 | hwif->pio_mask = ATA_PIO4; | ||
151 | hwif->set_pio_mode = &umc_set_pio_mode; | ||
152 | hwif->mate = mate; | ||
153 | |||
154 | mate->chipset = ide_umc8672; | ||
155 | mate->pio_mask = ATA_PIO4; | ||
156 | mate->set_pio_mode = &umc_set_pio_mode; | ||
157 | mate->mate = hwif; | ||
158 | mate->channel = 1; | ||
159 | 153 | ||
160 | ide_device_add(idx); | 154 | ide_device_add(idx, &umc8672_port_info); |
161 | 155 | ||
162 | return 0; | 156 | return 0; |
163 | } | 157 | } |
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index cd42b30a7a3b..0f4bf5d72835 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
@@ -548,6 +548,17 @@ static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif) | |||
548 | *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET); | 548 | *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET); |
549 | } | 549 | } |
550 | 550 | ||
551 | static const struct ide_port_info au1xxx_port_info = { | ||
552 | .host_flags = IDE_HFLAG_POST_SET_MODE | | ||
553 | IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ | ||
554 | IDE_HFLAG_NO_IO_32BIT | | ||
555 | IDE_HFLAG_UNMASK_IRQS, | ||
556 | .pio_mask = ATA_PIO4, | ||
557 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | ||
558 | .mwdma_mask = ATA_MWDMA2, | ||
559 | #endif | ||
560 | }; | ||
561 | |||
551 | static int au_ide_probe(struct device *dev) | 562 | static int au_ide_probe(struct device *dev) |
552 | { | 563 | { |
553 | struct platform_device *pdev = to_platform_device(dev); | 564 | struct platform_device *pdev = to_platform_device(dev); |
@@ -606,21 +617,6 @@ static int au_ide_probe(struct device *dev) | |||
606 | 617 | ||
607 | hwif->dev = dev; | 618 | hwif->dev = dev; |
608 | 619 | ||
609 | hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ | ||
610 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | ||
611 | hwif->mwdma_mask = 0x07; /* Multimode-2 DMA */ | ||
612 | hwif->swdma_mask = 0x00; | ||
613 | #else | ||
614 | hwif->mwdma_mask = 0x0; | ||
615 | hwif->swdma_mask = 0x0; | ||
616 | #endif | ||
617 | |||
618 | hwif->pio_mask = ATA_PIO4; | ||
619 | hwif->host_flags = IDE_HFLAG_POST_SET_MODE; | ||
620 | |||
621 | hwif->drives[0].unmask = 1; | ||
622 | hwif->drives[1].unmask = 1; | ||
623 | |||
624 | /* hold should be on in all cases */ | 620 | /* hold should be on in all cases */ |
625 | hwif->hold = 1; | 621 | hwif->hold = 1; |
626 | 622 | ||
@@ -651,16 +647,9 @@ static int au_ide_probe(struct device *dev) | |||
651 | hwif->ide_dma_test_irq = &auide_dma_test_irq; | 647 | hwif->ide_dma_test_irq = &auide_dma_test_irq; |
652 | hwif->dma_lost_irq = &auide_dma_lost_irq; | 648 | hwif->dma_lost_irq = &auide_dma_lost_irq; |
653 | #endif | 649 | #endif |
654 | hwif->channel = 0; | ||
655 | hwif->select_data = 0; /* no chipset-specific code */ | 650 | hwif->select_data = 0; /* no chipset-specific code */ |
656 | hwif->config_data = 0; /* no chipset-specific code */ | 651 | hwif->config_data = 0; /* no chipset-specific code */ |
657 | 652 | ||
658 | hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ | ||
659 | hwif->drives[1].autotune = 1; | ||
660 | |||
661 | hwif->drives[0].no_io_32bit = 1; | ||
662 | hwif->drives[1].no_io_32bit = 1; | ||
663 | |||
664 | auide_hwif.hwif = hwif; | 653 | auide_hwif.hwif = hwif; |
665 | hwif->hwif_data = &auide_hwif; | 654 | hwif->hwif_data = &auide_hwif; |
666 | 655 | ||
@@ -671,7 +660,7 @@ static int au_ide_probe(struct device *dev) | |||
671 | 660 | ||
672 | idx[0] = hwif->index; | 661 | idx[0] = hwif->index; |
673 | 662 | ||
674 | ide_device_add(idx); | 663 | ide_device_add(idx, &au1xxx_port_info); |
675 | 664 | ||
676 | dev_set_drvdata(dev, hwif); | 665 | dev_set_drvdata(dev, hwif); |
677 | 666 | ||
@@ -688,7 +677,7 @@ static int au_ide_remove(struct device *dev) | |||
688 | ide_hwif_t *hwif = dev_get_drvdata(dev); | 677 | ide_hwif_t *hwif = dev_get_drvdata(dev); |
689 | _auide_hwif *ahwif = &auide_hwif; | 678 | _auide_hwif *ahwif = &auide_hwif; |
690 | 679 | ||
691 | ide_unregister(hwif->index); | 680 | ide_unregister(hwif->index, 0, 0); |
692 | 681 | ||
693 | iounmap((void *)ahwif->regbase); | 682 | iounmap((void *)ahwif->regbase); |
694 | 683 | ||
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c index 8b3959dfa2b7..956259fc09ba 100644 --- a/drivers/ide/mips/swarm.c +++ b/drivers/ide/mips/swarm.c | |||
@@ -129,7 +129,7 @@ static int __devinit swarm_ide_probe(struct device *dev) | |||
129 | 129 | ||
130 | idx[0] = hwif->index; | 130 | idx[0] = hwif->index; |
131 | 131 | ||
132 | ide_device_add(idx); | 132 | ide_device_add(idx, NULL); |
133 | 133 | ||
134 | dev_set_drvdata(dev, hwif); | 134 | dev_set_drvdata(dev, hwif); |
135 | 135 | ||
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 824df78c7012..cfb3265bc1a8 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
9 | #include <linux/pci.h> | 9 | #include <linux/pci.h> |
10 | #include <linux/delay.h> | ||
11 | #include <linux/hdreg.h> | 10 | #include <linux/hdreg.h> |
12 | #include <linux/ide.h> | 11 | #include <linux/ide.h> |
13 | #include <linux/init.h> | 12 | #include <linux/init.h> |
@@ -166,6 +165,16 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const ch | |||
166 | return dev->irq; | 165 | return dev->irq; |
167 | } | 166 | } |
168 | 167 | ||
168 | static u8 __devinit atp86x_cable_detect(ide_hwif_t *hwif) | ||
169 | { | ||
170 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
171 | u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01; | ||
172 | |||
173 | pci_read_config_byte(dev, 0x49, &ata66); | ||
174 | |||
175 | return (ata66 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | ||
176 | } | ||
177 | |||
169 | static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | 178 | static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) |
170 | { | 179 | { |
171 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 180 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
@@ -174,21 +183,10 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | |||
174 | 183 | ||
175 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) | 184 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) |
176 | hwif->set_dma_mode = &aec6210_set_mode; | 185 | hwif->set_dma_mode = &aec6210_set_mode; |
177 | else | 186 | else { |
178 | hwif->set_dma_mode = &aec6260_set_mode; | 187 | hwif->set_dma_mode = &aec6260_set_mode; |
179 | 188 | ||
180 | if (hwif->dma_base == 0) | 189 | hwif->cable_detect = atp86x_cable_detect; |
181 | return; | ||
182 | |||
183 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) | ||
184 | return; | ||
185 | |||
186 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) { | ||
187 | u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01; | ||
188 | |||
189 | pci_read_config_byte(dev, 0x49, &ata66); | ||
190 | |||
191 | hwif->cbl = (ata66 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | ||
192 | } | 190 | } |
193 | } | 191 | } |
194 | 192 | ||
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 130cc6e784e5..b3b6f514ce2d 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
34 | #include <linux/delay.h> | ||
35 | #include <linux/hdreg.h> | 34 | #include <linux/hdreg.h> |
36 | #include <linux/ide.h> | 35 | #include <linux/ide.h> |
37 | #include <linux/init.h> | 36 | #include <linux/init.h> |
@@ -666,13 +665,12 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) | |||
666 | hwif->set_dma_mode = &ali_set_dma_mode; | 665 | hwif->set_dma_mode = &ali_set_dma_mode; |
667 | hwif->udma_filter = &ali_udma_filter; | 666 | hwif->udma_filter = &ali_udma_filter; |
668 | 667 | ||
668 | hwif->cable_detect = ata66_ali15x3; | ||
669 | |||
669 | if (hwif->dma_base == 0) | 670 | if (hwif->dma_base == 0) |
670 | return; | 671 | return; |
671 | 672 | ||
672 | hwif->dma_setup = &ali15x3_dma_setup; | 673 | hwif->dma_setup = &ali15x3_dma_setup; |
673 | |||
674 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
675 | hwif->cbl = ata66_ali15x3(hwif); | ||
676 | } | 674 | } |
677 | 675 | ||
678 | /** | 676 | /** |
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 8c52bc9eaa59..2ef890ce8097 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
@@ -17,12 +17,9 @@ | |||
17 | 17 | ||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/ioport.h> | ||
21 | #include <linux/blkdev.h> | ||
22 | #include <linux/pci.h> | 20 | #include <linux/pci.h> |
23 | #include <linux/init.h> | 21 | #include <linux/init.h> |
24 | #include <linux/ide.h> | 22 | #include <linux/ide.h> |
25 | #include <asm/io.h> | ||
26 | 23 | ||
27 | #include "ide-timing.h" | 24 | #include "ide-timing.h" |
28 | 25 | ||
@@ -199,6 +196,14 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, | |||
199 | return dev->irq; | 196 | return dev->irq; |
200 | } | 197 | } |
201 | 198 | ||
199 | static u8 __devinit amd_cable_detect(ide_hwif_t *hwif) | ||
200 | { | ||
201 | if ((amd_80w >> hwif->channel) & 1) | ||
202 | return ATA_CBL_PATA80; | ||
203 | else | ||
204 | return ATA_CBL_PATA40; | ||
205 | } | ||
206 | |||
202 | static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | 207 | static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) |
203 | { | 208 | { |
204 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 209 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
@@ -209,15 +214,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) | |||
209 | hwif->set_pio_mode = &amd_set_pio_mode; | 214 | hwif->set_pio_mode = &amd_set_pio_mode; |
210 | hwif->set_dma_mode = &amd_set_drive; | 215 | hwif->set_dma_mode = &amd_set_drive; |
211 | 216 | ||
212 | if (!hwif->dma_base) | 217 | hwif->cable_detect = amd_cable_detect; |
213 | return; | ||
214 | |||
215 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) { | ||
216 | if ((amd_80w >> hwif->channel) & 1) | ||
217 | hwif->cbl = ATA_CBL_PATA80; | ||
218 | else | ||
219 | hwif->cbl = ATA_CBL_PATA40; | ||
220 | } | ||
221 | } | 218 | } |
222 | 219 | ||
223 | #define IDE_HFLAGS_AMD \ | 220 | #define IDE_HFLAGS_AMD \ |
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index b56274af1782..7e037c880cb0 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c | |||
@@ -6,15 +6,11 @@ | |||
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
9 | #include <linux/ioport.h> | ||
10 | #include <linux/pci.h> | 9 | #include <linux/pci.h> |
11 | #include <linux/hdreg.h> | 10 | #include <linux/hdreg.h> |
12 | #include <linux/ide.h> | 11 | #include <linux/ide.h> |
13 | #include <linux/delay.h> | ||
14 | #include <linux/init.h> | 12 | #include <linux/init.h> |
15 | 13 | ||
16 | #include <asm/io.h> | ||
17 | |||
18 | #define ATIIXP_IDE_PIO_TIMING 0x40 | 14 | #define ATIIXP_IDE_PIO_TIMING 0x40 |
19 | #define ATIIXP_IDE_MDMA_TIMING 0x44 | 15 | #define ATIIXP_IDE_MDMA_TIMING 0x44 |
20 | #define ATIIXP_IDE_PIO_CONTROL 0x48 | 16 | #define ATIIXP_IDE_PIO_CONTROL 0x48 |
@@ -121,6 +117,19 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
121 | spin_unlock_irqrestore(&atiixp_lock, flags); | 117 | spin_unlock_irqrestore(&atiixp_lock, flags); |
122 | } | 118 | } |
123 | 119 | ||
120 | static u8 __devinit atiixp_cable_detect(ide_hwif_t *hwif) | ||
121 | { | ||
122 | struct pci_dev *pdev = to_pci_dev(hwif->dev); | ||
123 | u8 udma_mode = 0, ch = hwif->channel; | ||
124 | |||
125 | pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode); | ||
126 | |||
127 | if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40) | ||
128 | return ATA_CBL_PATA80; | ||
129 | else | ||
130 | return ATA_CBL_PATA40; | ||
131 | } | ||
132 | |||
124 | /** | 133 | /** |
125 | * init_hwif_atiixp - fill in the hwif for the ATIIXP | 134 | * init_hwif_atiixp - fill in the hwif for the ATIIXP |
126 | * @hwif: IDE interface | 135 | * @hwif: IDE interface |
@@ -131,21 +140,10 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
131 | 140 | ||
132 | static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) | 141 | static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) |
133 | { | 142 | { |
134 | struct pci_dev *pdev = to_pci_dev(hwif->dev); | ||
135 | u8 udma_mode = 0, ch = hwif->channel; | ||
136 | |||
137 | hwif->set_pio_mode = &atiixp_set_pio_mode; | 143 | hwif->set_pio_mode = &atiixp_set_pio_mode; |
138 | hwif->set_dma_mode = &atiixp_set_dma_mode; | 144 | hwif->set_dma_mode = &atiixp_set_dma_mode; |
139 | 145 | ||
140 | if (!hwif->dma_base) | 146 | hwif->cable_detect = atiixp_cable_detect; |
141 | return; | ||
142 | |||
143 | pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode); | ||
144 | |||
145 | if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40) | ||
146 | hwif->cbl = ATA_CBL_PATA80; | ||
147 | else | ||
148 | hwif->cbl = ATA_CBL_PATA40; | ||
149 | } | 147 | } |
150 | 148 | ||
151 | static const struct ide_port_info atiixp_pci_info[] __devinitdata = { | 149 | static const struct ide_port_info atiixp_pci_info[] __devinitdata = { |
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 7240c20b9593..bd24dad3cfc6 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c | |||
@@ -103,10 +103,6 @@ | |||
103 | #include <linux/types.h> | 103 | #include <linux/types.h> |
104 | #include <linux/kernel.h> | 104 | #include <linux/kernel.h> |
105 | #include <linux/delay.h> | 105 | #include <linux/delay.h> |
106 | #include <linux/timer.h> | ||
107 | #include <linux/mm.h> | ||
108 | #include <linux/ioport.h> | ||
109 | #include <linux/blkdev.h> | ||
110 | #include <linux/hdreg.h> | 106 | #include <linux/hdreg.h> |
111 | #include <linux/ide.h> | 107 | #include <linux/ide.h> |
112 | #include <linux/init.h> | 108 | #include <linux/init.h> |
@@ -703,6 +699,18 @@ static int pci_conf2(void) | |||
703 | return 0; | 699 | return 0; |
704 | } | 700 | } |
705 | 701 | ||
702 | static const struct ide_port_info cmd640_port_info __initdata = { | ||
703 | .chipset = ide_cmd640, | ||
704 | .host_flags = IDE_HFLAG_SERIALIZE | | ||
705 | IDE_HFLAG_NO_DMA | | ||
706 | IDE_HFLAG_NO_AUTOTUNE | | ||
707 | IDE_HFLAG_ABUSE_PREFETCH | | ||
708 | IDE_HFLAG_ABUSE_FAST_DEVSEL, | ||
709 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | ||
710 | .pio_mask = ATA_PIO5, | ||
711 | #endif | ||
712 | }; | ||
713 | |||
706 | /* | 714 | /* |
707 | * Probe for a cmd640 chipset, and initialize it if found. | 715 | * Probe for a cmd640 chipset, and initialize it if found. |
708 | */ | 716 | */ |
@@ -760,11 +768,7 @@ static int __init cmd640x_init(void) | |||
760 | setup_device_ptrs (); | 768 | setup_device_ptrs (); |
761 | printk("%s: buggy cmd640%c interface on %s, config=0x%02x\n", | 769 | printk("%s: buggy cmd640%c interface on %s, config=0x%02x\n", |
762 | cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); | 770 | cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); |
763 | cmd_hwif0->chipset = ide_cmd640; | ||
764 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 771 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
765 | cmd_hwif0->host_flags = IDE_HFLAG_ABUSE_PREFETCH | | ||
766 | IDE_HFLAG_ABUSE_FAST_DEVSEL; | ||
767 | cmd_hwif0->pio_mask = ATA_PIO5; | ||
768 | cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; | 772 | cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode; |
769 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | 773 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ |
770 | 774 | ||
@@ -815,23 +819,14 @@ static int __init cmd640x_init(void) | |||
815 | * Initialize data for secondary cmd640 port, if enabled | 819 | * Initialize data for secondary cmd640 port, if enabled |
816 | */ | 820 | */ |
817 | if (second_port_cmd640) { | 821 | if (second_port_cmd640) { |
818 | cmd_hwif0->serialized = 1; | ||
819 | cmd_hwif1->serialized = 1; | ||
820 | cmd_hwif1->chipset = ide_cmd640; | ||
821 | cmd_hwif0->mate = cmd_hwif1; | ||
822 | cmd_hwif1->mate = cmd_hwif0; | ||
823 | cmd_hwif1->channel = 1; | ||
824 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED | 822 | #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED |
825 | cmd_hwif1->host_flags = IDE_HFLAG_ABUSE_PREFETCH | | ||
826 | IDE_HFLAG_ABUSE_FAST_DEVSEL; | ||
827 | cmd_hwif1->pio_mask = ATA_PIO5; | ||
828 | cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; | 823 | cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode; |
829 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ | 824 | #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ |
830 | 825 | ||
831 | idx[1] = cmd_hwif1->index; | 826 | idx[1] = cmd_hwif1->index; |
832 | } | 827 | } |
833 | printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name, | 828 | printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name, |
834 | cmd_hwif0->serialized ? "" : "not ", port2); | 829 | second_port_cmd640 ? "" : "not ", port2); |
835 | 830 | ||
836 | /* | 831 | /* |
837 | * Establish initial timings/prefetch for all drives. | 832 | * Establish initial timings/prefetch for all drives. |
@@ -876,7 +871,7 @@ static int __init cmd640x_init(void) | |||
876 | cmd640_dump_regs(); | 871 | cmd640_dump_regs(); |
877 | #endif | 872 | #endif |
878 | 873 | ||
879 | ide_device_add(idx); | 874 | ide_device_add(idx, &cmd640_port_info); |
880 | 875 | ||
881 | return 1; | 876 | return 1; |
882 | } | 877 | } |
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 04aa9e59670e..edabe6299efd 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
16 | #include <linux/delay.h> | ||
17 | #include <linux/hdreg.h> | 16 | #include <linux/hdreg.h> |
18 | #include <linux/ide.h> | 17 | #include <linux/ide.h> |
19 | #include <linux/init.h> | 18 | #include <linux/init.h> |
@@ -393,6 +392,8 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) | |||
393 | hwif->set_pio_mode = &cmd64x_set_pio_mode; | 392 | hwif->set_pio_mode = &cmd64x_set_pio_mode; |
394 | hwif->set_dma_mode = &cmd64x_set_dma_mode; | 393 | hwif->set_dma_mode = &cmd64x_set_dma_mode; |
395 | 394 | ||
395 | hwif->cable_detect = ata66_cmd64x; | ||
396 | |||
396 | if (!hwif->dma_base) | 397 | if (!hwif->dma_base) |
397 | return; | 398 | return; |
398 | 399 | ||
@@ -411,9 +412,6 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) | |||
411 | if (dev->device == PCI_DEVICE_ID_CMD_646 && dev->revision < 5) | 412 | if (dev->device == PCI_DEVICE_ID_CMD_646 && dev->revision < 5) |
412 | hwif->ultra_mask = 0x00; | 413 | hwif->ultra_mask = 0x00; |
413 | 414 | ||
414 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
415 | hwif->cbl = ata66_cmd64x(hwif); | ||
416 | |||
417 | switch (dev->device) { | 415 | switch (dev->device) { |
418 | case PCI_DEVICE_ID_CMD_648: | 416 | case PCI_DEVICE_ID_CMD_648: |
419 | case PCI_DEVICE_ID_CMD_649: | 417 | case PCI_DEVICE_ID_CMD_649: |
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index eb68a9ad0c98..0be1a824102b 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
@@ -35,22 +35,12 @@ | |||
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
37 | #include <linux/kernel.h> | 37 | #include <linux/kernel.h> |
38 | #include <linux/delay.h> | ||
39 | #include <linux/timer.h> | ||
40 | #include <linux/mm.h> | ||
41 | #include <linux/ioport.h> | ||
42 | #include <linux/blkdev.h> | ||
43 | #include <linux/hdreg.h> | 38 | #include <linux/hdreg.h> |
44 | |||
45 | #include <linux/interrupt.h> | ||
46 | #include <linux/init.h> | 39 | #include <linux/init.h> |
47 | #include <linux/pci.h> | 40 | #include <linux/pci.h> |
48 | #include <linux/ide.h> | 41 | #include <linux/ide.h> |
49 | #include <linux/dma-mapping.h> | 42 | #include <linux/dma-mapping.h> |
50 | 43 | ||
51 | #include <asm/io.h> | ||
52 | #include <asm/irq.h> | ||
53 | |||
54 | struct pio_clocks | 44 | struct pio_clocks |
55 | { | 45 | { |
56 | int address; | 46 | int address; |
@@ -180,7 +170,7 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic | |||
180 | 170 | ||
181 | ide_pci_setup_ports(dev, d, 14, &idx[0]); | 171 | ide_pci_setup_ports(dev, d, 14, &idx[0]); |
182 | 172 | ||
183 | ide_device_add(idx); | 173 | ide_device_add(idx, d); |
184 | 174 | ||
185 | return 0; | 175 | return 0; |
186 | } | 176 | } |
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index 765aac397ced..941a1344820b 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
@@ -15,18 +15,12 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/delay.h> | ||
19 | #include <linux/timer.h> | ||
20 | #include <linux/mm.h> | ||
21 | #include <linux/ioport.h> | ||
22 | #include <linux/blkdev.h> | ||
23 | #include <linux/hdreg.h> | 18 | #include <linux/hdreg.h> |
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
26 | #include <linux/init.h> | 20 | #include <linux/init.h> |
27 | #include <linux/ide.h> | 21 | #include <linux/ide.h> |
22 | |||
28 | #include <asm/io.h> | 23 | #include <asm/io.h> |
29 | #include <asm/irq.h> | ||
30 | 24 | ||
31 | /* | 25 | /* |
32 | * Here are the standard PIO mode 0-4 timings for each "format". | 26 | * Here are the standard PIO mode 0-4 timings for each "format". |
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 66433aa53f59..d7b5ea992e94 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c | |||
@@ -155,8 +155,9 @@ static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
155 | cs5535_set_speed(drive, XFER_PIO_0 + pio); | 155 | cs5535_set_speed(drive, XFER_PIO_0 + pio); |
156 | } | 156 | } |
157 | 157 | ||
158 | static u8 __devinit cs5535_cable_detect(struct pci_dev *dev) | 158 | static u8 __devinit cs5535_cable_detect(ide_hwif_t *hwif) |
159 | { | 159 | { |
160 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
160 | u8 bit; | 161 | u8 bit; |
161 | 162 | ||
162 | /* if a 80 wire cable was detected */ | 163 | /* if a 80 wire cable was detected */ |
@@ -175,15 +176,10 @@ static u8 __devinit cs5535_cable_detect(struct pci_dev *dev) | |||
175 | */ | 176 | */ |
176 | static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) | 177 | static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) |
177 | { | 178 | { |
178 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
179 | |||
180 | hwif->set_pio_mode = &cs5535_set_pio_mode; | 179 | hwif->set_pio_mode = &cs5535_set_pio_mode; |
181 | hwif->set_dma_mode = &cs5535_set_dma_mode; | 180 | hwif->set_dma_mode = &cs5535_set_dma_mode; |
182 | 181 | ||
183 | if (hwif->dma_base == 0) | 182 | hwif->cable_detect = cs5535_cable_detect; |
184 | return; | ||
185 | |||
186 | hwif->cbl = cs5535_cable_detect(dev); | ||
187 | } | 183 | } |
188 | 184 | ||
189 | static const struct ide_port_info cs5535_chipset __devinitdata = { | 185 | static const struct ide_port_info cs5535_chipset __devinitdata = { |
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index 50100ac8770f..724cbacf4e5b 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | #include <linux/types.h> | 46 | #include <linux/types.h> |
47 | #include <linux/pci.h> | 47 | #include <linux/pci.h> |
48 | #include <linux/delay.h> | ||
49 | #include <linux/ide.h> | 48 | #include <linux/ide.h> |
50 | #include <linux/init.h> | 49 | #include <linux/init.h> |
51 | 50 | ||
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index 27e47fc97100..3f9cd64c26a6 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
@@ -16,15 +16,14 @@ | |||
16 | * License. See the file COPYING in the main directory of this archive for | 16 | * License. See the file COPYING in the main directory of this archive for |
17 | * more details. | 17 | * more details. |
18 | */ | 18 | */ |
19 | #include <linux/autoconf.h> | 19 | |
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/mm.h> | ||
23 | #include <linux/blkdev.h> | ||
24 | #include <linux/hdreg.h> | 22 | #include <linux/hdreg.h> |
25 | #include <linux/ide.h> | 23 | #include <linux/ide.h> |
26 | #include <linux/init.h> | 24 | #include <linux/init.h> |
27 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | |||
28 | #include <asm/io.h> | 27 | #include <asm/io.h> |
29 | 28 | ||
30 | /* | 29 | /* |
@@ -52,6 +51,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) | |||
52 | ide_hwif_t *hwif = NULL; | 51 | ide_hwif_t *hwif = NULL; |
53 | ide_drive_t *drive; | 52 | ide_drive_t *drive; |
54 | int i, rc; | 53 | int i, rc; |
54 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
55 | 55 | ||
56 | rc = pci_enable_device(dev); | 56 | rc = pci_enable_device(dev); |
57 | if (rc) { | 57 | if (rc) { |
@@ -78,12 +78,27 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) | |||
78 | hw.irq = dev->irq; | 78 | hw.irq = dev->irq; |
79 | hw.chipset = ide_pci; /* this enables IRQ sharing */ | 79 | hw.chipset = ide_pci; /* this enables IRQ sharing */ |
80 | 80 | ||
81 | rc = ide_register_hw(&hw, &ide_undecoded_slave, &hwif); | 81 | hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]); |
82 | if (rc < 0) { | 82 | if (hwif == NULL) |
83 | printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc); | 83 | goto out_disable; |
84 | pci_disable_device(dev); | 84 | |
85 | return -ENODEV; | 85 | i = hwif->index; |
86 | } | 86 | |
87 | if (hwif->present) | ||
88 | ide_unregister(i, 0, 0); | ||
89 | else if (!hwif->hold) | ||
90 | ide_init_port_data(hwif, i); | ||
91 | |||
92 | ide_init_port_hw(hwif, &hw); | ||
93 | hwif->quirkproc = &ide_undecoded_slave; | ||
94 | |||
95 | idx[0] = i; | ||
96 | |||
97 | ide_device_add(idx, NULL); | ||
98 | |||
99 | if (!hwif->present) | ||
100 | goto out_disable; | ||
101 | |||
87 | pci_set_drvdata(dev, hwif); | 102 | pci_set_drvdata(dev, hwif); |
88 | hwif->dev = &dev->dev; | 103 | hwif->dev = &dev->dev; |
89 | drive = &hwif->drives[0]; | 104 | drive = &hwif->drives[0]; |
@@ -92,6 +107,11 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id) | |||
92 | drive->unmask = 1; | 107 | drive->unmask = 1; |
93 | } | 108 | } |
94 | return 0; | 109 | return 0; |
110 | |||
111 | out_disable: | ||
112 | printk(KERN_ERR "delkin_cb: no IDE devices found\n"); | ||
113 | pci_disable_device(dev); | ||
114 | return -ENODEV; | ||
95 | } | 115 | } |
96 | 116 | ||
97 | static void | 117 | static void |
@@ -100,7 +120,8 @@ delkin_cb_remove (struct pci_dev *dev) | |||
100 | ide_hwif_t *hwif = pci_get_drvdata(dev); | 120 | ide_hwif_t *hwif = pci_get_drvdata(dev); |
101 | 121 | ||
102 | if (hwif) | 122 | if (hwif) |
103 | ide_unregister(hwif->index); | 123 | ide_unregister(hwif->index, 0, 0); |
124 | |||
104 | pci_disable_device(dev); | 125 | pci_disable_device(dev); |
105 | } | 126 | } |
106 | 127 | ||
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index 59ebe84f1053..9262a9174b4e 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c | |||
@@ -22,18 +22,11 @@ | |||
22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/delay.h> | ||
26 | #include <linux/timer.h> | ||
27 | #include <linux/mm.h> | ||
28 | #include <linux/ioport.h> | ||
29 | #include <linux/blkdev.h> | ||
30 | #include <linux/hdreg.h> | 25 | #include <linux/hdreg.h> |
31 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
32 | #include <linux/ide.h> | 27 | #include <linux/ide.h> |
33 | #include <linux/init.h> | 28 | #include <linux/init.h> |
34 | 29 | ||
35 | #include <asm/io.h> | ||
36 | |||
37 | static int ide_generic_all; /* Set to claim all devices */ | 30 | static int ide_generic_all; /* Set to claim all devices */ |
38 | 31 | ||
39 | /* | 32 | /* |
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index 25dbb814822d..9f01da46b016 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c | |||
@@ -26,20 +26,13 @@ | |||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/delay.h> | ||
30 | #include <linux/timer.h> | ||
31 | #include <linux/mm.h> | ||
32 | #include <linux/ioport.h> | 29 | #include <linux/ioport.h> |
33 | #include <linux/blkdev.h> | ||
34 | #include <linux/hdreg.h> | 30 | #include <linux/hdreg.h> |
35 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
36 | #include <linux/pci.h> | 32 | #include <linux/pci.h> |
37 | #include <linux/init.h> | 33 | #include <linux/init.h> |
38 | #include <linux/ide.h> | 34 | #include <linux/ide.h> |
39 | 35 | ||
40 | #include <asm/io.h> | ||
41 | #include <asm/irq.h> | ||
42 | |||
43 | #define HPT343_DEBUG_DRIVE_INFO 0 | 36 | #define HPT343_DEBUG_DRIVE_INFO 0 |
44 | 37 | ||
45 | static void hpt34x_set_mode(ide_drive_t *drive, const u8 speed) | 38 | static void hpt34x_set_mode(ide_drive_t *drive, const u8 speed) |
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 5623cad569da..d0f7bb8b8adf 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
@@ -121,12 +121,8 @@ | |||
121 | #include <linux/module.h> | 121 | #include <linux/module.h> |
122 | #include <linux/kernel.h> | 122 | #include <linux/kernel.h> |
123 | #include <linux/delay.h> | 123 | #include <linux/delay.h> |
124 | #include <linux/timer.h> | ||
125 | #include <linux/mm.h> | ||
126 | #include <linux/ioport.h> | ||
127 | #include <linux/blkdev.h> | 124 | #include <linux/blkdev.h> |
128 | #include <linux/hdreg.h> | 125 | #include <linux/hdreg.h> |
129 | |||
130 | #include <linux/interrupt.h> | 126 | #include <linux/interrupt.h> |
131 | #include <linux/pci.h> | 127 | #include <linux/pci.h> |
132 | #include <linux/init.h> | 128 | #include <linux/init.h> |
@@ -134,7 +130,6 @@ | |||
134 | 130 | ||
135 | #include <asm/uaccess.h> | 131 | #include <asm/uaccess.h> |
136 | #include <asm/io.h> | 132 | #include <asm/io.h> |
137 | #include <asm/irq.h> | ||
138 | 133 | ||
139 | /* various tuning parameters */ | 134 | /* various tuning parameters */ |
140 | #define HPT_RESET_STATE_ENGINE | 135 | #define HPT_RESET_STATE_ENGINE |
@@ -1279,12 +1274,55 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha | |||
1279 | return dev->irq; | 1274 | return dev->irq; |
1280 | } | 1275 | } |
1281 | 1276 | ||
1277 | static u8 __devinit hpt3xx_cable_detect(ide_hwif_t *hwif) | ||
1278 | { | ||
1279 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
1280 | struct hpt_info *info = pci_get_drvdata(dev); | ||
1281 | u8 chip_type = info->chip_type; | ||
1282 | u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; | ||
1283 | |||
1284 | /* | ||
1285 | * The HPT37x uses the CBLID pins as outputs for MA15/MA16 | ||
1286 | * address lines to access an external EEPROM. To read valid | ||
1287 | * cable detect state the pins must be enabled as inputs. | ||
1288 | */ | ||
1289 | if (chip_type == HPT374 && (PCI_FUNC(dev->devfn) & 1)) { | ||
1290 | /* | ||
1291 | * HPT374 PCI function 1 | ||
1292 | * - set bit 15 of reg 0x52 to enable TCBLID as input | ||
1293 | * - set bit 15 of reg 0x56 to enable FCBLID as input | ||
1294 | */ | ||
1295 | u8 mcr_addr = hwif->select_data + 2; | ||
1296 | u16 mcr; | ||
1297 | |||
1298 | pci_read_config_word(dev, mcr_addr, &mcr); | ||
1299 | pci_write_config_word(dev, mcr_addr, (mcr | 0x8000)); | ||
1300 | /* now read cable id register */ | ||
1301 | pci_read_config_byte(dev, 0x5a, &scr1); | ||
1302 | pci_write_config_word(dev, mcr_addr, mcr); | ||
1303 | } else if (chip_type >= HPT370) { | ||
1304 | /* | ||
1305 | * HPT370/372 and 374 pcifn 0 | ||
1306 | * - clear bit 0 of reg 0x5b to enable P/SCBLID as inputs | ||
1307 | */ | ||
1308 | u8 scr2 = 0; | ||
1309 | |||
1310 | pci_read_config_byte(dev, 0x5b, &scr2); | ||
1311 | pci_write_config_byte(dev, 0x5b, (scr2 & ~1)); | ||
1312 | /* now read cable id register */ | ||
1313 | pci_read_config_byte(dev, 0x5a, &scr1); | ||
1314 | pci_write_config_byte(dev, 0x5b, scr2); | ||
1315 | } else | ||
1316 | pci_read_config_byte(dev, 0x5a, &scr1); | ||
1317 | |||
1318 | return (scr1 & ata66) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | ||
1319 | } | ||
1320 | |||
1282 | static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | 1321 | static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) |
1283 | { | 1322 | { |
1284 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 1323 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1285 | struct hpt_info *info = pci_get_drvdata(dev); | 1324 | struct hpt_info *info = pci_get_drvdata(dev); |
1286 | int serialize = HPT_SERIALIZE_IO; | 1325 | int serialize = HPT_SERIALIZE_IO; |
1287 | u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; | ||
1288 | u8 chip_type = info->chip_type; | 1326 | u8 chip_type = info->chip_type; |
1289 | u8 new_mcr, old_mcr = 0; | 1327 | u8 new_mcr, old_mcr = 0; |
1290 | 1328 | ||
@@ -1301,6 +1339,8 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | |||
1301 | hwif->udma_filter = &hpt3xx_udma_filter; | 1339 | hwif->udma_filter = &hpt3xx_udma_filter; |
1302 | hwif->mdma_filter = &hpt3xx_mdma_filter; | 1340 | hwif->mdma_filter = &hpt3xx_mdma_filter; |
1303 | 1341 | ||
1342 | hwif->cable_detect = hpt3xx_cable_detect; | ||
1343 | |||
1304 | /* | 1344 | /* |
1305 | * HPT3xxN chips have some complications: | 1345 | * HPT3xxN chips have some complications: |
1306 | * | 1346 | * |
@@ -1346,43 +1386,6 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | |||
1346 | if (hwif->dma_base == 0) | 1386 | if (hwif->dma_base == 0) |
1347 | return; | 1387 | return; |
1348 | 1388 | ||
1349 | /* | ||
1350 | * The HPT37x uses the CBLID pins as outputs for MA15/MA16 | ||
1351 | * address lines to access an external EEPROM. To read valid | ||
1352 | * cable detect state the pins must be enabled as inputs. | ||
1353 | */ | ||
1354 | if (chip_type == HPT374 && (PCI_FUNC(dev->devfn) & 1)) { | ||
1355 | /* | ||
1356 | * HPT374 PCI function 1 | ||
1357 | * - set bit 15 of reg 0x52 to enable TCBLID as input | ||
1358 | * - set bit 15 of reg 0x56 to enable FCBLID as input | ||
1359 | */ | ||
1360 | u8 mcr_addr = hwif->select_data + 2; | ||
1361 | u16 mcr; | ||
1362 | |||
1363 | pci_read_config_word (dev, mcr_addr, &mcr); | ||
1364 | pci_write_config_word(dev, mcr_addr, (mcr | 0x8000)); | ||
1365 | /* now read cable id register */ | ||
1366 | pci_read_config_byte (dev, 0x5a, &scr1); | ||
1367 | pci_write_config_word(dev, mcr_addr, mcr); | ||
1368 | } else if (chip_type >= HPT370) { | ||
1369 | /* | ||
1370 | * HPT370/372 and 374 pcifn 0 | ||
1371 | * - clear bit 0 of reg 0x5b to enable P/SCBLID as inputs | ||
1372 | */ | ||
1373 | u8 scr2 = 0; | ||
1374 | |||
1375 | pci_read_config_byte (dev, 0x5b, &scr2); | ||
1376 | pci_write_config_byte(dev, 0x5b, (scr2 & ~1)); | ||
1377 | /* now read cable id register */ | ||
1378 | pci_read_config_byte (dev, 0x5a, &scr1); | ||
1379 | pci_write_config_byte(dev, 0x5b, scr2); | ||
1380 | } else | ||
1381 | pci_read_config_byte (dev, 0x5a, &scr1); | ||
1382 | |||
1383 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
1384 | hwif->cbl = (scr1 & ata66) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | ||
1385 | |||
1386 | if (chip_type >= HPT374) { | 1389 | if (chip_type >= HPT374) { |
1387 | hwif->ide_dma_test_irq = &hpt374_ide_dma_test_irq; | 1390 | hwif->ide_dma_test_irq = &hpt374_ide_dma_test_irq; |
1388 | hwif->ide_dma_end = &hpt374_ide_dma_end; | 1391 | hwif->ide_dma_end = &hpt374_ide_dma_end; |
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index df74e588a530..e3427eaab430 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c | |||
@@ -10,13 +10,10 @@ | |||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
13 | #include <linux/delay.h> | ||
14 | #include <linux/hdreg.h> | 13 | #include <linux/hdreg.h> |
15 | #include <linux/ide.h> | 14 | #include <linux/ide.h> |
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | 16 | ||
18 | #include <asm/io.h> | ||
19 | |||
20 | /** | 17 | /** |
21 | * it8213_set_pio_mode - set host controller for PIO mode | 18 | * it8213_set_pio_mode - set host controller for PIO mode |
22 | * @drive: drive | 19 | * @drive: drive |
@@ -143,6 +140,16 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
143 | } | 140 | } |
144 | } | 141 | } |
145 | 142 | ||
143 | static u8 __devinit it8213_cable_detect(ide_hwif_t *hwif) | ||
144 | { | ||
145 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
146 | u8 reg42h = 0; | ||
147 | |||
148 | pci_read_config_byte(dev, 0x42, ®42h); | ||
149 | |||
150 | return (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | ||
151 | } | ||
152 | |||
146 | /** | 153 | /** |
147 | * init_hwif_it8213 - set up hwif structs | 154 | * init_hwif_it8213 - set up hwif structs |
148 | * @hwif: interface to set up | 155 | * @hwif: interface to set up |
@@ -152,19 +159,10 @@ static void it8213_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
152 | 159 | ||
153 | static void __devinit init_hwif_it8213(ide_hwif_t *hwif) | 160 | static void __devinit init_hwif_it8213(ide_hwif_t *hwif) |
154 | { | 161 | { |
155 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
156 | u8 reg42h = 0; | ||
157 | |||
158 | hwif->set_dma_mode = &it8213_set_dma_mode; | 162 | hwif->set_dma_mode = &it8213_set_dma_mode; |
159 | hwif->set_pio_mode = &it8213_set_pio_mode; | 163 | hwif->set_pio_mode = &it8213_set_pio_mode; |
160 | 164 | ||
161 | if (!hwif->dma_base) | 165 | hwif->cable_detect = it8213_cable_detect; |
162 | return; | ||
163 | |||
164 | pci_read_config_byte(dev, 0x42, ®42h); | ||
165 | |||
166 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
167 | hwif->cbl = (reg42h & 0x02) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | ||
168 | } | 166 | } |
169 | 167 | ||
170 | 168 | ||
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 938d35f35c81..1597f0cc1bf1 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -63,13 +63,10 @@ | |||
63 | #include <linux/types.h> | 63 | #include <linux/types.h> |
64 | #include <linux/module.h> | 64 | #include <linux/module.h> |
65 | #include <linux/pci.h> | 65 | #include <linux/pci.h> |
66 | #include <linux/delay.h> | ||
67 | #include <linux/hdreg.h> | 66 | #include <linux/hdreg.h> |
68 | #include <linux/ide.h> | 67 | #include <linux/ide.h> |
69 | #include <linux/init.h> | 68 | #include <linux/init.h> |
70 | 69 | ||
71 | #include <asm/io.h> | ||
72 | |||
73 | struct it821x_dev | 70 | struct it821x_dev |
74 | { | 71 | { |
75 | unsigned int smart:1, /* Are we in smart raid mode */ | 72 | unsigned int smart:1, /* Are we in smart raid mode */ |
@@ -579,14 +576,13 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
579 | } else | 576 | } else |
580 | hwif->host_flags |= IDE_HFLAG_NO_SET_MODE; | 577 | hwif->host_flags |= IDE_HFLAG_NO_SET_MODE; |
581 | 578 | ||
579 | hwif->cable_detect = ata66_it821x; | ||
580 | |||
582 | if (hwif->dma_base == 0) | 581 | if (hwif->dma_base == 0) |
583 | return; | 582 | return; |
584 | 583 | ||
585 | hwif->ultra_mask = ATA_UDMA6; | 584 | hwif->ultra_mask = ATA_UDMA6; |
586 | hwif->mwdma_mask = ATA_MWDMA2; | 585 | hwif->mwdma_mask = ATA_MWDMA2; |
587 | |||
588 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
589 | hwif->cbl = ata66_it821x(hwif); | ||
590 | } | 586 | } |
591 | 587 | ||
592 | static void __devinit it8212_disable_raid(struct pci_dev *dev) | 588 | static void __devinit it8212_disable_raid(struct pci_dev *dev) |
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index 8b40f6479c55..a56bcb4f22f4 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c | |||
@@ -8,13 +8,10 @@ | |||
8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/pci.h> | 10 | #include <linux/pci.h> |
11 | #include <linux/delay.h> | ||
12 | #include <linux/hdreg.h> | 11 | #include <linux/hdreg.h> |
13 | #include <linux/ide.h> | 12 | #include <linux/ide.h> |
14 | #include <linux/init.h> | 13 | #include <linux/init.h> |
15 | 14 | ||
16 | #include <asm/io.h> | ||
17 | |||
18 | typedef enum { | 15 | typedef enum { |
19 | PORT_PATA0 = 0, | 16 | PORT_PATA0 = 0, |
20 | PORT_PATA1 = 1, | 17 | PORT_PATA1 = 1, |
@@ -111,11 +108,7 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif) | |||
111 | hwif->set_pio_mode = &jmicron_set_pio_mode; | 108 | hwif->set_pio_mode = &jmicron_set_pio_mode; |
112 | hwif->set_dma_mode = &jmicron_set_dma_mode; | 109 | hwif->set_dma_mode = &jmicron_set_dma_mode; |
113 | 110 | ||
114 | if (hwif->dma_base == 0) | 111 | hwif->cable_detect = ata66_jmicron; |
115 | return; | ||
116 | |||
117 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
118 | hwif->cbl = ata66_jmicron(hwif); | ||
119 | } | 112 | } |
120 | 113 | ||
121 | static const struct ide_port_info jmicron_chipset __devinitdata = { | 114 | static const struct ide_port_info jmicron_chipset __devinitdata = { |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index fc9eee9ccac3..bf0d3b2931f1 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -10,11 +10,7 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/timer.h> | ||
14 | #include <linux/mm.h> | ||
15 | #include <linux/ioport.h> | ||
16 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
17 | #include <linux/blkdev.h> | ||
18 | #include <linux/hdreg.h> | 14 | #include <linux/hdreg.h> |
19 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
20 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 0ce92d323036..46e8748f507e 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c | |||
@@ -87,11 +87,6 @@ | |||
87 | #include <linux/types.h> | 87 | #include <linux/types.h> |
88 | #include <linux/module.h> | 88 | #include <linux/module.h> |
89 | #include <linux/kernel.h> | 89 | #include <linux/kernel.h> |
90 | #include <linux/delay.h> | ||
91 | #include <linux/timer.h> | ||
92 | #include <linux/mm.h> | ||
93 | #include <linux/ioport.h> | ||
94 | #include <linux/blkdev.h> | ||
95 | #include <linux/pci.h> | 90 | #include <linux/pci.h> |
96 | #include <linux/hdreg.h> | 91 | #include <linux/hdreg.h> |
97 | #include <linux/ide.h> | 92 | #include <linux/ide.h> |
@@ -320,14 +315,18 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
320 | spin_unlock_irqrestore(&opti621_lock, flags); | 315 | spin_unlock_irqrestore(&opti621_lock, flags); |
321 | } | 316 | } |
322 | 317 | ||
318 | static void __devinit opti621_port_init_devs(ide_hwif_t *hwif) | ||
319 | { | ||
320 | hwif->drives[0].drive_data = PIO_DONT_KNOW; | ||
321 | hwif->drives[1].drive_data = PIO_DONT_KNOW; | ||
322 | } | ||
323 | |||
323 | /* | 324 | /* |
324 | * init_hwif_opti621() is called once for each hwif found at boot. | 325 | * init_hwif_opti621() is called once for each hwif found at boot. |
325 | */ | 326 | */ |
326 | static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) | 327 | static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) |
327 | { | 328 | { |
328 | hwif->drives[0].drive_data = PIO_DONT_KNOW; | 329 | hwif->port_init_devs = opti621_port_init_devs; |
329 | hwif->drives[1].drive_data = PIO_DONT_KNOW; | ||
330 | |||
331 | hwif->set_pio_mode = &opti621_set_pio_mode; | 330 | hwif->set_pio_mode = &opti621_set_pio_mode; |
332 | } | 331 | } |
333 | 332 | ||
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index bb29db03540e..1c8cb7797a4a 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
@@ -19,18 +19,12 @@ | |||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/timer.h> | ||
23 | #include <linux/mm.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/blkdev.h> | ||
26 | #include <linux/hdreg.h> | 22 | #include <linux/hdreg.h> |
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
29 | #include <linux/init.h> | 24 | #include <linux/init.h> |
30 | #include <linux/ide.h> | 25 | #include <linux/ide.h> |
31 | 26 | ||
32 | #include <asm/io.h> | 27 | #include <asm/io.h> |
33 | #include <asm/irq.h> | ||
34 | 28 | ||
35 | #ifdef CONFIG_PPC_PMAC | 29 | #ifdef CONFIG_PPC_PMAC |
36 | #include <asm/prom.h> | 30 | #include <asm/prom.h> |
@@ -197,7 +191,7 @@ static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
197 | } | 191 | } |
198 | } | 192 | } |
199 | 193 | ||
200 | static u8 pdcnew_cable_detect(ide_hwif_t *hwif) | 194 | static u8 __devinit pdcnew_cable_detect(ide_hwif_t *hwif) |
201 | { | 195 | { |
202 | if (get_indexed_reg(hwif, 0x0b) & 0x04) | 196 | if (get_indexed_reg(hwif, 0x0b) & 0x04) |
203 | return ATA_CBL_PATA40; | 197 | return ATA_CBL_PATA40; |
@@ -456,11 +450,7 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif) | |||
456 | hwif->quirkproc = &pdcnew_quirkproc; | 450 | hwif->quirkproc = &pdcnew_quirkproc; |
457 | hwif->resetproc = &pdcnew_reset; | 451 | hwif->resetproc = &pdcnew_reset; |
458 | 452 | ||
459 | if (hwif->dma_base == 0) | 453 | hwif->cable_detect = pdcnew_cable_detect; |
460 | return; | ||
461 | |||
462 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
463 | hwif->cbl = pdcnew_cable_detect(hwif); | ||
464 | } | 454 | } |
465 | 455 | ||
466 | static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev) | 456 | static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev) |
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 31a1308414a0..da4329790387 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
@@ -32,18 +32,13 @@ | |||
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/timer.h> | ||
36 | #include <linux/mm.h> | ||
37 | #include <linux/ioport.h> | ||
38 | #include <linux/blkdev.h> | 35 | #include <linux/blkdev.h> |
39 | #include <linux/hdreg.h> | 36 | #include <linux/hdreg.h> |
40 | #include <linux/interrupt.h> | ||
41 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
42 | #include <linux/init.h> | 38 | #include <linux/init.h> |
43 | #include <linux/ide.h> | 39 | #include <linux/ide.h> |
44 | 40 | ||
45 | #include <asm/io.h> | 41 | #include <asm/io.h> |
46 | #include <asm/irq.h> | ||
47 | 42 | ||
48 | #define PDC202XX_DEBUG_DRIVE_INFO 0 | 43 | #define PDC202XX_DEBUG_DRIVE_INFO 0 |
49 | 44 | ||
@@ -140,10 +135,10 @@ static void pdc202xx_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
140 | pdc202xx_set_mode(drive, XFER_PIO_0 + pio); | 135 | pdc202xx_set_mode(drive, XFER_PIO_0 + pio); |
141 | } | 136 | } |
142 | 137 | ||
143 | static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif) | 138 | static u8 __devinit pdc2026x_old_cable_detect(ide_hwif_t *hwif) |
144 | { | 139 | { |
145 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 140 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
146 | u16 CIS = 0, mask = (hwif->channel) ? (1<<11) : (1<<10); | 141 | u16 CIS, mask = hwif->channel ? (1 << 11) : (1 << 10); |
147 | 142 | ||
148 | pci_read_config_word(dev, 0x50, &CIS); | 143 | pci_read_config_word(dev, 0x50, &CIS); |
149 | 144 | ||
@@ -311,9 +306,12 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) | |||
311 | 306 | ||
312 | hwif->quirkproc = &pdc202xx_quirkproc; | 307 | hwif->quirkproc = &pdc202xx_quirkproc; |
313 | 308 | ||
314 | if (dev->device != PCI_DEVICE_ID_PROMISE_20246) | 309 | if (dev->device != PCI_DEVICE_ID_PROMISE_20246) { |
315 | hwif->resetproc = &pdc202xx_reset; | 310 | hwif->resetproc = &pdc202xx_reset; |
316 | 311 | ||
312 | hwif->cable_detect = pdc2026x_old_cable_detect; | ||
313 | } | ||
314 | |||
317 | if (hwif->dma_base == 0) | 315 | if (hwif->dma_base == 0) |
318 | return; | 316 | return; |
319 | 317 | ||
@@ -321,9 +319,6 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) | |||
321 | hwif->dma_timeout = &pdc202xx_dma_timeout; | 319 | hwif->dma_timeout = &pdc202xx_dma_timeout; |
322 | 320 | ||
323 | if (dev->device != PCI_DEVICE_ID_PROMISE_20246) { | 321 | if (dev->device != PCI_DEVICE_ID_PROMISE_20246) { |
324 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
325 | hwif->cbl = pdc202xx_old_cable_detect(hwif); | ||
326 | |||
327 | hwif->dma_start = &pdc202xx_old_ide_dma_start; | 322 | hwif->dma_start = &pdc202xx_old_ide_dma_start; |
328 | hwif->ide_dma_end = &pdc202xx_old_ide_dma_end; | 323 | hwif->ide_dma_end = &pdc202xx_old_ide_dma_end; |
329 | } | 324 | } |
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index c1a6b68337d5..decef0f47674 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -47,11 +47,9 @@ | |||
47 | #include <linux/types.h> | 47 | #include <linux/types.h> |
48 | #include <linux/module.h> | 48 | #include <linux/module.h> |
49 | #include <linux/kernel.h> | 49 | #include <linux/kernel.h> |
50 | #include <linux/ioport.h> | ||
51 | #include <linux/pci.h> | 50 | #include <linux/pci.h> |
52 | #include <linux/hdreg.h> | 51 | #include <linux/hdreg.h> |
53 | #include <linux/ide.h> | 52 | #include <linux/ide.h> |
54 | #include <linux/delay.h> | ||
55 | #include <linux/init.h> | 53 | #include <linux/init.h> |
56 | 54 | ||
57 | #include <asm/io.h> | 55 | #include <asm/io.h> |
@@ -290,14 +288,11 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif) | |||
290 | hwif->set_pio_mode = &piix_set_pio_mode; | 288 | hwif->set_pio_mode = &piix_set_pio_mode; |
291 | hwif->set_dma_mode = &piix_set_dma_mode; | 289 | hwif->set_dma_mode = &piix_set_dma_mode; |
292 | 290 | ||
291 | hwif->cable_detect = piix_cable_detect; | ||
292 | |||
293 | if (!hwif->dma_base) | 293 | if (!hwif->dma_base) |
294 | return; | 294 | return; |
295 | 295 | ||
296 | if (hwif->ultra_mask & 0x78) { | ||
297 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
298 | hwif->cbl = piix_cable_detect(hwif); | ||
299 | } | ||
300 | |||
301 | if (no_piix_dma) | 296 | if (no_piix_dma) |
302 | hwif->ultra_mask = hwif->mwdma_mask = hwif->swdma_mask = 0; | 297 | hwif->ultra_mask = hwif->mwdma_mask = hwif->swdma_mask = 0; |
303 | } | 298 | } |
diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c index 7ed6625819d4..51676612f78f 100644 --- a/drivers/ide/pci/rz1000.c +++ b/drivers/ide/pci/rz1000.c | |||
@@ -16,18 +16,11 @@ | |||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/delay.h> | ||
20 | #include <linux/timer.h> | ||
21 | #include <linux/mm.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/blkdev.h> | ||
24 | #include <linux/hdreg.h> | 19 | #include <linux/hdreg.h> |
25 | #include <linux/pci.h> | 20 | #include <linux/pci.h> |
26 | #include <linux/ide.h> | 21 | #include <linux/ide.h> |
27 | #include <linux/init.h> | 22 | #include <linux/init.h> |
28 | 23 | ||
29 | #include <asm/io.h> | ||
30 | |||
31 | static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) | 24 | static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) |
32 | { | 25 | { |
33 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 26 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
@@ -40,8 +33,7 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) | |||
40 | } else { | 33 | } else { |
41 | if (hwif->mate) | 34 | if (hwif->mate) |
42 | hwif->mate->serialized = hwif->serialized = 1; | 35 | hwif->mate->serialized = hwif->serialized = 1; |
43 | hwif->drives[0].no_unmask = 1; | 36 | hwif->host_flags |= IDE_HFLAG_NO_UNMASK_IRQS; |
44 | hwif->drives[1].no_unmask = 1; | ||
45 | printk(KERN_INFO "%s: serialized, disabled unmasking " | 37 | printk(KERN_INFO "%s: serialized, disabled unmasking " |
46 | "(buggy RZ1000/RZ1001)\n", hwif->name); | 38 | "(buggy RZ1000/RZ1001)\n", hwif->name); |
47 | } | 39 | } |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index af499a60eb31..561aa47c7720 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -14,19 +14,13 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/delay.h> | ||
18 | #include <linux/timer.h> | ||
19 | #include <linux/mm.h> | ||
20 | #include <linux/ioport.h> | ||
21 | #include <linux/blkdev.h> | ||
22 | #include <linux/hdreg.h> | 17 | #include <linux/hdreg.h> |
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
25 | #include <linux/init.h> | 19 | #include <linux/init.h> |
26 | #include <linux/ide.h> | 20 | #include <linux/ide.h> |
27 | #include <linux/pm.h> | 21 | #include <linux/pm.h> |
22 | |||
28 | #include <asm/io.h> | 23 | #include <asm/io.h> |
29 | #include <asm/irq.h> | ||
30 | 24 | ||
31 | #define SC1200_REV_A 0x00 | 25 | #define SC1200_REV_A 0x00 |
32 | #define SC1200_REV_B1 0x01 | 26 | #define SC1200_REV_B1 0x01 |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 7694969b02ce..238e3e181e87 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -644,6 +644,11 @@ static void __devinit init_iops_scc(ide_hwif_t *hwif) | |||
644 | init_mmio_iops_scc(hwif); | 644 | init_mmio_iops_scc(hwif); |
645 | } | 645 | } |
646 | 646 | ||
647 | static u8 __devinit scc_cable_detect(ide_hwif_t *hwif) | ||
648 | { | ||
649 | return ATA_CBL_PATA80; | ||
650 | } | ||
651 | |||
647 | /** | 652 | /** |
648 | * init_hwif_scc - set up hwif | 653 | * init_hwif_scc - set up hwif |
649 | * @hwif: interface to set up | 654 | * @hwif: interface to set up |
@@ -678,8 +683,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) | |||
678 | else | 683 | else |
679 | hwif->ultra_mask = ATA_UDMA5; /* 100MHz */ | 684 | hwif->ultra_mask = ATA_UDMA5; /* 100MHz */ |
680 | 685 | ||
681 | /* we support 80c cable only. */ | 686 | hwif->cable_detect = scc_cable_detect; |
682 | hwif->cbl = ATA_CBL_PATA80; | ||
683 | } | 687 | } |
684 | 688 | ||
685 | #define DECLARE_SCC_DEV(name_str) \ | 689 | #define DECLARE_SCC_DEV(name_str) \ |
@@ -732,7 +736,7 @@ static void __devexit scc_remove(struct pci_dev *dev) | |||
732 | hwif->dmatable_cpu = NULL; | 736 | hwif->dmatable_cpu = NULL; |
733 | } | 737 | } |
734 | 738 | ||
735 | ide_unregister(hwif->index); | 739 | ide_unregister(hwif->index, 0, 0); |
736 | 740 | ||
737 | hwif->chipset = ide_unknown; | 741 | hwif->chipset = ide_unknown; |
738 | iounmap((void*)ports->dma); | 742 | iounmap((void*)ports->dma); |
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index f495253b7d41..c11880b0709f 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
@@ -31,12 +31,10 @@ | |||
31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
34 | #include <linux/ioport.h> | ||
35 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
36 | #include <linux/hdreg.h> | 35 | #include <linux/hdreg.h> |
37 | #include <linux/ide.h> | 36 | #include <linux/ide.h> |
38 | #include <linux/init.h> | 37 | #include <linux/init.h> |
39 | #include <linux/delay.h> | ||
40 | 38 | ||
41 | #include <asm/io.h> | 39 | #include <asm/io.h> |
42 | 40 | ||
@@ -346,13 +344,8 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif) | |||
346 | hwif->set_dma_mode = &svwks_set_dma_mode; | 344 | hwif->set_dma_mode = &svwks_set_dma_mode; |
347 | hwif->udma_filter = &svwks_udma_filter; | 345 | hwif->udma_filter = &svwks_udma_filter; |
348 | 346 | ||
349 | if (!hwif->dma_base) | 347 | if (dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) |
350 | return; | 348 | hwif->cable_detect = ata66_svwks; |
351 | |||
352 | if (dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { | ||
353 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
354 | hwif->cbl = ata66_svwks(hwif); | ||
355 | } | ||
356 | } | 349 | } |
357 | 350 | ||
358 | #define IDE_HFLAGS_SVWKS \ | 351 | #define IDE_HFLAGS_SVWKS \ |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 85902074b1fc..054626497be4 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -25,8 +25,6 @@ | |||
25 | #include <linux/hdreg.h> | 25 | #include <linux/hdreg.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/timer.h> | ||
29 | #include <linux/mm.h> | ||
30 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
31 | #include <linux/blkdev.h> | 29 | #include <linux/blkdev.h> |
32 | #include <linux/scatterlist.h> | 30 | #include <linux/scatterlist.h> |
@@ -555,7 +553,6 @@ static void __devinit | |||
555 | ide_init_sgiioc4(ide_hwif_t * hwif) | 553 | ide_init_sgiioc4(ide_hwif_t * hwif) |
556 | { | 554 | { |
557 | hwif->mmio = 1; | 555 | hwif->mmio = 1; |
558 | hwif->pio_mask = 0x00; | ||
559 | hwif->set_pio_mode = NULL; /* Sets timing for PIO mode */ | 556 | hwif->set_pio_mode = NULL; /* Sets timing for PIO mode */ |
560 | hwif->set_dma_mode = &sgiioc4_set_dma_mode; | 557 | hwif->set_dma_mode = &sgiioc4_set_dma_mode; |
561 | hwif->selectproc = NULL;/* Use the default routine to select drive */ | 558 | hwif->selectproc = NULL;/* Use the default routine to select drive */ |
@@ -572,8 +569,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif) | |||
572 | if (hwif->dma_base == 0) | 569 | if (hwif->dma_base == 0) |
573 | return; | 570 | return; |
574 | 571 | ||
575 | hwif->mwdma_mask = ATA_MWDMA2_ONLY; | ||
576 | |||
577 | hwif->dma_host_set = &sgiioc4_dma_host_set; | 572 | hwif->dma_host_set = &sgiioc4_dma_host_set; |
578 | hwif->dma_setup = &sgiioc4_ide_dma_setup; | 573 | hwif->dma_setup = &sgiioc4_ide_dma_setup; |
579 | hwif->dma_start = &sgiioc4_ide_dma_start; | 574 | hwif->dma_start = &sgiioc4_ide_dma_start; |
@@ -583,6 +578,13 @@ ide_init_sgiioc4(ide_hwif_t * hwif) | |||
583 | hwif->dma_timeout = &ide_dma_timeout; | 578 | hwif->dma_timeout = &ide_dma_timeout; |
584 | } | 579 | } |
585 | 580 | ||
581 | static const struct ide_port_info sgiioc4_port_info __devinitdata = { | ||
582 | .chipset = ide_pci, | ||
583 | .host_flags = IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ | ||
584 | IDE_HFLAG_NO_AUTOTUNE, | ||
585 | .mwdma_mask = ATA_MWDMA2_ONLY, | ||
586 | }; | ||
587 | |||
586 | static int __devinit | 588 | static int __devinit |
587 | sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | 589 | sgiioc4_ide_setup_pci_device(struct pci_dev *dev) |
588 | { | 590 | { |
@@ -593,6 +595,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
593 | int h; | 595 | int h; |
594 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 596 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
595 | hw_regs_t hw; | 597 | hw_regs_t hw; |
598 | struct ide_port_info d = sgiioc4_port_info; | ||
596 | 599 | ||
597 | /* | 600 | /* |
598 | * Find an empty HWIF; if none available, return -ENOMEM. | 601 | * Find an empty HWIF; if none available, return -ENOMEM. |
@@ -641,7 +644,6 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
641 | ide_init_port_hw(hwif, &hw); | 644 | ide_init_port_hw(hwif, &hw); |
642 | 645 | ||
643 | hwif->dev = &dev->dev; | 646 | hwif->dev = &dev->dev; |
644 | hwif->channel = 0; /* Single Channel chip */ | ||
645 | 647 | ||
646 | /* The IOC4 uses MMIO rather than Port IO. */ | 648 | /* The IOC4 uses MMIO rather than Port IO. */ |
647 | default_hwif_mmiops(hwif); | 649 | default_hwif_mmiops(hwif); |
@@ -649,15 +651,17 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) | |||
649 | /* Initializing chipset IRQ Registers */ | 651 | /* Initializing chipset IRQ Registers */ |
650 | writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); | 652 | writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); |
651 | 653 | ||
652 | if (dma_base == 0 || ide_dma_sgiioc4(hwif, dma_base)) | 654 | if (dma_base == 0 || ide_dma_sgiioc4(hwif, dma_base)) { |
653 | printk(KERN_INFO "%s: %s Bus-Master DMA disabled\n", | 655 | printk(KERN_INFO "%s: %s Bus-Master DMA disabled\n", |
654 | hwif->name, DRV_NAME); | 656 | hwif->name, DRV_NAME); |
657 | d.mwdma_mask = 0; | ||
658 | } | ||
655 | 659 | ||
656 | ide_init_sgiioc4(hwif); | 660 | ide_init_sgiioc4(hwif); |
657 | 661 | ||
658 | idx[0] = hwif->index; | 662 | idx[0] = hwif->index; |
659 | 663 | ||
660 | if (ide_device_add(idx)) | 664 | if (ide_device_add(idx, &d)) |
661 | return -EIO; | 665 | return -EIO; |
662 | 666 | ||
663 | return 0; | 667 | return 0; |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 4877bc8cd599..ef5b39fa042b 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
40 | #include <linux/module.h> | 40 | #include <linux/module.h> |
41 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
42 | #include <linux/delay.h> | ||
43 | #include <linux/hdreg.h> | 42 | #include <linux/hdreg.h> |
44 | #include <linux/ide.h> | 43 | #include <linux/ide.h> |
45 | #include <linux/init.h> | 44 | #include <linux/init.h> |
@@ -332,15 +331,18 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | |||
332 | { | 331 | { |
333 | ide_hwif_t *hwif = HWIF(drive); | 332 | ide_hwif_t *hwif = HWIF(drive); |
334 | unsigned long addr = siimage_selreg(hwif, 0x1); | 333 | unsigned long addr = siimage_selreg(hwif, 0x1); |
334 | void __iomem *sata_error_addr | ||
335 | = (void __iomem *)hwif->sata_scr[SATA_ERROR_OFFSET]; | ||
335 | 336 | ||
336 | if (SATA_ERROR_REG) { | 337 | if (sata_error_addr) { |
337 | unsigned long base = (unsigned long)hwif->hwif_data; | 338 | unsigned long base = (unsigned long)hwif->hwif_data; |
338 | |||
339 | u32 ext_stat = readl((void __iomem *)(base + 0x10)); | 339 | u32 ext_stat = readl((void __iomem *)(base + 0x10)); |
340 | u8 watchdog = 0; | 340 | u8 watchdog = 0; |
341 | |||
341 | if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { | 342 | if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { |
342 | u32 sata_error = readl((void __iomem *)SATA_ERROR_REG); | 343 | u32 sata_error = readl(sata_error_addr); |
343 | writel(sata_error, (void __iomem *)SATA_ERROR_REG); | 344 | |
345 | writel(sata_error, sata_error_addr); | ||
344 | watchdog = (sata_error & 0x00680000) ? 1 : 0; | 346 | watchdog = (sata_error & 0x00680000) ? 1 : 0; |
345 | printk(KERN_WARNING "%s: sata_error = 0x%08x, " | 347 | printk(KERN_WARNING "%s: sata_error = 0x%08x, " |
346 | "watchdog = %d, %s\n", | 348 | "watchdog = %d, %s\n", |
@@ -419,13 +421,17 @@ static int sil_sata_busproc(ide_drive_t * drive, int state) | |||
419 | 421 | ||
420 | static int sil_sata_reset_poll(ide_drive_t *drive) | 422 | static int sil_sata_reset_poll(ide_drive_t *drive) |
421 | { | 423 | { |
422 | if (SATA_STATUS_REG) { | 424 | ide_hwif_t *hwif = drive->hwif; |
423 | ide_hwif_t *hwif = HWIF(drive); | 425 | void __iomem *sata_status_addr |
426 | = (void __iomem *)hwif->sata_scr[SATA_STATUS_OFFSET]; | ||
424 | 427 | ||
425 | /* SATA_STATUS_REG is valid only when in MMIO mode */ | 428 | if (sata_status_addr) { |
426 | if ((readl((void __iomem *)SATA_STATUS_REG) & 0x03) != 0x03) { | 429 | /* SATA Status is available only when in MMIO mode */ |
430 | u32 sata_stat = readl(sata_status_addr); | ||
431 | |||
432 | if ((sata_stat & 0x03) != 0x03) { | ||
427 | printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n", | 433 | printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n", |
428 | hwif->name, readl((void __iomem *)SATA_STATUS_REG)); | 434 | hwif->name, sata_stat); |
429 | HWGROUP(drive)->polling = 0; | 435 | HWGROUP(drive)->polling = 0; |
430 | return ide_started; | 436 | return ide_started; |
431 | } | 437 | } |
@@ -827,15 +833,14 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | |||
827 | } else | 833 | } else |
828 | hwif->udma_filter = &sil_pata_udma_filter; | 834 | hwif->udma_filter = &sil_pata_udma_filter; |
829 | 835 | ||
836 | hwif->cable_detect = ata66_siimage; | ||
837 | |||
830 | if (hwif->dma_base == 0) | 838 | if (hwif->dma_base == 0) |
831 | return; | 839 | return; |
832 | 840 | ||
833 | if (sata) | 841 | if (sata) |
834 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 842 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; |
835 | 843 | ||
836 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
837 | hwif->cbl = ata66_siimage(hwif); | ||
838 | |||
839 | if (hwif->mmio) { | 844 | if (hwif->mmio) { |
840 | hwif->ide_dma_test_irq = &siimage_mmio_ide_dma_test_irq; | 845 | hwif->ide_dma_test_irq = &siimage_mmio_ide_dma_test_irq; |
841 | } else { | 846 | } else { |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 2a461de22aa0..512bb4c1fd5c 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -47,20 +47,11 @@ | |||
47 | #include <linux/types.h> | 47 | #include <linux/types.h> |
48 | #include <linux/module.h> | 48 | #include <linux/module.h> |
49 | #include <linux/kernel.h> | 49 | #include <linux/kernel.h> |
50 | #include <linux/delay.h> | ||
51 | #include <linux/timer.h> | ||
52 | #include <linux/mm.h> | ||
53 | #include <linux/ioport.h> | ||
54 | #include <linux/blkdev.h> | ||
55 | #include <linux/hdreg.h> | 50 | #include <linux/hdreg.h> |
56 | |||
57 | #include <linux/interrupt.h> | ||
58 | #include <linux/pci.h> | 51 | #include <linux/pci.h> |
59 | #include <linux/init.h> | 52 | #include <linux/init.h> |
60 | #include <linux/ide.h> | 53 | #include <linux/ide.h> |
61 | 54 | ||
62 | #include <asm/irq.h> | ||
63 | |||
64 | #include "ide-timing.h" | 55 | #include "ide-timing.h" |
65 | 56 | ||
66 | /* registers layout and init values are chipset family dependant */ | 57 | /* registers layout and init values are chipset family dependant */ |
@@ -565,13 +556,12 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) | |||
565 | if (chipset_family >= ATA_133) | 556 | if (chipset_family >= ATA_133) |
566 | hwif->udma_filter = sis5513_ata133_udma_filter; | 557 | hwif->udma_filter = sis5513_ata133_udma_filter; |
567 | 558 | ||
559 | hwif->cable_detect = ata66_sis5513; | ||
560 | |||
568 | if (hwif->dma_base == 0) | 561 | if (hwif->dma_base == 0) |
569 | return; | 562 | return; |
570 | 563 | ||
571 | hwif->ultra_mask = udma_rates[chipset_family]; | 564 | hwif->ultra_mask = udma_rates[chipset_family]; |
572 | |||
573 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
574 | hwif->cbl = ata66_sis5513(hwif); | ||
575 | } | 565 | } |
576 | 566 | ||
577 | static const struct ide_port_info sis5513_chipset __devinitdata = { | 567 | static const struct ide_port_info sis5513_chipset __devinitdata = { |
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index da13a1298ada..ee261ae15b6f 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -17,17 +17,11 @@ | |||
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/timer.h> | ||
21 | #include <linux/mm.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/blkdev.h> | ||
25 | #include <linux/hdreg.h> | 20 | #include <linux/hdreg.h> |
26 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
27 | #include <linux/ide.h> | 22 | #include <linux/ide.h> |
28 | 23 | ||
29 | #include <asm/io.h> | 24 | #include <asm/io.h> |
30 | #include <asm/dma.h> | ||
31 | 25 | ||
32 | #undef DEBUG | 26 | #undef DEBUG |
33 | 27 | ||
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index a6cf810c4699..65f4c2ffaa59 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c | |||
@@ -10,15 +10,11 @@ | |||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/ioport.h> | ||
14 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
15 | #include <linux/hdreg.h> | 14 | #include <linux/hdreg.h> |
16 | #include <linux/ide.h> | 15 | #include <linux/ide.h> |
17 | #include <linux/delay.h> | ||
18 | #include <linux/init.h> | 16 | #include <linux/init.h> |
19 | 17 | ||
20 | #include <asm/io.h> | ||
21 | |||
22 | static DEFINE_SPINLOCK(slc90e66_lock); | 18 | static DEFINE_SPINLOCK(slc90e66_lock); |
23 | 19 | ||
24 | static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) | 20 | static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) |
@@ -118,23 +114,23 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
118 | } | 114 | } |
119 | } | 115 | } |
120 | 116 | ||
121 | static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) | 117 | static u8 __devinit slc90e66_cable_detect(ide_hwif_t *hwif) |
122 | { | 118 | { |
123 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 119 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
124 | u8 reg47 = 0; | 120 | u8 reg47 = 0, mask = hwif->channel ? 0x01 : 0x02; |
125 | u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ | ||
126 | |||
127 | hwif->set_pio_mode = &slc90e66_set_pio_mode; | ||
128 | hwif->set_dma_mode = &slc90e66_set_dma_mode; | ||
129 | 121 | ||
130 | pci_read_config_byte(dev, 0x47, ®47); | 122 | pci_read_config_byte(dev, 0x47, ®47); |
131 | 123 | ||
132 | if (hwif->dma_base == 0) | 124 | /* bit[0(1)]: 0:80, 1:40 */ |
133 | return; | 125 | return (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; |
126 | } | ||
127 | |||
128 | static void __devinit init_hwif_slc90e66(ide_hwif_t *hwif) | ||
129 | { | ||
130 | hwif->set_pio_mode = &slc90e66_set_pio_mode; | ||
131 | hwif->set_dma_mode = &slc90e66_set_dma_mode; | ||
134 | 132 | ||
135 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 133 | hwif->cable_detect = slc90e66_cable_detect; |
136 | /* bit[0(1)]: 0:80, 1:40 */ | ||
137 | hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | ||
138 | } | 134 | } |
139 | 135 | ||
140 | static const struct ide_port_info slc90e66_chipset __devinitdata = { | 136 | static const struct ide_port_info slc90e66_chipset __devinitdata = { |
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index 9fbbb4f2dd54..2ef2ed2f2b32 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c | |||
@@ -160,6 +160,19 @@ static int tc86c001_busproc(ide_drive_t *drive, int state) | |||
160 | return 0; | 160 | return 0; |
161 | } | 161 | } |
162 | 162 | ||
163 | static u8 __devinit tc86c001_cable_detect(ide_hwif_t *hwif) | ||
164 | { | ||
165 | struct pci_dev *dev = to_pci_dev(hwif->dev); | ||
166 | unsigned long sc_base = pci_resource_start(dev, 5); | ||
167 | u16 scr1 = inw(sc_base + 0x00); | ||
168 | |||
169 | /* | ||
170 | * System Control 1 Register bit 13 (PDIAGN): | ||
171 | * 0=80-pin cable, 1=40-pin cable | ||
172 | */ | ||
173 | return (scr1 & 0x2000) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | ||
174 | } | ||
175 | |||
163 | static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) | 176 | static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) |
164 | { | 177 | { |
165 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 178 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
@@ -183,6 +196,8 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) | |||
183 | 196 | ||
184 | hwif->busproc = &tc86c001_busproc; | 197 | hwif->busproc = &tc86c001_busproc; |
185 | 198 | ||
199 | hwif->cable_detect = tc86c001_cable_detect; | ||
200 | |||
186 | if (!hwif->dma_base) | 201 | if (!hwif->dma_base) |
187 | return; | 202 | return; |
188 | 203 | ||
@@ -196,15 +211,6 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) | |||
196 | hwif->rqsize = 0xffff; | 211 | hwif->rqsize = 0xffff; |
197 | 212 | ||
198 | hwif->dma_start = &tc86c001_dma_start; | 213 | hwif->dma_start = &tc86c001_dma_start; |
199 | |||
200 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) { | ||
201 | /* | ||
202 | * System Control 1 Register bit 13 (PDIAGN): | ||
203 | * 0=80-pin cable, 1=40-pin cable | ||
204 | */ | ||
205 | scr1 = inw(sc_base + 0x00); | ||
206 | hwif->cbl = (scr1 & 0x2000) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | ||
207 | } | ||
208 | } | 214 | } |
209 | 215 | ||
210 | static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev, | 216 | static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev, |
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index 852b72693736..a67d02a3f96e 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c | |||
@@ -28,11 +28,6 @@ | |||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
31 | #include <linux/delay.h> | ||
32 | #include <linux/timer.h> | ||
33 | #include <linux/mm.h> | ||
34 | #include <linux/ioport.h> | ||
35 | #include <linux/blkdev.h> | ||
36 | #include <linux/hdreg.h> | 31 | #include <linux/hdreg.h> |
37 | #include <linux/pci.h> | 32 | #include <linux/pci.h> |
38 | #include <linux/ide.h> | 33 | #include <linux/ide.h> |
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index d9ebb698953a..de750f7a43e9 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c | |||
@@ -131,14 +131,12 @@ | |||
131 | #include <linux/types.h> | 131 | #include <linux/types.h> |
132 | #include <linux/module.h> | 132 | #include <linux/module.h> |
133 | #include <linux/kernel.h> | 133 | #include <linux/kernel.h> |
134 | #include <linux/mm.h> | ||
135 | #include <linux/ioport.h> | 134 | #include <linux/ioport.h> |
136 | #include <linux/interrupt.h> | 135 | #include <linux/interrupt.h> |
137 | #include <linux/blkdev.h> | 136 | #include <linux/blkdev.h> |
138 | #include <linux/init.h> | 137 | #include <linux/init.h> |
139 | #include <linux/hdreg.h> | 138 | #include <linux/hdreg.h> |
140 | #include <linux/pci.h> | 139 | #include <linux/pci.h> |
141 | #include <linux/delay.h> | ||
142 | #include <linux/ide.h> | 140 | #include <linux/ide.h> |
143 | 141 | ||
144 | #include <asm/io.h> | 142 | #include <asm/io.h> |
@@ -179,10 +177,7 @@ static void trm290_selectproc (ide_drive_t *drive) | |||
179 | 177 | ||
180 | static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) | 178 | static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) |
181 | { | 179 | { |
182 | BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */ | 180 | ide_execute_command(drive, command, &ide_dma_intr, WAIT_CMD, NULL); |
183 | ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); | ||
184 | /* issue cmd to drive */ | ||
185 | outb(command, IDE_COMMAND_REG); | ||
186 | } | 181 | } |
187 | 182 | ||
188 | static int trm290_dma_setup(ide_drive_t *drive) | 183 | static int trm290_dma_setup(ide_drive_t *drive) |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 24cb9047fb41..f3f79f805813 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -26,15 +26,11 @@ | |||
26 | 26 | ||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/ioport.h> | ||
30 | #include <linux/blkdev.h> | ||
31 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
32 | #include <linux/init.h> | 30 | #include <linux/init.h> |
33 | #include <linux/ide.h> | 31 | #include <linux/ide.h> |
34 | #include <linux/dmi.h> | 32 | #include <linux/dmi.h> |
35 | 33 | ||
36 | #include <asm/io.h> | ||
37 | |||
38 | #ifdef CONFIG_PPC_CHRP | 34 | #ifdef CONFIG_PPC_CHRP |
39 | #include <asm/processor.h> | 35 | #include <asm/processor.h> |
40 | #endif | 36 | #endif |
@@ -424,11 +420,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | |||
424 | hwif->set_pio_mode = &via_set_pio_mode; | 420 | hwif->set_pio_mode = &via_set_pio_mode; |
425 | hwif->set_dma_mode = &via_set_drive; | 421 | hwif->set_dma_mode = &via_set_drive; |
426 | 422 | ||
427 | if (!hwif->dma_base) | 423 | hwif->cable_detect = via82cxxx_cable_detect; |
428 | return; | ||
429 | |||
430 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | ||
431 | hwif->cbl = via82cxxx_cable_detect(hwif); | ||
432 | } | 424 | } |
433 | 425 | ||
434 | static const struct ide_port_info via82cxxx_chipset __devinitdata = { | 426 | static const struct ide_port_info via82cxxx_chipset __devinitdata = { |
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c index 45c1d55e60df..06190b1c4ec5 100644 --- a/drivers/ide/ppc/mpc8xx.c +++ b/drivers/ide/ppc/mpc8xx.c | |||
@@ -848,7 +848,7 @@ static int __init mpc8xx_ide_probe(void) | |||
848 | #endif | 848 | #endif |
849 | #endif | 849 | #endif |
850 | 850 | ||
851 | ide_device_add(idx); | 851 | ide_device_add(idx, NULL); |
852 | 852 | ||
853 | return 0; | 853 | return 0; |
854 | } | 854 | } |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 23112ef68f67..12ac3bfb4f9a 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -412,7 +412,7 @@ kauai_lookup_timing(struct kauai_timing* table, int cycle_time) | |||
412 | */ | 412 | */ |
413 | #define IDE_WAKEUP_DELAY (1*HZ) | 413 | #define IDE_WAKEUP_DELAY (1*HZ) |
414 | 414 | ||
415 | static void pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif); | 415 | static int pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif); |
416 | static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); | 416 | static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); |
417 | static void pmac_ide_selectproc(ide_drive_t *drive); | 417 | static void pmac_ide_selectproc(ide_drive_t *drive); |
418 | static void pmac_ide_kauai_selectproc(ide_drive_t *drive); | 418 | static void pmac_ide_kauai_selectproc(ide_drive_t *drive); |
@@ -1003,6 +1003,17 @@ pmac_ide_do_resume(ide_hwif_t *hwif) | |||
1003 | return 0; | 1003 | return 0; |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | static const struct ide_port_info pmac_port_info = { | ||
1007 | .chipset = ide_pmac, | ||
1008 | .host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | | ||
1009 | IDE_HFLAG_PIO_NO_DOWNGRADE | | ||
1010 | IDE_HFLAG_POST_SET_MODE | | ||
1011 | IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ | ||
1012 | IDE_HFLAG_UNMASK_IRQS, | ||
1013 | .pio_mask = ATA_PIO4, | ||
1014 | .mwdma_mask = ATA_MWDMA2, | ||
1015 | }; | ||
1016 | |||
1006 | /* | 1017 | /* |
1007 | * Setup, register & probe an IDE channel driven by this driver, this is | 1018 | * Setup, register & probe an IDE channel driven by this driver, this is |
1008 | * called by one of the 2 probe functions (macio or PCI). Note that a channel | 1019 | * called by one of the 2 probe functions (macio or PCI). Note that a channel |
@@ -1016,23 +1027,28 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
1016 | struct device_node *np = pmif->node; | 1027 | struct device_node *np = pmif->node; |
1017 | const int *bidp; | 1028 | const int *bidp; |
1018 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 1029 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
1030 | struct ide_port_info d = pmac_port_info; | ||
1019 | 1031 | ||
1020 | pmif->cable_80 = 0; | 1032 | pmif->cable_80 = 0; |
1021 | pmif->broken_dma = pmif->broken_dma_warn = 0; | 1033 | pmif->broken_dma = pmif->broken_dma_warn = 0; |
1022 | if (of_device_is_compatible(np, "shasta-ata")) | 1034 | if (of_device_is_compatible(np, "shasta-ata")) { |
1023 | pmif->kind = controller_sh_ata6; | 1035 | pmif->kind = controller_sh_ata6; |
1024 | else if (of_device_is_compatible(np, "kauai-ata")) | 1036 | d.udma_mask = ATA_UDMA6; |
1037 | } else if (of_device_is_compatible(np, "kauai-ata")) { | ||
1025 | pmif->kind = controller_un_ata6; | 1038 | pmif->kind = controller_un_ata6; |
1026 | else if (of_device_is_compatible(np, "K2-UATA")) | 1039 | d.udma_mask = ATA_UDMA5; |
1040 | } else if (of_device_is_compatible(np, "K2-UATA")) { | ||
1027 | pmif->kind = controller_k2_ata6; | 1041 | pmif->kind = controller_k2_ata6; |
1028 | else if (of_device_is_compatible(np, "keylargo-ata")) { | 1042 | d.udma_mask = ATA_UDMA5; |
1029 | if (strcmp(np->name, "ata-4") == 0) | 1043 | } else if (of_device_is_compatible(np, "keylargo-ata")) { |
1044 | if (strcmp(np->name, "ata-4") == 0) { | ||
1030 | pmif->kind = controller_kl_ata4; | 1045 | pmif->kind = controller_kl_ata4; |
1031 | else | 1046 | d.udma_mask = ATA_UDMA4; |
1047 | } else | ||
1032 | pmif->kind = controller_kl_ata3; | 1048 | pmif->kind = controller_kl_ata3; |
1033 | } else if (of_device_is_compatible(np, "heathrow-ata")) | 1049 | } else if (of_device_is_compatible(np, "heathrow-ata")) { |
1034 | pmif->kind = controller_heathrow; | 1050 | pmif->kind = controller_heathrow; |
1035 | else { | 1051 | } else { |
1036 | pmif->kind = controller_ohare; | 1052 | pmif->kind = controller_ohare; |
1037 | pmif->broken_dma = 1; | 1053 | pmif->broken_dma = 1; |
1038 | } | 1054 | } |
@@ -1101,19 +1117,10 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
1101 | /* Tell common code _not_ to mess with resources */ | 1117 | /* Tell common code _not_ to mess with resources */ |
1102 | hwif->mmio = 1; | 1118 | hwif->mmio = 1; |
1103 | hwif->hwif_data = pmif; | 1119 | hwif->hwif_data = pmif; |
1104 | hw->chipset = ide_pmac; | ||
1105 | ide_init_port_hw(hwif, hw); | 1120 | ide_init_port_hw(hwif, hw); |
1106 | hwif->noprobe = pmif->mediabay; | 1121 | hwif->noprobe = pmif->mediabay; |
1107 | hwif->hold = pmif->mediabay; | 1122 | hwif->hold = pmif->mediabay; |
1108 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; | 1123 | hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; |
1109 | hwif->drives[0].unmask = 1; | ||
1110 | hwif->drives[1].unmask = 1; | ||
1111 | hwif->drives[0].autotune = IDE_TUNE_AUTO; | ||
1112 | hwif->drives[1].autotune = IDE_TUNE_AUTO; | ||
1113 | hwif->host_flags = IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | | ||
1114 | IDE_HFLAG_PIO_NO_DOWNGRADE | | ||
1115 | IDE_HFLAG_POST_SET_MODE; | ||
1116 | hwif->pio_mask = ATA_PIO4; | ||
1117 | hwif->set_pio_mode = pmac_ide_set_pio_mode; | 1124 | hwif->set_pio_mode = pmac_ide_set_pio_mode; |
1118 | if (pmif->kind == controller_un_ata6 | 1125 | if (pmif->kind == controller_un_ata6 |
1119 | || pmif->kind == controller_k2_ata6 | 1126 | || pmif->kind == controller_k2_ata6 |
@@ -1133,14 +1140,16 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif, hw_regs_t *hw) | |||
1133 | #endif /* CONFIG_PMAC_MEDIABAY */ | 1140 | #endif /* CONFIG_PMAC_MEDIABAY */ |
1134 | 1141 | ||
1135 | #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC | 1142 | #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC |
1143 | if (pmif->cable_80 == 0) | ||
1144 | d.udma_mask &= ATA_UDMA2; | ||
1136 | /* has a DBDMA controller channel */ | 1145 | /* has a DBDMA controller channel */ |
1137 | if (pmif->dma_regs) | 1146 | if (pmif->dma_regs == 0 || pmac_ide_setup_dma(pmif, hwif) < 0) |
1138 | pmac_ide_setup_dma(pmif, hwif); | 1147 | #endif |
1139 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ | 1148 | d.udma_mask = d.mwdma_mask = 0; |
1140 | 1149 | ||
1141 | idx[0] = hwif->index; | 1150 | idx[0] = hwif->index; |
1142 | 1151 | ||
1143 | ide_device_add(idx); | 1152 | ide_device_add(idx, &d); |
1144 | 1153 | ||
1145 | return 0; | 1154 | return 0; |
1146 | } | 1155 | } |
@@ -1721,8 +1730,7 @@ pmac_ide_dma_lost_irq (ide_drive_t *drive) | |||
1721 | * Allocate the data structures needed for using DMA with an interface | 1730 | * Allocate the data structures needed for using DMA with an interface |
1722 | * and fill the proper list of functions pointers | 1731 | * and fill the proper list of functions pointers |
1723 | */ | 1732 | */ |
1724 | static void __devinit | 1733 | static int __devinit pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) |
1725 | pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | ||
1726 | { | 1734 | { |
1727 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 1735 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
1728 | 1736 | ||
@@ -1730,7 +1738,7 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1730 | * DMA routines ... | 1738 | * DMA routines ... |
1731 | */ | 1739 | */ |
1732 | if (dev == NULL) | 1740 | if (dev == NULL) |
1733 | return; | 1741 | return -ENODEV; |
1734 | /* | 1742 | /* |
1735 | * Allocate space for the DBDMA commands. | 1743 | * Allocate space for the DBDMA commands. |
1736 | * The +2 is +1 for the stop command and +1 to allow for | 1744 | * The +2 is +1 for the stop command and +1 to allow for |
@@ -1743,7 +1751,7 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1743 | if (pmif->dma_table_cpu == NULL) { | 1751 | if (pmif->dma_table_cpu == NULL) { |
1744 | printk(KERN_ERR "%s: unable to allocate DMA command list\n", | 1752 | printk(KERN_ERR "%s: unable to allocate DMA command list\n", |
1745 | hwif->name); | 1753 | hwif->name); |
1746 | return; | 1754 | return -ENOMEM; |
1747 | } | 1755 | } |
1748 | 1756 | ||
1749 | hwif->sg_max_nents = MAX_DCMDS; | 1757 | hwif->sg_max_nents = MAX_DCMDS; |
@@ -1757,29 +1765,7 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1757 | hwif->dma_timeout = &ide_dma_timeout; | 1765 | hwif->dma_timeout = &ide_dma_timeout; |
1758 | hwif->dma_lost_irq = &pmac_ide_dma_lost_irq; | 1766 | hwif->dma_lost_irq = &pmac_ide_dma_lost_irq; |
1759 | 1767 | ||
1760 | switch(pmif->kind) { | 1768 | return 0; |
1761 | case controller_sh_ata6: | ||
1762 | hwif->ultra_mask = pmif->cable_80 ? 0x7f : 0x07; | ||
1763 | hwif->mwdma_mask = 0x07; | ||
1764 | hwif->swdma_mask = 0x00; | ||
1765 | break; | ||
1766 | case controller_un_ata6: | ||
1767 | case controller_k2_ata6: | ||
1768 | hwif->ultra_mask = pmif->cable_80 ? 0x3f : 0x07; | ||
1769 | hwif->mwdma_mask = 0x07; | ||
1770 | hwif->swdma_mask = 0x00; | ||
1771 | break; | ||
1772 | case controller_kl_ata4: | ||
1773 | hwif->ultra_mask = pmif->cable_80 ? 0x1f : 0x07; | ||
1774 | hwif->mwdma_mask = 0x07; | ||
1775 | hwif->swdma_mask = 0x00; | ||
1776 | break; | ||
1777 | default: | ||
1778 | hwif->ultra_mask = 0x00; | ||
1779 | hwif->mwdma_mask = 0x07; | ||
1780 | hwif->swdma_mask = 0x00; | ||
1781 | break; | ||
1782 | } | ||
1783 | } | 1769 | } |
1784 | 1770 | ||
1785 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ | 1771 | #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ |
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 05db429a7da8..634e3f6a9608 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -339,7 +339,8 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info * | |||
339 | * ide_hwif_configure - configure an IDE interface | 339 | * ide_hwif_configure - configure an IDE interface |
340 | * @dev: PCI device holding interface | 340 | * @dev: PCI device holding interface |
341 | * @d: IDE port info | 341 | * @d: IDE port info |
342 | * @mate: Paired interface if any | 342 | * @port: port number |
343 | * @irq: PCI IRQ | ||
343 | * | 344 | * |
344 | * Perform the initial set up for the hardware interface structure. This | 345 | * Perform the initial set up for the hardware interface structure. This |
345 | * is done per interface port rather than per PCI device. There may be | 346 | * is done per interface port rather than per PCI device. There may be |
@@ -348,7 +349,9 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info * | |||
348 | * Returns the new hardware interface structure, or NULL on a failure | 349 | * Returns the new hardware interface structure, or NULL on a failure |
349 | */ | 350 | */ |
350 | 351 | ||
351 | static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *mate, int port, int irq) | 352 | static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, |
353 | const struct ide_port_info *d, | ||
354 | unsigned int port, int irq) | ||
352 | { | 355 | { |
353 | unsigned long ctl = 0, base = 0; | 356 | unsigned long ctl = 0, base = 0; |
354 | ide_hwif_t *hwif; | 357 | ide_hwif_t *hwif; |
@@ -394,29 +397,24 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port | |||
394 | 397 | ||
395 | hwif->dev = &dev->dev; | 398 | hwif->dev = &dev->dev; |
396 | hwif->cds = d; | 399 | hwif->cds = d; |
397 | hwif->channel = port; | ||
398 | 400 | ||
399 | if (mate) { | ||
400 | hwif->mate = mate; | ||
401 | mate->mate = hwif; | ||
402 | } | ||
403 | return hwif; | 401 | return hwif; |
404 | } | 402 | } |
405 | 403 | ||
404 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | ||
406 | /** | 405 | /** |
407 | * ide_hwif_setup_dma - configure DMA interface | 406 | * ide_hwif_setup_dma - configure DMA interface |
408 | * @dev: PCI device | ||
409 | * @d: IDE port info | ||
410 | * @hwif: IDE interface | 407 | * @hwif: IDE interface |
408 | * @d: IDE port info | ||
411 | * | 409 | * |
412 | * Set up the DMA base for the interface. Enable the master bits as | 410 | * Set up the DMA base for the interface. Enable the master bits as |
413 | * necessary and attempt to bring the device DMA into a ready to use | 411 | * necessary and attempt to bring the device DMA into a ready to use |
414 | * state | 412 | * state |
415 | */ | 413 | */ |
416 | 414 | ||
417 | static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *hwif) | 415 | void ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d) |
418 | { | 416 | { |
419 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 417 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
420 | u16 pcicmd; | 418 | u16 pcicmd; |
421 | 419 | ||
422 | pci_read_config_word(dev, PCI_COMMAND, &pcicmd); | 420 | pci_read_config_word(dev, PCI_COMMAND, &pcicmd); |
@@ -448,8 +446,8 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info * | |||
448 | "(BIOS)\n", hwif->name, d->name); | 446 | "(BIOS)\n", hwif->name, d->name); |
449 | } | 447 | } |
450 | } | 448 | } |
451 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ | ||
452 | } | 449 | } |
450 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ | ||
453 | 451 | ||
454 | /** | 452 | /** |
455 | * ide_setup_pci_controller - set up IDE PCI | 453 | * ide_setup_pci_controller - set up IDE PCI |
@@ -511,7 +509,7 @@ out: | |||
511 | void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int pciirq, u8 *idx) | 509 | void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int pciirq, u8 *idx) |
512 | { | 510 | { |
513 | int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; | 511 | int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; |
514 | ide_hwif_t *hwif, *mate = NULL; | 512 | ide_hwif_t *hwif; |
515 | u8 tmp; | 513 | u8 tmp; |
516 | 514 | ||
517 | /* | 515 | /* |
@@ -527,56 +525,11 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int | |||
527 | continue; /* port not enabled */ | 525 | continue; /* port not enabled */ |
528 | } | 526 | } |
529 | 527 | ||
530 | if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) | 528 | hwif = ide_hwif_configure(dev, d, port, pciirq); |
529 | if (hwif == NULL) | ||
531 | continue; | 530 | continue; |
532 | 531 | ||
533 | *(idx + port) = hwif->index; | 532 | *(idx + port) = hwif->index; |
534 | |||
535 | if (d->init_iops) | ||
536 | d->init_iops(hwif); | ||
537 | |||
538 | if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) | ||
539 | ide_hwif_setup_dma(dev, d, hwif); | ||
540 | |||
541 | if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) || | ||
542 | (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) | ||
543 | hwif->irq = port ? 15 : 14; | ||
544 | |||
545 | hwif->host_flags = d->host_flags; | ||
546 | hwif->pio_mask = d->pio_mask; | ||
547 | |||
548 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) | ||
549 | hwif->mate->serialized = hwif->serialized = 1; | ||
550 | |||
551 | if (d->host_flags & IDE_HFLAG_IO_32BIT) { | ||
552 | hwif->drives[0].io_32bit = 1; | ||
553 | hwif->drives[1].io_32bit = 1; | ||
554 | } | ||
555 | |||
556 | if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) { | ||
557 | hwif->drives[0].unmask = 1; | ||
558 | hwif->drives[1].unmask = 1; | ||
559 | } | ||
560 | |||
561 | if (hwif->dma_base) { | ||
562 | hwif->swdma_mask = d->swdma_mask; | ||
563 | hwif->mwdma_mask = d->mwdma_mask; | ||
564 | hwif->ultra_mask = d->udma_mask; | ||
565 | } | ||
566 | |||
567 | hwif->drives[0].autotune = 1; | ||
568 | hwif->drives[1].autotune = 1; | ||
569 | |||
570 | if (d->host_flags & IDE_HFLAG_RQSIZE_256) | ||
571 | hwif->rqsize = 256; | ||
572 | |||
573 | if (d->init_hwif) | ||
574 | /* Call chipset-specific routine | ||
575 | * for each enabled hwif | ||
576 | */ | ||
577 | d->init_hwif(hwif); | ||
578 | |||
579 | mate = hwif; | ||
580 | } | 533 | } |
581 | } | 534 | } |
582 | 535 | ||
@@ -658,7 +611,7 @@ int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d) | |||
658 | ret = do_ide_setup_pci_device(dev, d, &idx[0], 1); | 611 | ret = do_ide_setup_pci_device(dev, d, &idx[0], 1); |
659 | 612 | ||
660 | if (ret >= 0) | 613 | if (ret >= 0) |
661 | ide_device_add(idx); | 614 | ide_device_add(idx, d); |
662 | 615 | ||
663 | return ret; | 616 | return ret; |
664 | } | 617 | } |
@@ -682,7 +635,7 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, | |||
682 | goto out; | 635 | goto out; |
683 | } | 636 | } |
684 | 637 | ||
685 | ide_device_add(idx); | 638 | ide_device_add(idx, d); |
686 | out: | 639 | out: |
687 | return ret; | 640 | return ret; |
688 | } | 641 | } |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 2b889d91e673..28e155a9e2a5 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -1465,10 +1465,9 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb, | |||
1465 | orb->misc |= ORB_SET_DIRECTION(orb_direction); | 1465 | orb->misc |= ORB_SET_DIRECTION(orb_direction); |
1466 | 1466 | ||
1467 | /* special case if only one element (and less than 64KB in size) */ | 1467 | /* special case if only one element (and less than 64KB in size) */ |
1468 | if ((scsi_use_sg == 1) && | 1468 | if (scsi_use_sg == 1 && sg->length <= SBP2_MAX_SG_ELEMENT_LENGTH) { |
1469 | (sg_dma_len(sg) <= SBP2_MAX_SG_ELEMENT_LENGTH)) { | ||
1470 | 1469 | ||
1471 | cmd->dma_size = sg_dma_len(sg); | 1470 | cmd->dma_size = sg->length; |
1472 | cmd->dma_type = CMD_DMA_PAGE; | 1471 | cmd->dma_type = CMD_DMA_PAGE; |
1473 | cmd->cmd_dma = dma_map_page(hi->host->device.parent, | 1472 | cmd->cmd_dma = dma_map_page(hi->host->device.parent, |
1474 | sg_page(sg), sg->offset, | 1473 | sg_page(sg), sg->offset, |
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 1dc2ac9f3d1c..c5600ac5feb3 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/gameport.h> | 18 | #include <linux/gameport.h> |
19 | #include <linux/wait.h> | 19 | #include <linux/wait.h> |
20 | #include <linux/sched.h> | ||
21 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
22 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/kthread.h> | 22 | #include <linux/kthread.h> |
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c index e5f4da928340..05e3494cf8b8 100644 --- a/drivers/input/keyboard/bf54x-keys.c +++ b/drivers/input/keyboard/bf54x-keys.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/delay.h> | 42 | #include <linux/delay.h> |
43 | #include <linux/platform_device.h> | 43 | #include <linux/platform_device.h> |
44 | #include <linux/input.h> | 44 | #include <linux/input.h> |
45 | #include <linux/irq.h> | ||
46 | 45 | ||
47 | #include <asm/portmux.h> | 46 | #include <asm/portmux.h> |
48 | #include <asm/mach/bf54x_keys.h> | 47 | #include <asm/mach/bf54x_keys.h> |
diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c index e6696b3c9416..986f93cfc6b8 100644 --- a/drivers/input/keyboard/jornada720_kbd.c +++ b/drivers/input/keyboard/jornada720_kbd.c | |||
@@ -17,7 +17,6 @@ | |||
17 | */ | 17 | */ |
18 | #include <linux/device.h> | 18 | #include <linux/device.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/init.h> | ||
21 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
22 | #include <linux/init.h> | 21 | #include <linux/init.h> |
23 | #include <linux/input.h> | 22 | #include <linux/input.h> |
diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c index 3e99df6be084..adc3bd6e7f7b 100644 --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c | |||
@@ -141,7 +141,7 @@ static void gscps2_flush(struct gscps2port *ps2port) | |||
141 | /* | 141 | /* |
142 | * gscps2_writeb_output() - write a byte to the port | 142 | * gscps2_writeb_output() - write a byte to the port |
143 | * | 143 | * |
144 | * returns 1 on sucess, 0 on error | 144 | * returns 1 on success, 0 on error |
145 | */ | 145 | */ |
146 | 146 | ||
147 | static inline int gscps2_writeb_output(struct gscps2port *ps2port, u8 data) | 147 | static inline int gscps2_writeb_output(struct gscps2port *ps2port, u8 data) |
diff --git a/drivers/isdn/hardware/eicon/debuglib.c b/drivers/isdn/hardware/eicon/debuglib.c index a19b7ffe9ace..e39c5c1f623e 100644 --- a/drivers/isdn/hardware/eicon/debuglib.c +++ b/drivers/isdn/hardware/eicon/debuglib.c | |||
@@ -106,7 +106,7 @@ DbgRegister (char *drvName, char *drvTag, unsigned long dbgMask) | |||
106 | return (1) ; | 106 | return (1) ; |
107 | } | 107 | } |
108 | /* | 108 | /* |
109 | * Check if we registered whith an old maint driver (see debuglib.h) | 109 | * Check if we registered with an old maint driver (see debuglib.h) |
110 | */ | 110 | */ |
111 | if ( myDriverDebugHandle.dbg_end != NULL | 111 | if ( myDriverDebugHandle.dbg_end != NULL |
112 | /* location of 'dbg_prt' in _OldDbgHandle_ struct */ | 112 | /* location of 'dbg_prt' in _OldDbgHandle_ struct */ |
diff --git a/drivers/isdn/hardware/eicon/debuglib.h b/drivers/isdn/hardware/eicon/debuglib.h index 11b3b9edd1d6..016410cf2273 100644 --- a/drivers/isdn/hardware/eicon/debuglib.h +++ b/drivers/isdn/hardware/eicon/debuglib.h | |||
@@ -177,7 +177,7 @@ DBG_DECL(PRV3) | |||
177 | } } | 177 | } } |
178 | #endif | 178 | #endif |
179 | /* | 179 | /* |
180 | * For event level debug use a separate define, the paramete are | 180 | * For event level debug use a separate define, the parameter are |
181 | * different and cause compiler errors on some systems. | 181 | * different and cause compiler errors on some systems. |
182 | */ | 182 | */ |
183 | #define DBG_EVL_ID(args) \ | 183 | #define DBG_EVL_ID(args) \ |
diff --git a/drivers/isdn/hardware/eicon/di.c b/drivers/isdn/hardware/eicon/di.c index ce8df3878908..10760b3c5eb5 100644 --- a/drivers/isdn/hardware/eicon/di.c +++ b/drivers/isdn/hardware/eicon/di.c | |||
@@ -285,7 +285,7 @@ byte pr_dpc(ADAPTER * a) | |||
285 | a->ram_in(a, &RcIn->RcId), | 285 | a->ram_in(a, &RcIn->RcId), |
286 | a->ram_in(a, &RcIn->RcCh), | 286 | a->ram_in(a, &RcIn->RcCh), |
287 | a->ram_inw(a, &RcIn->Reference), | 287 | a->ram_inw(a, &RcIn->Reference), |
288 | tmp[0], /* type of extended informtion */ | 288 | tmp[0], /* type of extended information */ |
289 | tmp[1]); /* extended information */ | 289 | tmp[1]); /* extended information */ |
290 | a->ram_out(a, &RcIn->Rc, 0); | 290 | a->ram_out(a, &RcIn->Rc, 0); |
291 | } | 291 | } |
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c index ccd35d047ec8..b9177ca4369a 100644 --- a/drivers/isdn/hardware/eicon/message.c +++ b/drivers/isdn/hardware/eicon/message.c | |||
@@ -4941,7 +4941,7 @@ void sig_ind(PLCI * plci) | |||
4941 | /* b = IE1 */ | 4941 | /* b = IE1 */ |
4942 | /* S = IE1 length + cont. */ | 4942 | /* S = IE1 length + cont. */ |
4943 | /* b = IE2 */ | 4943 | /* b = IE2 */ |
4944 | /* S = IE2 lenght + cont. */ | 4944 | /* S = IE2 length + cont. */ |
4945 | sendf(plci->appl, | 4945 | sendf(plci->appl, |
4946 | _MANUFACTURER_I, | 4946 | _MANUFACTURER_I, |
4947 | Id, | 4947 | Id, |
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index f85450146bdc..d3999a8e9f88 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -541,7 +541,7 @@ hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len) | |||
541 | } | 541 | } |
542 | ctrl = &cinfo->capi_ctrl; | 542 | ctrl = &cinfo->capi_ctrl; |
543 | if(len < CAPI_MSG_BASELEN) { | 543 | if(len < CAPI_MSG_BASELEN) { |
544 | printk(KERN_ERR "HYSDN Card%d: invalid CAPI-message, lenght %d!\n", | 544 | printk(KERN_ERR "HYSDN Card%d: invalid CAPI-message, length %d!\n", |
545 | card->myid, len); | 545 | card->myid, len); |
546 | return; | 546 | return; |
547 | } | 547 | } |
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index e2eec38c83c2..84f85e23cca7 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -52,57 +52,82 @@ struct lguest_device { | |||
52 | /*D:130 | 52 | /*D:130 |
53 | * Device configurations | 53 | * Device configurations |
54 | * | 54 | * |
55 | * The configuration information for a device consists of a series of fields. | 55 | * The configuration information for a device consists of one or more |
56 | * We don't really care what they are: the Launcher set them up, and the driver | 56 | * virtqueues, a feature bitmaks, and some configuration bytes. The |
57 | * will look at them during setup. | 57 | * configuration bytes don't really matter to us: the Launcher sets them up, and |
58 | * the driver will look at them during setup. | ||
58 | * | 59 | * |
59 | * For us these fields come immediately after that device's descriptor in the | 60 | * A convenient routine to return the device's virtqueue config array: |
60 | * lguest_devices page. | 61 | * immediately after the descriptor. */ |
61 | * | 62 | static struct lguest_vqconfig *lg_vq(const struct lguest_device_desc *desc) |
62 | * Each field starts with a "type" byte, a "length" byte, then that number of | 63 | { |
63 | * bytes of configuration information. The device descriptor tells us the | 64 | return (void *)(desc + 1); |
64 | * total configuration length so we know when we've reached the last field. */ | 65 | } |
65 | 66 | ||
66 | /* type + length bytes */ | 67 | /* The features come immediately after the virtqueues. */ |
67 | #define FHDR_LEN 2 | 68 | static u8 *lg_features(const struct lguest_device_desc *desc) |
69 | { | ||
70 | return (void *)(lg_vq(desc) + desc->num_vq); | ||
71 | } | ||
68 | 72 | ||
69 | /* This finds the first field of a given type for a device's configuration. */ | 73 | /* The config space comes after the two feature bitmasks. */ |
70 | static void *lg_find(struct virtio_device *vdev, u8 type, unsigned int *len) | 74 | static u8 *lg_config(const struct lguest_device_desc *desc) |
71 | { | 75 | { |
72 | struct lguest_device_desc *desc = to_lgdev(vdev)->desc; | 76 | return lg_features(desc) + desc->feature_len * 2; |
73 | int i; | 77 | } |
74 | |||
75 | for (i = 0; i < desc->config_len; i += FHDR_LEN + desc->config[i+1]) { | ||
76 | if (desc->config[i] == type) { | ||
77 | /* Mark it used, so Host can know we looked at it, and | ||
78 | * also so we won't find the same one twice. */ | ||
79 | desc->config[i] |= 0x80; | ||
80 | /* Remember, the second byte is the length. */ | ||
81 | *len = desc->config[i+1]; | ||
82 | /* We return a pointer to the field header. */ | ||
83 | return desc->config + i; | ||
84 | } | ||
85 | } | ||
86 | 78 | ||
87 | /* Not found: return NULL for failure. */ | 79 | /* The total size of the config page used by this device (incl. desc) */ |
88 | return NULL; | 80 | static unsigned desc_size(const struct lguest_device_desc *desc) |
81 | { | ||
82 | return sizeof(*desc) | ||
83 | + desc->num_vq * sizeof(struct lguest_vqconfig) | ||
84 | + desc->feature_len * 2 | ||
85 | + desc->config_len; | ||
86 | } | ||
87 | |||
88 | /* This tests (and acknowleges) a feature bit. */ | ||
89 | static bool lg_feature(struct virtio_device *vdev, unsigned fbit) | ||
90 | { | ||
91 | struct lguest_device_desc *desc = to_lgdev(vdev)->desc; | ||
92 | u8 *features; | ||
93 | |||
94 | /* Obviously if they ask for a feature off the end of our feature | ||
95 | * bitmap, it's not set. */ | ||
96 | if (fbit / 8 > desc->feature_len) | ||
97 | return false; | ||
98 | |||
99 | /* The feature bitmap comes after the virtqueues. */ | ||
100 | features = lg_features(desc); | ||
101 | if (!(features[fbit / 8] & (1 << (fbit % 8)))) | ||
102 | return false; | ||
103 | |||
104 | /* We set the matching bit in the other half of the bitmap to tell the | ||
105 | * Host we want to use this feature. We don't use this yet, but we | ||
106 | * could in future. */ | ||
107 | features[desc->feature_len + fbit / 8] |= (1 << (fbit % 8)); | ||
108 | return true; | ||
89 | } | 109 | } |
90 | 110 | ||
91 | /* Once they've found a field, getting a copy of it is easy. */ | 111 | /* Once they've found a field, getting a copy of it is easy. */ |
92 | static void lg_get(struct virtio_device *vdev, void *token, | 112 | static void lg_get(struct virtio_device *vdev, unsigned int offset, |
93 | void *buf, unsigned len) | 113 | void *buf, unsigned len) |
94 | { | 114 | { |
95 | /* Check they didn't ask for more than the length of the field! */ | 115 | struct lguest_device_desc *desc = to_lgdev(vdev)->desc; |
96 | BUG_ON(len > ((u8 *)token)[1]); | 116 | |
97 | memcpy(buf, token + FHDR_LEN, len); | 117 | /* Check they didn't ask for more than the length of the config! */ |
118 | BUG_ON(offset + len > desc->config_len); | ||
119 | memcpy(buf, lg_config(desc) + offset, len); | ||
98 | } | 120 | } |
99 | 121 | ||
100 | /* Setting the contents is also trivial. */ | 122 | /* Setting the contents is also trivial. */ |
101 | static void lg_set(struct virtio_device *vdev, void *token, | 123 | static void lg_set(struct virtio_device *vdev, unsigned int offset, |
102 | const void *buf, unsigned len) | 124 | const void *buf, unsigned len) |
103 | { | 125 | { |
104 | BUG_ON(len > ((u8 *)token)[1]); | 126 | struct lguest_device_desc *desc = to_lgdev(vdev)->desc; |
105 | memcpy(token + FHDR_LEN, buf, len); | 127 | |
128 | /* Check they didn't ask for more than the length of the config! */ | ||
129 | BUG_ON(offset + len > desc->config_len); | ||
130 | memcpy(lg_config(desc) + offset, buf, len); | ||
106 | } | 131 | } |
107 | 132 | ||
108 | /* The operations to get and set the status word just access the status field | 133 | /* The operations to get and set the status word just access the status field |
@@ -114,9 +139,20 @@ static u8 lg_get_status(struct virtio_device *vdev) | |||
114 | 139 | ||
115 | static void lg_set_status(struct virtio_device *vdev, u8 status) | 140 | static void lg_set_status(struct virtio_device *vdev, u8 status) |
116 | { | 141 | { |
142 | BUG_ON(!status); | ||
117 | to_lgdev(vdev)->desc->status = status; | 143 | to_lgdev(vdev)->desc->status = status; |
118 | } | 144 | } |
119 | 145 | ||
146 | /* To reset the device, we (ab)use the NOTIFY hypercall, with the descriptor | ||
147 | * address of the device. The Host will zero the status and all the | ||
148 | * features. */ | ||
149 | static void lg_reset(struct virtio_device *vdev) | ||
150 | { | ||
151 | unsigned long offset = (void *)to_lgdev(vdev)->desc - lguest_devices; | ||
152 | |||
153 | hcall(LHCALL_NOTIFY, (max_pfn<<PAGE_SHIFT) + offset, 0, 0); | ||
154 | } | ||
155 | |||
120 | /* | 156 | /* |
121 | * Virtqueues | 157 | * Virtqueues |
122 | * | 158 | * |
@@ -165,39 +201,29 @@ static void lg_notify(struct virtqueue *vq) | |||
165 | * | 201 | * |
166 | * So we provide devices with a "find virtqueue and set it up" function. */ | 202 | * So we provide devices with a "find virtqueue and set it up" function. */ |
167 | static struct virtqueue *lg_find_vq(struct virtio_device *vdev, | 203 | static struct virtqueue *lg_find_vq(struct virtio_device *vdev, |
168 | bool (*callback)(struct virtqueue *vq)) | 204 | unsigned index, |
205 | void (*callback)(struct virtqueue *vq)) | ||
169 | { | 206 | { |
207 | struct lguest_device *ldev = to_lgdev(vdev); | ||
170 | struct lguest_vq_info *lvq; | 208 | struct lguest_vq_info *lvq; |
171 | struct virtqueue *vq; | 209 | struct virtqueue *vq; |
172 | unsigned int len; | ||
173 | void *token; | ||
174 | int err; | 210 | int err; |
175 | 211 | ||
176 | /* Look for a field of the correct type to mark a virtqueue. Note that | 212 | /* We must have this many virtqueues. */ |
177 | * if this succeeds, then the type will be changed so it won't be found | 213 | if (index >= ldev->desc->num_vq) |
178 | * again, and future lg_find_vq() calls will find the next | ||
179 | * virtqueue (if any). */ | ||
180 | token = vdev->config->find(vdev, VIRTIO_CONFIG_F_VIRTQUEUE, &len); | ||
181 | if (!token) | ||
182 | return ERR_PTR(-ENOENT); | 214 | return ERR_PTR(-ENOENT); |
183 | 215 | ||
184 | lvq = kmalloc(sizeof(*lvq), GFP_KERNEL); | 216 | lvq = kmalloc(sizeof(*lvq), GFP_KERNEL); |
185 | if (!lvq) | 217 | if (!lvq) |
186 | return ERR_PTR(-ENOMEM); | 218 | return ERR_PTR(-ENOMEM); |
187 | 219 | ||
188 | /* Note: we could use a configuration space inside here, just like we | 220 | /* Make a copy of the "struct lguest_vqconfig" entry, which sits after |
189 | * do for the device. This would allow expansion in future, because | 221 | * the descriptor. We need a copy because the config space might not |
190 | * our configuration system is designed to be expansible. But this is | 222 | * be aligned correctly. */ |
191 | * way easier. */ | 223 | memcpy(&lvq->config, lg_vq(ldev->desc)+index, sizeof(lvq->config)); |
192 | if (len != sizeof(lvq->config)) { | ||
193 | dev_err(&vdev->dev, "Unexpected virtio config len %u\n", len); | ||
194 | err = -EIO; | ||
195 | goto free_lvq; | ||
196 | } | ||
197 | /* Make a copy of the "struct lguest_vqconfig" field. We need a copy | ||
198 | * because the config space might not be aligned correctly. */ | ||
199 | vdev->config->get(vdev, token, &lvq->config, sizeof(lvq->config)); | ||
200 | 224 | ||
225 | printk("Mapping virtqueue %i addr %lx\n", index, | ||
226 | (unsigned long)lvq->config.pfn << PAGE_SHIFT); | ||
201 | /* Figure out how many pages the ring will take, and map that memory */ | 227 | /* Figure out how many pages the ring will take, and map that memory */ |
202 | lvq->pages = lguest_map((unsigned long)lvq->config.pfn << PAGE_SHIFT, | 228 | lvq->pages = lguest_map((unsigned long)lvq->config.pfn << PAGE_SHIFT, |
203 | DIV_ROUND_UP(vring_size(lvq->config.num, | 229 | DIV_ROUND_UP(vring_size(lvq->config.num, |
@@ -259,11 +285,12 @@ static void lg_del_vq(struct virtqueue *vq) | |||
259 | 285 | ||
260 | /* The ops structure which hooks everything together. */ | 286 | /* The ops structure which hooks everything together. */ |
261 | static struct virtio_config_ops lguest_config_ops = { | 287 | static struct virtio_config_ops lguest_config_ops = { |
262 | .find = lg_find, | 288 | .feature = lg_feature, |
263 | .get = lg_get, | 289 | .get = lg_get, |
264 | .set = lg_set, | 290 | .set = lg_set, |
265 | .get_status = lg_get_status, | 291 | .get_status = lg_get_status, |
266 | .set_status = lg_set_status, | 292 | .set_status = lg_set_status, |
293 | .reset = lg_reset, | ||
267 | .find_vq = lg_find_vq, | 294 | .find_vq = lg_find_vq, |
268 | .del_vq = lg_del_vq, | 295 | .del_vq = lg_del_vq, |
269 | }; | 296 | }; |
@@ -329,13 +356,14 @@ static void scan_devices(void) | |||
329 | struct lguest_device_desc *d; | 356 | struct lguest_device_desc *d; |
330 | 357 | ||
331 | /* We start at the page beginning, and skip over each entry. */ | 358 | /* We start at the page beginning, and skip over each entry. */ |
332 | for (i = 0; i < PAGE_SIZE; i += sizeof(*d) + d->config_len) { | 359 | for (i = 0; i < PAGE_SIZE; i += desc_size(d)) { |
333 | d = lguest_devices + i; | 360 | d = lguest_devices + i; |
334 | 361 | ||
335 | /* Once we hit a zero, stop. */ | 362 | /* Once we hit a zero, stop. */ |
336 | if (d->type == 0) | 363 | if (d->type == 0) |
337 | break; | 364 | break; |
338 | 365 | ||
366 | printk("Device at %i has size %u\n", i, desc_size(d)); | ||
339 | add_lguest_device(d); | 367 | add_lguest_device(d); |
340 | } | 368 | } |
341 | } | 369 | } |
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index 7ce0ea64465c..28958101061f 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/completion.h> | 36 | #include <linux/completion.h> |
37 | #include <linux/device.h> | 37 | #include <linux/device.h> |
38 | #include <linux/kthread.h> | 38 | #include <linux/kthread.h> |
39 | #include <linux/platform_device.h> | ||
39 | 40 | ||
40 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
41 | #include <asm/semaphore.h> | 42 | #include <asm/semaphore.h> |
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index 18dde2a27209..de9ebbfbf122 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c | |||
@@ -595,7 +595,7 @@ static void media_bay_step(int i) | |||
595 | if (bay->cd_index >= 0) { | 595 | if (bay->cd_index >= 0) { |
596 | printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i, | 596 | printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i, |
597 | bay->cd_index); | 597 | bay->cd_index); |
598 | ide_unregister(bay->cd_index); | 598 | ide_unregister(bay->cd_index, 1, 1); |
599 | bay->cd_index = -1; | 599 | bay->cd_index = -1; |
600 | } | 600 | } |
601 | if (bay->cd_retry) { | 601 | if (bay->cd_retry) { |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index d409f6759482..8ba49385c3ff 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
@@ -12,7 +12,7 @@ | |||
12 | * - maybe add timeout to commands ? | 12 | * - maybe add timeout to commands ? |
13 | * - blocking version of time functions | 13 | * - blocking version of time functions |
14 | * - polling version of i2c commands (including timer that works with | 14 | * - polling version of i2c commands (including timer that works with |
15 | * interrutps off) | 15 | * interrupts off) |
16 | * - maybe avoid some data copies with i2c by directly using the smu cmd | 16 | * - maybe avoid some data copies with i2c by directly using the smu cmd |
17 | * buffer and a lower level internal interface | 17 | * buffer and a lower level internal interface |
18 | * - understand SMU -> CPU events and implement reception of them via | 18 | * - understand SMU -> CPU events and implement reception of them via |
@@ -179,7 +179,7 @@ static irqreturn_t smu_db_intr(int irq, void *arg) | |||
179 | /* CPU might have brought back the cache line, so we need | 179 | /* CPU might have brought back the cache line, so we need |
180 | * to flush again before peeking at the SMU response. We | 180 | * to flush again before peeking at the SMU response. We |
181 | * flush the entire buffer for now as we haven't read the | 181 | * flush the entire buffer for now as we haven't read the |
182 | * reply lenght (it's only 2 cache lines anyway) | 182 | * reply length (it's only 2 cache lines anyway) |
183 | */ | 183 | */ |
184 | faddr = (unsigned long)smu->cmd_buf; | 184 | faddr = (unsigned long)smu->cmd_buf; |
185 | flush_inval_dcache_range(faddr, faddr + 256); | 185 | flush_inval_dcache_range(faddr, faddr + 256); |
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index 7d04a6fd1acb..168a8d3a5e55 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -388,7 +388,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
388 | } | 388 | } |
389 | dev->revision &= 0xf; | 389 | dev->revision &= 0xf; |
390 | 390 | ||
391 | /* remap the memory from virtual to physical adress */ | 391 | /* remap the memory from virtual to physical address */ |
392 | 392 | ||
393 | err = pci_request_region(pci, 0, "saa7146"); | 393 | err = pci_request_region(pci, 0, "saa7146"); |
394 | if (err < 0) | 394 | if (err < 0) |
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c index a33eb5988c42..ed3f8268ed11 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.c +++ b/drivers/media/dvb/dvb-core/dvb_net.c | |||
@@ -681,7 +681,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) | |||
681 | drop = 1; | 681 | drop = 1; |
682 | /* else: destination address matches the MAC address of our receiver device */ | 682 | /* else: destination address matches the MAC address of our receiver device */ |
683 | } | 683 | } |
684 | /* else: promiscious mode; pass everything up the stack */ | 684 | /* else: promiscuous mode; pass everything up the stack */ |
685 | 685 | ||
686 | if (drop) { | 686 | if (drop) { |
687 | #ifdef ULE_DEBUG | 687 | #ifdef ULE_DEBUG |
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 63a47cd4c161..7374c02dd183 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -4344,7 +4344,7 @@ static void rv605_muxsel(struct bttv *btv, unsigned int input) | |||
4344 | gpio_bits(0x200,0x000); | 4344 | gpio_bits(0x200,0x000); |
4345 | mdelay(1); | 4345 | mdelay(1); |
4346 | 4346 | ||
4347 | /* create a new conection */ | 4347 | /* create a new connection */ |
4348 | gpio_bits(0x480,0x080); | 4348 | gpio_bits(0x480,0x080); |
4349 | gpio_bits(0x480,0x480); | 4349 | gpio_bits(0x480,0x480); |
4350 | mdelay(1); | 4350 | mdelay(1); |
diff --git a/drivers/media/video/indycam.c b/drivers/media/video/indycam.c index 5c2c4029ff86..84b9e4f2b3b3 100644 --- a/drivers/media/video/indycam.c +++ b/drivers/media/video/indycam.c | |||
@@ -326,7 +326,7 @@ static int indycam_attach(struct i2c_adapter *adap, int addr, int kind) | |||
326 | // initialize | 326 | // initialize |
327 | err = indycam_write_block(client, 0, sizeof(initseq), (u8 *)&initseq); | 327 | err = indycam_write_block(client, 0, sizeof(initseq), (u8 *)&initseq); |
328 | if (err) { | 328 | if (err) { |
329 | printk(KERN_ERR "IndyCam initalization failed\n"); | 329 | printk(KERN_ERR "IndyCam initialization failed\n"); |
330 | err = -EIO; | 330 | err = -EIO; |
331 | goto out_detach_client; | 331 | goto out_detach_client; |
332 | } | 332 | } |
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index b630c26cfe85..58bab653330f 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c | |||
@@ -369,7 +369,7 @@ static struct dvb_tuner_ops mt2032_tuner_ops = { | |||
369 | .get_frequency = microtune_get_frequency, | 369 | .get_frequency = microtune_get_frequency, |
370 | }; | 370 | }; |
371 | 371 | ||
372 | // Initalization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 | 372 | // Initialization as described in "MT203x Programming Procedures", Rev 1.2, Feb.2001 |
373 | static int mt2032_init(struct dvb_frontend *fe) | 373 | static int mt2032_init(struct dvb_frontend *fe) |
374 | { | 374 | { |
375 | struct microtune_priv *priv = fe->tuner_priv; | 375 | struct microtune_priv *priv = fe->tuner_priv; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2.h b/drivers/media/video/pvrusb2/pvrusb2.h index 074533e9c21e..1a9a4baf12b8 100644 --- a/drivers/media/video/pvrusb2/pvrusb2.h +++ b/drivers/media/video/pvrusb2/pvrusb2.h | |||
@@ -27,7 +27,7 @@ | |||
27 | might want to increase this - however the driver operation will not | 27 | might want to increase this - however the driver operation will not |
28 | be impaired if it is too small. Instead additional units just | 28 | be impaired if it is too small. Instead additional units just |
29 | won't have an ID assigned and it might not be possible to specify | 29 | won't have an ID assigned and it might not be possible to specify |
30 | module paramters for those extra units. */ | 30 | module parameters for those extra units. */ |
31 | #define PVR_NUM 20 | 31 | #define PVR_NUM 20 |
32 | 32 | ||
33 | #endif /* __PVRUSB2_H */ | 33 | #endif /* __PVRUSB2_H */ |
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 7300ace8f44e..f991d72fe108 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -542,7 +542,7 @@ int pwc_handle_frame(struct pwc_device *pdev) | |||
542 | } | 542 | } |
543 | 543 | ||
544 | if (pdev->read_frame != NULL) { | 544 | if (pdev->read_frame != NULL) { |
545 | /* Decompression is a lenghty process, so it's outside of the lock. | 545 | /* Decompression is a lengthy process, so it's outside of the lock. |
546 | This gives the isoc_handler the opportunity to fill more frames | 546 | This gives the isoc_handler the opportunity to fill more frames |
547 | in the mean time. | 547 | in the mean time. |
548 | */ | 548 | */ |
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index e0ff811fab6f..ca05cd655087 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c | |||
@@ -57,7 +57,7 @@ static int tea6420_switch(struct i2c_client *client, int i, int o, int g) | |||
57 | 57 | ||
58 | dprintk("adr:0x%02x, i:%d, o:%d, g:%d\n", client->addr, i, o, g); | 58 | dprintk("adr:0x%02x, i:%d, o:%d, g:%d\n", client->addr, i, o, g); |
59 | 59 | ||
60 | /* check if the paramters are valid */ | 60 | /* check if the parameters are valid */ |
61 | if (i < 1 || i > 6 || o < 1 || o > 4 || g < 0 || g > 6 || g % 2 != 0) | 61 | if (i < 1 || i > 6 || o < 1 || o > 4 || g < 0 || g > 6 || g % 2 != 0) |
62 | return -1; | 62 | return -1; |
63 | 63 | ||
diff --git a/drivers/media/video/usbvideo/quickcam_messenger.c b/drivers/media/video/usbvideo/quickcam_messenger.c index d847273eeba0..5e7b79501370 100644 --- a/drivers/media/video/usbvideo/quickcam_messenger.c +++ b/drivers/media/video/usbvideo/quickcam_messenger.c | |||
@@ -258,7 +258,7 @@ static void qcm_hsv2rgb(u16 hue, u16 sat, u16 val, u16 *r, u16 *g, u16 *b) | |||
258 | unsigned int p; | 258 | unsigned int p; |
259 | 259 | ||
260 | /* | 260 | /* |
261 | the registers controling gain are 8 bit of which | 261 | the registers controlling gain are 8 bit of which |
262 | we affect only the last 4 bits with our gain. | 262 | we affect only the last 4 bits with our gain. |
263 | we know that if saturation is 0, (unsaturated) then | 263 | we know that if saturation is 0, (unsaturated) then |
264 | we're grayscale (center axis of the colour cone) so | 264 | we're grayscale (center axis of the colour cone) so |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index b52b826a30be..df52f8a60215 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -131,7 +131,7 @@ static struct usbvision_v4l2_format_st usbvision_v4l2_format[] = { | |||
131 | /* Function prototypes */ | 131 | /* Function prototypes */ |
132 | static void usbvision_release(struct usb_usbvision *usbvision); | 132 | static void usbvision_release(struct usb_usbvision *usbvision); |
133 | 133 | ||
134 | /* Default initalization of device driver parameters */ | 134 | /* Default initialization of device driver parameters */ |
135 | /* Set the default format for ISOC endpoint */ | 135 | /* Set the default format for ISOC endpoint */ |
136 | static int isocMode = ISOC_MODE_COMPRESS; | 136 | static int isocMode = ISOC_MODE_COMPRESS; |
137 | /* Set the default Debug Mode of the device driver */ | 137 | /* Set the default Debug Mode of the device driver */ |
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 8ef31ed7d3f1..a9133858e913 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c | |||
@@ -566,7 +566,7 @@ vpx3220_init_client (struct i2c_client *client) | |||
566 | } | 566 | } |
567 | 567 | ||
568 | /* ----------------------------------------------------------------------- | 568 | /* ----------------------------------------------------------------------- |
569 | * Client managment code | 569 | * Client management code |
570 | */ | 570 | */ |
571 | 571 | ||
572 | /* | 572 | /* |
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index 6e0ac4c5c379..690281bb59ee 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c | |||
@@ -1270,7 +1270,7 @@ zoran_setup_videocodec (struct zoran *zr, | |||
1270 | } | 1270 | } |
1271 | 1271 | ||
1272 | /* | 1272 | /* |
1273 | * Scan for a Buz card (actually for the PCI contoler ZR36057), | 1273 | * Scan for a Buz card (actually for the PCI controller ZR36057), |
1274 | * request the irq and map the io memory | 1274 | * request the irq and map the io memory |
1275 | */ | 1275 | */ |
1276 | static int __devinit | 1276 | static int __devinit |
diff --git a/drivers/media/video/zr36050.c b/drivers/media/video/zr36050.c index 9f622e00c479..faae4ec3ea0b 100644 --- a/drivers/media/video/zr36050.c +++ b/drivers/media/video/zr36050.c | |||
@@ -161,7 +161,7 @@ zr36050_wait_end (struct zr36050 *ptr) | |||
161 | udelay(1); | 161 | udelay(1); |
162 | if (i++ > 200000) { // 200ms, there is for sure something wrong!!! | 162 | if (i++ > 200000) { // 200ms, there is for sure something wrong!!! |
163 | dprintk(1, | 163 | dprintk(1, |
164 | "%s: timout at wait_end (last status: 0x%02x)\n", | 164 | "%s: timeout at wait_end (last status: 0x%02x)\n", |
165 | ptr->name, ptr->status1); | 165 | ptr->name, ptr->status1); |
166 | break; | 166 | break; |
167 | } | 167 | } |
diff --git a/drivers/media/video/zr36060.c b/drivers/media/video/zr36060.c index 1ef14fef08e6..7849b65969d0 100644 --- a/drivers/media/video/zr36060.c +++ b/drivers/media/video/zr36060.c | |||
@@ -163,7 +163,7 @@ zr36060_wait_end (struct zr36060 *ptr) | |||
163 | udelay(1); | 163 | udelay(1); |
164 | if (i++ > 200000) { // 200ms, there is for sure something wrong!!! | 164 | if (i++ > 200000) { // 200ms, there is for sure something wrong!!! |
165 | dprintk(1, | 165 | dprintk(1, |
166 | "%s: timout at wait_end (last status: 0x%02x)\n", | 166 | "%s: timeout at wait_end (last status: 0x%02x)\n", |
167 | ptr->name, ptr->status); | 167 | ptr->name, ptr->status); |
168 | break; | 168 | break; |
169 | } | 169 | } |
diff --git a/drivers/message/fusion/lsi/mpi_log_sas.h b/drivers/message/fusion/lsi/mpi_log_sas.h index 6be1f6b65777..af9da03e95e5 100644 --- a/drivers/message/fusion/lsi/mpi_log_sas.h +++ b/drivers/message/fusion/lsi/mpi_log_sas.h | |||
@@ -162,7 +162,7 @@ | |||
162 | #define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */ | 162 | #define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */ |
163 | /* Bit 0 is Status Bit 0: FrameXferErr */ | 163 | /* Bit 0 is Status Bit 0: FrameXferErr */ |
164 | /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */ | 164 | /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */ |
165 | /* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */ | 165 | /* Bit 3 is Status Bit 18 WriteDataLengthGTDataLengthErr */ |
166 | 166 | ||
167 | #define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500) | 167 | #define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW (0x00000500) |
168 | #define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600) | 168 | #define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET (0x00000600) |
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 6029509702d3..e630b50966ec 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -1708,7 +1708,7 @@ mptctl_replace_fw (unsigned long arg) | |||
1708 | * | 1708 | * |
1709 | * Outputs: None. | 1709 | * Outputs: None. |
1710 | * Return: 0 if successful | 1710 | * Return: 0 if successful |
1711 | * -EBUSY if previous command timout and IOC reset is not complete. | 1711 | * -EBUSY if previous command timeout and IOC reset is not complete. |
1712 | * -EFAULT if data unavailable | 1712 | * -EFAULT if data unavailable |
1713 | * -ENODEV if no such device/adapter | 1713 | * -ENODEV if no such device/adapter |
1714 | * -ETIME if timer expires | 1714 | * -ETIME if timer expires |
@@ -1748,7 +1748,7 @@ mptctl_mpt_command (unsigned long arg) | |||
1748 | * | 1748 | * |
1749 | * Outputs: None. | 1749 | * Outputs: None. |
1750 | * Return: 0 if successful | 1750 | * Return: 0 if successful |
1751 | * -EBUSY if previous command timout and IOC reset is not complete. | 1751 | * -EBUSY if previous command timeout and IOC reset is not complete. |
1752 | * -EFAULT if data unavailable | 1752 | * -EFAULT if data unavailable |
1753 | * -ENODEV if no such device/adapter | 1753 | * -ENODEV if no such device/adapter |
1754 | * -ETIME if timer expires | 1754 | * -ETIME if timer expires |
@@ -2316,7 +2316,7 @@ done_free_mem: | |||
2316 | * Outputs: None. | 2316 | * Outputs: None. |
2317 | * Return: 0 if successful | 2317 | * Return: 0 if successful |
2318 | * -EFAULT if data unavailable | 2318 | * -EFAULT if data unavailable |
2319 | * -EBUSY if previous command timout and IOC reset is not complete. | 2319 | * -EBUSY if previous command timeout and IOC reset is not complete. |
2320 | * -ENODEV if no such device/adapter | 2320 | * -ENODEV if no such device/adapter |
2321 | * -ETIME if timer expires | 2321 | * -ETIME if timer expires |
2322 | * -ENOMEM if memory allocation error | 2322 | * -ENOMEM if memory allocation error |
@@ -2553,7 +2553,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) | |||
2553 | * Outputs: None. | 2553 | * Outputs: None. |
2554 | * Return: 0 if successful | 2554 | * Return: 0 if successful |
2555 | * -EFAULT if data unavailable | 2555 | * -EFAULT if data unavailable |
2556 | * -EBUSY if previous command timout and IOC reset is not complete. | 2556 | * -EBUSY if previous command timeout and IOC reset is not complete. |
2557 | * -ENODEV if no such device/adapter | 2557 | * -ENODEV if no such device/adapter |
2558 | * -ETIME if timer expires | 2558 | * -ETIME if timer expires |
2559 | * -ENOMEM if memory allocation error | 2559 | * -ENOMEM if memory allocation error |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 5c614ec38cc4..af1de0ccee2f 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -1736,7 +1736,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i | |||
1736 | fail_out: | 1736 | fail_out: |
1737 | 1737 | ||
1738 | /* | 1738 | /* |
1739 | * Free task managment mf, and corresponding tm flags | 1739 | * Free task management mf, and corresponding tm flags |
1740 | */ | 1740 | */ |
1741 | mpt_free_msg_frame(ioc, mf); | 1741 | mpt_free_msg_frame(ioc, mf); |
1742 | hd->tmPending = 0; | 1742 | hd->tmPending = 0; |
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c index 7814a06ae970..da715e11c1b2 100644 --- a/drivers/message/i2o/iop.c +++ b/drivers/message/i2o/iop.c | |||
@@ -916,7 +916,7 @@ static int i2o_parse_hrt(struct i2o_controller *c) | |||
916 | * status block. The status block could then be accessed through | 916 | * status block. The status block could then be accessed through |
917 | * c->status_block. | 917 | * c->status_block. |
918 | * | 918 | * |
919 | * Returns 0 on sucess or negative error code on failure. | 919 | * Returns 0 on success or negative error code on failure. |
920 | */ | 920 | */ |
921 | int i2o_status_get(struct i2o_controller *c) | 921 | int i2o_status_get(struct i2o_controller *c) |
922 | { | 922 | { |
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c index c73e96bfafc6..90acf57c19bd 100644 --- a/drivers/mtd/devices/doc2000.c +++ b/drivers/mtd/devices/doc2000.c | |||
@@ -376,7 +376,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip) | |||
376 | * hardware restriction. */ | 376 | * hardware restriction. */ |
377 | if (doc->mfr) { | 377 | if (doc->mfr) { |
378 | if (doc->mfr == mfr && doc->id == id) | 378 | if (doc->mfr == mfr && doc->id == id) |
379 | return 1; /* This is another the same the first */ | 379 | return 1; /* This is the same as the first */ |
380 | else | 380 | else |
381 | printk(KERN_WARNING | 381 | printk(KERN_WARNING |
382 | "Flash chip at floor %d, chip %d is different:\n", | 382 | "Flash chip at floor %d, chip %d is different:\n", |
diff --git a/drivers/mtd/nand/autcpu12.c b/drivers/mtd/nand/autcpu12.c index e3744eb8eccb..dd38011ee0b7 100644 --- a/drivers/mtd/nand/autcpu12.c +++ b/drivers/mtd/nand/autcpu12.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * | 20 | * |
21 | * 02-12-2002 TG Cleanup of module params | 21 | * 02-12-2002 TG Cleanup of module params |
22 | * | 22 | * |
23 | * 02-20-2002 TG adjusted for different rd/wr adress support | 23 | * 02-20-2002 TG adjusted for different rd/wr address support |
24 | * added support for read device ready/busy line | 24 | * added support for read device ready/busy line |
25 | * added page_cache | 25 | * added page_cache |
26 | * | 26 | * |
@@ -144,7 +144,7 @@ static int __init autcpu12_init(void) | |||
144 | goto out; | 144 | goto out; |
145 | } | 145 | } |
146 | 146 | ||
147 | /* map physical adress */ | 147 | /* map physical address */ |
148 | autcpu12_fio_base = ioremap(AUTCPU12_PHYS_SMC, SZ_1K); | 148 | autcpu12_fio_base = ioremap(AUTCPU12_PHYS_SMC, SZ_1K); |
149 | if (!autcpu12_fio_base) { | 149 | if (!autcpu12_fio_base) { |
150 | printk("Ioremap autcpu12 SmartMedia Card failed\n"); | 150 | printk("Ioremap autcpu12 SmartMedia Card failed\n"); |
@@ -227,7 +227,7 @@ static void __exit autcpu12_cleanup(void) | |||
227 | /* Release resources, unregister device */ | 227 | /* Release resources, unregister device */ |
228 | nand_release(autcpu12_mtd); | 228 | nand_release(autcpu12_mtd); |
229 | 229 | ||
230 | /* unmap physical adress */ | 230 | /* unmap physical address */ |
231 | iounmap(autcpu12_fio_base); | 231 | iounmap(autcpu12_fio_base); |
232 | 232 | ||
233 | /* Free the MTD device structure */ | 233 | /* Free the MTD device structure */ |
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c index 1657ecd74881..a52f3a737c39 100644 --- a/drivers/mtd/nand/bf5xx_nand.c +++ b/drivers/mtd/nand/bf5xx_nand.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * http://blackfin.uclinux.org/ | 4 | * http://blackfin.uclinux.org/ |
5 | * Bryan Wu <bryan.wu@analog.com> | 5 | * Bryan Wu <bryan.wu@analog.com> |
6 | * | 6 | * |
7 | * Blackfin BF5xx on-chip NAND flash controler driver | 7 | * Blackfin BF5xx on-chip NAND flash controller driver |
8 | * | 8 | * |
9 | * Derived from drivers/mtd/nand/s3c2410.c | 9 | * Derived from drivers/mtd/nand/s3c2410.c |
10 | * Copyright (c) 2007 Ben Dooks <ben@simtec.co.uk> | 10 | * Copyright (c) 2007 Ben Dooks <ben@simtec.co.uk> |
diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c index 89deff007116..19e1594421a4 100644 --- a/drivers/mtd/nand/cs553x_nand.c +++ b/drivers/mtd/nand/cs553x_nand.c | |||
@@ -337,7 +337,7 @@ static void __exit cs553x_cleanup(void) | |||
337 | nand_release(cs553x_mtd[i]); | 337 | nand_release(cs553x_mtd[i]); |
338 | cs553x_mtd[i] = NULL; | 338 | cs553x_mtd[i] = NULL; |
339 | 339 | ||
340 | /* unmap physical adress */ | 340 | /* unmap physical address */ |
341 | iounmap(mmio_base); | 341 | iounmap(mmio_base); |
342 | 342 | ||
343 | /* Free the MTD device structure */ | 343 | /* Free the MTD device structure */ |
diff --git a/drivers/mtd/nand/edb7312.c b/drivers/mtd/nand/edb7312.c index 0146cdc48039..ba67bbec20d3 100644 --- a/drivers/mtd/nand/edb7312.c +++ b/drivers/mtd/nand/edb7312.c | |||
@@ -125,7 +125,7 @@ static int __init ep7312_init(void) | |||
125 | return -ENOMEM; | 125 | return -ENOMEM; |
126 | } | 126 | } |
127 | 127 | ||
128 | /* map physical adress */ | 128 | /* map physical address */ |
129 | ep7312_fio_base = ioremap(ep7312_fio_pbase, SZ_1K); | 129 | ep7312_fio_base = ioremap(ep7312_fio_pbase, SZ_1K); |
130 | if (!ep7312_fio_base) { | 130 | if (!ep7312_fio_base) { |
131 | printk("ioremap EDB7312 NAND flash failed\n"); | 131 | printk("ioremap EDB7312 NAND flash failed\n"); |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index e29c1da7f56e..ddd4fc019042 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -89,7 +89,7 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, | |||
89 | struct mtd_oob_ops *ops); | 89 | struct mtd_oob_ops *ops); |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * For devices which display every fart in the system on a seperate LED. Is | 92 | * For devices which display every fart in the system on a separate LED. Is |
93 | * compiled away when LED support is disabled. | 93 | * compiled away when LED support is disabled. |
94 | */ | 94 | */ |
95 | DEFINE_LED_TRIGGER(nand_led_trigger); | 95 | DEFINE_LED_TRIGGER(nand_led_trigger); |
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index 10490b48d9f7..bb885d1fcab5 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c | |||
@@ -210,7 +210,7 @@ MODULE_PARM_DESC(overridesize, "Specifies the NAND Flash size overriding the I | |||
210 | #define STATE_CMD_RESET 0x0000000C /* reset */ | 210 | #define STATE_CMD_RESET 0x0000000C /* reset */ |
211 | #define STATE_CMD_MASK 0x0000000F /* command states mask */ | 211 | #define STATE_CMD_MASK 0x0000000F /* command states mask */ |
212 | 212 | ||
213 | /* After an addres is input, the simulator goes to one of these states */ | 213 | /* After an address is input, the simulator goes to one of these states */ |
214 | #define STATE_ADDR_PAGE 0x00000010 /* full (row, column) address is accepted */ | 214 | #define STATE_ADDR_PAGE 0x00000010 /* full (row, column) address is accepted */ |
215 | #define STATE_ADDR_SEC 0x00000020 /* sector address was accepted */ | 215 | #define STATE_ADDR_SEC 0x00000020 /* sector address was accepted */ |
216 | #define STATE_ADDR_ZERO 0x00000030 /* one byte zero address was accepted */ | 216 | #define STATE_ADDR_ZERO 0x00000030 /* one byte zero address was accepted */ |
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index 66f76e9618dd..2bd0737572c6 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * | 8 | * |
9 | * Changelog: | 9 | * Changelog: |
10 | * 21-Sep-2004 BJD Initial version | 10 | * 21-Sep-2004 BJD Initial version |
11 | * 23-Sep-2004 BJD Mulitple device support | 11 | * 23-Sep-2004 BJD Multiple device support |
12 | * 28-Sep-2004 BJD Fixed ECC placement for Hardware mode | 12 | * 28-Sep-2004 BJD Fixed ECC placement for Hardware mode |
13 | * 12-Oct-2004 BJD Fixed errors in use of platform data | 13 | * 12-Oct-2004 BJD Fixed errors in use of platform data |
14 | * 18-Feb-2005 BJD Fix sparse errors | 14 | * 18-Feb-2005 BJD Fix sparse errors |
diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c index 51c7288ab49a..033f8800b1e6 100644 --- a/drivers/mtd/nand/sharpsl.c +++ b/drivers/mtd/nand/sharpsl.c | |||
@@ -165,7 +165,7 @@ static int __init sharpsl_nand_init(void) | |||
165 | return -ENOMEM; | 165 | return -ENOMEM; |
166 | } | 166 | } |
167 | 167 | ||
168 | /* map physical adress */ | 168 | /* map physical address */ |
169 | sharpsl_io_base = ioremap(sharpsl_phys_base, 0x1000); | 169 | sharpsl_io_base = ioremap(sharpsl_phys_base, 0x1000); |
170 | if (!sharpsl_io_base) { | 170 | if (!sharpsl_io_base) { |
171 | printk("ioremap to access Sharp SL NAND chip failed\n"); | 171 | printk("ioremap to access Sharp SL NAND chip failed\n"); |
diff --git a/drivers/mtd/nftlmount.c b/drivers/mtd/nftlmount.c index 067262ee8df0..0513cbc8834d 100644 --- a/drivers/mtd/nftlmount.c +++ b/drivers/mtd/nftlmount.c | |||
@@ -429,7 +429,7 @@ static void check_sectors_in_chain(struct NFTLrecord *nftl, unsigned int first_b | |||
429 | } | 429 | } |
430 | } | 430 | } |
431 | 431 | ||
432 | /* calc_chain_lenght: Walk through a Virtual Unit Chain and estimate chain length */ | 432 | /* calc_chain_length: Walk through a Virtual Unit Chain and estimate chain length */ |
433 | static int calc_chain_length(struct NFTLrecord *nftl, unsigned int first_block) | 433 | static int calc_chain_length(struct NFTLrecord *nftl, unsigned int first_block) |
434 | { | 434 | { |
435 | unsigned int length = 0, block = first_block; | 435 | unsigned int length = 0, block = first_block; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 389980f0e59e..f234ba3f0404 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -814,8 +814,8 @@ config ULTRA32 | |||
814 | will be called smc-ultra32. | 814 | will be called smc-ultra32. |
815 | 815 | ||
816 | config BFIN_MAC | 816 | config BFIN_MAC |
817 | tristate "Blackfin 536/537 on-chip mac support" | 817 | tristate "Blackfin 527/536/537 on-chip mac support" |
818 | depends on NET_ETHERNET && (BF537 || BF536) && (!BF537_PORT_H) | 818 | depends on NET_ETHERNET && (BF527 || BF537 || BF536) && (!BF537_PORT_H) |
819 | select CRC32 | 819 | select CRC32 |
820 | select MII | 820 | select MII |
821 | select PHYLIB | 821 | select PHYLIB |
@@ -828,7 +828,7 @@ config BFIN_MAC | |||
828 | 828 | ||
829 | config BFIN_MAC_USE_L1 | 829 | config BFIN_MAC_USE_L1 |
830 | bool "Use L1 memory for rx/tx packets" | 830 | bool "Use L1 memory for rx/tx packets" |
831 | depends on BFIN_MAC && BF537 | 831 | depends on BFIN_MAC && (BF527 || BF537) |
832 | default y | 832 | default y |
833 | help | 833 | help |
834 | To get maximum network performance, you should use L1 memory as rx/tx buffers. | 834 | To get maximum network performance, you should use L1 memory as rx/tx buffers. |
@@ -855,7 +855,8 @@ config BFIN_RX_DESC_NUM | |||
855 | config BFIN_MAC_RMII | 855 | config BFIN_MAC_RMII |
856 | bool "RMII PHY Interface (EXPERIMENTAL)" | 856 | bool "RMII PHY Interface (EXPERIMENTAL)" |
857 | depends on BFIN_MAC && EXPERIMENTAL | 857 | depends on BFIN_MAC && EXPERIMENTAL |
858 | default n | 858 | default y if BFIN527_EZKIT |
859 | default n if BFIN537_STAMP | ||
859 | help | 860 | help |
860 | Use Reduced PHY MII Interface | 861 | Use Reduced PHY MII Interface |
861 | 862 | ||
@@ -1199,7 +1200,7 @@ config NE2_MCA | |||
1199 | 1200 | ||
1200 | config IBMLANA | 1201 | config IBMLANA |
1201 | tristate "IBM LAN Adapter/A support" | 1202 | tristate "IBM LAN Adapter/A support" |
1202 | depends on MCA && MCA_LEGACY | 1203 | depends on MCA |
1203 | ---help--- | 1204 | ---help--- |
1204 | This is a Micro Channel Ethernet adapter. You need to set | 1205 | This is a Micro Channel Ethernet adapter. You need to set |
1205 | CONFIG_MCA to use this driver. It is both available as an in-kernel | 1206 | CONFIG_MCA to use this driver. It is both available as an in-kernel |
@@ -3113,6 +3114,7 @@ config VIRTIO_NET | |||
3113 | tristate "Virtio network driver (EXPERIMENTAL)" | 3114 | tristate "Virtio network driver (EXPERIMENTAL)" |
3114 | depends on EXPERIMENTAL && VIRTIO | 3115 | depends on EXPERIMENTAL && VIRTIO |
3115 | ---help--- | 3116 | ---help--- |
3116 | This is the virtual network driver for lguest. Say Y or M. | 3117 | This is the virtual network driver for virtio. It can be used with |
3118 | lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. | ||
3117 | 3119 | ||
3118 | endif # NETDEVICES | 3120 | endif # NETDEVICES |
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index 25b114a4e2b1..0ae0d83e5d22 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c | |||
@@ -384,7 +384,7 @@ static void reset_phy(struct net_device *dev) | |||
384 | /* Wait until PHY reset is complete */ | 384 | /* Wait until PHY reset is complete */ |
385 | do { | 385 | do { |
386 | read_phy(lp->phy_address, MII_BMCR, &bmcr); | 386 | read_phy(lp->phy_address, MII_BMCR, &bmcr); |
387 | } while (!(bmcr && BMCR_RESET)); | 387 | } while (!(bmcr & BMCR_RESET)); |
388 | 388 | ||
389 | disable_mdi(); | 389 | disable_mdi(); |
390 | spin_unlock_irq(&lp->lock); | 390 | spin_unlock_irq(&lp->lock); |
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c index 7495a9ee8f4b..194949afacd0 100644 --- a/drivers/net/ax88796.c +++ b/drivers/net/ax88796.c | |||
@@ -137,11 +137,12 @@ static int ax_initial_check(struct net_device *dev) | |||
137 | static void ax_reset_8390(struct net_device *dev) | 137 | static void ax_reset_8390(struct net_device *dev) |
138 | { | 138 | { |
139 | struct ei_device *ei_local = netdev_priv(dev); | 139 | struct ei_device *ei_local = netdev_priv(dev); |
140 | struct ax_device *ax = to_ax_dev(dev); | ||
140 | unsigned long reset_start_time = jiffies; | 141 | unsigned long reset_start_time = jiffies; |
141 | void __iomem *addr = (void __iomem *)dev->base_addr; | 142 | void __iomem *addr = (void __iomem *)dev->base_addr; |
142 | 143 | ||
143 | if (ei_debug > 1) | 144 | if (ei_debug > 1) |
144 | printk(KERN_DEBUG "resetting the 8390 t=%ld...", jiffies); | 145 | dev_dbg(&ax->dev->dev, "resetting the 8390 t=%ld\n", jiffies); |
145 | 146 | ||
146 | ei_outb(ei_inb(addr + NE_RESET), addr + NE_RESET); | 147 | ei_outb(ei_inb(addr + NE_RESET), addr + NE_RESET); |
147 | 148 | ||
@@ -151,7 +152,7 @@ static void ax_reset_8390(struct net_device *dev) | |||
151 | /* This check _should_not_ be necessary, omit eventually. */ | 152 | /* This check _should_not_ be necessary, omit eventually. */ |
152 | while ((ei_inb(addr + EN0_ISR) & ENISR_RESET) == 0) { | 153 | while ((ei_inb(addr + EN0_ISR) & ENISR_RESET) == 0) { |
153 | if (jiffies - reset_start_time > 2*HZ/100) { | 154 | if (jiffies - reset_start_time > 2*HZ/100) { |
154 | printk(KERN_WARNING "%s: %s did not complete.\n", | 155 | dev_warn(&ax->dev->dev, "%s: %s did not complete.\n", |
155 | __FUNCTION__, dev->name); | 156 | __FUNCTION__, dev->name); |
156 | break; | 157 | break; |
157 | } | 158 | } |
@@ -165,13 +166,15 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, | |||
165 | int ring_page) | 166 | int ring_page) |
166 | { | 167 | { |
167 | struct ei_device *ei_local = netdev_priv(dev); | 168 | struct ei_device *ei_local = netdev_priv(dev); |
169 | struct ax_device *ax = to_ax_dev(dev); | ||
168 | void __iomem *nic_base = ei_local->mem; | 170 | void __iomem *nic_base = ei_local->mem; |
169 | 171 | ||
170 | /* This *shouldn't* happen. If it does, it's the last thing you'll see */ | 172 | /* This *shouldn't* happen. If it does, it's the last thing you'll see */ |
171 | if (ei_status.dmaing) { | 173 | if (ei_status.dmaing) { |
172 | printk(KERN_EMERG "%s: DMAing conflict in %s [DMAstat:%d][irqlock:%d].\n", | 174 | dev_err(&ax->dev->dev, "%s: DMAing conflict in %s " |
175 | "[DMAstat:%d][irqlock:%d].\n", | ||
173 | dev->name, __FUNCTION__, | 176 | dev->name, __FUNCTION__, |
174 | ei_status.dmaing, ei_status.irqlock); | 177 | ei_status.dmaing, ei_status.irqlock); |
175 | return; | 178 | return; |
176 | } | 179 | } |
177 | 180 | ||
@@ -204,13 +207,16 @@ static void ax_block_input(struct net_device *dev, int count, | |||
204 | struct sk_buff *skb, int ring_offset) | 207 | struct sk_buff *skb, int ring_offset) |
205 | { | 208 | { |
206 | struct ei_device *ei_local = netdev_priv(dev); | 209 | struct ei_device *ei_local = netdev_priv(dev); |
210 | struct ax_device *ax = to_ax_dev(dev); | ||
207 | void __iomem *nic_base = ei_local->mem; | 211 | void __iomem *nic_base = ei_local->mem; |
208 | char *buf = skb->data; | 212 | char *buf = skb->data; |
209 | 213 | ||
210 | if (ei_status.dmaing) { | 214 | if (ei_status.dmaing) { |
211 | printk(KERN_EMERG "%s: DMAing conflict in ax_block_input " | 215 | dev_err(&ax->dev->dev, |
216 | "%s: DMAing conflict in %s " | ||
212 | "[DMAstat:%d][irqlock:%d].\n", | 217 | "[DMAstat:%d][irqlock:%d].\n", |
213 | dev->name, ei_status.dmaing, ei_status.irqlock); | 218 | dev->name, __FUNCTION__, |
219 | ei_status.dmaing, ei_status.irqlock); | ||
214 | return; | 220 | return; |
215 | } | 221 | } |
216 | 222 | ||
@@ -239,6 +245,7 @@ static void ax_block_output(struct net_device *dev, int count, | |||
239 | const unsigned char *buf, const int start_page) | 245 | const unsigned char *buf, const int start_page) |
240 | { | 246 | { |
241 | struct ei_device *ei_local = netdev_priv(dev); | 247 | struct ei_device *ei_local = netdev_priv(dev); |
248 | struct ax_device *ax = to_ax_dev(dev); | ||
242 | void __iomem *nic_base = ei_local->mem; | 249 | void __iomem *nic_base = ei_local->mem; |
243 | unsigned long dma_start; | 250 | unsigned long dma_start; |
244 | 251 | ||
@@ -251,7 +258,7 @@ static void ax_block_output(struct net_device *dev, int count, | |||
251 | 258 | ||
252 | /* This *shouldn't* happen. If it does, it's the last thing you'll see */ | 259 | /* This *shouldn't* happen. If it does, it's the last thing you'll see */ |
253 | if (ei_status.dmaing) { | 260 | if (ei_status.dmaing) { |
254 | printk(KERN_EMERG "%s: DMAing conflict in %s." | 261 | dev_err(&ax->dev->dev, "%s: DMAing conflict in %s." |
255 | "[DMAstat:%d][irqlock:%d]\n", | 262 | "[DMAstat:%d][irqlock:%d]\n", |
256 | dev->name, __FUNCTION__, | 263 | dev->name, __FUNCTION__, |
257 | ei_status.dmaing, ei_status.irqlock); | 264 | ei_status.dmaing, ei_status.irqlock); |
@@ -281,7 +288,8 @@ static void ax_block_output(struct net_device *dev, int count, | |||
281 | 288 | ||
282 | while ((ei_inb(nic_base + EN0_ISR) & ENISR_RDC) == 0) { | 289 | while ((ei_inb(nic_base + EN0_ISR) & ENISR_RDC) == 0) { |
283 | if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ | 290 | if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ |
284 | printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); | 291 | dev_warn(&ax->dev->dev, |
292 | "%s: timeout waiting for Tx RDC.\n", dev->name); | ||
285 | ax_reset_8390(dev); | 293 | ax_reset_8390(dev); |
286 | ax_NS8390_init(dev,1); | 294 | ax_NS8390_init(dev,1); |
287 | break; | 295 | break; |
@@ -424,10 +432,11 @@ static void | |||
424 | ax_phy_write(struct net_device *dev, int phy_addr, int reg, int value) | 432 | ax_phy_write(struct net_device *dev, int phy_addr, int reg, int value) |
425 | { | 433 | { |
426 | struct ei_device *ei = (struct ei_device *) netdev_priv(dev); | 434 | struct ei_device *ei = (struct ei_device *) netdev_priv(dev); |
435 | struct ax_device *ax = to_ax_dev(dev); | ||
427 | unsigned long flags; | 436 | unsigned long flags; |
428 | 437 | ||
429 | printk(KERN_DEBUG "%s: %p, %04x, %04x %04x\n", | 438 | dev_dbg(&ax->dev->dev, "%s: %p, %04x, %04x %04x\n", |
430 | __FUNCTION__, dev, phy_addr, reg, value); | 439 | __FUNCTION__, dev, phy_addr, reg, value); |
431 | 440 | ||
432 | spin_lock_irqsave(&ei->page_lock, flags); | 441 | spin_lock_irqsave(&ei->page_lock, flags); |
433 | 442 | ||
@@ -750,14 +759,11 @@ static int ax_init_dev(struct net_device *dev, int first_init) | |||
750 | ax_NS8390_init(dev, 0); | 759 | ax_NS8390_init(dev, 0); |
751 | 760 | ||
752 | if (first_init) { | 761 | if (first_init) { |
753 | printk("AX88796: %dbit, irq %d, %lx, MAC: ", | 762 | DECLARE_MAC_BUF(mac); |
754 | ei_status.word16 ? 16:8, dev->irq, dev->base_addr); | ||
755 | |||
756 | for (i = 0; i < ETHER_ADDR_LEN; i++) | ||
757 | printk("%2.2x%c", dev->dev_addr[i], | ||
758 | (i < (ETHER_ADDR_LEN-1) ? ':' : ' ')); | ||
759 | 763 | ||
760 | printk("\n"); | 764 | dev_info(&ax->dev->dev, "%dbit, irq %d, %lx, MAC: %s\n", |
765 | ei_status.word16 ? 16:8, dev->irq, dev->base_addr, | ||
766 | print_mac(mac, dev->dev_addr)); | ||
761 | } | 767 | } |
762 | 768 | ||
763 | ret = register_netdev(dev); | 769 | ret = register_netdev(dev); |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index eb971755a3ff..c993a32b3f50 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -1,34 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * File: drivers/net/bfin_mac.c | 2 | * Blackfin On-Chip MAC Driver |
3 | * Based on: | ||
4 | * Maintainer: | ||
5 | * Bryan Wu <bryan.wu@analog.com> | ||
6 | * | 3 | * |
7 | * Original author: | 4 | * Copyright 2004-2007 Analog Devices Inc. |
8 | * Luke Yang <luke.yang@analog.com> | ||
9 | * | 5 | * |
10 | * Created: | 6 | * Enter bugs at http://blackfin.uclinux.org/ |
11 | * Description: | ||
12 | * | 7 | * |
13 | * Modified: | 8 | * Licensed under the GPL-2 or later. |
14 | * Copyright 2004-2006 Analog Devices Inc. | ||
15 | * | ||
16 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
17 | * | ||
18 | * This program is free software ; you can redistribute it and/or modify | ||
19 | * it under the terms of the GNU General Public License as published by | ||
20 | * the Free Software Foundation ; either version 2, or (at your option) | ||
21 | * any later version. | ||
22 | * | ||
23 | * This program is distributed in the hope that it will be useful, | ||
24 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
26 | * GNU General Public License for more details. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License | ||
29 | * along with this program ; see the file COPYING. | ||
30 | * If not, write to the Free Software Foundation, | ||
31 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
32 | */ | 9 | */ |
33 | 10 | ||
34 | #include <linux/init.h> | 11 | #include <linux/init.h> |
@@ -65,7 +42,7 @@ | |||
65 | #define DRV_NAME "bfin_mac" | 42 | #define DRV_NAME "bfin_mac" |
66 | #define DRV_VERSION "1.1" | 43 | #define DRV_VERSION "1.1" |
67 | #define DRV_AUTHOR "Bryan Wu, Luke Yang" | 44 | #define DRV_AUTHOR "Bryan Wu, Luke Yang" |
68 | #define DRV_DESC "Blackfin BF53[67] on-chip Ethernet MAC driver" | 45 | #define DRV_DESC "Blackfin BF53[67] BF527 on-chip Ethernet MAC driver" |
69 | 46 | ||
70 | MODULE_AUTHOR(DRV_AUTHOR); | 47 | MODULE_AUTHOR(DRV_AUTHOR); |
71 | MODULE_LICENSE("GPL"); | 48 | MODULE_LICENSE("GPL"); |
@@ -296,7 +273,7 @@ static void mdio_poll(void) | |||
296 | 273 | ||
297 | /* poll the STABUSY bit */ | 274 | /* poll the STABUSY bit */ |
298 | while ((bfin_read_EMAC_STAADD()) & STABUSY) { | 275 | while ((bfin_read_EMAC_STAADD()) & STABUSY) { |
299 | mdelay(10); | 276 | udelay(1); |
300 | if (timeout_cnt-- < 0) { | 277 | if (timeout_cnt-- < 0) { |
301 | printk(KERN_ERR DRV_NAME | 278 | printk(KERN_ERR DRV_NAME |
302 | ": wait MDC/MDIO transaction to complete timeout\n"); | 279 | ": wait MDC/MDIO transaction to complete timeout\n"); |
@@ -412,20 +389,26 @@ static void bf537_adjust_link(struct net_device *dev) | |||
412 | spin_unlock_irqrestore(&lp->lock, flags); | 389 | spin_unlock_irqrestore(&lp->lock, flags); |
413 | } | 390 | } |
414 | 391 | ||
392 | /* MDC = 2.5 MHz */ | ||
393 | #define MDC_CLK 2500000 | ||
394 | |||
415 | static int mii_probe(struct net_device *dev) | 395 | static int mii_probe(struct net_device *dev) |
416 | { | 396 | { |
417 | struct bf537mac_local *lp = netdev_priv(dev); | 397 | struct bf537mac_local *lp = netdev_priv(dev); |
418 | struct phy_device *phydev = NULL; | 398 | struct phy_device *phydev = NULL; |
419 | unsigned short sysctl; | 399 | unsigned short sysctl; |
420 | int i; | 400 | int i; |
401 | u32 sclk, mdc_div; | ||
421 | 402 | ||
422 | /* Enable PHY output early */ | 403 | /* Enable PHY output early */ |
423 | if (!(bfin_read_VR_CTL() & PHYCLKOE)) | 404 | if (!(bfin_read_VR_CTL() & PHYCLKOE)) |
424 | bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE); | 405 | bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE); |
425 | 406 | ||
426 | /* MDC = 2.5 MHz */ | 407 | sclk = get_sclk(); |
408 | mdc_div = ((sclk / MDC_CLK) / 2) - 1; | ||
409 | |||
427 | sysctl = bfin_read_EMAC_SYSCTL(); | 410 | sysctl = bfin_read_EMAC_SYSCTL(); |
428 | sysctl |= SET_MDCDIV(24); | 411 | sysctl = (sysctl & ~MDCDIV) | SET_MDCDIV(mdc_div); |
429 | bfin_write_EMAC_SYSCTL(sysctl); | 412 | bfin_write_EMAC_SYSCTL(sysctl); |
430 | 413 | ||
431 | /* search for connect PHY device */ | 414 | /* search for connect PHY device */ |
@@ -477,8 +460,10 @@ static int mii_probe(struct net_device *dev) | |||
477 | lp->phydev = phydev; | 460 | lp->phydev = phydev; |
478 | 461 | ||
479 | printk(KERN_INFO "%s: attached PHY driver [%s] " | 462 | printk(KERN_INFO "%s: attached PHY driver [%s] " |
480 | "(mii_bus:phy_addr=%s, irq=%d)\n", | 463 | "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)" |
481 | DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq); | 464 | "@sclk=%dMHz)\n", |
465 | DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq, | ||
466 | MDC_CLK, mdc_div, sclk/1000000); | ||
482 | 467 | ||
483 | return 0; | 468 | return 0; |
484 | } | 469 | } |
@@ -551,7 +536,7 @@ static void adjust_tx_list(void) | |||
551 | */ | 536 | */ |
552 | if (current_tx_ptr->next->next == tx_list_head) { | 537 | if (current_tx_ptr->next->next == tx_list_head) { |
553 | while (tx_list_head->status.status_word == 0) { | 538 | while (tx_list_head->status.status_word == 0) { |
554 | mdelay(10); | 539 | mdelay(1); |
555 | if (tx_list_head->status.status_word != 0 | 540 | if (tx_list_head->status.status_word != 0 |
556 | || !(bfin_read_DMA2_IRQ_STATUS() & 0x08)) { | 541 | || !(bfin_read_DMA2_IRQ_STATUS() & 0x08)) { |
557 | goto adjust_head; | 542 | goto adjust_head; |
@@ -666,6 +651,12 @@ static void bf537mac_rx(struct net_device *dev) | |||
666 | current_rx_ptr->skb = new_skb; | 651 | current_rx_ptr->skb = new_skb; |
667 | current_rx_ptr->desc_a.start_addr = (unsigned long)new_skb->data - 2; | 652 | current_rx_ptr->desc_a.start_addr = (unsigned long)new_skb->data - 2; |
668 | 653 | ||
654 | /* Invidate the data cache of skb->data range when it is write back | ||
655 | * cache. It will prevent overwritting the new data from DMA | ||
656 | */ | ||
657 | blackfin_dcache_invalidate_range((unsigned long)new_skb->head, | ||
658 | (unsigned long)new_skb->end); | ||
659 | |||
669 | len = (unsigned short)((current_rx_ptr->status.status_word) & RX_FRLEN); | 660 | len = (unsigned short)((current_rx_ptr->status.status_word) & RX_FRLEN); |
670 | skb_put(skb, len); | 661 | skb_put(skb, len); |
671 | blackfin_dcache_invalidate_range((unsigned long)skb->head, | 662 | blackfin_dcache_invalidate_range((unsigned long)skb->head, |
@@ -767,7 +758,7 @@ static void bf537mac_enable(void) | |||
767 | 758 | ||
768 | #if defined(CONFIG_BFIN_MAC_RMII) | 759 | #if defined(CONFIG_BFIN_MAC_RMII) |
769 | opmode |= RMII; /* For Now only 100MBit are supported */ | 760 | opmode |= RMII; /* For Now only 100MBit are supported */ |
770 | #ifdef CONFIG_BF_REV_0_2 | 761 | #if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) && CONFIG_BF_REV_0_2 |
771 | opmode |= TE; | 762 | opmode |= TE; |
772 | #endif | 763 | #endif |
773 | #endif | 764 | #endif |
@@ -792,6 +783,39 @@ static void bf537mac_timeout(struct net_device *dev) | |||
792 | netif_wake_queue(dev); | 783 | netif_wake_queue(dev); |
793 | } | 784 | } |
794 | 785 | ||
786 | static void bf537mac_multicast_hash(struct net_device *dev) | ||
787 | { | ||
788 | u32 emac_hashhi, emac_hashlo; | ||
789 | struct dev_mc_list *dmi = dev->mc_list; | ||
790 | char *addrs; | ||
791 | int i; | ||
792 | u32 crc; | ||
793 | |||
794 | emac_hashhi = emac_hashlo = 0; | ||
795 | |||
796 | for (i = 0; i < dev->mc_count; i++) { | ||
797 | addrs = dmi->dmi_addr; | ||
798 | dmi = dmi->next; | ||
799 | |||
800 | /* skip non-multicast addresses */ | ||
801 | if (!(*addrs & 1)) | ||
802 | continue; | ||
803 | |||
804 | crc = ether_crc(ETH_ALEN, addrs); | ||
805 | crc >>= 26; | ||
806 | |||
807 | if (crc & 0x20) | ||
808 | emac_hashhi |= 1 << (crc & 0x1f); | ||
809 | else | ||
810 | emac_hashlo |= 1 << (crc & 0x1f); | ||
811 | } | ||
812 | |||
813 | bfin_write_EMAC_HASHHI(emac_hashhi); | ||
814 | bfin_write_EMAC_HASHLO(emac_hashlo); | ||
815 | |||
816 | return; | ||
817 | } | ||
818 | |||
795 | /* | 819 | /* |
796 | * This routine will, depending on the values passed to it, | 820 | * This routine will, depending on the values passed to it, |
797 | * either make it accept multicast packets, go into | 821 | * either make it accept multicast packets, go into |
@@ -807,11 +831,17 @@ static void bf537mac_set_multicast_list(struct net_device *dev) | |||
807 | sysctl = bfin_read_EMAC_OPMODE(); | 831 | sysctl = bfin_read_EMAC_OPMODE(); |
808 | sysctl |= RAF; | 832 | sysctl |= RAF; |
809 | bfin_write_EMAC_OPMODE(sysctl); | 833 | bfin_write_EMAC_OPMODE(sysctl); |
810 | } else if (dev->flags & IFF_ALLMULTI || dev->mc_count) { | 834 | } else if (dev->flags & IFF_ALLMULTI) { |
811 | /* accept all multicast */ | 835 | /* accept all multicast */ |
812 | sysctl = bfin_read_EMAC_OPMODE(); | 836 | sysctl = bfin_read_EMAC_OPMODE(); |
813 | sysctl |= PAM; | 837 | sysctl |= PAM; |
814 | bfin_write_EMAC_OPMODE(sysctl); | 838 | bfin_write_EMAC_OPMODE(sysctl); |
839 | } else if (dev->mc_count) { | ||
840 | /* set up multicast hash table */ | ||
841 | sysctl = bfin_read_EMAC_OPMODE(); | ||
842 | sysctl |= HM; | ||
843 | bfin_write_EMAC_OPMODE(sysctl); | ||
844 | bf537mac_multicast_hash(dev); | ||
815 | } else { | 845 | } else { |
816 | /* clear promisc or multicast mode */ | 846 | /* clear promisc or multicast mode */ |
817 | sysctl = bfin_read_EMAC_OPMODE(); | 847 | sysctl = bfin_read_EMAC_OPMODE(); |
@@ -860,10 +890,10 @@ static int bf537mac_open(struct net_device *dev) | |||
860 | return retval; | 890 | return retval; |
861 | 891 | ||
862 | phy_start(lp->phydev); | 892 | phy_start(lp->phydev); |
893 | phy_write(lp->phydev, MII_BMCR, BMCR_RESET); | ||
863 | setup_system_regs(dev); | 894 | setup_system_regs(dev); |
864 | bf537mac_disable(); | 895 | bf537mac_disable(); |
865 | bf537mac_enable(); | 896 | bf537mac_enable(); |
866 | |||
867 | pr_debug("hardware init finished\n"); | 897 | pr_debug("hardware init finished\n"); |
868 | netif_start_queue(dev); | 898 | netif_start_queue(dev); |
869 | netif_carrier_on(dev); | 899 | netif_carrier_on(dev); |
@@ -886,6 +916,7 @@ static int bf537mac_close(struct net_device *dev) | |||
886 | netif_carrier_off(dev); | 916 | netif_carrier_off(dev); |
887 | 917 | ||
888 | phy_stop(lp->phydev); | 918 | phy_stop(lp->phydev); |
919 | phy_write(lp->phydev, MII_BMCR, BMCR_PDOWN); | ||
889 | 920 | ||
890 | /* clear everything */ | 921 | /* clear everything */ |
891 | bf537mac_shutdown(dev); | 922 | bf537mac_shutdown(dev); |
@@ -970,7 +1001,7 @@ static int __init bf537mac_probe(struct net_device *dev) | |||
970 | /* register irq handler */ | 1001 | /* register irq handler */ |
971 | if (request_irq | 1002 | if (request_irq |
972 | (IRQ_MAC_RX, bf537mac_interrupt, IRQF_DISABLED | IRQF_SHARED, | 1003 | (IRQ_MAC_RX, bf537mac_interrupt, IRQF_DISABLED | IRQF_SHARED, |
973 | "BFIN537_MAC_RX", dev)) { | 1004 | "EMAC_RX", dev)) { |
974 | printk(KERN_WARNING DRV_NAME | 1005 | printk(KERN_WARNING DRV_NAME |
975 | ": Unable to attach BlackFin MAC RX interrupt\n"); | 1006 | ": Unable to attach BlackFin MAC RX interrupt\n"); |
976 | return -EBUSY; | 1007 | return -EBUSY; |
diff --git a/drivers/net/bfin_mac.h b/drivers/net/bfin_mac.h index 5970ea7142cd..f774d5a36942 100644 --- a/drivers/net/bfin_mac.h +++ b/drivers/net/bfin_mac.h | |||
@@ -1,34 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * File: drivers/net/bfin_mac.c | 2 | * Blackfin On-Chip MAC Driver |
3 | * Based on: | ||
4 | * Maintainer: | ||
5 | * Bryan Wu <bryan.wu@analog.com> | ||
6 | * | 3 | * |
7 | * Original author: | 4 | * Copyright 2004-2007 Analog Devices Inc. |
8 | * Luke Yang <luke.yang@analog.com> | ||
9 | * | 5 | * |
10 | * Created: | 6 | * Enter bugs at http://blackfin.uclinux.org/ |
11 | * Description: | ||
12 | * | 7 | * |
13 | * Modified: | 8 | * Licensed under the GPL-2 or later. |
14 | * Copyright 2004-2006 Analog Devices Inc. | ||
15 | * | ||
16 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
17 | * | ||
18 | * This program is free software ; you can redistribute it and/or modify | ||
19 | * it under the terms of the GNU General Public License as published by | ||
20 | * the Free Software Foundation ; either version 2, or (at your option) | ||
21 | * any later version. | ||
22 | * | ||
23 | * This program is distributed in the hope that it will be useful, | ||
24 | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | ||
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
26 | * GNU General Public License for more details. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License | ||
29 | * along with this program ; see the file COPYING. | ||
30 | * If not, write to the Free Software Foundation, | ||
31 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
32 | */ | 9 | */ |
33 | 10 | ||
34 | #define BFIN_MAC_CSUM_OFFLOAD | 11 | #define BFIN_MAC_CSUM_OFFLOAD |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 2039f7838f2d..0942d82f7cbf 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1464,10 +1464,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1464 | dev_set_allmulti(slave_dev, 1); | 1464 | dev_set_allmulti(slave_dev, 1); |
1465 | } | 1465 | } |
1466 | 1466 | ||
1467 | netif_tx_lock_bh(bond_dev); | ||
1467 | /* upload master's mc_list to new slave */ | 1468 | /* upload master's mc_list to new slave */ |
1468 | for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { | 1469 | for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) { |
1469 | dev_mc_add (slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); | 1470 | dev_mc_add (slave_dev, dmi->dmi_addr, dmi->dmi_addrlen, 0); |
1470 | } | 1471 | } |
1472 | netif_tx_unlock_bh(bond_dev); | ||
1471 | } | 1473 | } |
1472 | 1474 | ||
1473 | if (bond->params.mode == BOND_MODE_8023AD) { | 1475 | if (bond->params.mode == BOND_MODE_8023AD) { |
@@ -1821,7 +1823,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1821 | } | 1823 | } |
1822 | 1824 | ||
1823 | /* flush master's mc_list from slave */ | 1825 | /* flush master's mc_list from slave */ |
1826 | netif_tx_lock_bh(bond_dev); | ||
1824 | bond_mc_list_flush(bond_dev, slave_dev); | 1827 | bond_mc_list_flush(bond_dev, slave_dev); |
1828 | netif_tx_unlock_bh(bond_dev); | ||
1825 | } | 1829 | } |
1826 | 1830 | ||
1827 | netdev_set_master(slave_dev, NULL); | 1831 | netdev_set_master(slave_dev, NULL); |
@@ -1942,7 +1946,9 @@ static int bond_release_all(struct net_device *bond_dev) | |||
1942 | } | 1946 | } |
1943 | 1947 | ||
1944 | /* flush master's mc_list from slave */ | 1948 | /* flush master's mc_list from slave */ |
1949 | netif_tx_lock_bh(bond_dev); | ||
1945 | bond_mc_list_flush(bond_dev, slave_dev); | 1950 | bond_mc_list_flush(bond_dev, slave_dev); |
1951 | netif_tx_unlock_bh(bond_dev); | ||
1946 | } | 1952 | } |
1947 | 1953 | ||
1948 | netdev_set_master(slave_dev, NULL); | 1954 | netdev_set_master(slave_dev, NULL); |
@@ -2795,14 +2801,11 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2795 | } | 2801 | } |
2796 | 2802 | ||
2797 | if (do_failover) { | 2803 | if (do_failover) { |
2798 | rtnl_lock(); | ||
2799 | write_lock_bh(&bond->curr_slave_lock); | 2804 | write_lock_bh(&bond->curr_slave_lock); |
2800 | 2805 | ||
2801 | bond_select_active_slave(bond); | 2806 | bond_select_active_slave(bond); |
2802 | 2807 | ||
2803 | write_unlock_bh(&bond->curr_slave_lock); | 2808 | write_unlock_bh(&bond->curr_slave_lock); |
2804 | rtnl_unlock(); | ||
2805 | |||
2806 | } | 2809 | } |
2807 | 2810 | ||
2808 | re_arm: | 2811 | re_arm: |
@@ -2859,8 +2862,6 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2859 | 2862 | ||
2860 | slave->link = BOND_LINK_UP; | 2863 | slave->link = BOND_LINK_UP; |
2861 | 2864 | ||
2862 | rtnl_lock(); | ||
2863 | |||
2864 | write_lock_bh(&bond->curr_slave_lock); | 2865 | write_lock_bh(&bond->curr_slave_lock); |
2865 | 2866 | ||
2866 | if ((!bond->curr_active_slave) && | 2867 | if ((!bond->curr_active_slave) && |
@@ -2896,7 +2897,6 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2896 | } | 2897 | } |
2897 | 2898 | ||
2898 | write_unlock_bh(&bond->curr_slave_lock); | 2899 | write_unlock_bh(&bond->curr_slave_lock); |
2899 | rtnl_unlock(); | ||
2900 | } | 2900 | } |
2901 | } else { | 2901 | } else { |
2902 | read_lock(&bond->curr_slave_lock); | 2902 | read_lock(&bond->curr_slave_lock); |
@@ -2966,7 +2966,6 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2966 | bond->dev->name, | 2966 | bond->dev->name, |
2967 | slave->dev->name); | 2967 | slave->dev->name); |
2968 | 2968 | ||
2969 | rtnl_lock(); | ||
2970 | write_lock_bh(&bond->curr_slave_lock); | 2969 | write_lock_bh(&bond->curr_slave_lock); |
2971 | 2970 | ||
2972 | bond_select_active_slave(bond); | 2971 | bond_select_active_slave(bond); |
@@ -2974,8 +2973,6 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2974 | 2973 | ||
2975 | write_unlock_bh(&bond->curr_slave_lock); | 2974 | write_unlock_bh(&bond->curr_slave_lock); |
2976 | 2975 | ||
2977 | rtnl_unlock(); | ||
2978 | |||
2979 | bond->current_arp_slave = slave; | 2976 | bond->current_arp_slave = slave; |
2980 | 2977 | ||
2981 | if (slave) { | 2978 | if (slave) { |
@@ -2993,13 +2990,10 @@ void bond_activebackup_arp_mon(struct work_struct *work) | |||
2993 | bond->primary_slave->dev->name); | 2990 | bond->primary_slave->dev->name); |
2994 | 2991 | ||
2995 | /* primary is up so switch to it */ | 2992 | /* primary is up so switch to it */ |
2996 | rtnl_lock(); | ||
2997 | write_lock_bh(&bond->curr_slave_lock); | 2993 | write_lock_bh(&bond->curr_slave_lock); |
2998 | bond_change_active_slave(bond, bond->primary_slave); | 2994 | bond_change_active_slave(bond, bond->primary_slave); |
2999 | write_unlock_bh(&bond->curr_slave_lock); | 2995 | write_unlock_bh(&bond->curr_slave_lock); |
3000 | 2996 | ||
3001 | rtnl_unlock(); | ||
3002 | |||
3003 | slave = bond->primary_slave; | 2997 | slave = bond->primary_slave; |
3004 | slave->jiffies = jiffies; | 2998 | slave->jiffies = jiffies; |
3005 | } else { | 2999 | } else { |
@@ -3769,42 +3763,45 @@ static struct net_device_stats *bond_get_stats(struct net_device *bond_dev) | |||
3769 | { | 3763 | { |
3770 | struct bonding *bond = bond_dev->priv; | 3764 | struct bonding *bond = bond_dev->priv; |
3771 | struct net_device_stats *stats = &(bond->stats), *sstats; | 3765 | struct net_device_stats *stats = &(bond->stats), *sstats; |
3766 | struct net_device_stats local_stats; | ||
3772 | struct slave *slave; | 3767 | struct slave *slave; |
3773 | int i; | 3768 | int i; |
3774 | 3769 | ||
3775 | memset(stats, 0, sizeof(struct net_device_stats)); | 3770 | memset(&local_stats, 0, sizeof(struct net_device_stats)); |
3776 | 3771 | ||
3777 | read_lock_bh(&bond->lock); | 3772 | read_lock_bh(&bond->lock); |
3778 | 3773 | ||
3779 | bond_for_each_slave(bond, slave, i) { | 3774 | bond_for_each_slave(bond, slave, i) { |
3780 | sstats = slave->dev->get_stats(slave->dev); | 3775 | sstats = slave->dev->get_stats(slave->dev); |
3781 | stats->rx_packets += sstats->rx_packets; | 3776 | local_stats.rx_packets += sstats->rx_packets; |
3782 | stats->rx_bytes += sstats->rx_bytes; | 3777 | local_stats.rx_bytes += sstats->rx_bytes; |
3783 | stats->rx_errors += sstats->rx_errors; | 3778 | local_stats.rx_errors += sstats->rx_errors; |
3784 | stats->rx_dropped += sstats->rx_dropped; | 3779 | local_stats.rx_dropped += sstats->rx_dropped; |
3785 | 3780 | ||
3786 | stats->tx_packets += sstats->tx_packets; | 3781 | local_stats.tx_packets += sstats->tx_packets; |
3787 | stats->tx_bytes += sstats->tx_bytes; | 3782 | local_stats.tx_bytes += sstats->tx_bytes; |
3788 | stats->tx_errors += sstats->tx_errors; | 3783 | local_stats.tx_errors += sstats->tx_errors; |
3789 | stats->tx_dropped += sstats->tx_dropped; | 3784 | local_stats.tx_dropped += sstats->tx_dropped; |
3790 | 3785 | ||
3791 | stats->multicast += sstats->multicast; | 3786 | local_stats.multicast += sstats->multicast; |
3792 | stats->collisions += sstats->collisions; | 3787 | local_stats.collisions += sstats->collisions; |
3793 | 3788 | ||
3794 | stats->rx_length_errors += sstats->rx_length_errors; | 3789 | local_stats.rx_length_errors += sstats->rx_length_errors; |
3795 | stats->rx_over_errors += sstats->rx_over_errors; | 3790 | local_stats.rx_over_errors += sstats->rx_over_errors; |
3796 | stats->rx_crc_errors += sstats->rx_crc_errors; | 3791 | local_stats.rx_crc_errors += sstats->rx_crc_errors; |
3797 | stats->rx_frame_errors += sstats->rx_frame_errors; | 3792 | local_stats.rx_frame_errors += sstats->rx_frame_errors; |
3798 | stats->rx_fifo_errors += sstats->rx_fifo_errors; | 3793 | local_stats.rx_fifo_errors += sstats->rx_fifo_errors; |
3799 | stats->rx_missed_errors += sstats->rx_missed_errors; | 3794 | local_stats.rx_missed_errors += sstats->rx_missed_errors; |
3800 | 3795 | ||
3801 | stats->tx_aborted_errors += sstats->tx_aborted_errors; | 3796 | local_stats.tx_aborted_errors += sstats->tx_aborted_errors; |
3802 | stats->tx_carrier_errors += sstats->tx_carrier_errors; | 3797 | local_stats.tx_carrier_errors += sstats->tx_carrier_errors; |
3803 | stats->tx_fifo_errors += sstats->tx_fifo_errors; | 3798 | local_stats.tx_fifo_errors += sstats->tx_fifo_errors; |
3804 | stats->tx_heartbeat_errors += sstats->tx_heartbeat_errors; | 3799 | local_stats.tx_heartbeat_errors += sstats->tx_heartbeat_errors; |
3805 | stats->tx_window_errors += sstats->tx_window_errors; | 3800 | local_stats.tx_window_errors += sstats->tx_window_errors; |
3806 | } | 3801 | } |
3807 | 3802 | ||
3803 | memcpy(stats, &local_stats, sizeof(struct net_device_stats)); | ||
3804 | |||
3808 | read_unlock_bh(&bond->lock); | 3805 | read_unlock_bh(&bond->lock); |
3809 | 3806 | ||
3810 | return stats; | 3807 | return stats; |
@@ -3937,8 +3934,6 @@ static void bond_set_multicast_list(struct net_device *bond_dev) | |||
3937 | struct bonding *bond = bond_dev->priv; | 3934 | struct bonding *bond = bond_dev->priv; |
3938 | struct dev_mc_list *dmi; | 3935 | struct dev_mc_list *dmi; |
3939 | 3936 | ||
3940 | write_lock_bh(&bond->lock); | ||
3941 | |||
3942 | /* | 3937 | /* |
3943 | * Do promisc before checking multicast_mode | 3938 | * Do promisc before checking multicast_mode |
3944 | */ | 3939 | */ |
@@ -3959,6 +3954,8 @@ static void bond_set_multicast_list(struct net_device *bond_dev) | |||
3959 | bond_set_allmulti(bond, -1); | 3954 | bond_set_allmulti(bond, -1); |
3960 | } | 3955 | } |
3961 | 3956 | ||
3957 | read_lock(&bond->lock); | ||
3958 | |||
3962 | bond->flags = bond_dev->flags; | 3959 | bond->flags = bond_dev->flags; |
3963 | 3960 | ||
3964 | /* looking for addresses to add to slaves' mc list */ | 3961 | /* looking for addresses to add to slaves' mc list */ |
@@ -3979,7 +3976,7 @@ static void bond_set_multicast_list(struct net_device *bond_dev) | |||
3979 | bond_mc_list_destroy(bond); | 3976 | bond_mc_list_destroy(bond); |
3980 | bond_mc_list_copy(bond_dev->mc_list, bond, GFP_ATOMIC); | 3977 | bond_mc_list_copy(bond_dev->mc_list, bond, GFP_ATOMIC); |
3981 | 3978 | ||
3982 | write_unlock_bh(&bond->lock); | 3979 | read_unlock(&bond->lock); |
3983 | } | 3980 | } |
3984 | 3981 | ||
3985 | /* | 3982 | /* |
@@ -4526,7 +4523,9 @@ static void bond_free_all(void) | |||
4526 | struct net_device *bond_dev = bond->dev; | 4523 | struct net_device *bond_dev = bond->dev; |
4527 | 4524 | ||
4528 | bond_work_cancel_all(bond); | 4525 | bond_work_cancel_all(bond); |
4526 | netif_tx_lock_bh(bond_dev); | ||
4529 | bond_mc_list_destroy(bond); | 4527 | bond_mc_list_destroy(bond); |
4528 | netif_tx_unlock_bh(bond_dev); | ||
4530 | /* Release the bonded slaves */ | 4529 | /* Release the bonded slaves */ |
4531 | bond_release_all(bond_dev); | 4530 | bond_release_all(bond_dev); |
4532 | bond_deinit(bond_dev); | 4531 | bond_deinit(bond_dev); |
@@ -4549,14 +4548,19 @@ static void bond_free_all(void) | |||
4549 | int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl) | 4548 | int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl) |
4550 | { | 4549 | { |
4551 | int mode = -1, i, rv; | 4550 | int mode = -1, i, rv; |
4552 | char modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, }; | 4551 | char *p, modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, }; |
4553 | 4552 | ||
4554 | rv = sscanf(buf, "%d", &mode); | 4553 | for (p = (char *)buf; *p; p++) |
4555 | if (!rv) { | 4554 | if (!(isdigit(*p) || isspace(*p))) |
4555 | break; | ||
4556 | |||
4557 | if (*p) | ||
4556 | rv = sscanf(buf, "%20s", modestr); | 4558 | rv = sscanf(buf, "%20s", modestr); |
4557 | if (!rv) | 4559 | else |
4558 | return -1; | 4560 | rv = sscanf(buf, "%d", &mode); |
4559 | } | 4561 | |
4562 | if (!rv) | ||
4563 | return -1; | ||
4560 | 4564 | ||
4561 | for (i = 0; tbl[i].modename; i++) { | 4565 | for (i = 0; tbl[i].modename; i++) { |
4562 | if (mode == tbl[i].mode) | 4566 | if (mode == tbl[i].mode) |
@@ -4883,14 +4887,16 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond | |||
4883 | down_write(&bonding_rwsem); | 4887 | down_write(&bonding_rwsem); |
4884 | 4888 | ||
4885 | /* Check to see if the bond already exists. */ | 4889 | /* Check to see if the bond already exists. */ |
4886 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) | 4890 | if (name) { |
4887 | if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) { | 4891 | list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) |
4888 | printk(KERN_ERR DRV_NAME | 4892 | if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) { |
4893 | printk(KERN_ERR DRV_NAME | ||
4889 | ": cannot add bond %s; it already exists\n", | 4894 | ": cannot add bond %s; it already exists\n", |
4890 | name); | 4895 | name); |
4891 | res = -EPERM; | 4896 | res = -EPERM; |
4892 | goto out_rtnl; | 4897 | goto out_rtnl; |
4893 | } | 4898 | } |
4899 | } | ||
4894 | 4900 | ||
4895 | bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", | 4901 | bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", |
4896 | ether_setup); | 4902 | ether_setup); |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 6d83be49899a..67ccad69d445 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -22,8 +22,8 @@ | |||
22 | #include "bond_3ad.h" | 22 | #include "bond_3ad.h" |
23 | #include "bond_alb.h" | 23 | #include "bond_alb.h" |
24 | 24 | ||
25 | #define DRV_VERSION "3.2.3" | 25 | #define DRV_VERSION "3.2.4" |
26 | #define DRV_RELDATE "December 6, 2007" | 26 | #define DRV_RELDATE "January 28, 2008" |
27 | #define DRV_NAME "bonding" | 27 | #define DRV_NAME "bonding" |
28 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" | 28 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" |
29 | 29 | ||
diff --git a/drivers/net/cxgb3/mc5.c b/drivers/net/cxgb3/mc5.c index 84c1ffa8e2d3..4c4d6e877ea6 100644 --- a/drivers/net/cxgb3/mc5.c +++ b/drivers/net/cxgb3/mc5.c | |||
@@ -452,7 +452,7 @@ void t3_mc5_intr_handler(struct mc5 *mc5) | |||
452 | t3_write_reg(adap, A_MC5_DB_INT_CAUSE, cause); | 452 | t3_write_reg(adap, A_MC5_DB_INT_CAUSE, cause); |
453 | } | 453 | } |
454 | 454 | ||
455 | void __devinit t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode) | 455 | void t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode) |
456 | { | 456 | { |
457 | #define K * 1024 | 457 | #define K * 1024 |
458 | 458 | ||
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index cb684d30831f..9ca8c66abd16 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -2836,7 +2836,7 @@ void t3_sge_init(struct adapter *adap, struct sge_params *p) | |||
2836 | * defaults for the assorted SGE parameters, which admins can change until | 2836 | * defaults for the assorted SGE parameters, which admins can change until |
2837 | * they are used to initialize the SGE. | 2837 | * they are used to initialize the SGE. |
2838 | */ | 2838 | */ |
2839 | void __devinit t3_sge_prep(struct adapter *adap, struct sge_params *p) | 2839 | void t3_sge_prep(struct adapter *adap, struct sge_params *p) |
2840 | { | 2840 | { |
2841 | int i; | 2841 | int i; |
2842 | 2842 | ||
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index 7469935877bd..a99496a431c4 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -2675,7 +2675,7 @@ void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size) | |||
2675 | V_PMMAXXFERLEN0(size) | V_PMMAXXFERLEN1(size)); | 2675 | V_PMMAXXFERLEN0(size) | V_PMMAXXFERLEN1(size)); |
2676 | } | 2676 | } |
2677 | 2677 | ||
2678 | static void __devinit init_mtus(unsigned short mtus[]) | 2678 | static void init_mtus(unsigned short mtus[]) |
2679 | { | 2679 | { |
2680 | /* | 2680 | /* |
2681 | * See draft-mathis-plpmtud-00.txt for the values. The min is 88 so | 2681 | * See draft-mathis-plpmtud-00.txt for the values. The min is 88 so |
@@ -2703,7 +2703,7 @@ static void __devinit init_mtus(unsigned short mtus[]) | |||
2703 | /* | 2703 | /* |
2704 | * Initial congestion control parameters. | 2704 | * Initial congestion control parameters. |
2705 | */ | 2705 | */ |
2706 | static void __devinit init_cong_ctrl(unsigned short *a, unsigned short *b) | 2706 | static void init_cong_ctrl(unsigned short *a, unsigned short *b) |
2707 | { | 2707 | { |
2708 | a[0] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = 1; | 2708 | a[0] = a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = 1; |
2709 | a[9] = 2; | 2709 | a[9] = 2; |
@@ -3354,8 +3354,7 @@ out_err: | |||
3354 | * Determines a card's PCI mode and associated parameters, such as speed | 3354 | * Determines a card's PCI mode and associated parameters, such as speed |
3355 | * and width. | 3355 | * and width. |
3356 | */ | 3356 | */ |
3357 | static void __devinit get_pci_mode(struct adapter *adapter, | 3357 | static void get_pci_mode(struct adapter *adapter, struct pci_params *p) |
3358 | struct pci_params *p) | ||
3359 | { | 3358 | { |
3360 | static unsigned short speed_map[] = { 33, 66, 100, 133 }; | 3359 | static unsigned short speed_map[] = { 33, 66, 100, 133 }; |
3361 | u32 pci_mode, pcie_cap; | 3360 | u32 pci_mode, pcie_cap; |
@@ -3395,8 +3394,7 @@ static void __devinit get_pci_mode(struct adapter *adapter, | |||
3395 | * capabilities and default speed/duplex/flow-control/autonegotiation | 3394 | * capabilities and default speed/duplex/flow-control/autonegotiation |
3396 | * settings. | 3395 | * settings. |
3397 | */ | 3396 | */ |
3398 | static void __devinit init_link_config(struct link_config *lc, | 3397 | static void init_link_config(struct link_config *lc, unsigned int caps) |
3399 | unsigned int caps) | ||
3400 | { | 3398 | { |
3401 | lc->supported = caps; | 3399 | lc->supported = caps; |
3402 | lc->requested_speed = lc->speed = SPEED_INVALID; | 3400 | lc->requested_speed = lc->speed = SPEED_INVALID; |
@@ -3419,7 +3417,7 @@ static void __devinit init_link_config(struct link_config *lc, | |||
3419 | * Calculates the size of an MC7 memory in bytes from the value of its | 3417 | * Calculates the size of an MC7 memory in bytes from the value of its |
3420 | * configuration register. | 3418 | * configuration register. |
3421 | */ | 3419 | */ |
3422 | static unsigned int __devinit mc7_calc_size(u32 cfg) | 3420 | static unsigned int mc7_calc_size(u32 cfg) |
3423 | { | 3421 | { |
3424 | unsigned int width = G_WIDTH(cfg); | 3422 | unsigned int width = G_WIDTH(cfg); |
3425 | unsigned int banks = !!(cfg & F_BKS) + 1; | 3423 | unsigned int banks = !!(cfg & F_BKS) + 1; |
@@ -3430,8 +3428,8 @@ static unsigned int __devinit mc7_calc_size(u32 cfg) | |||
3430 | return MBs << 20; | 3428 | return MBs << 20; |
3431 | } | 3429 | } |
3432 | 3430 | ||
3433 | static void __devinit mc7_prep(struct adapter *adapter, struct mc7 *mc7, | 3431 | static void mc7_prep(struct adapter *adapter, struct mc7 *mc7, |
3434 | unsigned int base_addr, const char *name) | 3432 | unsigned int base_addr, const char *name) |
3435 | { | 3433 | { |
3436 | u32 cfg; | 3434 | u32 cfg; |
3437 | 3435 | ||
@@ -3517,7 +3515,7 @@ static int t3_reset_adapter(struct adapter *adapter) | |||
3517 | return 0; | 3515 | return 0; |
3518 | } | 3516 | } |
3519 | 3517 | ||
3520 | static int __devinit init_parity(struct adapter *adap) | 3518 | static int init_parity(struct adapter *adap) |
3521 | { | 3519 | { |
3522 | int i, err, addr; | 3520 | int i, err, addr; |
3523 | 3521 | ||
@@ -3552,8 +3550,8 @@ static int __devinit init_parity(struct adapter *adap) | |||
3552 | * for some adapter tunables, take PHYs out of reset, and initialize the MDIO | 3550 | * for some adapter tunables, take PHYs out of reset, and initialize the MDIO |
3553 | * interface. | 3551 | * interface. |
3554 | */ | 3552 | */ |
3555 | int __devinit t3_prep_adapter(struct adapter *adapter, | 3553 | int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, |
3556 | const struct adapter_info *ai, int reset) | 3554 | int reset) |
3557 | { | 3555 | { |
3558 | int ret; | 3556 | int ret; |
3559 | unsigned int i, j = 0; | 3557 | unsigned int i, j = 0; |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 51cf577035be..36ba6dc96acc 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -94,7 +94,7 @@ | |||
94 | * enabled. 82557 pads with 7Eh, while the later controllers pad | 94 | * enabled. 82557 pads with 7Eh, while the later controllers pad |
95 | * with 00h. | 95 | * with 00h. |
96 | * | 96 | * |
97 | * IV. Recieve | 97 | * IV. Receive |
98 | * | 98 | * |
99 | * The Receive Frame Area (RFA) comprises a ring of Receive Frame | 99 | * The Receive Frame Area (RFA) comprises a ring of Receive Frame |
100 | * Descriptors (RFD) + data buffer, thus forming the simplified mode | 100 | * Descriptors (RFD) + data buffer, thus forming the simplified mode |
@@ -120,7 +120,7 @@ | |||
120 | * and Rx indication and re-allocation happen in the same context, | 120 | * and Rx indication and re-allocation happen in the same context, |
121 | * therefore no locking is required. A software-generated interrupt | 121 | * therefore no locking is required. A software-generated interrupt |
122 | * is generated from the watchdog to recover from a failed allocation | 122 | * is generated from the watchdog to recover from a failed allocation |
123 | * senario where all Rx resources have been indicated and none re- | 123 | * scenario where all Rx resources have been indicated and none re- |
124 | * placed. | 124 | * placed. |
125 | * | 125 | * |
126 | * V. Miscellaneous | 126 | * V. Miscellaneous |
@@ -954,7 +954,7 @@ static void e100_get_defaults(struct nic *nic) | |||
954 | /* Quadwords to DMA into FIFO before starting frame transmit */ | 954 | /* Quadwords to DMA into FIFO before starting frame transmit */ |
955 | nic->tx_threshold = 0xE0; | 955 | nic->tx_threshold = 0xE0; |
956 | 956 | ||
957 | /* no interrupt for every tx completion, delay = 256us if not 557*/ | 957 | /* no interrupt for every tx completion, delay = 256us if not 557 */ |
958 | nic->tx_command = cpu_to_le16(cb_tx | cb_tx_sf | | 958 | nic->tx_command = cpu_to_le16(cb_tx | cb_tx_sf | |
959 | ((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i)); | 959 | ((nic->mac >= mac_82558_D101_A4) ? cb_cid : cb_i)); |
960 | 960 | ||
@@ -1497,7 +1497,7 @@ static void e100_update_stats(struct nic *nic) | |||
1497 | &s->complete; | 1497 | &s->complete; |
1498 | 1498 | ||
1499 | /* Device's stats reporting may take several microseconds to | 1499 | /* Device's stats reporting may take several microseconds to |
1500 | * complete, so where always waiting for results of the | 1500 | * complete, so we're always waiting for results of the |
1501 | * previous command. */ | 1501 | * previous command. */ |
1502 | 1502 | ||
1503 | if(*complete == cpu_to_le32(cuc_dump_reset_complete)) { | 1503 | if(*complete == cpu_to_le32(cuc_dump_reset_complete)) { |
@@ -1958,7 +1958,7 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done, | |||
1958 | 1958 | ||
1959 | if(restart_required) { | 1959 | if(restart_required) { |
1960 | // ack the rnr? | 1960 | // ack the rnr? |
1961 | writeb(stat_ack_rnr, &nic->csr->scb.stat_ack); | 1961 | iowrite8(stat_ack_rnr, &nic->csr->scb.stat_ack); |
1962 | e100_start_receiver(nic, nic->rx_to_clean); | 1962 | e100_start_receiver(nic, nic->rx_to_clean); |
1963 | if(work_done) | 1963 | if(work_done) |
1964 | (*work_done)++; | 1964 | (*work_done)++; |
@@ -2774,7 +2774,7 @@ static void __devexit e100_remove(struct pci_dev *pdev) | |||
2774 | struct nic *nic = netdev_priv(netdev); | 2774 | struct nic *nic = netdev_priv(netdev); |
2775 | unregister_netdev(netdev); | 2775 | unregister_netdev(netdev); |
2776 | e100_free(nic); | 2776 | e100_free(nic); |
2777 | iounmap(nic->csr); | 2777 | pci_iounmap(pdev, nic->csr); |
2778 | free_netdev(netdev); | 2778 | free_netdev(netdev); |
2779 | pci_release_regions(pdev); | 2779 | pci_release_regions(pdev); |
2780 | pci_disable_device(pdev); | 2780 | pci_disable_device(pdev); |
@@ -2858,17 +2858,17 @@ static void e100_shutdown(struct pci_dev *pdev) | |||
2858 | /** | 2858 | /** |
2859 | * e100_io_error_detected - called when PCI error is detected. | 2859 | * e100_io_error_detected - called when PCI error is detected. |
2860 | * @pdev: Pointer to PCI device | 2860 | * @pdev: Pointer to PCI device |
2861 | * @state: The current pci conneection state | 2861 | * @state: The current pci connection state |
2862 | */ | 2862 | */ |
2863 | static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state) | 2863 | static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state) |
2864 | { | 2864 | { |
2865 | struct net_device *netdev = pci_get_drvdata(pdev); | 2865 | struct net_device *netdev = pci_get_drvdata(pdev); |
2866 | struct nic *nic = netdev_priv(netdev); | 2866 | struct nic *nic = netdev_priv(netdev); |
2867 | 2867 | ||
2868 | /* Similar to calling e100_down(), but avoids adpater I/O. */ | 2868 | /* Similar to calling e100_down(), but avoids adapter I/O. */ |
2869 | netdev->stop(netdev); | 2869 | netdev->stop(netdev); |
2870 | 2870 | ||
2871 | /* Detach; put netif into state similar to hotplug unplug. */ | 2871 | /* Detach; put netif into a state similar to hotplug unplug. */ |
2872 | napi_enable(&nic->napi); | 2872 | napi_enable(&nic->napi); |
2873 | netif_device_detach(netdev); | 2873 | netif_device_detach(netdev); |
2874 | pci_disable_device(pdev); | 2874 | pci_disable_device(pdev); |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 8c87940a9ce8..7c5b05a82f0e 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -853,7 +853,7 @@ e1000_reset(struct e1000_adapter *adapter) | |||
853 | /** | 853 | /** |
854 | * Dump the eeprom for users having checksum issues | 854 | * Dump the eeprom for users having checksum issues |
855 | **/ | 855 | **/ |
856 | void e1000_dump_eeprom(struct e1000_adapter *adapter) | 856 | static void e1000_dump_eeprom(struct e1000_adapter *adapter) |
857 | { | 857 | { |
858 | struct net_device *netdev = adapter->netdev; | 858 | struct net_device *netdev = adapter->netdev; |
859 | struct ethtool_eeprom eeprom; | 859 | struct ethtool_eeprom eeprom; |
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index f2175ea46b83..6232c3e96689 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h | |||
@@ -63,6 +63,7 @@ | |||
63 | #define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ | 63 | #define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ |
64 | #define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ | 64 | #define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ |
65 | #define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ | 65 | #define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ |
66 | #define E1000_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */ | ||
66 | 67 | ||
67 | /* Extended Device Control */ | 68 | /* Extended Device Control */ |
68 | #define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */ | 69 | #define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */ |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 6d9c27fd0b53..f77a7427d3a0 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -690,8 +690,8 @@ err_setup: | |||
690 | return err; | 690 | return err; |
691 | } | 691 | } |
692 | 692 | ||
693 | bool reg_pattern_test_array(struct e1000_adapter *adapter, u64 *data, | 693 | static bool reg_pattern_test_array(struct e1000_adapter *adapter, u64 *data, |
694 | int reg, int offset, u32 mask, u32 write) | 694 | int reg, int offset, u32 mask, u32 write) |
695 | { | 695 | { |
696 | int i; | 696 | int i; |
697 | u32 read; | 697 | u32 read; |
@@ -1632,7 +1632,8 @@ static void e1000_get_wol(struct net_device *netdev, | |||
1632 | return; | 1632 | return; |
1633 | 1633 | ||
1634 | wol->supported = WAKE_UCAST | WAKE_MCAST | | 1634 | wol->supported = WAKE_UCAST | WAKE_MCAST | |
1635 | WAKE_BCAST | WAKE_MAGIC; | 1635 | WAKE_BCAST | WAKE_MAGIC | |
1636 | WAKE_PHY | WAKE_ARP; | ||
1636 | 1637 | ||
1637 | /* apply any specific unsupported masks here */ | 1638 | /* apply any specific unsupported masks here */ |
1638 | if (adapter->flags & FLAG_NO_WAKE_UCAST) { | 1639 | if (adapter->flags & FLAG_NO_WAKE_UCAST) { |
@@ -1651,6 +1652,10 @@ static void e1000_get_wol(struct net_device *netdev, | |||
1651 | wol->wolopts |= WAKE_BCAST; | 1652 | wol->wolopts |= WAKE_BCAST; |
1652 | if (adapter->wol & E1000_WUFC_MAG) | 1653 | if (adapter->wol & E1000_WUFC_MAG) |
1653 | wol->wolopts |= WAKE_MAGIC; | 1654 | wol->wolopts |= WAKE_MAGIC; |
1655 | if (adapter->wol & E1000_WUFC_LNKC) | ||
1656 | wol->wolopts |= WAKE_PHY; | ||
1657 | if (adapter->wol & E1000_WUFC_ARP) | ||
1658 | wol->wolopts |= WAKE_ARP; | ||
1654 | } | 1659 | } |
1655 | 1660 | ||
1656 | static int e1000_set_wol(struct net_device *netdev, | 1661 | static int e1000_set_wol(struct net_device *netdev, |
@@ -1658,7 +1663,7 @@ static int e1000_set_wol(struct net_device *netdev, | |||
1658 | { | 1663 | { |
1659 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1664 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1660 | 1665 | ||
1661 | if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE)) | 1666 | if (wol->wolopts & WAKE_MAGICSECURE) |
1662 | return -EOPNOTSUPP; | 1667 | return -EOPNOTSUPP; |
1663 | 1668 | ||
1664 | if (!(adapter->flags & FLAG_HAS_WOL)) | 1669 | if (!(adapter->flags & FLAG_HAS_WOL)) |
@@ -1675,6 +1680,10 @@ static int e1000_set_wol(struct net_device *netdev, | |||
1675 | adapter->wol |= E1000_WUFC_BC; | 1680 | adapter->wol |= E1000_WUFC_BC; |
1676 | if (wol->wolopts & WAKE_MAGIC) | 1681 | if (wol->wolopts & WAKE_MAGIC) |
1677 | adapter->wol |= E1000_WUFC_MAG; | 1682 | adapter->wol |= E1000_WUFC_MAG; |
1683 | if (wol->wolopts & WAKE_PHY) | ||
1684 | adapter->wol |= E1000_WUFC_LNKC; | ||
1685 | if (wol->wolopts & WAKE_ARP) | ||
1686 | adapter->wol |= E1000_WUFC_ARP; | ||
1678 | 1687 | ||
1679 | return 0; | 1688 | return 0; |
1680 | } | 1689 | } |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 0a2cb7960c9e..f58f017ee47a 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -945,11 +945,7 @@ static int e1000_request_irq(struct e1000_adapter *adapter) | |||
945 | int irq_flags = IRQF_SHARED; | 945 | int irq_flags = IRQF_SHARED; |
946 | int err; | 946 | int err; |
947 | 947 | ||
948 | err = pci_enable_msi(adapter->pdev); | 948 | if (!pci_enable_msi(adapter->pdev)) { |
949 | if (err) { | ||
950 | ndev_warn(netdev, | ||
951 | "Unable to allocate MSI interrupt Error: %d\n", err); | ||
952 | } else { | ||
953 | adapter->flags |= FLAG_MSI_ENABLED; | 949 | adapter->flags |= FLAG_MSI_ENABLED; |
954 | handler = e1000_intr_msi; | 950 | handler = e1000_intr_msi; |
955 | irq_flags = 0; | 951 | irq_flags = 0; |
@@ -958,10 +954,12 @@ static int e1000_request_irq(struct e1000_adapter *adapter) | |||
958 | err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, | 954 | err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name, |
959 | netdev); | 955 | netdev); |
960 | if (err) { | 956 | if (err) { |
957 | ndev_err(netdev, | ||
958 | "Unable to allocate %s interrupt (return: %d)\n", | ||
959 | adapter->flags & FLAG_MSI_ENABLED ? "MSI":"INTx", | ||
960 | err); | ||
961 | if (adapter->flags & FLAG_MSI_ENABLED) | 961 | if (adapter->flags & FLAG_MSI_ENABLED) |
962 | pci_disable_msi(adapter->pdev); | 962 | pci_disable_msi(adapter->pdev); |
963 | ndev_err(netdev, | ||
964 | "Unable to allocate interrupt Error: %d\n", err); | ||
965 | } | 963 | } |
966 | 964 | ||
967 | return err; | 965 | return err; |
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index d5459a8056b1..2eb82aba4a8b 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * Many modifications, and currently maintained, by | 9 | * Many modifications, and currently maintained, by |
10 | * Philip Blundell <philb@gnu.org> | 10 | * Philip Blundell <philb@gnu.org> |
11 | * Added the Compaq LTE Alan Cox <alan@redhat.com> | 11 | * Added the Compaq LTE Alan Cox <alan@redhat.com> |
12 | * Added MCA support Adam Fritzler <mid@auk.cx> | 12 | * Added MCA support Adam Fritzler |
13 | * | 13 | * |
14 | * Note - this driver is experimental still - it has problems on faster | 14 | * Note - this driver is experimental still - it has problems on faster |
15 | * machines. Someone needs to sit down and go through it line by line with | 15 | * machines. Someone needs to sit down and go through it line by line with |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 5f82a4647eee..88fb53eba715 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -458,4 +458,7 @@ void ehea_set_ethtool_ops(struct net_device *netdev); | |||
458 | int ehea_sense_port_attr(struct ehea_port *port); | 458 | int ehea_sense_port_attr(struct ehea_port *port); |
459 | int ehea_set_portspeed(struct ehea_port *port, u32 port_speed); | 459 | int ehea_set_portspeed(struct ehea_port *port, u32 port_speed); |
460 | 460 | ||
461 | extern u64 ehea_driver_flags; | ||
462 | extern struct work_struct ehea_rereg_mr_task; | ||
463 | |||
461 | #endif /* __EHEA_H__ */ | 464 | #endif /* __EHEA_H__ */ |
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c index 679f40ee9572..d76885223366 100644 --- a/drivers/net/ehea/ehea_ethtool.c +++ b/drivers/net/ehea/ehea_ethtool.c | |||
@@ -40,7 +40,7 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
40 | return ret; | 40 | return ret; |
41 | 41 | ||
42 | if (netif_carrier_ok(dev)) { | 42 | if (netif_carrier_ok(dev)) { |
43 | switch(port->port_speed) { | 43 | switch (port->port_speed) { |
44 | case EHEA_SPEED_10M: cmd->speed = SPEED_10; break; | 44 | case EHEA_SPEED_10M: cmd->speed = SPEED_10; break; |
45 | case EHEA_SPEED_100M: cmd->speed = SPEED_100; break; | 45 | case EHEA_SPEED_100M: cmd->speed = SPEED_100; break; |
46 | case EHEA_SPEED_1G: cmd->speed = SPEED_1000; break; | 46 | case EHEA_SPEED_1G: cmd->speed = SPEED_1000; break; |
@@ -78,7 +78,7 @@ static int ehea_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
78 | goto doit; | 78 | goto doit; |
79 | } | 79 | } |
80 | 80 | ||
81 | switch(cmd->speed) { | 81 | switch (cmd->speed) { |
82 | case SPEED_10: | 82 | case SPEED_10: |
83 | if (cmd->duplex == DUPLEX_FULL) | 83 | if (cmd->duplex == DUPLEX_FULL) |
84 | sp = H_SPEED_10M_F; | 84 | sp = H_SPEED_10M_F; |
diff --git a/drivers/net/ehea/ehea_hw.h b/drivers/net/ehea/ehea_hw.h index 1af7ca499ec5..567981b4b2cc 100644 --- a/drivers/net/ehea/ehea_hw.h +++ b/drivers/net/ehea/ehea_hw.h | |||
@@ -29,10 +29,10 @@ | |||
29 | #ifndef __EHEA_HW_H__ | 29 | #ifndef __EHEA_HW_H__ |
30 | #define __EHEA_HW_H__ | 30 | #define __EHEA_HW_H__ |
31 | 31 | ||
32 | #define QPX_SQA_VALUE EHEA_BMASK_IBM(48,63) | 32 | #define QPX_SQA_VALUE EHEA_BMASK_IBM(48, 63) |
33 | #define QPX_RQ1A_VALUE EHEA_BMASK_IBM(48,63) | 33 | #define QPX_RQ1A_VALUE EHEA_BMASK_IBM(48, 63) |
34 | #define QPX_RQ2A_VALUE EHEA_BMASK_IBM(48,63) | 34 | #define QPX_RQ2A_VALUE EHEA_BMASK_IBM(48, 63) |
35 | #define QPX_RQ3A_VALUE EHEA_BMASK_IBM(48,63) | 35 | #define QPX_RQ3A_VALUE EHEA_BMASK_IBM(48, 63) |
36 | 36 | ||
37 | #define QPTEMM_OFFSET(x) offsetof(struct ehea_qptemm, x) | 37 | #define QPTEMM_OFFSET(x) offsetof(struct ehea_qptemm, x) |
38 | 38 | ||
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 869e1604b16e..c051c7e09b9a 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -6,9 +6,9 @@ | |||
6 | * (C) Copyright IBM Corp. 2006 | 6 | * (C) Copyright IBM Corp. 2006 |
7 | * | 7 | * |
8 | * Authors: | 8 | * Authors: |
9 | * Christoph Raisch <raisch@de.ibm.com> | 9 | * Christoph Raisch <raisch@de.ibm.com> |
10 | * Jan-Bernd Themann <themann@de.ibm.com> | 10 | * Jan-Bernd Themann <themann@de.ibm.com> |
11 | * Thomas Klein <tklein@de.ibm.com> | 11 | * Thomas Klein <tklein@de.ibm.com> |
12 | * | 12 | * |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or modify | 14 | * This program is free software; you can redistribute it and/or modify |
@@ -54,11 +54,11 @@ static int rq1_entries = EHEA_DEF_ENTRIES_RQ1; | |||
54 | static int rq2_entries = EHEA_DEF_ENTRIES_RQ2; | 54 | static int rq2_entries = EHEA_DEF_ENTRIES_RQ2; |
55 | static int rq3_entries = EHEA_DEF_ENTRIES_RQ3; | 55 | static int rq3_entries = EHEA_DEF_ENTRIES_RQ3; |
56 | static int sq_entries = EHEA_DEF_ENTRIES_SQ; | 56 | static int sq_entries = EHEA_DEF_ENTRIES_SQ; |
57 | static int use_mcs = 0; | 57 | static int use_mcs; |
58 | static int use_lro = 0; | 58 | static int use_lro; |
59 | static int lro_max_aggr = EHEA_LRO_MAX_AGGR; | 59 | static int lro_max_aggr = EHEA_LRO_MAX_AGGR; |
60 | static int num_tx_qps = EHEA_NUM_TX_QP; | 60 | static int num_tx_qps = EHEA_NUM_TX_QP; |
61 | static int prop_carrier_state = 0; | 61 | static int prop_carrier_state; |
62 | 62 | ||
63 | module_param(msg_level, int, 0); | 63 | module_param(msg_level, int, 0); |
64 | module_param(rq1_entries, int, 0); | 64 | module_param(rq1_entries, int, 0); |
@@ -94,9 +94,9 @@ MODULE_PARM_DESC(lro_max_aggr, " LRO: Max packets to be aggregated. Default = " | |||
94 | MODULE_PARM_DESC(use_lro, " Large Receive Offload, 1: enable, 0: disable, " | 94 | MODULE_PARM_DESC(use_lro, " Large Receive Offload, 1: enable, 0: disable, " |
95 | "Default = 0"); | 95 | "Default = 0"); |
96 | 96 | ||
97 | static int port_name_cnt = 0; | 97 | static int port_name_cnt; |
98 | static LIST_HEAD(adapter_list); | 98 | static LIST_HEAD(adapter_list); |
99 | u64 ehea_driver_flags = 0; | 99 | u64 ehea_driver_flags; |
100 | struct work_struct ehea_rereg_mr_task; | 100 | struct work_struct ehea_rereg_mr_task; |
101 | 101 | ||
102 | struct semaphore dlpar_mem_lock; | 102 | struct semaphore dlpar_mem_lock; |
@@ -121,12 +121,13 @@ static struct of_platform_driver ehea_driver = { | |||
121 | .remove = ehea_remove, | 121 | .remove = ehea_remove, |
122 | }; | 122 | }; |
123 | 123 | ||
124 | void ehea_dump(void *adr, int len, char *msg) { | 124 | void ehea_dump(void *adr, int len, char *msg) |
125 | { | ||
125 | int x; | 126 | int x; |
126 | unsigned char *deb = adr; | 127 | unsigned char *deb = adr; |
127 | for (x = 0; x < len; x += 16) { | 128 | for (x = 0; x < len; x += 16) { |
128 | printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg, | 129 | printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg, |
129 | deb, x, *((u64*)&deb[0]), *((u64*)&deb[8])); | 130 | deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8])); |
130 | deb += 16; | 131 | deb += 16; |
131 | } | 132 | } |
132 | } | 133 | } |
@@ -518,7 +519,8 @@ static int ehea_proc_rwqes(struct net_device *dev, | |||
518 | last_wqe_index = wqe_index; | 519 | last_wqe_index = wqe_index; |
519 | rmb(); | 520 | rmb(); |
520 | if (!ehea_check_cqe(cqe, &rq)) { | 521 | if (!ehea_check_cqe(cqe, &rq)) { |
521 | if (rq == 1) { /* LL RQ1 */ | 522 | if (rq == 1) { |
523 | /* LL RQ1 */ | ||
522 | skb = get_skb_by_index_ll(skb_arr_rq1, | 524 | skb = get_skb_by_index_ll(skb_arr_rq1, |
523 | skb_arr_rq1_len, | 525 | skb_arr_rq1_len, |
524 | wqe_index); | 526 | wqe_index); |
@@ -531,10 +533,11 @@ static int ehea_proc_rwqes(struct net_device *dev, | |||
531 | if (!skb) | 533 | if (!skb) |
532 | break; | 534 | break; |
533 | } | 535 | } |
534 | skb_copy_to_linear_data(skb, ((char*)cqe) + 64, | 536 | skb_copy_to_linear_data(skb, ((char *)cqe) + 64, |
535 | cqe->num_bytes_transfered - 4); | 537 | cqe->num_bytes_transfered - 4); |
536 | ehea_fill_skb(dev, skb, cqe); | 538 | ehea_fill_skb(dev, skb, cqe); |
537 | } else if (rq == 2) { /* RQ2 */ | 539 | } else if (rq == 2) { |
540 | /* RQ2 */ | ||
538 | skb = get_skb_by_index(skb_arr_rq2, | 541 | skb = get_skb_by_index(skb_arr_rq2, |
539 | skb_arr_rq2_len, cqe); | 542 | skb_arr_rq2_len, cqe); |
540 | if (unlikely(!skb)) { | 543 | if (unlikely(!skb)) { |
@@ -544,7 +547,8 @@ static int ehea_proc_rwqes(struct net_device *dev, | |||
544 | } | 547 | } |
545 | ehea_fill_skb(dev, skb, cqe); | 548 | ehea_fill_skb(dev, skb, cqe); |
546 | processed_rq2++; | 549 | processed_rq2++; |
547 | } else { /* RQ3 */ | 550 | } else { |
551 | /* RQ3 */ | ||
548 | skb = get_skb_by_index(skb_arr_rq3, | 552 | skb = get_skb_by_index(skb_arr_rq3, |
549 | skb_arr_rq3_len, cqe); | 553 | skb_arr_rq3_len, cqe); |
550 | if (unlikely(!skb)) { | 554 | if (unlikely(!skb)) { |
@@ -592,7 +596,7 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) | |||
592 | unsigned long flags; | 596 | unsigned long flags; |
593 | 597 | ||
594 | cqe = ehea_poll_cq(send_cq); | 598 | cqe = ehea_poll_cq(send_cq); |
595 | while(cqe && (quota > 0)) { | 599 | while (cqe && (quota > 0)) { |
596 | ehea_inc_cq(send_cq); | 600 | ehea_inc_cq(send_cq); |
597 | 601 | ||
598 | cqe_counter++; | 602 | cqe_counter++; |
@@ -643,7 +647,8 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) | |||
643 | 647 | ||
644 | static int ehea_poll(struct napi_struct *napi, int budget) | 648 | static int ehea_poll(struct napi_struct *napi, int budget) |
645 | { | 649 | { |
646 | struct ehea_port_res *pr = container_of(napi, struct ehea_port_res, napi); | 650 | struct ehea_port_res *pr = container_of(napi, struct ehea_port_res, |
651 | napi); | ||
647 | struct net_device *dev = pr->port->netdev; | 652 | struct net_device *dev = pr->port->netdev; |
648 | struct ehea_cqe *cqe; | 653 | struct ehea_cqe *cqe; |
649 | struct ehea_cqe *cqe_skb = NULL; | 654 | struct ehea_cqe *cqe_skb = NULL; |
@@ -743,8 +748,9 @@ int ehea_sense_port_attr(struct ehea_port *port) | |||
743 | u64 hret; | 748 | u64 hret; |
744 | struct hcp_ehea_port_cb0 *cb0; | 749 | struct hcp_ehea_port_cb0 *cb0; |
745 | 750 | ||
746 | cb0 = kzalloc(PAGE_SIZE, GFP_ATOMIC); /* May be called via */ | 751 | /* may be called via ehea_neq_tasklet() */ |
747 | if (!cb0) { /* ehea_neq_tasklet() */ | 752 | cb0 = kzalloc(PAGE_SIZE, GFP_ATOMIC); |
753 | if (!cb0) { | ||
748 | ehea_error("no mem for cb0"); | 754 | ehea_error("no mem for cb0"); |
749 | ret = -ENOMEM; | 755 | ret = -ENOMEM; |
750 | goto out; | 756 | goto out; |
@@ -762,7 +768,7 @@ int ehea_sense_port_attr(struct ehea_port *port) | |||
762 | /* MAC address */ | 768 | /* MAC address */ |
763 | port->mac_addr = cb0->port_mac_addr << 16; | 769 | port->mac_addr = cb0->port_mac_addr << 16; |
764 | 770 | ||
765 | if (!is_valid_ether_addr((u8*)&port->mac_addr)) { | 771 | if (!is_valid_ether_addr((u8 *)&port->mac_addr)) { |
766 | ret = -EADDRNOTAVAIL; | 772 | ret = -EADDRNOTAVAIL; |
767 | goto out_free; | 773 | goto out_free; |
768 | } | 774 | } |
@@ -994,7 +1000,7 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe) | |||
994 | 1000 | ||
995 | static void ehea_neq_tasklet(unsigned long data) | 1001 | static void ehea_neq_tasklet(unsigned long data) |
996 | { | 1002 | { |
997 | struct ehea_adapter *adapter = (struct ehea_adapter*)data; | 1003 | struct ehea_adapter *adapter = (struct ehea_adapter *)data; |
998 | struct ehea_eqe *eqe; | 1004 | struct ehea_eqe *eqe; |
999 | u64 event_mask; | 1005 | u64 event_mask; |
1000 | 1006 | ||
@@ -1204,7 +1210,7 @@ int ehea_rem_smrs(struct ehea_port_res *pr) | |||
1204 | 1210 | ||
1205 | static int ehea_init_q_skba(struct ehea_q_skb_arr *q_skba, int max_q_entries) | 1211 | static int ehea_init_q_skba(struct ehea_q_skb_arr *q_skba, int max_q_entries) |
1206 | { | 1212 | { |
1207 | int arr_size = sizeof(void*) * max_q_entries; | 1213 | int arr_size = sizeof(void *) * max_q_entries; |
1208 | 1214 | ||
1209 | q_skba->arr = vmalloc(arr_size); | 1215 | q_skba->arr = vmalloc(arr_size); |
1210 | if (!q_skba->arr) | 1216 | if (!q_skba->arr) |
@@ -1489,7 +1495,7 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev, | |||
1489 | 1495 | ||
1490 | nfrags = skb_shinfo(skb)->nr_frags; | 1496 | nfrags = skb_shinfo(skb)->nr_frags; |
1491 | sg1entry = &swqe->u.immdata_desc.sg_entry; | 1497 | sg1entry = &swqe->u.immdata_desc.sg_entry; |
1492 | sg_list = (struct ehea_vsgentry*)&swqe->u.immdata_desc.sg_list; | 1498 | sg_list = (struct ehea_vsgentry *)&swqe->u.immdata_desc.sg_list; |
1493 | swqe->descriptors = 0; | 1499 | swqe->descriptors = 0; |
1494 | sg1entry_contains_frag_data = 0; | 1500 | sg1entry_contains_frag_data = 0; |
1495 | 1501 | ||
@@ -1542,7 +1548,7 @@ static int ehea_broadcast_reg_helper(struct ehea_port *port, u32 hcallid) | |||
1542 | reg_type, port->mac_addr, 0, hcallid); | 1548 | reg_type, port->mac_addr, 0, hcallid); |
1543 | if (hret != H_SUCCESS) { | 1549 | if (hret != H_SUCCESS) { |
1544 | ehea_error("%sregistering bc address failed (tagged)", | 1550 | ehea_error("%sregistering bc address failed (tagged)", |
1545 | hcallid == H_REG_BCMC ? "" : "de"); | 1551 | hcallid == H_REG_BCMC ? "" : "de"); |
1546 | ret = -EIO; | 1552 | ret = -EIO; |
1547 | goto out_herr; | 1553 | goto out_herr; |
1548 | } | 1554 | } |
@@ -1732,7 +1738,7 @@ static void ehea_allmulti(struct net_device *dev, int enable) | |||
1732 | } | 1738 | } |
1733 | } | 1739 | } |
1734 | 1740 | ||
1735 | static void ehea_add_multicast_entry(struct ehea_port* port, u8* mc_mac_addr) | 1741 | static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr) |
1736 | { | 1742 | { |
1737 | struct ehea_mc_list *ehea_mcl_entry; | 1743 | struct ehea_mc_list *ehea_mcl_entry; |
1738 | u64 hret; | 1744 | u64 hret; |
@@ -1791,11 +1797,10 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1791 | goto out; | 1797 | goto out; |
1792 | } | 1798 | } |
1793 | 1799 | ||
1794 | for (i = 0, k_mcl_entry = dev->mc_list; | 1800 | for (i = 0, k_mcl_entry = dev->mc_list; i < dev->mc_count; i++, |
1795 | i < dev->mc_count; | 1801 | k_mcl_entry = k_mcl_entry->next) |
1796 | i++, k_mcl_entry = k_mcl_entry->next) { | ||
1797 | ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr); | 1802 | ehea_add_multicast_entry(port, k_mcl_entry->dmi_addr); |
1798 | } | 1803 | |
1799 | } | 1804 | } |
1800 | out: | 1805 | out: |
1801 | return; | 1806 | return; |
@@ -1925,12 +1930,12 @@ static inline int ehea_hash_skb(struct sk_buff *skb, int num_qps) | |||
1925 | 1930 | ||
1926 | if ((skb->protocol == htons(ETH_P_IP)) && | 1931 | if ((skb->protocol == htons(ETH_P_IP)) && |
1927 | (ip_hdr(skb)->protocol == IPPROTO_TCP)) { | 1932 | (ip_hdr(skb)->protocol == IPPROTO_TCP)) { |
1928 | tcp = (struct tcphdr*)(skb_network_header(skb) + (ip_hdr(skb)->ihl * 4)); | 1933 | tcp = (struct tcphdr *)(skb_network_header(skb) + |
1934 | (ip_hdr(skb)->ihl * 4)); | ||
1929 | tmp = (tcp->source + (tcp->dest << 16)) % 31; | 1935 | tmp = (tcp->source + (tcp->dest << 16)) % 31; |
1930 | tmp += ip_hdr(skb)->daddr % 31; | 1936 | tmp += ip_hdr(skb)->daddr % 31; |
1931 | return tmp % num_qps; | 1937 | return tmp % num_qps; |
1932 | } | 1938 | } else |
1933 | else | ||
1934 | return 0; | 1939 | return 0; |
1935 | } | 1940 | } |
1936 | 1941 | ||
@@ -2122,7 +2127,7 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp) | |||
2122 | u64 hret; | 2127 | u64 hret; |
2123 | u16 dummy16 = 0; | 2128 | u16 dummy16 = 0; |
2124 | u64 dummy64 = 0; | 2129 | u64 dummy64 = 0; |
2125 | struct hcp_modify_qp_cb0* cb0; | 2130 | struct hcp_modify_qp_cb0 *cb0; |
2126 | 2131 | ||
2127 | cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); | 2132 | cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL); |
2128 | if (!cb0) { | 2133 | if (!cb0) { |
@@ -2248,7 +2253,7 @@ static int ehea_clean_all_portres(struct ehea_port *port) | |||
2248 | int ret = 0; | 2253 | int ret = 0; |
2249 | int i; | 2254 | int i; |
2250 | 2255 | ||
2251 | for(i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) | 2256 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) |
2252 | ret |= ehea_clean_portres(port, &port->port_res[i]); | 2257 | ret |= ehea_clean_portres(port, &port->port_res[i]); |
2253 | 2258 | ||
2254 | ret |= ehea_destroy_eq(port->qp_eq); | 2259 | ret |= ehea_destroy_eq(port->qp_eq); |
@@ -2300,7 +2305,7 @@ static int ehea_up(struct net_device *dev) | |||
2300 | goto out_clean_pr; | 2305 | goto out_clean_pr; |
2301 | } | 2306 | } |
2302 | 2307 | ||
2303 | for(i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { | 2308 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { |
2304 | ret = ehea_activate_qp(port->adapter, port->port_res[i].qp); | 2309 | ret = ehea_activate_qp(port->adapter, port->port_res[i].qp); |
2305 | if (ret) { | 2310 | if (ret) { |
2306 | ehea_error("activate_qp failed"); | 2311 | ehea_error("activate_qp failed"); |
@@ -2308,7 +2313,7 @@ static int ehea_up(struct net_device *dev) | |||
2308 | } | 2313 | } |
2309 | } | 2314 | } |
2310 | 2315 | ||
2311 | for(i = 0; i < port->num_def_qps; i++) { | 2316 | for (i = 0; i < port->num_def_qps; i++) { |
2312 | ret = ehea_fill_port_res(&port->port_res[i]); | 2317 | ret = ehea_fill_port_res(&port->port_res[i]); |
2313 | if (ret) { | 2318 | if (ret) { |
2314 | ehea_error("out_free_irqs"); | 2319 | ehea_error("out_free_irqs"); |
@@ -2425,7 +2430,7 @@ int ehea_stop_qps(struct net_device *dev) | |||
2425 | { | 2430 | { |
2426 | struct ehea_port *port = netdev_priv(dev); | 2431 | struct ehea_port *port = netdev_priv(dev); |
2427 | struct ehea_adapter *adapter = port->adapter; | 2432 | struct ehea_adapter *adapter = port->adapter; |
2428 | struct hcp_modify_qp_cb0* cb0; | 2433 | struct hcp_modify_qp_cb0 *cb0; |
2429 | int ret = -EIO; | 2434 | int ret = -EIO; |
2430 | int dret; | 2435 | int dret; |
2431 | int i; | 2436 | int i; |
@@ -2490,7 +2495,7 @@ out: | |||
2490 | return ret; | 2495 | return ret; |
2491 | } | 2496 | } |
2492 | 2497 | ||
2493 | void ehea_update_rqs(struct ehea_qp *orig_qp, struct ehea_port_res * pr) | 2498 | void ehea_update_rqs(struct ehea_qp *orig_qp, struct ehea_port_res *pr) |
2494 | { | 2499 | { |
2495 | struct ehea_qp qp = *orig_qp; | 2500 | struct ehea_qp qp = *orig_qp; |
2496 | struct ehea_qp_init_attr *init_attr = &qp.init_attr; | 2501 | struct ehea_qp_init_attr *init_attr = &qp.init_attr; |
@@ -2530,7 +2535,7 @@ int ehea_restart_qps(struct net_device *dev) | |||
2530 | int ret = 0; | 2535 | int ret = 0; |
2531 | int i; | 2536 | int i; |
2532 | 2537 | ||
2533 | struct hcp_modify_qp_cb0* cb0; | 2538 | struct hcp_modify_qp_cb0 *cb0; |
2534 | u64 hret; | 2539 | u64 hret; |
2535 | u64 dummy64 = 0; | 2540 | u64 dummy64 = 0; |
2536 | u16 dummy16 = 0; | 2541 | u16 dummy16 = 0; |
@@ -2804,34 +2809,6 @@ static void __devinit logical_port_release(struct device *dev) | |||
2804 | of_node_put(port->ofdev.node); | 2809 | of_node_put(port->ofdev.node); |
2805 | } | 2810 | } |
2806 | 2811 | ||
2807 | static int ehea_driver_sysfs_add(struct device *dev, | ||
2808 | struct device_driver *driver) | ||
2809 | { | ||
2810 | int ret; | ||
2811 | |||
2812 | ret = sysfs_create_link(&driver->kobj, &dev->kobj, | ||
2813 | kobject_name(&dev->kobj)); | ||
2814 | if (ret == 0) { | ||
2815 | ret = sysfs_create_link(&dev->kobj, &driver->kobj, | ||
2816 | "driver"); | ||
2817 | if (ret) | ||
2818 | sysfs_remove_link(&driver->kobj, | ||
2819 | kobject_name(&dev->kobj)); | ||
2820 | } | ||
2821 | return ret; | ||
2822 | } | ||
2823 | |||
2824 | static void ehea_driver_sysfs_remove(struct device *dev, | ||
2825 | struct device_driver *driver) | ||
2826 | { | ||
2827 | struct device_driver *drv = driver; | ||
2828 | |||
2829 | if (drv) { | ||
2830 | sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj)); | ||
2831 | sysfs_remove_link(&dev->kobj, "driver"); | ||
2832 | } | ||
2833 | } | ||
2834 | |||
2835 | static struct device *ehea_register_port(struct ehea_port *port, | 2812 | static struct device *ehea_register_port(struct ehea_port *port, |
2836 | struct device_node *dn) | 2813 | struct device_node *dn) |
2837 | { | 2814 | { |
@@ -2856,16 +2833,8 @@ static struct device *ehea_register_port(struct ehea_port *port, | |||
2856 | goto out_unreg_of_dev; | 2833 | goto out_unreg_of_dev; |
2857 | } | 2834 | } |
2858 | 2835 | ||
2859 | ret = ehea_driver_sysfs_add(&port->ofdev.dev, &ehea_driver.driver); | ||
2860 | if (ret) { | ||
2861 | ehea_error("failed to register sysfs driver link"); | ||
2862 | goto out_rem_dev_file; | ||
2863 | } | ||
2864 | |||
2865 | return &port->ofdev.dev; | 2836 | return &port->ofdev.dev; |
2866 | 2837 | ||
2867 | out_rem_dev_file: | ||
2868 | device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id); | ||
2869 | out_unreg_of_dev: | 2838 | out_unreg_of_dev: |
2870 | of_device_unregister(&port->ofdev); | 2839 | of_device_unregister(&port->ofdev); |
2871 | out: | 2840 | out: |
@@ -2874,7 +2843,6 @@ out: | |||
2874 | 2843 | ||
2875 | static void ehea_unregister_port(struct ehea_port *port) | 2844 | static void ehea_unregister_port(struct ehea_port *port) |
2876 | { | 2845 | { |
2877 | ehea_driver_sysfs_remove(&port->ofdev.dev, &ehea_driver.driver); | ||
2878 | device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id); | 2846 | device_remove_file(&port->ofdev.dev, &dev_attr_log_port_id); |
2879 | of_device_unregister(&port->ofdev); | 2847 | of_device_unregister(&port->ofdev); |
2880 | } | 2848 | } |
@@ -3109,7 +3077,7 @@ static ssize_t ehea_probe_port(struct device *dev, | |||
3109 | of_node_put(eth_dn); | 3077 | of_node_put(eth_dn); |
3110 | 3078 | ||
3111 | if (port) { | 3079 | if (port) { |
3112 | for (i=0; i < EHEA_MAX_PORTS; i++) | 3080 | for (i = 0; i < EHEA_MAX_PORTS; i++) |
3113 | if (!adapter->port[i]) { | 3081 | if (!adapter->port[i]) { |
3114 | adapter->port[i] = port; | 3082 | adapter->port[i] = port; |
3115 | break; | 3083 | break; |
@@ -3144,7 +3112,7 @@ static ssize_t ehea_remove_port(struct device *dev, | |||
3144 | 3112 | ||
3145 | ehea_shutdown_single_port(port); | 3113 | ehea_shutdown_single_port(port); |
3146 | 3114 | ||
3147 | for (i=0; i < EHEA_MAX_PORTS; i++) | 3115 | for (i = 0; i < EHEA_MAX_PORTS; i++) |
3148 | if (adapter->port[i] == port) { | 3116 | if (adapter->port[i] == port) { |
3149 | adapter->port[i] = NULL; | 3117 | adapter->port[i] = NULL; |
3150 | break; | 3118 | break; |
@@ -3313,7 +3281,7 @@ static int ehea_reboot_notifier(struct notifier_block *nb, | |||
3313 | } | 3281 | } |
3314 | 3282 | ||
3315 | static struct notifier_block ehea_reboot_nb = { | 3283 | static struct notifier_block ehea_reboot_nb = { |
3316 | .notifier_call = ehea_reboot_notifier, | 3284 | .notifier_call = ehea_reboot_notifier, |
3317 | }; | 3285 | }; |
3318 | 3286 | ||
3319 | static int check_module_parm(void) | 3287 | static int check_module_parm(void) |
diff --git a/drivers/net/ehea/ehea_phyp.c b/drivers/net/ehea/ehea_phyp.c index 95c4a7f9cc88..156eb6320b4e 100644 --- a/drivers/net/ehea/ehea_phyp.c +++ b/drivers/net/ehea/ehea_phyp.c | |||
@@ -6,9 +6,9 @@ | |||
6 | * (C) Copyright IBM Corp. 2006 | 6 | * (C) Copyright IBM Corp. 2006 |
7 | * | 7 | * |
8 | * Authors: | 8 | * Authors: |
9 | * Christoph Raisch <raisch@de.ibm.com> | 9 | * Christoph Raisch <raisch@de.ibm.com> |
10 | * Jan-Bernd Themann <themann@de.ibm.com> | 10 | * Jan-Bernd Themann <themann@de.ibm.com> |
11 | * Thomas Klein <tklein@de.ibm.com> | 11 | * Thomas Klein <tklein@de.ibm.com> |
12 | * | 12 | * |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or modify | 14 | * This program is free software; you can redistribute it and/or modify |
@@ -38,11 +38,11 @@ static inline u16 get_order_of_qentries(u16 queue_entries) | |||
38 | } | 38 | } |
39 | 39 | ||
40 | /* Defines for H_CALL H_ALLOC_RESOURCE */ | 40 | /* Defines for H_CALL H_ALLOC_RESOURCE */ |
41 | #define H_ALL_RES_TYPE_QP 1 | 41 | #define H_ALL_RES_TYPE_QP 1 |
42 | #define H_ALL_RES_TYPE_CQ 2 | 42 | #define H_ALL_RES_TYPE_CQ 2 |
43 | #define H_ALL_RES_TYPE_EQ 3 | 43 | #define H_ALL_RES_TYPE_EQ 3 |
44 | #define H_ALL_RES_TYPE_MR 5 | 44 | #define H_ALL_RES_TYPE_MR 5 |
45 | #define H_ALL_RES_TYPE_MW 6 | 45 | #define H_ALL_RES_TYPE_MW 6 |
46 | 46 | ||
47 | static long ehea_plpar_hcall_norets(unsigned long opcode, | 47 | static long ehea_plpar_hcall_norets(unsigned long opcode, |
48 | unsigned long arg1, | 48 | unsigned long arg1, |
@@ -137,77 +137,77 @@ u64 ehea_h_query_ehea_qp(const u64 adapter_handle, const u8 qp_category, | |||
137 | const u64 qp_handle, const u64 sel_mask, void *cb_addr) | 137 | const u64 qp_handle, const u64 sel_mask, void *cb_addr) |
138 | { | 138 | { |
139 | return ehea_plpar_hcall_norets(H_QUERY_HEA_QP, | 139 | return ehea_plpar_hcall_norets(H_QUERY_HEA_QP, |
140 | adapter_handle, /* R4 */ | 140 | adapter_handle, /* R4 */ |
141 | qp_category, /* R5 */ | 141 | qp_category, /* R5 */ |
142 | qp_handle, /* R6 */ | 142 | qp_handle, /* R6 */ |
143 | sel_mask, /* R7 */ | 143 | sel_mask, /* R7 */ |
144 | virt_to_abs(cb_addr), /* R8 */ | 144 | virt_to_abs(cb_addr), /* R8 */ |
145 | 0, 0); | 145 | 0, 0); |
146 | } | 146 | } |
147 | 147 | ||
148 | /* input param R5 */ | 148 | /* input param R5 */ |
149 | #define H_ALL_RES_QP_EQPO EHEA_BMASK_IBM(9, 11) | 149 | #define H_ALL_RES_QP_EQPO EHEA_BMASK_IBM(9, 11) |
150 | #define H_ALL_RES_QP_QPP EHEA_BMASK_IBM(12, 12) | 150 | #define H_ALL_RES_QP_QPP EHEA_BMASK_IBM(12, 12) |
151 | #define H_ALL_RES_QP_RQR EHEA_BMASK_IBM(13, 15) | 151 | #define H_ALL_RES_QP_RQR EHEA_BMASK_IBM(13, 15) |
152 | #define H_ALL_RES_QP_EQEG EHEA_BMASK_IBM(16, 16) | 152 | #define H_ALL_RES_QP_EQEG EHEA_BMASK_IBM(16, 16) |
153 | #define H_ALL_RES_QP_LL_QP EHEA_BMASK_IBM(17, 17) | 153 | #define H_ALL_RES_QP_LL_QP EHEA_BMASK_IBM(17, 17) |
154 | #define H_ALL_RES_QP_DMA128 EHEA_BMASK_IBM(19, 19) | 154 | #define H_ALL_RES_QP_DMA128 EHEA_BMASK_IBM(19, 19) |
155 | #define H_ALL_RES_QP_HSM EHEA_BMASK_IBM(20, 21) | 155 | #define H_ALL_RES_QP_HSM EHEA_BMASK_IBM(20, 21) |
156 | #define H_ALL_RES_QP_SIGT EHEA_BMASK_IBM(22, 23) | 156 | #define H_ALL_RES_QP_SIGT EHEA_BMASK_IBM(22, 23) |
157 | #define H_ALL_RES_QP_TENURE EHEA_BMASK_IBM(48, 55) | 157 | #define H_ALL_RES_QP_TENURE EHEA_BMASK_IBM(48, 55) |
158 | #define H_ALL_RES_QP_RES_TYP EHEA_BMASK_IBM(56, 63) | 158 | #define H_ALL_RES_QP_RES_TYP EHEA_BMASK_IBM(56, 63) |
159 | 159 | ||
160 | /* input param R9 */ | 160 | /* input param R9 */ |
161 | #define H_ALL_RES_QP_TOKEN EHEA_BMASK_IBM(0, 31) | 161 | #define H_ALL_RES_QP_TOKEN EHEA_BMASK_IBM(0, 31) |
162 | #define H_ALL_RES_QP_PD EHEA_BMASK_IBM(32,63) | 162 | #define H_ALL_RES_QP_PD EHEA_BMASK_IBM(32, 63) |
163 | 163 | ||
164 | /* input param R10 */ | 164 | /* input param R10 */ |
165 | #define H_ALL_RES_QP_MAX_SWQE EHEA_BMASK_IBM(4, 7) | 165 | #define H_ALL_RES_QP_MAX_SWQE EHEA_BMASK_IBM(4, 7) |
166 | #define H_ALL_RES_QP_MAX_R1WQE EHEA_BMASK_IBM(12, 15) | 166 | #define H_ALL_RES_QP_MAX_R1WQE EHEA_BMASK_IBM(12, 15) |
167 | #define H_ALL_RES_QP_MAX_R2WQE EHEA_BMASK_IBM(20, 23) | 167 | #define H_ALL_RES_QP_MAX_R2WQE EHEA_BMASK_IBM(20, 23) |
168 | #define H_ALL_RES_QP_MAX_R3WQE EHEA_BMASK_IBM(28, 31) | 168 | #define H_ALL_RES_QP_MAX_R3WQE EHEA_BMASK_IBM(28, 31) |
169 | /* Max Send Scatter Gather Elements */ | 169 | /* Max Send Scatter Gather Elements */ |
170 | #define H_ALL_RES_QP_MAX_SSGE EHEA_BMASK_IBM(37, 39) | 170 | #define H_ALL_RES_QP_MAX_SSGE EHEA_BMASK_IBM(37, 39) |
171 | #define H_ALL_RES_QP_MAX_R1SGE EHEA_BMASK_IBM(45, 47) | 171 | #define H_ALL_RES_QP_MAX_R1SGE EHEA_BMASK_IBM(45, 47) |
172 | /* Max Receive SG Elements RQ1 */ | 172 | /* Max Receive SG Elements RQ1 */ |
173 | #define H_ALL_RES_QP_MAX_R2SGE EHEA_BMASK_IBM(53, 55) | 173 | #define H_ALL_RES_QP_MAX_R2SGE EHEA_BMASK_IBM(53, 55) |
174 | #define H_ALL_RES_QP_MAX_R3SGE EHEA_BMASK_IBM(61, 63) | 174 | #define H_ALL_RES_QP_MAX_R3SGE EHEA_BMASK_IBM(61, 63) |
175 | 175 | ||
176 | /* input param R11 */ | 176 | /* input param R11 */ |
177 | #define H_ALL_RES_QP_SWQE_IDL EHEA_BMASK_IBM(0, 7) | 177 | #define H_ALL_RES_QP_SWQE_IDL EHEA_BMASK_IBM(0, 7) |
178 | /* max swqe immediate data length */ | 178 | /* max swqe immediate data length */ |
179 | #define H_ALL_RES_QP_PORT_NUM EHEA_BMASK_IBM(48, 63) | 179 | #define H_ALL_RES_QP_PORT_NUM EHEA_BMASK_IBM(48, 63) |
180 | 180 | ||
181 | /* input param R12 */ | 181 | /* input param R12 */ |
182 | #define H_ALL_RES_QP_TH_RQ2 EHEA_BMASK_IBM(0, 15) | 182 | #define H_ALL_RES_QP_TH_RQ2 EHEA_BMASK_IBM(0, 15) |
183 | /* Threshold RQ2 */ | 183 | /* Threshold RQ2 */ |
184 | #define H_ALL_RES_QP_TH_RQ3 EHEA_BMASK_IBM(16, 31) | 184 | #define H_ALL_RES_QP_TH_RQ3 EHEA_BMASK_IBM(16, 31) |
185 | /* Threshold RQ3 */ | 185 | /* Threshold RQ3 */ |
186 | 186 | ||
187 | /* output param R6 */ | 187 | /* output param R6 */ |
188 | #define H_ALL_RES_QP_ACT_SWQE EHEA_BMASK_IBM(0, 15) | 188 | #define H_ALL_RES_QP_ACT_SWQE EHEA_BMASK_IBM(0, 15) |
189 | #define H_ALL_RES_QP_ACT_R1WQE EHEA_BMASK_IBM(16, 31) | 189 | #define H_ALL_RES_QP_ACT_R1WQE EHEA_BMASK_IBM(16, 31) |
190 | #define H_ALL_RES_QP_ACT_R2WQE EHEA_BMASK_IBM(32, 47) | 190 | #define H_ALL_RES_QP_ACT_R2WQE EHEA_BMASK_IBM(32, 47) |
191 | #define H_ALL_RES_QP_ACT_R3WQE EHEA_BMASK_IBM(48, 63) | 191 | #define H_ALL_RES_QP_ACT_R3WQE EHEA_BMASK_IBM(48, 63) |
192 | 192 | ||
193 | /* output param, R7 */ | 193 | /* output param, R7 */ |
194 | #define H_ALL_RES_QP_ACT_SSGE EHEA_BMASK_IBM(0, 7) | 194 | #define H_ALL_RES_QP_ACT_SSGE EHEA_BMASK_IBM(0, 7) |
195 | #define H_ALL_RES_QP_ACT_R1SGE EHEA_BMASK_IBM(8, 15) | 195 | #define H_ALL_RES_QP_ACT_R1SGE EHEA_BMASK_IBM(8, 15) |
196 | #define H_ALL_RES_QP_ACT_R2SGE EHEA_BMASK_IBM(16, 23) | 196 | #define H_ALL_RES_QP_ACT_R2SGE EHEA_BMASK_IBM(16, 23) |
197 | #define H_ALL_RES_QP_ACT_R3SGE EHEA_BMASK_IBM(24, 31) | 197 | #define H_ALL_RES_QP_ACT_R3SGE EHEA_BMASK_IBM(24, 31) |
198 | #define H_ALL_RES_QP_ACT_SWQE_IDL EHEA_BMASK_IBM(32, 39) | 198 | #define H_ALL_RES_QP_ACT_SWQE_IDL EHEA_BMASK_IBM(32, 39) |
199 | 199 | ||
200 | /* output param R8,R9 */ | 200 | /* output param R8,R9 */ |
201 | #define H_ALL_RES_QP_SIZE_SQ EHEA_BMASK_IBM(0, 31) | 201 | #define H_ALL_RES_QP_SIZE_SQ EHEA_BMASK_IBM(0, 31) |
202 | #define H_ALL_RES_QP_SIZE_RQ1 EHEA_BMASK_IBM(32, 63) | 202 | #define H_ALL_RES_QP_SIZE_RQ1 EHEA_BMASK_IBM(32, 63) |
203 | #define H_ALL_RES_QP_SIZE_RQ2 EHEA_BMASK_IBM(0, 31) | 203 | #define H_ALL_RES_QP_SIZE_RQ2 EHEA_BMASK_IBM(0, 31) |
204 | #define H_ALL_RES_QP_SIZE_RQ3 EHEA_BMASK_IBM(32, 63) | 204 | #define H_ALL_RES_QP_SIZE_RQ3 EHEA_BMASK_IBM(32, 63) |
205 | 205 | ||
206 | /* output param R11,R12 */ | 206 | /* output param R11,R12 */ |
207 | #define H_ALL_RES_QP_LIOBN_SQ EHEA_BMASK_IBM(0, 31) | 207 | #define H_ALL_RES_QP_LIOBN_SQ EHEA_BMASK_IBM(0, 31) |
208 | #define H_ALL_RES_QP_LIOBN_RQ1 EHEA_BMASK_IBM(32, 63) | 208 | #define H_ALL_RES_QP_LIOBN_RQ1 EHEA_BMASK_IBM(32, 63) |
209 | #define H_ALL_RES_QP_LIOBN_RQ2 EHEA_BMASK_IBM(0, 31) | 209 | #define H_ALL_RES_QP_LIOBN_RQ2 EHEA_BMASK_IBM(0, 31) |
210 | #define H_ALL_RES_QP_LIOBN_RQ3 EHEA_BMASK_IBM(32, 63) | 210 | #define H_ALL_RES_QP_LIOBN_RQ3 EHEA_BMASK_IBM(32, 63) |
211 | 211 | ||
212 | u64 ehea_h_alloc_resource_qp(const u64 adapter_handle, | 212 | u64 ehea_h_alloc_resource_qp(const u64 adapter_handle, |
213 | struct ehea_qp_init_attr *init_attr, const u32 pd, | 213 | struct ehea_qp_init_attr *init_attr, const u32 pd, |
@@ -334,28 +334,28 @@ u64 ehea_h_alloc_resource_cq(const u64 adapter_handle, | |||
334 | } | 334 | } |
335 | 335 | ||
336 | /* Defines for H_CALL H_ALLOC_RESOURCE */ | 336 | /* Defines for H_CALL H_ALLOC_RESOURCE */ |
337 | #define H_ALL_RES_TYPE_QP 1 | 337 | #define H_ALL_RES_TYPE_QP 1 |
338 | #define H_ALL_RES_TYPE_CQ 2 | 338 | #define H_ALL_RES_TYPE_CQ 2 |
339 | #define H_ALL_RES_TYPE_EQ 3 | 339 | #define H_ALL_RES_TYPE_EQ 3 |
340 | #define H_ALL_RES_TYPE_MR 5 | 340 | #define H_ALL_RES_TYPE_MR 5 |
341 | #define H_ALL_RES_TYPE_MW 6 | 341 | #define H_ALL_RES_TYPE_MW 6 |
342 | 342 | ||
343 | /* input param R5 */ | 343 | /* input param R5 */ |
344 | #define H_ALL_RES_EQ_NEQ EHEA_BMASK_IBM(0, 0) | 344 | #define H_ALL_RES_EQ_NEQ EHEA_BMASK_IBM(0, 0) |
345 | #define H_ALL_RES_EQ_NON_NEQ_ISN EHEA_BMASK_IBM(6, 7) | 345 | #define H_ALL_RES_EQ_NON_NEQ_ISN EHEA_BMASK_IBM(6, 7) |
346 | #define H_ALL_RES_EQ_INH_EQE_GEN EHEA_BMASK_IBM(16, 16) | 346 | #define H_ALL_RES_EQ_INH_EQE_GEN EHEA_BMASK_IBM(16, 16) |
347 | #define H_ALL_RES_EQ_RES_TYPE EHEA_BMASK_IBM(56, 63) | 347 | #define H_ALL_RES_EQ_RES_TYPE EHEA_BMASK_IBM(56, 63) |
348 | /* input param R6 */ | 348 | /* input param R6 */ |
349 | #define H_ALL_RES_EQ_MAX_EQE EHEA_BMASK_IBM(32, 63) | 349 | #define H_ALL_RES_EQ_MAX_EQE EHEA_BMASK_IBM(32, 63) |
350 | 350 | ||
351 | /* output param R6 */ | 351 | /* output param R6 */ |
352 | #define H_ALL_RES_EQ_LIOBN EHEA_BMASK_IBM(32, 63) | 352 | #define H_ALL_RES_EQ_LIOBN EHEA_BMASK_IBM(32, 63) |
353 | 353 | ||
354 | /* output param R7 */ | 354 | /* output param R7 */ |
355 | #define H_ALL_RES_EQ_ACT_EQE EHEA_BMASK_IBM(32, 63) | 355 | #define H_ALL_RES_EQ_ACT_EQE EHEA_BMASK_IBM(32, 63) |
356 | 356 | ||
357 | /* output param R8 */ | 357 | /* output param R8 */ |
358 | #define H_ALL_RES_EQ_ACT_PS EHEA_BMASK_IBM(32, 63) | 358 | #define H_ALL_RES_EQ_ACT_PS EHEA_BMASK_IBM(32, 63) |
359 | 359 | ||
360 | /* output param R9 */ | 360 | /* output param R9 */ |
361 | #define H_ALL_RES_EQ_ACT_EQ_IST_C EHEA_BMASK_IBM(30, 31) | 361 | #define H_ALL_RES_EQ_ACT_EQ_IST_C EHEA_BMASK_IBM(30, 31) |
@@ -453,12 +453,12 @@ u64 ehea_h_register_smr(const u64 adapter_handle, const u64 orig_mr_handle, | |||
453 | 453 | ||
454 | hret = ehea_plpar_hcall9(H_REGISTER_SMR, | 454 | hret = ehea_plpar_hcall9(H_REGISTER_SMR, |
455 | outs, | 455 | outs, |
456 | adapter_handle , /* R4 */ | 456 | adapter_handle , /* R4 */ |
457 | orig_mr_handle, /* R5 */ | 457 | orig_mr_handle, /* R5 */ |
458 | vaddr_in, /* R6 */ | 458 | vaddr_in, /* R6 */ |
459 | (((u64)access_ctrl) << 32ULL), /* R7 */ | 459 | (((u64)access_ctrl) << 32ULL), /* R7 */ |
460 | pd, /* R8 */ | 460 | pd, /* R8 */ |
461 | 0, 0, 0, 0); /* R9-R12 */ | 461 | 0, 0, 0, 0); /* R9-R12 */ |
462 | 462 | ||
463 | mr->handle = outs[0]; | 463 | mr->handle = outs[0]; |
464 | mr->lkey = (u32)outs[2]; | 464 | mr->lkey = (u32)outs[2]; |
@@ -471,11 +471,11 @@ u64 ehea_h_disable_and_get_hea(const u64 adapter_handle, const u64 qp_handle) | |||
471 | u64 outs[PLPAR_HCALL9_BUFSIZE]; | 471 | u64 outs[PLPAR_HCALL9_BUFSIZE]; |
472 | 472 | ||
473 | return ehea_plpar_hcall9(H_DISABLE_AND_GET_HEA, | 473 | return ehea_plpar_hcall9(H_DISABLE_AND_GET_HEA, |
474 | outs, | 474 | outs, |
475 | adapter_handle, /* R4 */ | 475 | adapter_handle, /* R4 */ |
476 | H_DISABLE_GET_EHEA_WQE_P, /* R5 */ | 476 | H_DISABLE_GET_EHEA_WQE_P, /* R5 */ |
477 | qp_handle, /* R6 */ | 477 | qp_handle, /* R6 */ |
478 | 0, 0, 0, 0, 0, 0); /* R7-R12 */ | 478 | 0, 0, 0, 0, 0, 0); /* R7-R12 */ |
479 | } | 479 | } |
480 | 480 | ||
481 | u64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle, | 481 | u64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle, |
@@ -483,9 +483,9 @@ u64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle, | |||
483 | { | 483 | { |
484 | return ehea_plpar_hcall_norets(H_FREE_RESOURCE, | 484 | return ehea_plpar_hcall_norets(H_FREE_RESOURCE, |
485 | adapter_handle, /* R4 */ | 485 | adapter_handle, /* R4 */ |
486 | res_handle, /* R5 */ | 486 | res_handle, /* R5 */ |
487 | force_bit, | 487 | force_bit, |
488 | 0, 0, 0, 0); /* R7-R10 */ | 488 | 0, 0, 0, 0); /* R7-R10 */ |
489 | } | 489 | } |
490 | 490 | ||
491 | u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr, | 491 | u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr, |
@@ -493,13 +493,13 @@ u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr, | |||
493 | const u32 pd, u64 *mr_handle, u32 *lkey) | 493 | const u32 pd, u64 *mr_handle, u32 *lkey) |
494 | { | 494 | { |
495 | u64 hret; | 495 | u64 hret; |
496 | u64 outs[PLPAR_HCALL9_BUFSIZE]; | 496 | u64 outs[PLPAR_HCALL9_BUFSIZE]; |
497 | 497 | ||
498 | hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE, | 498 | hret = ehea_plpar_hcall9(H_ALLOC_HEA_RESOURCE, |
499 | outs, | 499 | outs, |
500 | adapter_handle, /* R4 */ | 500 | adapter_handle, /* R4 */ |
501 | 5, /* R5 */ | 501 | 5, /* R5 */ |
502 | vaddr, /* R6 */ | 502 | vaddr, /* R6 */ |
503 | length, /* R7 */ | 503 | length, /* R7 */ |
504 | (((u64) access_ctrl) << 32ULL), /* R8 */ | 504 | (((u64) access_ctrl) << 32ULL), /* R8 */ |
505 | pd, /* R9 */ | 505 | pd, /* R9 */ |
@@ -619,8 +619,8 @@ u64 ehea_h_error_data(const u64 adapter_handle, const u64 ressource_handle, | |||
619 | void *rblock) | 619 | void *rblock) |
620 | { | 620 | { |
621 | return ehea_plpar_hcall_norets(H_ERROR_DATA, | 621 | return ehea_plpar_hcall_norets(H_ERROR_DATA, |
622 | adapter_handle, /* R4 */ | 622 | adapter_handle, /* R4 */ |
623 | ressource_handle, /* R5 */ | 623 | ressource_handle, /* R5 */ |
624 | virt_to_abs(rblock), /* R6 */ | 624 | virt_to_abs(rblock), /* R6 */ |
625 | 0, 0, 0, 0); /* R7-R12 */ | 625 | 0, 0, 0, 0); /* R7-R12 */ |
626 | } | 626 | } |
diff --git a/drivers/net/ehea/ehea_phyp.h b/drivers/net/ehea/ehea_phyp.h index faa191d23b86..f3628c803567 100644 --- a/drivers/net/ehea/ehea_phyp.h +++ b/drivers/net/ehea/ehea_phyp.h | |||
@@ -93,7 +93,7 @@ static inline void hcp_epas_ctor(struct h_epas *epas, u64 paddr_kernel, | |||
93 | static inline void hcp_epas_dtor(struct h_epas *epas) | 93 | static inline void hcp_epas_dtor(struct h_epas *epas) |
94 | { | 94 | { |
95 | if (epas->kernel.addr) | 95 | if (epas->kernel.addr) |
96 | iounmap((void __iomem*)((u64)epas->kernel.addr & PAGE_MASK)); | 96 | iounmap((void __iomem *)((u64)epas->kernel.addr & PAGE_MASK)); |
97 | 97 | ||
98 | epas->user.addr = 0; | 98 | epas->user.addr = 0; |
99 | epas->kernel.addr = 0; | 99 | epas->kernel.addr = 0; |
@@ -388,23 +388,23 @@ u64 ehea_h_modify_ehea_qp(const u64 adapter_handle, | |||
388 | const u64 qp_handle, | 388 | const u64 qp_handle, |
389 | const u64 sel_mask, | 389 | const u64 sel_mask, |
390 | void *cb_addr, | 390 | void *cb_addr, |
391 | u64 * inv_attr_id, | 391 | u64 *inv_attr_id, |
392 | u64 * proc_mask, u16 * out_swr, u16 * out_rwr); | 392 | u64 *proc_mask, u16 *out_swr, u16 *out_rwr); |
393 | 393 | ||
394 | u64 ehea_h_alloc_resource_eq(const u64 adapter_handle, | 394 | u64 ehea_h_alloc_resource_eq(const u64 adapter_handle, |
395 | struct ehea_eq_attr *eq_attr, u64 * eq_handle); | 395 | struct ehea_eq_attr *eq_attr, u64 *eq_handle); |
396 | 396 | ||
397 | u64 ehea_h_alloc_resource_cq(const u64 adapter_handle, | 397 | u64 ehea_h_alloc_resource_cq(const u64 adapter_handle, |
398 | struct ehea_cq_attr *cq_attr, | 398 | struct ehea_cq_attr *cq_attr, |
399 | u64 * cq_handle, struct h_epas *epas); | 399 | u64 *cq_handle, struct h_epas *epas); |
400 | 400 | ||
401 | u64 ehea_h_alloc_resource_qp(const u64 adapter_handle, | 401 | u64 ehea_h_alloc_resource_qp(const u64 adapter_handle, |
402 | struct ehea_qp_init_attr *init_attr, | 402 | struct ehea_qp_init_attr *init_attr, |
403 | const u32 pd, | 403 | const u32 pd, |
404 | u64 * qp_handle, struct h_epas *h_epas); | 404 | u64 *qp_handle, struct h_epas *h_epas); |
405 | 405 | ||
406 | #define H_REG_RPAGE_PAGE_SIZE EHEA_BMASK_IBM(48,55) | 406 | #define H_REG_RPAGE_PAGE_SIZE EHEA_BMASK_IBM(48, 55) |
407 | #define H_REG_RPAGE_QT EHEA_BMASK_IBM(62,63) | 407 | #define H_REG_RPAGE_QT EHEA_BMASK_IBM(62, 63) |
408 | 408 | ||
409 | u64 ehea_h_register_rpage(const u64 adapter_handle, | 409 | u64 ehea_h_register_rpage(const u64 adapter_handle, |
410 | const u8 pagesize, | 410 | const u8 pagesize, |
@@ -426,7 +426,7 @@ u64 ehea_h_free_resource(const u64 adapter_handle, const u64 res_handle, | |||
426 | 426 | ||
427 | u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr, | 427 | u64 ehea_h_alloc_resource_mr(const u64 adapter_handle, const u64 vaddr, |
428 | const u64 length, const u32 access_ctrl, | 428 | const u64 length, const u32 access_ctrl, |
429 | const u32 pd, u64 * mr_handle, u32 * lkey); | 429 | const u32 pd, u64 *mr_handle, u32 *lkey); |
430 | 430 | ||
431 | u64 ehea_h_register_rpage_mr(const u64 adapter_handle, const u64 mr_handle, | 431 | u64 ehea_h_register_rpage_mr(const u64 adapter_handle, const u64 mr_handle, |
432 | const u8 pagesize, const u8 queue_type, | 432 | const u8 pagesize, const u8 queue_type, |
@@ -439,8 +439,8 @@ u64 ehea_h_register_smr(const u64 adapter_handle, const u64 orig_mr_handle, | |||
439 | u64 ehea_h_query_ehea(const u64 adapter_handle, void *cb_addr); | 439 | u64 ehea_h_query_ehea(const u64 adapter_handle, void *cb_addr); |
440 | 440 | ||
441 | /* output param R5 */ | 441 | /* output param R5 */ |
442 | #define H_MEHEAPORT_CAT EHEA_BMASK_IBM(40,47) | 442 | #define H_MEHEAPORT_CAT EHEA_BMASK_IBM(40, 47) |
443 | #define H_MEHEAPORT_PN EHEA_BMASK_IBM(48,63) | 443 | #define H_MEHEAPORT_PN EHEA_BMASK_IBM(48, 63) |
444 | 444 | ||
445 | u64 ehea_h_query_ehea_port(const u64 adapter_handle, const u16 port_num, | 445 | u64 ehea_h_query_ehea_port(const u64 adapter_handle, const u16 port_num, |
446 | const u8 cb_cat, const u64 select_mask, | 446 | const u8 cb_cat, const u64 select_mask, |
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c index 83b76432b41a..d522e905f460 100644 --- a/drivers/net/ehea/ehea_qmr.c +++ b/drivers/net/ehea/ehea_qmr.c | |||
@@ -33,8 +33,6 @@ | |||
33 | 33 | ||
34 | 34 | ||
35 | struct ehea_busmap ehea_bmap = { 0, 0, NULL }; | 35 | struct ehea_busmap ehea_bmap = { 0, 0, NULL }; |
36 | extern u64 ehea_driver_flags; | ||
37 | extern struct work_struct ehea_rereg_mr_task; | ||
38 | 36 | ||
39 | 37 | ||
40 | static void *hw_qpageit_get_inc(struct hw_queue *queue) | 38 | static void *hw_qpageit_get_inc(struct hw_queue *queue) |
@@ -65,7 +63,7 @@ static int hw_queue_ctor(struct hw_queue *queue, const u32 nr_of_pages, | |||
65 | } | 63 | } |
66 | 64 | ||
67 | queue->queue_length = nr_of_pages * pagesize; | 65 | queue->queue_length = nr_of_pages * pagesize; |
68 | queue->queue_pages = kmalloc(nr_of_pages * sizeof(void*), GFP_KERNEL); | 66 | queue->queue_pages = kmalloc(nr_of_pages * sizeof(void *), GFP_KERNEL); |
69 | if (!queue->queue_pages) { | 67 | if (!queue->queue_pages) { |
70 | ehea_error("no mem for queue_pages"); | 68 | ehea_error("no mem for queue_pages"); |
71 | return -ENOMEM; | 69 | return -ENOMEM; |
@@ -78,11 +76,11 @@ static int hw_queue_ctor(struct hw_queue *queue, const u32 nr_of_pages, | |||
78 | */ | 76 | */ |
79 | i = 0; | 77 | i = 0; |
80 | while (i < nr_of_pages) { | 78 | while (i < nr_of_pages) { |
81 | u8 *kpage = (u8*)get_zeroed_page(GFP_KERNEL); | 79 | u8 *kpage = (u8 *)get_zeroed_page(GFP_KERNEL); |
82 | if (!kpage) | 80 | if (!kpage) |
83 | goto out_nomem; | 81 | goto out_nomem; |
84 | for (k = 0; k < pages_per_kpage && i < nr_of_pages; k++) { | 82 | for (k = 0; k < pages_per_kpage && i < nr_of_pages; k++) { |
85 | (queue->queue_pages)[i] = (struct ehea_page*)kpage; | 83 | (queue->queue_pages)[i] = (struct ehea_page *)kpage; |
86 | kpage += pagesize; | 84 | kpage += pagesize; |
87 | i++; | 85 | i++; |
88 | } | 86 | } |
@@ -235,8 +233,8 @@ int ehea_destroy_cq(struct ehea_cq *cq) | |||
235 | return 0; | 233 | return 0; |
236 | 234 | ||
237 | hcp_epas_dtor(&cq->epas); | 235 | hcp_epas_dtor(&cq->epas); |
238 | 236 | hret = ehea_destroy_cq_res(cq, NORMAL_FREE); | |
239 | if ((hret = ehea_destroy_cq_res(cq, NORMAL_FREE)) == H_R_STATE) { | 237 | if (hret == H_R_STATE) { |
240 | ehea_error_data(cq->adapter, cq->fw_handle); | 238 | ehea_error_data(cq->adapter, cq->fw_handle); |
241 | hret = ehea_destroy_cq_res(cq, FORCE_FREE); | 239 | hret = ehea_destroy_cq_res(cq, FORCE_FREE); |
242 | } | 240 | } |
@@ -301,13 +299,13 @@ struct ehea_eq *ehea_create_eq(struct ehea_adapter *adapter, | |||
301 | if (i == (eq->attr.nr_pages - 1)) { | 299 | if (i == (eq->attr.nr_pages - 1)) { |
302 | /* last page */ | 300 | /* last page */ |
303 | vpage = hw_qpageit_get_inc(&eq->hw_queue); | 301 | vpage = hw_qpageit_get_inc(&eq->hw_queue); |
304 | if ((hret != H_SUCCESS) || (vpage)) { | 302 | if ((hret != H_SUCCESS) || (vpage)) |
305 | goto out_kill_hwq; | 303 | goto out_kill_hwq; |
306 | } | 304 | |
307 | } else { | 305 | } else { |
308 | if ((hret != H_PAGE_REGISTERED) || (!vpage)) { | 306 | if ((hret != H_PAGE_REGISTERED) || (!vpage)) |
309 | goto out_kill_hwq; | 307 | goto out_kill_hwq; |
310 | } | 308 | |
311 | } | 309 | } |
312 | } | 310 | } |
313 | 311 | ||
@@ -331,7 +329,7 @@ struct ehea_eqe *ehea_poll_eq(struct ehea_eq *eq) | |||
331 | unsigned long flags; | 329 | unsigned long flags; |
332 | 330 | ||
333 | spin_lock_irqsave(&eq->spinlock, flags); | 331 | spin_lock_irqsave(&eq->spinlock, flags); |
334 | eqe = (struct ehea_eqe*)hw_eqit_eq_get_inc_valid(&eq->hw_queue); | 332 | eqe = (struct ehea_eqe *)hw_eqit_eq_get_inc_valid(&eq->hw_queue); |
335 | spin_unlock_irqrestore(&eq->spinlock, flags); | 333 | spin_unlock_irqrestore(&eq->spinlock, flags); |
336 | 334 | ||
337 | return eqe; | 335 | return eqe; |
@@ -364,7 +362,8 @@ int ehea_destroy_eq(struct ehea_eq *eq) | |||
364 | 362 | ||
365 | hcp_epas_dtor(&eq->epas); | 363 | hcp_epas_dtor(&eq->epas); |
366 | 364 | ||
367 | if ((hret = ehea_destroy_eq_res(eq, NORMAL_FREE)) == H_R_STATE) { | 365 | hret = ehea_destroy_eq_res(eq, NORMAL_FREE); |
366 | if (hret == H_R_STATE) { | ||
368 | ehea_error_data(eq->adapter, eq->fw_handle); | 367 | ehea_error_data(eq->adapter, eq->fw_handle); |
369 | hret = ehea_destroy_eq_res(eq, FORCE_FREE); | 368 | hret = ehea_destroy_eq_res(eq, FORCE_FREE); |
370 | } | 369 | } |
@@ -546,7 +545,8 @@ int ehea_destroy_qp(struct ehea_qp *qp) | |||
546 | 545 | ||
547 | hcp_epas_dtor(&qp->epas); | 546 | hcp_epas_dtor(&qp->epas); |
548 | 547 | ||
549 | if ((hret = ehea_destroy_qp_res(qp, NORMAL_FREE)) == H_R_STATE) { | 548 | hret = ehea_destroy_qp_res(qp, NORMAL_FREE); |
549 | if (hret == H_R_STATE) { | ||
550 | ehea_error_data(qp->adapter, qp->fw_handle); | 550 | ehea_error_data(qp->adapter, qp->fw_handle); |
551 | hret = ehea_destroy_qp_res(qp, FORCE_FREE); | 551 | hret = ehea_destroy_qp_res(qp, FORCE_FREE); |
552 | } | 552 | } |
@@ -559,7 +559,7 @@ int ehea_destroy_qp(struct ehea_qp *qp) | |||
559 | return 0; | 559 | return 0; |
560 | } | 560 | } |
561 | 561 | ||
562 | int ehea_create_busmap( void ) | 562 | int ehea_create_busmap(void) |
563 | { | 563 | { |
564 | u64 vaddr = EHEA_BUSMAP_START; | 564 | u64 vaddr = EHEA_BUSMAP_START; |
565 | unsigned long high_section_index = 0; | 565 | unsigned long high_section_index = 0; |
@@ -595,7 +595,7 @@ int ehea_create_busmap( void ) | |||
595 | return 0; | 595 | return 0; |
596 | } | 596 | } |
597 | 597 | ||
598 | void ehea_destroy_busmap( void ) | 598 | void ehea_destroy_busmap(void) |
599 | { | 599 | { |
600 | vfree(ehea_bmap.vaddr); | 600 | vfree(ehea_bmap.vaddr); |
601 | } | 601 | } |
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h index bc62d389c166..0bb6f92fa2f8 100644 --- a/drivers/net/ehea/ehea_qmr.h +++ b/drivers/net/ehea/ehea_qmr.h | |||
@@ -41,8 +41,8 @@ | |||
41 | #define EHEA_SECTSIZE (1UL << 24) | 41 | #define EHEA_SECTSIZE (1UL << 24) |
42 | #define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> EHEA_PAGESHIFT) | 42 | #define EHEA_PAGES_PER_SECTION (EHEA_SECTSIZE >> EHEA_PAGESHIFT) |
43 | 43 | ||
44 | #if (1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE | 44 | #if ((1UL << SECTION_SIZE_BITS) < EHEA_SECTSIZE) |
45 | #error eHEA module can't work if kernel sectionsize < ehea sectionsize | 45 | #error eHEA module cannot work if kernel sectionsize < ehea sectionsize |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | /* Some abbreviations used here: | 48 | /* Some abbreviations used here: |
@@ -188,8 +188,8 @@ struct ehea_eqe { | |||
188 | u64 entry; | 188 | u64 entry; |
189 | }; | 189 | }; |
190 | 190 | ||
191 | #define ERROR_DATA_LENGTH EHEA_BMASK_IBM(52,63) | 191 | #define ERROR_DATA_LENGTH EHEA_BMASK_IBM(52, 63) |
192 | #define ERROR_DATA_TYPE EHEA_BMASK_IBM(0,7) | 192 | #define ERROR_DATA_TYPE EHEA_BMASK_IBM(0, 7) |
193 | 193 | ||
194 | static inline void *hw_qeit_calc(struct hw_queue *queue, u64 q_offset) | 194 | static inline void *hw_qeit_calc(struct hw_queue *queue, u64 q_offset) |
195 | { | 195 | { |
@@ -279,7 +279,7 @@ static inline void *hw_qeit_eq_get_inc(struct hw_queue *queue) | |||
279 | static inline void *hw_eqit_eq_get_inc_valid(struct hw_queue *queue) | 279 | static inline void *hw_eqit_eq_get_inc_valid(struct hw_queue *queue) |
280 | { | 280 | { |
281 | void *retvalue = hw_qeit_get(queue); | 281 | void *retvalue = hw_qeit_get(queue); |
282 | u32 qe = *(u8*)retvalue; | 282 | u32 qe = *(u8 *)retvalue; |
283 | if ((qe >> 7) == (queue->toggle_state & 1)) | 283 | if ((qe >> 7) == (queue->toggle_state & 1)) |
284 | hw_qeit_eq_get_inc(queue); | 284 | hw_qeit_eq_get_inc(queue); |
285 | else | 285 | else |
@@ -364,7 +364,7 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, int cqe, | |||
364 | 364 | ||
365 | int ehea_destroy_cq(struct ehea_cq *cq); | 365 | int ehea_destroy_cq(struct ehea_cq *cq); |
366 | 366 | ||
367 | struct ehea_qp *ehea_create_qp(struct ehea_adapter * adapter, u32 pd, | 367 | struct ehea_qp *ehea_create_qp(struct ehea_adapter *adapter, u32 pd, |
368 | struct ehea_qp_init_attr *init_attr); | 368 | struct ehea_qp_init_attr *init_attr); |
369 | 369 | ||
370 | int ehea_destroy_qp(struct ehea_qp *qp); | 370 | int ehea_destroy_qp(struct ehea_qp *qp); |
@@ -378,8 +378,8 @@ int ehea_rem_mr(struct ehea_mr *mr); | |||
378 | 378 | ||
379 | void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle); | 379 | void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle); |
380 | 380 | ||
381 | int ehea_create_busmap( void ); | 381 | int ehea_create_busmap(void); |
382 | void ehea_destroy_busmap( void ); | 382 | void ehea_destroy_busmap(void); |
383 | u64 ehea_map_vaddr(void *caddr); | 383 | u64 ehea_map_vaddr(void *caddr); |
384 | 384 | ||
385 | #endif /* __EHEA_QMR_H__ */ | 385 | #endif /* __EHEA_QMR_H__ */ |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 7667a62ac31f..36342230a6de 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -13,7 +13,7 @@ | |||
13 | * Copyright (C) 2004 Andrew de Quincey (wol support) | 13 | * Copyright (C) 2004 Andrew de Quincey (wol support) |
14 | * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane | 14 | * Copyright (C) 2004 Carl-Daniel Hailfinger (invalid MAC handling, insane |
15 | * IRQ rate fixes, bigendian fixes, cleanups, verification) | 15 | * IRQ rate fixes, bigendian fixes, cleanups, verification) |
16 | * Copyright (c) 2004,5,6 NVIDIA Corporation | 16 | * Copyright (c) 2004,2005,2006,2007,2008 NVIDIA Corporation |
17 | * | 17 | * |
18 | * This program is free software; you can redistribute it and/or modify | 18 | * This program is free software; you can redistribute it and/or modify |
19 | * it under the terms of the GNU General Public License as published by | 19 | * it under the terms of the GNU General Public License as published by |
@@ -226,7 +226,7 @@ enum { | |||
226 | #define NVREG_MISC1_HD 0x02 | 226 | #define NVREG_MISC1_HD 0x02 |
227 | #define NVREG_MISC1_FORCE 0x3b0f3c | 227 | #define NVREG_MISC1_FORCE 0x3b0f3c |
228 | 228 | ||
229 | NvRegMacReset = 0x3c, | 229 | NvRegMacReset = 0x34, |
230 | #define NVREG_MAC_RESET_ASSERT 0x0F3 | 230 | #define NVREG_MAC_RESET_ASSERT 0x0F3 |
231 | NvRegTransmitterControl = 0x084, | 231 | NvRegTransmitterControl = 0x084, |
232 | #define NVREG_XMITCTL_START 0x01 | 232 | #define NVREG_XMITCTL_START 0x01 |
@@ -277,7 +277,9 @@ enum { | |||
277 | #define NVREG_MCASTADDRA_FORCE 0x01 | 277 | #define NVREG_MCASTADDRA_FORCE 0x01 |
278 | NvRegMulticastAddrB = 0xB4, | 278 | NvRegMulticastAddrB = 0xB4, |
279 | NvRegMulticastMaskA = 0xB8, | 279 | NvRegMulticastMaskA = 0xB8, |
280 | #define NVREG_MCASTMASKA_NONE 0xffffffff | ||
280 | NvRegMulticastMaskB = 0xBC, | 281 | NvRegMulticastMaskB = 0xBC, |
282 | #define NVREG_MCASTMASKB_NONE 0xffff | ||
281 | 283 | ||
282 | NvRegPhyInterface = 0xC0, | 284 | NvRegPhyInterface = 0xC0, |
283 | #define PHY_RGMII 0x10000000 | 285 | #define PHY_RGMII 0x10000000 |
@@ -316,8 +318,8 @@ enum { | |||
316 | NvRegTxRingPhysAddrHigh = 0x148, | 318 | NvRegTxRingPhysAddrHigh = 0x148, |
317 | NvRegRxRingPhysAddrHigh = 0x14C, | 319 | NvRegRxRingPhysAddrHigh = 0x14C, |
318 | NvRegTxPauseFrame = 0x170, | 320 | NvRegTxPauseFrame = 0x170, |
319 | #define NVREG_TX_PAUSEFRAME_DISABLE 0x1ff0080 | 321 | #define NVREG_TX_PAUSEFRAME_DISABLE 0x01ff0080 |
320 | #define NVREG_TX_PAUSEFRAME_ENABLE 0x0c00030 | 322 | #define NVREG_TX_PAUSEFRAME_ENABLE 0x01800010 |
321 | NvRegMIIStatus = 0x180, | 323 | NvRegMIIStatus = 0x180, |
322 | #define NVREG_MIISTAT_ERROR 0x0001 | 324 | #define NVREG_MIISTAT_ERROR 0x0001 |
323 | #define NVREG_MIISTAT_LINKCHANGE 0x0008 | 325 | #define NVREG_MIISTAT_LINKCHANGE 0x0008 |
@@ -471,9 +473,9 @@ union ring_type { | |||
471 | #define NV_RX_AVAIL (1<<31) | 473 | #define NV_RX_AVAIL (1<<31) |
472 | 474 | ||
473 | #define NV_RX2_CHECKSUMMASK (0x1C000000) | 475 | #define NV_RX2_CHECKSUMMASK (0x1C000000) |
474 | #define NV_RX2_CHECKSUMOK1 (0x10000000) | 476 | #define NV_RX2_CHECKSUM_IP (0x10000000) |
475 | #define NV_RX2_CHECKSUMOK2 (0x14000000) | 477 | #define NV_RX2_CHECKSUM_IP_TCP (0x14000000) |
476 | #define NV_RX2_CHECKSUMOK3 (0x18000000) | 478 | #define NV_RX2_CHECKSUM_IP_UDP (0x18000000) |
477 | #define NV_RX2_DESCRIPTORVALID (1<<29) | 479 | #define NV_RX2_DESCRIPTORVALID (1<<29) |
478 | #define NV_RX2_SUBSTRACT1 (1<<25) | 480 | #define NV_RX2_SUBSTRACT1 (1<<25) |
479 | #define NV_RX2_ERROR1 (1<<18) | 481 | #define NV_RX2_ERROR1 (1<<18) |
@@ -2375,14 +2377,9 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
2375 | goto next_pkt; | 2377 | goto next_pkt; |
2376 | } | 2378 | } |
2377 | } | 2379 | } |
2378 | if ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK2)/*ip and tcp */ { | 2380 | if (((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUM_IP_TCP) || /*ip and tcp */ |
2381 | ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUM_IP_UDP)) /*ip and udp */ | ||
2379 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 2382 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
2380 | } else { | ||
2381 | if ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK1 || | ||
2382 | (flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK3) { | ||
2383 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
2384 | } | ||
2385 | } | ||
2386 | } else { | 2383 | } else { |
2387 | dev_kfree_skb(skb); | 2384 | dev_kfree_skb(skb); |
2388 | goto next_pkt; | 2385 | goto next_pkt; |
@@ -2474,14 +2471,9 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit) | |||
2474 | } | 2471 | } |
2475 | } | 2472 | } |
2476 | 2473 | ||
2477 | if ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK2)/*ip and tcp */ { | 2474 | if (((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUM_IP_TCP) || /*ip and tcp */ |
2475 | ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUM_IP_UDP)) /*ip and udp */ | ||
2478 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 2476 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
2479 | } else { | ||
2480 | if ((flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK1 || | ||
2481 | (flags & NV_RX2_CHECKSUMMASK) == NV_RX2_CHECKSUMOK3) { | ||
2482 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
2483 | } | ||
2484 | } | ||
2485 | 2477 | ||
2486 | /* got a valid packet - forward it to the network core */ | 2478 | /* got a valid packet - forward it to the network core */ |
2487 | skb_put(skb, len); | 2479 | skb_put(skb, len); |
@@ -2703,6 +2695,9 @@ static void nv_set_multicast(struct net_device *dev) | |||
2703 | addr[1] = alwaysOn[1]; | 2695 | addr[1] = alwaysOn[1]; |
2704 | mask[0] = alwaysOn[0] | alwaysOff[0]; | 2696 | mask[0] = alwaysOn[0] | alwaysOff[0]; |
2705 | mask[1] = alwaysOn[1] | alwaysOff[1]; | 2697 | mask[1] = alwaysOn[1] | alwaysOff[1]; |
2698 | } else { | ||
2699 | mask[0] = NVREG_MCASTMASKA_NONE; | ||
2700 | mask[1] = NVREG_MCASTMASKB_NONE; | ||
2706 | } | 2701 | } |
2707 | } | 2702 | } |
2708 | addr[0] |= NVREG_MCASTADDRA_FORCE; | 2703 | addr[0] |= NVREG_MCASTADDRA_FORCE; |
@@ -4813,8 +4808,8 @@ static int nv_open(struct net_device *dev) | |||
4813 | nv_mac_reset(dev); | 4808 | nv_mac_reset(dev); |
4814 | writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); | 4809 | writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); |
4815 | writel(0, base + NvRegMulticastAddrB); | 4810 | writel(0, base + NvRegMulticastAddrB); |
4816 | writel(0, base + NvRegMulticastMaskA); | 4811 | writel(NVREG_MCASTMASKA_NONE, base + NvRegMulticastMaskA); |
4817 | writel(0, base + NvRegMulticastMaskB); | 4812 | writel(NVREG_MCASTMASKB_NONE, base + NvRegMulticastMaskB); |
4818 | writel(0, base + NvRegPacketFilterFlags); | 4813 | writel(0, base + NvRegPacketFilterFlags); |
4819 | 4814 | ||
4820 | writel(0, base + NvRegTransmitterControl); | 4815 | writel(0, base + NvRegTransmitterControl); |
@@ -4908,8 +4903,8 @@ static int nv_open(struct net_device *dev) | |||
4908 | spin_lock_irq(&np->lock); | 4903 | spin_lock_irq(&np->lock); |
4909 | writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); | 4904 | writel(NVREG_MCASTADDRA_FORCE, base + NvRegMulticastAddrA); |
4910 | writel(0, base + NvRegMulticastAddrB); | 4905 | writel(0, base + NvRegMulticastAddrB); |
4911 | writel(0, base + NvRegMulticastMaskA); | 4906 | writel(NVREG_MCASTMASKA_NONE, base + NvRegMulticastMaskA); |
4912 | writel(0, base + NvRegMulticastMaskB); | 4907 | writel(NVREG_MCASTMASKB_NONE, base + NvRegMulticastMaskB); |
4913 | writel(NVREG_PFF_ALWAYS|NVREG_PFF_MYADDR, base + NvRegPacketFilterFlags); | 4908 | writel(NVREG_PFF_ALWAYS|NVREG_PFF_MYADDR, base + NvRegPacketFilterFlags); |
4914 | /* One manual link speed update: Interrupts are enabled, future link | 4909 | /* One manual link speed update: Interrupts are enabled, future link |
4915 | * speed changes cause interrupts and are handled by nv_link_irq(). | 4910 | * speed changes cause interrupts and are handled by nv_link_irq(). |
@@ -5603,35 +5598,35 @@ static struct pci_device_id pci_tbl[] = { | |||
5603 | }, | 5598 | }, |
5604 | { /* MCP77 Ethernet Controller */ | 5599 | { /* MCP77 Ethernet Controller */ |
5605 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32), | 5600 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32), |
5606 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5601 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, |
5607 | }, | 5602 | }, |
5608 | { /* MCP77 Ethernet Controller */ | 5603 | { /* MCP77 Ethernet Controller */ |
5609 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33), | 5604 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33), |
5610 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5605 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, |
5611 | }, | 5606 | }, |
5612 | { /* MCP77 Ethernet Controller */ | 5607 | { /* MCP77 Ethernet Controller */ |
5613 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34), | 5608 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34), |
5614 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5609 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, |
5615 | }, | 5610 | }, |
5616 | { /* MCP77 Ethernet Controller */ | 5611 | { /* MCP77 Ethernet Controller */ |
5617 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), | 5612 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), |
5618 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5613 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, |
5619 | }, | 5614 | }, |
5620 | { /* MCP79 Ethernet Controller */ | 5615 | { /* MCP79 Ethernet Controller */ |
5621 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), | 5616 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), |
5622 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5617 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, |
5623 | }, | 5618 | }, |
5624 | { /* MCP79 Ethernet Controller */ | 5619 | { /* MCP79 Ethernet Controller */ |
5625 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), | 5620 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), |
5626 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5621 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, |
5627 | }, | 5622 | }, |
5628 | { /* MCP79 Ethernet Controller */ | 5623 | { /* MCP79 Ethernet Controller */ |
5629 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), | 5624 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), |
5630 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5625 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, |
5631 | }, | 5626 | }, |
5632 | { /* MCP79 Ethernet Controller */ | 5627 | { /* MCP79 Ethernet Controller */ |
5633 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), | 5628 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), |
5634 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5629 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, |
5635 | }, | 5630 | }, |
5636 | {0,}, | 5631 | {0,}, |
5637 | }; | 5632 | }; |
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index 46e2c52c7862..95e3464068db 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c | |||
@@ -901,12 +901,12 @@ static short ibmlana_adapter_ids[] __initdata = { | |||
901 | 0x0000 | 901 | 0x0000 |
902 | }; | 902 | }; |
903 | 903 | ||
904 | static char *ibmlana_adapter_names[] __initdata = { | 904 | static char *ibmlana_adapter_names[] __devinitdata = { |
905 | "IBM LAN Adapter/A", | 905 | "IBM LAN Adapter/A", |
906 | NULL | 906 | NULL |
907 | }; | 907 | }; |
908 | 908 | ||
909 | static int ibmlana_init_one(struct device *kdev) | 909 | static int __devinit ibmlana_init_one(struct device *kdev) |
910 | { | 910 | { |
911 | struct mca_device *mdev = to_mca_device(kdev); | 911 | struct mca_device *mdev = to_mca_device(kdev); |
912 | struct net_device *dev; | 912 | struct net_device *dev; |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index f3c144d5d72f..d4eb8e2d8720 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -438,7 +438,6 @@ static int igb_request_irq(struct igb_adapter *adapter) | |||
438 | if (adapter->msix_entries) { | 438 | if (adapter->msix_entries) { |
439 | err = igb_request_msix(adapter); | 439 | err = igb_request_msix(adapter); |
440 | if (!err) { | 440 | if (!err) { |
441 | struct e1000_hw *hw = &adapter->hw; | ||
442 | /* enable IAM, auto-mask, | 441 | /* enable IAM, auto-mask, |
443 | * DO NOT USE EIAME or IAME in legacy mode */ | 442 | * DO NOT USE EIAME or IAME in legacy mode */ |
444 | wr32(E1000_IAM, IMS_ENABLE_MASK); | 443 | wr32(E1000_IAM, IMS_ENABLE_MASK); |
diff --git a/drivers/net/irda/ali-ircc.h b/drivers/net/irda/ali-ircc.h index e489c6661ee8..07876578887f 100644 --- a/drivers/net/irda/ali-ircc.h +++ b/drivers/net/irda/ali-ircc.h | |||
@@ -173,13 +173,13 @@ struct st_fifo { | |||
173 | 173 | ||
174 | struct frame_cb { | 174 | struct frame_cb { |
175 | void *start; /* Start of frame in DMA mem */ | 175 | void *start; /* Start of frame in DMA mem */ |
176 | int len; /* Lenght of frame in DMA mem */ | 176 | int len; /* Length of frame in DMA mem */ |
177 | }; | 177 | }; |
178 | 178 | ||
179 | struct tx_fifo { | 179 | struct tx_fifo { |
180 | struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */ | 180 | struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */ |
181 | int ptr; /* Currently being sent */ | 181 | int ptr; /* Currently being sent */ |
182 | int len; /* Lenght of queue */ | 182 | int len; /* Length of queue */ |
183 | int free; /* Next free slot */ | 183 | int free; /* Next free slot */ |
184 | void *tail; /* Next free start in DMA mem */ | 184 | void *tail; /* Next free start in DMA mem */ |
185 | }; | 185 | }; |
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h index bbdc97ff83ca..29398a4f73fd 100644 --- a/drivers/net/irda/nsc-ircc.h +++ b/drivers/net/irda/nsc-ircc.h | |||
@@ -231,13 +231,13 @@ struct st_fifo { | |||
231 | 231 | ||
232 | struct frame_cb { | 232 | struct frame_cb { |
233 | void *start; /* Start of frame in DMA mem */ | 233 | void *start; /* Start of frame in DMA mem */ |
234 | int len; /* Lenght of frame in DMA mem */ | 234 | int len; /* Length of frame in DMA mem */ |
235 | }; | 235 | }; |
236 | 236 | ||
237 | struct tx_fifo { | 237 | struct tx_fifo { |
238 | struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */ | 238 | struct frame_cb queue[MAX_TX_WINDOW]; /* Info about frames in queue */ |
239 | int ptr; /* Currently being sent */ | 239 | int ptr; /* Currently being sent */ |
240 | int len; /* Lenght of queue */ | 240 | int len; /* Length of queue */ |
241 | int free; /* Next free slot */ | 241 | int free; /* Next free slot */ |
242 | void *tail; /* Next free start in DMA mem */ | 242 | void *tail; /* Next free start in DMA mem */ |
243 | }; | 243 | }; |
diff --git a/drivers/net/irda/via-ircc.h b/drivers/net/irda/via-ircc.h index 204b1b34ffc7..9d012f0dbd30 100644 --- a/drivers/net/irda/via-ircc.h +++ b/drivers/net/irda/via-ircc.h | |||
@@ -54,13 +54,13 @@ struct st_fifo { | |||
54 | 54 | ||
55 | struct frame_cb { | 55 | struct frame_cb { |
56 | void *start; /* Start of frame in DMA mem */ | 56 | void *start; /* Start of frame in DMA mem */ |
57 | int len; /* Lenght of frame in DMA mem */ | 57 | int len; /* Length of frame in DMA mem */ |
58 | }; | 58 | }; |
59 | 59 | ||
60 | struct tx_fifo { | 60 | struct tx_fifo { |
61 | struct frame_cb queue[MAX_TX_WINDOW + 2]; /* Info about frames in queue */ | 61 | struct frame_cb queue[MAX_TX_WINDOW + 2]; /* Info about frames in queue */ |
62 | int ptr; /* Currently being sent */ | 62 | int ptr; /* Currently being sent */ |
63 | int len; /* Lenght of queue */ | 63 | int len; /* Length of queue */ |
64 | int free; /* Next free slot */ | 64 | int free; /* Next free slot */ |
65 | void *tail; /* Next free start in DMA mem */ | 65 | void *tail; /* Next free start in DMA mem */ |
66 | }; | 66 | }; |
diff --git a/drivers/net/lib8390.c b/drivers/net/lib8390.c index c429a5002dd6..0c5447dac03b 100644 --- a/drivers/net/lib8390.c +++ b/drivers/net/lib8390.c | |||
@@ -148,7 +148,7 @@ static void __NS8390_init(struct net_device *dev, int startp); | |||
148 | * | 148 | * |
149 | * "The author (me) didn't use spin_lock_irqsave because the slowness of the | 149 | * "The author (me) didn't use spin_lock_irqsave because the slowness of the |
150 | * card means that approach caused horrible problems like losing serial data | 150 | * card means that approach caused horrible problems like losing serial data |
151 | * at 38400 baud on some chips. Rememeber many 8390 nics on PCI were ISA | 151 | * at 38400 baud on some chips. Remember many 8390 nics on PCI were ISA |
152 | * chips with FPGA front ends. | 152 | * chips with FPGA front ends. |
153 | * | 153 | * |
154 | * Ok the logic behind the 8390 is very simple: | 154 | * Ok the logic behind the 8390 is very simple: |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index e10528ed9081..81bf005ff280 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -1084,7 +1084,7 @@ static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1084 | return phy_mii_ioctl(phydev, if_mii(rq), cmd); | 1084 | return phy_mii_ioctl(phydev, if_mii(rq), cmd); |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | static int __devinit macb_probe(struct platform_device *pdev) | 1087 | static int __init macb_probe(struct platform_device *pdev) |
1088 | { | 1088 | { |
1089 | struct eth_platform_data *pdata; | 1089 | struct eth_platform_data *pdata; |
1090 | struct resource *regs; | 1090 | struct resource *regs; |
@@ -1248,7 +1248,7 @@ err_out: | |||
1248 | return err; | 1248 | return err; |
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | static int __devexit macb_remove(struct platform_device *pdev) | 1251 | static int __exit macb_remove(struct platform_device *pdev) |
1252 | { | 1252 | { |
1253 | struct net_device *dev; | 1253 | struct net_device *dev; |
1254 | struct macb *bp; | 1254 | struct macb *bp; |
@@ -1276,8 +1276,7 @@ static int __devexit macb_remove(struct platform_device *pdev) | |||
1276 | } | 1276 | } |
1277 | 1277 | ||
1278 | static struct platform_driver macb_driver = { | 1278 | static struct platform_driver macb_driver = { |
1279 | .probe = macb_probe, | 1279 | .remove = __exit_p(macb_remove), |
1280 | .remove = __devexit_p(macb_remove), | ||
1281 | .driver = { | 1280 | .driver = { |
1282 | .name = "macb", | 1281 | .name = "macb", |
1283 | }, | 1282 | }, |
@@ -1285,7 +1284,7 @@ static struct platform_driver macb_driver = { | |||
1285 | 1284 | ||
1286 | static int __init macb_init(void) | 1285 | static int __init macb_init(void) |
1287 | { | 1286 | { |
1288 | return platform_driver_register(&macb_driver); | 1287 | return platform_driver_probe(&macb_driver, macb_probe); |
1289 | } | 1288 | } |
1290 | 1289 | ||
1291 | static void __exit macb_exit(void) | 1290 | static void __exit macb_exit(void) |
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c index aafc3ce59cbb..6d343efb2717 100644 --- a/drivers/net/mipsnet.c +++ b/drivers/net/mipsnet.c | |||
@@ -4,8 +4,6 @@ | |||
4 | * for more details. | 4 | * for more details. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #define DEBUG | ||
8 | |||
9 | #include <linux/init.h> | 7 | #include <linux/init.h> |
10 | #include <linux/io.h> | 8 | #include <linux/io.h> |
11 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
@@ -15,11 +13,93 @@ | |||
15 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
16 | #include <asm/mips-boards/simint.h> | 14 | #include <asm/mips-boards/simint.h> |
17 | 15 | ||
18 | #include "mipsnet.h" /* actual device IO mapping */ | 16 | #define MIPSNET_VERSION "2007-11-17" |
17 | |||
18 | /* | ||
19 | * Net status/control block as seen by sw in the core. | ||
20 | */ | ||
21 | struct mipsnet_regs { | ||
22 | /* | ||
23 | * Device info for probing, reads as MIPSNET%d where %d is some | ||
24 | * form of version. | ||
25 | */ | ||
26 | u64 devId; /*0x00 */ | ||
19 | 27 | ||
20 | #define MIPSNET_VERSION "2005-06-20" | 28 | /* |
29 | * read only busy flag. | ||
30 | * Set and cleared by the Net Device to indicate that an rx or a tx | ||
31 | * is in progress. | ||
32 | */ | ||
33 | u32 busy; /*0x08 */ | ||
21 | 34 | ||
22 | #define mipsnet_reg_address(dev, field) (dev->base_addr + field_offset(field)) | 35 | /* |
36 | * Set by the Net Device. | ||
37 | * The device will set it once data has been received. | ||
38 | * The value is the number of bytes that should be read from | ||
39 | * rxDataBuffer. The value will decrease till 0 until all the data | ||
40 | * from rxDataBuffer has been read. | ||
41 | */ | ||
42 | u32 rxDataCount; /*0x0c */ | ||
43 | #define MIPSNET_MAX_RXTX_DATACOUNT (1 << 16) | ||
44 | |||
45 | /* | ||
46 | * Settable from the MIPS core, cleared by the Net Device. | ||
47 | * The core should set the number of bytes it wants to send, | ||
48 | * then it should write those bytes of data to txDataBuffer. | ||
49 | * The device will clear txDataCount has been processed (not | ||
50 | * necessarily sent). | ||
51 | */ | ||
52 | u32 txDataCount; /*0x10 */ | ||
53 | |||
54 | /* | ||
55 | * Interrupt control | ||
56 | * | ||
57 | * Used to clear the interrupted generated by this dev. | ||
58 | * Write a 1 to clear the interrupt. (except bit31). | ||
59 | * | ||
60 | * Bit0 is set if it was a tx-done interrupt. | ||
61 | * Bit1 is set when new rx-data is available. | ||
62 | * Until this bit is cleared there will be no other RXs. | ||
63 | * | ||
64 | * Bit31 is used for testing, it clears after a read. | ||
65 | * Writing 1 to this bit will cause an interrupt to be generated. | ||
66 | * To clear the test interrupt, write 0 to this register. | ||
67 | */ | ||
68 | u32 interruptControl; /*0x14 */ | ||
69 | #define MIPSNET_INTCTL_TXDONE (1u << 0) | ||
70 | #define MIPSNET_INTCTL_RXDONE (1u << 1) | ||
71 | #define MIPSNET_INTCTL_TESTBIT (1u << 31) | ||
72 | |||
73 | /* | ||
74 | * Readonly core-specific interrupt info for the device to signal | ||
75 | * the core. The meaning of the contents of this field might change. | ||
76 | */ | ||
77 | /* XXX: the whole memIntf interrupt scheme is messy: the device | ||
78 | * should have no control what so ever of what VPE/register set is | ||
79 | * being used. | ||
80 | * The MemIntf should only expose interrupt lines, and something in | ||
81 | * the config should be responsible for the line<->core/vpe bindings. | ||
82 | */ | ||
83 | u32 interruptInfo; /*0x18 */ | ||
84 | |||
85 | /* | ||
86 | * This is where the received data is read out. | ||
87 | * There is more data to read until rxDataReady is 0. | ||
88 | * Only 1 byte at this regs offset is used. | ||
89 | */ | ||
90 | u32 rxDataBuffer; /*0x1c */ | ||
91 | |||
92 | /* | ||
93 | * This is where the data to transmit is written. | ||
94 | * Data should be written for the amount specified in the | ||
95 | * txDataCount register. | ||
96 | * Only 1 byte at this regs offset is used. | ||
97 | */ | ||
98 | u32 txDataBuffer; /*0x20 */ | ||
99 | }; | ||
100 | |||
101 | #define regaddr(dev, field) \ | ||
102 | (dev->base_addr + offsetof(struct mipsnet_regs, field)) | ||
23 | 103 | ||
24 | static char mipsnet_string[] = "mipsnet"; | 104 | static char mipsnet_string[] = "mipsnet"; |
25 | 105 | ||
@@ -29,32 +109,27 @@ static char mipsnet_string[] = "mipsnet"; | |||
29 | static int ioiocpy_frommipsnet(struct net_device *dev, unsigned char *kdata, | 109 | static int ioiocpy_frommipsnet(struct net_device *dev, unsigned char *kdata, |
30 | int len) | 110 | int len) |
31 | { | 111 | { |
32 | uint32_t available_len = inl(mipsnet_reg_address(dev, rxDataCount)); | ||
33 | |||
34 | if (available_len < len) | ||
35 | return -EFAULT; | ||
36 | |||
37 | for (; len > 0; len--, kdata++) | 112 | for (; len > 0; len--, kdata++) |
38 | *kdata = inb(mipsnet_reg_address(dev, rxDataBuffer)); | 113 | *kdata = inb(regaddr(dev, rxDataBuffer)); |
39 | 114 | ||
40 | return inl(mipsnet_reg_address(dev, rxDataCount)); | 115 | return inl(regaddr(dev, rxDataCount)); |
41 | } | 116 | } |
42 | 117 | ||
43 | static inline ssize_t mipsnet_put_todevice(struct net_device *dev, | 118 | static inline void mipsnet_put_todevice(struct net_device *dev, |
44 | struct sk_buff *skb) | 119 | struct sk_buff *skb) |
45 | { | 120 | { |
46 | int count_to_go = skb->len; | 121 | int count_to_go = skb->len; |
47 | char *buf_ptr = skb->data; | 122 | char *buf_ptr = skb->data; |
48 | 123 | ||
49 | outl(skb->len, mipsnet_reg_address(dev, txDataCount)); | 124 | outl(skb->len, regaddr(dev, txDataCount)); |
50 | 125 | ||
51 | for (; count_to_go; buf_ptr++, count_to_go--) | 126 | for (; count_to_go; buf_ptr++, count_to_go--) |
52 | outb(*buf_ptr, mipsnet_reg_address(dev, txDataBuffer)); | 127 | outb(*buf_ptr, regaddr(dev, txDataBuffer)); |
53 | 128 | ||
54 | dev->stats.tx_packets++; | 129 | dev->stats.tx_packets++; |
55 | dev->stats.tx_bytes += skb->len; | 130 | dev->stats.tx_bytes += skb->len; |
56 | 131 | ||
57 | return skb->len; | 132 | dev_kfree_skb(skb); |
58 | } | 133 | } |
59 | 134 | ||
60 | static int mipsnet_xmit(struct sk_buff *skb, struct net_device *dev) | 135 | static int mipsnet_xmit(struct sk_buff *skb, struct net_device *dev) |
@@ -69,18 +144,20 @@ static int mipsnet_xmit(struct sk_buff *skb, struct net_device *dev) | |||
69 | return 0; | 144 | return 0; |
70 | } | 145 | } |
71 | 146 | ||
72 | static inline ssize_t mipsnet_get_fromdev(struct net_device *dev, size_t count) | 147 | static inline ssize_t mipsnet_get_fromdev(struct net_device *dev, size_t len) |
73 | { | 148 | { |
74 | struct sk_buff *skb; | 149 | struct sk_buff *skb; |
75 | size_t len = count; | ||
76 | 150 | ||
77 | skb = alloc_skb(len + 2, GFP_KERNEL); | 151 | if (!len) |
152 | return len; | ||
153 | |||
154 | skb = dev_alloc_skb(len + NET_IP_ALIGN); | ||
78 | if (!skb) { | 155 | if (!skb) { |
79 | dev->stats.rx_dropped++; | 156 | dev->stats.rx_dropped++; |
80 | return -ENOMEM; | 157 | return -ENOMEM; |
81 | } | 158 | } |
82 | 159 | ||
83 | skb_reserve(skb, 2); | 160 | skb_reserve(skb, NET_IP_ALIGN); |
84 | if (ioiocpy_frommipsnet(dev, skb_put(skb, len), len)) | 161 | if (ioiocpy_frommipsnet(dev, skb_put(skb, len), len)) |
85 | return -EFAULT; | 162 | return -EFAULT; |
86 | 163 | ||
@@ -92,50 +169,42 @@ static inline ssize_t mipsnet_get_fromdev(struct net_device *dev, size_t count) | |||
92 | dev->stats.rx_packets++; | 169 | dev->stats.rx_packets++; |
93 | dev->stats.rx_bytes += len; | 170 | dev->stats.rx_bytes += len; |
94 | 171 | ||
95 | return count; | 172 | return len; |
96 | } | 173 | } |
97 | 174 | ||
98 | static irqreturn_t mipsnet_interrupt(int irq, void *dev_id) | 175 | static irqreturn_t mipsnet_interrupt(int irq, void *dev_id) |
99 | { | 176 | { |
100 | struct net_device *dev = dev_id; | 177 | struct net_device *dev = dev_id; |
101 | 178 | u32 int_flags; | |
102 | irqreturn_t retval = IRQ_NONE; | 179 | irqreturn_t ret = IRQ_NONE; |
103 | uint64_t interruptFlags; | 180 | |
104 | 181 | if (irq != dev->irq) | |
105 | if (irq == dev->irq) { | 182 | goto out_badirq; |
106 | retval = IRQ_HANDLED; | 183 | |
107 | 184 | /* TESTBIT is cleared on read. */ | |
108 | interruptFlags = | 185 | int_flags = inl(regaddr(dev, interruptControl)); |
109 | inl(mipsnet_reg_address(dev, interruptControl)); | 186 | if (int_flags & MIPSNET_INTCTL_TESTBIT) { |
110 | 187 | /* TESTBIT takes effect after a write with 0. */ | |
111 | if (interruptFlags & MIPSNET_INTCTL_TXDONE) { | 188 | outl(0, regaddr(dev, interruptControl)); |
112 | outl(MIPSNET_INTCTL_TXDONE, | 189 | ret = IRQ_HANDLED; |
113 | mipsnet_reg_address(dev, interruptControl)); | 190 | } else if (int_flags & MIPSNET_INTCTL_TXDONE) { |
114 | /* only one packet at a time, we are done. */ | 191 | /* Only one packet at a time, we are done. */ |
115 | netif_wake_queue(dev); | 192 | dev->stats.tx_packets++; |
116 | } else if (interruptFlags & MIPSNET_INTCTL_RXDONE) { | 193 | netif_wake_queue(dev); |
117 | mipsnet_get_fromdev(dev, | 194 | outl(MIPSNET_INTCTL_TXDONE, |
118 | inl(mipsnet_reg_address(dev, rxDataCount))); | 195 | regaddr(dev, interruptControl)); |
119 | outl(MIPSNET_INTCTL_RXDONE, | 196 | ret = IRQ_HANDLED; |
120 | mipsnet_reg_address(dev, interruptControl)); | 197 | } else if (int_flags & MIPSNET_INTCTL_RXDONE) { |
121 | 198 | mipsnet_get_fromdev(dev, inl(regaddr(dev, rxDataCount))); | |
122 | } else if (interruptFlags & MIPSNET_INTCTL_TESTBIT) { | 199 | outl(MIPSNET_INTCTL_RXDONE, regaddr(dev, interruptControl)); |
123 | /* | 200 | ret = IRQ_HANDLED; |
124 | * TESTBIT is cleared on read. | ||
125 | * And takes effect after a write with 0 | ||
126 | */ | ||
127 | outl(0, mipsnet_reg_address(dev, interruptControl)); | ||
128 | } else { | ||
129 | /* Maybe shared IRQ, just ignore, no clearing. */ | ||
130 | retval = IRQ_NONE; | ||
131 | } | ||
132 | |||
133 | } else { | ||
134 | printk(KERN_INFO "%s: %s(): irq %d for unknown device\n", | ||
135 | dev->name, __FUNCTION__, irq); | ||
136 | retval = IRQ_NONE; | ||
137 | } | 201 | } |
138 | return retval; | 202 | return ret; |
203 | |||
204 | out_badirq: | ||
205 | printk(KERN_INFO "%s: %s(): irq %d for unknown device\n", | ||
206 | dev->name, __FUNCTION__, irq); | ||
207 | return ret; | ||
139 | } | 208 | } |
140 | 209 | ||
141 | static int mipsnet_open(struct net_device *dev) | 210 | static int mipsnet_open(struct net_device *dev) |
@@ -144,18 +213,15 @@ static int mipsnet_open(struct net_device *dev) | |||
144 | 213 | ||
145 | err = request_irq(dev->irq, &mipsnet_interrupt, | 214 | err = request_irq(dev->irq, &mipsnet_interrupt, |
146 | IRQF_SHARED, dev->name, (void *) dev); | 215 | IRQF_SHARED, dev->name, (void *) dev); |
147 | |||
148 | if (err) { | 216 | if (err) { |
149 | release_region(dev->base_addr, MIPSNET_IO_EXTENT); | 217 | release_region(dev->base_addr, sizeof(struct mipsnet_regs)); |
150 | return err; | 218 | return err; |
151 | } | 219 | } |
152 | 220 | ||
153 | netif_start_queue(dev); | 221 | netif_start_queue(dev); |
154 | 222 | ||
155 | /* test interrupt handler */ | 223 | /* test interrupt handler */ |
156 | outl(MIPSNET_INTCTL_TESTBIT, | 224 | outl(MIPSNET_INTCTL_TESTBIT, regaddr(dev, interruptControl)); |
157 | mipsnet_reg_address(dev, interruptControl)); | ||
158 | |||
159 | 225 | ||
160 | return 0; | 226 | return 0; |
161 | } | 227 | } |
@@ -163,7 +229,7 @@ static int mipsnet_open(struct net_device *dev) | |||
163 | static int mipsnet_close(struct net_device *dev) | 229 | static int mipsnet_close(struct net_device *dev) |
164 | { | 230 | { |
165 | netif_stop_queue(dev); | 231 | netif_stop_queue(dev); |
166 | 232 | free_irq(dev->irq, dev); | |
167 | return 0; | 233 | return 0; |
168 | } | 234 | } |
169 | 235 | ||
@@ -194,10 +260,11 @@ static int __init mipsnet_probe(struct device *dev) | |||
194 | */ | 260 | */ |
195 | netdev->base_addr = 0x4200; | 261 | netdev->base_addr = 0x4200; |
196 | netdev->irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB0 + | 262 | netdev->irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB0 + |
197 | inl(mipsnet_reg_address(netdev, interruptInfo)); | 263 | inl(regaddr(netdev, interruptInfo)); |
198 | 264 | ||
199 | /* Get the io region now, get irq on open() */ | 265 | /* Get the io region now, get irq on open() */ |
200 | if (!request_region(netdev->base_addr, MIPSNET_IO_EXTENT, "mipsnet")) { | 266 | if (!request_region(netdev->base_addr, sizeof(struct mipsnet_regs), |
267 | "mipsnet")) { | ||
201 | err = -EBUSY; | 268 | err = -EBUSY; |
202 | goto out_free_netdev; | 269 | goto out_free_netdev; |
203 | } | 270 | } |
@@ -217,7 +284,7 @@ static int __init mipsnet_probe(struct device *dev) | |||
217 | return 0; | 284 | return 0; |
218 | 285 | ||
219 | out_free_region: | 286 | out_free_region: |
220 | release_region(netdev->base_addr, MIPSNET_IO_EXTENT); | 287 | release_region(netdev->base_addr, sizeof(struct mipsnet_regs)); |
221 | 288 | ||
222 | out_free_netdev: | 289 | out_free_netdev: |
223 | free_netdev(netdev); | 290 | free_netdev(netdev); |
@@ -231,7 +298,7 @@ static int __devexit mipsnet_device_remove(struct device *device) | |||
231 | struct net_device *dev = dev_get_drvdata(device); | 298 | struct net_device *dev = dev_get_drvdata(device); |
232 | 299 | ||
233 | unregister_netdev(dev); | 300 | unregister_netdev(dev); |
234 | release_region(dev->base_addr, MIPSNET_IO_EXTENT); | 301 | release_region(dev->base_addr, sizeof(struct mipsnet_regs)); |
235 | free_netdev(dev); | 302 | free_netdev(dev); |
236 | dev_set_drvdata(device, NULL); | 303 | dev_set_drvdata(device, NULL); |
237 | 304 | ||
diff --git a/drivers/net/mipsnet.h b/drivers/net/mipsnet.h deleted file mode 100644 index 0132c6714a40..000000000000 --- a/drivers/net/mipsnet.h +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | */ | ||
6 | #ifndef __MIPSNET_H | ||
7 | #define __MIPSNET_H | ||
8 | |||
9 | /* | ||
10 | * Id of this Net device, as seen by the core. | ||
11 | */ | ||
12 | #define MIPS_NET_DEV_ID ((uint64_t) \ | ||
13 | ((uint64_t) 'M' << 0)| \ | ||
14 | ((uint64_t) 'I' << 8)| \ | ||
15 | ((uint64_t) 'P' << 16)| \ | ||
16 | ((uint64_t) 'S' << 24)| \ | ||
17 | ((uint64_t) 'N' << 32)| \ | ||
18 | ((uint64_t) 'E' << 40)| \ | ||
19 | ((uint64_t) 'T' << 48)| \ | ||
20 | ((uint64_t) '0' << 56)) | ||
21 | |||
22 | /* | ||
23 | * Net status/control block as seen by sw in the core. | ||
24 | * (Why not use bit fields? can't be bothered with cross-platform struct | ||
25 | * packing.) | ||
26 | */ | ||
27 | struct net_control_block { | ||
28 | /* | ||
29 | * dev info for probing | ||
30 | * reads as MIPSNET%d where %d is some form of version | ||
31 | */ | ||
32 | uint64_t devId; /* 0x00 */ | ||
33 | |||
34 | /* | ||
35 | * read only busy flag. | ||
36 | * Set and cleared by the Net Device to indicate that an rx or a tx | ||
37 | * is in progress. | ||
38 | */ | ||
39 | uint32_t busy; /* 0x08 */ | ||
40 | |||
41 | /* | ||
42 | * Set by the Net Device. | ||
43 | * The device will set it once data has been received. | ||
44 | * The value is the number of bytes that should be read from | ||
45 | * rxDataBuffer. The value will decrease till 0 until all the data | ||
46 | * from rxDataBuffer has been read. | ||
47 | */ | ||
48 | uint32_t rxDataCount; /* 0x0c */ | ||
49 | #define MIPSNET_MAX_RXTX_DATACOUNT (1<<16) | ||
50 | |||
51 | /* | ||
52 | * Settable from the MIPS core, cleared by the Net Device. The core | ||
53 | * should set the number of bytes it wants to send, then it should | ||
54 | * write those bytes of data to txDataBuffer. The device will clear | ||
55 | * txDataCount has been processed (not necessarily sent). | ||
56 | */ | ||
57 | uint32_t txDataCount; /* 0x10 */ | ||
58 | |||
59 | /* | ||
60 | * Interrupt control | ||
61 | * | ||
62 | * Used to clear the interrupted generated by this dev. | ||
63 | * Write a 1 to clear the interrupt. (except bit31). | ||
64 | * | ||
65 | * Bit0 is set if it was a tx-done interrupt. | ||
66 | * Bit1 is set when new rx-data is available. | ||
67 | * Until this bit is cleared there will be no other RXs. | ||
68 | * | ||
69 | * Bit31 is used for testing, it clears after a read. | ||
70 | * Writing 1 to this bit will cause an interrupt to be generated. | ||
71 | * To clear the test interrupt, write 0 to this register. | ||
72 | */ | ||
73 | uint32_t interruptControl; /*0x14 */ | ||
74 | #define MIPSNET_INTCTL_TXDONE ((uint32_t)(1 << 0)) | ||
75 | #define MIPSNET_INTCTL_RXDONE ((uint32_t)(1 << 1)) | ||
76 | #define MIPSNET_INTCTL_TESTBIT ((uint32_t)(1 << 31)) | ||
77 | #define MIPSNET_INTCTL_ALLSOURCES (MIPSNET_INTCTL_TXDONE | \ | ||
78 | MIPSNET_INTCTL_RXDONE | \ | ||
79 | MIPSNET_INTCTL_TESTBIT) | ||
80 | |||
81 | /* | ||
82 | * Readonly core-specific interrupt info for the device to signal the | ||
83 | * core. The meaning of the contents of this field might change. | ||
84 | * | ||
85 | * TODO: the whole memIntf interrupt scheme is messy: the device should | ||
86 | * have no control what so ever of what VPE/register set is being | ||
87 | * used. The MemIntf should only expose interrupt lines, and | ||
88 | * something in the config should be responsible for the | ||
89 | * line<->core/vpe bindings. | ||
90 | */ | ||
91 | uint32_t interruptInfo; /* 0x18 */ | ||
92 | |||
93 | /* | ||
94 | * This is where the received data is read out. | ||
95 | * There is more data to read until rxDataReady is 0. | ||
96 | * Only 1 byte at this regs offset is used. | ||
97 | */ | ||
98 | uint32_t rxDataBuffer; /* 0x1c */ | ||
99 | |||
100 | /* | ||
101 | * This is where the data to transmit is written. Data should be | ||
102 | * written for the amount specified in the txDataCount register. Only | ||
103 | * 1 byte at this regs offset is used. | ||
104 | */ | ||
105 | uint32_t txDataBuffer; /* 0x20 */ | ||
106 | }; | ||
107 | |||
108 | #define MIPSNET_IO_EXTENT 0x40 /* being generous */ | ||
109 | |||
110 | #define field_offset(field) (offsetof(struct net_control_block, field)) | ||
111 | |||
112 | #endif /* __MIPSNET_H */ | ||
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index c329a4f5840c..0a3e60418e53 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -203,22 +203,8 @@ skbuff at an offset of "+2", 16-byte aligning the IP header. | |||
203 | IIId. Synchronization | 203 | IIId. Synchronization |
204 | 204 | ||
205 | Most operations are synchronized on the np->lock irq spinlock, except the | 205 | Most operations are synchronized on the np->lock irq spinlock, except the |
206 | performance critical codepaths: | 206 | recieve and transmit paths which are synchronised using a combination of |
207 | 207 | hardware descriptor ownership, disabling interrupts and NAPI poll scheduling. | |
208 | The rx process only runs in the interrupt handler. Access from outside | ||
209 | the interrupt handler is only permitted after disable_irq(). | ||
210 | |||
211 | The rx process usually runs under the netif_tx_lock. If np->intr_tx_reap | ||
212 | is set, then access is permitted under spin_lock_irq(&np->lock). | ||
213 | |||
214 | Thus configuration functions that want to access everything must call | ||
215 | disable_irq(dev->irq); | ||
216 | netif_tx_lock_bh(dev); | ||
217 | spin_lock_irq(&np->lock); | ||
218 | |||
219 | IV. Notes | ||
220 | |||
221 | NatSemi PCI network controllers are very uncommon. | ||
222 | 208 | ||
223 | IVb. References | 209 | IVb. References |
224 | 210 | ||
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index bb88a41b7591..2e39e0285d8f 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -62,6 +62,10 @@ | |||
62 | 62 | ||
63 | #define LRO_MAX_AGGR 64 | 63 | #define LRO_MAX_AGGR 64 |
64 | 64 | ||
65 | #define PE_MIN_MTU 64 | ||
66 | #define PE_MAX_MTU 1500 | ||
67 | #define PE_DEF_MTU ETH_DATA_LEN | ||
68 | |||
65 | #define DEFAULT_MSG_ENABLE \ | 69 | #define DEFAULT_MSG_ENABLE \ |
66 | (NETIF_MSG_DRV | \ | 70 | (NETIF_MSG_DRV | \ |
67 | NETIF_MSG_PROBE | \ | 71 | NETIF_MSG_PROBE | \ |
@@ -82,8 +86,6 @@ | |||
82 | & ((ring)->size - 1)) | 86 | & ((ring)->size - 1)) |
83 | #define RING_AVAIL(ring) ((ring->size) - RING_USED(ring)) | 87 | #define RING_AVAIL(ring) ((ring->size) - RING_USED(ring)) |
84 | 88 | ||
85 | #define BUF_SIZE 1646 /* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */ | ||
86 | |||
87 | MODULE_LICENSE("GPL"); | 89 | MODULE_LICENSE("GPL"); |
88 | MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); | 90 | MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); |
89 | MODULE_DESCRIPTION("PA Semi PWRficient Ethernet driver"); | 91 | MODULE_DESCRIPTION("PA Semi PWRficient Ethernet driver"); |
@@ -175,6 +177,24 @@ static int mac_to_intf(struct pasemi_mac *mac) | |||
175 | return -1; | 177 | return -1; |
176 | } | 178 | } |
177 | 179 | ||
180 | static void pasemi_mac_intf_disable(struct pasemi_mac *mac) | ||
181 | { | ||
182 | unsigned int flags; | ||
183 | |||
184 | flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); | ||
185 | flags &= ~PAS_MAC_CFG_PCFG_PE; | ||
186 | write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); | ||
187 | } | ||
188 | |||
189 | static void pasemi_mac_intf_enable(struct pasemi_mac *mac) | ||
190 | { | ||
191 | unsigned int flags; | ||
192 | |||
193 | flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); | ||
194 | flags |= PAS_MAC_CFG_PCFG_PE; | ||
195 | write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); | ||
196 | } | ||
197 | |||
178 | static int pasemi_get_mac_addr(struct pasemi_mac *mac) | 198 | static int pasemi_get_mac_addr(struct pasemi_mac *mac) |
179 | { | 199 | { |
180 | struct pci_dev *pdev = mac->pdev; | 200 | struct pci_dev *pdev = mac->pdev; |
@@ -221,6 +241,33 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac) | |||
221 | return 0; | 241 | return 0; |
222 | } | 242 | } |
223 | 243 | ||
244 | static int pasemi_mac_set_mac_addr(struct net_device *dev, void *p) | ||
245 | { | ||
246 | struct pasemi_mac *mac = netdev_priv(dev); | ||
247 | struct sockaddr *addr = p; | ||
248 | unsigned int adr0, adr1; | ||
249 | |||
250 | if (!is_valid_ether_addr(addr->sa_data)) | ||
251 | return -EINVAL; | ||
252 | |||
253 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | ||
254 | |||
255 | adr0 = dev->dev_addr[2] << 24 | | ||
256 | dev->dev_addr[3] << 16 | | ||
257 | dev->dev_addr[4] << 8 | | ||
258 | dev->dev_addr[5]; | ||
259 | adr1 = read_mac_reg(mac, PAS_MAC_CFG_ADR1); | ||
260 | adr1 &= ~0xffff; | ||
261 | adr1 |= dev->dev_addr[0] << 8 | dev->dev_addr[1]; | ||
262 | |||
263 | pasemi_mac_intf_disable(mac); | ||
264 | write_mac_reg(mac, PAS_MAC_CFG_ADR0, adr0); | ||
265 | write_mac_reg(mac, PAS_MAC_CFG_ADR1, adr1); | ||
266 | pasemi_mac_intf_enable(mac); | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | |||
224 | static int get_skb_hdr(struct sk_buff *skb, void **iphdr, | 271 | static int get_skb_hdr(struct sk_buff *skb, void **iphdr, |
225 | void **tcph, u64 *hdr_flags, void *data) | 272 | void **tcph, u64 *hdr_flags, void *data) |
226 | { | 273 | { |
@@ -453,7 +500,7 @@ static void pasemi_mac_free_tx_resources(struct pasemi_mac *mac) | |||
453 | 500 | ||
454 | } | 501 | } |
455 | 502 | ||
456 | static void pasemi_mac_free_rx_resources(struct pasemi_mac *mac) | 503 | static void pasemi_mac_free_rx_buffers(struct pasemi_mac *mac) |
457 | { | 504 | { |
458 | struct pasemi_mac_rxring *rx = rx_ring(mac); | 505 | struct pasemi_mac_rxring *rx = rx_ring(mac); |
459 | unsigned int i; | 506 | unsigned int i; |
@@ -473,7 +520,12 @@ static void pasemi_mac_free_rx_resources(struct pasemi_mac *mac) | |||
473 | } | 520 | } |
474 | 521 | ||
475 | for (i = 0; i < RX_RING_SIZE; i++) | 522 | for (i = 0; i < RX_RING_SIZE; i++) |
476 | RX_DESC(rx, i) = 0; | 523 | RX_BUFF(rx, i) = 0; |
524 | } | ||
525 | |||
526 | static void pasemi_mac_free_rx_resources(struct pasemi_mac *mac) | ||
527 | { | ||
528 | pasemi_mac_free_rx_buffers(mac); | ||
477 | 529 | ||
478 | dma_free_coherent(&mac->dma_pdev->dev, RX_RING_SIZE * sizeof(u64), | 530 | dma_free_coherent(&mac->dma_pdev->dev, RX_RING_SIZE * sizeof(u64), |
479 | rx_ring(mac)->buffers, rx_ring(mac)->buf_dma); | 531 | rx_ring(mac)->buffers, rx_ring(mac)->buf_dma); |
@@ -503,14 +555,14 @@ static void pasemi_mac_replenish_rx_ring(const struct net_device *dev, | |||
503 | /* Entry in use? */ | 555 | /* Entry in use? */ |
504 | WARN_ON(*buff); | 556 | WARN_ON(*buff); |
505 | 557 | ||
506 | skb = dev_alloc_skb(BUF_SIZE); | 558 | skb = dev_alloc_skb(mac->bufsz); |
507 | skb_reserve(skb, LOCAL_SKB_ALIGN); | 559 | skb_reserve(skb, LOCAL_SKB_ALIGN); |
508 | 560 | ||
509 | if (unlikely(!skb)) | 561 | if (unlikely(!skb)) |
510 | break; | 562 | break; |
511 | 563 | ||
512 | dma = pci_map_single(mac->dma_pdev, skb->data, | 564 | dma = pci_map_single(mac->dma_pdev, skb->data, |
513 | BUF_SIZE - LOCAL_SKB_ALIGN, | 565 | mac->bufsz - LOCAL_SKB_ALIGN, |
514 | PCI_DMA_FROMDEVICE); | 566 | PCI_DMA_FROMDEVICE); |
515 | 567 | ||
516 | if (unlikely(dma_mapping_error(dma))) { | 568 | if (unlikely(dma_mapping_error(dma))) { |
@@ -520,7 +572,7 @@ static void pasemi_mac_replenish_rx_ring(const struct net_device *dev, | |||
520 | 572 | ||
521 | info->skb = skb; | 573 | info->skb = skb; |
522 | info->dma = dma; | 574 | info->dma = dma; |
523 | *buff = XCT_RXB_LEN(BUF_SIZE) | XCT_RXB_ADDR(dma); | 575 | *buff = XCT_RXB_LEN(mac->bufsz) | XCT_RXB_ADDR(dma); |
524 | fill++; | 576 | fill++; |
525 | } | 577 | } |
526 | 578 | ||
@@ -650,7 +702,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac_rxring *rx, | |||
650 | 702 | ||
651 | len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S; | 703 | len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S; |
652 | 704 | ||
653 | pci_unmap_single(pdev, dma, BUF_SIZE-LOCAL_SKB_ALIGN, | 705 | pci_unmap_single(pdev, dma, mac->bufsz - LOCAL_SKB_ALIGN, |
654 | PCI_DMA_FROMDEVICE); | 706 | PCI_DMA_FROMDEVICE); |
655 | 707 | ||
656 | if (macrx & XCT_MACRX_CRC) { | 708 | if (macrx & XCT_MACRX_CRC) { |
@@ -874,24 +926,6 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data) | |||
874 | return IRQ_HANDLED; | 926 | return IRQ_HANDLED; |
875 | } | 927 | } |
876 | 928 | ||
877 | static void pasemi_mac_intf_disable(struct pasemi_mac *mac) | ||
878 | { | ||
879 | unsigned int flags; | ||
880 | |||
881 | flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); | ||
882 | flags &= ~PAS_MAC_CFG_PCFG_PE; | ||
883 | write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); | ||
884 | } | ||
885 | |||
886 | static void pasemi_mac_intf_enable(struct pasemi_mac *mac) | ||
887 | { | ||
888 | unsigned int flags; | ||
889 | |||
890 | flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); | ||
891 | flags |= PAS_MAC_CFG_PCFG_PE; | ||
892 | write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); | ||
893 | } | ||
894 | |||
895 | static void pasemi_adjust_link(struct net_device *dev) | 929 | static void pasemi_adjust_link(struct net_device *dev) |
896 | { | 930 | { |
897 | struct pasemi_mac *mac = netdev_priv(dev); | 931 | struct pasemi_mac *mac = netdev_priv(dev); |
@@ -1148,11 +1182,71 @@ out_rx_resources: | |||
1148 | 1182 | ||
1149 | #define MAX_RETRIES 5000 | 1183 | #define MAX_RETRIES 5000 |
1150 | 1184 | ||
1185 | static void pasemi_mac_pause_txchan(struct pasemi_mac *mac) | ||
1186 | { | ||
1187 | unsigned int sta, retries; | ||
1188 | int txch = tx_ring(mac)->chan.chno; | ||
1189 | |||
1190 | write_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch), | ||
1191 | PAS_DMA_TXCHAN_TCMDSTA_ST); | ||
1192 | |||
1193 | for (retries = 0; retries < MAX_RETRIES; retries++) { | ||
1194 | sta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch)); | ||
1195 | if (!(sta & PAS_DMA_TXCHAN_TCMDSTA_ACT)) | ||
1196 | break; | ||
1197 | cond_resched(); | ||
1198 | } | ||
1199 | |||
1200 | if (sta & PAS_DMA_TXCHAN_TCMDSTA_ACT) | ||
1201 | dev_err(&mac->dma_pdev->dev, | ||
1202 | "Failed to stop tx channel, tcmdsta %08x\n", sta); | ||
1203 | |||
1204 | write_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch), 0); | ||
1205 | } | ||
1206 | |||
1207 | static void pasemi_mac_pause_rxchan(struct pasemi_mac *mac) | ||
1208 | { | ||
1209 | unsigned int sta, retries; | ||
1210 | int rxch = rx_ring(mac)->chan.chno; | ||
1211 | |||
1212 | write_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch), | ||
1213 | PAS_DMA_RXCHAN_CCMDSTA_ST); | ||
1214 | for (retries = 0; retries < MAX_RETRIES; retries++) { | ||
1215 | sta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch)); | ||
1216 | if (!(sta & PAS_DMA_RXCHAN_CCMDSTA_ACT)) | ||
1217 | break; | ||
1218 | cond_resched(); | ||
1219 | } | ||
1220 | |||
1221 | if (sta & PAS_DMA_RXCHAN_CCMDSTA_ACT) | ||
1222 | dev_err(&mac->dma_pdev->dev, | ||
1223 | "Failed to stop rx channel, ccmdsta 08%x\n", sta); | ||
1224 | write_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch), 0); | ||
1225 | } | ||
1226 | |||
1227 | static void pasemi_mac_pause_rxint(struct pasemi_mac *mac) | ||
1228 | { | ||
1229 | unsigned int sta, retries; | ||
1230 | |||
1231 | write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), | ||
1232 | PAS_DMA_RXINT_RCMDSTA_ST); | ||
1233 | for (retries = 0; retries < MAX_RETRIES; retries++) { | ||
1234 | sta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); | ||
1235 | if (!(sta & PAS_DMA_RXINT_RCMDSTA_ACT)) | ||
1236 | break; | ||
1237 | cond_resched(); | ||
1238 | } | ||
1239 | |||
1240 | if (sta & PAS_DMA_RXINT_RCMDSTA_ACT) | ||
1241 | dev_err(&mac->dma_pdev->dev, | ||
1242 | "Failed to stop rx interface, rcmdsta %08x\n", sta); | ||
1243 | write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 0); | ||
1244 | } | ||
1245 | |||
1151 | static int pasemi_mac_close(struct net_device *dev) | 1246 | static int pasemi_mac_close(struct net_device *dev) |
1152 | { | 1247 | { |
1153 | struct pasemi_mac *mac = netdev_priv(dev); | 1248 | struct pasemi_mac *mac = netdev_priv(dev); |
1154 | unsigned int sta; | 1249 | unsigned int sta; |
1155 | int retries; | ||
1156 | int rxch, txch; | 1250 | int rxch, txch; |
1157 | 1251 | ||
1158 | rxch = rx_ring(mac)->chan.chno; | 1252 | rxch = rx_ring(mac)->chan.chno; |
@@ -1190,51 +1284,10 @@ static int pasemi_mac_close(struct net_device *dev) | |||
1190 | pasemi_mac_clean_tx(tx_ring(mac)); | 1284 | pasemi_mac_clean_tx(tx_ring(mac)); |
1191 | pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE); | 1285 | pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE); |
1192 | 1286 | ||
1193 | /* Disable interface */ | 1287 | pasemi_mac_pause_txchan(mac); |
1194 | write_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch), | 1288 | pasemi_mac_pause_rxint(mac); |
1195 | PAS_DMA_TXCHAN_TCMDSTA_ST); | 1289 | pasemi_mac_pause_rxchan(mac); |
1196 | write_dma_reg( PAS_DMA_RXINT_RCMDSTA(mac->dma_if), | 1290 | pasemi_mac_intf_disable(mac); |
1197 | PAS_DMA_RXINT_RCMDSTA_ST); | ||
1198 | write_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch), | ||
1199 | PAS_DMA_RXCHAN_CCMDSTA_ST); | ||
1200 | |||
1201 | for (retries = 0; retries < MAX_RETRIES; retries++) { | ||
1202 | sta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(rxch)); | ||
1203 | if (!(sta & PAS_DMA_TXCHAN_TCMDSTA_ACT)) | ||
1204 | break; | ||
1205 | cond_resched(); | ||
1206 | } | ||
1207 | |||
1208 | if (sta & PAS_DMA_TXCHAN_TCMDSTA_ACT) | ||
1209 | dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n"); | ||
1210 | |||
1211 | for (retries = 0; retries < MAX_RETRIES; retries++) { | ||
1212 | sta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch)); | ||
1213 | if (!(sta & PAS_DMA_RXCHAN_CCMDSTA_ACT)) | ||
1214 | break; | ||
1215 | cond_resched(); | ||
1216 | } | ||
1217 | |||
1218 | if (sta & PAS_DMA_RXCHAN_CCMDSTA_ACT) | ||
1219 | dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n"); | ||
1220 | |||
1221 | for (retries = 0; retries < MAX_RETRIES; retries++) { | ||
1222 | sta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); | ||
1223 | if (!(sta & PAS_DMA_RXINT_RCMDSTA_ACT)) | ||
1224 | break; | ||
1225 | cond_resched(); | ||
1226 | } | ||
1227 | |||
1228 | if (sta & PAS_DMA_RXINT_RCMDSTA_ACT) | ||
1229 | dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n"); | ||
1230 | |||
1231 | /* Then, disable the channel. This must be done separately from | ||
1232 | * stopping, since you can't disable when active. | ||
1233 | */ | ||
1234 | |||
1235 | write_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch), 0); | ||
1236 | write_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(rxch), 0); | ||
1237 | write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 0); | ||
1238 | 1291 | ||
1239 | free_irq(mac->tx->chan.irq, mac->tx); | 1292 | free_irq(mac->tx->chan.irq, mac->tx); |
1240 | free_irq(mac->rx->chan.irq, mac->rx); | 1293 | free_irq(mac->rx->chan.irq, mac->rx); |
@@ -1388,6 +1441,62 @@ static int pasemi_mac_poll(struct napi_struct *napi, int budget) | |||
1388 | return pkts; | 1441 | return pkts; |
1389 | } | 1442 | } |
1390 | 1443 | ||
1444 | static int pasemi_mac_change_mtu(struct net_device *dev, int new_mtu) | ||
1445 | { | ||
1446 | struct pasemi_mac *mac = netdev_priv(dev); | ||
1447 | unsigned int reg; | ||
1448 | unsigned int rcmdsta; | ||
1449 | int running; | ||
1450 | |||
1451 | if (new_mtu < PE_MIN_MTU || new_mtu > PE_MAX_MTU) | ||
1452 | return -EINVAL; | ||
1453 | |||
1454 | running = netif_running(dev); | ||
1455 | |||
1456 | if (running) { | ||
1457 | /* Need to stop the interface, clean out all already | ||
1458 | * received buffers, free all unused buffers on the RX | ||
1459 | * interface ring, then finally re-fill the rx ring with | ||
1460 | * the new-size buffers and restart. | ||
1461 | */ | ||
1462 | |||
1463 | napi_disable(&mac->napi); | ||
1464 | netif_tx_disable(dev); | ||
1465 | pasemi_mac_intf_disable(mac); | ||
1466 | |||
1467 | rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); | ||
1468 | pasemi_mac_pause_rxint(mac); | ||
1469 | pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE); | ||
1470 | pasemi_mac_free_rx_buffers(mac); | ||
1471 | } | ||
1472 | |||
1473 | /* Change maxf, i.e. what size frames are accepted. | ||
1474 | * Need room for ethernet header and CRC word | ||
1475 | */ | ||
1476 | reg = read_mac_reg(mac, PAS_MAC_CFG_MACCFG); | ||
1477 | reg &= ~PAS_MAC_CFG_MACCFG_MAXF_M; | ||
1478 | reg |= PAS_MAC_CFG_MACCFG_MAXF(new_mtu + ETH_HLEN + 4); | ||
1479 | write_mac_reg(mac, PAS_MAC_CFG_MACCFG, reg); | ||
1480 | |||
1481 | dev->mtu = new_mtu; | ||
1482 | /* MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */ | ||
1483 | mac->bufsz = new_mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128; | ||
1484 | |||
1485 | if (running) { | ||
1486 | write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), | ||
1487 | rcmdsta | PAS_DMA_RXINT_RCMDSTA_EN); | ||
1488 | |||
1489 | rx_ring(mac)->next_to_fill = 0; | ||
1490 | pasemi_mac_replenish_rx_ring(dev, RX_RING_SIZE-1); | ||
1491 | |||
1492 | napi_enable(&mac->napi); | ||
1493 | netif_start_queue(dev); | ||
1494 | pasemi_mac_intf_enable(mac); | ||
1495 | } | ||
1496 | |||
1497 | return 0; | ||
1498 | } | ||
1499 | |||
1391 | static int __devinit | 1500 | static int __devinit |
1392 | pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 1501 | pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
1393 | { | 1502 | { |
@@ -1475,6 +1584,12 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1475 | dev->stop = pasemi_mac_close; | 1584 | dev->stop = pasemi_mac_close; |
1476 | dev->hard_start_xmit = pasemi_mac_start_tx; | 1585 | dev->hard_start_xmit = pasemi_mac_start_tx; |
1477 | dev->set_multicast_list = pasemi_mac_set_rx_mode; | 1586 | dev->set_multicast_list = pasemi_mac_set_rx_mode; |
1587 | dev->set_mac_address = pasemi_mac_set_mac_addr; | ||
1588 | dev->mtu = PE_DEF_MTU; | ||
1589 | /* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */ | ||
1590 | mac->bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128; | ||
1591 | |||
1592 | dev->change_mtu = pasemi_mac_change_mtu; | ||
1478 | 1593 | ||
1479 | if (err) | 1594 | if (err) |
1480 | goto out; | 1595 | goto out; |
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h index 8bee2a664c83..99e7b9329a6f 100644 --- a/drivers/net/pasemi_mac.h +++ b/drivers/net/pasemi_mac.h | |||
@@ -59,6 +59,7 @@ struct pasemi_mac { | |||
59 | struct phy_device *phydev; | 59 | struct phy_device *phydev; |
60 | struct napi_struct napi; | 60 | struct napi_struct napi; |
61 | 61 | ||
62 | int bufsz; /* RX ring buffer size */ | ||
62 | u8 type; | 63 | u8 type; |
63 | #define MAC_TYPE_GMAC 1 | 64 | #define MAC_TYPE_GMAC 1 |
64 | #define MAC_TYPE_XAUI 2 | 65 | #define MAC_TYPE_XAUI 2 |
@@ -96,6 +97,9 @@ struct pasemi_mac_buffer { | |||
96 | /* MAC CFG register offsets */ | 97 | /* MAC CFG register offsets */ |
97 | enum { | 98 | enum { |
98 | PAS_MAC_CFG_PCFG = 0x80, | 99 | PAS_MAC_CFG_PCFG = 0x80, |
100 | PAS_MAC_CFG_MACCFG = 0x84, | ||
101 | PAS_MAC_CFG_ADR0 = 0x8c, | ||
102 | PAS_MAC_CFG_ADR1 = 0x90, | ||
99 | PAS_MAC_CFG_TXP = 0x98, | 103 | PAS_MAC_CFG_TXP = 0x98, |
100 | PAS_MAC_IPC_CHNL = 0x208, | 104 | PAS_MAC_IPC_CHNL = 0x208, |
101 | }; | 105 | }; |
@@ -130,6 +134,18 @@ enum { | |||
130 | #define PAS_MAC_CFG_PCFG_SPD_100M 0x00000001 | 134 | #define PAS_MAC_CFG_PCFG_SPD_100M 0x00000001 |
131 | #define PAS_MAC_CFG_PCFG_SPD_1G 0x00000002 | 135 | #define PAS_MAC_CFG_PCFG_SPD_1G 0x00000002 |
132 | #define PAS_MAC_CFG_PCFG_SPD_10G 0x00000003 | 136 | #define PAS_MAC_CFG_PCFG_SPD_10G 0x00000003 |
137 | |||
138 | #define PAS_MAC_CFG_MACCFG_TXT_M 0x70000000 | ||
139 | #define PAS_MAC_CFG_MACCFG_TXT_S 28 | ||
140 | #define PAS_MAC_CFG_MACCFG_PRES_M 0x0f000000 | ||
141 | #define PAS_MAC_CFG_MACCFG_PRES_S 24 | ||
142 | #define PAS_MAC_CFG_MACCFG_MAXF_M 0x00ffff00 | ||
143 | #define PAS_MAC_CFG_MACCFG_MAXF_S 8 | ||
144 | #define PAS_MAC_CFG_MACCFG_MAXF(x) (((x) << PAS_MAC_CFG_MACCFG_MAXF_S) & \ | ||
145 | PAS_MAC_CFG_MACCFG_MAXF_M) | ||
146 | #define PAS_MAC_CFG_MACCFG_MINF_M 0x000000ff | ||
147 | #define PAS_MAC_CFG_MACCFG_MINF_S 0 | ||
148 | |||
133 | #define PAS_MAC_CFG_TXP_FCF 0x01000000 | 149 | #define PAS_MAC_CFG_TXP_FCF 0x01000000 |
134 | #define PAS_MAC_CFG_TXP_FCE 0x00800000 | 150 | #define PAS_MAC_CFG_TXP_FCE 0x00800000 |
135 | #define PAS_MAC_CFG_TXP_FC 0x00400000 | 151 | #define PAS_MAC_CFG_TXP_FC 0x00400000 |
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c index ed402e00e730..fffc49befe04 100644 --- a/drivers/net/pci-skeleton.c +++ b/drivers/net/pci-skeleton.c | |||
@@ -541,7 +541,7 @@ static void netdrv_hw_start (struct net_device *dev); | |||
541 | #define NETDRV_W32_F(reg, val32) do { writel ((val32), ioaddr + (reg)); readl (ioaddr + (reg)); } while (0) | 541 | #define NETDRV_W32_F(reg, val32) do { writel ((val32), ioaddr + (reg)); readl (ioaddr + (reg)); } while (0) |
542 | 542 | ||
543 | 543 | ||
544 | #if MMIO_FLUSH_AUDIT_COMPLETE | 544 | #ifdef MMIO_FLUSH_AUDIT_COMPLETE |
545 | 545 | ||
546 | /* write MMIO register */ | 546 | /* write MMIO register */ |
547 | #define NETDRV_W8(reg, val8) writeb ((val8), ioaddr + (reg)) | 547 | #define NETDRV_W8(reg, val8) writeb ((val8), ioaddr + (reg)) |
@@ -603,7 +603,7 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev, | |||
603 | return -ENOMEM; | 603 | return -ENOMEM; |
604 | } | 604 | } |
605 | SET_NETDEV_DEV(dev, &pdev->dev); | 605 | SET_NETDEV_DEV(dev, &pdev->dev); |
606 | tp = dev->priv; | 606 | tp = netdev_priv(dev); |
607 | 607 | ||
608 | /* enable device (incl. PCI PM wakeup), and bus-mastering */ | 608 | /* enable device (incl. PCI PM wakeup), and bus-mastering */ |
609 | rc = pci_enable_device (pdev); | 609 | rc = pci_enable_device (pdev); |
@@ -759,7 +759,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev, | |||
759 | return i; | 759 | return i; |
760 | } | 760 | } |
761 | 761 | ||
762 | tp = dev->priv; | 762 | tp = netdev_priv(dev); |
763 | 763 | ||
764 | assert (ioaddr != NULL); | 764 | assert (ioaddr != NULL); |
765 | assert (dev != NULL); | 765 | assert (dev != NULL); |
@@ -783,7 +783,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev, | |||
783 | dev->base_addr = (unsigned long) ioaddr; | 783 | dev->base_addr = (unsigned long) ioaddr; |
784 | 784 | ||
785 | /* dev->priv/tp zeroed and aligned in alloc_etherdev */ | 785 | /* dev->priv/tp zeroed and aligned in alloc_etherdev */ |
786 | tp = dev->priv; | 786 | tp = netdev_priv(dev); |
787 | 787 | ||
788 | /* note: tp->chipset set in netdrv_init_board */ | 788 | /* note: tp->chipset set in netdrv_init_board */ |
789 | tp->drv_flags = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | | 789 | tp->drv_flags = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | |
@@ -841,7 +841,7 @@ static void __devexit netdrv_remove_one (struct pci_dev *pdev) | |||
841 | 841 | ||
842 | assert (dev != NULL); | 842 | assert (dev != NULL); |
843 | 843 | ||
844 | np = dev->priv; | 844 | np = netdev_priv(dev); |
845 | assert (np != NULL); | 845 | assert (np != NULL); |
846 | 846 | ||
847 | unregister_netdev (dev); | 847 | unregister_netdev (dev); |
@@ -974,7 +974,7 @@ static void mdio_sync (void *mdio_addr) | |||
974 | 974 | ||
975 | static int mdio_read (struct net_device *dev, int phy_id, int location) | 975 | static int mdio_read (struct net_device *dev, int phy_id, int location) |
976 | { | 976 | { |
977 | struct netdrv_private *tp = dev->priv; | 977 | struct netdrv_private *tp = netdev_priv(dev); |
978 | void *mdio_addr = tp->mmio_addr + Config4; | 978 | void *mdio_addr = tp->mmio_addr + Config4; |
979 | int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location; | 979 | int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location; |
980 | int retval = 0; | 980 | int retval = 0; |
@@ -1017,7 +1017,7 @@ static int mdio_read (struct net_device *dev, int phy_id, int location) | |||
1017 | static void mdio_write (struct net_device *dev, int phy_id, int location, | 1017 | static void mdio_write (struct net_device *dev, int phy_id, int location, |
1018 | int value) | 1018 | int value) |
1019 | { | 1019 | { |
1020 | struct netdrv_private *tp = dev->priv; | 1020 | struct netdrv_private *tp = netdev_priv(dev); |
1021 | void *mdio_addr = tp->mmio_addr + Config4; | 1021 | void *mdio_addr = tp->mmio_addr + Config4; |
1022 | int mii_cmd = | 1022 | int mii_cmd = |
1023 | (0x5002 << 16) | (phy_id << 23) | (location << 18) | value; | 1023 | (0x5002 << 16) | (phy_id << 23) | (location << 18) | value; |
@@ -1060,7 +1060,7 @@ static void mdio_write (struct net_device *dev, int phy_id, int location, | |||
1060 | 1060 | ||
1061 | static int netdrv_open (struct net_device *dev) | 1061 | static int netdrv_open (struct net_device *dev) |
1062 | { | 1062 | { |
1063 | struct netdrv_private *tp = dev->priv; | 1063 | struct netdrv_private *tp = netdev_priv(dev); |
1064 | int retval; | 1064 | int retval; |
1065 | #ifdef NETDRV_DEBUG | 1065 | #ifdef NETDRV_DEBUG |
1066 | void *ioaddr = tp->mmio_addr; | 1066 | void *ioaddr = tp->mmio_addr; |
@@ -1121,7 +1121,7 @@ static int netdrv_open (struct net_device *dev) | |||
1121 | /* Start the hardware at open or resume. */ | 1121 | /* Start the hardware at open or resume. */ |
1122 | static void netdrv_hw_start (struct net_device *dev) | 1122 | static void netdrv_hw_start (struct net_device *dev) |
1123 | { | 1123 | { |
1124 | struct netdrv_private *tp = dev->priv; | 1124 | struct netdrv_private *tp = netdev_priv(dev); |
1125 | void *ioaddr = tp->mmio_addr; | 1125 | void *ioaddr = tp->mmio_addr; |
1126 | u32 i; | 1126 | u32 i; |
1127 | 1127 | ||
@@ -1191,7 +1191,7 @@ static void netdrv_hw_start (struct net_device *dev) | |||
1191 | /* Initialize the Rx and Tx rings, along with various 'dev' bits. */ | 1191 | /* Initialize the Rx and Tx rings, along with various 'dev' bits. */ |
1192 | static void netdrv_init_ring (struct net_device *dev) | 1192 | static void netdrv_init_ring (struct net_device *dev) |
1193 | { | 1193 | { |
1194 | struct netdrv_private *tp = dev->priv; | 1194 | struct netdrv_private *tp = netdev_priv(dev); |
1195 | int i; | 1195 | int i; |
1196 | 1196 | ||
1197 | DPRINTK ("ENTER\n"); | 1197 | DPRINTK ("ENTER\n"); |
@@ -1213,7 +1213,7 @@ static void netdrv_init_ring (struct net_device *dev) | |||
1213 | static void netdrv_timer (unsigned long data) | 1213 | static void netdrv_timer (unsigned long data) |
1214 | { | 1214 | { |
1215 | struct net_device *dev = (struct net_device *) data; | 1215 | struct net_device *dev = (struct net_device *) data; |
1216 | struct netdrv_private *tp = dev->priv; | 1216 | struct netdrv_private *tp = netdev_priv(dev); |
1217 | void *ioaddr = tp->mmio_addr; | 1217 | void *ioaddr = tp->mmio_addr; |
1218 | int next_tick = 60 * HZ; | 1218 | int next_tick = 60 * HZ; |
1219 | int mii_lpa; | 1219 | int mii_lpa; |
@@ -1252,9 +1252,10 @@ static void netdrv_timer (unsigned long data) | |||
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | 1254 | ||
1255 | static void netdrv_tx_clear (struct netdrv_private *tp) | 1255 | static void netdrv_tx_clear (struct net_device *dev) |
1256 | { | 1256 | { |
1257 | int i; | 1257 | int i; |
1258 | struct netdrv_private *tp = netdev_priv(dev); | ||
1258 | 1259 | ||
1259 | atomic_set (&tp->cur_tx, 0); | 1260 | atomic_set (&tp->cur_tx, 0); |
1260 | atomic_set (&tp->dirty_tx, 0); | 1261 | atomic_set (&tp->dirty_tx, 0); |
@@ -1278,7 +1279,7 @@ static void netdrv_tx_clear (struct netdrv_private *tp) | |||
1278 | 1279 | ||
1279 | static void netdrv_tx_timeout (struct net_device *dev) | 1280 | static void netdrv_tx_timeout (struct net_device *dev) |
1280 | { | 1281 | { |
1281 | struct netdrv_private *tp = dev->priv; | 1282 | struct netdrv_private *tp = netdev_priv(dev); |
1282 | void *ioaddr = tp->mmio_addr; | 1283 | void *ioaddr = tp->mmio_addr; |
1283 | int i; | 1284 | int i; |
1284 | u8 tmp8; | 1285 | u8 tmp8; |
@@ -1311,7 +1312,7 @@ static void netdrv_tx_timeout (struct net_device *dev) | |||
1311 | /* Stop a shared interrupt from scavenging while we are. */ | 1312 | /* Stop a shared interrupt from scavenging while we are. */ |
1312 | spin_lock_irqsave (&tp->lock, flags); | 1313 | spin_lock_irqsave (&tp->lock, flags); |
1313 | 1314 | ||
1314 | netdrv_tx_clear (tp); | 1315 | netdrv_tx_clear (dev); |
1315 | 1316 | ||
1316 | spin_unlock_irqrestore (&tp->lock, flags); | 1317 | spin_unlock_irqrestore (&tp->lock, flags); |
1317 | 1318 | ||
@@ -1325,7 +1326,7 @@ static void netdrv_tx_timeout (struct net_device *dev) | |||
1325 | 1326 | ||
1326 | static int netdrv_start_xmit (struct sk_buff *skb, struct net_device *dev) | 1327 | static int netdrv_start_xmit (struct sk_buff *skb, struct net_device *dev) |
1327 | { | 1328 | { |
1328 | struct netdrv_private *tp = dev->priv; | 1329 | struct netdrv_private *tp = netdev_priv(dev); |
1329 | void *ioaddr = tp->mmio_addr; | 1330 | void *ioaddr = tp->mmio_addr; |
1330 | int entry; | 1331 | int entry; |
1331 | 1332 | ||
@@ -1525,7 +1526,7 @@ static void netdrv_rx_interrupt (struct net_device *dev, | |||
1525 | DPRINTK ("%s: netdrv_rx() status %4.4x, size %4.4x," | 1526 | DPRINTK ("%s: netdrv_rx() status %4.4x, size %4.4x," |
1526 | " cur %4.4x.\n", dev->name, rx_status, | 1527 | " cur %4.4x.\n", dev->name, rx_status, |
1527 | rx_size, cur_rx); | 1528 | rx_size, cur_rx); |
1528 | #if NETDRV_DEBUG > 2 | 1529 | #if defined(NETDRV_DEBUG) && (NETDRV_DEBUG > 2) |
1529 | { | 1530 | { |
1530 | int i; | 1531 | int i; |
1531 | DPRINTK ("%s: Frame contents ", dev->name); | 1532 | DPRINTK ("%s: Frame contents ", dev->name); |
@@ -1648,7 +1649,7 @@ static void netdrv_weird_interrupt (struct net_device *dev, | |||
1648 | static irqreturn_t netdrv_interrupt (int irq, void *dev_instance) | 1649 | static irqreturn_t netdrv_interrupt (int irq, void *dev_instance) |
1649 | { | 1650 | { |
1650 | struct net_device *dev = (struct net_device *) dev_instance; | 1651 | struct net_device *dev = (struct net_device *) dev_instance; |
1651 | struct netdrv_private *tp = dev->priv; | 1652 | struct netdrv_private *tp = netdev_priv(dev); |
1652 | int boguscnt = max_interrupt_work; | 1653 | int boguscnt = max_interrupt_work; |
1653 | void *ioaddr = tp->mmio_addr; | 1654 | void *ioaddr = tp->mmio_addr; |
1654 | int status = 0, link_changed = 0; /* avoid bogus "uninit" warning */ | 1655 | int status = 0, link_changed = 0; /* avoid bogus "uninit" warning */ |
@@ -1711,7 +1712,7 @@ static irqreturn_t netdrv_interrupt (int irq, void *dev_instance) | |||
1711 | 1712 | ||
1712 | static int netdrv_close (struct net_device *dev) | 1713 | static int netdrv_close (struct net_device *dev) |
1713 | { | 1714 | { |
1714 | struct netdrv_private *tp = dev->priv; | 1715 | struct netdrv_private *tp = netdev_priv(dev); |
1715 | void *ioaddr = tp->mmio_addr; | 1716 | void *ioaddr = tp->mmio_addr; |
1716 | unsigned long flags; | 1717 | unsigned long flags; |
1717 | 1718 | ||
@@ -1738,10 +1739,10 @@ static int netdrv_close (struct net_device *dev) | |||
1738 | 1739 | ||
1739 | spin_unlock_irqrestore (&tp->lock, flags); | 1740 | spin_unlock_irqrestore (&tp->lock, flags); |
1740 | 1741 | ||
1741 | synchronize_irq (); | 1742 | synchronize_irq (dev->irq); |
1742 | free_irq (dev->irq, dev); | 1743 | free_irq (dev->irq, dev); |
1743 | 1744 | ||
1744 | netdrv_tx_clear (tp); | 1745 | netdrv_tx_clear (dev); |
1745 | 1746 | ||
1746 | pci_free_consistent(tp->pci_dev, RX_BUF_TOT_LEN, | 1747 | pci_free_consistent(tp->pci_dev, RX_BUF_TOT_LEN, |
1747 | tp->rx_ring, tp->rx_ring_dma); | 1748 | tp->rx_ring, tp->rx_ring_dma); |
@@ -1762,7 +1763,7 @@ static int netdrv_close (struct net_device *dev) | |||
1762 | 1763 | ||
1763 | static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | 1764 | static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) |
1764 | { | 1765 | { |
1765 | struct netdrv_private *tp = dev->priv; | 1766 | struct netdrv_private *tp = netdev_priv(dev); |
1766 | struct mii_ioctl_data *data = if_mii(rq); | 1767 | struct mii_ioctl_data *data = if_mii(rq); |
1767 | unsigned long flags; | 1768 | unsigned long flags; |
1768 | int rc = 0; | 1769 | int rc = 0; |
@@ -1805,7 +1806,7 @@ static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1805 | 1806 | ||
1806 | static void netdrv_set_rx_mode (struct net_device *dev) | 1807 | static void netdrv_set_rx_mode (struct net_device *dev) |
1807 | { | 1808 | { |
1808 | struct netdrv_private *tp = dev->priv; | 1809 | struct netdrv_private *tp = netdev_priv(dev); |
1809 | void *ioaddr = tp->mmio_addr; | 1810 | void *ioaddr = tp->mmio_addr; |
1810 | u32 mc_filter[2]; /* Multicast hash filter */ | 1811 | u32 mc_filter[2]; /* Multicast hash filter */ |
1811 | int i, rx_mode; | 1812 | int i, rx_mode; |
@@ -1862,7 +1863,7 @@ static void netdrv_set_rx_mode (struct net_device *dev) | |||
1862 | static int netdrv_suspend (struct pci_dev *pdev, pm_message_t state) | 1863 | static int netdrv_suspend (struct pci_dev *pdev, pm_message_t state) |
1863 | { | 1864 | { |
1864 | struct net_device *dev = pci_get_drvdata (pdev); | 1865 | struct net_device *dev = pci_get_drvdata (pdev); |
1865 | struct netdrv_private *tp = dev->priv; | 1866 | struct netdrv_private *tp = netdev_priv(dev); |
1866 | void *ioaddr = tp->mmio_addr; | 1867 | void *ioaddr = tp->mmio_addr; |
1867 | unsigned long flags; | 1868 | unsigned long flags; |
1868 | 1869 | ||
@@ -1892,7 +1893,7 @@ static int netdrv_suspend (struct pci_dev *pdev, pm_message_t state) | |||
1892 | static int netdrv_resume (struct pci_dev *pdev) | 1893 | static int netdrv_resume (struct pci_dev *pdev) |
1893 | { | 1894 | { |
1894 | struct net_device *dev = pci_get_drvdata (pdev); | 1895 | struct net_device *dev = pci_get_drvdata (pdev); |
1895 | struct netdrv_private *tp = dev->priv; | 1896 | /*struct netdrv_private *tp = netdev_priv(dev);*/ |
1896 | 1897 | ||
1897 | if (!netif_running(dev)) | 1898 | if (!netif_running(dev)) |
1898 | return 0; | 1899 | return 0; |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 7fe03ce774b1..f4ca0591231d 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -60,6 +60,11 @@ config ICPLUS_PHY | |||
60 | ---help--- | 60 | ---help--- |
61 | Currently supports the IP175C PHY. | 61 | Currently supports the IP175C PHY. |
62 | 62 | ||
63 | config REALTEK_PHY | ||
64 | tristate "Drivers for Realtek PHYs" | ||
65 | ---help--- | ||
66 | Supports the Realtek 821x PHY. | ||
67 | |||
63 | config FIXED_PHY | 68 | config FIXED_PHY |
64 | bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" | 69 | bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" |
65 | ---help--- | 70 | ---help--- |
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index 3d6cc7b67a80..5997d6ef702b 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile | |||
@@ -12,5 +12,6 @@ obj-$(CONFIG_SMSC_PHY) += smsc.o | |||
12 | obj-$(CONFIG_VITESSE_PHY) += vitesse.o | 12 | obj-$(CONFIG_VITESSE_PHY) += vitesse.o |
13 | obj-$(CONFIG_BROADCOM_PHY) += broadcom.o | 13 | obj-$(CONFIG_BROADCOM_PHY) += broadcom.o |
14 | obj-$(CONFIG_ICPLUS_PHY) += icplus.o | 14 | obj-$(CONFIG_ICPLUS_PHY) += icplus.o |
15 | obj-$(CONFIG_REALTEK_PHY) += realtek.o | ||
15 | obj-$(CONFIG_FIXED_PHY) += fixed.o | 16 | obj-$(CONFIG_FIXED_PHY) += fixed.o |
16 | obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o | 17 | obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o |
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 29666c85ed55..5b80358af658 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c | |||
@@ -141,6 +141,20 @@ static struct phy_driver bcm5461_driver = { | |||
141 | .driver = { .owner = THIS_MODULE }, | 141 | .driver = { .owner = THIS_MODULE }, |
142 | }; | 142 | }; |
143 | 143 | ||
144 | static struct phy_driver bcm5482_driver = { | ||
145 | .phy_id = 0x0143bcb0, | ||
146 | .phy_id_mask = 0xfffffff0, | ||
147 | .name = "Broadcom BCM5482", | ||
148 | .features = PHY_GBIT_FEATURES, | ||
149 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | ||
150 | .config_init = bcm54xx_config_init, | ||
151 | .config_aneg = genphy_config_aneg, | ||
152 | .read_status = genphy_read_status, | ||
153 | .ack_interrupt = bcm54xx_ack_interrupt, | ||
154 | .config_intr = bcm54xx_config_intr, | ||
155 | .driver = { .owner = THIS_MODULE }, | ||
156 | }; | ||
157 | |||
144 | static int __init broadcom_init(void) | 158 | static int __init broadcom_init(void) |
145 | { | 159 | { |
146 | int ret; | 160 | int ret; |
@@ -154,8 +168,13 @@ static int __init broadcom_init(void) | |||
154 | ret = phy_driver_register(&bcm5461_driver); | 168 | ret = phy_driver_register(&bcm5461_driver); |
155 | if (ret) | 169 | if (ret) |
156 | goto out_5461; | 170 | goto out_5461; |
171 | ret = phy_driver_register(&bcm5482_driver); | ||
172 | if (ret) | ||
173 | goto out_5482; | ||
157 | return ret; | 174 | return ret; |
158 | 175 | ||
176 | out_5482: | ||
177 | phy_driver_unregister(&bcm5461_driver); | ||
159 | out_5461: | 178 | out_5461: |
160 | phy_driver_unregister(&bcm5421_driver); | 179 | phy_driver_unregister(&bcm5421_driver); |
161 | out_5421: | 180 | out_5421: |
@@ -166,6 +185,7 @@ out_5411: | |||
166 | 185 | ||
167 | static void __exit broadcom_exit(void) | 186 | static void __exit broadcom_exit(void) |
168 | { | 187 | { |
188 | phy_driver_unregister(&bcm5482_driver); | ||
169 | phy_driver_unregister(&bcm5461_driver); | 189 | phy_driver_unregister(&bcm5461_driver); |
170 | phy_driver_unregister(&bcm5421_driver); | 190 | phy_driver_unregister(&bcm5421_driver); |
171 | phy_driver_unregister(&bcm5411_driver); | 191 | phy_driver_unregister(&bcm5411_driver); |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index c30196d0ad16..6e9f619c491f 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -49,7 +49,7 @@ int mdiobus_register(struct mii_bus *bus) | |||
49 | int i; | 49 | int i; |
50 | int err = 0; | 50 | int err = 0; |
51 | 51 | ||
52 | spin_lock_init(&bus->mdio_lock); | 52 | mutex_init(&bus->mdio_lock); |
53 | 53 | ||
54 | if (NULL == bus || NULL == bus->name || | 54 | if (NULL == bus || NULL == bus->name || |
55 | NULL == bus->read || | 55 | NULL == bus->read || |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 7c9e6e349503..12fccb1c76dc 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
27 | #include <linux/etherdevice.h> | 27 | #include <linux/etherdevice.h> |
28 | #include <linux/skbuff.h> | 28 | #include <linux/skbuff.h> |
29 | #include <linux/spinlock.h> | ||
30 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/mii.h> | 31 | #include <linux/mii.h> |
@@ -72,9 +71,11 @@ int phy_read(struct phy_device *phydev, u16 regnum) | |||
72 | int retval; | 71 | int retval; |
73 | struct mii_bus *bus = phydev->bus; | 72 | struct mii_bus *bus = phydev->bus; |
74 | 73 | ||
75 | spin_lock_bh(&bus->mdio_lock); | 74 | BUG_ON(in_interrupt()); |
75 | |||
76 | mutex_lock(&bus->mdio_lock); | ||
76 | retval = bus->read(bus, phydev->addr, regnum); | 77 | retval = bus->read(bus, phydev->addr, regnum); |
77 | spin_unlock_bh(&bus->mdio_lock); | 78 | mutex_unlock(&bus->mdio_lock); |
78 | 79 | ||
79 | return retval; | 80 | return retval; |
80 | } | 81 | } |
@@ -95,9 +96,11 @@ int phy_write(struct phy_device *phydev, u16 regnum, u16 val) | |||
95 | int err; | 96 | int err; |
96 | struct mii_bus *bus = phydev->bus; | 97 | struct mii_bus *bus = phydev->bus; |
97 | 98 | ||
98 | spin_lock_bh(&bus->mdio_lock); | 99 | BUG_ON(in_interrupt()); |
100 | |||
101 | mutex_lock(&bus->mdio_lock); | ||
99 | err = bus->write(bus, phydev->addr, regnum, val); | 102 | err = bus->write(bus, phydev->addr, regnum, val); |
100 | spin_unlock_bh(&bus->mdio_lock); | 103 | mutex_unlock(&bus->mdio_lock); |
101 | 104 | ||
102 | return err; | 105 | return err; |
103 | } | 106 | } |
@@ -428,7 +431,7 @@ int phy_start_aneg(struct phy_device *phydev) | |||
428 | { | 431 | { |
429 | int err; | 432 | int err; |
430 | 433 | ||
431 | spin_lock_bh(&phydev->lock); | 434 | mutex_lock(&phydev->lock); |
432 | 435 | ||
433 | if (AUTONEG_DISABLE == phydev->autoneg) | 436 | if (AUTONEG_DISABLE == phydev->autoneg) |
434 | phy_sanitize_settings(phydev); | 437 | phy_sanitize_settings(phydev); |
@@ -449,13 +452,14 @@ int phy_start_aneg(struct phy_device *phydev) | |||
449 | } | 452 | } |
450 | 453 | ||
451 | out_unlock: | 454 | out_unlock: |
452 | spin_unlock_bh(&phydev->lock); | 455 | mutex_unlock(&phydev->lock); |
453 | return err; | 456 | return err; |
454 | } | 457 | } |
455 | EXPORT_SYMBOL(phy_start_aneg); | 458 | EXPORT_SYMBOL(phy_start_aneg); |
456 | 459 | ||
457 | 460 | ||
458 | static void phy_change(struct work_struct *work); | 461 | static void phy_change(struct work_struct *work); |
462 | static void phy_state_machine(struct work_struct *work); | ||
459 | static void phy_timer(unsigned long data); | 463 | static void phy_timer(unsigned long data); |
460 | 464 | ||
461 | /** | 465 | /** |
@@ -476,6 +480,7 @@ void phy_start_machine(struct phy_device *phydev, | |||
476 | { | 480 | { |
477 | phydev->adjust_state = handler; | 481 | phydev->adjust_state = handler; |
478 | 482 | ||
483 | INIT_WORK(&phydev->state_queue, phy_state_machine); | ||
479 | init_timer(&phydev->phy_timer); | 484 | init_timer(&phydev->phy_timer); |
480 | phydev->phy_timer.function = &phy_timer; | 485 | phydev->phy_timer.function = &phy_timer; |
481 | phydev->phy_timer.data = (unsigned long) phydev; | 486 | phydev->phy_timer.data = (unsigned long) phydev; |
@@ -493,11 +498,12 @@ void phy_start_machine(struct phy_device *phydev, | |||
493 | void phy_stop_machine(struct phy_device *phydev) | 498 | void phy_stop_machine(struct phy_device *phydev) |
494 | { | 499 | { |
495 | del_timer_sync(&phydev->phy_timer); | 500 | del_timer_sync(&phydev->phy_timer); |
501 | cancel_work_sync(&phydev->state_queue); | ||
496 | 502 | ||
497 | spin_lock_bh(&phydev->lock); | 503 | mutex_lock(&phydev->lock); |
498 | if (phydev->state > PHY_UP) | 504 | if (phydev->state > PHY_UP) |
499 | phydev->state = PHY_UP; | 505 | phydev->state = PHY_UP; |
500 | spin_unlock_bh(&phydev->lock); | 506 | mutex_unlock(&phydev->lock); |
501 | 507 | ||
502 | phydev->adjust_state = NULL; | 508 | phydev->adjust_state = NULL; |
503 | } | 509 | } |
@@ -541,9 +547,9 @@ static void phy_force_reduction(struct phy_device *phydev) | |||
541 | */ | 547 | */ |
542 | void phy_error(struct phy_device *phydev) | 548 | void phy_error(struct phy_device *phydev) |
543 | { | 549 | { |
544 | spin_lock_bh(&phydev->lock); | 550 | mutex_lock(&phydev->lock); |
545 | phydev->state = PHY_HALTED; | 551 | phydev->state = PHY_HALTED; |
546 | spin_unlock_bh(&phydev->lock); | 552 | mutex_unlock(&phydev->lock); |
547 | } | 553 | } |
548 | 554 | ||
549 | /** | 555 | /** |
@@ -705,10 +711,10 @@ static void phy_change(struct work_struct *work) | |||
705 | if (err) | 711 | if (err) |
706 | goto phy_err; | 712 | goto phy_err; |
707 | 713 | ||
708 | spin_lock_bh(&phydev->lock); | 714 | mutex_lock(&phydev->lock); |
709 | if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state)) | 715 | if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state)) |
710 | phydev->state = PHY_CHANGELINK; | 716 | phydev->state = PHY_CHANGELINK; |
711 | spin_unlock_bh(&phydev->lock); | 717 | mutex_unlock(&phydev->lock); |
712 | 718 | ||
713 | atomic_dec(&phydev->irq_disable); | 719 | atomic_dec(&phydev->irq_disable); |
714 | enable_irq(phydev->irq); | 720 | enable_irq(phydev->irq); |
@@ -735,7 +741,7 @@ phy_err: | |||
735 | */ | 741 | */ |
736 | void phy_stop(struct phy_device *phydev) | 742 | void phy_stop(struct phy_device *phydev) |
737 | { | 743 | { |
738 | spin_lock_bh(&phydev->lock); | 744 | mutex_lock(&phydev->lock); |
739 | 745 | ||
740 | if (PHY_HALTED == phydev->state) | 746 | if (PHY_HALTED == phydev->state) |
741 | goto out_unlock; | 747 | goto out_unlock; |
@@ -751,7 +757,7 @@ void phy_stop(struct phy_device *phydev) | |||
751 | phydev->state = PHY_HALTED; | 757 | phydev->state = PHY_HALTED; |
752 | 758 | ||
753 | out_unlock: | 759 | out_unlock: |
754 | spin_unlock_bh(&phydev->lock); | 760 | mutex_unlock(&phydev->lock); |
755 | 761 | ||
756 | /* | 762 | /* |
757 | * Cannot call flush_scheduled_work() here as desired because | 763 | * Cannot call flush_scheduled_work() here as desired because |
@@ -773,7 +779,7 @@ out_unlock: | |||
773 | */ | 779 | */ |
774 | void phy_start(struct phy_device *phydev) | 780 | void phy_start(struct phy_device *phydev) |
775 | { | 781 | { |
776 | spin_lock_bh(&phydev->lock); | 782 | mutex_lock(&phydev->lock); |
777 | 783 | ||
778 | switch (phydev->state) { | 784 | switch (phydev->state) { |
779 | case PHY_STARTING: | 785 | case PHY_STARTING: |
@@ -787,19 +793,26 @@ void phy_start(struct phy_device *phydev) | |||
787 | default: | 793 | default: |
788 | break; | 794 | break; |
789 | } | 795 | } |
790 | spin_unlock_bh(&phydev->lock); | 796 | mutex_unlock(&phydev->lock); |
791 | } | 797 | } |
792 | EXPORT_SYMBOL(phy_stop); | 798 | EXPORT_SYMBOL(phy_stop); |
793 | EXPORT_SYMBOL(phy_start); | 799 | EXPORT_SYMBOL(phy_start); |
794 | 800 | ||
795 | /* PHY timer which handles the state machine */ | 801 | /** |
796 | static void phy_timer(unsigned long data) | 802 | * phy_state_machine - Handle the state machine |
803 | * @work: work_struct that describes the work to be done | ||
804 | * | ||
805 | * Description: Scheduled by the state_queue workqueue each time | ||
806 | * phy_timer is triggered. | ||
807 | */ | ||
808 | static void phy_state_machine(struct work_struct *work) | ||
797 | { | 809 | { |
798 | struct phy_device *phydev = (struct phy_device *)data; | 810 | struct phy_device *phydev = |
811 | container_of(work, struct phy_device, state_queue); | ||
799 | int needs_aneg = 0; | 812 | int needs_aneg = 0; |
800 | int err = 0; | 813 | int err = 0; |
801 | 814 | ||
802 | spin_lock_bh(&phydev->lock); | 815 | mutex_lock(&phydev->lock); |
803 | 816 | ||
804 | if (phydev->adjust_state) | 817 | if (phydev->adjust_state) |
805 | phydev->adjust_state(phydev->attached_dev); | 818 | phydev->adjust_state(phydev->attached_dev); |
@@ -965,7 +978,7 @@ static void phy_timer(unsigned long data) | |||
965 | break; | 978 | break; |
966 | } | 979 | } |
967 | 980 | ||
968 | spin_unlock_bh(&phydev->lock); | 981 | mutex_unlock(&phydev->lock); |
969 | 982 | ||
970 | if (needs_aneg) | 983 | if (needs_aneg) |
971 | err = phy_start_aneg(phydev); | 984 | err = phy_start_aneg(phydev); |
@@ -976,3 +989,14 @@ static void phy_timer(unsigned long data) | |||
976 | mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ); | 989 | mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ); |
977 | } | 990 | } |
978 | 991 | ||
992 | /* PHY timer which schedules the state machine work */ | ||
993 | static void phy_timer(unsigned long data) | ||
994 | { | ||
995 | struct phy_device *phydev = (struct phy_device *)data; | ||
996 | |||
997 | /* | ||
998 | * PHY I/O operations can potentially sleep so we ensure that | ||
999 | * it's done from a process context | ||
1000 | */ | ||
1001 | schedule_work(&phydev->state_queue); | ||
1002 | } | ||
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 5b9e1751e1b4..f4c4fd85425f 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/netdevice.h> | 25 | #include <linux/netdevice.h> |
26 | #include <linux/etherdevice.h> | 26 | #include <linux/etherdevice.h> |
27 | #include <linux/skbuff.h> | 27 | #include <linux/skbuff.h> |
28 | #include <linux/spinlock.h> | ||
29 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
30 | #include <linux/module.h> | 29 | #include <linux/module.h> |
31 | #include <linux/mii.h> | 30 | #include <linux/mii.h> |
@@ -80,7 +79,7 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | |||
80 | 79 | ||
81 | dev->state = PHY_DOWN; | 80 | dev->state = PHY_DOWN; |
82 | 81 | ||
83 | spin_lock_init(&dev->lock); | 82 | mutex_init(&dev->lock); |
84 | 83 | ||
85 | return dev; | 84 | return dev; |
86 | } | 85 | } |
@@ -656,7 +655,7 @@ static int phy_probe(struct device *dev) | |||
656 | if (!(phydrv->flags & PHY_HAS_INTERRUPT)) | 655 | if (!(phydrv->flags & PHY_HAS_INTERRUPT)) |
657 | phydev->irq = PHY_POLL; | 656 | phydev->irq = PHY_POLL; |
658 | 657 | ||
659 | spin_lock_bh(&phydev->lock); | 658 | mutex_lock(&phydev->lock); |
660 | 659 | ||
661 | /* Start out supporting everything. Eventually, | 660 | /* Start out supporting everything. Eventually, |
662 | * a controller will attach, and may modify one | 661 | * a controller will attach, and may modify one |
@@ -670,7 +669,7 @@ static int phy_probe(struct device *dev) | |||
670 | if (phydev->drv->probe) | 669 | if (phydev->drv->probe) |
671 | err = phydev->drv->probe(phydev); | 670 | err = phydev->drv->probe(phydev); |
672 | 671 | ||
673 | spin_unlock_bh(&phydev->lock); | 672 | mutex_unlock(&phydev->lock); |
674 | 673 | ||
675 | return err; | 674 | return err; |
676 | 675 | ||
@@ -682,9 +681,9 @@ static int phy_remove(struct device *dev) | |||
682 | 681 | ||
683 | phydev = to_phy_device(dev); | 682 | phydev = to_phy_device(dev); |
684 | 683 | ||
685 | spin_lock_bh(&phydev->lock); | 684 | mutex_lock(&phydev->lock); |
686 | phydev->state = PHY_DOWN; | 685 | phydev->state = PHY_DOWN; |
687 | spin_unlock_bh(&phydev->lock); | 686 | mutex_unlock(&phydev->lock); |
688 | 687 | ||
689 | if (phydev->drv->remove) | 688 | if (phydev->drv->remove) |
690 | phydev->drv->remove(phydev); | 689 | phydev->drv->remove(phydev); |
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c new file mode 100644 index 000000000000..a052a6744a51 --- /dev/null +++ b/drivers/net/phy/realtek.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * drivers/net/phy/realtek.c | ||
3 | * | ||
4 | * Driver for Realtek PHYs | ||
5 | * | ||
6 | * Author: Johnson Leung <r58129@freescale.com> | ||
7 | * | ||
8 | * Copyright (c) 2004 Freescale Semiconductor, Inc. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | * | ||
15 | */ | ||
16 | #include <linux/phy.h> | ||
17 | |||
18 | #define RTL821x_PHYSR 0x11 | ||
19 | #define RTL821x_PHYSR_DUPLEX 0x2000 | ||
20 | #define RTL821x_PHYSR_SPEED 0xc000 | ||
21 | #define RTL821x_INER 0x12 | ||
22 | #define RTL821x_INER_INIT 0x6400 | ||
23 | #define RTL821x_INSR 0x13 | ||
24 | |||
25 | MODULE_DESCRIPTION("Realtek PHY driver"); | ||
26 | MODULE_AUTHOR("Johnson Leung"); | ||
27 | MODULE_LICENSE("GPL"); | ||
28 | |||
29 | static int rtl821x_ack_interrupt(struct phy_device *phydev) | ||
30 | { | ||
31 | int err; | ||
32 | |||
33 | err = phy_read(phydev, RTL821x_INSR); | ||
34 | |||
35 | return (err < 0) ? err : 0; | ||
36 | } | ||
37 | |||
38 | static int rtl821x_config_intr(struct phy_device *phydev) | ||
39 | { | ||
40 | int err; | ||
41 | |||
42 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) | ||
43 | err = phy_write(phydev, RTL821x_INER, | ||
44 | RTL821x_INER_INIT); | ||
45 | else | ||
46 | err = phy_write(phydev, RTL821x_INER, 0); | ||
47 | |||
48 | return err; | ||
49 | } | ||
50 | |||
51 | /* RTL8211B */ | ||
52 | static struct phy_driver rtl821x_driver = { | ||
53 | .phy_id = 0x001cc912, | ||
54 | .name = "RTL821x Gigabit Ethernet", | ||
55 | .phy_id_mask = 0x001fffff, | ||
56 | .features = PHY_GBIT_FEATURES, | ||
57 | .flags = PHY_HAS_INTERRUPT, | ||
58 | .config_aneg = &genphy_config_aneg, | ||
59 | .read_status = &genphy_read_status, | ||
60 | .ack_interrupt = &rtl821x_ack_interrupt, | ||
61 | .config_intr = &rtl821x_config_intr, | ||
62 | .driver = { .owner = THIS_MODULE,}, | ||
63 | }; | ||
64 | |||
65 | static int __init realtek_init(void) | ||
66 | { | ||
67 | int ret; | ||
68 | |||
69 | ret = phy_driver_register(&rtl821x_driver); | ||
70 | |||
71 | return ret; | ||
72 | } | ||
73 | |||
74 | static void __exit realtek_exit(void) | ||
75 | { | ||
76 | phy_driver_unregister(&rtl821x_driver); | ||
77 | } | ||
78 | |||
79 | module_init(realtek_init); | ||
80 | module_exit(realtek_exit); | ||
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 5fab7d7b5d74..6179a0a2032c 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -8118,7 +8118,7 @@ static void initiate_new_session(struct lro *lro, u8 *l2h, | |||
8118 | lro->iph = ip; | 8118 | lro->iph = ip; |
8119 | lro->tcph = tcp; | 8119 | lro->tcph = tcp; |
8120 | lro->tcp_next_seq = tcp_pyld_len + ntohl(tcp->seq); | 8120 | lro->tcp_next_seq = tcp_pyld_len + ntohl(tcp->seq); |
8121 | lro->tcp_ack = ntohl(tcp->ack_seq); | 8121 | lro->tcp_ack = tcp->ack_seq; |
8122 | lro->sg_num = 1; | 8122 | lro->sg_num = 1; |
8123 | lro->total_len = ntohs(ip->tot_len); | 8123 | lro->total_len = ntohs(ip->tot_len); |
8124 | lro->frags_len = 0; | 8124 | lro->frags_len = 0; |
@@ -8127,10 +8127,10 @@ static void initiate_new_session(struct lro *lro, u8 *l2h, | |||
8127 | * already been done. | 8127 | * already been done. |
8128 | */ | 8128 | */ |
8129 | if (tcp->doff == 8) { | 8129 | if (tcp->doff == 8) { |
8130 | u32 *ptr; | 8130 | __be32 *ptr; |
8131 | ptr = (u32 *)(tcp+1); | 8131 | ptr = (__be32 *)(tcp+1); |
8132 | lro->saw_ts = 1; | 8132 | lro->saw_ts = 1; |
8133 | lro->cur_tsval = *(ptr+1); | 8133 | lro->cur_tsval = ntohl(*(ptr+1)); |
8134 | lro->cur_tsecr = *(ptr+2); | 8134 | lro->cur_tsecr = *(ptr+2); |
8135 | } | 8135 | } |
8136 | lro->in_use = 1; | 8136 | lro->in_use = 1; |
@@ -8156,7 +8156,7 @@ static void update_L3L4_header(struct s2io_nic *sp, struct lro *lro) | |||
8156 | 8156 | ||
8157 | /* Update tsecr field if this session has timestamps enabled */ | 8157 | /* Update tsecr field if this session has timestamps enabled */ |
8158 | if (lro->saw_ts) { | 8158 | if (lro->saw_ts) { |
8159 | u32 *ptr = (u32 *)(tcp + 1); | 8159 | __be32 *ptr = (__be32 *)(tcp + 1); |
8160 | *(ptr+2) = lro->cur_tsecr; | 8160 | *(ptr+2) = lro->cur_tsecr; |
8161 | } | 8161 | } |
8162 | 8162 | ||
@@ -8181,10 +8181,10 @@ static void aggregate_new_rx(struct lro *lro, struct iphdr *ip, | |||
8181 | lro->window = tcp->window; | 8181 | lro->window = tcp->window; |
8182 | 8182 | ||
8183 | if (lro->saw_ts) { | 8183 | if (lro->saw_ts) { |
8184 | u32 *ptr; | 8184 | __be32 *ptr; |
8185 | /* Update tsecr and tsval from this packet */ | 8185 | /* Update tsecr and tsval from this packet */ |
8186 | ptr = (u32 *) (tcp + 1); | 8186 | ptr = (__be32 *)(tcp+1); |
8187 | lro->cur_tsval = *(ptr + 1); | 8187 | lro->cur_tsval = ntohl(*(ptr+1)); |
8188 | lro->cur_tsecr = *(ptr + 2); | 8188 | lro->cur_tsecr = *(ptr + 2); |
8189 | } | 8189 | } |
8190 | } | 8190 | } |
@@ -8235,11 +8235,11 @@ static int verify_l3_l4_lro_capable(struct lro *l_lro, struct iphdr *ip, | |||
8235 | 8235 | ||
8236 | /* Ensure timestamp value increases monotonically */ | 8236 | /* Ensure timestamp value increases monotonically */ |
8237 | if (l_lro) | 8237 | if (l_lro) |
8238 | if (l_lro->cur_tsval > *((u32 *)(ptr+2))) | 8238 | if (l_lro->cur_tsval > ntohl(*((__be32 *)(ptr+2)))) |
8239 | return -1; | 8239 | return -1; |
8240 | 8240 | ||
8241 | /* timestamp echo reply should be non-zero */ | 8241 | /* timestamp echo reply should be non-zero */ |
8242 | if (*((u32 *)(ptr+6)) == 0) | 8242 | if (*((__be32 *)(ptr+6)) == 0) |
8243 | return -1; | 8243 | return -1; |
8244 | } | 8244 | } |
8245 | 8245 | ||
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 9f6016c6f135..64b88eb48287 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -809,7 +809,7 @@ struct lro { | |||
809 | int in_use; | 809 | int in_use; |
810 | __be16 window; | 810 | __be16 window; |
811 | u32 cur_tsval; | 811 | u32 cur_tsval; |
812 | u32 cur_tsecr; | 812 | __be32 cur_tsecr; |
813 | u8 saw_ts; | 813 | u8 saw_ts; |
814 | }; | 814 | }; |
815 | 815 | ||
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index b570402f7fed..2e9e88be7b33 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c | |||
@@ -326,7 +326,7 @@ static const struct { | |||
326 | { "SiS 191 PCI Gigabit Ethernet adapter" }, | 326 | { "SiS 191 PCI Gigabit Ethernet adapter" }, |
327 | }; | 327 | }; |
328 | 328 | ||
329 | static struct pci_device_id sis190_pci_tbl[] __devinitdata = { | 329 | static struct pci_device_id sis190_pci_tbl[] = { |
330 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0190), 0, 0, 0 }, | 330 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0190), 0, 0, 0 }, |
331 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0191), 0, 0, 1 }, | 331 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0191), 0, 0, 1 }, |
332 | { 0, }, | 332 | { 0, }, |
diff --git a/drivers/net/skfp/ess.c b/drivers/net/skfp/ess.c index 62b01328c496..889f98724610 100644 --- a/drivers/net/skfp/ess.c +++ b/drivers/net/skfp/ess.c | |||
@@ -598,7 +598,7 @@ static void ess_send_alc_req(struct s_smc *smc) | |||
598 | req->cmd.sba_cmd = REQUEST_ALLOCATION ; | 598 | req->cmd.sba_cmd = REQUEST_ALLOCATION ; |
599 | 599 | ||
600 | /* | 600 | /* |
601 | * set the parameter type and parameter lenght of all used | 601 | * set the parameter type and parameter length of all used |
602 | * parameters | 602 | * parameters |
603 | */ | 603 | */ |
604 | 604 | ||
diff --git a/drivers/net/skfp/fplustm.c b/drivers/net/skfp/fplustm.c index a45205da8033..76dc8adc9441 100644 --- a/drivers/net/skfp/fplustm.c +++ b/drivers/net/skfp/fplustm.c | |||
@@ -398,7 +398,7 @@ static void copy_tx_mac(struct s_smc *smc, u_long td, struct fddi_mac *mac, | |||
398 | /* u_long td; transmit descriptor */ | 398 | /* u_long td; transmit descriptor */ |
399 | /* struct fddi_mac *mac; mac frame pointer */ | 399 | /* struct fddi_mac *mac; mac frame pointer */ |
400 | /* unsigned off; start address within buffer memory */ | 400 | /* unsigned off; start address within buffer memory */ |
401 | /* int len ; lenght of the frame including the FC */ | 401 | /* int len ; length of the frame including the FC */ |
402 | { | 402 | { |
403 | int i ; | 403 | int i ; |
404 | u_int *p ; | 404 | u_int *p ; |
diff --git a/drivers/net/skfp/hwmtm.c b/drivers/net/skfp/hwmtm.c index 8a430a366547..46e339315656 100644 --- a/drivers/net/skfp/hwmtm.c +++ b/drivers/net/skfp/hwmtm.c | |||
@@ -1185,7 +1185,7 @@ void process_receive(struct s_smc *smc) | |||
1185 | 1185 | ||
1186 | DB_RX("frame length = %d",len,0,4) ; | 1186 | DB_RX("frame length = %d",len,0,4) ; |
1187 | /* | 1187 | /* |
1188 | * check the frame_lenght and all error flags | 1188 | * check the frame_length and all error flags |
1189 | */ | 1189 | */ |
1190 | if (rfsw & (RX_MSRABT|RX_FS_E|RX_FS_CRC|RX_FS_IMPL)){ | 1190 | if (rfsw & (RX_MSRABT|RX_FS_E|RX_FS_CRC|RX_FS_IMPL)){ |
1191 | if (rfsw & RD_S_MSRABT) { | 1191 | if (rfsw & RD_S_MSRABT) { |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 626190eb91e7..dc062367a1c8 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -623,6 +623,7 @@ static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) | |||
623 | static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD }; | 623 | static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD }; |
624 | static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA }; | 624 | static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA }; |
625 | 625 | ||
626 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
626 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); | 627 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
627 | /* Turn on/off phy power saving */ | 628 | /* Turn on/off phy power saving */ |
628 | if (onoff) | 629 | if (onoff) |
@@ -634,7 +635,8 @@ static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) | |||
634 | reg1 |= coma_mode[port]; | 635 | reg1 |= coma_mode[port]; |
635 | 636 | ||
636 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | 637 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
637 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); | 638 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); |
639 | sky2_pci_read32(hw, PCI_DEV_REG1); | ||
638 | 640 | ||
639 | udelay(100); | 641 | udelay(100); |
640 | } | 642 | } |
@@ -1422,6 +1424,7 @@ static int sky2_up(struct net_device *dev) | |||
1422 | imask |= portirq_msk[port]; | 1424 | imask |= portirq_msk[port]; |
1423 | sky2_write32(hw, B0_IMSK, imask); | 1425 | sky2_write32(hw, B0_IMSK, imask); |
1424 | 1426 | ||
1427 | sky2_set_multicast(dev); | ||
1425 | return 0; | 1428 | return 0; |
1426 | 1429 | ||
1427 | err_out: | 1430 | err_out: |
@@ -2436,6 +2439,7 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2436 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { | 2439 | if (status & (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) { |
2437 | u16 pci_err; | 2440 | u16 pci_err; |
2438 | 2441 | ||
2442 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2439 | pci_err = sky2_pci_read16(hw, PCI_STATUS); | 2443 | pci_err = sky2_pci_read16(hw, PCI_STATUS); |
2440 | if (net_ratelimit()) | 2444 | if (net_ratelimit()) |
2441 | dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", | 2445 | dev_err(&pdev->dev, "PCI hardware error (0x%x)\n", |
@@ -2443,12 +2447,14 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2443 | 2447 | ||
2444 | sky2_pci_write16(hw, PCI_STATUS, | 2448 | sky2_pci_write16(hw, PCI_STATUS, |
2445 | pci_err | PCI_STATUS_ERROR_BITS); | 2449 | pci_err | PCI_STATUS_ERROR_BITS); |
2450 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2446 | } | 2451 | } |
2447 | 2452 | ||
2448 | if (status & Y2_IS_PCI_EXP) { | 2453 | if (status & Y2_IS_PCI_EXP) { |
2449 | /* PCI-Express uncorrectable Error occurred */ | 2454 | /* PCI-Express uncorrectable Error occurred */ |
2450 | u32 err; | 2455 | u32 err; |
2451 | 2456 | ||
2457 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); | ||
2452 | err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); | 2458 | err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); |
2453 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, | 2459 | sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS, |
2454 | 0xfffffffful); | 2460 | 0xfffffffful); |
@@ -2456,6 +2462,7 @@ static void sky2_hw_intr(struct sky2_hw *hw) | |||
2456 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); | 2462 | dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err); |
2457 | 2463 | ||
2458 | sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); | 2464 | sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS); |
2465 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2459 | } | 2466 | } |
2460 | 2467 | ||
2461 | if (status & Y2_HWE_L1_MASK) | 2468 | if (status & Y2_HWE_L1_MASK) |
@@ -2831,6 +2838,7 @@ static void sky2_reset(struct sky2_hw *hw) | |||
2831 | } | 2838 | } |
2832 | 2839 | ||
2833 | sky2_power_on(hw); | 2840 | sky2_power_on(hw); |
2841 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | ||
2834 | 2842 | ||
2835 | for (i = 0; i < hw->ports; i++) { | 2843 | for (i = 0; i < hw->ports; i++) { |
2836 | sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); | 2844 | sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET); |
@@ -3554,8 +3562,6 @@ static int sky2_set_ringparam(struct net_device *dev, | |||
3554 | err = sky2_up(dev); | 3562 | err = sky2_up(dev); |
3555 | if (err) | 3563 | if (err) |
3556 | dev_close(dev); | 3564 | dev_close(dev); |
3557 | else | ||
3558 | sky2_set_multicast(dev); | ||
3559 | } | 3565 | } |
3560 | 3566 | ||
3561 | return err; | 3567 | return err; |
@@ -4389,8 +4395,6 @@ static int sky2_resume(struct pci_dev *pdev) | |||
4389 | dev_close(dev); | 4395 | dev_close(dev); |
4390 | goto out; | 4396 | goto out; |
4391 | } | 4397 | } |
4392 | |||
4393 | sky2_set_multicast(dev); | ||
4394 | } | 4398 | } |
4395 | } | 4399 | } |
4396 | 4400 | ||
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c index fe3ac6f9ae89..0e4a88d16327 100644 --- a/drivers/net/sunbmac.c +++ b/drivers/net/sunbmac.c | |||
@@ -1075,7 +1075,7 @@ static const struct ethtool_ops bigmac_ethtool_ops = { | |||
1075 | .get_link = bigmac_get_link, | 1075 | .get_link = bigmac_get_link, |
1076 | }; | 1076 | }; |
1077 | 1077 | ||
1078 | static int __init bigmac_ether_init(struct sbus_dev *qec_sdev) | 1078 | static int __devinit bigmac_ether_init(struct sbus_dev *qec_sdev) |
1079 | { | 1079 | { |
1080 | struct net_device *dev; | 1080 | struct net_device *dev; |
1081 | static int version_printed; | 1081 | static int version_printed; |
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c index ff23c6489efd..e811331d4608 100644 --- a/drivers/net/sunqe.c +++ b/drivers/net/sunqe.c | |||
@@ -747,7 +747,7 @@ static inline void qec_init_once(struct sunqec *qecp, struct sbus_dev *qsdev) | |||
747 | qecp->gregs + GLOB_RSIZE); | 747 | qecp->gregs + GLOB_RSIZE); |
748 | } | 748 | } |
749 | 749 | ||
750 | static u8 __init qec_get_burst(struct device_node *dp) | 750 | static u8 __devinit qec_get_burst(struct device_node *dp) |
751 | { | 751 | { |
752 | u8 bsizes, bsizes_more; | 752 | u8 bsizes, bsizes_more; |
753 | 753 | ||
@@ -767,7 +767,7 @@ static u8 __init qec_get_burst(struct device_node *dp) | |||
767 | return bsizes; | 767 | return bsizes; |
768 | } | 768 | } |
769 | 769 | ||
770 | static struct sunqec * __init get_qec(struct sbus_dev *child_sdev) | 770 | static struct sunqec * __devinit get_qec(struct sbus_dev *child_sdev) |
771 | { | 771 | { |
772 | struct sbus_dev *qec_sdev = child_sdev->parent; | 772 | struct sbus_dev *qec_sdev = child_sdev->parent; |
773 | struct sunqec *qecp; | 773 | struct sunqec *qecp; |
@@ -823,7 +823,7 @@ fail: | |||
823 | return NULL; | 823 | return NULL; |
824 | } | 824 | } |
825 | 825 | ||
826 | static int __init qec_ether_init(struct sbus_dev *sdev) | 826 | static int __devinit qec_ether_init(struct sbus_dev *sdev) |
827 | { | 827 | { |
828 | static unsigned version_printed; | 828 | static unsigned version_printed; |
829 | struct net_device *dev; | 829 | struct net_device *dev; |
diff --git a/drivers/net/sunvnet.c b/drivers/net/sunvnet.c index 4a0035f7a842..6415ce15c2ef 100644 --- a/drivers/net/sunvnet.c +++ b/drivers/net/sunvnet.c | |||
@@ -1130,7 +1130,7 @@ static struct vio_driver_ops vnet_vio_ops = { | |||
1130 | .handshake_complete = vnet_handshake_complete, | 1130 | .handshake_complete = vnet_handshake_complete, |
1131 | }; | 1131 | }; |
1132 | 1132 | ||
1133 | static void print_version(void) | 1133 | static void __devinit print_version(void) |
1134 | { | 1134 | { |
1135 | static int version_printed; | 1135 | static int version_printed; |
1136 | 1136 | ||
diff --git a/drivers/net/tokenring/abyss.c b/drivers/net/tokenring/abyss.c index 124cfd4fbcf4..7a7de0469eae 100644 --- a/drivers/net/tokenring/abyss.c +++ b/drivers/net/tokenring/abyss.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * - Madge Smart 16/4 PCI Mk2 | 10 | * - Madge Smart 16/4 PCI Mk2 |
11 | * | 11 | * |
12 | * Maintainer(s): | 12 | * Maintainer(s): |
13 | * AF Adam Fritzler mid@auk.cx | 13 | * AF Adam Fritzler |
14 | * | 14 | * |
15 | * Modification History: | 15 | * Modification History: |
16 | * 30-Dec-99 AF Split off from the tms380tr driver. | 16 | * 30-Dec-99 AF Split off from the tms380tr driver. |
diff --git a/drivers/net/tokenring/abyss.h b/drivers/net/tokenring/abyss.h index 0ee6e4f085b1..b0a473b89133 100644 --- a/drivers/net/tokenring/abyss.h +++ b/drivers/net/tokenring/abyss.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * abyss.h: Header for the abyss tms380tr module | 2 | * abyss.h: Header for the abyss tms380tr module |
3 | * | 3 | * |
4 | * Authors: | 4 | * Authors: |
5 | * - Adam Fritzler <mid@auk.cx> | 5 | * - Adam Fritzler |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef __LINUX_MADGETR_H | 8 | #ifndef __LINUX_MADGETR_H |
diff --git a/drivers/net/tokenring/madgemc.c b/drivers/net/tokenring/madgemc.c index 5a4151362fc0..c9c5a2b1ed9e 100644 --- a/drivers/net/tokenring/madgemc.c +++ b/drivers/net/tokenring/madgemc.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * - Madge Smart 16/4 Ringnode MC32 (??) | 11 | * - Madge Smart 16/4 Ringnode MC32 (??) |
12 | * | 12 | * |
13 | * Maintainer(s): | 13 | * Maintainer(s): |
14 | * AF Adam Fritzler mid@auk.cx | 14 | * AF Adam Fritzler |
15 | * | 15 | * |
16 | * Modification History: | 16 | * Modification History: |
17 | * 16-Jan-00 AF Created | 17 | * 16-Jan-00 AF Created |
diff --git a/drivers/net/tokenring/madgemc.h b/drivers/net/tokenring/madgemc.h index 2dd822203809..fe88e272c531 100644 --- a/drivers/net/tokenring/madgemc.h +++ b/drivers/net/tokenring/madgemc.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * madgemc.h: Header for the madgemc tms380tr module | 2 | * madgemc.h: Header for the madgemc tms380tr module |
3 | * | 3 | * |
4 | * Authors: | 4 | * Authors: |
5 | * - Adam Fritzler <mid@auk.cx> | 5 | * - Adam Fritzler |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef __LINUX_MADGEMC_H | 8 | #ifndef __LINUX_MADGEMC_H |
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c index e7b4adc5c4e7..433c994ea9d8 100644 --- a/drivers/net/tokenring/olympic.c +++ b/drivers/net/tokenring/olympic.c | |||
@@ -434,7 +434,7 @@ static int __devinit olympic_init(struct net_device *dev) | |||
434 | 434 | ||
435 | } | 435 | } |
436 | 436 | ||
437 | static int olympic_open(struct net_device *dev) | 437 | static int __devinit olympic_open(struct net_device *dev) |
438 | { | 438 | { |
439 | struct olympic_private *olympic_priv=netdev_priv(dev); | 439 | struct olympic_private *olympic_priv=netdev_priv(dev); |
440 | u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio,*init_srb; | 440 | u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio,*init_srb; |
diff --git a/drivers/net/tokenring/proteon.c b/drivers/net/tokenring/proteon.c index ca6b65919b3d..00ea94513460 100644 --- a/drivers/net/tokenring/proteon.c +++ b/drivers/net/tokenring/proteon.c | |||
@@ -12,7 +12,7 @@ | |||
12 | * - Proteon 1392, 1392+ | 12 | * - Proteon 1392, 1392+ |
13 | * | 13 | * |
14 | * Maintainer(s): | 14 | * Maintainer(s): |
15 | * AF Adam Fritzler mid@auk.cx | 15 | * AF Adam Fritzler |
16 | * JF Jochen Friedrich jochen@scram.de | 16 | * JF Jochen Friedrich jochen@scram.de |
17 | * | 17 | * |
18 | * Modification History: | 18 | * Modification History: |
diff --git a/drivers/net/tokenring/skisa.c b/drivers/net/tokenring/skisa.c index 32e8d5a9f958..41b6999a0f33 100644 --- a/drivers/net/tokenring/skisa.c +++ b/drivers/net/tokenring/skisa.c | |||
@@ -13,7 +13,7 @@ | |||
13 | * - SysKonnect TR4/16(+) ISA (SK-4190) | 13 | * - SysKonnect TR4/16(+) ISA (SK-4190) |
14 | * | 14 | * |
15 | * Maintainer(s): | 15 | * Maintainer(s): |
16 | * AF Adam Fritzler mid@auk.cx | 16 | * AF Adam Fritzler |
17 | * JF Jochen Friedrich jochen@scram.de | 17 | * JF Jochen Friedrich jochen@scram.de |
18 | * | 18 | * |
19 | * Modification History: | 19 | * Modification History: |
diff --git a/drivers/net/tokenring/tms380tr.c b/drivers/net/tokenring/tms380tr.c index d5fa36d36515..d07c4523c847 100644 --- a/drivers/net/tokenring/tms380tr.c +++ b/drivers/net/tokenring/tms380tr.c | |||
@@ -30,7 +30,7 @@ | |||
30 | * Maintainer(s): | 30 | * Maintainer(s): |
31 | * JS Jay Schulist jschlst@samba.org | 31 | * JS Jay Schulist jschlst@samba.org |
32 | * CG Christoph Goos cgoos@syskonnect.de | 32 | * CG Christoph Goos cgoos@syskonnect.de |
33 | * AF Adam Fritzler mid@auk.cx | 33 | * AF Adam Fritzler |
34 | * MLP Mike Phillips phillim@amtrak.com | 34 | * MLP Mike Phillips phillim@amtrak.com |
35 | * JF Jochen Friedrich jochen@scram.de | 35 | * JF Jochen Friedrich jochen@scram.de |
36 | * | 36 | * |
diff --git a/drivers/net/tokenring/tms380tr.h b/drivers/net/tokenring/tms380tr.h index 7daf74e31ccd..7af76d708849 100644 --- a/drivers/net/tokenring/tms380tr.h +++ b/drivers/net/tokenring/tms380tr.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Authors: | 4 | * Authors: |
5 | * - Christoph Goos <cgoos@syskonnect.de> | 5 | * - Christoph Goos <cgoos@syskonnect.de> |
6 | * - Adam Fritzler <mid@auk.cx> | 6 | * - Adam Fritzler |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #ifndef __LINUX_TMS380TR_H | 9 | #ifndef __LINUX_TMS380TR_H |
diff --git a/drivers/net/tokenring/tmspci.c b/drivers/net/tokenring/tmspci.c index 1c18f782f522..5f0ee880cfff 100644 --- a/drivers/net/tokenring/tmspci.c +++ b/drivers/net/tokenring/tmspci.c | |||
@@ -14,7 +14,7 @@ | |||
14 | * - 3Com 3C339 Token Link Velocity | 14 | * - 3Com 3C339 Token Link Velocity |
15 | * | 15 | * |
16 | * Maintainer(s): | 16 | * Maintainer(s): |
17 | * AF Adam Fritzler mid@auk.cx | 17 | * AF Adam Fritzler |
18 | * | 18 | * |
19 | * Modification History: | 19 | * Modification History: |
20 | * 30-Dec-99 AF Split off from the tms380tr driver. | 20 | * 30-Dec-99 AF Split off from the tms380tr driver. |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 4ffd8739f8b7..fba0811d2608 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -2084,8 +2084,10 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth) | |||
2084 | if (!ugeth) | 2084 | if (!ugeth) |
2085 | return; | 2085 | return; |
2086 | 2086 | ||
2087 | if (ugeth->uccf) | 2087 | if (ugeth->uccf) { |
2088 | ucc_fast_free(ugeth->uccf); | 2088 | ucc_fast_free(ugeth->uccf); |
2089 | ugeth->uccf = NULL; | ||
2090 | } | ||
2089 | 2091 | ||
2090 | if (ugeth->p_thread_data_tx) { | 2092 | if (ugeth->p_thread_data_tx) { |
2091 | qe_muram_free(ugeth->thread_dat_tx_offset); | 2093 | qe_muram_free(ugeth->thread_dat_tx_offset); |
@@ -2305,10 +2307,6 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2305 | ug_info = ugeth->ug_info; | 2307 | ug_info = ugeth->ug_info; |
2306 | uf_info = &ug_info->uf_info; | 2308 | uf_info = &ug_info->uf_info; |
2307 | 2309 | ||
2308 | /* Create CQs for hash tables */ | ||
2309 | INIT_LIST_HEAD(&ugeth->group_hash_q); | ||
2310 | INIT_LIST_HEAD(&ugeth->ind_hash_q); | ||
2311 | |||
2312 | if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || | 2310 | if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || |
2313 | (uf_info->bd_mem_part == MEM_PART_MURAM))) { | 2311 | (uf_info->bd_mem_part == MEM_PART_MURAM))) { |
2314 | if (netif_msg_probe(ugeth)) | 2312 | if (netif_msg_probe(ugeth)) |
@@ -3668,6 +3666,23 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info) | |||
3668 | return IRQ_HANDLED; | 3666 | return IRQ_HANDLED; |
3669 | } | 3667 | } |
3670 | 3668 | ||
3669 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
3670 | /* | ||
3671 | * Polling 'interrupt' - used by things like netconsole to send skbs | ||
3672 | * without having to re-enable interrupts. It's not called while | ||
3673 | * the interrupt routine is executing. | ||
3674 | */ | ||
3675 | static void ucc_netpoll(struct net_device *dev) | ||
3676 | { | ||
3677 | struct ucc_geth_private *ugeth = netdev_priv(dev); | ||
3678 | int irq = ugeth->ug_info->uf_info.irq; | ||
3679 | |||
3680 | disable_irq(irq); | ||
3681 | ucc_geth_irq_handler(irq, dev); | ||
3682 | enable_irq(irq); | ||
3683 | } | ||
3684 | #endif /* CONFIG_NET_POLL_CONTROLLER */ | ||
3685 | |||
3671 | /* Called when something needs to use the ethernet device */ | 3686 | /* Called when something needs to use the ethernet device */ |
3672 | /* Returns 0 for success. */ | 3687 | /* Returns 0 for success. */ |
3673 | static int ucc_geth_open(struct net_device *dev) | 3688 | static int ucc_geth_open(struct net_device *dev) |
@@ -3990,6 +4005,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3990 | ugeth = netdev_priv(dev); | 4005 | ugeth = netdev_priv(dev); |
3991 | spin_lock_init(&ugeth->lock); | 4006 | spin_lock_init(&ugeth->lock); |
3992 | 4007 | ||
4008 | /* Create CQs for hash tables */ | ||
4009 | INIT_LIST_HEAD(&ugeth->group_hash_q); | ||
4010 | INIT_LIST_HEAD(&ugeth->ind_hash_q); | ||
4011 | |||
3993 | dev_set_drvdata(device, dev); | 4012 | dev_set_drvdata(device, dev); |
3994 | 4013 | ||
3995 | /* Set the dev->base_addr to the gfar reg region */ | 4014 | /* Set the dev->base_addr to the gfar reg region */ |
@@ -4006,6 +4025,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
4006 | #ifdef CONFIG_UGETH_NAPI | 4025 | #ifdef CONFIG_UGETH_NAPI |
4007 | netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT); | 4026 | netif_napi_add(dev, &ugeth->napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT); |
4008 | #endif /* CONFIG_UGETH_NAPI */ | 4027 | #endif /* CONFIG_UGETH_NAPI */ |
4028 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
4029 | dev->poll_controller = ucc_netpoll; | ||
4030 | #endif | ||
4009 | dev->stop = ucc_geth_close; | 4031 | dev->stop = ucc_geth_close; |
4010 | // dev->change_mtu = ucc_geth_change_mtu; | 4032 | // dev->change_mtu = ucc_geth_change_mtu; |
4011 | dev->mtu = 1500; | 4033 | dev->mtu = 1500; |
@@ -4040,9 +4062,10 @@ static int ucc_geth_remove(struct of_device* ofdev) | |||
4040 | struct net_device *dev = dev_get_drvdata(device); | 4062 | struct net_device *dev = dev_get_drvdata(device); |
4041 | struct ucc_geth_private *ugeth = netdev_priv(dev); | 4063 | struct ucc_geth_private *ugeth = netdev_priv(dev); |
4042 | 4064 | ||
4043 | dev_set_drvdata(device, NULL); | 4065 | unregister_netdev(dev); |
4044 | ucc_geth_memclean(ugeth); | ||
4045 | free_netdev(dev); | 4066 | free_netdev(dev); |
4067 | ucc_geth_memclean(ugeth); | ||
4068 | dev_set_drvdata(device, NULL); | ||
4046 | 4069 | ||
4047 | return 0; | 4070 | return 0; |
4048 | } | 4071 | } |
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 33cbc306226c..7e1f00131f91 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -926,7 +926,6 @@ static int rtl8150_probe(struct usb_interface *intf, | |||
926 | netdev->set_multicast_list = rtl8150_set_multicast; | 926 | netdev->set_multicast_list = rtl8150_set_multicast; |
927 | netdev->set_mac_address = rtl8150_set_mac_address; | 927 | netdev->set_mac_address = rtl8150_set_mac_address; |
928 | netdev->get_stats = rtl8150_netdev_stats; | 928 | netdev->get_stats = rtl8150_netdev_stats; |
929 | netdev->mtu = RTL8150_MTU; | ||
930 | SET_ETHTOOL_OPS(netdev, &ops); | 929 | SET_ETHTOOL_OPS(netdev, &ops); |
931 | dev->intr_interval = 100; /* 100ms */ | 930 | dev->intr_interval = 100; /* 100ms */ |
932 | 931 | ||
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 87c180b563d3..7c851b1e6daa 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -606,7 +606,7 @@ static int rhine_napipoll(struct napi_struct *napi, int budget) | |||
606 | } | 606 | } |
607 | #endif | 607 | #endif |
608 | 608 | ||
609 | static void rhine_hw_init(struct net_device *dev, long pioaddr) | 609 | static void __devinit rhine_hw_init(struct net_device *dev, long pioaddr) |
610 | { | 610 | { |
611 | struct rhine_private *rp = netdev_priv(dev); | 611 | struct rhine_private *rp = netdev_priv(dev); |
612 | 612 | ||
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 35cd65d6b9ed..8c9fb824cbd4 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * for 64bit hardware platforms. | 8 | * for 64bit hardware platforms. |
9 | * | 9 | * |
10 | * TODO | 10 | * TODO |
11 | * Big-endian support | ||
12 | * rx_copybreak/alignment | 11 | * rx_copybreak/alignment |
13 | * Scatter gather | 12 | * Scatter gather |
14 | * More testing | 13 | * More testing |
@@ -681,7 +680,7 @@ static void velocity_rx_reset(struct velocity_info *vptr) | |||
681 | * Init state, all RD entries belong to the NIC | 680 | * Init state, all RD entries belong to the NIC |
682 | */ | 681 | */ |
683 | for (i = 0; i < vptr->options.numrx; ++i) | 682 | for (i = 0; i < vptr->options.numrx; ++i) |
684 | vptr->rd_ring[i].rdesc0.owner = OWNED_BY_NIC; | 683 | vptr->rd_ring[i].rdesc0.len |= OWNED_BY_NIC; |
685 | 684 | ||
686 | writew(vptr->options.numrx, ®s->RBRDU); | 685 | writew(vptr->options.numrx, ®s->RBRDU); |
687 | writel(vptr->rd_pool_dma, ®s->RDBaseLo); | 686 | writel(vptr->rd_pool_dma, ®s->RDBaseLo); |
@@ -777,7 +776,7 @@ static void velocity_init_registers(struct velocity_info *vptr, | |||
777 | 776 | ||
778 | vptr->int_mask = INT_MASK_DEF; | 777 | vptr->int_mask = INT_MASK_DEF; |
779 | 778 | ||
780 | writel(cpu_to_le32(vptr->rd_pool_dma), ®s->RDBaseLo); | 779 | writel(vptr->rd_pool_dma, ®s->RDBaseLo); |
781 | writew(vptr->options.numrx - 1, ®s->RDCSize); | 780 | writew(vptr->options.numrx - 1, ®s->RDCSize); |
782 | mac_rx_queue_run(regs); | 781 | mac_rx_queue_run(regs); |
783 | mac_rx_queue_wake(regs); | 782 | mac_rx_queue_wake(regs); |
@@ -785,7 +784,7 @@ static void velocity_init_registers(struct velocity_info *vptr, | |||
785 | writew(vptr->options.numtx - 1, ®s->TDCSize); | 784 | writew(vptr->options.numtx - 1, ®s->TDCSize); |
786 | 785 | ||
787 | for (i = 0; i < vptr->num_txq; i++) { | 786 | for (i = 0; i < vptr->num_txq; i++) { |
788 | writel(cpu_to_le32(vptr->td_pool_dma[i]), &(regs->TDBaseLo[i])); | 787 | writel(vptr->td_pool_dma[i], ®s->TDBaseLo[i]); |
789 | mac_tx_queue_run(regs, i); | 788 | mac_tx_queue_run(regs, i); |
790 | } | 789 | } |
791 | 790 | ||
@@ -1195,7 +1194,7 @@ static inline void velocity_give_many_rx_descs(struct velocity_info *vptr) | |||
1195 | dirty = vptr->rd_dirty - unusable; | 1194 | dirty = vptr->rd_dirty - unusable; |
1196 | for (avail = vptr->rd_filled & 0xfffc; avail; avail--) { | 1195 | for (avail = vptr->rd_filled & 0xfffc; avail; avail--) { |
1197 | dirty = (dirty > 0) ? dirty - 1 : vptr->options.numrx - 1; | 1196 | dirty = (dirty > 0) ? dirty - 1 : vptr->options.numrx - 1; |
1198 | vptr->rd_ring[dirty].rdesc0.owner = OWNED_BY_NIC; | 1197 | vptr->rd_ring[dirty].rdesc0.len |= OWNED_BY_NIC; |
1199 | } | 1198 | } |
1200 | 1199 | ||
1201 | writew(vptr->rd_filled & 0xfffc, ®s->RBRDU); | 1200 | writew(vptr->rd_filled & 0xfffc, ®s->RBRDU); |
@@ -1210,7 +1209,7 @@ static int velocity_rx_refill(struct velocity_info *vptr) | |||
1210 | struct rx_desc *rd = vptr->rd_ring + dirty; | 1209 | struct rx_desc *rd = vptr->rd_ring + dirty; |
1211 | 1210 | ||
1212 | /* Fine for an all zero Rx desc at init time as well */ | 1211 | /* Fine for an all zero Rx desc at init time as well */ |
1213 | if (rd->rdesc0.owner == OWNED_BY_NIC) | 1212 | if (rd->rdesc0.len & OWNED_BY_NIC) |
1214 | break; | 1213 | break; |
1215 | 1214 | ||
1216 | if (!vptr->rd_info[dirty].skb) { | 1215 | if (!vptr->rd_info[dirty].skb) { |
@@ -1413,7 +1412,7 @@ static int velocity_rx_srv(struct velocity_info *vptr, int status) | |||
1413 | if (!vptr->rd_info[rd_curr].skb) | 1412 | if (!vptr->rd_info[rd_curr].skb) |
1414 | break; | 1413 | break; |
1415 | 1414 | ||
1416 | if (rd->rdesc0.owner == OWNED_BY_NIC) | 1415 | if (rd->rdesc0.len & OWNED_BY_NIC) |
1417 | break; | 1416 | break; |
1418 | 1417 | ||
1419 | rmb(); | 1418 | rmb(); |
@@ -1421,7 +1420,7 @@ static int velocity_rx_srv(struct velocity_info *vptr, int status) | |||
1421 | /* | 1420 | /* |
1422 | * Don't drop CE or RL error frame although RXOK is off | 1421 | * Don't drop CE or RL error frame although RXOK is off |
1423 | */ | 1422 | */ |
1424 | if ((rd->rdesc0.RSR & RSR_RXOK) || (!(rd->rdesc0.RSR & RSR_RXOK) && (rd->rdesc0.RSR & (RSR_CE | RSR_RL)))) { | 1423 | if (rd->rdesc0.RSR & (RSR_RXOK | RSR_CE | RSR_RL)) { |
1425 | if (velocity_receive_frame(vptr, rd_curr) < 0) | 1424 | if (velocity_receive_frame(vptr, rd_curr) < 0) |
1426 | stats->rx_dropped++; | 1425 | stats->rx_dropped++; |
1427 | } else { | 1426 | } else { |
@@ -1433,7 +1432,7 @@ static int velocity_rx_srv(struct velocity_info *vptr, int status) | |||
1433 | stats->rx_dropped++; | 1432 | stats->rx_dropped++; |
1434 | } | 1433 | } |
1435 | 1434 | ||
1436 | rd->inten = 1; | 1435 | rd->size |= RX_INTEN; |
1437 | 1436 | ||
1438 | vptr->dev->last_rx = jiffies; | 1437 | vptr->dev->last_rx = jiffies; |
1439 | 1438 | ||
@@ -1554,7 +1553,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx) | |||
1554 | struct net_device_stats *stats = &vptr->stats; | 1553 | struct net_device_stats *stats = &vptr->stats; |
1555 | struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]); | 1554 | struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]); |
1556 | struct rx_desc *rd = &(vptr->rd_ring[idx]); | 1555 | struct rx_desc *rd = &(vptr->rd_ring[idx]); |
1557 | int pkt_len = rd->rdesc0.len; | 1556 | int pkt_len = le16_to_cpu(rd->rdesc0.len) & 0x3fff; |
1558 | struct sk_buff *skb; | 1557 | struct sk_buff *skb; |
1559 | 1558 | ||
1560 | if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) { | 1559 | if (rd->rdesc0.RSR & (RSR_STP | RSR_EDP)) { |
@@ -1637,8 +1636,7 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx) | |||
1637 | */ | 1636 | */ |
1638 | 1637 | ||
1639 | *((u32 *) & (rd->rdesc0)) = 0; | 1638 | *((u32 *) & (rd->rdesc0)) = 0; |
1640 | rd->len = cpu_to_le32(vptr->rx_buf_sz); | 1639 | rd->size = cpu_to_le16(vptr->rx_buf_sz) | RX_INTEN; |
1641 | rd->inten = 1; | ||
1642 | rd->pa_low = cpu_to_le32(rd_info->skb_dma); | 1640 | rd->pa_low = cpu_to_le32(rd_info->skb_dma); |
1643 | rd->pa_high = 0; | 1641 | rd->pa_high = 0; |
1644 | return 0; | 1642 | return 0; |
@@ -1674,7 +1672,7 @@ static int velocity_tx_srv(struct velocity_info *vptr, u32 status) | |||
1674 | td = &(vptr->td_rings[qnum][idx]); | 1672 | td = &(vptr->td_rings[qnum][idx]); |
1675 | tdinfo = &(vptr->td_infos[qnum][idx]); | 1673 | tdinfo = &(vptr->td_infos[qnum][idx]); |
1676 | 1674 | ||
1677 | if (td->tdesc0.owner == OWNED_BY_NIC) | 1675 | if (td->tdesc0.len & OWNED_BY_NIC) |
1678 | break; | 1676 | break; |
1679 | 1677 | ||
1680 | if ((works++ > 15)) | 1678 | if ((works++ > 15)) |
@@ -1874,7 +1872,7 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_ | |||
1874 | 1872 | ||
1875 | for (i = 0; i < tdinfo->nskb_dma; i++) { | 1873 | for (i = 0; i < tdinfo->nskb_dma; i++) { |
1876 | #ifdef VELOCITY_ZERO_COPY_SUPPORT | 1874 | #ifdef VELOCITY_ZERO_COPY_SUPPORT |
1877 | pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], td->tdesc1.len, PCI_DMA_TODEVICE); | 1875 | pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], le16_to_cpu(td->tdesc1.len), PCI_DMA_TODEVICE); |
1878 | #else | 1876 | #else |
1879 | pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], skb->len, PCI_DMA_TODEVICE); | 1877 | pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], skb->len, PCI_DMA_TODEVICE); |
1880 | #endif | 1878 | #endif |
@@ -2067,8 +2065,8 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2067 | struct velocity_td_info *tdinfo; | 2065 | struct velocity_td_info *tdinfo; |
2068 | unsigned long flags; | 2066 | unsigned long flags; |
2069 | int index; | 2067 | int index; |
2070 | |||
2071 | int pktlen = skb->len; | 2068 | int pktlen = skb->len; |
2069 | __le16 len = cpu_to_le16(pktlen); | ||
2072 | 2070 | ||
2073 | #ifdef VELOCITY_ZERO_COPY_SUPPORT | 2071 | #ifdef VELOCITY_ZERO_COPY_SUPPORT |
2074 | if (skb_shinfo(skb)->nr_frags > 6 && __skb_linearize(skb)) { | 2072 | if (skb_shinfo(skb)->nr_frags > 6 && __skb_linearize(skb)) { |
@@ -2083,9 +2081,8 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2083 | td_ptr = &(vptr->td_rings[qnum][index]); | 2081 | td_ptr = &(vptr->td_rings[qnum][index]); |
2084 | tdinfo = &(vptr->td_infos[qnum][index]); | 2082 | tdinfo = &(vptr->td_infos[qnum][index]); |
2085 | 2083 | ||
2086 | td_ptr->tdesc1.TCPLS = TCPLS_NORMAL; | ||
2087 | td_ptr->tdesc1.TCR = TCR0_TIC; | 2084 | td_ptr->tdesc1.TCR = TCR0_TIC; |
2088 | td_ptr->td_buf[0].queue = 0; | 2085 | td_ptr->td_buf[0].size &= ~TD_QUEUE; |
2089 | 2086 | ||
2090 | /* | 2087 | /* |
2091 | * Pad short frames. | 2088 | * Pad short frames. |
@@ -2093,16 +2090,16 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2093 | if (pktlen < ETH_ZLEN) { | 2090 | if (pktlen < ETH_ZLEN) { |
2094 | /* Cannot occur until ZC support */ | 2091 | /* Cannot occur until ZC support */ |
2095 | pktlen = ETH_ZLEN; | 2092 | pktlen = ETH_ZLEN; |
2093 | len = cpu_to_le16(ETH_ZLEN); | ||
2096 | skb_copy_from_linear_data(skb, tdinfo->buf, skb->len); | 2094 | skb_copy_from_linear_data(skb, tdinfo->buf, skb->len); |
2097 | memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len); | 2095 | memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len); |
2098 | tdinfo->skb = skb; | 2096 | tdinfo->skb = skb; |
2099 | tdinfo->skb_dma[0] = tdinfo->buf_dma; | 2097 | tdinfo->skb_dma[0] = tdinfo->buf_dma; |
2100 | td_ptr->tdesc0.pktsize = pktlen; | 2098 | td_ptr->tdesc0.len = len; |
2101 | td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); | 2099 | td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); |
2102 | td_ptr->td_buf[0].pa_high = 0; | 2100 | td_ptr->td_buf[0].pa_high = 0; |
2103 | td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; | 2101 | td_ptr->td_buf[0].size = len; /* queue is 0 anyway */ |
2104 | tdinfo->nskb_dma = 1; | 2102 | tdinfo->nskb_dma = 1; |
2105 | td_ptr->tdesc1.CMDZ = 2; | ||
2106 | } else | 2103 | } else |
2107 | #ifdef VELOCITY_ZERO_COPY_SUPPORT | 2104 | #ifdef VELOCITY_ZERO_COPY_SUPPORT |
2108 | if (skb_shinfo(skb)->nr_frags > 0) { | 2105 | if (skb_shinfo(skb)->nr_frags > 0) { |
@@ -2111,36 +2108,35 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2111 | if (nfrags > 6) { | 2108 | if (nfrags > 6) { |
2112 | skb_copy_from_linear_data(skb, tdinfo->buf, skb->len); | 2109 | skb_copy_from_linear_data(skb, tdinfo->buf, skb->len); |
2113 | tdinfo->skb_dma[0] = tdinfo->buf_dma; | 2110 | tdinfo->skb_dma[0] = tdinfo->buf_dma; |
2114 | td_ptr->tdesc0.pktsize = | 2111 | td_ptr->tdesc0.len = len; |
2115 | td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); | 2112 | td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); |
2116 | td_ptr->td_buf[0].pa_high = 0; | 2113 | td_ptr->td_buf[0].pa_high = 0; |
2117 | td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; | 2114 | td_ptr->td_buf[0].size = len; /* queue is 0 anyway */ |
2118 | tdinfo->nskb_dma = 1; | 2115 | tdinfo->nskb_dma = 1; |
2119 | td_ptr->tdesc1.CMDZ = 2; | ||
2120 | } else { | 2116 | } else { |
2121 | int i = 0; | 2117 | int i = 0; |
2122 | tdinfo->nskb_dma = 0; | 2118 | tdinfo->nskb_dma = 0; |
2123 | tdinfo->skb_dma[i] = pci_map_single(vptr->pdev, skb->data, skb->len - skb->data_len, PCI_DMA_TODEVICE); | 2119 | tdinfo->skb_dma[i] = pci_map_single(vptr->pdev, skb->data, |
2120 | skb_headlen(skb), PCI_DMA_TODEVICE); | ||
2124 | 2121 | ||
2125 | td_ptr->tdesc0.pktsize = pktlen; | 2122 | td_ptr->tdesc0.len = len; |
2126 | 2123 | ||
2127 | /* FIXME: support 48bit DMA later */ | 2124 | /* FIXME: support 48bit DMA later */ |
2128 | td_ptr->td_buf[i].pa_low = cpu_to_le32(tdinfo->skb_dma); | 2125 | td_ptr->td_buf[i].pa_low = cpu_to_le32(tdinfo->skb_dma); |
2129 | td_ptr->td_buf[i].pa_high = 0; | 2126 | td_ptr->td_buf[i].pa_high = 0; |
2130 | td_ptr->td_buf[i].bufsize = skb->len->skb->data_len; | 2127 | td_ptr->td_buf[i].size = cpu_to_le16(skb_headlen(skb)); |
2131 | 2128 | ||
2132 | for (i = 0; i < nfrags; i++) { | 2129 | for (i = 0; i < nfrags; i++) { |
2133 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 2130 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
2134 | void *addr = ((void *) page_address(frag->page + frag->page_offset)); | 2131 | void *addr = (void *)page_address(frag->page) + frag->page_offset; |
2135 | 2132 | ||
2136 | tdinfo->skb_dma[i + 1] = pci_map_single(vptr->pdev, addr, frag->size, PCI_DMA_TODEVICE); | 2133 | tdinfo->skb_dma[i + 1] = pci_map_single(vptr->pdev, addr, frag->size, PCI_DMA_TODEVICE); |
2137 | 2134 | ||
2138 | td_ptr->td_buf[i + 1].pa_low = cpu_to_le32(tdinfo->skb_dma[i + 1]); | 2135 | td_ptr->td_buf[i + 1].pa_low = cpu_to_le32(tdinfo->skb_dma[i + 1]); |
2139 | td_ptr->td_buf[i + 1].pa_high = 0; | 2136 | td_ptr->td_buf[i + 1].pa_high = 0; |
2140 | td_ptr->td_buf[i + 1].bufsize = frag->size; | 2137 | td_ptr->td_buf[i + 1].size = cpu_to_le16(frag->size); |
2141 | } | 2138 | } |
2142 | tdinfo->nskb_dma = i - 1; | 2139 | tdinfo->nskb_dma = i - 1; |
2143 | td_ptr->tdesc1.CMDZ = i; | ||
2144 | } | 2140 | } |
2145 | 2141 | ||
2146 | } else | 2142 | } else |
@@ -2152,18 +2148,16 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2152 | */ | 2148 | */ |
2153 | tdinfo->skb = skb; | 2149 | tdinfo->skb = skb; |
2154 | tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE); | 2150 | tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE); |
2155 | td_ptr->tdesc0.pktsize = pktlen; | 2151 | td_ptr->tdesc0.len = len; |
2156 | td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); | 2152 | td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]); |
2157 | td_ptr->td_buf[0].pa_high = 0; | 2153 | td_ptr->td_buf[0].pa_high = 0; |
2158 | td_ptr->td_buf[0].bufsize = td_ptr->tdesc0.pktsize; | 2154 | td_ptr->td_buf[0].size = len; |
2159 | tdinfo->nskb_dma = 1; | 2155 | tdinfo->nskb_dma = 1; |
2160 | td_ptr->tdesc1.CMDZ = 2; | ||
2161 | } | 2156 | } |
2157 | td_ptr->tdesc1.cmd = TCPLS_NORMAL + (tdinfo->nskb_dma + 1) * 16; | ||
2162 | 2158 | ||
2163 | if (vptr->vlgrp && vlan_tx_tag_present(skb)) { | 2159 | if (vptr->vlgrp && vlan_tx_tag_present(skb)) { |
2164 | td_ptr->tdesc1.pqinf.VID = vlan_tx_tag_get(skb); | 2160 | td_ptr->tdesc1.vlan = cpu_to_le16(vlan_tx_tag_get(skb)); |
2165 | td_ptr->tdesc1.pqinf.priority = 0; | ||
2166 | td_ptr->tdesc1.pqinf.CFI = 0; | ||
2167 | td_ptr->tdesc1.TCR |= TCR0_VETAG; | 2161 | td_ptr->tdesc1.TCR |= TCR0_VETAG; |
2168 | } | 2162 | } |
2169 | 2163 | ||
@@ -2185,7 +2179,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2185 | 2179 | ||
2186 | if (prev < 0) | 2180 | if (prev < 0) |
2187 | prev = vptr->options.numtx - 1; | 2181 | prev = vptr->options.numtx - 1; |
2188 | td_ptr->tdesc0.owner = OWNED_BY_NIC; | 2182 | td_ptr->tdesc0.len |= OWNED_BY_NIC; |
2189 | vptr->td_used[qnum]++; | 2183 | vptr->td_used[qnum]++; |
2190 | vptr->td_curr[qnum] = (index + 1) % vptr->options.numtx; | 2184 | vptr->td_curr[qnum] = (index + 1) % vptr->options.numtx; |
2191 | 2185 | ||
@@ -2193,7 +2187,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2193 | netif_stop_queue(dev); | 2187 | netif_stop_queue(dev); |
2194 | 2188 | ||
2195 | td_ptr = &(vptr->td_rings[qnum][prev]); | 2189 | td_ptr = &(vptr->td_rings[qnum][prev]); |
2196 | td_ptr->td_buf[0].queue = 1; | 2190 | td_ptr->td_buf[0].size |= TD_QUEUE; |
2197 | mac_tx_queue_wake(vptr->mac_regs, qnum); | 2191 | mac_tx_queue_wake(vptr->mac_regs, qnum); |
2198 | } | 2192 | } |
2199 | dev->trans_start = jiffies; | 2193 | dev->trans_start = jiffies; |
@@ -3410,7 +3404,7 @@ static int velocity_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3410 | velocity_save_context(vptr, &vptr->context); | 3404 | velocity_save_context(vptr, &vptr->context); |
3411 | velocity_shutdown(vptr); | 3405 | velocity_shutdown(vptr); |
3412 | velocity_set_wol(vptr); | 3406 | velocity_set_wol(vptr); |
3413 | pci_enable_wake(pdev, 3, 1); | 3407 | pci_enable_wake(pdev, PCI_D3hot, 1); |
3414 | pci_set_power_state(pdev, PCI_D3hot); | 3408 | pci_set_power_state(pdev, PCI_D3hot); |
3415 | } else { | 3409 | } else { |
3416 | velocity_save_context(vptr, &vptr->context); | 3410 | velocity_save_context(vptr, &vptr->context); |
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h index aa9179623d90..7387be4f428d 100644 --- a/drivers/net/via-velocity.h +++ b/drivers/net/via-velocity.h | |||
@@ -70,40 +70,27 @@ | |||
70 | * Bits in the RSR0 register | 70 | * Bits in the RSR0 register |
71 | */ | 71 | */ |
72 | 72 | ||
73 | #define RSR_DETAG 0x0080 | 73 | #define RSR_DETAG cpu_to_le16(0x0080) |
74 | #define RSR_SNTAG 0x0040 | 74 | #define RSR_SNTAG cpu_to_le16(0x0040) |
75 | #define RSR_RXER 0x0020 | 75 | #define RSR_RXER cpu_to_le16(0x0020) |
76 | #define RSR_RL 0x0010 | 76 | #define RSR_RL cpu_to_le16(0x0010) |
77 | #define RSR_CE 0x0008 | 77 | #define RSR_CE cpu_to_le16(0x0008) |
78 | #define RSR_FAE 0x0004 | 78 | #define RSR_FAE cpu_to_le16(0x0004) |
79 | #define RSR_CRC 0x0002 | 79 | #define RSR_CRC cpu_to_le16(0x0002) |
80 | #define RSR_VIDM 0x0001 | 80 | #define RSR_VIDM cpu_to_le16(0x0001) |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Bits in the RSR1 register | 83 | * Bits in the RSR1 register |
84 | */ | 84 | */ |
85 | 85 | ||
86 | #define RSR_RXOK 0x8000 // rx OK | 86 | #define RSR_RXOK cpu_to_le16(0x8000) // rx OK |
87 | #define RSR_PFT 0x4000 // Perfect filtering address match | 87 | #define RSR_PFT cpu_to_le16(0x4000) // Perfect filtering address match |
88 | #define RSR_MAR 0x2000 // MAC accept multicast address packet | 88 | #define RSR_MAR cpu_to_le16(0x2000) // MAC accept multicast address packet |
89 | #define RSR_BAR 0x1000 // MAC accept broadcast address packet | 89 | #define RSR_BAR cpu_to_le16(0x1000) // MAC accept broadcast address packet |
90 | #define RSR_PHY 0x0800 // MAC accept physical address packet | 90 | #define RSR_PHY cpu_to_le16(0x0800) // MAC accept physical address packet |
91 | #define RSR_VTAG 0x0400 // 802.1p/1q tagging packet indicator | 91 | #define RSR_VTAG cpu_to_le16(0x0400) // 802.1p/1q tagging packet indicator |
92 | #define RSR_STP 0x0200 // start of packet | 92 | #define RSR_STP cpu_to_le16(0x0200) // start of packet |
93 | #define RSR_EDP 0x0100 // end of packet | 93 | #define RSR_EDP cpu_to_le16(0x0100) // end of packet |
94 | |||
95 | /* | ||
96 | * Bits in the RSR1 register | ||
97 | */ | ||
98 | |||
99 | #define RSR1_RXOK 0x80 // rx OK | ||
100 | #define RSR1_PFT 0x40 // Perfect filtering address match | ||
101 | #define RSR1_MAR 0x20 // MAC accept multicast address packet | ||
102 | #define RSR1_BAR 0x10 // MAC accept broadcast address packet | ||
103 | #define RSR1_PHY 0x08 // MAC accept physical address packet | ||
104 | #define RSR1_VTAG 0x04 // 802.1p/1q tagging packet indicator | ||
105 | #define RSR1_STP 0x02 // start of packet | ||
106 | #define RSR1_EDP 0x01 // end of packet | ||
107 | 94 | ||
108 | /* | 95 | /* |
109 | * Bits in the CSM register | 96 | * Bits in the CSM register |
@@ -120,33 +107,21 @@ | |||
120 | * Bits in the TSR0 register | 107 | * Bits in the TSR0 register |
121 | */ | 108 | */ |
122 | 109 | ||
123 | #define TSR0_ABT 0x0080 // Tx abort because of excessive collision | 110 | #define TSR0_ABT cpu_to_le16(0x0080) // Tx abort because of excessive collision |
124 | #define TSR0_OWT 0x0040 // Jumbo frame Tx abort | 111 | #define TSR0_OWT cpu_to_le16(0x0040) // Jumbo frame Tx abort |
125 | #define TSR0_OWC 0x0020 // Out of window collision | 112 | #define TSR0_OWC cpu_to_le16(0x0020) // Out of window collision |
126 | #define TSR0_COLS 0x0010 // experience collision in this transmit event | 113 | #define TSR0_COLS cpu_to_le16(0x0010) // experience collision in this transmit event |
127 | #define TSR0_NCR3 0x0008 // collision retry counter[3] | 114 | #define TSR0_NCR3 cpu_to_le16(0x0008) // collision retry counter[3] |
128 | #define TSR0_NCR2 0x0004 // collision retry counter[2] | 115 | #define TSR0_NCR2 cpu_to_le16(0x0004) // collision retry counter[2] |
129 | #define TSR0_NCR1 0x0002 // collision retry counter[1] | 116 | #define TSR0_NCR1 cpu_to_le16(0x0002) // collision retry counter[1] |
130 | #define TSR0_NCR0 0x0001 // collision retry counter[0] | 117 | #define TSR0_NCR0 cpu_to_le16(0x0001) // collision retry counter[0] |
131 | #define TSR0_TERR 0x8000 // | 118 | #define TSR0_TERR cpu_to_le16(0x8000) // |
132 | #define TSR0_FDX 0x4000 // current transaction is serviced by full duplex mode | 119 | #define TSR0_FDX cpu_to_le16(0x4000) // current transaction is serviced by full duplex mode |
133 | #define TSR0_GMII 0x2000 // current transaction is serviced by GMII mode | 120 | #define TSR0_GMII cpu_to_le16(0x2000) // current transaction is serviced by GMII mode |
134 | #define TSR0_LNKFL 0x1000 // packet serviced during link down | 121 | #define TSR0_LNKFL cpu_to_le16(0x1000) // packet serviced during link down |
135 | #define TSR0_SHDN 0x0400 // shutdown case | 122 | #define TSR0_SHDN cpu_to_le16(0x0400) // shutdown case |
136 | #define TSR0_CRS 0x0200 // carrier sense lost | 123 | #define TSR0_CRS cpu_to_le16(0x0200) // carrier sense lost |
137 | #define TSR0_CDH 0x0100 // AQE test fail (CD heartbeat) | 124 | #define TSR0_CDH cpu_to_le16(0x0100) // AQE test fail (CD heartbeat) |
138 | |||
139 | /* | ||
140 | * Bits in the TSR1 register | ||
141 | */ | ||
142 | |||
143 | #define TSR1_TERR 0x80 // | ||
144 | #define TSR1_FDX 0x40 // current transaction is serviced by full duplex mode | ||
145 | #define TSR1_GMII 0x20 // current transaction is serviced by GMII mode | ||
146 | #define TSR1_LNKFL 0x10 // packet serviced during link down | ||
147 | #define TSR1_SHDN 0x04 // shutdown case | ||
148 | #define TSR1_CRS 0x02 // carrier sense lost | ||
149 | #define TSR1_CDH 0x01 // AQE test fail (CD heartbeat) | ||
150 | 125 | ||
151 | // | 126 | // |
152 | // Bits in the TCR0 register | 127 | // Bits in the TCR0 register |
@@ -197,25 +172,26 @@ | |||
197 | */ | 172 | */ |
198 | 173 | ||
199 | struct rdesc0 { | 174 | struct rdesc0 { |
200 | u16 RSR; /* Receive status */ | 175 | __le16 RSR; /* Receive status */ |
201 | u16 len:14; /* Received packet length */ | 176 | __le16 len; /* bits 0--13; bit 15 - owner */ |
202 | u16 reserved:1; | ||
203 | u16 owner:1; /* Who owns this buffer ? */ | ||
204 | }; | 177 | }; |
205 | 178 | ||
206 | struct rdesc1 { | 179 | struct rdesc1 { |
207 | u16 PQTAG; | 180 | __le16 PQTAG; |
208 | u8 CSM; | 181 | u8 CSM; |
209 | u8 IPKT; | 182 | u8 IPKT; |
210 | }; | 183 | }; |
211 | 184 | ||
185 | enum { | ||
186 | RX_INTEN = __constant_cpu_to_le16(0x8000) | ||
187 | }; | ||
188 | |||
212 | struct rx_desc { | 189 | struct rx_desc { |
213 | struct rdesc0 rdesc0; | 190 | struct rdesc0 rdesc0; |
214 | struct rdesc1 rdesc1; | 191 | struct rdesc1 rdesc1; |
215 | u32 pa_low; /* Low 32 bit PCI address */ | 192 | __le32 pa_low; /* Low 32 bit PCI address */ |
216 | u16 pa_high; /* Next 16 bit PCI address (48 total) */ | 193 | __le16 pa_high; /* Next 16 bit PCI address (48 total) */ |
217 | u16 len:15; /* Frame size */ | 194 | __le16 size; /* bits 0--14 - frame size, bit 15 - enable int. */ |
218 | u16 inten:1; /* Enable interrupt */ | ||
219 | } __attribute__ ((__packed__)); | 195 | } __attribute__ ((__packed__)); |
220 | 196 | ||
221 | /* | 197 | /* |
@@ -223,32 +199,24 @@ struct rx_desc { | |||
223 | */ | 199 | */ |
224 | 200 | ||
225 | struct tdesc0 { | 201 | struct tdesc0 { |
226 | u16 TSR; /* Transmit status register */ | 202 | __le16 TSR; /* Transmit status register */ |
227 | u16 pktsize:14; /* Size of frame */ | 203 | __le16 len; /* bits 0--13 - size of frame, bit 15 - owner */ |
228 | u16 reserved:1; | ||
229 | u16 owner:1; /* Who owns the buffer */ | ||
230 | }; | 204 | }; |
231 | 205 | ||
232 | struct pqinf { /* Priority queue info */ | ||
233 | u16 VID:12; | ||
234 | u16 CFI:1; | ||
235 | u16 priority:3; | ||
236 | } __attribute__ ((__packed__)); | ||
237 | |||
238 | struct tdesc1 { | 206 | struct tdesc1 { |
239 | struct pqinf pqinf; | 207 | __le16 vlan; |
240 | u8 TCR; | 208 | u8 TCR; |
241 | u8 TCPLS:2; | 209 | u8 cmd; /* bits 0--1 - TCPLS, bits 4--7 - CMDZ */ |
242 | u8 reserved:2; | ||
243 | u8 CMDZ:4; | ||
244 | } __attribute__ ((__packed__)); | 210 | } __attribute__ ((__packed__)); |
245 | 211 | ||
212 | enum { | ||
213 | TD_QUEUE = __constant_cpu_to_le16(0x8000) | ||
214 | }; | ||
215 | |||
246 | struct td_buf { | 216 | struct td_buf { |
247 | u32 pa_low; | 217 | __le32 pa_low; |
248 | u16 pa_high; | 218 | __le16 pa_high; |
249 | u16 bufsize:14; | 219 | __le16 size; /* bits 0--13 - size, bit 15 - queue */ |
250 | u16 reserved:1; | ||
251 | u16 queue:1; | ||
252 | } __attribute__ ((__packed__)); | 220 | } __attribute__ ((__packed__)); |
253 | 221 | ||
254 | struct tx_desc { | 222 | struct tx_desc { |
@@ -276,7 +244,7 @@ struct velocity_td_info { | |||
276 | 244 | ||
277 | enum velocity_owner { | 245 | enum velocity_owner { |
278 | OWNED_BY_HOST = 0, | 246 | OWNED_BY_HOST = 0, |
279 | OWNED_BY_NIC = 1 | 247 | OWNED_BY_NIC = __constant_cpu_to_le16(0x8000) |
280 | }; | 248 | }; |
281 | 249 | ||
282 | 250 | ||
@@ -1012,45 +980,45 @@ struct mac_regs { | |||
1012 | volatile u8 RCR; | 980 | volatile u8 RCR; |
1013 | volatile u8 TCR; | 981 | volatile u8 TCR; |
1014 | 982 | ||
1015 | volatile u32 CR0Set; /* 0x08 */ | 983 | volatile __le32 CR0Set; /* 0x08 */ |
1016 | volatile u32 CR0Clr; /* 0x0C */ | 984 | volatile __le32 CR0Clr; /* 0x0C */ |
1017 | 985 | ||
1018 | volatile u8 MARCAM[8]; /* 0x10 */ | 986 | volatile u8 MARCAM[8]; /* 0x10 */ |
1019 | 987 | ||
1020 | volatile u32 DecBaseHi; /* 0x18 */ | 988 | volatile __le32 DecBaseHi; /* 0x18 */ |
1021 | volatile u16 DbfBaseHi; /* 0x1C */ | 989 | volatile __le16 DbfBaseHi; /* 0x1C */ |
1022 | volatile u16 reserved_1E; | 990 | volatile __le16 reserved_1E; |
1023 | 991 | ||
1024 | volatile u16 ISRCTL; /* 0x20 */ | 992 | volatile __le16 ISRCTL; /* 0x20 */ |
1025 | volatile u8 TXESR; | 993 | volatile u8 TXESR; |
1026 | volatile u8 RXESR; | 994 | volatile u8 RXESR; |
1027 | 995 | ||
1028 | volatile u32 ISR; /* 0x24 */ | 996 | volatile __le32 ISR; /* 0x24 */ |
1029 | volatile u32 IMR; | 997 | volatile __le32 IMR; |
1030 | 998 | ||
1031 | volatile u32 TDStatusPort; /* 0x2C */ | 999 | volatile __le32 TDStatusPort; /* 0x2C */ |
1032 | 1000 | ||
1033 | volatile u16 TDCSRSet; /* 0x30 */ | 1001 | volatile __le16 TDCSRSet; /* 0x30 */ |
1034 | volatile u8 RDCSRSet; | 1002 | volatile u8 RDCSRSet; |
1035 | volatile u8 reserved_33; | 1003 | volatile u8 reserved_33; |
1036 | volatile u16 TDCSRClr; | 1004 | volatile __le16 TDCSRClr; |
1037 | volatile u8 RDCSRClr; | 1005 | volatile u8 RDCSRClr; |
1038 | volatile u8 reserved_37; | 1006 | volatile u8 reserved_37; |
1039 | 1007 | ||
1040 | volatile u32 RDBaseLo; /* 0x38 */ | 1008 | volatile __le32 RDBaseLo; /* 0x38 */ |
1041 | volatile u16 RDIdx; /* 0x3C */ | 1009 | volatile __le16 RDIdx; /* 0x3C */ |
1042 | volatile u16 reserved_3E; | 1010 | volatile __le16 reserved_3E; |
1043 | 1011 | ||
1044 | volatile u32 TDBaseLo[4]; /* 0x40 */ | 1012 | volatile __le32 TDBaseLo[4]; /* 0x40 */ |
1045 | 1013 | ||
1046 | volatile u16 RDCSize; /* 0x50 */ | 1014 | volatile __le16 RDCSize; /* 0x50 */ |
1047 | volatile u16 TDCSize; /* 0x52 */ | 1015 | volatile __le16 TDCSize; /* 0x52 */ |
1048 | volatile u16 TDIdx[4]; /* 0x54 */ | 1016 | volatile __le16 TDIdx[4]; /* 0x54 */ |
1049 | volatile u16 tx_pause_timer; /* 0x5C */ | 1017 | volatile __le16 tx_pause_timer; /* 0x5C */ |
1050 | volatile u16 RBRDU; /* 0x5E */ | 1018 | volatile __le16 RBRDU; /* 0x5E */ |
1051 | 1019 | ||
1052 | volatile u32 FIFOTest0; /* 0x60 */ | 1020 | volatile __le32 FIFOTest0; /* 0x60 */ |
1053 | volatile u32 FIFOTest1; /* 0x64 */ | 1021 | volatile __le32 FIFOTest1; /* 0x64 */ |
1054 | 1022 | ||
1055 | volatile u8 CAMADDR; /* 0x68 */ | 1023 | volatile u8 CAMADDR; /* 0x68 */ |
1056 | volatile u8 CAMCR; /* 0x69 */ | 1024 | volatile u8 CAMCR; /* 0x69 */ |
@@ -1063,18 +1031,18 @@ struct mac_regs { | |||
1063 | volatile u8 PHYSR1; | 1031 | volatile u8 PHYSR1; |
1064 | volatile u8 MIICR; | 1032 | volatile u8 MIICR; |
1065 | volatile u8 MIIADR; | 1033 | volatile u8 MIIADR; |
1066 | volatile u16 MIIDATA; | 1034 | volatile __le16 MIIDATA; |
1067 | 1035 | ||
1068 | volatile u16 SoftTimer0; /* 0x74 */ | 1036 | volatile __le16 SoftTimer0; /* 0x74 */ |
1069 | volatile u16 SoftTimer1; | 1037 | volatile __le16 SoftTimer1; |
1070 | 1038 | ||
1071 | volatile u8 CFGA; /* 0x78 */ | 1039 | volatile u8 CFGA; /* 0x78 */ |
1072 | volatile u8 CFGB; | 1040 | volatile u8 CFGB; |
1073 | volatile u8 CFGC; | 1041 | volatile u8 CFGC; |
1074 | volatile u8 CFGD; | 1042 | volatile u8 CFGD; |
1075 | 1043 | ||
1076 | volatile u16 DCFG; /* 0x7C */ | 1044 | volatile __le16 DCFG; /* 0x7C */ |
1077 | volatile u16 MCFG; | 1045 | volatile __le16 MCFG; |
1078 | 1046 | ||
1079 | volatile u8 TBIST; /* 0x80 */ | 1047 | volatile u8 TBIST; /* 0x80 */ |
1080 | volatile u8 RBIST; | 1048 | volatile u8 RBIST; |
@@ -1086,9 +1054,9 @@ struct mac_regs { | |||
1086 | volatile u8 rev_id; | 1054 | volatile u8 rev_id; |
1087 | volatile u8 PORSTS; | 1055 | volatile u8 PORSTS; |
1088 | 1056 | ||
1089 | volatile u32 MIBData; /* 0x88 */ | 1057 | volatile __le32 MIBData; /* 0x88 */ |
1090 | 1058 | ||
1091 | volatile u16 EEWrData; | 1059 | volatile __le16 EEWrData; |
1092 | 1060 | ||
1093 | volatile u8 reserved_8E; | 1061 | volatile u8 reserved_8E; |
1094 | volatile u8 BPMDWr; | 1062 | volatile u8 BPMDWr; |
@@ -1098,7 +1066,7 @@ struct mac_regs { | |||
1098 | volatile u8 EECHKSUM; /* 0x92 */ | 1066 | volatile u8 EECHKSUM; /* 0x92 */ |
1099 | volatile u8 EECSR; | 1067 | volatile u8 EECSR; |
1100 | 1068 | ||
1101 | volatile u16 EERdData; /* 0x94 */ | 1069 | volatile __le16 EERdData; /* 0x94 */ |
1102 | volatile u8 EADDR; | 1070 | volatile u8 EADDR; |
1103 | volatile u8 EMBCMD; | 1071 | volatile u8 EMBCMD; |
1104 | 1072 | ||
@@ -1112,22 +1080,22 @@ struct mac_regs { | |||
1112 | volatile u8 DEBUG; | 1080 | volatile u8 DEBUG; |
1113 | volatile u8 CHIPGCR; | 1081 | volatile u8 CHIPGCR; |
1114 | 1082 | ||
1115 | volatile u16 WOLCRSet; /* 0xA0 */ | 1083 | volatile __le16 WOLCRSet; /* 0xA0 */ |
1116 | volatile u8 PWCFGSet; | 1084 | volatile u8 PWCFGSet; |
1117 | volatile u8 WOLCFGSet; | 1085 | volatile u8 WOLCFGSet; |
1118 | 1086 | ||
1119 | volatile u16 WOLCRClr; /* 0xA4 */ | 1087 | volatile __le16 WOLCRClr; /* 0xA4 */ |
1120 | volatile u8 PWCFGCLR; | 1088 | volatile u8 PWCFGCLR; |
1121 | volatile u8 WOLCFGClr; | 1089 | volatile u8 WOLCFGClr; |
1122 | 1090 | ||
1123 | volatile u16 WOLSRSet; /* 0xA8 */ | 1091 | volatile __le16 WOLSRSet; /* 0xA8 */ |
1124 | volatile u16 reserved_AA; | 1092 | volatile __le16 reserved_AA; |
1125 | 1093 | ||
1126 | volatile u16 WOLSRClr; /* 0xAC */ | 1094 | volatile __le16 WOLSRClr; /* 0xAC */ |
1127 | volatile u16 reserved_AE; | 1095 | volatile __le16 reserved_AE; |
1128 | 1096 | ||
1129 | volatile u16 PatternCRC[8]; /* 0xB0 */ | 1097 | volatile __le16 PatternCRC[8]; /* 0xB0 */ |
1130 | volatile u32 ByteMask[4][4]; /* 0xC0 */ | 1098 | volatile __le32 ByteMask[4][4]; /* 0xC0 */ |
1131 | } __attribute__ ((__packed__)); | 1099 | } __attribute__ ((__packed__)); |
1132 | 1100 | ||
1133 | 1101 | ||
@@ -1238,12 +1206,12 @@ typedef u8 MCAM_ADDR[ETH_ALEN]; | |||
1238 | struct arp_packet { | 1206 | struct arp_packet { |
1239 | u8 dest_mac[ETH_ALEN]; | 1207 | u8 dest_mac[ETH_ALEN]; |
1240 | u8 src_mac[ETH_ALEN]; | 1208 | u8 src_mac[ETH_ALEN]; |
1241 | u16 type; | 1209 | __be16 type; |
1242 | u16 ar_hrd; | 1210 | __be16 ar_hrd; |
1243 | u16 ar_pro; | 1211 | __be16 ar_pro; |
1244 | u8 ar_hln; | 1212 | u8 ar_hln; |
1245 | u8 ar_pln; | 1213 | u8 ar_pln; |
1246 | u16 ar_op; | 1214 | __be16 ar_op; |
1247 | u8 ar_sha[ETH_ALEN]; | 1215 | u8 ar_sha[ETH_ALEN]; |
1248 | u8 ar_sip[4]; | 1216 | u8 ar_sip[4]; |
1249 | u8 ar_tha[ETH_ALEN]; | 1217 | u8 ar_tha[ETH_ALEN]; |
@@ -1253,7 +1221,7 @@ struct arp_packet { | |||
1253 | struct _magic_packet { | 1221 | struct _magic_packet { |
1254 | u8 dest_mac[6]; | 1222 | u8 dest_mac[6]; |
1255 | u8 src_mac[6]; | 1223 | u8 src_mac[6]; |
1256 | u16 type; | 1224 | __be16 type; |
1257 | u8 MAC[16][6]; | 1225 | u8 MAC[16][6]; |
1258 | u8 password[6]; | 1226 | u8 password[6]; |
1259 | } __attribute__ ((__packed__)); | 1227 | } __attribute__ ((__packed__)); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 5413dbf3d4ac..e66de0c12fc1 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -24,6 +24,13 @@ | |||
24 | #include <linux/virtio_net.h> | 24 | #include <linux/virtio_net.h> |
25 | #include <linux/scatterlist.h> | 25 | #include <linux/scatterlist.h> |
26 | 26 | ||
27 | static int napi_weight = 128; | ||
28 | module_param(napi_weight, int, 0444); | ||
29 | |||
30 | static int csum = 1, gso = 1; | ||
31 | module_param(csum, bool, 0444); | ||
32 | module_param(gso, bool, 0444); | ||
33 | |||
27 | /* FIXME: MTU in config. */ | 34 | /* FIXME: MTU in config. */ |
28 | #define MAX_PACKET_LEN (ETH_HLEN+ETH_DATA_LEN) | 35 | #define MAX_PACKET_LEN (ETH_HLEN+ETH_DATA_LEN) |
29 | 36 | ||
@@ -52,13 +59,14 @@ static inline void vnet_hdr_to_sg(struct scatterlist *sg, struct sk_buff *skb) | |||
52 | sg_init_one(sg, skb_vnet_hdr(skb), sizeof(struct virtio_net_hdr)); | 59 | sg_init_one(sg, skb_vnet_hdr(skb), sizeof(struct virtio_net_hdr)); |
53 | } | 60 | } |
54 | 61 | ||
55 | static bool skb_xmit_done(struct virtqueue *rvq) | 62 | static void skb_xmit_done(struct virtqueue *svq) |
56 | { | 63 | { |
57 | struct virtnet_info *vi = rvq->vdev->priv; | 64 | struct virtnet_info *vi = svq->vdev->priv; |
58 | 65 | ||
59 | /* In case we were waiting for output buffers. */ | 66 | /* Suppress further interrupts. */ |
67 | svq->vq_ops->disable_cb(svq); | ||
68 | /* We were waiting for more output buffers. */ | ||
60 | netif_wake_queue(vi->dev); | 69 | netif_wake_queue(vi->dev); |
61 | return true; | ||
62 | } | 70 | } |
63 | 71 | ||
64 | static void receive_skb(struct net_device *dev, struct sk_buff *skb, | 72 | static void receive_skb(struct net_device *dev, struct sk_buff *skb, |
@@ -83,28 +91,16 @@ static void receive_skb(struct net_device *dev, struct sk_buff *skb, | |||
83 | 91 | ||
84 | if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { | 92 | if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { |
85 | pr_debug("Needs csum!\n"); | 93 | pr_debug("Needs csum!\n"); |
86 | skb->ip_summed = CHECKSUM_PARTIAL; | 94 | if (!skb_partial_csum_set(skb,hdr->csum_start,hdr->csum_offset)) |
87 | skb->csum_start = hdr->csum_start; | ||
88 | skb->csum_offset = hdr->csum_offset; | ||
89 | if (skb->csum_start > skb->len - 2 | ||
90 | || skb->csum_offset > skb->len - 2) { | ||
91 | if (net_ratelimit()) | ||
92 | printk(KERN_WARNING "%s: csum=%u/%u len=%u\n", | ||
93 | dev->name, skb->csum_start, | ||
94 | skb->csum_offset, skb->len); | ||
95 | goto frame_err; | 95 | goto frame_err; |
96 | } | ||
97 | } | 96 | } |
98 | 97 | ||
99 | if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { | 98 | if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { |
100 | pr_debug("GSO!\n"); | 99 | pr_debug("GSO!\n"); |
101 | switch (hdr->gso_type) { | 100 | switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { |
102 | case VIRTIO_NET_HDR_GSO_TCPV4: | 101 | case VIRTIO_NET_HDR_GSO_TCPV4: |
103 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; | 102 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; |
104 | break; | 103 | break; |
105 | case VIRTIO_NET_HDR_GSO_TCPV4_ECN: | ||
106 | skb_shinfo(skb)->gso_type = SKB_GSO_TCP_ECN; | ||
107 | break; | ||
108 | case VIRTIO_NET_HDR_GSO_UDP: | 104 | case VIRTIO_NET_HDR_GSO_UDP: |
109 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; | 105 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; |
110 | break; | 106 | break; |
@@ -118,6 +114,9 @@ static void receive_skb(struct net_device *dev, struct sk_buff *skb, | |||
118 | goto frame_err; | 114 | goto frame_err; |
119 | } | 115 | } |
120 | 116 | ||
117 | if (hdr->gso_type & VIRTIO_NET_HDR_GSO_ECN) | ||
118 | skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; | ||
119 | |||
121 | skb_shinfo(skb)->gso_size = hdr->gso_size; | 120 | skb_shinfo(skb)->gso_size = hdr->gso_size; |
122 | if (skb_shinfo(skb)->gso_size == 0) { | 121 | if (skb_shinfo(skb)->gso_size == 0) { |
123 | if (net_ratelimit()) | 122 | if (net_ratelimit()) |
@@ -170,12 +169,14 @@ static void try_fill_recv(struct virtnet_info *vi) | |||
170 | vi->rvq->vq_ops->kick(vi->rvq); | 169 | vi->rvq->vq_ops->kick(vi->rvq); |
171 | } | 170 | } |
172 | 171 | ||
173 | static bool skb_recv_done(struct virtqueue *rvq) | 172 | static void skb_recv_done(struct virtqueue *rvq) |
174 | { | 173 | { |
175 | struct virtnet_info *vi = rvq->vdev->priv; | 174 | struct virtnet_info *vi = rvq->vdev->priv; |
176 | netif_rx_schedule(vi->dev, &vi->napi); | 175 | /* Schedule NAPI, Suppress further interrupts if successful. */ |
177 | /* Suppress further interrupts. */ | 176 | if (netif_rx_schedule_prep(vi->dev, &vi->napi)) { |
178 | return false; | 177 | rvq->vq_ops->disable_cb(rvq); |
178 | __netif_rx_schedule(vi->dev, &vi->napi); | ||
179 | } | ||
179 | } | 180 | } |
180 | 181 | ||
181 | static int virtnet_poll(struct napi_struct *napi, int budget) | 182 | static int virtnet_poll(struct napi_struct *napi, int budget) |
@@ -201,7 +202,7 @@ again: | |||
201 | /* Out of packets? */ | 202 | /* Out of packets? */ |
202 | if (received < budget) { | 203 | if (received < budget) { |
203 | netif_rx_complete(vi->dev, napi); | 204 | netif_rx_complete(vi->dev, napi); |
204 | if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) | 205 | if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq)) |
205 | && netif_rx_reschedule(vi->dev, napi)) | 206 | && netif_rx_reschedule(vi->dev, napi)) |
206 | goto again; | 207 | goto again; |
207 | } | 208 | } |
@@ -236,8 +237,6 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
236 | 237 | ||
237 | pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest)); | 238 | pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest)); |
238 | 239 | ||
239 | free_old_xmit_skbs(vi); | ||
240 | |||
241 | /* Encode metadata header at front. */ | 240 | /* Encode metadata header at front. */ |
242 | hdr = skb_vnet_hdr(skb); | 241 | hdr = skb_vnet_hdr(skb); |
243 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 242 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
@@ -250,10 +249,9 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
250 | } | 249 | } |
251 | 250 | ||
252 | if (skb_is_gso(skb)) { | 251 | if (skb_is_gso(skb)) { |
252 | hdr->hdr_len = skb_transport_header(skb) - skb->data; | ||
253 | hdr->gso_size = skb_shinfo(skb)->gso_size; | 253 | hdr->gso_size = skb_shinfo(skb)->gso_size; |
254 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) | 254 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) |
255 | hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4_ECN; | ||
256 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) | ||
257 | hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; | 255 | hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; |
258 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) | 256 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) |
259 | hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; | 257 | hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; |
@@ -261,19 +259,34 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
261 | hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP; | 259 | hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP; |
262 | else | 260 | else |
263 | BUG(); | 261 | BUG(); |
262 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) | ||
263 | hdr->gso_type |= VIRTIO_NET_HDR_GSO_ECN; | ||
264 | } else { | 264 | } else { |
265 | hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE; | 265 | hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE; |
266 | hdr->gso_size = 0; | 266 | hdr->gso_size = hdr->hdr_len = 0; |
267 | } | 267 | } |
268 | 268 | ||
269 | vnet_hdr_to_sg(sg, skb); | 269 | vnet_hdr_to_sg(sg, skb); |
270 | num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1; | 270 | num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1; |
271 | __skb_queue_head(&vi->send, skb); | 271 | __skb_queue_head(&vi->send, skb); |
272 | |||
273 | again: | ||
274 | /* Free up any pending old buffers before queueing new ones. */ | ||
275 | free_old_xmit_skbs(vi); | ||
272 | err = vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb); | 276 | err = vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb); |
273 | if (err) { | 277 | if (err) { |
274 | pr_debug("%s: virtio not prepared to send\n", dev->name); | 278 | pr_debug("%s: virtio not prepared to send\n", dev->name); |
275 | skb_unlink(skb, &vi->send); | ||
276 | netif_stop_queue(dev); | 279 | netif_stop_queue(dev); |
280 | |||
281 | /* Activate callback for using skbs: if this fails it | ||
282 | * means some were used in the meantime. */ | ||
283 | if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) { | ||
284 | printk("Unlikely: restart svq failed\n"); | ||
285 | netif_start_queue(dev); | ||
286 | goto again; | ||
287 | } | ||
288 | __skb_unlink(skb, &vi->send); | ||
289 | |||
277 | return NETDEV_TX_BUSY; | 290 | return NETDEV_TX_BUSY; |
278 | } | 291 | } |
279 | vi->svq->vq_ops->kick(vi->svq); | 292 | vi->svq->vq_ops->kick(vi->svq); |
@@ -285,45 +298,31 @@ static int virtnet_open(struct net_device *dev) | |||
285 | { | 298 | { |
286 | struct virtnet_info *vi = netdev_priv(dev); | 299 | struct virtnet_info *vi = netdev_priv(dev); |
287 | 300 | ||
288 | try_fill_recv(vi); | 301 | napi_enable(&vi->napi); |
289 | 302 | ||
290 | /* If we didn't even get one input buffer, we're useless. */ | 303 | /* If all buffers were filled by other side before we napi_enabled, we |
291 | if (vi->num == 0) | 304 | * won't get another interrupt, so process any outstanding packets |
292 | return -ENOMEM; | 305 | * now. virtnet_poll wants re-enable the queue, so we disable here. */ |
306 | vi->rvq->vq_ops->disable_cb(vi->rvq); | ||
307 | netif_rx_schedule(vi->dev, &vi->napi); | ||
293 | 308 | ||
294 | napi_enable(&vi->napi); | ||
295 | return 0; | 309 | return 0; |
296 | } | 310 | } |
297 | 311 | ||
298 | static int virtnet_close(struct net_device *dev) | 312 | static int virtnet_close(struct net_device *dev) |
299 | { | 313 | { |
300 | struct virtnet_info *vi = netdev_priv(dev); | 314 | struct virtnet_info *vi = netdev_priv(dev); |
301 | struct sk_buff *skb; | ||
302 | 315 | ||
303 | napi_disable(&vi->napi); | 316 | napi_disable(&vi->napi); |
304 | 317 | ||
305 | /* networking core has neutered skb_xmit_done/skb_recv_done, so don't | ||
306 | * worry about races vs. get(). */ | ||
307 | vi->rvq->vq_ops->shutdown(vi->rvq); | ||
308 | while ((skb = __skb_dequeue(&vi->recv)) != NULL) { | ||
309 | kfree_skb(skb); | ||
310 | vi->num--; | ||
311 | } | ||
312 | vi->svq->vq_ops->shutdown(vi->svq); | ||
313 | while ((skb = __skb_dequeue(&vi->send)) != NULL) | ||
314 | kfree_skb(skb); | ||
315 | |||
316 | BUG_ON(vi->num != 0); | ||
317 | return 0; | 318 | return 0; |
318 | } | 319 | } |
319 | 320 | ||
320 | static int virtnet_probe(struct virtio_device *vdev) | 321 | static int virtnet_probe(struct virtio_device *vdev) |
321 | { | 322 | { |
322 | int err; | 323 | int err; |
323 | unsigned int len; | ||
324 | struct net_device *dev; | 324 | struct net_device *dev; |
325 | struct virtnet_info *vi; | 325 | struct virtnet_info *vi; |
326 | void *token; | ||
327 | 326 | ||
328 | /* Allocate ourselves a network device with room for our info */ | 327 | /* Allocate ourselves a network device with room for our info */ |
329 | dev = alloc_etherdev(sizeof(struct virtnet_info)); | 328 | dev = alloc_etherdev(sizeof(struct virtnet_info)); |
@@ -331,7 +330,6 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
331 | return -ENOMEM; | 330 | return -ENOMEM; |
332 | 331 | ||
333 | /* Set up network device as normal. */ | 332 | /* Set up network device as normal. */ |
334 | ether_setup(dev); | ||
335 | dev->open = virtnet_open; | 333 | dev->open = virtnet_open; |
336 | dev->stop = virtnet_close; | 334 | dev->stop = virtnet_close; |
337 | dev->hard_start_xmit = start_xmit; | 335 | dev->hard_start_xmit = start_xmit; |
@@ -339,42 +337,37 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
339 | SET_NETDEV_DEV(dev, &vdev->dev); | 337 | SET_NETDEV_DEV(dev, &vdev->dev); |
340 | 338 | ||
341 | /* Do we support "hardware" checksums? */ | 339 | /* Do we support "hardware" checksums? */ |
342 | token = vdev->config->find(vdev, VIRTIO_CONFIG_NET_F, &len); | 340 | if (csum && vdev->config->feature(vdev, VIRTIO_NET_F_CSUM)) { |
343 | if (virtio_use_bit(vdev, token, len, VIRTIO_NET_F_NO_CSUM)) { | ||
344 | /* This opens up the world of extra features. */ | 341 | /* This opens up the world of extra features. */ |
345 | dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; | 342 | dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; |
346 | if (virtio_use_bit(vdev, token, len, VIRTIO_NET_F_TSO4)) | 343 | if (gso && vdev->config->feature(vdev, VIRTIO_NET_F_GSO)) { |
347 | dev->features |= NETIF_F_TSO; | 344 | dev->features |= NETIF_F_TSO | NETIF_F_UFO |
348 | if (virtio_use_bit(vdev, token, len, VIRTIO_NET_F_UFO)) | 345 | | NETIF_F_TSO_ECN | NETIF_F_TSO6; |
349 | dev->features |= NETIF_F_UFO; | 346 | } |
350 | if (virtio_use_bit(vdev, token, len, VIRTIO_NET_F_TSO4_ECN)) | ||
351 | dev->features |= NETIF_F_TSO_ECN; | ||
352 | if (virtio_use_bit(vdev, token, len, VIRTIO_NET_F_TSO6)) | ||
353 | dev->features |= NETIF_F_TSO6; | ||
354 | } | 347 | } |
355 | 348 | ||
356 | /* Configuration may specify what MAC to use. Otherwise random. */ | 349 | /* Configuration may specify what MAC to use. Otherwise random. */ |
357 | token = vdev->config->find(vdev, VIRTIO_CONFIG_NET_MAC_F, &len); | 350 | if (vdev->config->feature(vdev, VIRTIO_NET_F_MAC)) { |
358 | if (token) { | 351 | vdev->config->get(vdev, |
359 | dev->addr_len = len; | 352 | offsetof(struct virtio_net_config, mac), |
360 | vdev->config->get(vdev, token, dev->dev_addr, len); | 353 | dev->dev_addr, dev->addr_len); |
361 | } else | 354 | } else |
362 | random_ether_addr(dev->dev_addr); | 355 | random_ether_addr(dev->dev_addr); |
363 | 356 | ||
364 | /* Set up our device-specific information */ | 357 | /* Set up our device-specific information */ |
365 | vi = netdev_priv(dev); | 358 | vi = netdev_priv(dev); |
366 | netif_napi_add(dev, &vi->napi, virtnet_poll, 16); | 359 | netif_napi_add(dev, &vi->napi, virtnet_poll, napi_weight); |
367 | vi->dev = dev; | 360 | vi->dev = dev; |
368 | vi->vdev = vdev; | 361 | vi->vdev = vdev; |
369 | 362 | ||
370 | /* We expect two virtqueues, receive then send. */ | 363 | /* We expect two virtqueues, receive then send. */ |
371 | vi->rvq = vdev->config->find_vq(vdev, skb_recv_done); | 364 | vi->rvq = vdev->config->find_vq(vdev, 0, skb_recv_done); |
372 | if (IS_ERR(vi->rvq)) { | 365 | if (IS_ERR(vi->rvq)) { |
373 | err = PTR_ERR(vi->rvq); | 366 | err = PTR_ERR(vi->rvq); |
374 | goto free; | 367 | goto free; |
375 | } | 368 | } |
376 | 369 | ||
377 | vi->svq = vdev->config->find_vq(vdev, skb_xmit_done); | 370 | vi->svq = vdev->config->find_vq(vdev, 1, skb_xmit_done); |
378 | if (IS_ERR(vi->svq)) { | 371 | if (IS_ERR(vi->svq)) { |
379 | err = PTR_ERR(vi->svq); | 372 | err = PTR_ERR(vi->svq); |
380 | goto free_recv; | 373 | goto free_recv; |
@@ -389,10 +382,22 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
389 | pr_debug("virtio_net: registering device failed\n"); | 382 | pr_debug("virtio_net: registering device failed\n"); |
390 | goto free_send; | 383 | goto free_send; |
391 | } | 384 | } |
385 | |||
386 | /* Last of all, set up some receive buffers. */ | ||
387 | try_fill_recv(vi); | ||
388 | |||
389 | /* If we didn't even get one input buffer, we're useless. */ | ||
390 | if (vi->num == 0) { | ||
391 | err = -ENOMEM; | ||
392 | goto unregister; | ||
393 | } | ||
394 | |||
392 | pr_debug("virtnet: registered device %s\n", dev->name); | 395 | pr_debug("virtnet: registered device %s\n", dev->name); |
393 | vdev->priv = vi; | 396 | vdev->priv = vi; |
394 | return 0; | 397 | return 0; |
395 | 398 | ||
399 | unregister: | ||
400 | unregister_netdev(dev); | ||
396 | free_send: | 401 | free_send: |
397 | vdev->config->del_vq(vi->svq); | 402 | vdev->config->del_vq(vi->svq); |
398 | free_recv: | 403 | free_recv: |
@@ -405,6 +410,20 @@ free: | |||
405 | static void virtnet_remove(struct virtio_device *vdev) | 410 | static void virtnet_remove(struct virtio_device *vdev) |
406 | { | 411 | { |
407 | struct virtnet_info *vi = vdev->priv; | 412 | struct virtnet_info *vi = vdev->priv; |
413 | struct sk_buff *skb; | ||
414 | |||
415 | /* Stop all the virtqueues. */ | ||
416 | vdev->config->reset(vdev); | ||
417 | |||
418 | /* Free our skbs in send and recv queues, if any. */ | ||
419 | while ((skb = __skb_dequeue(&vi->recv)) != NULL) { | ||
420 | kfree_skb(skb); | ||
421 | vi->num--; | ||
422 | } | ||
423 | while ((skb = __skb_dequeue(&vi->send)) != NULL) | ||
424 | kfree_skb(skb); | ||
425 | |||
426 | BUG_ON(vi->num != 0); | ||
408 | 427 | ||
409 | vdev->config->del_vq(vi->svq); | 428 | vdev->config->del_vq(vi->svq); |
410 | vdev->config->del_vq(vi->rvq); | 429 | vdev->config->del_vq(vi->rvq); |
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c index d347d59db656..d14e6678deed 100644 --- a/drivers/net/wan/cycx_drv.c +++ b/drivers/net/wan/cycx_drv.c | |||
@@ -322,7 +322,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len) | |||
322 | void __iomem *pt_boot_cmd = addr + CMD_OFFSET; | 322 | void __iomem *pt_boot_cmd = addr + CMD_OFFSET; |
323 | u32 i; | 323 | u32 i; |
324 | 324 | ||
325 | /* boot buffer lenght */ | 325 | /* boot buffer length */ |
326 | writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16)); | 326 | writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16)); |
327 | writew(GEN_DEFPAR, pt_boot_cmd); | 327 | writew(GEN_DEFPAR, pt_boot_cmd); |
328 | 328 | ||
@@ -353,7 +353,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len) | |||
353 | void __iomem *pt_boot_cmd = addr + CMD_OFFSET; | 353 | void __iomem *pt_boot_cmd = addr + CMD_OFFSET; |
354 | u32 i; | 354 | u32 i; |
355 | 355 | ||
356 | /* boot buffer lenght */ | 356 | /* boot buffer length */ |
357 | writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16)); | 357 | writew(CFM_LOAD_BUFSZ, pt_boot_cmd + sizeof(u16)); |
358 | writew(GEN_DEFPAR, pt_boot_cmd); | 358 | writew(GEN_DEFPAR, pt_boot_cmd); |
359 | 359 | ||
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index d6599d219193..ddc87149fe31 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c | |||
@@ -153,7 +153,7 @@ static int ath5k_pci_resume(struct pci_dev *pdev); | |||
153 | #define ath5k_pci_resume NULL | 153 | #define ath5k_pci_resume NULL |
154 | #endif /* CONFIG_PM */ | 154 | #endif /* CONFIG_PM */ |
155 | 155 | ||
156 | static struct pci_driver ath5k_pci_drv_id = { | 156 | static struct pci_driver ath5k_pci_driver = { |
157 | .name = "ath5k_pci", | 157 | .name = "ath5k_pci", |
158 | .id_table = ath5k_pci_id_table, | 158 | .id_table = ath5k_pci_id_table, |
159 | .probe = ath5k_pci_probe, | 159 | .probe = ath5k_pci_probe, |
@@ -329,7 +329,7 @@ init_ath5k_pci(void) | |||
329 | 329 | ||
330 | ath5k_debug_init(); | 330 | ath5k_debug_init(); |
331 | 331 | ||
332 | ret = pci_register_driver(&ath5k_pci_drv_id); | 332 | ret = pci_register_driver(&ath5k_pci_driver); |
333 | if (ret) { | 333 | if (ret) { |
334 | printk(KERN_ERR "ath5k_pci: can't register pci driver\n"); | 334 | printk(KERN_ERR "ath5k_pci: can't register pci driver\n"); |
335 | return ret; | 335 | return ret; |
@@ -341,7 +341,7 @@ init_ath5k_pci(void) | |||
341 | static void __exit | 341 | static void __exit |
342 | exit_ath5k_pci(void) | 342 | exit_ath5k_pci(void) |
343 | { | 343 | { |
344 | pci_unregister_driver(&ath5k_pci_drv_id); | 344 | pci_unregister_driver(&ath5k_pci_driver); |
345 | 345 | ||
346 | ath5k_debug_finish(); | 346 | ath5k_debug_finish(); |
347 | } | 347 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 4fdeb5323248..8d4d91d35fd2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -238,9 +238,10 @@ void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_b | |||
238 | priv->last_statistics_time = jiffies; | 238 | priv->last_statistics_time = jiffies; |
239 | } | 239 | } |
240 | 240 | ||
241 | void iwl3945_add_radiotap(struct iwl3945_priv *priv, struct sk_buff *skb, | 241 | static void iwl3945_add_radiotap(struct iwl3945_priv *priv, |
242 | struct iwl3945_rx_frame_hdr *rx_hdr, | 242 | struct sk_buff *skb, |
243 | struct ieee80211_rx_status *stats) | 243 | struct iwl3945_rx_frame_hdr *rx_hdr, |
244 | struct ieee80211_rx_status *stats) | ||
244 | { | 245 | { |
245 | /* First cache any information we need before we overwrite | 246 | /* First cache any information we need before we overwrite |
246 | * the information provided in the skb from the hardware */ | 247 | * the information provided in the skb from the hardware */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 569347ff377b..d727de8b96fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -4658,17 +4658,30 @@ void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index, | |||
4658 | struct ieee80211_ht_info *sta_ht_inf) | 4658 | struct ieee80211_ht_info *sta_ht_inf) |
4659 | { | 4659 | { |
4660 | __le32 sta_flags; | 4660 | __le32 sta_flags; |
4661 | u8 mimo_ps_mode; | ||
4661 | 4662 | ||
4662 | if (!sta_ht_inf || !sta_ht_inf->ht_supported) | 4663 | if (!sta_ht_inf || !sta_ht_inf->ht_supported) |
4663 | goto done; | 4664 | goto done; |
4664 | 4665 | ||
4666 | mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_MIMO_PS) >> 2; | ||
4667 | |||
4665 | sta_flags = priv->stations[index].sta.station_flags; | 4668 | sta_flags = priv->stations[index].sta.station_flags; |
4666 | 4669 | ||
4667 | if (((sta_ht_inf->cap & IEEE80211_HT_CAP_MIMO_PS >> 2)) | 4670 | sta_flags &= ~(STA_FLG_RTS_MIMO_PROT_MSK | STA_FLG_MIMO_DIS_MSK); |
4668 | == IWL_MIMO_PS_DYNAMIC) | 4671 | |
4672 | switch (mimo_ps_mode) { | ||
4673 | case WLAN_HT_CAP_MIMO_PS_STATIC: | ||
4674 | sta_flags |= STA_FLG_MIMO_DIS_MSK; | ||
4675 | break; | ||
4676 | case WLAN_HT_CAP_MIMO_PS_DYNAMIC: | ||
4669 | sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK; | 4677 | sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK; |
4670 | else | 4678 | break; |
4671 | sta_flags &= ~STA_FLG_RTS_MIMO_PROT_MSK; | 4679 | case WLAN_HT_CAP_MIMO_PS_DISABLED: |
4680 | break; | ||
4681 | default: | ||
4682 | IWL_WARNING("Invalid MIMO PS mode %d", mimo_ps_mode); | ||
4683 | break; | ||
4684 | } | ||
4672 | 4685 | ||
4673 | sta_flags |= cpu_to_le32( | 4686 | sta_flags |= cpu_to_le32( |
4674 | (u32)sta_ht_inf->ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS); | 4687 | (u32)sta_ht_inf->ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS); |
@@ -4679,7 +4692,7 @@ void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index, | |||
4679 | if (iwl4965_is_fat_tx_allowed(priv, sta_ht_inf)) | 4692 | if (iwl4965_is_fat_tx_allowed(priv, sta_ht_inf)) |
4680 | sta_flags |= STA_FLG_FAT_EN_MSK; | 4693 | sta_flags |= STA_FLG_FAT_EN_MSK; |
4681 | else | 4694 | else |
4682 | sta_flags &= (~STA_FLG_FAT_EN_MSK); | 4695 | sta_flags &= ~STA_FLG_FAT_EN_MSK; |
4683 | 4696 | ||
4684 | priv->stations[index].sta.station_flags = sta_flags; | 4697 | priv->stations[index].sta.station_flags = sta_flags; |
4685 | done: | 4698 | done: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h index cb009f4c401f..8993cca81b40 100644 --- a/drivers/net/wireless/iwlwifi/iwl-helpers.h +++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h | |||
@@ -147,9 +147,6 @@ static inline struct ieee80211_conf *ieee80211_get_hw_conf( | |||
147 | 147 | ||
148 | #define QOS_CONTROL_LEN 2 | 148 | #define QOS_CONTROL_LEN 2 |
149 | 149 | ||
150 | #define IEEE80211_STYPE_BACK_REQ 0x0080 | ||
151 | #define IEEE80211_STYPE_BACK 0x0090 | ||
152 | |||
153 | 150 | ||
154 | static inline int ieee80211_is_management(u16 fc) | 151 | static inline int ieee80211_is_management(u16 fc) |
155 | { | 152 | { |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 33239f197984..f55c75712b55 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -6330,6 +6330,11 @@ static int __iwl3945_up(struct iwl3945_priv *priv) | |||
6330 | return -ENODEV; | 6330 | return -ENODEV; |
6331 | } | 6331 | } |
6332 | 6332 | ||
6333 | if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { | ||
6334 | IWL_ERROR("ucode not available for device bringup\n"); | ||
6335 | return -EIO; | ||
6336 | } | ||
6337 | |||
6333 | /* If platform's RF_KILL switch is NOT set to KILL */ | 6338 | /* If platform's RF_KILL switch is NOT set to KILL */ |
6334 | if (iwl3945_read32(priv, CSR_GP_CNTRL) & | 6339 | if (iwl3945_read32(priv, CSR_GP_CNTRL) & |
6335 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) | 6340 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) |
@@ -6342,11 +6347,6 @@ static int __iwl3945_up(struct iwl3945_priv *priv) | |||
6342 | } | 6347 | } |
6343 | } | 6348 | } |
6344 | 6349 | ||
6345 | if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { | ||
6346 | IWL_ERROR("ucode not available for device bringup\n"); | ||
6347 | return -EIO; | ||
6348 | } | ||
6349 | |||
6350 | iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF); | 6350 | iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF); |
6351 | 6351 | ||
6352 | rc = iwl3945_hw_nic_init(priv); | 6352 | rc = iwl3945_hw_nic_init(priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index bf3a60c037aa..f423241b9567 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -6755,6 +6755,11 @@ static int __iwl4965_up(struct iwl4965_priv *priv) | |||
6755 | return -ENODEV; | 6755 | return -ENODEV; |
6756 | } | 6756 | } |
6757 | 6757 | ||
6758 | if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { | ||
6759 | IWL_ERROR("ucode not available for device bringup\n"); | ||
6760 | return -EIO; | ||
6761 | } | ||
6762 | |||
6758 | /* If platform's RF_KILL switch is NOT set to KILL */ | 6763 | /* If platform's RF_KILL switch is NOT set to KILL */ |
6759 | if (iwl4965_read32(priv, CSR_GP_CNTRL) & | 6764 | if (iwl4965_read32(priv, CSR_GP_CNTRL) & |
6760 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) | 6765 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) |
@@ -6767,11 +6772,6 @@ static int __iwl4965_up(struct iwl4965_priv *priv) | |||
6767 | } | 6772 | } |
6768 | } | 6773 | } |
6769 | 6774 | ||
6770 | if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { | ||
6771 | IWL_ERROR("ucode not available for device bringup\n"); | ||
6772 | return -EIO; | ||
6773 | } | ||
6774 | |||
6775 | iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF); | 6775 | iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF); |
6776 | 6776 | ||
6777 | rc = iwl4965_hw_nic_init(priv); | 6777 | rc = iwl4965_hw_nic_init(priv); |
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 9a61188b62e9..69f94c92b32d 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -1473,7 +1473,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, | |||
1473 | * Called via lbs_prepare_and_send_command(priv, CMD_802_11_SCAN, ...) | 1473 | * Called via lbs_prepare_and_send_command(priv, CMD_802_11_SCAN, ...) |
1474 | * from cmd.c | 1474 | * from cmd.c |
1475 | * | 1475 | * |
1476 | * Sends a fixed lenght data part (specifying the BSS type and BSSID filters) | 1476 | * Sends a fixed length data part (specifying the BSS type and BSSID filters) |
1477 | * as well as a variable number/length of TLVs to the firmware. | 1477 | * as well as a variable number/length of TLVs to the firmware. |
1478 | * | 1478 | * |
1479 | * @param priv A pointer to struct lbs_private structure | 1479 | * @param priv A pointer to struct lbs_private structure |
diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c index e503c9c98032..f4076aeb2098 100644 --- a/drivers/nubus/nubus.c +++ b/drivers/nubus/nubus.c | |||
@@ -352,7 +352,7 @@ nubus_find_rsrc(struct nubus_dir* dir, unsigned char rsrc_type, | |||
352 | resource blocks. */ | 352 | resource blocks. */ |
353 | 353 | ||
354 | /* FIXME: A lot of this stuff will eventually be useful after | 354 | /* FIXME: A lot of this stuff will eventually be useful after |
355 | initializaton, for intelligently probing Ethernet and video chips, | 355 | initialization, for intelligently probing Ethernet and video chips, |
356 | among other things. The rest of it should go in the /proc code. | 356 | among other things. The rest of it should go in the /proc code. |
357 | For now, we just use it to give verbose boot logs. */ | 357 | For now, we just use it to give verbose boot logs. */ |
358 | 358 | ||
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index 7c60cbd85dc8..ca52307b8f40 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c | |||
@@ -363,7 +363,7 @@ ccio_alloc_range(struct ioc *ioc, size_t size) | |||
363 | if (pages_needed <= 8) { | 363 | if (pages_needed <= 8) { |
364 | /* | 364 | /* |
365 | * LAN traffic will not thrash the TLB IFF the same NIC | 365 | * LAN traffic will not thrash the TLB IFF the same NIC |
366 | * uses 8 adjacent pages to map seperate payload data. | 366 | * uses 8 adjacent pages to map separate payload data. |
367 | * ie the same byte in the resource bit map. | 367 | * ie the same byte in the resource bit map. |
368 | */ | 368 | */ |
369 | #if 0 | 369 | #if 0 |
@@ -1589,7 +1589,7 @@ static int __init ccio_probe(struct parisc_device *dev) | |||
1589 | } | 1589 | } |
1590 | 1590 | ||
1591 | /** | 1591 | /** |
1592 | * ccio_init - ccio initalization procedure. | 1592 | * ccio_init - ccio initialization procedure. |
1593 | * | 1593 | * |
1594 | * Register this driver. | 1594 | * Register this driver. |
1595 | */ | 1595 | */ |
diff --git a/drivers/parisc/hppb.c b/drivers/parisc/hppb.c index a728a7cd2fc8..65eee67aa2ae 100644 --- a/drivers/parisc/hppb.c +++ b/drivers/parisc/hppb.c | |||
@@ -95,7 +95,7 @@ static struct parisc_driver hppb_driver = { | |||
95 | }; | 95 | }; |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * hppb_init - HP-PB bus initalization procedure. | 98 | * hppb_init - HP-PB bus initialization procedure. |
99 | * | 99 | * |
100 | * Register this driver. | 100 | * Register this driver. |
101 | */ | 101 | */ |
diff --git a/drivers/parport/probe.c b/drivers/parport/probe.c index 853a15f44f88..cd565bb4e1a9 100644 --- a/drivers/parport/probe.c +++ b/drivers/parport/probe.c | |||
@@ -163,7 +163,7 @@ static ssize_t parport_read_device_id (struct parport *port, char *buffer, | |||
163 | idlens[1] = idlens[0]+2; | 163 | idlens[1] = idlens[0]+2; |
164 | if (belen != lelen) { | 164 | if (belen != lelen) { |
165 | int off = 2; | 165 | int off = 2; |
166 | /* Don't try lenghts of 0x100 and 0x200 as 1 and 2 */ | 166 | /* Don't try lengths of 0x100 and 0x200 as 1 and 2 */ |
167 | if (idlens[0] <= 2) | 167 | if (idlens[0] <= 2) |
168 | off = 0; | 168 | off = 0; |
169 | idlens[off] = max(belen, lelen); | 169 | idlens[off] = max(belen, lelen); |
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index f697f3d728eb..9f04d17576d6 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile | |||
@@ -13,6 +13,9 @@ obj-$(CONFIG_HOTPLUG) += hotplug.o | |||
13 | 13 | ||
14 | # Build the PCI Hotplug drivers if we were asked to | 14 | # Build the PCI Hotplug drivers if we were asked to |
15 | obj-$(CONFIG_HOTPLUG_PCI) += hotplug/ | 15 | obj-$(CONFIG_HOTPLUG_PCI) += hotplug/ |
16 | ifdef CONFIG_HOTPLUG_PCI | ||
17 | obj-y += hotplug-pci.o | ||
18 | endif | ||
16 | 19 | ||
17 | # Build the PCI MSI interrupt support | 20 | # Build the PCI MSI interrupt support |
18 | obj-$(CONFIG_PCI_MSI) += msi.o | 21 | obj-$(CONFIG_PCI_MSI) += msi.o |
diff --git a/drivers/pci/hotplug-pci.c b/drivers/pci/hotplug-pci.c new file mode 100644 index 000000000000..a590ef682153 --- /dev/null +++ b/drivers/pci/hotplug-pci.c | |||
@@ -0,0 +1,20 @@ | |||
1 | /* Core PCI functionality used only by PCI hotplug */ | ||
2 | |||
3 | #include <linux/pci.h> | ||
4 | #include "pci.h" | ||
5 | |||
6 | |||
7 | unsigned int pci_do_scan_bus(struct pci_bus *bus) | ||
8 | { | ||
9 | unsigned int max; | ||
10 | |||
11 | max = pci_scan_child_bus(bus); | ||
12 | |||
13 | /* | ||
14 | * Make the discovered devices available. | ||
15 | */ | ||
16 | pci_bus_add_devices(bus); | ||
17 | |||
18 | return max; | ||
19 | } | ||
20 | EXPORT_SYMBOL(pci_do_scan_bus); | ||
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index abf4203304e4..8dcf1458aa2f 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/topology.h> | 21 | #include <linux/topology.h> |
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/capability.h> | 23 | #include <linux/capability.h> |
24 | #include <linux/aspm.h> | ||
25 | #include "pci.h" | 24 | #include "pci.h" |
26 | 25 | ||
27 | static int sysfs_initialized; /* = 0 */ | 26 | static int sysfs_initialized; /* = 0 */ |
@@ -651,8 +650,6 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
651 | if (pcibios_add_platform_entries(pdev)) | 650 | if (pcibios_add_platform_entries(pdev)) |
652 | goto err_rom_file; | 651 | goto err_rom_file; |
653 | 652 | ||
654 | pcie_aspm_create_sysfs_dev_files(pdev); | ||
655 | |||
656 | return 0; | 653 | return 0; |
657 | 654 | ||
658 | err_rom_file: | 655 | err_rom_file: |
@@ -682,8 +679,6 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev) | |||
682 | if (!sysfs_initialized) | 679 | if (!sysfs_initialized) |
683 | return; | 680 | return; |
684 | 681 | ||
685 | pcie_aspm_remove_sysfs_dev_files(pdev); | ||
686 | |||
687 | if (pdev->cfg_size < 4096) | 682 | if (pdev->cfg_size < 4096) |
688 | sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); | 683 | sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); |
689 | else | 684 | else |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b3e9294e4a0e..04aac7782468 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
19 | #include <linux/string.h> | 19 | #include <linux/string.h> |
20 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
21 | #include <linux/aspm.h> | ||
22 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ | 21 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ |
23 | #include "pci.h" | 22 | #include "pci.h" |
24 | 23 | ||
@@ -520,9 +519,6 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
520 | if (need_restore) | 519 | if (need_restore) |
521 | pci_restore_bars(dev); | 520 | pci_restore_bars(dev); |
522 | 521 | ||
523 | if (dev->bus->self) | ||
524 | pcie_aspm_pm_state_change(dev->bus->self); | ||
525 | |||
526 | return 0; | 522 | return 0; |
527 | } | 523 | } |
528 | 524 | ||
diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig index 60104cf98796..287a9311716c 100644 --- a/drivers/pci/pcie/Kconfig +++ b/drivers/pci/pcie/Kconfig | |||
@@ -26,23 +26,3 @@ config HOTPLUG_PCI_PCIE | |||
26 | When in doubt, say N. | 26 | When in doubt, say N. |
27 | 27 | ||
28 | source "drivers/pci/pcie/aer/Kconfig" | 28 | source "drivers/pci/pcie/aer/Kconfig" |
29 | |||
30 | # | ||
31 | # PCI Express ASPM | ||
32 | # | ||
33 | config PCIEASPM | ||
34 | bool "PCI Express ASPM support(Experimental)" | ||
35 | depends on PCI && EXPERIMENTAL | ||
36 | default y | ||
37 | help | ||
38 | This enables PCI Express ASPM (Active State Power Management) and | ||
39 | Clock Power Management. ASPM supports state L0/L0s/L1. | ||
40 | |||
41 | When in doubt, say N. | ||
42 | config PCIEASPM_DEBUG | ||
43 | bool "Debug PCI Express ASPM" | ||
44 | depends on PCIEASPM | ||
45 | default n | ||
46 | help | ||
47 | This enables PCI Express ASPM debug support. It will add per-device | ||
48 | interface to control ASPM. | ||
diff --git a/drivers/pci/pcie/Makefile b/drivers/pci/pcie/Makefile index 11f6bb1eae24..e00fb99acf44 100644 --- a/drivers/pci/pcie/Makefile +++ b/drivers/pci/pcie/Makefile | |||
@@ -2,9 +2,6 @@ | |||
2 | # Makefile for PCI-Express PORT Driver | 2 | # Makefile for PCI-Express PORT Driver |
3 | # | 3 | # |
4 | 4 | ||
5 | # Build PCI Express ASPM if needed | ||
6 | obj-$(CONFIG_PCIEASPM) += aspm.o | ||
7 | |||
8 | pcieportdrv-y := portdrv_core.o portdrv_pci.o portdrv_bus.o | 5 | pcieportdrv-y := portdrv_core.o portdrv_pci.o portdrv_bus.o |
9 | 6 | ||
10 | obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o | 7 | obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o |
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c deleted file mode 100644 index 1a5adeb10c95..000000000000 --- a/drivers/pci/pcie/aspm.c +++ /dev/null | |||
@@ -1,802 +0,0 @@ | |||
1 | /* | ||
2 | * File: drivers/pci/pcie/aspm.c | ||
3 | * Enabling PCIE link L0s/L1 state and Clock Power Management | ||
4 | * | ||
5 | * Copyright (C) 2007 Intel | ||
6 | * Copyright (C) Zhang Yanmin (yanmin.zhang@intel.com) | ||
7 | * Copyright (C) Shaohua Li (shaohua.li@intel.com) | ||
8 | */ | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/moduleparam.h> | ||
13 | #include <linux/pci.h> | ||
14 | #include <linux/pci_regs.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/pm.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/aspm.h> | ||
20 | #include <acpi/acpi_bus.h> | ||
21 | #include <linux/pci-acpi.h> | ||
22 | #include "../pci.h" | ||
23 | |||
24 | #ifdef MODULE_PARAM_PREFIX | ||
25 | #undef MODULE_PARAM_PREFIX | ||
26 | #endif | ||
27 | #define MODULE_PARAM_PREFIX "pcie_aspm." | ||
28 | |||
29 | struct endpoint_state { | ||
30 | unsigned int l0s_acceptable_latency; | ||
31 | unsigned int l1_acceptable_latency; | ||
32 | }; | ||
33 | |||
34 | struct pcie_link_state { | ||
35 | struct list_head sibiling; | ||
36 | struct pci_dev *pdev; | ||
37 | |||
38 | /* ASPM state */ | ||
39 | unsigned int support_state; | ||
40 | unsigned int enabled_state; | ||
41 | unsigned int bios_aspm_state; | ||
42 | /* upstream component */ | ||
43 | unsigned int l0s_upper_latency; | ||
44 | unsigned int l1_upper_latency; | ||
45 | /* downstream component */ | ||
46 | unsigned int l0s_down_latency; | ||
47 | unsigned int l1_down_latency; | ||
48 | /* Clock PM state*/ | ||
49 | unsigned int clk_pm_capable; | ||
50 | unsigned int clk_pm_enabled; | ||
51 | unsigned int bios_clk_state; | ||
52 | |||
53 | /* | ||
54 | * A pcie downstream port only has one slot under it, so at most there | ||
55 | * are 8 functions | ||
56 | */ | ||
57 | struct endpoint_state endpoints[8]; | ||
58 | }; | ||
59 | |||
60 | static int aspm_disabled; | ||
61 | static DEFINE_MUTEX(aspm_lock); | ||
62 | static LIST_HEAD(link_list); | ||
63 | |||
64 | #define POLICY_DEFAULT 0 /* BIOS default setting */ | ||
65 | #define POLICY_PERFORMANCE 1 /* high performance */ | ||
66 | #define POLICY_POWERSAVE 2 /* high power saving */ | ||
67 | static int aspm_policy; | ||
68 | static const char *policy_str[] = { | ||
69 | [POLICY_DEFAULT] = "default", | ||
70 | [POLICY_PERFORMANCE] = "performance", | ||
71 | [POLICY_POWERSAVE] = "powersave" | ||
72 | }; | ||
73 | |||
74 | static int policy_to_aspm_state(struct pci_dev *pdev) | ||
75 | { | ||
76 | struct pcie_link_state *link_state = pdev->link_state; | ||
77 | |||
78 | switch (aspm_policy) { | ||
79 | case POLICY_PERFORMANCE: | ||
80 | /* Disable ASPM and Clock PM */ | ||
81 | return 0; | ||
82 | case POLICY_POWERSAVE: | ||
83 | /* Enable ASPM L0s/L1 */ | ||
84 | return PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1; | ||
85 | case POLICY_DEFAULT: | ||
86 | return link_state->bios_aspm_state; | ||
87 | } | ||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | static int policy_to_clkpm_state(struct pci_dev *pdev) | ||
92 | { | ||
93 | struct pcie_link_state *link_state = pdev->link_state; | ||
94 | |||
95 | switch (aspm_policy) { | ||
96 | case POLICY_PERFORMANCE: | ||
97 | /* Disable ASPM and Clock PM */ | ||
98 | return 0; | ||
99 | case POLICY_POWERSAVE: | ||
100 | /* Disable Clock PM */ | ||
101 | return 1; | ||
102 | case POLICY_DEFAULT: | ||
103 | return link_state->bios_clk_state; | ||
104 | } | ||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | static void pcie_set_clock_pm(struct pci_dev *pdev, int enable) | ||
109 | { | ||
110 | struct pci_dev *child_dev; | ||
111 | int pos; | ||
112 | u16 reg16; | ||
113 | struct pcie_link_state *link_state = pdev->link_state; | ||
114 | |||
115 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
116 | pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
117 | if (!pos) | ||
118 | return; | ||
119 | pci_read_config_word(child_dev, pos + PCI_EXP_LNKCTL, ®16); | ||
120 | if (enable) | ||
121 | reg16 |= PCI_EXP_LNKCTL_CLKREQ_EN; | ||
122 | else | ||
123 | reg16 &= ~PCI_EXP_LNKCTL_CLKREQ_EN; | ||
124 | pci_write_config_word(child_dev, pos + PCI_EXP_LNKCTL, reg16); | ||
125 | } | ||
126 | link_state->clk_pm_enabled = !!enable; | ||
127 | } | ||
128 | |||
129 | static void pcie_check_clock_pm(struct pci_dev *pdev) | ||
130 | { | ||
131 | int pos; | ||
132 | u32 reg32; | ||
133 | u16 reg16; | ||
134 | int capable = 1, enabled = 1; | ||
135 | struct pci_dev *child_dev; | ||
136 | struct pcie_link_state *link_state = pdev->link_state; | ||
137 | |||
138 | /* All functions should have the same cap and state, take the worst */ | ||
139 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
140 | pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
141 | if (!pos) | ||
142 | return; | ||
143 | pci_read_config_dword(child_dev, pos + PCI_EXP_LNKCAP, ®32); | ||
144 | if (!(reg32 & PCI_EXP_LNKCAP_CLKPM)) { | ||
145 | capable = 0; | ||
146 | enabled = 0; | ||
147 | break; | ||
148 | } | ||
149 | pci_read_config_word(child_dev, pos + PCI_EXP_LNKCTL, ®16); | ||
150 | if (!(reg16 & PCI_EXP_LNKCTL_CLKREQ_EN)) | ||
151 | enabled = 0; | ||
152 | } | ||
153 | link_state->clk_pm_capable = capable; | ||
154 | link_state->clk_pm_enabled = enabled; | ||
155 | link_state->bios_clk_state = enabled; | ||
156 | pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev)); | ||
157 | } | ||
158 | |||
159 | /* | ||
160 | * pcie_aspm_configure_common_clock: check if the 2 ends of a link | ||
161 | * could use common clock. If they are, configure them to use the | ||
162 | * common clock. That will reduce the ASPM state exit latency. | ||
163 | */ | ||
164 | static void pcie_aspm_configure_common_clock(struct pci_dev *pdev) | ||
165 | { | ||
166 | int pos, child_pos; | ||
167 | u16 reg16 = 0; | ||
168 | struct pci_dev *child_dev; | ||
169 | int same_clock = 1; | ||
170 | |||
171 | /* | ||
172 | * all functions of a slot should have the same Slot Clock | ||
173 | * Configuration, so just check one function | ||
174 | * */ | ||
175 | child_dev = list_entry(pdev->subordinate->devices.next, struct pci_dev, | ||
176 | bus_list); | ||
177 | BUG_ON(!child_dev->is_pcie); | ||
178 | |||
179 | /* Check downstream component if bit Slot Clock Configuration is 1 */ | ||
180 | child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
181 | pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKSTA, ®16); | ||
182 | if (!(reg16 & PCI_EXP_LNKSTA_SLC)) | ||
183 | same_clock = 0; | ||
184 | |||
185 | /* Check upstream component if bit Slot Clock Configuration is 1 */ | ||
186 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
187 | pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, ®16); | ||
188 | if (!(reg16 & PCI_EXP_LNKSTA_SLC)) | ||
189 | same_clock = 0; | ||
190 | |||
191 | /* Configure downstream component, all functions */ | ||
192 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
193 | child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
194 | pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKCTL, | ||
195 | ®16); | ||
196 | if (same_clock) | ||
197 | reg16 |= PCI_EXP_LNKCTL_CCC; | ||
198 | else | ||
199 | reg16 &= ~PCI_EXP_LNKCTL_CCC; | ||
200 | pci_write_config_word(child_dev, child_pos + PCI_EXP_LNKCTL, | ||
201 | reg16); | ||
202 | } | ||
203 | |||
204 | /* Configure upstream component */ | ||
205 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); | ||
206 | if (same_clock) | ||
207 | reg16 |= PCI_EXP_LNKCTL_CCC; | ||
208 | else | ||
209 | reg16 &= ~PCI_EXP_LNKCTL_CCC; | ||
210 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); | ||
211 | |||
212 | /* retrain link */ | ||
213 | reg16 |= PCI_EXP_LNKCTL_RL; | ||
214 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); | ||
215 | |||
216 | /* Wait for link training end */ | ||
217 | while (1) { | ||
218 | pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, ®16); | ||
219 | if (!(reg16 & PCI_EXP_LNKSTA_LT)) | ||
220 | break; | ||
221 | cpu_relax(); | ||
222 | } | ||
223 | } | ||
224 | |||
225 | /* | ||
226 | * calc_L0S_latency: Convert L0s latency encoding to ns | ||
227 | */ | ||
228 | static unsigned int calc_L0S_latency(unsigned int latency_encoding, int ac) | ||
229 | { | ||
230 | unsigned int ns = 64; | ||
231 | |||
232 | if (latency_encoding == 0x7) { | ||
233 | if (ac) | ||
234 | ns = -1U; | ||
235 | else | ||
236 | ns = 5*1000; /* > 4us */ | ||
237 | } else | ||
238 | ns *= (1 << latency_encoding); | ||
239 | return ns; | ||
240 | } | ||
241 | |||
242 | /* | ||
243 | * calc_L1_latency: Convert L1 latency encoding to ns | ||
244 | */ | ||
245 | static unsigned int calc_L1_latency(unsigned int latency_encoding, int ac) | ||
246 | { | ||
247 | unsigned int ns = 1000; | ||
248 | |||
249 | if (latency_encoding == 0x7) { | ||
250 | if (ac) | ||
251 | ns = -1U; | ||
252 | else | ||
253 | ns = 65*1000; /* > 64us */ | ||
254 | } else | ||
255 | ns *= (1 << latency_encoding); | ||
256 | return ns; | ||
257 | } | ||
258 | |||
259 | static void pcie_aspm_get_cap_device(struct pci_dev *pdev, u32 *state, | ||
260 | unsigned int *l0s, unsigned int *l1, unsigned int *enabled) | ||
261 | { | ||
262 | int pos; | ||
263 | u16 reg16; | ||
264 | u32 reg32; | ||
265 | unsigned int latency; | ||
266 | |||
267 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
268 | pci_read_config_dword(pdev, pos + PCI_EXP_LNKCAP, ®32); | ||
269 | *state = (reg32 & PCI_EXP_LNKCAP_ASPMS) >> 10; | ||
270 | if (*state != PCIE_LINK_STATE_L0S && | ||
271 | *state != (PCIE_LINK_STATE_L1|PCIE_LINK_STATE_L0S)) | ||
272 | * state = 0; | ||
273 | if (*state == 0) | ||
274 | return; | ||
275 | |||
276 | latency = (reg32 & PCI_EXP_LNKCAP_L0SEL) >> 12; | ||
277 | *l0s = calc_L0S_latency(latency, 0); | ||
278 | if (*state & PCIE_LINK_STATE_L1) { | ||
279 | latency = (reg32 & PCI_EXP_LNKCAP_L1EL) >> 15; | ||
280 | *l1 = calc_L1_latency(latency, 0); | ||
281 | } | ||
282 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); | ||
283 | *enabled = reg16 & (PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1); | ||
284 | } | ||
285 | |||
286 | static void pcie_aspm_cap_init(struct pci_dev *pdev) | ||
287 | { | ||
288 | struct pci_dev *child_dev; | ||
289 | u32 state, tmp; | ||
290 | struct pcie_link_state *link_state = pdev->link_state; | ||
291 | |||
292 | /* upstream component states */ | ||
293 | pcie_aspm_get_cap_device(pdev, &link_state->support_state, | ||
294 | &link_state->l0s_upper_latency, | ||
295 | &link_state->l1_upper_latency, | ||
296 | &link_state->enabled_state); | ||
297 | /* downstream component states, all functions have the same setting */ | ||
298 | child_dev = list_entry(pdev->subordinate->devices.next, struct pci_dev, | ||
299 | bus_list); | ||
300 | pcie_aspm_get_cap_device(child_dev, &state, | ||
301 | &link_state->l0s_down_latency, | ||
302 | &link_state->l1_down_latency, | ||
303 | &tmp); | ||
304 | link_state->support_state &= state; | ||
305 | if (!link_state->support_state) | ||
306 | return; | ||
307 | link_state->enabled_state &= link_state->support_state; | ||
308 | link_state->bios_aspm_state = link_state->enabled_state; | ||
309 | |||
310 | /* ENDPOINT states*/ | ||
311 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
312 | int pos; | ||
313 | u32 reg32; | ||
314 | unsigned int latency; | ||
315 | struct endpoint_state *ep_state = | ||
316 | &link_state->endpoints[PCI_FUNC(child_dev->devfn)]; | ||
317 | |||
318 | if (child_dev->pcie_type != PCI_EXP_TYPE_ENDPOINT && | ||
319 | child_dev->pcie_type != PCI_EXP_TYPE_LEG_END) | ||
320 | continue; | ||
321 | |||
322 | pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
323 | pci_read_config_dword(child_dev, pos + PCI_EXP_DEVCAP, ®32); | ||
324 | latency = (reg32 & PCI_EXP_DEVCAP_L0S) >> 6; | ||
325 | latency = calc_L0S_latency(latency, 1); | ||
326 | ep_state->l0s_acceptable_latency = latency; | ||
327 | if (link_state->support_state & PCIE_LINK_STATE_L1) { | ||
328 | latency = (reg32 & PCI_EXP_DEVCAP_L1) >> 9; | ||
329 | latency = calc_L1_latency(latency, 1); | ||
330 | ep_state->l1_acceptable_latency = latency; | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | |||
335 | static unsigned int __pcie_aspm_check_state_one(struct pci_dev *pdev, | ||
336 | unsigned int state) | ||
337 | { | ||
338 | struct pci_dev *parent_dev, *tmp_dev; | ||
339 | unsigned int latency, l1_latency = 0; | ||
340 | struct pcie_link_state *link_state; | ||
341 | struct endpoint_state *ep_state; | ||
342 | |||
343 | parent_dev = pdev->bus->self; | ||
344 | link_state = parent_dev->link_state; | ||
345 | state &= link_state->support_state; | ||
346 | if (state == 0) | ||
347 | return 0; | ||
348 | ep_state = &link_state->endpoints[PCI_FUNC(pdev->devfn)]; | ||
349 | |||
350 | /* | ||
351 | * Check latency for endpoint device. | ||
352 | * TBD: The latency from the endpoint to root complex vary per | ||
353 | * switch's upstream link state above the device. Here we just do a | ||
354 | * simple check which assumes all links above the device can be in L1 | ||
355 | * state, that is we just consider the worst case. If switch's upstream | ||
356 | * link can't be put into L0S/L1, then our check is too strictly. | ||
357 | */ | ||
358 | tmp_dev = pdev; | ||
359 | while (state & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) { | ||
360 | parent_dev = tmp_dev->bus->self; | ||
361 | link_state = parent_dev->link_state; | ||
362 | if (state & PCIE_LINK_STATE_L0S) { | ||
363 | latency = max_t(unsigned int, | ||
364 | link_state->l0s_upper_latency, | ||
365 | link_state->l0s_down_latency); | ||
366 | if (latency > ep_state->l0s_acceptable_latency) | ||
367 | state &= ~PCIE_LINK_STATE_L0S; | ||
368 | } | ||
369 | if (state & PCIE_LINK_STATE_L1) { | ||
370 | latency = max_t(unsigned int, | ||
371 | link_state->l1_upper_latency, | ||
372 | link_state->l1_down_latency); | ||
373 | if (latency + l1_latency > | ||
374 | ep_state->l1_acceptable_latency) | ||
375 | state &= ~PCIE_LINK_STATE_L1; | ||
376 | } | ||
377 | if (!parent_dev->bus->self) /* parent_dev is a root port */ | ||
378 | break; | ||
379 | else { | ||
380 | /* | ||
381 | * parent_dev is the downstream port of a switch, make | ||
382 | * tmp_dev the upstream port of the switch | ||
383 | */ | ||
384 | tmp_dev = parent_dev->bus->self; | ||
385 | /* | ||
386 | * every switch on the path to root complex need 1 more | ||
387 | * microsecond for L1. Spec doesn't mention L0S. | ||
388 | */ | ||
389 | if (state & PCIE_LINK_STATE_L1) | ||
390 | l1_latency += 1000; | ||
391 | } | ||
392 | } | ||
393 | return state; | ||
394 | } | ||
395 | |||
396 | static unsigned int pcie_aspm_check_state(struct pci_dev *pdev, | ||
397 | unsigned int state) | ||
398 | { | ||
399 | struct pci_dev *child_dev; | ||
400 | |||
401 | /* If no child, disable the link */ | ||
402 | if (list_empty(&pdev->subordinate->devices)) | ||
403 | return 0; | ||
404 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
405 | if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) { | ||
406 | /* | ||
407 | * If downstream component of a link is pci bridge, we | ||
408 | * disable ASPM for now for the link | ||
409 | * */ | ||
410 | state = 0; | ||
411 | break; | ||
412 | } | ||
413 | if ((child_dev->pcie_type != PCI_EXP_TYPE_ENDPOINT && | ||
414 | child_dev->pcie_type != PCI_EXP_TYPE_LEG_END)) | ||
415 | continue; | ||
416 | /* Device not in D0 doesn't need check latency */ | ||
417 | if (child_dev->current_state == PCI_D1 || | ||
418 | child_dev->current_state == PCI_D2 || | ||
419 | child_dev->current_state == PCI_D3hot || | ||
420 | child_dev->current_state == PCI_D3cold) | ||
421 | continue; | ||
422 | state = __pcie_aspm_check_state_one(child_dev, state); | ||
423 | } | ||
424 | return state; | ||
425 | } | ||
426 | |||
427 | static void __pcie_aspm_config_one_dev(struct pci_dev *pdev, unsigned int state) | ||
428 | { | ||
429 | u16 reg16; | ||
430 | int pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
431 | |||
432 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); | ||
433 | reg16 &= ~0x3; | ||
434 | reg16 |= state; | ||
435 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); | ||
436 | } | ||
437 | |||
438 | static void __pcie_aspm_config_link(struct pci_dev *pdev, unsigned int state) | ||
439 | { | ||
440 | struct pci_dev *child_dev; | ||
441 | int valid = 1; | ||
442 | struct pcie_link_state *link_state = pdev->link_state; | ||
443 | |||
444 | /* | ||
445 | * if the downstream component has pci bridge function, don't do ASPM | ||
446 | * now | ||
447 | */ | ||
448 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
449 | if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) { | ||
450 | valid = 0; | ||
451 | break; | ||
452 | } | ||
453 | } | ||
454 | if (!valid) | ||
455 | return; | ||
456 | |||
457 | /* | ||
458 | * spec 2.0 suggests all functions should be configured the same | ||
459 | * setting for ASPM. Enabling ASPM L1 should be done in upstream | ||
460 | * component first and then downstream, and vice versa for disabling | ||
461 | * ASPM L1. Spec doesn't mention L0S. | ||
462 | */ | ||
463 | if (state & PCIE_LINK_STATE_L1) | ||
464 | __pcie_aspm_config_one_dev(pdev, state); | ||
465 | |||
466 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) | ||
467 | __pcie_aspm_config_one_dev(child_dev, state); | ||
468 | |||
469 | if (!(state & PCIE_LINK_STATE_L1)) | ||
470 | __pcie_aspm_config_one_dev(pdev, state); | ||
471 | |||
472 | link_state->enabled_state = state; | ||
473 | } | ||
474 | |||
475 | static void __pcie_aspm_configure_link_state(struct pci_dev *pdev, | ||
476 | unsigned int state) | ||
477 | { | ||
478 | struct pcie_link_state *link_state = pdev->link_state; | ||
479 | |||
480 | if (link_state->support_state == 0) | ||
481 | return; | ||
482 | state &= PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1; | ||
483 | |||
484 | /* state 0 means disabling aspm */ | ||
485 | state = pcie_aspm_check_state(pdev, state); | ||
486 | if (link_state->enabled_state == state) | ||
487 | return; | ||
488 | __pcie_aspm_config_link(pdev, state); | ||
489 | } | ||
490 | |||
491 | /* | ||
492 | * pcie_aspm_configure_link_state: enable/disable PCI express link state | ||
493 | * @pdev: the root port or switch downstream port | ||
494 | */ | ||
495 | static void pcie_aspm_configure_link_state(struct pci_dev *pdev, | ||
496 | unsigned int state) | ||
497 | { | ||
498 | down_read(&pci_bus_sem); | ||
499 | mutex_lock(&aspm_lock); | ||
500 | __pcie_aspm_configure_link_state(pdev, state); | ||
501 | mutex_unlock(&aspm_lock); | ||
502 | up_read(&pci_bus_sem); | ||
503 | } | ||
504 | |||
505 | static void free_link_state(struct pci_dev *pdev) | ||
506 | { | ||
507 | kfree(pdev->link_state); | ||
508 | pdev->link_state = NULL; | ||
509 | } | ||
510 | |||
511 | /* | ||
512 | * pcie_aspm_init_link_state: Initiate PCI express link state. | ||
513 | * It is called after the pcie and its children devices are scaned. | ||
514 | * @pdev: the root port or switch downstream port | ||
515 | */ | ||
516 | void pcie_aspm_init_link_state(struct pci_dev *pdev) | ||
517 | { | ||
518 | unsigned int state; | ||
519 | struct pcie_link_state *link_state; | ||
520 | int error = 0; | ||
521 | |||
522 | if (aspm_disabled || !pdev->is_pcie || pdev->link_state) | ||
523 | return; | ||
524 | if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | ||
525 | pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) | ||
526 | return; | ||
527 | down_read(&pci_bus_sem); | ||
528 | if (list_empty(&pdev->subordinate->devices)) | ||
529 | goto out; | ||
530 | |||
531 | mutex_lock(&aspm_lock); | ||
532 | |||
533 | link_state = kzalloc(sizeof(*link_state), GFP_KERNEL); | ||
534 | if (!link_state) | ||
535 | goto unlock_out; | ||
536 | pdev->link_state = link_state; | ||
537 | |||
538 | pcie_aspm_configure_common_clock(pdev); | ||
539 | |||
540 | pcie_aspm_cap_init(pdev); | ||
541 | |||
542 | /* config link state to avoid BIOS error */ | ||
543 | state = pcie_aspm_check_state(pdev, policy_to_aspm_state(pdev)); | ||
544 | __pcie_aspm_config_link(pdev, state); | ||
545 | |||
546 | pcie_check_clock_pm(pdev); | ||
547 | |||
548 | link_state->pdev = pdev; | ||
549 | list_add(&link_state->sibiling, &link_list); | ||
550 | |||
551 | unlock_out: | ||
552 | if (error) | ||
553 | free_link_state(pdev); | ||
554 | mutex_unlock(&aspm_lock); | ||
555 | out: | ||
556 | up_read(&pci_bus_sem); | ||
557 | } | ||
558 | |||
559 | /* @pdev: the endpoint device */ | ||
560 | void pcie_aspm_exit_link_state(struct pci_dev *pdev) | ||
561 | { | ||
562 | struct pci_dev *parent = pdev->bus->self; | ||
563 | struct pcie_link_state *link_state = parent->link_state; | ||
564 | |||
565 | if (aspm_disabled || !pdev->is_pcie || !parent || !link_state) | ||
566 | return; | ||
567 | if (parent->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | ||
568 | parent->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) | ||
569 | return; | ||
570 | down_read(&pci_bus_sem); | ||
571 | mutex_lock(&aspm_lock); | ||
572 | |||
573 | /* | ||
574 | * All PCIe functions are in one slot, remove one function will remove | ||
575 | * the the whole slot, so just wait | ||
576 | */ | ||
577 | if (!list_empty(&parent->subordinate->devices)) | ||
578 | goto out; | ||
579 | |||
580 | /* All functions are removed, so just disable ASPM for the link */ | ||
581 | __pcie_aspm_config_one_dev(parent, 0); | ||
582 | list_del(&link_state->sibiling); | ||
583 | /* Clock PM is for endpoint device */ | ||
584 | |||
585 | free_link_state(parent); | ||
586 | out: | ||
587 | mutex_unlock(&aspm_lock); | ||
588 | up_read(&pci_bus_sem); | ||
589 | } | ||
590 | |||
591 | /* @pdev: the root port or switch downstream port */ | ||
592 | void pcie_aspm_pm_state_change(struct pci_dev *pdev) | ||
593 | { | ||
594 | struct pcie_link_state *link_state = pdev->link_state; | ||
595 | |||
596 | if (aspm_disabled || !pdev->is_pcie || !pdev->link_state) | ||
597 | return; | ||
598 | if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | ||
599 | pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) | ||
600 | return; | ||
601 | /* | ||
602 | * devices changed PM state, we should recheck if latency meets all | ||
603 | * functions' requirement | ||
604 | */ | ||
605 | pcie_aspm_configure_link_state(pdev, link_state->enabled_state); | ||
606 | } | ||
607 | |||
608 | /* | ||
609 | * pci_disable_link_state - disable pci device's link state, so the link will | ||
610 | * never enter specific states | ||
611 | */ | ||
612 | void pci_disable_link_state(struct pci_dev *pdev, int state) | ||
613 | { | ||
614 | struct pci_dev *parent = pdev->bus->self; | ||
615 | struct pcie_link_state *link_state; | ||
616 | |||
617 | if (aspm_disabled || !pdev->is_pcie) | ||
618 | return; | ||
619 | if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT || | ||
620 | pdev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM) | ||
621 | parent = pdev; | ||
622 | if (!parent) | ||
623 | return; | ||
624 | |||
625 | down_read(&pci_bus_sem); | ||
626 | mutex_lock(&aspm_lock); | ||
627 | link_state = parent->link_state; | ||
628 | link_state->support_state &= | ||
629 | ~(state & (PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1)); | ||
630 | if (state & PCIE_LINK_STATE_CLKPM) | ||
631 | link_state->clk_pm_capable = 0; | ||
632 | |||
633 | __pcie_aspm_configure_link_state(parent, link_state->enabled_state); | ||
634 | if (!link_state->clk_pm_capable && link_state->clk_pm_enabled) | ||
635 | pcie_set_clock_pm(parent, 0); | ||
636 | mutex_unlock(&aspm_lock); | ||
637 | up_read(&pci_bus_sem); | ||
638 | } | ||
639 | EXPORT_SYMBOL(pci_disable_link_state); | ||
640 | |||
641 | static int pcie_aspm_set_policy(const char *val, struct kernel_param *kp) | ||
642 | { | ||
643 | int i; | ||
644 | struct pci_dev *pdev; | ||
645 | struct pcie_link_state *link_state; | ||
646 | |||
647 | for (i = 0; i < ARRAY_SIZE(policy_str); i++) | ||
648 | if (!strncmp(val, policy_str[i], strlen(policy_str[i]))) | ||
649 | break; | ||
650 | if (i >= ARRAY_SIZE(policy_str)) | ||
651 | return -EINVAL; | ||
652 | if (i == aspm_policy) | ||
653 | return 0; | ||
654 | |||
655 | down_read(&pci_bus_sem); | ||
656 | mutex_lock(&aspm_lock); | ||
657 | aspm_policy = i; | ||
658 | list_for_each_entry(link_state, &link_list, sibiling) { | ||
659 | pdev = link_state->pdev; | ||
660 | __pcie_aspm_configure_link_state(pdev, | ||
661 | policy_to_aspm_state(pdev)); | ||
662 | if (link_state->clk_pm_capable && | ||
663 | link_state->clk_pm_enabled != policy_to_clkpm_state(pdev)) | ||
664 | pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev)); | ||
665 | |||
666 | } | ||
667 | mutex_unlock(&aspm_lock); | ||
668 | up_read(&pci_bus_sem); | ||
669 | return 0; | ||
670 | } | ||
671 | |||
672 | static int pcie_aspm_get_policy(char *buffer, struct kernel_param *kp) | ||
673 | { | ||
674 | int i, cnt = 0; | ||
675 | for (i = 0; i < ARRAY_SIZE(policy_str); i++) | ||
676 | if (i == aspm_policy) | ||
677 | cnt += sprintf(buffer + cnt, "[%s] ", policy_str[i]); | ||
678 | else | ||
679 | cnt += sprintf(buffer + cnt, "%s ", policy_str[i]); | ||
680 | return cnt; | ||
681 | } | ||
682 | |||
683 | module_param_call(policy, pcie_aspm_set_policy, pcie_aspm_get_policy, | ||
684 | NULL, 0644); | ||
685 | |||
686 | #ifdef CONFIG_PCIEASPM_DEBUG | ||
687 | static ssize_t link_state_show(struct device *dev, | ||
688 | struct device_attribute *attr, | ||
689 | char *buf) | ||
690 | { | ||
691 | struct pci_dev *pci_device = to_pci_dev(dev); | ||
692 | struct pcie_link_state *link_state = pci_device->link_state; | ||
693 | |||
694 | return sprintf(buf, "%d\n", link_state->enabled_state); | ||
695 | } | ||
696 | |||
697 | static ssize_t link_state_store(struct device *dev, | ||
698 | struct device_attribute *attr, | ||
699 | const char *buf, | ||
700 | size_t n) | ||
701 | { | ||
702 | struct pci_dev *pci_device = to_pci_dev(dev); | ||
703 | int state; | ||
704 | |||
705 | if (n < 1) | ||
706 | return -EINVAL; | ||
707 | state = buf[0]-'0'; | ||
708 | if (state >= 0 && state <= 3) { | ||
709 | /* setup link aspm state */ | ||
710 | pcie_aspm_configure_link_state(pci_device, state); | ||
711 | return n; | ||
712 | } | ||
713 | |||
714 | return -EINVAL; | ||
715 | } | ||
716 | |||
717 | static ssize_t clk_ctl_show(struct device *dev, | ||
718 | struct device_attribute *attr, | ||
719 | char *buf) | ||
720 | { | ||
721 | struct pci_dev *pci_device = to_pci_dev(dev); | ||
722 | struct pcie_link_state *link_state = pci_device->link_state; | ||
723 | |||
724 | return sprintf(buf, "%d\n", link_state->clk_pm_enabled); | ||
725 | } | ||
726 | |||
727 | static ssize_t clk_ctl_store(struct device *dev, | ||
728 | struct device_attribute *attr, | ||
729 | const char *buf, | ||
730 | size_t n) | ||
731 | { | ||
732 | struct pci_dev *pci_device = to_pci_dev(dev); | ||
733 | int state; | ||
734 | |||
735 | if (n < 1) | ||
736 | return -EINVAL; | ||
737 | state = buf[0]-'0'; | ||
738 | |||
739 | down_read(&pci_bus_sem); | ||
740 | mutex_lock(&aspm_lock); | ||
741 | pcie_set_clock_pm(pci_device, !!state); | ||
742 | mutex_unlock(&aspm_lock); | ||
743 | up_read(&pci_bus_sem); | ||
744 | |||
745 | return n; | ||
746 | } | ||
747 | |||
748 | static DEVICE_ATTR(link_state, 0644, link_state_show, link_state_store); | ||
749 | static DEVICE_ATTR(clk_ctl, 0644, clk_ctl_show, clk_ctl_store); | ||
750 | |||
751 | static char power_group[] = "power"; | ||
752 | void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) | ||
753 | { | ||
754 | struct pcie_link_state *link_state = pdev->link_state; | ||
755 | |||
756 | if (!pdev->is_pcie || (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | ||
757 | pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)) | ||
758 | return; | ||
759 | |||
760 | if (link_state->support_state) | ||
761 | sysfs_add_file_to_group(&pdev->dev.kobj, | ||
762 | &dev_attr_link_state.attr, power_group); | ||
763 | if (link_state->clk_pm_capable) | ||
764 | sysfs_add_file_to_group(&pdev->dev.kobj, | ||
765 | &dev_attr_clk_ctl.attr, power_group); | ||
766 | } | ||
767 | |||
768 | void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) | ||
769 | { | ||
770 | struct pcie_link_state *link_state = pdev->link_state; | ||
771 | |||
772 | if (!pdev->is_pcie || (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | ||
773 | pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)) | ||
774 | return; | ||
775 | |||
776 | if (link_state->support_state) | ||
777 | sysfs_remove_file_from_group(&pdev->dev.kobj, | ||
778 | &dev_attr_link_state.attr, power_group); | ||
779 | if (link_state->clk_pm_capable) | ||
780 | sysfs_remove_file_from_group(&pdev->dev.kobj, | ||
781 | &dev_attr_clk_ctl.attr, power_group); | ||
782 | } | ||
783 | #endif | ||
784 | |||
785 | static int __init pcie_aspm_disable(char *str) | ||
786 | { | ||
787 | aspm_disabled = 1; | ||
788 | return 1; | ||
789 | } | ||
790 | |||
791 | __setup("pcie_noaspm", pcie_aspm_disable); | ||
792 | |||
793 | static int __init pcie_aspm_init(void) | ||
794 | { | ||
795 | if (aspm_disabled) | ||
796 | return 0; | ||
797 | pci_osc_support_set(OSC_ACTIVE_STATE_PWR_SUPPORT| | ||
798 | OSC_CLOCK_PWR_CAPABILITY_SUPPORT); | ||
799 | return 0; | ||
800 | } | ||
801 | |||
802 | fs_initcall(pcie_aspm_init); | ||
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 8b505bd925aa..7f5dab34d315 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/cpumask.h> | 11 | #include <linux/cpumask.h> |
12 | #include <linux/aspm.h> | ||
13 | #include "pci.h" | 12 | #include "pci.h" |
14 | 13 | ||
15 | #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ | 14 | #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ |
@@ -434,7 +433,7 @@ pci_alloc_child_bus(struct pci_bus *parent, struct pci_dev *bridge, int busnr) | |||
434 | return child; | 433 | return child; |
435 | } | 434 | } |
436 | 435 | ||
437 | struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) | 436 | struct pci_bus *__ref pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr) |
438 | { | 437 | { |
439 | struct pci_bus *child; | 438 | struct pci_bus *child; |
440 | 439 | ||
@@ -949,7 +948,7 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) | |||
949 | up_write(&pci_bus_sem); | 948 | up_write(&pci_bus_sem); |
950 | } | 949 | } |
951 | 950 | ||
952 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn) | 951 | struct pci_dev *__ref pci_scan_single_device(struct pci_bus *bus, int devfn) |
953 | { | 952 | { |
954 | struct pci_dev *dev; | 953 | struct pci_dev *dev; |
955 | 954 | ||
@@ -1002,10 +1001,6 @@ int pci_scan_slot(struct pci_bus *bus, int devfn) | |||
1002 | break; | 1001 | break; |
1003 | } | 1002 | } |
1004 | } | 1003 | } |
1005 | |||
1006 | if (bus->self) | ||
1007 | pcie_aspm_init_link_state(bus->self); | ||
1008 | |||
1009 | return nr; | 1004 | return nr; |
1010 | } | 1005 | } |
1011 | 1006 | ||
@@ -1045,20 +1040,6 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus) | |||
1045 | return max; | 1040 | return max; |
1046 | } | 1041 | } |
1047 | 1042 | ||
1048 | unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus) | ||
1049 | { | ||
1050 | unsigned int max; | ||
1051 | |||
1052 | max = pci_scan_child_bus(bus); | ||
1053 | |||
1054 | /* | ||
1055 | * Make the discovered devices available. | ||
1056 | */ | ||
1057 | pci_bus_add_devices(bus); | ||
1058 | |||
1059 | return max; | ||
1060 | } | ||
1061 | |||
1062 | struct pci_bus * pci_create_bus(struct device *parent, | 1043 | struct pci_bus * pci_create_bus(struct device *parent, |
1063 | int bus, struct pci_ops *ops, void *sysdata) | 1044 | int bus, struct pci_ops *ops, void *sysdata) |
1064 | { | 1045 | { |
@@ -1145,7 +1126,6 @@ EXPORT_SYMBOL(pci_scan_bus_parented); | |||
1145 | 1126 | ||
1146 | #ifdef CONFIG_HOTPLUG | 1127 | #ifdef CONFIG_HOTPLUG |
1147 | EXPORT_SYMBOL(pci_add_new_bus); | 1128 | EXPORT_SYMBOL(pci_add_new_bus); |
1148 | EXPORT_SYMBOL(pci_do_scan_bus); | ||
1149 | EXPORT_SYMBOL(pci_scan_slot); | 1129 | EXPORT_SYMBOL(pci_scan_slot); |
1150 | EXPORT_SYMBOL(pci_scan_bridge); | 1130 | EXPORT_SYMBOL(pci_scan_bridge); |
1151 | EXPORT_SYMBOL_GPL(pci_scan_child_bus); | 1131 | EXPORT_SYMBOL_GPL(pci_scan_child_bus); |
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index ec4a82ba29a8..9684e1bde277 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -1,6 +1,5 @@ | |||
1 | #include <linux/pci.h> | 1 | #include <linux/pci.h> |
2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
3 | #include <linux/aspm.h> | ||
4 | #include "pci.h" | 3 | #include "pci.h" |
5 | 4 | ||
6 | static void pci_free_resources(struct pci_dev *dev) | 5 | static void pci_free_resources(struct pci_dev *dev) |
@@ -31,9 +30,6 @@ static void pci_stop_dev(struct pci_dev *dev) | |||
31 | dev->global_list.next = dev->global_list.prev = NULL; | 30 | dev->global_list.next = dev->global_list.prev = NULL; |
32 | up_write(&pci_bus_sem); | 31 | up_write(&pci_bus_sem); |
33 | } | 32 | } |
34 | |||
35 | if (dev->bus->self) | ||
36 | pcie_aspm_exit_link_state(dev); | ||
37 | } | 33 | } |
38 | 34 | ||
39 | static void pci_destroy_dev(struct pci_dev *dev) | 35 | static void pci_destroy_dev(struct pci_dev *dev) |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 8a7232feb553..262b0439abe9 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -456,7 +456,7 @@ pci_bus_size_cardbus(struct pci_bus *bus) | |||
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
459 | void pci_bus_size_bridges(struct pci_bus *bus) | 459 | void __ref pci_bus_size_bridges(struct pci_bus *bus) |
460 | { | 460 | { |
461 | struct pci_dev *dev; | 461 | struct pci_dev *dev; |
462 | unsigned long mask, prefmask; | 462 | unsigned long mask, prefmask; |
@@ -511,7 +511,7 @@ void pci_bus_size_bridges(struct pci_bus *bus) | |||
511 | } | 511 | } |
512 | EXPORT_SYMBOL(pci_bus_size_bridges); | 512 | EXPORT_SYMBOL(pci_bus_size_bridges); |
513 | 513 | ||
514 | void pci_bus_assign_resources(struct pci_bus *bus) | 514 | void __ref pci_bus_assign_resources(struct pci_bus *bus) |
515 | { | 515 | { |
516 | struct pci_bus *b; | 516 | struct pci_bus *b; |
517 | struct pci_dev *dev; | 517 | struct pci_dev *dev; |
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index c5e0d89c3ece..ec4c1253ebbb 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c | |||
@@ -368,7 +368,7 @@ static irqreturn_t pcc_interrupt(int irq, void *dev) | |||
368 | handled = 1; | 368 | handled = 1; |
369 | irc = pcc_get(i, PCIRC); | 369 | irc = pcc_get(i, PCIRC); |
370 | irc >>=16; | 370 | irc >>=16; |
371 | debug(2, "m32r-pcc:interrput: socket %d pcirc 0x%02x ", i, irc); | 371 | debug(2, "m32r-pcc:interrupt: socket %d pcirc 0x%02x ", i, irc); |
372 | if (!irc) | 372 | if (!irc) |
373 | continue; | 373 | continue; |
374 | 374 | ||
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index d182760f035b..4ea426a25909 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c | |||
@@ -851,7 +851,7 @@ static int m8xx_set_socket(struct pcmcia_socket *sock, socket_state_t * state) | |||
851 | I tried to control the CxOE signal with SS_OUTPUT_ENA, | 851 | I tried to control the CxOE signal with SS_OUTPUT_ENA, |
852 | but the reset signal seems connected via the 541. | 852 | but the reset signal seems connected via the 541. |
853 | If the CxOE is left high are some signals tristated and | 853 | If the CxOE is left high are some signals tristated and |
854 | no pullups are present -> the cards act wierd. | 854 | no pullups are present -> the cards act weird. |
855 | So right now the buffers are enabled if the power is on. */ | 855 | So right now the buffers are enabled if the power is on. */ |
856 | 856 | ||
857 | if (state->Vcc || state->Vpp) | 857 | if (state->Vcc || state->Vpp) |
diff --git a/drivers/scsi/NCR53C9x.h b/drivers/scsi/NCR53C9x.h index d85cb73a9f69..00a0ba040dba 100644 --- a/drivers/scsi/NCR53C9x.h +++ b/drivers/scsi/NCR53C9x.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* NCR53C9x.c: Defines and structures for the NCR53C9x generic driver. | 1 | /* NCR53C9x.c: Defines and structures for the NCR53C9x generic driver. |
2 | * | 2 | * |
3 | * Originaly esp.h: Defines and structures for the Sparc ESP | 3 | * Originally esp.h: Defines and structures for the Sparc ESP |
4 | * (Enhanced SCSI Processor) driver under Linux. | 4 | * (Enhanced SCSI Processor) driver under Linux. |
5 | * | 5 | * |
6 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | 6 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) |
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 190568ebea3c..5a1471c370fa 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * Modified by Chris Faulhaber <jedgar@fxp.org> | 21 | * Modified by Chris Faulhaber <jedgar@fxp.org> |
22 | * Added module command-line options | 22 | * Added module command-line options |
23 | * 19-Jul-99 | 23 | * 19-Jul-99 |
24 | * Modified by Adam Fritzler <mid@auk.cx> | 24 | * Modified by Adam Fritzler |
25 | * Added proper detection of the AHA-1640 (MCA version of AHA-1540) | 25 | * Added proper detection of the AHA-1640 (MCA version of AHA-1540) |
26 | */ | 26 | */ |
27 | 27 | ||
diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile index e4f70c563bc2..4c549540a35d 100644 --- a/drivers/scsi/aic7xxx/Makefile +++ b/drivers/scsi/aic7xxx/Makefile | |||
@@ -44,13 +44,8 @@ clean-files += aic79xx_seq.h aic79xx_reg.h aic79xx_reg_print.c | |||
44 | 44 | ||
45 | # Dependencies for generated files need to be listed explicitly | 45 | # Dependencies for generated files need to be listed explicitly |
46 | 46 | ||
47 | $(obj)/aic7xxx_core.o: $(obj)/aic7xxx_seq.h | 47 | $(addprefix $(src)/,$(aic7xxx-y:.o=.c)): $(obj)/aic7xxx_seq.h $(obj)/aic7xxx_reg.h |
48 | $(obj)/aic7xxx_core.o: $(obj)/aic7xxx_reg.h | 48 | $(addprefix $(src)/,$(aic79xx-y:.o=.c)): $(obj)/aic79xx_seq.h $(obj)/aic79xx_reg.h |
49 | $(obj)/aic79xx_core.o: $(obj)/aic79xx_seq.h | ||
50 | $(obj)/aic79xx_core.o: $(obj)/aic79xx_reg.h | ||
51 | |||
52 | $(addprefix $(obj)/,$(aic7xxx-y)): $(obj)/aic7xxx_seq.h | ||
53 | $(addprefix $(obj)/,$(aic79xx-y)): $(obj)/aic79xx_seq.h | ||
54 | 49 | ||
55 | aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_reg.h | 50 | aic7xxx-gen-$(CONFIG_AIC7XXX_BUILD_FIRMWARE) := $(obj)/aic7xxx_reg.h |
56 | aic7xxx-gen-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) += $(obj)/aic7xxx_reg_print.c | 51 | aic7xxx-gen-$(CONFIG_AIC7XXX_REG_PRETTY_PRINT) += $(obj)/aic7xxx_reg_print.c |
diff --git a/drivers/scsi/aic7xxx/aic79xx_inline.h b/drivers/scsi/aic7xxx/aic79xx_inline.h index 2ceb67f4af2a..45e55575a0fa 100644 --- a/drivers/scsi/aic7xxx/aic79xx_inline.h +++ b/drivers/scsi/aic7xxx/aic79xx_inline.h | |||
@@ -417,7 +417,7 @@ ahd_targetcmd_offset(struct ahd_softc *ahd, u_int index) | |||
417 | - (uint8_t *)ahd->qoutfifo); | 417 | - (uint8_t *)ahd->qoutfifo); |
418 | } | 418 | } |
419 | 419 | ||
420 | /*********************** Miscelaneous Support Functions ***********************/ | 420 | /*********************** Miscellaneous Support Functions ***********************/ |
421 | static __inline struct ahd_initiator_tinfo * | 421 | static __inline struct ahd_initiator_tinfo * |
422 | ahd_fetch_transinfo(struct ahd_softc *ahd, | 422 | ahd_fetch_transinfo(struct ahd_softc *ahd, |
423 | char channel, u_int our_id, | 423 | char channel, u_int our_id, |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 014654792901..72fccd9f40df 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -325,7 +325,7 @@ MODULE_PARM_DESC(aic79xx, | |||
325 | " verbose Enable verbose/diagnostic logging\n" | 325 | " verbose Enable verbose/diagnostic logging\n" |
326 | " allow_memio Allow device registers to be memory mapped\n" | 326 | " allow_memio Allow device registers to be memory mapped\n" |
327 | " debug Bitmask of debug values to enable\n" | 327 | " debug Bitmask of debug values to enable\n" |
328 | " no_reset Supress initial bus resets\n" | 328 | " no_reset Suppress initial bus resets\n" |
329 | " extended Enable extended geometry on all controllers\n" | 329 | " extended Enable extended geometry on all controllers\n" |
330 | " periodic_otag Send an ordered tagged transaction\n" | 330 | " periodic_otag Send an ordered tagged transaction\n" |
331 | " periodically to prevent tag starvation.\n" | 331 | " periodically to prevent tag starvation.\n" |
diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c index df853676e66a..c9f79fdf9131 100644 --- a/drivers/scsi/aic7xxx/aic79xx_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_pci.c | |||
@@ -979,7 +979,7 @@ ahd_aic790X_setup(struct ahd_softc *ahd) | |||
979 | | AHD_FAINT_LED_BUG; | 979 | | AHD_FAINT_LED_BUG; |
980 | 980 | ||
981 | /* | 981 | /* |
982 | * IO Cell paramter setup. | 982 | * IO Cell parameter setup. |
983 | */ | 983 | */ |
984 | AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29); | 984 | AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29); |
985 | 985 | ||
@@ -1006,7 +1006,7 @@ ahd_aic790X_setup(struct ahd_softc *ahd) | |||
1006 | ahd->bugs |= AHD_INTCOLLISION_BUG|AHD_ABORT_LQI_BUG; | 1006 | ahd->bugs |= AHD_INTCOLLISION_BUG|AHD_ABORT_LQI_BUG; |
1007 | 1007 | ||
1008 | /* | 1008 | /* |
1009 | * IO Cell paramter setup. | 1009 | * IO Cell parameter setup. |
1010 | */ | 1010 | */ |
1011 | AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29); | 1011 | AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29); |
1012 | AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVB); | 1012 | AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVB); |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_inline.h b/drivers/scsi/aic7xxx/aic7xxx_inline.h index 8e1954cdd84f..cba2f23bbe79 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_inline.h +++ b/drivers/scsi/aic7xxx/aic7xxx_inline.h | |||
@@ -229,7 +229,7 @@ ahc_name(struct ahc_softc *ahc) | |||
229 | return (ahc->name); | 229 | return (ahc->name); |
230 | } | 230 | } |
231 | 231 | ||
232 | /*********************** Miscelaneous Support Functions ***********************/ | 232 | /*********************** Miscellaneous Support Functions ***********************/ |
233 | 233 | ||
234 | static __inline void ahc_update_residual(struct ahc_softc *ahc, | 234 | static __inline void ahc_update_residual(struct ahc_softc *ahc, |
235 | struct scb *scb); | 235 | struct scb *scb); |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 99a3b33a3233..282aff6f852e 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -347,7 +347,7 @@ MODULE_PARM_DESC(aic7xxx, | |||
347 | " debug Bitmask of debug values to enable\n" | 347 | " debug Bitmask of debug values to enable\n" |
348 | " no_probe Toggle EISA/VLB controller probing\n" | 348 | " no_probe Toggle EISA/VLB controller probing\n" |
349 | " probe_eisa_vl Toggle EISA/VLB controller probing\n" | 349 | " probe_eisa_vl Toggle EISA/VLB controller probing\n" |
350 | " no_reset Supress initial bus resets\n" | 350 | " no_reset Suppress initial bus resets\n" |
351 | " extended Enable extended geometry on all controllers\n" | 351 | " extended Enable extended geometry on all controllers\n" |
352 | " periodic_otag Send an ordered tagged transaction\n" | 352 | " periodic_otag Send an ordered tagged transaction\n" |
353 | " periodically to prevent tag starvation.\n" | 353 | " periodically to prevent tag starvation.\n" |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 5ed00069846d..6c4f0f081785 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -588,19 +588,14 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc) | |||
588 | hwif->sg_mapped = 0; | 588 | hwif->sg_mapped = 0; |
589 | } | 589 | } |
590 | 590 | ||
591 | SELECT_DRIVE(drive); | ||
592 | |||
593 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK, bcount, dma); | 591 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK, bcount, dma); |
594 | 592 | ||
595 | if (dma) | 593 | if (dma) |
596 | set_bit(PC_DMA_OK, &pc->flags); | 594 | set_bit(PC_DMA_OK, &pc->flags); |
597 | 595 | ||
598 | if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) { | 596 | if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) { |
599 | BUG_ON(HWGROUP(drive)->handler != NULL); | 597 | ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc, |
600 | ide_set_handler(drive, &idescsi_transfer_pc, | 598 | get_timeout(pc), idescsi_expiry); |
601 | get_timeout(pc), idescsi_expiry); | ||
602 | /* Issue the packet command */ | ||
603 | HWIF(drive)->OUTB(WIN_PACKETCMD, IDE_COMMAND_REG); | ||
604 | return ide_started; | 599 | return ide_started; |
605 | } else { | 600 | } else { |
606 | /* Issue the packet command */ | 601 | /* Issue the packet command */ |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 73270ff892d9..2074701f7e76 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -7053,7 +7053,7 @@ static pci_ers_result_t ipr_pci_error_detected(struct pci_dev *pdev, | |||
7053 | * where it can accept new commands. | 7053 | * where it can accept new commands. |
7054 | 7054 | ||
7055 | * Return value: | 7055 | * Return value: |
7056 | * 0 on sucess / -EIO on failure | 7056 | * 0 on success / -EIO on failure |
7057 | **/ | 7057 | **/ |
7058 | static int __devinit ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg) | 7058 | static int __devinit ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg) |
7059 | { | 7059 | { |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 7505cca8e68e..bb152fb9fec7 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -1309,7 +1309,7 @@ ips_intr_copperhead(ips_ha_t * ha) | |||
1309 | cstatus.value = (*ha->func.statupd) (ha); | 1309 | cstatus.value = (*ha->func.statupd) (ha); |
1310 | 1310 | ||
1311 | if (cstatus.fields.command_id > (IPS_MAX_CMDS - 1)) { | 1311 | if (cstatus.fields.command_id > (IPS_MAX_CMDS - 1)) { |
1312 | /* Spurious Interupt ? */ | 1312 | /* Spurious Interrupt ? */ |
1313 | continue; | 1313 | continue; |
1314 | } | 1314 | } |
1315 | 1315 | ||
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index f26b9538affe..83567b9755b4 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -325,7 +325,7 @@ struct lpfc_vport { | |||
325 | 325 | ||
326 | #define WORKER_MBOX_TMO 0x100 /* hba: MBOX timeout */ | 326 | #define WORKER_MBOX_TMO 0x100 /* hba: MBOX timeout */ |
327 | #define WORKER_HB_TMO 0x200 /* hba: Heart beat timeout */ | 327 | #define WORKER_HB_TMO 0x200 /* hba: Heart beat timeout */ |
328 | #define WORKER_FABRIC_BLOCK_TMO 0x400 /* hba: fabric block timout */ | 328 | #define WORKER_FABRIC_BLOCK_TMO 0x400 /* hba: fabric block timeout */ |
329 | #define WORKER_RAMP_DOWN_QUEUE 0x800 /* hba: Decrease Q depth */ | 329 | #define WORKER_RAMP_DOWN_QUEUE 0x800 /* hba: Decrease Q depth */ |
330 | #define WORKER_RAMP_UP_QUEUE 0x1000 /* hba: Increase Q depth */ | 330 | #define WORKER_RAMP_UP_QUEUE 0x1000 /* hba: Increase Q depth */ |
331 | 331 | ||
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 29b4cf9e059b..6cfeba7454d4 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -1894,7 +1894,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1894 | uint16_t iotag; | 1894 | uint16_t iotag; |
1895 | int bars = pci_select_bars(pdev, IORESOURCE_MEM); | 1895 | int bars = pci_select_bars(pdev, IORESOURCE_MEM); |
1896 | 1896 | ||
1897 | if (pci_enable_device_bars(pdev, bars)) | 1897 | if (pci_enable_device_mem(pdev)) |
1898 | goto out; | 1898 | goto out; |
1899 | if (pci_request_selected_regions(pdev, bars, LPFC_DRIVER_NAME)) | 1899 | if (pci_request_selected_regions(pdev, bars, LPFC_DRIVER_NAME)) |
1900 | goto out_disable_device; | 1900 | goto out_disable_device; |
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index dfc63f6ccd7b..7a9be4c5b7cb 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -880,7 +880,7 @@ lpfc_mbox_get(struct lpfc_hba * phba) | |||
880 | void | 880 | void |
881 | lpfc_mbox_cmpl_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq) | 881 | lpfc_mbox_cmpl_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq) |
882 | { | 882 | { |
883 | /* This function expects to be called from interupt context */ | 883 | /* This function expects to be called from interrupt context */ |
884 | spin_lock(&phba->hbalock); | 884 | spin_lock(&phba->hbalock); |
885 | list_add_tail(&mbq->list, &phba->sli.mboxq_cmpl); | 885 | list_add_tail(&mbq->list, &phba->sli.mboxq_cmpl); |
886 | spin_unlock(&phba->hbalock); | 886 | spin_unlock(&phba->hbalock); |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index 6db77c00e3ee..9f041929aca5 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -3464,12 +3464,12 @@ megaraid_mbox_setup_device_map(adapter_t *adapter) | |||
3464 | /* | 3464 | /* |
3465 | * START: Interface for the common management module | 3465 | * START: Interface for the common management module |
3466 | * | 3466 | * |
3467 | * This is the module, which interfaces with the common mangement module to | 3467 | * This is the module, which interfaces with the common management module to |
3468 | * provide support for ioctl and sysfs | 3468 | * provide support for ioctl and sysfs |
3469 | */ | 3469 | */ |
3470 | 3470 | ||
3471 | /** | 3471 | /** |
3472 | * megaraid_cmm_register - register with the mangement module | 3472 | * megaraid_cmm_register - register with the management module |
3473 | * @adapter : HBA soft state | 3473 | * @adapter : HBA soft state |
3474 | * | 3474 | * |
3475 | * Register with the management module, which allows applications to issue | 3475 | * Register with the management module, which allows applications to issue |
@@ -3557,7 +3557,7 @@ megaraid_cmm_register(adapter_t *adapter) | |||
3557 | 3557 | ||
3558 | 3558 | ||
3559 | /** | 3559 | /** |
3560 | * megaraid_cmm_unregister - un-register with the mangement module | 3560 | * megaraid_cmm_unregister - un-register with the management module |
3561 | * @adapter : HBA soft state | 3561 | * @adapter : HBA soft state |
3562 | * | 3562 | * |
3563 | * Un-register with the management module. | 3563 | * Un-register with the management module. |
@@ -3579,7 +3579,7 @@ megaraid_cmm_unregister(adapter_t *adapter) | |||
3579 | * @kioc : CMM interface packet | 3579 | * @kioc : CMM interface packet |
3580 | * @action : command action | 3580 | * @action : command action |
3581 | * | 3581 | * |
3582 | * This routine is invoked whenever the Common Mangement Module (CMM) has a | 3582 | * This routine is invoked whenever the Common Management Module (CMM) has a |
3583 | * command for us. The 'action' parameter specifies if this is a new command | 3583 | * command for us. The 'action' parameter specifies if this is a new command |
3584 | * or otherwise. | 3584 | * or otherwise. |
3585 | */ | 3585 | */ |
@@ -3944,7 +3944,7 @@ megaraid_sysfs_get_ldmap_timeout(unsigned long data) | |||
3944 | * | 3944 | * |
3945 | * This routine will be called whenever user reads the logical drive | 3945 | * This routine will be called whenever user reads the logical drive |
3946 | * attributes, go get the current logical drive mapping table from the | 3946 | * attributes, go get the current logical drive mapping table from the |
3947 | * firmware. We use the managment API's to issue commands to the controller. | 3947 | * firmware. We use the management API's to issue commands to the controller. |
3948 | * | 3948 | * |
3949 | * NOTE: The commands issuance functionality is not generalized and | 3949 | * NOTE: The commands issuance functionality is not generalized and |
3950 | * implemented in context of "get ld map" command only. If required, the | 3950 | * implemented in context of "get ld map" command only. If required, the |
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index eb0784c9ff83..6226d88479f5 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c | |||
@@ -1094,7 +1094,7 @@ qla2x00_sns_rnn_id(scsi_qla_host_t *ha) | |||
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | /** | 1096 | /** |
1097 | * qla2x00_mgmt_svr_login() - Login to fabric Managment Service. | 1097 | * qla2x00_mgmt_svr_login() - Login to fabric Management Service. |
1098 | * @ha: HA context | 1098 | * @ha: HA context |
1099 | * | 1099 | * |
1100 | * Returns 0 on success. | 1100 | * Returns 0 on success. |
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h index accaf690eaf0..d6be0762eb91 100644 --- a/drivers/scsi/qla4xxx/ql4_def.h +++ b/drivers/scsi/qla4xxx/ql4_def.h | |||
@@ -121,7 +121,7 @@ | |||
121 | #define MAX_REQS_SERVICED_PER_INTR 16 | 121 | #define MAX_REQS_SERVICED_PER_INTR 16 |
122 | 122 | ||
123 | #define ISCSI_IPADDR_SIZE 4 /* IP address size */ | 123 | #define ISCSI_IPADDR_SIZE 4 /* IP address size */ |
124 | #define ISCSI_ALIAS_SIZE 32 /* ISCSI Alais name size */ | 124 | #define ISCSI_ALIAS_SIZE 32 /* ISCSI Alias name size */ |
125 | #define ISCSI_NAME_SIZE 0xE0 /* ISCSI Name size */ | 125 | #define ISCSI_NAME_SIZE 0xE0 /* ISCSI Name size */ |
126 | 126 | ||
127 | #define LSDW(x) ((u32)((u64)(x))) | 127 | #define LSDW(x) ((u32)((u64)(x))) |
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index cbe0a17ced5f..49925f92555e 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c | |||
@@ -1098,7 +1098,7 @@ static int qla4xxx_start_firmware(struct scsi_qla_host *ha) | |||
1098 | } | 1098 | } |
1099 | config_chip = 1; | 1099 | config_chip = 1; |
1100 | 1100 | ||
1101 | /* Reset clears the semaphore, so aquire again */ | 1101 | /* Reset clears the semaphore, so acquire again */ |
1102 | if (ql4xxx_lock_drvr_wait(ha) != QLA_SUCCESS) | 1102 | if (ql4xxx_lock_drvr_wait(ha) != QLA_SUCCESS) |
1103 | return QLA_ERROR; | 1103 | return QLA_ERROR; |
1104 | } | 1104 | } |
diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c index 91630baea532..3677fbb30b72 100644 --- a/drivers/scsi/scsi_tgt_lib.c +++ b/drivers/scsi/scsi_tgt_lib.c | |||
@@ -320,7 +320,7 @@ int scsi_tgt_queue_command(struct scsi_cmnd *cmd, u64 itn_id, | |||
320 | EXPORT_SYMBOL_GPL(scsi_tgt_queue_command); | 320 | EXPORT_SYMBOL_GPL(scsi_tgt_queue_command); |
321 | 321 | ||
322 | /* | 322 | /* |
323 | * This is run from a interrpt handler normally and the unmap | 323 | * This is run from a interrupt handler normally and the unmap |
324 | * needs process context so we must queue | 324 | * needs process context so we must queue |
325 | */ | 325 | */ |
326 | static void scsi_tgt_cmd_done(struct scsi_cmnd *cmd) | 326 | static void scsi_tgt_cmd_done(struct scsi_cmnd *cmd) |
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index f2149d0bb999..43a964d635b4 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * The SAS transport class contains common code to deal with SAS HBAs, | 7 | * The SAS transport class contains common code to deal with SAS HBAs, |
8 | * an aproximated representation of SAS topologies in the driver model, | 8 | * an aproximated representation of SAS topologies in the driver model, |
9 | * and various sysfs attributes to expose these topologies and managment | 9 | * and various sysfs attributes to expose these topologies and management |
10 | * interfaces to userspace. | 10 | * interfaces to userspace. |
11 | * | 11 | * |
12 | * In addition to the basic SCSI core objects this transport class | 12 | * In addition to the basic SCSI core objects this transport class |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 8a053ea21e1d..4fa7927997ad 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -1295,8 +1295,8 @@ config SERIAL_NETX_CONSOLE | |||
1295 | depends on SERIAL_NETX | 1295 | depends on SERIAL_NETX |
1296 | select SERIAL_CORE_CONSOLE | 1296 | select SERIAL_CORE_CONSOLE |
1297 | help | 1297 | help |
1298 | If you have enabled the serial port on the Motorola IMX | 1298 | If you have enabled the serial port on the Hilscher NetX SoC |
1299 | CPU you can make it the console by answering Y to this option. | 1299 | you can make it the console by answering Y to this option. |
1300 | 1300 | ||
1301 | config SERIAL_OF_PLATFORM | 1301 | config SERIAL_OF_PLATFORM |
1302 | tristate "Serial port on Open Firmware platform bus" | 1302 | tristate "Serial port on Open Firmware platform bus" |
diff --git a/drivers/serial/icom.h b/drivers/serial/icom.h index 027455496745..c8029e0025c9 100644 --- a/drivers/serial/icom.h +++ b/drivers/serial/icom.h | |||
@@ -20,7 +20,7 @@ | |||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include<linux/serial_core.h> | 23 | #include <linux/serial_core.h> |
24 | 24 | ||
25 | #define BAUD_TABLE_LIMIT ((sizeof(icom_acfg_baud)/sizeof(int)) - 1) | 25 | #define BAUD_TABLE_LIMIT ((sizeof(icom_acfg_baud)/sizeof(int)) - 1) |
26 | static int icom_acfg_baud[] = { | 26 | static int icom_acfg_baud[] = { |
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 83211013deb8..e94031731a47 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c | |||
@@ -582,7 +582,7 @@ static struct parisc_driver serial_mux_driver = { | |||
582 | }; | 582 | }; |
583 | 583 | ||
584 | /** | 584 | /** |
585 | * mux_init - Serial MUX initalization procedure. | 585 | * mux_init - Serial MUX initialization procedure. |
586 | * | 586 | * |
587 | * Register the Serial MUX driver. | 587 | * Register the Serial MUX driver. |
588 | */ | 588 | */ |
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 2cd8573fb09c..639963eb1ac1 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
@@ -157,7 +157,7 @@ | |||
157 | #define SPI_FIFO_BYTE_WIDTH (2) | 157 | #define SPI_FIFO_BYTE_WIDTH (2) |
158 | #define SPI_FIFO_OVERFLOW_MARGIN (2) | 158 | #define SPI_FIFO_OVERFLOW_MARGIN (2) |
159 | 159 | ||
160 | /* DMA burst lenght for half full/empty request trigger */ | 160 | /* DMA burst length for half full/empty request trigger */ |
161 | #define SPI_DMA_BLR (SPI_FIFO_DEPTH * SPI_FIFO_BYTE_WIDTH / 2) | 161 | #define SPI_DMA_BLR (SPI_FIFO_DEPTH * SPI_FIFO_BYTE_WIDTH / 2) |
162 | 162 | ||
163 | /* Dummy char output to achieve reads. | 163 | /* Dummy char output to achieve reads. |
diff --git a/drivers/ssb/b43_pci_bridge.c b/drivers/ssb/b43_pci_bridge.c index 1a31f7a72848..2d27d6d6d08e 100644 --- a/drivers/ssb/b43_pci_bridge.c +++ b/drivers/ssb/b43_pci_bridge.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Broadcom 43xx PCI-SSB bridge module | 2 | * Broadcom 43xx PCI-SSB bridge module |
3 | * | 3 | * |
4 | * This technically is a seperate PCI driver module, but | 4 | * This technically is a separate PCI driver module, but |
5 | * because of its small size we include it in the SSB core | 5 | * because of its small size we include it in the SSB core |
6 | * instead of creating a standalone module. | 6 | * instead of creating a standalone module. |
7 | * | 7 | * |
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index 83ee3e75386c..675abdafc2d8 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -2561,7 +2561,7 @@ static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend) | |||
2561 | pci_read_config_dword(rinfo->pdev, i * 4, | 2561 | pci_read_config_dword(rinfo->pdev, i * 4, |
2562 | &rinfo->cfg_save[i]); | 2562 | &rinfo->cfg_save[i]); |
2563 | 2563 | ||
2564 | /* Switch PCI power managment to D2. */ | 2564 | /* Switch PCI power management to D2. */ |
2565 | pci_disable_device(rinfo->pdev); | 2565 | pci_disable_device(rinfo->pdev); |
2566 | for (;;) { | 2566 | for (;;) { |
2567 | pci_read_config_word( | 2567 | pci_read_config_word( |
diff --git a/drivers/video/cyblafb.c b/drivers/video/cyblafb.c index e23324d10be2..9704b73135f5 100644 --- a/drivers/video/cyblafb.c +++ b/drivers/video/cyblafb.c | |||
@@ -1156,7 +1156,7 @@ static struct fb_ops cyblafb_ops __devinitdata = { | |||
1156 | // need altered timings to display correctly. So I decided that it is much | 1156 | // need altered timings to display correctly. So I decided that it is much |
1157 | // better to provide a limited optimized set of modes plus the option of | 1157 | // better to provide a limited optimized set of modes plus the option of |
1158 | // using the mode in effect at startup time (might be selected using the | 1158 | // using the mode in effect at startup time (might be selected using the |
1159 | // vga=??? paramter). After that the user might use fbset to select any | 1159 | // vga=??? parameter). After that the user might use fbset to select any |
1160 | // mode he likes, check_var will not try to alter geometry parameters as | 1160 | // mode he likes, check_var will not try to alter geometry parameters as |
1161 | // it would be necessary otherwise. | 1161 | // it would be necessary otherwise. |
1162 | // | 1162 | // |
diff --git a/drivers/video/intelfb/intelfb.h b/drivers/video/intelfb/intelfb.h index 2fe3f7def530..836796177942 100644 --- a/drivers/video/intelfb/intelfb.h +++ b/drivers/video/intelfb/intelfb.h | |||
@@ -111,7 +111,7 @@ | |||
111 | 111 | ||
112 | #define FIXED_MODE(d) ((d)->fixed_mode) | 112 | #define FIXED_MODE(d) ((d)->fixed_mode) |
113 | 113 | ||
114 | /*** Driver paramters ***/ | 114 | /*** Driver parameters ***/ |
115 | 115 | ||
116 | #define RINGBUFFER_SIZE KB(64) | 116 | #define RINGBUFFER_SIZE KB(64) |
117 | #define HW_CURSOR_SIZE KB(4) | 117 | #define HW_CURSOR_SIZE KB(4) |
diff --git a/drivers/video/omap/lcdc.c b/drivers/video/omap/lcdc.c index 9085188d815e..fb19ed4992db 100644 --- a/drivers/video/omap/lcdc.c +++ b/drivers/video/omap/lcdc.c | |||
@@ -312,7 +312,7 @@ static irqreturn_t lcdc_irq_handler(int irq, void *dev_id) | |||
312 | /* | 312 | /* |
313 | * Change to a new video mode. We defer this to a later time to avoid any | 313 | * Change to a new video mode. We defer this to a later time to avoid any |
314 | * flicker and not to mess up the current LCD DMA context. For this we disable | 314 | * flicker and not to mess up the current LCD DMA context. For this we disable |
315 | * the LCD controler, which will generate a DONE irq after the last frame has | 315 | * the LCD controller, which will generate a DONE irq after the last frame has |
316 | * been transferred. Then it'll be safe to reconfigure both the LCD controller | 316 | * been transferred. Then it'll be safe to reconfigure both the LCD controller |
317 | * as well as the LCD DMA. | 317 | * as well as the LCD DMA. |
318 | */ | 318 | */ |
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index 1be95a68d696..58f200c69be3 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c | |||
@@ -48,7 +48,7 @@ enum sm501_controller { | |||
48 | HEAD_PANEL = 1, | 48 | HEAD_PANEL = 1, |
49 | }; | 49 | }; |
50 | 50 | ||
51 | /* SM501 memory adress */ | 51 | /* SM501 memory address */ |
52 | struct sm501_mem { | 52 | struct sm501_mem { |
53 | unsigned long size; | 53 | unsigned long size; |
54 | unsigned long sm_addr; | 54 | unsigned long sm_addr; |
diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig index 9e33fc4da875..3dd6294d10b6 100644 --- a/drivers/virtio/Kconfig +++ b/drivers/virtio/Kconfig | |||
@@ -1,8 +1,35 @@ | |||
1 | # Virtio always gets selected by whoever wants it. | 1 | # Virtio always gets selected by whoever wants it. |
2 | config VIRTIO | 2 | config VIRTIO |
3 | bool | 3 | tristate |
4 | 4 | ||
5 | # Similarly the virtio ring implementation. | 5 | # Similarly the virtio ring implementation. |
6 | config VIRTIO_RING | 6 | config VIRTIO_RING |
7 | bool | 7 | tristate |
8 | depends on VIRTIO | 8 | depends on VIRTIO |
9 | |||
10 | config VIRTIO_PCI | ||
11 | tristate "PCI driver for virtio devices (EXPERIMENTAL)" | ||
12 | depends on PCI && EXPERIMENTAL | ||
13 | select VIRTIO | ||
14 | select VIRTIO_RING | ||
15 | ---help--- | ||
16 | This drivers provides support for virtio based paravirtual device | ||
17 | drivers over PCI. This requires that your VMM has appropriate PCI | ||
18 | virtio backends. Most QEMU based VMMs should support these devices | ||
19 | (like KVM or Xen). | ||
20 | |||
21 | Currently, the ABI is not considered stable so there is no guarantee | ||
22 | that this version of the driver will work with your VMM. | ||
23 | |||
24 | If unsure, say M. | ||
25 | |||
26 | config VIRTIO_BALLOON | ||
27 | tristate "Virtio balloon driver (EXPERIMENTAL)" | ||
28 | select VIRTIO | ||
29 | select VIRTIO_RING | ||
30 | ---help--- | ||
31 | This driver supports increasing and decreasing the amount | ||
32 | of memory within a KVM guest. | ||
33 | |||
34 | If unsure, say M. | ||
35 | |||
diff --git a/drivers/virtio/Makefile b/drivers/virtio/Makefile index f70e40971dd9..6738c446c199 100644 --- a/drivers/virtio/Makefile +++ b/drivers/virtio/Makefile | |||
@@ -1,2 +1,4 @@ | |||
1 | obj-$(CONFIG_VIRTIO) += virtio.o | 1 | obj-$(CONFIG_VIRTIO) += virtio.o |
2 | obj-$(CONFIG_VIRTIO_RING) += virtio_ring.o | 2 | obj-$(CONFIG_VIRTIO_RING) += virtio_ring.o |
3 | obj-$(CONFIG_VIRTIO_PCI) += virtio_pci.o | ||
4 | obj-$(CONFIG_VIRTIO_BALLOON) += virtio_balloon.o | ||
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 69d7ea02cd48..b535483bc556 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
@@ -102,9 +102,13 @@ static int virtio_dev_remove(struct device *_d) | |||
102 | struct virtio_driver *drv = container_of(dev->dev.driver, | 102 | struct virtio_driver *drv = container_of(dev->dev.driver, |
103 | struct virtio_driver, driver); | 103 | struct virtio_driver, driver); |
104 | 104 | ||
105 | dev->config->set_status(dev, dev->config->get_status(dev) | ||
106 | & ~VIRTIO_CONFIG_S_DRIVER); | ||
107 | drv->remove(dev); | 105 | drv->remove(dev); |
106 | |||
107 | /* Driver should have reset device. */ | ||
108 | BUG_ON(dev->config->get_status(dev)); | ||
109 | |||
110 | /* Acknowledge the device's existence again. */ | ||
111 | add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE); | ||
108 | return 0; | 112 | return 0; |
109 | } | 113 | } |
110 | 114 | ||
@@ -130,6 +134,10 @@ int register_virtio_device(struct virtio_device *dev) | |||
130 | dev->dev.bus = &virtio_bus; | 134 | dev->dev.bus = &virtio_bus; |
131 | sprintf(dev->dev.bus_id, "%u", dev->index); | 135 | sprintf(dev->dev.bus_id, "%u", dev->index); |
132 | 136 | ||
137 | /* We always start by resetting the device, in case a previous | ||
138 | * driver messed it up. This also tests that code path a little. */ | ||
139 | dev->config->reset(dev); | ||
140 | |||
133 | /* Acknowledge that we've seen the device. */ | 141 | /* Acknowledge that we've seen the device. */ |
134 | add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE); | 142 | add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE); |
135 | 143 | ||
@@ -148,55 +156,18 @@ void unregister_virtio_device(struct virtio_device *dev) | |||
148 | } | 156 | } |
149 | EXPORT_SYMBOL_GPL(unregister_virtio_device); | 157 | EXPORT_SYMBOL_GPL(unregister_virtio_device); |
150 | 158 | ||
151 | int __virtio_config_val(struct virtio_device *vdev, | ||
152 | u8 type, void *val, size_t size) | ||
153 | { | ||
154 | void *token; | ||
155 | unsigned int len; | ||
156 | |||
157 | token = vdev->config->find(vdev, type, &len); | ||
158 | if (!token) | ||
159 | return -ENOENT; | ||
160 | |||
161 | if (len != size) | ||
162 | return -EIO; | ||
163 | |||
164 | vdev->config->get(vdev, token, val, size); | ||
165 | return 0; | ||
166 | } | ||
167 | EXPORT_SYMBOL_GPL(__virtio_config_val); | ||
168 | |||
169 | int virtio_use_bit(struct virtio_device *vdev, | ||
170 | void *token, unsigned int len, unsigned int bitnum) | ||
171 | { | ||
172 | unsigned long bits[16]; | ||
173 | |||
174 | /* This makes it convenient to pass-through find() results. */ | ||
175 | if (!token) | ||
176 | return 0; | ||
177 | |||
178 | /* bit not in range of this bitfield? */ | ||
179 | if (bitnum * 8 >= len / 2) | ||
180 | return 0; | ||
181 | |||
182 | /* Giant feature bitfields are silly. */ | ||
183 | BUG_ON(len > sizeof(bits)); | ||
184 | vdev->config->get(vdev, token, bits, len); | ||
185 | |||
186 | if (!test_bit(bitnum, bits)) | ||
187 | return 0; | ||
188 | |||
189 | /* Set acknowledge bit, and write it back. */ | ||
190 | set_bit(bitnum + len * 8 / 2, bits); | ||
191 | vdev->config->set(vdev, token, bits, len); | ||
192 | return 1; | ||
193 | } | ||
194 | EXPORT_SYMBOL_GPL(virtio_use_bit); | ||
195 | |||
196 | static int virtio_init(void) | 159 | static int virtio_init(void) |
197 | { | 160 | { |
198 | if (bus_register(&virtio_bus) != 0) | 161 | if (bus_register(&virtio_bus) != 0) |
199 | panic("virtio bus registration failed"); | 162 | panic("virtio bus registration failed"); |
200 | return 0; | 163 | return 0; |
201 | } | 164 | } |
165 | |||
166 | static void __exit virtio_exit(void) | ||
167 | { | ||
168 | bus_unregister(&virtio_bus); | ||
169 | } | ||
202 | core_initcall(virtio_init); | 170 | core_initcall(virtio_init); |
171 | module_exit(virtio_exit); | ||
172 | |||
173 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c new file mode 100644 index 000000000000..622aece1acce --- /dev/null +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -0,0 +1,284 @@ | |||
1 | /* Virtio balloon implementation, inspired by Dor Loar and Marcelo | ||
2 | * Tosatti's implementations. | ||
3 | * | ||
4 | * Copyright 2008 Rusty Russell IBM Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more 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 | //#define DEBUG | ||
21 | #include <linux/virtio.h> | ||
22 | #include <linux/virtio_balloon.h> | ||
23 | #include <linux/swap.h> | ||
24 | #include <linux/kthread.h> | ||
25 | #include <linux/freezer.h> | ||
26 | |||
27 | struct virtio_balloon | ||
28 | { | ||
29 | struct virtio_device *vdev; | ||
30 | struct virtqueue *inflate_vq, *deflate_vq; | ||
31 | |||
32 | /* Where the ballooning thread waits for config to change. */ | ||
33 | wait_queue_head_t config_change; | ||
34 | |||
35 | /* The thread servicing the balloon. */ | ||
36 | struct task_struct *thread; | ||
37 | |||
38 | /* Waiting for host to ack the pages we released. */ | ||
39 | struct completion acked; | ||
40 | |||
41 | /* Do we have to tell Host *before* we reuse pages? */ | ||
42 | bool tell_host_first; | ||
43 | |||
44 | /* The pages we've told the Host we're not using. */ | ||
45 | unsigned int num_pages; | ||
46 | struct list_head pages; | ||
47 | |||
48 | /* The array of pfns we tell the Host about. */ | ||
49 | unsigned int num_pfns; | ||
50 | u32 pfns[256]; | ||
51 | }; | ||
52 | |||
53 | static struct virtio_device_id id_table[] = { | ||
54 | { VIRTIO_ID_BALLOON, VIRTIO_DEV_ANY_ID }, | ||
55 | { 0 }, | ||
56 | }; | ||
57 | |||
58 | static void balloon_ack(struct virtqueue *vq) | ||
59 | { | ||
60 | struct virtio_balloon *vb; | ||
61 | unsigned int len; | ||
62 | |||
63 | vb = vq->vq_ops->get_buf(vq, &len); | ||
64 | if (vb) | ||
65 | complete(&vb->acked); | ||
66 | } | ||
67 | |||
68 | static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) | ||
69 | { | ||
70 | struct scatterlist sg; | ||
71 | |||
72 | sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); | ||
73 | |||
74 | init_completion(&vb->acked); | ||
75 | |||
76 | /* We should always be able to add one buffer to an empty queue. */ | ||
77 | if (vq->vq_ops->add_buf(vq, &sg, 1, 0, vb) != 0) | ||
78 | BUG(); | ||
79 | vq->vq_ops->kick(vq); | ||
80 | |||
81 | /* When host has read buffer, this completes via balloon_ack */ | ||
82 | wait_for_completion(&vb->acked); | ||
83 | } | ||
84 | |||
85 | static void fill_balloon(struct virtio_balloon *vb, size_t num) | ||
86 | { | ||
87 | /* We can only do one array worth at a time. */ | ||
88 | num = min(num, ARRAY_SIZE(vb->pfns)); | ||
89 | |||
90 | for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { | ||
91 | struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY); | ||
92 | if (!page) { | ||
93 | if (printk_ratelimit()) | ||
94 | dev_printk(KERN_INFO, &vb->vdev->dev, | ||
95 | "Out of puff! Can't get %zu pages\n", | ||
96 | num); | ||
97 | /* Sleep for at least 1/5 of a second before retry. */ | ||
98 | msleep(200); | ||
99 | break; | ||
100 | } | ||
101 | vb->pfns[vb->num_pfns] = page_to_pfn(page); | ||
102 | totalram_pages--; | ||
103 | vb->num_pages++; | ||
104 | list_add(&page->lru, &vb->pages); | ||
105 | } | ||
106 | |||
107 | /* Didn't get any? Oh well. */ | ||
108 | if (vb->num_pfns == 0) | ||
109 | return; | ||
110 | |||
111 | tell_host(vb, vb->inflate_vq); | ||
112 | } | ||
113 | |||
114 | static void release_pages_by_pfn(const u32 pfns[], unsigned int num) | ||
115 | { | ||
116 | unsigned int i; | ||
117 | |||
118 | for (i = 0; i < num; i++) { | ||
119 | __free_page(pfn_to_page(pfns[i])); | ||
120 | totalram_pages++; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | static void leak_balloon(struct virtio_balloon *vb, size_t num) | ||
125 | { | ||
126 | struct page *page; | ||
127 | |||
128 | /* We can only do one array worth at a time. */ | ||
129 | num = min(num, ARRAY_SIZE(vb->pfns)); | ||
130 | |||
131 | for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { | ||
132 | page = list_first_entry(&vb->pages, struct page, lru); | ||
133 | list_del(&page->lru); | ||
134 | vb->pfns[vb->num_pfns] = page_to_pfn(page); | ||
135 | vb->num_pages--; | ||
136 | } | ||
137 | |||
138 | if (vb->tell_host_first) { | ||
139 | tell_host(vb, vb->deflate_vq); | ||
140 | release_pages_by_pfn(vb->pfns, vb->num_pfns); | ||
141 | } else { | ||
142 | release_pages_by_pfn(vb->pfns, vb->num_pfns); | ||
143 | tell_host(vb, vb->deflate_vq); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | static void virtballoon_changed(struct virtio_device *vdev) | ||
148 | { | ||
149 | struct virtio_balloon *vb = vdev->priv; | ||
150 | |||
151 | wake_up(&vb->config_change); | ||
152 | } | ||
153 | |||
154 | static inline int towards_target(struct virtio_balloon *vb) | ||
155 | { | ||
156 | u32 v; | ||
157 | __virtio_config_val(vb->vdev, | ||
158 | offsetof(struct virtio_balloon_config, num_pages), | ||
159 | &v); | ||
160 | return v - vb->num_pages; | ||
161 | } | ||
162 | |||
163 | static void update_balloon_size(struct virtio_balloon *vb) | ||
164 | { | ||
165 | __le32 actual = cpu_to_le32(vb->num_pages); | ||
166 | |||
167 | vb->vdev->config->set(vb->vdev, | ||
168 | offsetof(struct virtio_balloon_config, actual), | ||
169 | &actual, sizeof(actual)); | ||
170 | } | ||
171 | |||
172 | static int balloon(void *_vballoon) | ||
173 | { | ||
174 | struct virtio_balloon *vb = _vballoon; | ||
175 | |||
176 | set_freezable(); | ||
177 | while (!kthread_should_stop()) { | ||
178 | int diff; | ||
179 | |||
180 | try_to_freeze(); | ||
181 | wait_event_interruptible(vb->config_change, | ||
182 | (diff = towards_target(vb)) != 0 | ||
183 | || kthread_should_stop()); | ||
184 | if (diff > 0) | ||
185 | fill_balloon(vb, diff); | ||
186 | else if (diff < 0) | ||
187 | leak_balloon(vb, -diff); | ||
188 | update_balloon_size(vb); | ||
189 | } | ||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | static int virtballoon_probe(struct virtio_device *vdev) | ||
194 | { | ||
195 | struct virtio_balloon *vb; | ||
196 | int err; | ||
197 | |||
198 | vdev->priv = vb = kmalloc(sizeof(*vb), GFP_KERNEL); | ||
199 | if (!vb) { | ||
200 | err = -ENOMEM; | ||
201 | goto out; | ||
202 | } | ||
203 | |||
204 | INIT_LIST_HEAD(&vb->pages); | ||
205 | vb->num_pages = 0; | ||
206 | init_waitqueue_head(&vb->config_change); | ||
207 | vb->vdev = vdev; | ||
208 | |||
209 | /* We expect two virtqueues. */ | ||
210 | vb->inflate_vq = vdev->config->find_vq(vdev, 0, balloon_ack); | ||
211 | if (IS_ERR(vb->inflate_vq)) { | ||
212 | err = PTR_ERR(vb->inflate_vq); | ||
213 | goto out_free_vb; | ||
214 | } | ||
215 | |||
216 | vb->deflate_vq = vdev->config->find_vq(vdev, 1, balloon_ack); | ||
217 | if (IS_ERR(vb->deflate_vq)) { | ||
218 | err = PTR_ERR(vb->deflate_vq); | ||
219 | goto out_del_inflate_vq; | ||
220 | } | ||
221 | |||
222 | vb->thread = kthread_run(balloon, vb, "vballoon"); | ||
223 | if (IS_ERR(vb->thread)) { | ||
224 | err = PTR_ERR(vb->thread); | ||
225 | goto out_del_deflate_vq; | ||
226 | } | ||
227 | |||
228 | vb->tell_host_first | ||
229 | = vdev->config->feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST); | ||
230 | |||
231 | return 0; | ||
232 | |||
233 | out_del_deflate_vq: | ||
234 | vdev->config->del_vq(vb->deflate_vq); | ||
235 | out_del_inflate_vq: | ||
236 | vdev->config->del_vq(vb->inflate_vq); | ||
237 | out_free_vb: | ||
238 | kfree(vb); | ||
239 | out: | ||
240 | return err; | ||
241 | } | ||
242 | |||
243 | static void virtballoon_remove(struct virtio_device *vdev) | ||
244 | { | ||
245 | struct virtio_balloon *vb = vdev->priv; | ||
246 | |||
247 | kthread_stop(vb->thread); | ||
248 | |||
249 | /* There might be pages left in the balloon: free them. */ | ||
250 | while (vb->num_pages) | ||
251 | leak_balloon(vb, vb->num_pages); | ||
252 | |||
253 | /* Now we reset the device so we can clean up the queues. */ | ||
254 | vdev->config->reset(vdev); | ||
255 | |||
256 | vdev->config->del_vq(vb->deflate_vq); | ||
257 | vdev->config->del_vq(vb->inflate_vq); | ||
258 | kfree(vb); | ||
259 | } | ||
260 | |||
261 | static struct virtio_driver virtio_balloon = { | ||
262 | .driver.name = KBUILD_MODNAME, | ||
263 | .driver.owner = THIS_MODULE, | ||
264 | .id_table = id_table, | ||
265 | .probe = virtballoon_probe, | ||
266 | .remove = __devexit_p(virtballoon_remove), | ||
267 | .config_changed = virtballoon_changed, | ||
268 | }; | ||
269 | |||
270 | static int __init init(void) | ||
271 | { | ||
272 | return register_virtio_driver(&virtio_balloon); | ||
273 | } | ||
274 | |||
275 | static void __exit fini(void) | ||
276 | { | ||
277 | unregister_virtio_driver(&virtio_balloon); | ||
278 | } | ||
279 | module_init(init); | ||
280 | module_exit(fini); | ||
281 | |||
282 | MODULE_DEVICE_TABLE(virtio, id_table); | ||
283 | MODULE_DESCRIPTION("Virtio balloon driver"); | ||
284 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c new file mode 100644 index 000000000000..26f787ddd5ff --- /dev/null +++ b/drivers/virtio/virtio_pci.c | |||
@@ -0,0 +1,446 @@ | |||
1 | /* | ||
2 | * Virtio PCI driver | ||
3 | * | ||
4 | * This module allows virtio devices to be used over a virtual PCI device. | ||
5 | * This can be used with QEMU based VMMs like KVM or Xen. | ||
6 | * | ||
7 | * Copyright IBM Corp. 2007 | ||
8 | * | ||
9 | * Authors: | ||
10 | * Anthony Liguori <aliguori@us.ibm.com> | ||
11 | * | ||
12 | * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
13 | * See the COPYING file in the top-level directory. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <linux/list.h> | ||
19 | #include <linux/pci.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/virtio.h> | ||
22 | #include <linux/virtio_config.h> | ||
23 | #include <linux/virtio_ring.h> | ||
24 | #include <linux/virtio_pci.h> | ||
25 | #include <linux/highmem.h> | ||
26 | #include <linux/spinlock.h> | ||
27 | |||
28 | MODULE_AUTHOR("Anthony Liguori <aliguori@us.ibm.com>"); | ||
29 | MODULE_DESCRIPTION("virtio-pci"); | ||
30 | MODULE_LICENSE("GPL"); | ||
31 | MODULE_VERSION("1"); | ||
32 | |||
33 | /* Our device structure */ | ||
34 | struct virtio_pci_device | ||
35 | { | ||
36 | struct virtio_device vdev; | ||
37 | struct pci_dev *pci_dev; | ||
38 | |||
39 | /* the IO mapping for the PCI config space */ | ||
40 | void *ioaddr; | ||
41 | |||
42 | /* a list of queues so we can dispatch IRQs */ | ||
43 | spinlock_t lock; | ||
44 | struct list_head virtqueues; | ||
45 | }; | ||
46 | |||
47 | struct virtio_pci_vq_info | ||
48 | { | ||
49 | /* the actual virtqueue */ | ||
50 | struct virtqueue *vq; | ||
51 | |||
52 | /* the number of entries in the queue */ | ||
53 | int num; | ||
54 | |||
55 | /* the index of the queue */ | ||
56 | int queue_index; | ||
57 | |||
58 | /* the virtual address of the ring queue */ | ||
59 | void *queue; | ||
60 | |||
61 | /* the list node for the virtqueues list */ | ||
62 | struct list_head node; | ||
63 | }; | ||
64 | |||
65 | /* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. */ | ||
66 | static struct pci_device_id virtio_pci_id_table[] = { | ||
67 | { 0x1af4, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | ||
68 | { 0 }, | ||
69 | }; | ||
70 | |||
71 | MODULE_DEVICE_TABLE(pci, virtio_pci_id_table); | ||
72 | |||
73 | /* A PCI device has it's own struct device and so does a virtio device so | ||
74 | * we create a place for the virtio devices to show up in sysfs. I think it | ||
75 | * would make more sense for virtio to not insist on having it's own device. */ | ||
76 | static struct device virtio_pci_root = { | ||
77 | .parent = NULL, | ||
78 | .bus_id = "virtio-pci", | ||
79 | }; | ||
80 | |||
81 | /* Unique numbering for devices under the kvm root */ | ||
82 | static unsigned int dev_index; | ||
83 | |||
84 | /* Convert a generic virtio device to our structure */ | ||
85 | static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) | ||
86 | { | ||
87 | return container_of(vdev, struct virtio_pci_device, vdev); | ||
88 | } | ||
89 | |||
90 | /* virtio config->feature() implementation */ | ||
91 | static bool vp_feature(struct virtio_device *vdev, unsigned bit) | ||
92 | { | ||
93 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | ||
94 | u32 mask; | ||
95 | |||
96 | /* Since this function is supposed to have the side effect of | ||
97 | * enabling a queried feature, we simulate that by doing a read | ||
98 | * from the host feature bitmask and then writing to the guest | ||
99 | * feature bitmask */ | ||
100 | mask = ioread32(vp_dev->ioaddr + VIRTIO_PCI_HOST_FEATURES); | ||
101 | if (mask & (1 << bit)) { | ||
102 | mask |= (1 << bit); | ||
103 | iowrite32(mask, vp_dev->ioaddr + VIRTIO_PCI_GUEST_FEATURES); | ||
104 | } | ||
105 | |||
106 | return !!(mask & (1 << bit)); | ||
107 | } | ||
108 | |||
109 | /* virtio config->get() implementation */ | ||
110 | static void vp_get(struct virtio_device *vdev, unsigned offset, | ||
111 | void *buf, unsigned len) | ||
112 | { | ||
113 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | ||
114 | void *ioaddr = vp_dev->ioaddr + VIRTIO_PCI_CONFIG + offset; | ||
115 | u8 *ptr = buf; | ||
116 | int i; | ||
117 | |||
118 | for (i = 0; i < len; i++) | ||
119 | ptr[i] = ioread8(ioaddr + i); | ||
120 | } | ||
121 | |||
122 | /* the config->set() implementation. it's symmetric to the config->get() | ||
123 | * implementation */ | ||
124 | static void vp_set(struct virtio_device *vdev, unsigned offset, | ||
125 | const void *buf, unsigned len) | ||
126 | { | ||
127 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | ||
128 | void *ioaddr = vp_dev->ioaddr + VIRTIO_PCI_CONFIG + offset; | ||
129 | const u8 *ptr = buf; | ||
130 | int i; | ||
131 | |||
132 | for (i = 0; i < len; i++) | ||
133 | iowrite8(ptr[i], ioaddr + i); | ||
134 | } | ||
135 | |||
136 | /* config->{get,set}_status() implementations */ | ||
137 | static u8 vp_get_status(struct virtio_device *vdev) | ||
138 | { | ||
139 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | ||
140 | return ioread8(vp_dev->ioaddr + VIRTIO_PCI_STATUS); | ||
141 | } | ||
142 | |||
143 | static void vp_set_status(struct virtio_device *vdev, u8 status) | ||
144 | { | ||
145 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | ||
146 | /* We should never be setting status to 0. */ | ||
147 | BUG_ON(status == 0); | ||
148 | return iowrite8(status, vp_dev->ioaddr + VIRTIO_PCI_STATUS); | ||
149 | } | ||
150 | |||
151 | static void vp_reset(struct virtio_device *vdev) | ||
152 | { | ||
153 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | ||
154 | /* 0 status means a reset. */ | ||
155 | return iowrite8(0, vp_dev->ioaddr + VIRTIO_PCI_STATUS); | ||
156 | } | ||
157 | |||
158 | /* the notify function used when creating a virt queue */ | ||
159 | static void vp_notify(struct virtqueue *vq) | ||
160 | { | ||
161 | struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); | ||
162 | struct virtio_pci_vq_info *info = vq->priv; | ||
163 | |||
164 | /* we write the queue's selector into the notification register to | ||
165 | * signal the other end */ | ||
166 | iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY); | ||
167 | } | ||
168 | |||
169 | /* A small wrapper to also acknowledge the interrupt when it's handled. | ||
170 | * I really need an EIO hook for the vring so I can ack the interrupt once we | ||
171 | * know that we'll be handling the IRQ but before we invoke the callback since | ||
172 | * the callback may notify the host which results in the host attempting to | ||
173 | * raise an interrupt that we would then mask once we acknowledged the | ||
174 | * interrupt. */ | ||
175 | static irqreturn_t vp_interrupt(int irq, void *opaque) | ||
176 | { | ||
177 | struct virtio_pci_device *vp_dev = opaque; | ||
178 | struct virtio_pci_vq_info *info; | ||
179 | irqreturn_t ret = IRQ_NONE; | ||
180 | u8 isr; | ||
181 | |||
182 | /* reading the ISR has the effect of also clearing it so it's very | ||
183 | * important to save off the value. */ | ||
184 | isr = ioread8(vp_dev->ioaddr + VIRTIO_PCI_ISR); | ||
185 | |||
186 | /* It's definitely not us if the ISR was not high */ | ||
187 | if (!isr) | ||
188 | return IRQ_NONE; | ||
189 | |||
190 | /* Configuration change? Tell driver if it wants to know. */ | ||
191 | if (isr & VIRTIO_PCI_ISR_CONFIG) { | ||
192 | struct virtio_driver *drv; | ||
193 | drv = container_of(vp_dev->vdev.dev.driver, | ||
194 | struct virtio_driver, driver); | ||
195 | |||
196 | if (drv->config_changed) | ||
197 | drv->config_changed(&vp_dev->vdev); | ||
198 | } | ||
199 | |||
200 | spin_lock(&vp_dev->lock); | ||
201 | list_for_each_entry(info, &vp_dev->virtqueues, node) { | ||
202 | if (vring_interrupt(irq, info->vq) == IRQ_HANDLED) | ||
203 | ret = IRQ_HANDLED; | ||
204 | } | ||
205 | spin_unlock(&vp_dev->lock); | ||
206 | |||
207 | return ret; | ||
208 | } | ||
209 | |||
210 | /* the config->find_vq() implementation */ | ||
211 | static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index, | ||
212 | void (*callback)(struct virtqueue *vq)) | ||
213 | { | ||
214 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | ||
215 | struct virtio_pci_vq_info *info; | ||
216 | struct virtqueue *vq; | ||
217 | u16 num; | ||
218 | int err; | ||
219 | |||
220 | /* Select the queue we're interested in */ | ||
221 | iowrite16(index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL); | ||
222 | |||
223 | /* Check if queue is either not available or already active. */ | ||
224 | num = ioread16(vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NUM); | ||
225 | if (!num || ioread32(vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN)) | ||
226 | return ERR_PTR(-ENOENT); | ||
227 | |||
228 | /* allocate and fill out our structure the represents an active | ||
229 | * queue */ | ||
230 | info = kmalloc(sizeof(struct virtio_pci_vq_info), GFP_KERNEL); | ||
231 | if (!info) | ||
232 | return ERR_PTR(-ENOMEM); | ||
233 | |||
234 | info->queue_index = index; | ||
235 | info->num = num; | ||
236 | |||
237 | info->queue = kzalloc(PAGE_ALIGN(vring_size(num,PAGE_SIZE)), GFP_KERNEL); | ||
238 | if (info->queue == NULL) { | ||
239 | err = -ENOMEM; | ||
240 | goto out_info; | ||
241 | } | ||
242 | |||
243 | /* activate the queue */ | ||
244 | iowrite32(virt_to_phys(info->queue) >> PAGE_SHIFT, | ||
245 | vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN); | ||
246 | |||
247 | /* create the vring */ | ||
248 | vq = vring_new_virtqueue(info->num, vdev, info->queue, | ||
249 | vp_notify, callback); | ||
250 | if (!vq) { | ||
251 | err = -ENOMEM; | ||
252 | goto out_activate_queue; | ||
253 | } | ||
254 | |||
255 | vq->priv = info; | ||
256 | info->vq = vq; | ||
257 | |||
258 | spin_lock(&vp_dev->lock); | ||
259 | list_add(&info->node, &vp_dev->virtqueues); | ||
260 | spin_unlock(&vp_dev->lock); | ||
261 | |||
262 | return vq; | ||
263 | |||
264 | out_activate_queue: | ||
265 | iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN); | ||
266 | kfree(info->queue); | ||
267 | out_info: | ||
268 | kfree(info); | ||
269 | return ERR_PTR(err); | ||
270 | } | ||
271 | |||
272 | /* the config->del_vq() implementation */ | ||
273 | static void vp_del_vq(struct virtqueue *vq) | ||
274 | { | ||
275 | struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); | ||
276 | struct virtio_pci_vq_info *info = vq->priv; | ||
277 | |||
278 | spin_lock(&vp_dev->lock); | ||
279 | list_del(&info->node); | ||
280 | spin_unlock(&vp_dev->lock); | ||
281 | |||
282 | vring_del_virtqueue(vq); | ||
283 | |||
284 | /* Select and deactivate the queue */ | ||
285 | iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL); | ||
286 | iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN); | ||
287 | |||
288 | kfree(info->queue); | ||
289 | kfree(info); | ||
290 | } | ||
291 | |||
292 | static struct virtio_config_ops virtio_pci_config_ops = { | ||
293 | .feature = vp_feature, | ||
294 | .get = vp_get, | ||
295 | .set = vp_set, | ||
296 | .get_status = vp_get_status, | ||
297 | .set_status = vp_set_status, | ||
298 | .reset = vp_reset, | ||
299 | .find_vq = vp_find_vq, | ||
300 | .del_vq = vp_del_vq, | ||
301 | }; | ||
302 | |||
303 | /* the PCI probing function */ | ||
304 | static int __devinit virtio_pci_probe(struct pci_dev *pci_dev, | ||
305 | const struct pci_device_id *id) | ||
306 | { | ||
307 | struct virtio_pci_device *vp_dev; | ||
308 | int err; | ||
309 | |||
310 | /* We only own devices >= 0x1000 and <= 0x103f: leave the rest. */ | ||
311 | if (pci_dev->device < 0x1000 || pci_dev->device > 0x103f) | ||
312 | return -ENODEV; | ||
313 | |||
314 | if (pci_dev->revision != VIRTIO_PCI_ABI_VERSION) { | ||
315 | printk(KERN_ERR "virtio_pci: expected ABI version %d, got %d\n", | ||
316 | VIRTIO_PCI_ABI_VERSION, pci_dev->revision); | ||
317 | return -ENODEV; | ||
318 | } | ||
319 | |||
320 | /* allocate our structure and fill it out */ | ||
321 | vp_dev = kzalloc(sizeof(struct virtio_pci_device), GFP_KERNEL); | ||
322 | if (vp_dev == NULL) | ||
323 | return -ENOMEM; | ||
324 | |||
325 | snprintf(vp_dev->vdev.dev.bus_id, BUS_ID_SIZE, "virtio%d", dev_index); | ||
326 | vp_dev->vdev.index = dev_index; | ||
327 | dev_index++; | ||
328 | |||
329 | vp_dev->vdev.dev.parent = &virtio_pci_root; | ||
330 | vp_dev->vdev.config = &virtio_pci_config_ops; | ||
331 | vp_dev->pci_dev = pci_dev; | ||
332 | INIT_LIST_HEAD(&vp_dev->virtqueues); | ||
333 | spin_lock_init(&vp_dev->lock); | ||
334 | |||
335 | /* enable the device */ | ||
336 | err = pci_enable_device(pci_dev); | ||
337 | if (err) | ||
338 | goto out; | ||
339 | |||
340 | err = pci_request_regions(pci_dev, "virtio-pci"); | ||
341 | if (err) | ||
342 | goto out_enable_device; | ||
343 | |||
344 | vp_dev->ioaddr = pci_iomap(pci_dev, 0, 0); | ||
345 | if (vp_dev->ioaddr == NULL) | ||
346 | goto out_req_regions; | ||
347 | |||
348 | pci_set_drvdata(pci_dev, vp_dev); | ||
349 | |||
350 | /* we use the subsystem vendor/device id as the virtio vendor/device | ||
351 | * id. this allows us to use the same PCI vendor/device id for all | ||
352 | * virtio devices and to identify the particular virtio driver by | ||
353 | * the subsytem ids */ | ||
354 | vp_dev->vdev.id.vendor = pci_dev->subsystem_vendor; | ||
355 | vp_dev->vdev.id.device = pci_dev->subsystem_device; | ||
356 | |||
357 | /* register a handler for the queue with the PCI device's interrupt */ | ||
358 | err = request_irq(vp_dev->pci_dev->irq, vp_interrupt, IRQF_SHARED, | ||
359 | vp_dev->vdev.dev.bus_id, vp_dev); | ||
360 | if (err) | ||
361 | goto out_set_drvdata; | ||
362 | |||
363 | /* finally register the virtio device */ | ||
364 | err = register_virtio_device(&vp_dev->vdev); | ||
365 | if (err) | ||
366 | goto out_req_irq; | ||
367 | |||
368 | return 0; | ||
369 | |||
370 | out_req_irq: | ||
371 | free_irq(pci_dev->irq, vp_dev); | ||
372 | out_set_drvdata: | ||
373 | pci_set_drvdata(pci_dev, NULL); | ||
374 | pci_iounmap(pci_dev, vp_dev->ioaddr); | ||
375 | out_req_regions: | ||
376 | pci_release_regions(pci_dev); | ||
377 | out_enable_device: | ||
378 | pci_disable_device(pci_dev); | ||
379 | out: | ||
380 | kfree(vp_dev); | ||
381 | return err; | ||
382 | } | ||
383 | |||
384 | static void __devexit virtio_pci_remove(struct pci_dev *pci_dev) | ||
385 | { | ||
386 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); | ||
387 | |||
388 | free_irq(pci_dev->irq, vp_dev); | ||
389 | pci_set_drvdata(pci_dev, NULL); | ||
390 | pci_iounmap(pci_dev, vp_dev->ioaddr); | ||
391 | pci_release_regions(pci_dev); | ||
392 | pci_disable_device(pci_dev); | ||
393 | kfree(vp_dev); | ||
394 | } | ||
395 | |||
396 | #ifdef CONFIG_PM | ||
397 | static int virtio_pci_suspend(struct pci_dev *pci_dev, pm_message_t state) | ||
398 | { | ||
399 | pci_save_state(pci_dev); | ||
400 | pci_set_power_state(pci_dev, PCI_D3hot); | ||
401 | return 0; | ||
402 | } | ||
403 | |||
404 | static int virtio_pci_resume(struct pci_dev *pci_dev) | ||
405 | { | ||
406 | pci_restore_state(pci_dev); | ||
407 | pci_set_power_state(pci_dev, PCI_D0); | ||
408 | return 0; | ||
409 | } | ||
410 | #endif | ||
411 | |||
412 | static struct pci_driver virtio_pci_driver = { | ||
413 | .name = "virtio-pci", | ||
414 | .id_table = virtio_pci_id_table, | ||
415 | .probe = virtio_pci_probe, | ||
416 | .remove = virtio_pci_remove, | ||
417 | #ifdef CONFIG_PM | ||
418 | .suspend = virtio_pci_suspend, | ||
419 | .resume = virtio_pci_resume, | ||
420 | #endif | ||
421 | }; | ||
422 | |||
423 | static int __init virtio_pci_init(void) | ||
424 | { | ||
425 | int err; | ||
426 | |||
427 | err = device_register(&virtio_pci_root); | ||
428 | if (err) | ||
429 | return err; | ||
430 | |||
431 | err = pci_register_driver(&virtio_pci_driver); | ||
432 | if (err) | ||
433 | device_unregister(&virtio_pci_root); | ||
434 | |||
435 | return err; | ||
436 | } | ||
437 | |||
438 | module_init(virtio_pci_init); | ||
439 | |||
440 | static void __exit virtio_pci_exit(void) | ||
441 | { | ||
442 | device_unregister(&virtio_pci_root); | ||
443 | pci_unregister_driver(&virtio_pci_driver); | ||
444 | } | ||
445 | |||
446 | module_exit(virtio_pci_exit); | ||
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1dc04b6684e6..3a28c1382131 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -87,6 +87,8 @@ static int vring_add_buf(struct virtqueue *_vq, | |||
87 | if (vq->num_free < out + in) { | 87 | if (vq->num_free < out + in) { |
88 | pr_debug("Can't add buf len %i - avail = %i\n", | 88 | pr_debug("Can't add buf len %i - avail = %i\n", |
89 | out + in, vq->num_free); | 89 | out + in, vq->num_free); |
90 | /* We notify *even if* VRING_USED_F_NO_NOTIFY is set here. */ | ||
91 | vq->notify(&vq->vq); | ||
90 | END_USE(vq); | 92 | END_USE(vq); |
91 | return -ENOSPC; | 93 | return -ENOSPC; |
92 | } | 94 | } |
@@ -97,16 +99,14 @@ static int vring_add_buf(struct virtqueue *_vq, | |||
97 | head = vq->free_head; | 99 | head = vq->free_head; |
98 | for (i = vq->free_head; out; i = vq->vring.desc[i].next, out--) { | 100 | for (i = vq->free_head; out; i = vq->vring.desc[i].next, out--) { |
99 | vq->vring.desc[i].flags = VRING_DESC_F_NEXT; | 101 | vq->vring.desc[i].flags = VRING_DESC_F_NEXT; |
100 | vq->vring.desc[i].addr = (page_to_pfn(sg_page(sg))<<PAGE_SHIFT) | 102 | vq->vring.desc[i].addr = sg_phys(sg); |
101 | + sg->offset; | ||
102 | vq->vring.desc[i].len = sg->length; | 103 | vq->vring.desc[i].len = sg->length; |
103 | prev = i; | 104 | prev = i; |
104 | sg++; | 105 | sg++; |
105 | } | 106 | } |
106 | for (; in; i = vq->vring.desc[i].next, in--) { | 107 | for (; in; i = vq->vring.desc[i].next, in--) { |
107 | vq->vring.desc[i].flags = VRING_DESC_F_NEXT|VRING_DESC_F_WRITE; | 108 | vq->vring.desc[i].flags = VRING_DESC_F_NEXT|VRING_DESC_F_WRITE; |
108 | vq->vring.desc[i].addr = (page_to_pfn(sg_page(sg))<<PAGE_SHIFT) | 109 | vq->vring.desc[i].addr = sg_phys(sg); |
109 | + sg->offset; | ||
110 | vq->vring.desc[i].len = sg->length; | 110 | vq->vring.desc[i].len = sg->length; |
111 | prev = i; | 111 | prev = i; |
112 | sg++; | 112 | sg++; |
@@ -171,16 +171,6 @@ static void detach_buf(struct vring_virtqueue *vq, unsigned int head) | |||
171 | vq->num_free++; | 171 | vq->num_free++; |
172 | } | 172 | } |
173 | 173 | ||
174 | /* FIXME: We need to tell other side about removal, to synchronize. */ | ||
175 | static void vring_shutdown(struct virtqueue *_vq) | ||
176 | { | ||
177 | struct vring_virtqueue *vq = to_vvq(_vq); | ||
178 | unsigned int i; | ||
179 | |||
180 | for (i = 0; i < vq->vring.num; i++) | ||
181 | detach_buf(vq, i); | ||
182 | } | ||
183 | |||
184 | static inline bool more_used(const struct vring_virtqueue *vq) | 174 | static inline bool more_used(const struct vring_virtqueue *vq) |
185 | { | 175 | { |
186 | return vq->last_used_idx != vq->vring.used->idx; | 176 | return vq->last_used_idx != vq->vring.used->idx; |
@@ -220,7 +210,17 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len) | |||
220 | return ret; | 210 | return ret; |
221 | } | 211 | } |
222 | 212 | ||
223 | static bool vring_restart(struct virtqueue *_vq) | 213 | static void vring_disable_cb(struct virtqueue *_vq) |
214 | { | ||
215 | struct vring_virtqueue *vq = to_vvq(_vq); | ||
216 | |||
217 | START_USE(vq); | ||
218 | BUG_ON(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT); | ||
219 | vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; | ||
220 | END_USE(vq); | ||
221 | } | ||
222 | |||
223 | static bool vring_enable_cb(struct virtqueue *_vq) | ||
224 | { | 224 | { |
225 | struct vring_virtqueue *vq = to_vvq(_vq); | 225 | struct vring_virtqueue *vq = to_vvq(_vq); |
226 | 226 | ||
@@ -253,26 +253,34 @@ irqreturn_t vring_interrupt(int irq, void *_vq) | |||
253 | if (unlikely(vq->broken)) | 253 | if (unlikely(vq->broken)) |
254 | return IRQ_HANDLED; | 254 | return IRQ_HANDLED; |
255 | 255 | ||
256 | /* Other side may have missed us turning off the interrupt, | ||
257 | * but we should preserve disable semantic for virtio users. */ | ||
258 | if (unlikely(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) { | ||
259 | pr_debug("virtqueue interrupt after disable for %p\n", vq); | ||
260 | return IRQ_HANDLED; | ||
261 | } | ||
262 | |||
256 | pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); | 263 | pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); |
257 | if (vq->vq.callback && !vq->vq.callback(&vq->vq)) | 264 | if (vq->vq.callback) |
258 | vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; | 265 | vq->vq.callback(&vq->vq); |
259 | 266 | ||
260 | return IRQ_HANDLED; | 267 | return IRQ_HANDLED; |
261 | } | 268 | } |
269 | EXPORT_SYMBOL_GPL(vring_interrupt); | ||
262 | 270 | ||
263 | static struct virtqueue_ops vring_vq_ops = { | 271 | static struct virtqueue_ops vring_vq_ops = { |
264 | .add_buf = vring_add_buf, | 272 | .add_buf = vring_add_buf, |
265 | .get_buf = vring_get_buf, | 273 | .get_buf = vring_get_buf, |
266 | .kick = vring_kick, | 274 | .kick = vring_kick, |
267 | .restart = vring_restart, | 275 | .disable_cb = vring_disable_cb, |
268 | .shutdown = vring_shutdown, | 276 | .enable_cb = vring_enable_cb, |
269 | }; | 277 | }; |
270 | 278 | ||
271 | struct virtqueue *vring_new_virtqueue(unsigned int num, | 279 | struct virtqueue *vring_new_virtqueue(unsigned int num, |
272 | struct virtio_device *vdev, | 280 | struct virtio_device *vdev, |
273 | void *pages, | 281 | void *pages, |
274 | void (*notify)(struct virtqueue *), | 282 | void (*notify)(struct virtqueue *), |
275 | bool (*callback)(struct virtqueue *)) | 283 | void (*callback)(struct virtqueue *)) |
276 | { | 284 | { |
277 | struct vring_virtqueue *vq; | 285 | struct vring_virtqueue *vq; |
278 | unsigned int i; | 286 | unsigned int i; |
@@ -311,9 +319,12 @@ struct virtqueue *vring_new_virtqueue(unsigned int num, | |||
311 | 319 | ||
312 | return &vq->vq; | 320 | return &vq->vq; |
313 | } | 321 | } |
322 | EXPORT_SYMBOL_GPL(vring_new_virtqueue); | ||
314 | 323 | ||
315 | void vring_del_virtqueue(struct virtqueue *vq) | 324 | void vring_del_virtqueue(struct virtqueue *vq) |
316 | { | 325 | { |
317 | kfree(to_vvq(vq)); | 326 | kfree(to_vvq(vq)); |
318 | } | 327 | } |
328 | EXPORT_SYMBOL_GPL(vring_del_virtqueue); | ||
319 | 329 | ||
330 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c index cecbedd473a4..61dde863bd40 100644 --- a/drivers/watchdog/shwdt.c +++ b/drivers/watchdog/shwdt.c | |||
@@ -52,7 +52,7 @@ | |||
52 | * overflow periods respectively. | 52 | * overflow periods respectively. |
53 | * | 53 | * |
54 | * Also, since we can't really expect userspace to be responsive enough | 54 | * Also, since we can't really expect userspace to be responsive enough |
55 | * before the overflow happens, we maintain two seperate timers .. One in | 55 | * before the overflow happens, we maintain two separate timers .. One in |
56 | * the kernel for clearing out WOVF every 2ms or so (again, this depends on | 56 | * the kernel for clearing out WOVF every 2ms or so (again, this depends on |
57 | * HZ == 1000), and another for monitoring userspace writes to the WDT device. | 57 | * HZ == 1000), and another for monitoring userspace writes to the WDT device. |
58 | * | 58 | * |
diff --git a/fs/befs/btree.c b/fs/befs/btree.c index af5bb93276f8..4202db7496cb 100644 --- a/fs/befs/btree.c +++ b/fs/befs/btree.c | |||
@@ -232,7 +232,7 @@ befs_bt_read_node(struct super_block *sb, befs_data_stream * ds, | |||
232 | * @key: Key string to lookup in btree | 232 | * @key: Key string to lookup in btree |
233 | * @value: Value stored with @key | 233 | * @value: Value stored with @key |
234 | * | 234 | * |
235 | * On sucess, returns BEFS_OK and sets *@value to the value stored | 235 | * On success, returns BEFS_OK and sets *@value to the value stored |
236 | * with @key (usually the disk block number of an inode). | 236 | * with @key (usually the disk block number of an inode). |
237 | * | 237 | * |
238 | * On failure, returns BEFS_ERR or BEFS_BT_NOT_FOUND. | 238 | * On failure, returns BEFS_ERR or BEFS_BT_NOT_FOUND. |
diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index aacb4da6298a..e3287d0d1a58 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c | |||
@@ -236,7 +236,7 @@ befs_count_blocks(struct super_block * sb, befs_data_stream * ds) | |||
236 | as in the indirect region code). | 236 | as in the indirect region code). |
237 | 237 | ||
238 | When/if blockno is found, if blockno is inside of a block | 238 | When/if blockno is found, if blockno is inside of a block |
239 | run as stored on disk, we offset the start and lenght members | 239 | run as stored on disk, we offset the start and length members |
240 | of the block run, so that blockno is the start and len is | 240 | of the block run, so that blockno is the start and len is |
241 | still valid (the run ends in the same place). | 241 | still valid (the run ends in the same place). |
242 | 242 | ||
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 18ed6dd906c1..4628c42ca892 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -117,7 +117,7 @@ static int padzero(unsigned long elf_bss) | |||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | 119 | ||
120 | /* Let's use some macros to make this stack manipulation a litle clearer */ | 120 | /* Let's use some macros to make this stack manipulation a little clearer */ |
121 | #ifdef CONFIG_STACK_GROWSUP | 121 | #ifdef CONFIG_STACK_GROWSUP |
122 | #define STACK_ADD(sp, items) ((elf_addr_t __user *)(sp) + (items)) | 122 | #define STACK_ADD(sp, items) ((elf_addr_t __user *)(sp) + (items)) |
123 | #define STACK_ROUND(sp, items) \ | 123 | #define STACK_ROUND(sp, items) \ |
diff --git a/fs/freevxfs/vxfs_dir.h b/fs/freevxfs/vxfs_dir.h index 3c96d6e63978..aaf1fb098639 100644 --- a/fs/freevxfs/vxfs_dir.h +++ b/fs/freevxfs/vxfs_dir.h | |||
@@ -41,7 +41,7 @@ | |||
41 | * VxFS directory block header. | 41 | * VxFS directory block header. |
42 | * | 42 | * |
43 | * This entry is the head of every filesystem block in a directory. | 43 | * This entry is the head of every filesystem block in a directory. |
44 | * It is used for free space managment and additionally includes | 44 | * It is used for free space management and additionally includes |
45 | * a hash for speeding up directory search (lookup). | 45 | * a hash for speeding up directory search (lookup). |
46 | * | 46 | * |
47 | * The hash may be empty and in fact we do not use it all in the | 47 | * The hash may be empty and in fact we do not use it all in the |
diff --git a/fs/freevxfs/vxfs_immed.c b/fs/freevxfs/vxfs_immed.c index 24b5a775ff96..8a5959a61ba9 100644 --- a/fs/freevxfs/vxfs_immed.c +++ b/fs/freevxfs/vxfs_immed.c | |||
@@ -54,7 +54,7 @@ const struct inode_operations vxfs_immed_symlink_iops = { | |||
54 | }; | 54 | }; |
55 | 55 | ||
56 | /* | 56 | /* |
57 | * Adress space operations for immed files and directories. | 57 | * Address space operations for immed files and directories. |
58 | */ | 58 | */ |
59 | const struct address_space_operations vxfs_immed_aops = { | 59 | const struct address_space_operations vxfs_immed_aops = { |
60 | .readpage = vxfs_immed_readpage, | 60 | .readpage = vxfs_immed_readpage, |
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index b249e294a95b..6fb07d67ca8a 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c | |||
@@ -450,7 +450,7 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd) | |||
450 | fs_info(sdp, "jid=%u: Trying to acquire journal lock...\n", | 450 | fs_info(sdp, "jid=%u: Trying to acquire journal lock...\n", |
451 | jd->jd_jid); | 451 | jd->jd_jid); |
452 | 452 | ||
453 | /* Aquire the journal lock so we can do recovery */ | 453 | /* Acquire the journal lock so we can do recovery */ |
454 | 454 | ||
455 | error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops, | 455 | error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops, |
456 | LM_ST_EXCLUSIVE, | 456 | LM_ST_EXCLUSIVE, |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 2eae5d2dbebe..6c1ba3566f58 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -741,7 +741,7 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref | |||
741 | * are not obsolete. | 741 | * are not obsolete. |
742 | * | 742 | * |
743 | * Of course, this optimization only makes sense in case | 743 | * Of course, this optimization only makes sense in case |
744 | * of NAND flashes (or other flashes whith | 744 | * of NAND flashes (or other flashes with |
745 | * !jffs2_can_mark_obsolete()), since on NOR flashes | 745 | * !jffs2_can_mark_obsolete()), since on NOR flashes |
746 | * nodes are marked obsolete physically. | 746 | * nodes are marked obsolete physically. |
747 | * | 747 | * |
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c index 1543906a2e0d..a000aaa75136 100644 --- a/fs/jfs/jfs_xtree.c +++ b/fs/jfs/jfs_xtree.c | |||
@@ -3965,7 +3965,7 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) | |||
3965 | * xtTruncate_pmap() | 3965 | * xtTruncate_pmap() |
3966 | * | 3966 | * |
3967 | * function: | 3967 | * function: |
3968 | * Perform truncate to zero lenghth for deleted file, leaving the | 3968 | * Perform truncate to zero length for deleted file, leaving the |
3969 | * the xtree and working map untouched. This allows the file to | 3969 | * the xtree and working map untouched. This allows the file to |
3970 | * be accessed via open file handles, while the delete of the file | 3970 | * be accessed via open file handles, while the delete of the file |
3971 | * is committed to disk. | 3971 | * is committed to disk. |
diff --git a/fs/locks.c b/fs/locks.c index 8b8388eca05e..49354b9c7dc1 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -125,6 +125,7 @@ | |||
125 | #include <linux/syscalls.h> | 125 | #include <linux/syscalls.h> |
126 | #include <linux/time.h> | 126 | #include <linux/time.h> |
127 | #include <linux/rcupdate.h> | 127 | #include <linux/rcupdate.h> |
128 | #include <linux/pid_namespace.h> | ||
128 | 129 | ||
129 | #include <asm/semaphore.h> | 130 | #include <asm/semaphore.h> |
130 | #include <asm/uaccess.h> | 131 | #include <asm/uaccess.h> |
@@ -185,6 +186,7 @@ void locks_init_lock(struct file_lock *fl) | |||
185 | fl->fl_fasync = NULL; | 186 | fl->fl_fasync = NULL; |
186 | fl->fl_owner = NULL; | 187 | fl->fl_owner = NULL; |
187 | fl->fl_pid = 0; | 188 | fl->fl_pid = 0; |
189 | fl->fl_nspid = NULL; | ||
188 | fl->fl_file = NULL; | 190 | fl->fl_file = NULL; |
189 | fl->fl_flags = 0; | 191 | fl->fl_flags = 0; |
190 | fl->fl_type = 0; | 192 | fl->fl_type = 0; |
@@ -553,6 +555,8 @@ static void locks_insert_lock(struct file_lock **pos, struct file_lock *fl) | |||
553 | { | 555 | { |
554 | list_add(&fl->fl_link, &file_lock_list); | 556 | list_add(&fl->fl_link, &file_lock_list); |
555 | 557 | ||
558 | fl->fl_nspid = get_pid(task_tgid(current)); | ||
559 | |||
556 | /* insert into file's list */ | 560 | /* insert into file's list */ |
557 | fl->fl_next = *pos; | 561 | fl->fl_next = *pos; |
558 | *pos = fl; | 562 | *pos = fl; |
@@ -584,6 +588,11 @@ static void locks_delete_lock(struct file_lock **thisfl_p) | |||
584 | if (fl->fl_ops && fl->fl_ops->fl_remove) | 588 | if (fl->fl_ops && fl->fl_ops->fl_remove) |
585 | fl->fl_ops->fl_remove(fl); | 589 | fl->fl_ops->fl_remove(fl); |
586 | 590 | ||
591 | if (fl->fl_nspid) { | ||
592 | put_pid(fl->fl_nspid); | ||
593 | fl->fl_nspid = NULL; | ||
594 | } | ||
595 | |||
587 | locks_wake_up_blocks(fl); | 596 | locks_wake_up_blocks(fl); |
588 | locks_free_lock(fl); | 597 | locks_free_lock(fl); |
589 | } | 598 | } |
@@ -634,33 +643,6 @@ static int flock_locks_conflict(struct file_lock *caller_fl, struct file_lock *s | |||
634 | return (locks_conflict(caller_fl, sys_fl)); | 643 | return (locks_conflict(caller_fl, sys_fl)); |
635 | } | 644 | } |
636 | 645 | ||
637 | static int interruptible_sleep_on_locked(wait_queue_head_t *fl_wait, int timeout) | ||
638 | { | ||
639 | int result = 0; | ||
640 | DECLARE_WAITQUEUE(wait, current); | ||
641 | |||
642 | __set_current_state(TASK_INTERRUPTIBLE); | ||
643 | add_wait_queue(fl_wait, &wait); | ||
644 | if (timeout == 0) | ||
645 | schedule(); | ||
646 | else | ||
647 | result = schedule_timeout(timeout); | ||
648 | if (signal_pending(current)) | ||
649 | result = -ERESTARTSYS; | ||
650 | remove_wait_queue(fl_wait, &wait); | ||
651 | __set_current_state(TASK_RUNNING); | ||
652 | return result; | ||
653 | } | ||
654 | |||
655 | static int locks_block_on_timeout(struct file_lock *blocker, struct file_lock *waiter, int time) | ||
656 | { | ||
657 | int result; | ||
658 | locks_insert_block(blocker, waiter); | ||
659 | result = interruptible_sleep_on_locked(&waiter->fl_wait, time); | ||
660 | __locks_delete_block(waiter); | ||
661 | return result; | ||
662 | } | ||
663 | |||
664 | void | 646 | void |
665 | posix_test_lock(struct file *filp, struct file_lock *fl) | 647 | posix_test_lock(struct file *filp, struct file_lock *fl) |
666 | { | 648 | { |
@@ -673,55 +655,67 @@ posix_test_lock(struct file *filp, struct file_lock *fl) | |||
673 | if (posix_locks_conflict(fl, cfl)) | 655 | if (posix_locks_conflict(fl, cfl)) |
674 | break; | 656 | break; |
675 | } | 657 | } |
676 | if (cfl) | 658 | if (cfl) { |
677 | __locks_copy_lock(fl, cfl); | 659 | __locks_copy_lock(fl, cfl); |
678 | else | 660 | if (cfl->fl_nspid) |
661 | fl->fl_pid = pid_nr_ns(cfl->fl_nspid, | ||
662 | task_active_pid_ns(current)); | ||
663 | } else | ||
679 | fl->fl_type = F_UNLCK; | 664 | fl->fl_type = F_UNLCK; |
680 | unlock_kernel(); | 665 | unlock_kernel(); |
681 | return; | 666 | return; |
682 | } | 667 | } |
683 | |||
684 | EXPORT_SYMBOL(posix_test_lock); | 668 | EXPORT_SYMBOL(posix_test_lock); |
685 | 669 | ||
686 | /* This function tests for deadlock condition before putting a process to | 670 | /* |
687 | * sleep. The detection scheme is no longer recursive. Recursive was neat, | 671 | * Deadlock detection: |
688 | * but dangerous - we risked stack corruption if the lock data was bad, or | 672 | * |
689 | * if the recursion was too deep for any other reason. | 673 | * We attempt to detect deadlocks that are due purely to posix file |
674 | * locks. | ||
690 | * | 675 | * |
691 | * We rely on the fact that a task can only be on one lock's wait queue | 676 | * We assume that a task can be waiting for at most one lock at a time. |
692 | * at a time. When we find blocked_task on a wait queue we can re-search | 677 | * So for any acquired lock, the process holding that lock may be |
693 | * with blocked_task equal to that queue's owner, until either blocked_task | 678 | * waiting on at most one other lock. That lock in turns may be held by |
694 | * isn't found, or blocked_task is found on a queue owned by my_task. | 679 | * someone waiting for at most one other lock. Given a requested lock |
680 | * caller_fl which is about to wait for a conflicting lock block_fl, we | ||
681 | * follow this chain of waiters to ensure we are not about to create a | ||
682 | * cycle. | ||
695 | * | 683 | * |
696 | * Note: the above assumption may not be true when handling lock requests | 684 | * Since we do this before we ever put a process to sleep on a lock, we |
697 | * from a broken NFS client. But broken NFS clients have a lot more to | 685 | * are ensured that there is never a cycle; that is what guarantees that |
698 | * worry about than proper deadlock detection anyway... --okir | 686 | * the while() loop in posix_locks_deadlock() eventually completes. |
699 | * | 687 | * |
700 | * However, the failure of this assumption (also possible in the case of | 688 | * Note: the above assumption may not be true when handling lock |
701 | * multiple tasks sharing the same open file table) also means there's no | 689 | * requests from a broken NFS client. It may also fail in the presence |
702 | * guarantee that the loop below will terminate. As a hack, we give up | 690 | * of tasks (such as posix threads) sharing the same open file table. |
703 | * after a few iterations. | 691 | * |
692 | * To handle those cases, we just bail out after a few iterations. | ||
704 | */ | 693 | */ |
705 | 694 | ||
706 | #define MAX_DEADLK_ITERATIONS 10 | 695 | #define MAX_DEADLK_ITERATIONS 10 |
707 | 696 | ||
697 | /* Find a lock that the owner of the given block_fl is blocking on. */ | ||
698 | static struct file_lock *what_owner_is_waiting_for(struct file_lock *block_fl) | ||
699 | { | ||
700 | struct file_lock *fl; | ||
701 | |||
702 | list_for_each_entry(fl, &blocked_list, fl_link) { | ||
703 | if (posix_same_owner(fl, block_fl)) | ||
704 | return fl->fl_next; | ||
705 | } | ||
706 | return NULL; | ||
707 | } | ||
708 | |||
708 | static int posix_locks_deadlock(struct file_lock *caller_fl, | 709 | static int posix_locks_deadlock(struct file_lock *caller_fl, |
709 | struct file_lock *block_fl) | 710 | struct file_lock *block_fl) |
710 | { | 711 | { |
711 | struct file_lock *fl; | ||
712 | int i = 0; | 712 | int i = 0; |
713 | 713 | ||
714 | next_task: | 714 | while ((block_fl = what_owner_is_waiting_for(block_fl))) { |
715 | if (posix_same_owner(caller_fl, block_fl)) | 715 | if (i++ > MAX_DEADLK_ITERATIONS) |
716 | return 1; | 716 | return 0; |
717 | list_for_each_entry(fl, &blocked_list, fl_link) { | 717 | if (posix_same_owner(caller_fl, block_fl)) |
718 | if (posix_same_owner(fl, block_fl)) { | 718 | return 1; |
719 | if (i++ > MAX_DEADLK_ITERATIONS) | ||
720 | return 0; | ||
721 | fl = fl->fl_next; | ||
722 | block_fl = fl; | ||
723 | goto next_task; | ||
724 | } | ||
725 | } | 719 | } |
726 | return 0; | 720 | return 0; |
727 | } | 721 | } |
@@ -1256,7 +1250,10 @@ restart: | |||
1256 | if (break_time == 0) | 1250 | if (break_time == 0) |
1257 | break_time++; | 1251 | break_time++; |
1258 | } | 1252 | } |
1259 | error = locks_block_on_timeout(flock, new_fl, break_time); | 1253 | locks_insert_block(flock, new_fl); |
1254 | error = wait_event_interruptible_timeout(new_fl->fl_wait, | ||
1255 | !new_fl->fl_next, break_time); | ||
1256 | __locks_delete_block(new_fl); | ||
1260 | if (error >= 0) { | 1257 | if (error >= 0) { |
1261 | if (error == 0) | 1258 | if (error == 0) |
1262 | time_out_leases(inode); | 1259 | time_out_leases(inode); |
@@ -2084,6 +2081,12 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, | |||
2084 | int id, char *pfx) | 2081 | int id, char *pfx) |
2085 | { | 2082 | { |
2086 | struct inode *inode = NULL; | 2083 | struct inode *inode = NULL; |
2084 | unsigned int fl_pid; | ||
2085 | |||
2086 | if (fl->fl_nspid) | ||
2087 | fl_pid = pid_nr_ns(fl->fl_nspid, task_active_pid_ns(current)); | ||
2088 | else | ||
2089 | fl_pid = fl->fl_pid; | ||
2087 | 2090 | ||
2088 | if (fl->fl_file != NULL) | 2091 | if (fl->fl_file != NULL) |
2089 | inode = fl->fl_file->f_path.dentry->d_inode; | 2092 | inode = fl->fl_file->f_path.dentry->d_inode; |
@@ -2124,16 +2127,16 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, | |||
2124 | } | 2127 | } |
2125 | if (inode) { | 2128 | if (inode) { |
2126 | #ifdef WE_CAN_BREAK_LSLK_NOW | 2129 | #ifdef WE_CAN_BREAK_LSLK_NOW |
2127 | seq_printf(f, "%d %s:%ld ", fl->fl_pid, | 2130 | seq_printf(f, "%d %s:%ld ", fl_pid, |
2128 | inode->i_sb->s_id, inode->i_ino); | 2131 | inode->i_sb->s_id, inode->i_ino); |
2129 | #else | 2132 | #else |
2130 | /* userspace relies on this representation of dev_t ;-( */ | 2133 | /* userspace relies on this representation of dev_t ;-( */ |
2131 | seq_printf(f, "%d %02x:%02x:%ld ", fl->fl_pid, | 2134 | seq_printf(f, "%d %02x:%02x:%ld ", fl_pid, |
2132 | MAJOR(inode->i_sb->s_dev), | 2135 | MAJOR(inode->i_sb->s_dev), |
2133 | MINOR(inode->i_sb->s_dev), inode->i_ino); | 2136 | MINOR(inode->i_sb->s_dev), inode->i_ino); |
2134 | #endif | 2137 | #endif |
2135 | } else { | 2138 | } else { |
2136 | seq_printf(f, "%d <none>:0 ", fl->fl_pid); | 2139 | seq_printf(f, "%d <none>:0 ", fl_pid); |
2137 | } | 2140 | } |
2138 | if (IS_POSIX(fl)) { | 2141 | if (IS_POSIX(fl)) { |
2139 | if (fl->fl_end == OFFSET_MAX) | 2142 | if (fl->fl_end == OFFSET_MAX) |
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c index a94473d3072c..5d8dcb9ee326 100644 --- a/fs/ncpfs/mmap.c +++ b/fs/ncpfs/mmap.c | |||
@@ -50,10 +50,6 @@ static int ncp_file_mmap_fault(struct vm_area_struct *area, | |||
50 | pos = vmf->pgoff << PAGE_SHIFT; | 50 | pos = vmf->pgoff << PAGE_SHIFT; |
51 | 51 | ||
52 | count = PAGE_SIZE; | 52 | count = PAGE_SIZE; |
53 | if ((unsigned long)vmf->virtual_address + PAGE_SIZE > area->vm_end) { | ||
54 | WARN_ON(1); /* shouldn't happen? */ | ||
55 | count = area->vm_end - (unsigned long)vmf->virtual_address; | ||
56 | } | ||
57 | /* what we can read in one go */ | 53 | /* what we can read in one go */ |
58 | bufsize = NCP_SERVER(inode)->buffer_size; | 54 | bufsize = NCP_SERVER(inode)->buffer_size; |
59 | 55 | ||
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index e6df06ac6405..64713e149e46 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -3338,7 +3338,7 @@ static int ocfs2_insert_path(struct inode *inode, | |||
3338 | if (insert->ins_split != SPLIT_NONE) { | 3338 | if (insert->ins_split != SPLIT_NONE) { |
3339 | /* | 3339 | /* |
3340 | * We could call ocfs2_insert_at_leaf() for some types | 3340 | * We could call ocfs2_insert_at_leaf() for some types |
3341 | * of splits, but it's easier to just let one seperate | 3341 | * of splits, but it's easier to just let one separate |
3342 | * function sort it all out. | 3342 | * function sort it all out. |
3343 | */ | 3343 | */ |
3344 | ocfs2_split_record(inode, left_path, right_path, | 3344 | ocfs2_split_record(inode, left_path, right_path, |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 6b0107f21344..e280833ceb9a 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -1215,7 +1215,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
1215 | down_write(&oi->ip_alloc_sem); | 1215 | down_write(&oi->ip_alloc_sem); |
1216 | 1216 | ||
1217 | /* | 1217 | /* |
1218 | * Prepare for worst case allocation scenario of two seperate | 1218 | * Prepare for worst case allocation scenario of two separate |
1219 | * extents. | 1219 | * extents. |
1220 | */ | 1220 | */ |
1221 | if (alloc == 2) | 1221 | if (alloc == 2) |
diff --git a/fs/ocfs2/ocfs1_fs_compat.h b/fs/ocfs2/ocfs1_fs_compat.h index 0b499bccec5a..dfb313bda5dd 100644 --- a/fs/ocfs2/ocfs1_fs_compat.h +++ b/fs/ocfs2/ocfs1_fs_compat.h | |||
@@ -77,7 +77,7 @@ struct ocfs1_disk_lock | |||
77 | { | 77 | { |
78 | /*00*/ __u32 curr_master; | 78 | /*00*/ __u32 curr_master; |
79 | __u8 file_lock; | 79 | __u8 file_lock; |
80 | __u8 compat_pad[3]; /* Not in orignal definition. Used to | 80 | __u8 compat_pad[3]; /* Not in original definition. Used to |
81 | make the already existing alignment | 81 | make the already existing alignment |
82 | explicit */ | 82 | explicit */ |
83 | __u64 last_write_time; | 83 | __u64 last_write_time; |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index 7e397e2c25dd..72c198a004df 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -646,7 +646,7 @@ bail: | |||
646 | * sync-data inodes." | 646 | * sync-data inodes." |
647 | * | 647 | * |
648 | * Note: OCFS2 already does this differently for metadata vs data | 648 | * Note: OCFS2 already does this differently for metadata vs data |
649 | * allocations, as those bitmaps are seperate and undo access is never | 649 | * allocations, as those bitmaps are separate and undo access is never |
650 | * called on a metadata group descriptor. | 650 | * called on a metadata group descriptor. |
651 | */ | 651 | */ |
652 | static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh, | 652 | static int ocfs2_test_bg_bit_allocatable(struct buffer_head *bg_bh, |
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index 16b331dd9913..f491ceb5af02 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -272,7 +272,7 @@ static inline int block_group_used(struct super_block *s, u32 id) | |||
272 | 272 | ||
273 | /* If we don't have cached information on this bitmap block, we're | 273 | /* If we don't have cached information on this bitmap block, we're |
274 | * going to have to load it later anyway. Loading it here allows us | 274 | * going to have to load it later anyway. Loading it here allows us |
275 | * to make a better decision. This favors long-term performace gain | 275 | * to make a better decision. This favors long-term performance gain |
276 | * with a better on-disk layout vs. a short term gain of skipping the | 276 | * with a better on-disk layout vs. a short term gain of skipping the |
277 | * read and potentially having a bad placement. */ | 277 | * read and potentially having a bad placement. */ |
278 | if (info->free_count == UINT_MAX) { | 278 | if (info->free_count == UINT_MAX) { |
@@ -663,7 +663,7 @@ static inline void new_hashed_relocation(reiserfs_blocknr_hint_t * hint) | |||
663 | 663 | ||
664 | /* | 664 | /* |
665 | * Relocation based on dirid, hashing them into a given bitmap block | 665 | * Relocation based on dirid, hashing them into a given bitmap block |
666 | * files. Formatted nodes are unaffected, a seperate policy covers them | 666 | * files. Formatted nodes are unaffected, a separate policy covers them |
667 | */ | 667 | */ |
668 | static void dirid_groups(reiserfs_blocknr_hint_t * hint) | 668 | static void dirid_groups(reiserfs_blocknr_hint_t * hint) |
669 | { | 669 | { |
@@ -688,7 +688,7 @@ static void dirid_groups(reiserfs_blocknr_hint_t * hint) | |||
688 | 688 | ||
689 | /* | 689 | /* |
690 | * Relocation based on oid, hashing them into a given bitmap block | 690 | * Relocation based on oid, hashing them into a given bitmap block |
691 | * files. Formatted nodes are unaffected, a seperate policy covers them | 691 | * files. Formatted nodes are unaffected, a separate policy covers them |
692 | */ | 692 | */ |
693 | static void oid_groups(reiserfs_blocknr_hint_t * hint) | 693 | static void oid_groups(reiserfs_blocknr_hint_t * hint) |
694 | { | 694 | { |
diff --git a/fs/signalfd.c b/fs/signalfd.c index fb7f7e8034df..2d3e107da2d3 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -66,7 +66,7 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo, | |||
66 | BUILD_BUG_ON(sizeof(struct signalfd_siginfo) != 128); | 66 | BUILD_BUG_ON(sizeof(struct signalfd_siginfo) != 128); |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * Unused memebers should be zero ... | 69 | * Unused members should be zero ... |
70 | */ | 70 | */ |
71 | err = __clear_user(uinfo, sizeof(*uinfo)); | 71 | err = __clear_user(uinfo, sizeof(*uinfo)); |
72 | 72 | ||
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index b729e64d0d4c..d970f7f99549 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -85,7 +85,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function); | |||
85 | #endif | 85 | #endif |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * ACPI Memory managment | 88 | * ACPI Memory management |
89 | */ | 89 | */ |
90 | void *acpi_allocate(u32 size); | 90 | void *acpi_allocate(u32 size); |
91 | 91 | ||
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 76411b1fc4fd..6e253b5b0f3b 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -182,7 +182,7 @@ struct acpi_processor_throttling { | |||
182 | /* Limit Interface */ | 182 | /* Limit Interface */ |
183 | 183 | ||
184 | struct acpi_processor_lx { | 184 | struct acpi_processor_lx { |
185 | int px; /* performace state */ | 185 | int px; /* performance state */ |
186 | int tx; /* throttle level */ | 186 | int tx; /* throttle level */ |
187 | }; | 187 | }; |
188 | 188 | ||
diff --git a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h index c704fe8cf42f..68aca8554f5a 100644 --- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h +++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h | |||
@@ -583,23 +583,23 @@ | |||
583 | #define UICR1_IM14 (1 << 6) /* Interrupt mask ep 14 */ | 583 | #define UICR1_IM14 (1 << 6) /* Interrupt mask ep 14 */ |
584 | #define UICR1_IM15 (1 << 7) /* Interrupt mask ep 15 */ | 584 | #define UICR1_IM15 (1 << 7) /* Interrupt mask ep 15 */ |
585 | 585 | ||
586 | #define USIR0_IR0 (1 << 0) /* Interrup request ep 0 */ | 586 | #define USIR0_IR0 (1 << 0) /* Interrupt request ep 0 */ |
587 | #define USIR0_IR1 (1 << 1) /* Interrup request ep 1 */ | 587 | #define USIR0_IR1 (1 << 1) /* Interrupt request ep 1 */ |
588 | #define USIR0_IR2 (1 << 2) /* Interrup request ep 2 */ | 588 | #define USIR0_IR2 (1 << 2) /* Interrupt request ep 2 */ |
589 | #define USIR0_IR3 (1 << 3) /* Interrup request ep 3 */ | 589 | #define USIR0_IR3 (1 << 3) /* Interrupt request ep 3 */ |
590 | #define USIR0_IR4 (1 << 4) /* Interrup request ep 4 */ | 590 | #define USIR0_IR4 (1 << 4) /* Interrupt request ep 4 */ |
591 | #define USIR0_IR5 (1 << 5) /* Interrup request ep 5 */ | 591 | #define USIR0_IR5 (1 << 5) /* Interrupt request ep 5 */ |
592 | #define USIR0_IR6 (1 << 6) /* Interrup request ep 6 */ | 592 | #define USIR0_IR6 (1 << 6) /* Interrupt request ep 6 */ |
593 | #define USIR0_IR7 (1 << 7) /* Interrup request ep 7 */ | 593 | #define USIR0_IR7 (1 << 7) /* Interrupt request ep 7 */ |
594 | 594 | ||
595 | #define USIR1_IR8 (1 << 0) /* Interrup request ep 8 */ | 595 | #define USIR1_IR8 (1 << 0) /* Interrupt request ep 8 */ |
596 | #define USIR1_IR9 (1 << 1) /* Interrup request ep 9 */ | 596 | #define USIR1_IR9 (1 << 1) /* Interrupt request ep 9 */ |
597 | #define USIR1_IR10 (1 << 2) /* Interrup request ep 10 */ | 597 | #define USIR1_IR10 (1 << 2) /* Interrupt request ep 10 */ |
598 | #define USIR1_IR11 (1 << 3) /* Interrup request ep 11 */ | 598 | #define USIR1_IR11 (1 << 3) /* Interrupt request ep 11 */ |
599 | #define USIR1_IR12 (1 << 4) /* Interrup request ep 12 */ | 599 | #define USIR1_IR12 (1 << 4) /* Interrupt request ep 12 */ |
600 | #define USIR1_IR13 (1 << 5) /* Interrup request ep 13 */ | 600 | #define USIR1_IR13 (1 << 5) /* Interrupt request ep 13 */ |
601 | #define USIR1_IR14 (1 << 6) /* Interrup request ep 14 */ | 601 | #define USIR1_IR14 (1 << 6) /* Interrupt request ep 14 */ |
602 | #define USIR1_IR15 (1 << 7) /* Interrup request ep 15 */ | 602 | #define USIR1_IR15 (1 << 7) /* Interrupt request ep 15 */ |
603 | 603 | ||
604 | #define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ | 604 | #define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */ |
605 | 605 | ||
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h index 442494d71f12..16ed24dbda4e 100644 --- a/include/asm-arm/arch-pxa/pxa-regs.h +++ b/include/asm-arm/arch-pxa/pxa-regs.h | |||
@@ -737,25 +737,25 @@ | |||
737 | 737 | ||
738 | #define USIR0 __REG(0x40600058) /* UDC Status Interrupt Register 0 */ | 738 | #define USIR0 __REG(0x40600058) /* UDC Status Interrupt Register 0 */ |
739 | 739 | ||
740 | #define USIR0_IR0 (1 << 0) /* Interrup request ep 0 */ | 740 | #define USIR0_IR0 (1 << 0) /* Interrupt request ep 0 */ |
741 | #define USIR0_IR1 (1 << 1) /* Interrup request ep 1 */ | 741 | #define USIR0_IR1 (1 << 1) /* Interrupt request ep 1 */ |
742 | #define USIR0_IR2 (1 << 2) /* Interrup request ep 2 */ | 742 | #define USIR0_IR2 (1 << 2) /* Interrupt request ep 2 */ |
743 | #define USIR0_IR3 (1 << 3) /* Interrup request ep 3 */ | 743 | #define USIR0_IR3 (1 << 3) /* Interrupt request ep 3 */ |
744 | #define USIR0_IR4 (1 << 4) /* Interrup request ep 4 */ | 744 | #define USIR0_IR4 (1 << 4) /* Interrupt request ep 4 */ |
745 | #define USIR0_IR5 (1 << 5) /* Interrup request ep 5 */ | 745 | #define USIR0_IR5 (1 << 5) /* Interrupt request ep 5 */ |
746 | #define USIR0_IR6 (1 << 6) /* Interrup request ep 6 */ | 746 | #define USIR0_IR6 (1 << 6) /* Interrupt request ep 6 */ |
747 | #define USIR0_IR7 (1 << 7) /* Interrup request ep 7 */ | 747 | #define USIR0_IR7 (1 << 7) /* Interrupt request ep 7 */ |
748 | 748 | ||
749 | #define USIR1 __REG(0x4060005C) /* UDC Status Interrupt Register 1 */ | 749 | #define USIR1 __REG(0x4060005C) /* UDC Status Interrupt Register 1 */ |
750 | 750 | ||
751 | #define USIR1_IR8 (1 << 0) /* Interrup request ep 8 */ | 751 | #define USIR1_IR8 (1 << 0) /* Interrupt request ep 8 */ |
752 | #define USIR1_IR9 (1 << 1) /* Interrup request ep 9 */ | 752 | #define USIR1_IR9 (1 << 1) /* Interrupt request ep 9 */ |
753 | #define USIR1_IR10 (1 << 2) /* Interrup request ep 10 */ | 753 | #define USIR1_IR10 (1 << 2) /* Interrupt request ep 10 */ |
754 | #define USIR1_IR11 (1 << 3) /* Interrup request ep 11 */ | 754 | #define USIR1_IR11 (1 << 3) /* Interrupt request ep 11 */ |
755 | #define USIR1_IR12 (1 << 4) /* Interrup request ep 12 */ | 755 | #define USIR1_IR12 (1 << 4) /* Interrupt request ep 12 */ |
756 | #define USIR1_IR13 (1 << 5) /* Interrup request ep 13 */ | 756 | #define USIR1_IR13 (1 << 5) /* Interrupt request ep 13 */ |
757 | #define USIR1_IR14 (1 << 6) /* Interrup request ep 14 */ | 757 | #define USIR1_IR14 (1 << 6) /* Interrupt request ep 14 */ |
758 | #define USIR1_IR15 (1 << 7) /* Interrup request ep 15 */ | 758 | #define USIR1_IR15 (1 << 7) /* Interrupt request ep 15 */ |
759 | 759 | ||
760 | #elif defined(CONFIG_PXA27x) | 760 | #elif defined(CONFIG_PXA27x) |
761 | 761 | ||
@@ -1020,7 +1020,7 @@ | |||
1020 | #define ICSR0 __REG(0x40800014) /* ICP Status Register 0 */ | 1020 | #define ICSR0 __REG(0x40800014) /* ICP Status Register 0 */ |
1021 | #define ICSR1 __REG(0x40800018) /* ICP Status Register 1 */ | 1021 | #define ICSR1 __REG(0x40800018) /* ICP Status Register 1 */ |
1022 | 1022 | ||
1023 | #define ICCR0_AME (1 << 7) /* Adress match enable */ | 1023 | #define ICCR0_AME (1 << 7) /* Address match enable */ |
1024 | #define ICCR0_TIE (1 << 6) /* Transmit FIFO interrupt enable */ | 1024 | #define ICCR0_TIE (1 << 6) /* Transmit FIFO interrupt enable */ |
1025 | #define ICCR0_RIE (1 << 5) /* Recieve FIFO interrupt enable */ | 1025 | #define ICCR0_RIE (1 << 5) /* Recieve FIFO interrupt enable */ |
1026 | #define ICCR0_RXE (1 << 4) /* Receive enable */ | 1026 | #define ICCR0_RXE (1 << 4) /* Receive enable */ |
diff --git a/include/asm-arm/arch-versatile/irqs.h b/include/asm-arm/arch-versatile/irqs.h index 745aa841b31a..f7263b99403b 100644 --- a/include/asm-arm/arch-versatile/irqs.h +++ b/include/asm-arm/arch-versatile/irqs.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <asm/arch/platform.h> | 22 | #include <asm/arch/platform.h> |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * IRQ interrupts definitions are the same the INT definitions | 25 | * IRQ interrupts definitions are the same as the INT definitions |
26 | * held within platform.h | 26 | * held within platform.h |
27 | */ | 27 | */ |
28 | #define IRQ_VIC_START 0 | 28 | #define IRQ_VIC_START 0 |
@@ -94,7 +94,7 @@ | |||
94 | #define IRQMASK_VICSOURCE31 INTMASK_VICSOURCE31 | 94 | #define IRQMASK_VICSOURCE31 INTMASK_VICSOURCE31 |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * FIQ interrupts definitions are the same the INT definitions. | 97 | * FIQ interrupts definitions are the same as the INT definitions. |
98 | */ | 98 | */ |
99 | #define FIQ_WDOGINT INT_WDOGINT | 99 | #define FIQ_WDOGINT INT_WDOGINT |
100 | #define FIQ_SOFTINT INT_SOFTINT | 100 | #define FIQ_SOFTINT INT_SOFTINT |
diff --git a/include/asm-arm/hardware/it8152.h b/include/asm-arm/hardware/it8152.h index aaebb61aca48..74b5fff7f575 100644 --- a/include/asm-arm/hardware/it8152.h +++ b/include/asm-arm/hardware/it8152.h | |||
@@ -42,7 +42,7 @@ extern unsigned long it8152_base_address; | |||
42 | #define IT8152_GPIO_GPDR __REG_IT8152(0x3f00500) | 42 | #define IT8152_GPIO_GPDR __REG_IT8152(0x3f00500) |
43 | 43 | ||
44 | /* | 44 | /* |
45 | Interrup contoler per register summary: | 45 | Interrupt controller per register summary: |
46 | --------------------------------------- | 46 | --------------------------------------- |
47 | LCDNIRR: | 47 | LCDNIRR: |
48 | IT8152_LD_IRQ(8) PCICLK stop | 48 | IT8152_LD_IRQ(8) PCICLK stop |
diff --git a/include/asm-arm/mach/udc_pxa2xx.h b/include/asm-arm/mach/udc_pxa2xx.h index f191e147ea90..f9f3606986c2 100644 --- a/include/asm-arm/mach/udc_pxa2xx.h +++ b/include/asm-arm/mach/udc_pxa2xx.h | |||
@@ -16,7 +16,7 @@ struct pxa2xx_udc_mach_info { | |||
16 | #define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */ | 16 | #define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */ |
17 | 17 | ||
18 | /* Boards following the design guidelines in the developer's manual, | 18 | /* Boards following the design guidelines in the developer's manual, |
19 | * with on-chip GPIOs not Lubbock's wierd hardware, can have a sane | 19 | * with on-chip GPIOs not Lubbock's weird hardware, can have a sane |
20 | * VBUS IRQ and omit the methods above. Store the GPIO number | 20 | * VBUS IRQ and omit the methods above. Store the GPIO number |
21 | * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits. | 21 | * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits. |
22 | * Note that sometimes the signals go through inverters... | 22 | * Note that sometimes the signals go through inverters... |
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h index d425d8d0ad77..6ec494a5bc5a 100644 --- a/include/asm-frv/atomic.h +++ b/include/asm-frv/atomic.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* atomic.h: atomic operation emulation for FR-V | 1 | /* atomic.h: atomic operation emulation for FR-V |
2 | * | 2 | * |
3 | * For an explanation of how atomic ops work in this arch, see: | 3 | * For an explanation of how atomic ops work in this arch, see: |
4 | * Documentation/fujitsu/frv/atomic-ops.txt | 4 | * Documentation/frv/atomic-ops.txt |
5 | * | 5 | * |
6 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | 6 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. |
7 | * Written by David Howells (dhowells@redhat.com) | 7 | * Written by David Howells (dhowells@redhat.com) |
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h index e29de7131b79..5f86b876b298 100644 --- a/include/asm-frv/bitops.h +++ b/include/asm-frv/bitops.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* bitops.h: bit operations for the Fujitsu FR-V CPUs | 1 | /* bitops.h: bit operations for the Fujitsu FR-V CPUs |
2 | * | 2 | * |
3 | * For an explanation of how atomic ops work in this arch, see: | 3 | * For an explanation of how atomic ops work in this arch, see: |
4 | * Documentation/fujitsu/frv/atomic-ops.txt | 4 | * Documentation/frv/atomic-ops.txt |
5 | * | 5 | * |
6 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | 6 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. |
7 | * Written by David Howells (dhowells@redhat.com) | 7 | * Written by David Howells (dhowells@redhat.com) |
diff --git a/include/asm-frv/cacheflush.h b/include/asm-frv/cacheflush.h index 02500405a6fb..432a69e7f3d4 100644 --- a/include/asm-frv/cacheflush.h +++ b/include/asm-frv/cacheflush.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #define flush_dcache_mmap_unlock(mapping) do {} while(0) | 29 | #define flush_dcache_mmap_unlock(mapping) do {} while(0) |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * physically-indexed cache managment | 32 | * physically-indexed cache management |
33 | * - see arch/frv/lib/cache.S | 33 | * - see arch/frv/lib/cache.S |
34 | */ | 34 | */ |
35 | extern void frv_dcache_writeback(unsigned long start, unsigned long size); | 35 | extern void frv_dcache_writeback(unsigned long start, unsigned long size); |
diff --git a/include/asm-frv/highmem.h b/include/asm-frv/highmem.h index ff4d6cdeb152..26cefcde5cee 100644 --- a/include/asm-frv/highmem.h +++ b/include/asm-frv/highmem.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
5 | * - Derived from include/asm-i386/highmem.h | 5 | * - Derived from include/asm-i386/highmem.h |
6 | * | 6 | * |
7 | * See Documentation/fujitsu/frv/mmu-layout.txt for more information. | 7 | * See Documentation/frv/mmu-layout.txt for more information. |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
diff --git a/include/asm-frv/mem-layout.h b/include/asm-frv/mem-layout.h index aaf2a773d9d3..83532252b8be 100644 --- a/include/asm-frv/mem-layout.h +++ b/include/asm-frv/mem-layout.h | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #ifdef CONFIG_MMU | 40 | #ifdef CONFIG_MMU |
41 | 41 | ||
42 | /* see Documentation/fujitsu/frv/mmu-layout.txt */ | 42 | /* see Documentation/frv/mmu-layout.txt */ |
43 | #define KERNEL_LOWMEM_START __UL(0xc0000000) | 43 | #define KERNEL_LOWMEM_START __UL(0xc0000000) |
44 | #define KERNEL_LOWMEM_END __UL(0xd0000000) | 44 | #define KERNEL_LOWMEM_END __UL(0xd0000000) |
45 | #define VMALLOC_START __UL(0xd0000000) | 45 | #define VMALLOC_START __UL(0xd0000000) |
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h index 147e995bec24..3c402afb9e74 100644 --- a/include/asm-frv/pgtable.h +++ b/include/asm-frv/pgtable.h | |||
@@ -93,7 +93,7 @@ extern unsigned long empty_zero_page; | |||
93 | 93 | ||
94 | /* | 94 | /* |
95 | * we use 2-level page tables, folding the PMD (mid-level table) into the PGE (top-level entry) | 95 | * we use 2-level page tables, folding the PMD (mid-level table) into the PGE (top-level entry) |
96 | * [see Documentation/fujitsu/frv/mmu-layout.txt] | 96 | * [see Documentation/frv/mmu-layout.txt] |
97 | * | 97 | * |
98 | * Page Directory: | 98 | * Page Directory: |
99 | * - Size: 16KB | 99 | * - Size: 16KB |
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h index d3238f1f70a6..dd1bed860e64 100644 --- a/include/asm-generic/rtc.h +++ b/include/asm-generic/rtc.h | |||
@@ -35,10 +35,11 @@ | |||
35 | static inline unsigned char rtc_is_updating(void) | 35 | static inline unsigned char rtc_is_updating(void) |
36 | { | 36 | { |
37 | unsigned char uip; | 37 | unsigned char uip; |
38 | unsigned long flags; | ||
38 | 39 | ||
39 | spin_lock_irq(&rtc_lock); | 40 | spin_lock_irqsave(&rtc_lock, flags); |
40 | uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP); | 41 | uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP); |
41 | spin_unlock_irq(&rtc_lock); | 42 | spin_unlock_irqrestore(&rtc_lock, flags); |
42 | return uip; | 43 | return uip; |
43 | } | 44 | } |
44 | 45 | ||
@@ -46,6 +47,8 @@ static inline unsigned int get_rtc_time(struct rtc_time *time) | |||
46 | { | 47 | { |
47 | unsigned long uip_watchdog = jiffies; | 48 | unsigned long uip_watchdog = jiffies; |
48 | unsigned char ctrl; | 49 | unsigned char ctrl; |
50 | unsigned long flags; | ||
51 | |||
49 | #ifdef CONFIG_MACH_DECSTATION | 52 | #ifdef CONFIG_MACH_DECSTATION |
50 | unsigned int real_year; | 53 | unsigned int real_year; |
51 | #endif | 54 | #endif |
@@ -72,7 +75,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time) | |||
72 | * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated | 75 | * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated |
73 | * by the RTC when initially set to a non-zero value. | 76 | * by the RTC when initially set to a non-zero value. |
74 | */ | 77 | */ |
75 | spin_lock_irq(&rtc_lock); | 78 | spin_lock_irqsave(&rtc_lock, flags); |
76 | time->tm_sec = CMOS_READ(RTC_SECONDS); | 79 | time->tm_sec = CMOS_READ(RTC_SECONDS); |
77 | time->tm_min = CMOS_READ(RTC_MINUTES); | 80 | time->tm_min = CMOS_READ(RTC_MINUTES); |
78 | time->tm_hour = CMOS_READ(RTC_HOURS); | 81 | time->tm_hour = CMOS_READ(RTC_HOURS); |
@@ -83,7 +86,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time) | |||
83 | real_year = CMOS_READ(RTC_DEC_YEAR); | 86 | real_year = CMOS_READ(RTC_DEC_YEAR); |
84 | #endif | 87 | #endif |
85 | ctrl = CMOS_READ(RTC_CONTROL); | 88 | ctrl = CMOS_READ(RTC_CONTROL); |
86 | spin_unlock_irq(&rtc_lock); | 89 | spin_unlock_irqrestore(&rtc_lock, flags); |
87 | 90 | ||
88 | if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) | 91 | if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) |
89 | { | 92 | { |
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 75f2bfab614f..f490e43a90b9 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #define _ASM_GENERIC__TLB_H | 14 | #define _ASM_GENERIC__TLB_H |
15 | 15 | ||
16 | #include <linux/swap.h> | 16 | #include <linux/swap.h> |
17 | #include <linux/quicklist.h> | ||
18 | #include <asm/pgalloc.h> | 17 | #include <asm/pgalloc.h> |
19 | #include <asm/tlbflush.h> | 18 | #include <asm/tlbflush.h> |
20 | 19 | ||
diff --git a/include/asm-ia64/compat.h b/include/asm-ia64/compat.h index 0f6e5264ab8f..dfcf75b8426d 100644 --- a/include/asm-ia64/compat.h +++ b/include/asm-ia64/compat.h | |||
@@ -181,7 +181,7 @@ struct compat_shmid64_ds { | |||
181 | /* | 181 | /* |
182 | * A pointer passed in from user mode. This should not be used for syscall parameters, | 182 | * A pointer passed in from user mode. This should not be used for syscall parameters, |
183 | * just declare them as pointers because the syscall entry code will have appropriately | 183 | * just declare them as pointers because the syscall entry code will have appropriately |
184 | * comverted them already. | 184 | * converted them already. |
185 | */ | 185 | */ |
186 | typedef u32 compat_uptr_t; | 186 | typedef u32 compat_uptr_t; |
187 | 187 | ||
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h index f43afe1fc3b3..c142fbf2f376 100644 --- a/include/asm-m68knommu/bitops.h +++ b/include/asm-m68knommu/bitops.h | |||
@@ -262,7 +262,7 @@ static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned lon | |||
262 | * tmp = __swab32(*(p++)); | 262 | * tmp = __swab32(*(p++)); |
263 | * tmp |= ~0UL >> (32-offset); | 263 | * tmp |= ~0UL >> (32-offset); |
264 | * | 264 | * |
265 | * but this would decrease preformance, so we change the | 265 | * but this would decrease performance, so we change the |
266 | * shift: | 266 | * shift: |
267 | */ | 267 | */ |
268 | tmp = *(p++); | 268 | tmp = *(p++); |
diff --git a/include/asm-m68knommu/commproc.h b/include/asm-m68knommu/commproc.h index 0161ebb5d883..36e870b468ef 100644 --- a/include/asm-m68knommu/commproc.h +++ b/include/asm-m68knommu/commproc.h | |||
@@ -715,7 +715,7 @@ extern void cpm_install_handler(int vec, void (*handler)(void *), void *dev_id); | |||
715 | #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */ | 715 | #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */ |
716 | #define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */ | 716 | #define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */ |
717 | #define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */ | 717 | #define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */ |
718 | #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrrupt */ | 718 | #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrupt */ |
719 | #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */ | 719 | #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */ |
720 | #define CICR_IEN ((uint)0x00000080) /* Int. enable */ | 720 | #define CICR_IEN ((uint)0x00000080) /* Int. enable */ |
721 | #define CICR_SPS ((uint)0x00000001) /* SCC Spread */ | 721 | #define CICR_SPS ((uint)0x00000001) /* SCC Spread */ |
diff --git a/include/asm-m68knommu/delay.h b/include/asm-m68knommu/delay.h index 04a20fd051cf..55cbd6294ab6 100644 --- a/include/asm-m68knommu/delay.h +++ b/include/asm-m68knommu/delay.h | |||
@@ -68,7 +68,7 @@ static inline void _udelay(unsigned long usecs) | |||
68 | /* | 68 | /* |
69 | * Moved the udelay() function into library code, no longer inlined. | 69 | * Moved the udelay() function into library code, no longer inlined. |
70 | * I had to change the algorithm because we are overflowing now on | 70 | * I had to change the algorithm because we are overflowing now on |
71 | * the faster ColdFire parts. The code is a little biger, so it makes | 71 | * the faster ColdFire parts. The code is a little bigger, so it makes |
72 | * sense to library it. | 72 | * sense to library it. |
73 | */ | 73 | */ |
74 | extern void udelay(unsigned long usecs); | 74 | extern void udelay(unsigned long usecs); |
diff --git a/include/asm-m68knommu/m5249sim.h b/include/asm-m68knommu/m5249sim.h index 399814f0b219..366eb8602d2f 100644 --- a/include/asm-m68knommu/m5249sim.h +++ b/include/asm-m68knommu/m5249sim.h | |||
@@ -43,10 +43,10 @@ | |||
43 | #define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ | 43 | #define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ |
44 | #define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ | 44 | #define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ |
45 | #define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ | 45 | #define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ |
46 | #define MCFSIM_CSAR2 0x98 /* CS 2 Adress reg (r/w) */ | 46 | #define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ |
47 | #define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ | 47 | #define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ |
48 | #define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ | 48 | #define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ |
49 | #define MCFSIM_CSAR3 0xa4 /* CS 3 Adress reg (r/w) */ | 49 | #define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ |
50 | #define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ | 50 | #define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ |
51 | #define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ | 51 | #define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ |
52 | 52 | ||
diff --git a/include/asm-m68knommu/m5307sim.h b/include/asm-m68knommu/m5307sim.h index d3ce550f6ef4..5886728409c0 100644 --- a/include/asm-m68knommu/m5307sim.h +++ b/include/asm-m68knommu/m5307sim.h | |||
@@ -64,22 +64,22 @@ | |||
64 | #define MCFSIM_CSMR7 0xda /* CS 7 Mask reg (r/w) */ | 64 | #define MCFSIM_CSMR7 0xda /* CS 7 Mask reg (r/w) */ |
65 | #define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ | 65 | #define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ |
66 | #else | 66 | #else |
67 | #define MCFSIM_CSAR2 0x98 /* CS 2 Adress reg (r/w) */ | 67 | #define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ |
68 | #define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ | 68 | #define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ |
69 | #define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ | 69 | #define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ |
70 | #define MCFSIM_CSAR3 0xa4 /* CS 3 Adress reg (r/w) */ | 70 | #define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ |
71 | #define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ | 71 | #define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ |
72 | #define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ | 72 | #define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ |
73 | #define MCFSIM_CSAR4 0xb0 /* CS 4 Adress reg (r/w) */ | 73 | #define MCFSIM_CSAR4 0xb0 /* CS 4 Address reg (r/w) */ |
74 | #define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ | 74 | #define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ |
75 | #define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ | 75 | #define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ |
76 | #define MCFSIM_CSAR5 0xbc /* CS 5 Adress reg (r/w) */ | 76 | #define MCFSIM_CSAR5 0xbc /* CS 5 Address reg (r/w) */ |
77 | #define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */ | 77 | #define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */ |
78 | #define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ | 78 | #define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ |
79 | #define MCFSIM_CSAR6 0xc8 /* CS 6 Adress reg (r/w) */ | 79 | #define MCFSIM_CSAR6 0xc8 /* CS 6 Address reg (r/w) */ |
80 | #define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */ | 80 | #define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */ |
81 | #define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ | 81 | #define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ |
82 | #define MCFSIM_CSAR7 0xd4 /* CS 7 Adress reg (r/w) */ | 82 | #define MCFSIM_CSAR7 0xd4 /* CS 7 Address reg (r/w) */ |
83 | #define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */ | 83 | #define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */ |
84 | #define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ | 84 | #define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ |
85 | #endif /* CONFIG_OLDMASK */ | 85 | #endif /* CONFIG_OLDMASK */ |
diff --git a/include/asm-m68knommu/m5407sim.h b/include/asm-m68knommu/m5407sim.h index 75dcdacdb298..cc22c4a53005 100644 --- a/include/asm-m68knommu/m5407sim.h +++ b/include/asm-m68knommu/m5407sim.h | |||
@@ -48,22 +48,22 @@ | |||
48 | #define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ | 48 | #define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ |
49 | #define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ | 49 | #define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ |
50 | 50 | ||
51 | #define MCFSIM_CSAR2 0x98 /* CS 2 Adress reg (r/w) */ | 51 | #define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ |
52 | #define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ | 52 | #define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ |
53 | #define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ | 53 | #define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ |
54 | #define MCFSIM_CSAR3 0xa4 /* CS 3 Adress reg (r/w) */ | 54 | #define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ |
55 | #define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ | 55 | #define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ |
56 | #define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ | 56 | #define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ |
57 | #define MCFSIM_CSAR4 0xb0 /* CS 4 Adress reg (r/w) */ | 57 | #define MCFSIM_CSAR4 0xb0 /* CS 4 Address reg (r/w) */ |
58 | #define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ | 58 | #define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ |
59 | #define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ | 59 | #define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ |
60 | #define MCFSIM_CSAR5 0xbc /* CS 5 Adress reg (r/w) */ | 60 | #define MCFSIM_CSAR5 0xbc /* CS 5 Address reg (r/w) */ |
61 | #define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */ | 61 | #define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */ |
62 | #define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ | 62 | #define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ |
63 | #define MCFSIM_CSAR6 0xc8 /* CS 6 Adress reg (r/w) */ | 63 | #define MCFSIM_CSAR6 0xc8 /* CS 6 Address reg (r/w) */ |
64 | #define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */ | 64 | #define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */ |
65 | #define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ | 65 | #define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ |
66 | #define MCFSIM_CSAR7 0xd4 /* CS 7 Adress reg (r/w) */ | 66 | #define MCFSIM_CSAR7 0xd4 /* CS 7 Address reg (r/w) */ |
67 | #define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */ | 67 | #define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */ |
68 | #define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ | 68 | #define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ |
69 | 69 | ||
diff --git a/include/asm-m68knommu/m68360_regs.h b/include/asm-m68knommu/m68360_regs.h index a3f8cc8a4a84..d57217ca4f27 100644 --- a/include/asm-m68knommu/m68360_regs.h +++ b/include/asm-m68knommu/m68360_regs.h | |||
@@ -138,7 +138,7 @@ | |||
138 | #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */ | 138 | #define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */ |
139 | #define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */ | 139 | #define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */ |
140 | 140 | ||
141 | #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrrupt */ | 141 | #define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrupt */ |
142 | #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */ | 142 | #define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */ |
143 | #define CICR_VBA_MASK ((uint)0x000000e0) /* Vector Base Address */ | 143 | #define CICR_VBA_MASK ((uint)0x000000e0) /* Vector Base Address */ |
144 | #define CICR_SPS ((uint)0x00000001) /* SCC Spread */ | 144 | #define CICR_SPS ((uint)0x00000001) /* SCC Spread */ |
diff --git a/include/asm-m68knommu/mcfuart.h b/include/asm-m68knommu/mcfuart.h index 1319a81814b1..8a7a67703ac3 100644 --- a/include/asm-m68knommu/mcfuart.h +++ b/include/asm-m68knommu/mcfuart.h | |||
@@ -71,7 +71,7 @@ struct mcf_platform_uart { | |||
71 | #define MCFUART_UTB 0x0c /* Transmit Buffer (w) */ | 71 | #define MCFUART_UTB 0x0c /* Transmit Buffer (w) */ |
72 | #define MCFUART_UIPCR 0x10 /* Input Port Change (r) */ | 72 | #define MCFUART_UIPCR 0x10 /* Input Port Change (r) */ |
73 | #define MCFUART_UACR 0x10 /* Auxiliary Control (w) */ | 73 | #define MCFUART_UACR 0x10 /* Auxiliary Control (w) */ |
74 | #define MCFUART_UISR 0x14 /* Interrup Status (r) */ | 74 | #define MCFUART_UISR 0x14 /* Interrupt Status (r) */ |
75 | #define MCFUART_UIMR 0x14 /* Interrupt Mask (w) */ | 75 | #define MCFUART_UIMR 0x14 /* Interrupt Mask (w) */ |
76 | #define MCFUART_UBG1 0x18 /* Baud Rate MSB (r/w) */ | 76 | #define MCFUART_UBG1 0x18 /* Baud Rate MSB (r/w) */ |
77 | #define MCFUART_UBG2 0x1c /* Baud Rate LSB (r/w) */ | 77 | #define MCFUART_UBG2 0x1c /* Baud Rate LSB (r/w) */ |
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h index 568c76cdd900..ac5d541368e9 100644 --- a/include/asm-mips/compat.h +++ b/include/asm-mips/compat.h | |||
@@ -128,7 +128,7 @@ typedef u32 compat_sigset_word; | |||
128 | * A pointer passed in from user mode. This should not | 128 | * A pointer passed in from user mode. This should not |
129 | * be used for syscall parameters, just declare them | 129 | * be used for syscall parameters, just declare them |
130 | * as pointers because the syscall entry code will have | 130 | * as pointers because the syscall entry code will have |
131 | * appropriately comverted them already. | 131 | * appropriately converted them already. |
132 | */ | 132 | */ |
133 | typedef u32 compat_uptr_t; | 133 | typedef u32 compat_uptr_t; |
134 | 134 | ||
diff --git a/include/asm-mips/mach-excite/excite_fpga.h b/include/asm-mips/mach-excite/excite_fpga.h index 38fcda703a0b..0a1ef69bece7 100644 --- a/include/asm-mips/mach-excite/excite_fpga.h +++ b/include/asm-mips/mach-excite/excite_fpga.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Adress alignment of the individual FPGA bytes. | 6 | * Address alignment of the individual FPGA bytes. |
7 | * The address arrangement of the individual bytes of the FPGA is two | 7 | * The address arrangement of the individual bytes of the FPGA is two |
8 | * byte aligned at the embedded MK2 platform. | 8 | * byte aligned at the embedded MK2 platform. |
9 | */ | 9 | */ |
diff --git a/include/asm-mips/mach-wrppmc/mach-gt64120.h b/include/asm-mips/mach-wrppmc/mach-gt64120.h index 00d8bf6164a9..83746b84a5ec 100644 --- a/include/asm-mips/mach-wrppmc/mach-gt64120.h +++ b/include/asm-mips/mach-wrppmc/mach-gt64120.h | |||
@@ -45,7 +45,7 @@ | |||
45 | #define GT_PCI_IO_SIZE 0x02000000UL | 45 | #define GT_PCI_IO_SIZE 0x02000000UL |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * PCI interrupts will come in on either the INTA or INTD interrups lines, | 48 | * PCI interrupts will come in on either the INTA or INTD interrupt lines, |
49 | * which are mapped to the #2 and #5 interrupt pins of the MIPS. On our | 49 | * which are mapped to the #2 and #5 interrupt pins of the MIPS. On our |
50 | * boards, they all either come in on IntD or they all come in on IntA, they | 50 | * boards, they all either come in on IntD or they all come in on IntA, they |
51 | * aren't mixed. There can be numerous PCI interrupts, so we keep a list of the | 51 | * aren't mixed. There can be numerous PCI interrupts, so we keep a list of the |
diff --git a/include/asm-mips/sgi/ip22.h b/include/asm-mips/sgi/ip22.h index f4981c4f16bb..c0501f91719b 100644 --- a/include/asm-mips/sgi/ip22.h +++ b/include/asm-mips/sgi/ip22.h | |||
@@ -15,7 +15,7 @@ | |||
15 | /* | 15 | /* |
16 | * These are the virtual IRQ numbers, we divide all IRQ's into | 16 | * These are the virtual IRQ numbers, we divide all IRQ's into |
17 | * 'spaces', the 'space' determines where and how to enable/disable | 17 | * 'spaces', the 'space' determines where and how to enable/disable |
18 | * that particular IRQ on an SGI machine. HPC DMA and MC DMA interrups | 18 | * that particular IRQ on an SGI machine. HPC DMA and MC DMA interrupts |
19 | * are not supported this way. Driver is supposed to allocate HPC/MC | 19 | * are not supported this way. Driver is supposed to allocate HPC/MC |
20 | * interrupt as shareable and then look to proper status bit (see | 20 | * interrupt as shareable and then look to proper status bit (see |
21 | * HAL2 driver). This will prevent many complications, trust me ;-) | 21 | * HAL2 driver). This will prevent many complications, trust me ;-) |
diff --git a/include/asm-mips/sn/sn0/hubio.h b/include/asm-mips/sn/sn0/hubio.h index ef91b3363554..0187895e556c 100644 --- a/include/asm-mips/sn/sn0/hubio.h +++ b/include/asm-mips/sn/sn0/hubio.h | |||
@@ -338,7 +338,7 @@ typedef union io_perf_cnt { | |||
338 | #define IIO_IFDR 0x400398 /* IOQ FIFO Depth */ | 338 | #define IIO_IFDR 0x400398 /* IOQ FIFO Depth */ |
339 | #define IIO_IIAP 0x4003a0 /* IIQ Arbitration Parameters */ | 339 | #define IIO_IIAP 0x4003a0 /* IIQ Arbitration Parameters */ |
340 | #define IIO_IMMR IIO_IIAP | 340 | #define IIO_IMMR IIO_IIAP |
341 | #define IIO_ICMR 0x4003a8 /* CRB Managment Register */ | 341 | #define IIO_ICMR 0x4003a8 /* CRB Management Register */ |
342 | #define IIO_ICCR 0x4003b0 /* CRB Control Register */ | 342 | #define IIO_ICCR 0x4003b0 /* CRB Control Register */ |
343 | #define IIO_ICTO 0x4003b8 /* CRB Time Out Register */ | 343 | #define IIO_ICTO 0x4003b8 /* CRB Time Out Register */ |
344 | #define IIO_ICTP 0x4003c0 /* CRB Time Out Prescalar */ | 344 | #define IIO_ICTP 0x4003c0 /* CRB Time Out Prescalar */ |
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h index 5a85d1b025c8..7f32611a7a5e 100644 --- a/include/asm-parisc/compat.h +++ b/include/asm-parisc/compat.h | |||
@@ -132,7 +132,7 @@ typedef u32 compat_sigset_word; | |||
132 | * A pointer passed in from user mode. This should not | 132 | * A pointer passed in from user mode. This should not |
133 | * be used for syscall parameters, just declare them | 133 | * be used for syscall parameters, just declare them |
134 | * as pointers because the syscall entry code will have | 134 | * as pointers because the syscall entry code will have |
135 | * appropriately comverted them already. | 135 | * appropriately converted them already. |
136 | */ | 136 | */ |
137 | typedef u32 compat_uptr_t; | 137 | typedef u32 compat_uptr_t; |
138 | 138 | ||
diff --git a/include/asm-parisc/elf.h b/include/asm-parisc/elf.h index f628ac7de83d..8e7946a141de 100644 --- a/include/asm-parisc/elf.h +++ b/include/asm-parisc/elf.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ | 28 | #define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */ |
29 | #define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ | 29 | #define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */ |
30 | 30 | ||
31 | /* Additional section indeces. */ | 31 | /* Additional section indices. */ |
32 | 32 | ||
33 | #define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared | 33 | #define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared |
34 | symbols in ANSI C. */ | 34 | symbols in ANSI C. */ |
diff --git a/include/asm-parisc/linkage.h b/include/asm-parisc/linkage.h index ad8cd0d069ea..0b19a7242d0c 100644 --- a/include/asm-parisc/linkage.h +++ b/include/asm-parisc/linkage.h | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | /* | 9 | /* |
10 | * In parisc assembly a semicolon marks a comment while a | 10 | * In parisc assembly a semicolon marks a comment while a |
11 | * exclamation mark is used to seperate independent lines. | 11 | * exclamation mark is used to separate independent lines. |
12 | */ | 12 | */ |
13 | #ifdef __ASSEMBLY__ | 13 | #ifdef __ASSEMBLY__ |
14 | 14 | ||
diff --git a/include/asm-parisc/vga.h b/include/asm-parisc/vga.h index 154a84c843a7..171399a88ca6 100644 --- a/include/asm-parisc/vga.h +++ b/include/asm-parisc/vga.h | |||
@@ -3,4 +3,4 @@ | |||
3 | 3 | ||
4 | /* nothing */ | 4 | /* nothing */ |
5 | 5 | ||
6 | #endif __ASM_PARISC_VGA_H__ | 6 | #endif /* __ASM_PARISC_VGA_H__ */ |
diff --git a/include/asm-powerpc/compat.h b/include/asm-powerpc/compat.h index 64ab1ddbdf85..d811a8cd7b58 100644 --- a/include/asm-powerpc/compat.h +++ b/include/asm-powerpc/compat.h | |||
@@ -119,7 +119,7 @@ typedef u32 compat_sigset_word; | |||
119 | * A pointer passed in from user mode. This should not | 119 | * A pointer passed in from user mode. This should not |
120 | * be used for syscall parameters, just declare them | 120 | * be used for syscall parameters, just declare them |
121 | * as pointers because the syscall entry code will have | 121 | * as pointers because the syscall entry code will have |
122 | * appropriately comverted them already. | 122 | * appropriately converted them already. |
123 | */ | 123 | */ |
124 | typedef u32 compat_uptr_t; | 124 | typedef u32 compat_uptr_t; |
125 | 125 | ||
diff --git a/include/asm-s390/compat.h b/include/asm-s390/compat.h index 7f4ad623f7d5..de065b32381a 100644 --- a/include/asm-s390/compat.h +++ b/include/asm-s390/compat.h | |||
@@ -149,7 +149,7 @@ typedef u32 compat_sigset_word; | |||
149 | * A pointer passed in from user mode. This should not | 149 | * A pointer passed in from user mode. This should not |
150 | * be used for syscall parameters, just declare them | 150 | * be used for syscall parameters, just declare them |
151 | * as pointers because the syscall entry code will have | 151 | * as pointers because the syscall entry code will have |
152 | * appropriately comverted them already. | 152 | * appropriately converted them already. |
153 | */ | 153 | */ |
154 | typedef u32 compat_uptr_t; | 154 | typedef u32 compat_uptr_t; |
155 | 155 | ||
diff --git a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h index 01fe6682b405..f260b58f5ce9 100644 --- a/include/asm-sparc64/compat.h +++ b/include/asm-sparc64/compat.h | |||
@@ -152,7 +152,7 @@ typedef u32 compat_sigset_word; | |||
152 | * A pointer passed in from user mode. This should not | 152 | * A pointer passed in from user mode. This should not |
153 | * be used for syscall parameters, just declare them | 153 | * be used for syscall parameters, just declare them |
154 | * as pointers because the syscall entry code will have | 154 | * as pointers because the syscall entry code will have |
155 | * appropriately comverted them already. | 155 | * appropriately converted them already. |
156 | */ | 156 | */ |
157 | typedef u32 compat_uptr_t; | 157 | typedef u32 compat_uptr_t; |
158 | 158 | ||
diff --git a/include/asm-x86/asm.h b/include/asm-x86/asm.h index 1a6980a60fc6..90dec0c23646 100644 --- a/include/asm-x86/asm.h +++ b/include/asm-x86/asm.h | |||
@@ -29,4 +29,11 @@ | |||
29 | 29 | ||
30 | #endif /* CONFIG_X86_32 */ | 30 | #endif /* CONFIG_X86_32 */ |
31 | 31 | ||
32 | /* Exception table entry */ | ||
33 | # define _ASM_EXTABLE(from,to) \ | ||
34 | " .section __ex_table,\"a\"\n" \ | ||
35 | _ASM_ALIGN "\n" \ | ||
36 | _ASM_PTR #from "," #to "\n" \ | ||
37 | " .previous\n" | ||
38 | |||
32 | #endif /* _ASM_X86_ASM_H */ | 39 | #endif /* _ASM_X86_ASM_H */ |
diff --git a/include/asm-x86/bugs.h b/include/asm-x86/bugs.h index 3fcc30dc0731..021cbdd5f258 100644 --- a/include/asm-x86/bugs.h +++ b/include/asm-x86/bugs.h | |||
@@ -2,6 +2,6 @@ | |||
2 | #define _ASM_X86_BUGS_H | 2 | #define _ASM_X86_BUGS_H |
3 | 3 | ||
4 | extern void check_bugs(void); | 4 | extern void check_bugs(void); |
5 | extern int ppro_with_ram_bug(void); | 5 | int ppro_with_ram_bug(void); |
6 | 6 | ||
7 | #endif /* _ASM_X86_BUGS_H */ | 7 | #endif /* _ASM_X86_BUGS_H */ |
diff --git a/include/asm-x86/compat.h b/include/asm-x86/compat.h index b270ee04959e..d3e8f3e87ee8 100644 --- a/include/asm-x86/compat.h +++ b/include/asm-x86/compat.h | |||
@@ -190,7 +190,7 @@ typedef struct user_regs_struct32 compat_elf_gregset_t; | |||
190 | * A pointer passed in from user mode. This should not | 190 | * A pointer passed in from user mode. This should not |
191 | * be used for syscall parameters, just declare them | 191 | * be used for syscall parameters, just declare them |
192 | * as pointers because the syscall entry code will have | 192 | * as pointers because the syscall entry code will have |
193 | * appropriately comverted them already. | 193 | * appropriately converted them already. |
194 | */ | 194 | */ |
195 | typedef u32 compat_uptr_t; | 195 | typedef u32 compat_uptr_t; |
196 | 196 | ||
diff --git a/include/asm-x86/cpufeature.h b/include/asm-x86/cpufeature.h index 3fb7dfa7fc91..065e92966c7c 100644 --- a/include/asm-x86/cpufeature.h +++ b/include/asm-x86/cpufeature.h | |||
@@ -4,9 +4,6 @@ | |||
4 | #ifndef _ASM_X86_CPUFEATURE_H | 4 | #ifndef _ASM_X86_CPUFEATURE_H |
5 | #define _ASM_X86_CPUFEATURE_H | 5 | #define _ASM_X86_CPUFEATURE_H |
6 | 6 | ||
7 | #ifndef __ASSEMBLY__ | ||
8 | #include <linux/bitops.h> | ||
9 | #endif | ||
10 | #include <asm/required-features.h> | 7 | #include <asm/required-features.h> |
11 | 8 | ||
12 | #define NCAPINTS 8 /* N 32-bit words worth of info */ | 9 | #define NCAPINTS 8 /* N 32-bit words worth of info */ |
@@ -49,6 +46,7 @@ | |||
49 | #define X86_FEATURE_MP (1*32+19) /* MP Capable. */ | 46 | #define X86_FEATURE_MP (1*32+19) /* MP Capable. */ |
50 | #define X86_FEATURE_NX (1*32+20) /* Execute Disable */ | 47 | #define X86_FEATURE_NX (1*32+20) /* Execute Disable */ |
51 | #define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ | 48 | #define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ |
49 | #define X86_FEATURE_GBPAGES (1*32+26) /* GB pages */ | ||
52 | #define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */ | 50 | #define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */ |
53 | #define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ | 51 | #define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ |
54 | #define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ | 52 | #define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ |
@@ -115,6 +113,13 @@ | |||
115 | */ | 113 | */ |
116 | #define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ | 114 | #define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ |
117 | 115 | ||
116 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | ||
117 | |||
118 | #include <linux/bitops.h> | ||
119 | |||
120 | extern const char * const x86_cap_flags[NCAPINTS*32]; | ||
121 | extern const char * const x86_power_flags[32]; | ||
122 | |||
118 | #define cpu_has(c, bit) \ | 123 | #define cpu_has(c, bit) \ |
119 | (__builtin_constant_p(bit) && \ | 124 | (__builtin_constant_p(bit) && \ |
120 | ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \ | 125 | ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \ |
@@ -175,6 +180,7 @@ | |||
175 | #define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS) | 180 | #define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS) |
176 | #define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH) | 181 | #define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH) |
177 | #define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS) | 182 | #define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS) |
183 | #define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES) | ||
178 | 184 | ||
179 | #if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64) | 185 | #if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64) |
180 | # define cpu_has_invlpg 1 | 186 | # define cpu_has_invlpg 1 |
@@ -204,4 +210,6 @@ | |||
204 | 210 | ||
205 | #endif /* CONFIG_X86_64 */ | 211 | #endif /* CONFIG_X86_64 */ |
206 | 212 | ||
213 | #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */ | ||
214 | |||
207 | #endif /* _ASM_X86_CPUFEATURE_H */ | 215 | #endif /* _ASM_X86_CPUFEATURE_H */ |
diff --git a/include/asm-x86/efi.h b/include/asm-x86/efi.h index 9c68a1f098d8..ea9734b74aca 100644 --- a/include/asm-x86/efi.h +++ b/include/asm-x86/efi.h | |||
@@ -33,7 +33,7 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...); | |||
33 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ | 33 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ |
34 | efi_call_virt(f, a1, a2, a3, a4, a5, a6) | 34 | efi_call_virt(f, a1, a2, a3, a4, a5, a6) |
35 | 35 | ||
36 | #define efi_ioremap(addr, size) ioremap(addr, size) | 36 | #define efi_ioremap(addr, size) ioremap_cache(addr, size) |
37 | 37 | ||
38 | #else /* !CONFIG_X86_32 */ | 38 | #else /* !CONFIG_X86_32 */ |
39 | 39 | ||
@@ -86,7 +86,7 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3, | |||
86 | efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | 86 | efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ |
87 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) | 87 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) |
88 | 88 | ||
89 | extern void *efi_ioremap(unsigned long offset, unsigned long size); | 89 | extern void *efi_ioremap(unsigned long addr, unsigned long size); |
90 | 90 | ||
91 | #endif /* CONFIG_X86_32 */ | 91 | #endif /* CONFIG_X86_32 */ |
92 | 92 | ||
diff --git a/include/asm-x86/futex.h b/include/asm-x86/futex.h index 9d919264923a..cd9f894dd2d7 100644 --- a/include/asm-x86/futex.h +++ b/include/asm-x86/futex.h | |||
@@ -17,11 +17,8 @@ | |||
17 | "2: .section .fixup,\"ax\"\n \ | 17 | "2: .section .fixup,\"ax\"\n \ |
18 | 3: mov %3, %1\n \ | 18 | 3: mov %3, %1\n \ |
19 | jmp 2b\n \ | 19 | jmp 2b\n \ |
20 | .previous\n \ | 20 | .previous\n" \ |
21 | .section __ex_table,\"a\"\n \ | 21 | _ASM_EXTABLE(1b,3b) \ |
22 | .align 8\n" \ | ||
23 | _ASM_PTR "1b,3b\n \ | ||
24 | .previous" \ | ||
25 | : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \ | 22 | : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \ |
26 | : "i" (-EFAULT), "0" (oparg), "1" (0)) | 23 | : "i" (-EFAULT), "0" (oparg), "1" (0)) |
27 | 24 | ||
@@ -35,11 +32,9 @@ | |||
35 | 3: .section .fixup,\"ax\"\n \ | 32 | 3: .section .fixup,\"ax\"\n \ |
36 | 4: mov %5, %1\n \ | 33 | 4: mov %5, %1\n \ |
37 | jmp 3b\n \ | 34 | jmp 3b\n \ |
38 | .previous\n \ | 35 | .previous\n" \ |
39 | .section __ex_table,\"a\"\n \ | 36 | _ASM_EXTABLE(1b,4b) \ |
40 | .align 8\n" \ | 37 | _ASM_EXTABLE(2b,4b) \ |
41 | _ASM_PTR "1b,4b,2b,4b\n \ | ||
42 | .previous" \ | ||
43 | : "=&a" (oldval), "=&r" (ret), "+m" (*uaddr), \ | 38 | : "=&a" (oldval), "=&r" (ret), "+m" (*uaddr), \ |
44 | "=&r" (tem) \ | 39 | "=&r" (tem) \ |
45 | : "r" (oparg), "i" (-EFAULT), "1" (0)) | 40 | : "r" (oparg), "i" (-EFAULT), "1" (0)) |
@@ -111,18 +106,12 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) | |||
111 | return -EFAULT; | 106 | return -EFAULT; |
112 | 107 | ||
113 | __asm__ __volatile__( | 108 | __asm__ __volatile__( |
114 | |||
115 | "1: lock; cmpxchgl %3, %1 \n" | 109 | "1: lock; cmpxchgl %3, %1 \n" |
116 | "2: .section .fixup, \"ax\" \n" | 110 | "2: .section .fixup, \"ax\" \n" |
117 | "3: mov %2, %0 \n" | 111 | "3: mov %2, %0 \n" |
118 | " jmp 2b \n" | 112 | " jmp 2b \n" |
119 | " .previous \n" | 113 | " .previous \n" |
120 | 114 | _ASM_EXTABLE(1b,3b) | |
121 | " .section __ex_table, \"a\" \n" | ||
122 | " .align 8 \n" | ||
123 | _ASM_PTR " 1b,3b \n" | ||
124 | " .previous \n" | ||
125 | |||
126 | : "=a" (oldval), "+m" (*uaddr) | 115 | : "=a" (oldval), "+m" (*uaddr) |
127 | : "i" (-EFAULT), "r" (newval), "0" (oldval) | 116 | : "i" (-EFAULT), "r" (newval), "0" (oldval) |
128 | : "memory" | 117 | : "memory" |
diff --git a/include/asm-x86/highmem.h b/include/asm-x86/highmem.h index 13cdcd66fff2..c25cfcaab589 100644 --- a/include/asm-x86/highmem.h +++ b/include/asm-x86/highmem.h | |||
@@ -63,8 +63,8 @@ extern pte_t *pkmap_page_table; | |||
63 | #define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) | 63 | #define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) |
64 | #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) | 64 | #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) |
65 | 65 | ||
66 | extern void * FASTCALL(kmap_high(struct page *page)); | 66 | extern void *kmap_high(struct page *page); |
67 | extern void FASTCALL(kunmap_high(struct page *page)); | 67 | extern void kunmap_high(struct page *page); |
68 | 68 | ||
69 | void *kmap(struct page *page); | 69 | void *kmap(struct page *page); |
70 | void kunmap(struct page *page); | 70 | void kunmap(struct page *page); |
diff --git a/include/asm-x86/hw_irq_32.h b/include/asm-x86/hw_irq_32.h index 6d65fbb6358b..ea88054e03f3 100644 --- a/include/asm-x86/hw_irq_32.h +++ b/include/asm-x86/hw_irq_32.h | |||
@@ -47,7 +47,7 @@ void enable_8259A_irq(unsigned int irq); | |||
47 | int i8259A_irq_pending(unsigned int irq); | 47 | int i8259A_irq_pending(unsigned int irq); |
48 | void make_8259A_irq(unsigned int irq); | 48 | void make_8259A_irq(unsigned int irq); |
49 | void init_8259A(int aeoi); | 49 | void init_8259A(int aeoi); |
50 | void FASTCALL(send_IPI_self(int vector)); | 50 | void send_IPI_self(int vector); |
51 | void init_VISWS_APIC_irqs(void); | 51 | void init_VISWS_APIC_irqs(void); |
52 | void setup_IO_APIC(void); | 52 | void setup_IO_APIC(void); |
53 | void disable_IO_APIC(void); | 53 | void disable_IO_APIC(void); |
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h index ba8105ca822b..6b1895ccd6b7 100644 --- a/include/asm-x86/i387.h +++ b/include/asm-x86/i387.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/kernel_stat.h> | 14 | #include <linux/kernel_stat.h> |
15 | #include <linux/regset.h> | 15 | #include <linux/regset.h> |
16 | #include <asm/asm.h> | ||
16 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
17 | #include <asm/sigcontext.h> | 18 | #include <asm/sigcontext.h> |
18 | #include <asm/user.h> | 19 | #include <asm/user.h> |
@@ -41,10 +42,7 @@ static inline void tolerant_fwait(void) | |||
41 | { | 42 | { |
42 | asm volatile("1: fwait\n" | 43 | asm volatile("1: fwait\n" |
43 | "2:\n" | 44 | "2:\n" |
44 | " .section __ex_table,\"a\"\n" | 45 | _ASM_EXTABLE(1b,2b)); |
45 | " .align 8\n" | ||
46 | " .quad 1b,2b\n" | ||
47 | " .previous\n"); | ||
48 | } | 46 | } |
49 | 47 | ||
50 | static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) | 48 | static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) |
@@ -57,10 +55,7 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) | |||
57 | "3: movl $-1,%[err]\n" | 55 | "3: movl $-1,%[err]\n" |
58 | " jmp 2b\n" | 56 | " jmp 2b\n" |
59 | ".previous\n" | 57 | ".previous\n" |
60 | ".section __ex_table,\"a\"\n" | 58 | _ASM_EXTABLE(1b,3b) |
61 | " .align 8\n" | ||
62 | " .quad 1b,3b\n" | ||
63 | ".previous" | ||
64 | : [err] "=r" (err) | 59 | : [err] "=r" (err) |
65 | #if 0 /* See comment in __save_init_fpu() below. */ | 60 | #if 0 /* See comment in __save_init_fpu() below. */ |
66 | : [fx] "r" (fx), "m" (*fx), "0" (0)); | 61 | : [fx] "r" (fx), "m" (*fx), "0" (0)); |
@@ -99,10 +94,7 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) | |||
99 | "3: movl $-1,%[err]\n" | 94 | "3: movl $-1,%[err]\n" |
100 | " jmp 2b\n" | 95 | " jmp 2b\n" |
101 | ".previous\n" | 96 | ".previous\n" |
102 | ".section __ex_table,\"a\"\n" | 97 | _ASM_EXTABLE(1b,3b) |
103 | " .align 8\n" | ||
104 | " .quad 1b,3b\n" | ||
105 | ".previous" | ||
106 | : [err] "=r" (err), "=m" (*fx) | 98 | : [err] "=r" (err), "=m" (*fx) |
107 | #if 0 /* See comment in __fxsave_clear() below. */ | 99 | #if 0 /* See comment in __fxsave_clear() below. */ |
108 | : [fx] "r" (fx), "0" (0)); | 100 | : [fx] "r" (fx), "0" (0)); |
diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h index 586d7aa54ceb..58d2c45cd0b1 100644 --- a/include/asm-x86/io_32.h +++ b/include/asm-x86/io_32.h | |||
@@ -275,29 +275,6 @@ static inline void slow_down_io(void) { | |||
275 | 275 | ||
276 | #endif | 276 | #endif |
277 | 277 | ||
278 | #ifdef CONFIG_X86_NUMAQ | ||
279 | extern void *xquad_portio; /* Where the IO area was mapped */ | ||
280 | #define XQUAD_PORT_ADDR(port, quad) (xquad_portio + (XQUAD_PORTIO_QUAD*quad) + port) | ||
281 | #define __BUILDIO(bwl,bw,type) \ | ||
282 | static inline void out##bwl##_quad(unsigned type value, int port, int quad) { \ | ||
283 | if (xquad_portio) \ | ||
284 | write##bwl(value, XQUAD_PORT_ADDR(port, quad)); \ | ||
285 | else \ | ||
286 | out##bwl##_local(value, port); \ | ||
287 | } \ | ||
288 | static inline void out##bwl(unsigned type value, int port) { \ | ||
289 | out##bwl##_quad(value, port, 0); \ | ||
290 | } \ | ||
291 | static inline unsigned type in##bwl##_quad(int port, int quad) { \ | ||
292 | if (xquad_portio) \ | ||
293 | return read##bwl(XQUAD_PORT_ADDR(port, quad)); \ | ||
294 | else \ | ||
295 | return in##bwl##_local(port); \ | ||
296 | } \ | ||
297 | static inline unsigned type in##bwl(int port) { \ | ||
298 | return in##bwl##_quad(port, 0); \ | ||
299 | } | ||
300 | #else | ||
301 | #define __BUILDIO(bwl,bw,type) \ | 278 | #define __BUILDIO(bwl,bw,type) \ |
302 | static inline void out##bwl(unsigned type value, int port) { \ | 279 | static inline void out##bwl(unsigned type value, int port) { \ |
303 | out##bwl##_local(value, port); \ | 280 | out##bwl##_local(value, port); \ |
@@ -305,8 +282,6 @@ static inline void out##bwl(unsigned type value, int port) { \ | |||
305 | static inline unsigned type in##bwl(int port) { \ | 282 | static inline unsigned type in##bwl(int port) { \ |
306 | return in##bwl##_local(port); \ | 283 | return in##bwl##_local(port); \ |
307 | } | 284 | } |
308 | #endif | ||
309 | |||
310 | 285 | ||
311 | #define BUILDIO(bwl,bw,type) \ | 286 | #define BUILDIO(bwl,bw,type) \ |
312 | static inline void out##bwl##_local(unsigned type value, int port) { \ | 287 | static inline void out##bwl##_local(unsigned type value, int port) { \ |
diff --git a/include/asm-x86/mach-numaq/mach_apic.h b/include/asm-x86/mach-numaq/mach_apic.h index 17e183bd39c1..3b637fac890b 100644 --- a/include/asm-x86/mach-numaq/mach_apic.h +++ b/include/asm-x86/mach-numaq/mach_apic.h | |||
@@ -109,6 +109,8 @@ static inline int mpc_apic_id(struct mpc_config_processor *m, | |||
109 | return logical_apicid; | 109 | return logical_apicid; |
110 | } | 110 | } |
111 | 111 | ||
112 | extern void *xquad_portio; | ||
113 | |||
112 | static inline void setup_portio_remap(void) | 114 | static inline void setup_portio_remap(void) |
113 | { | 115 | { |
114 | int num_quads = num_online_nodes(); | 116 | int num_quads = num_online_nodes(); |
diff --git a/include/asm-x86/mach-voyager/do_timer.h b/include/asm-x86/mach-voyager/do_timer.h index bc2b58926308..9e5a459fd15b 100644 --- a/include/asm-x86/mach-voyager/do_timer.h +++ b/include/asm-x86/mach-voyager/do_timer.h | |||
@@ -6,7 +6,6 @@ | |||
6 | 6 | ||
7 | /** | 7 | /** |
8 | * do_timer_interrupt_hook - hook into timer tick | 8 | * do_timer_interrupt_hook - hook into timer tick |
9 | * @regs: standard registers from interrupt | ||
10 | * | 9 | * |
11 | * Call the pit clock event handler. see asm/i8253.h | 10 | * Call the pit clock event handler. see asm/i8253.h |
12 | **/ | 11 | **/ |
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h index 204a8a30fecf..3ca29ebebbb1 100644 --- a/include/asm-x86/msr.h +++ b/include/asm-x86/msr.h | |||
@@ -57,10 +57,7 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr, | |||
57 | ".section .fixup,\"ax\"\n\t" | 57 | ".section .fixup,\"ax\"\n\t" |
58 | "3: mov %3,%0 ; jmp 1b\n\t" | 58 | "3: mov %3,%0 ; jmp 1b\n\t" |
59 | ".previous\n\t" | 59 | ".previous\n\t" |
60 | ".section __ex_table,\"a\"\n" | 60 | _ASM_EXTABLE(2b,3b) |
61 | _ASM_ALIGN "\n\t" | ||
62 | _ASM_PTR " 2b,3b\n\t" | ||
63 | ".previous" | ||
64 | : "=r" (*err), EAX_EDX_RET(val, low, high) | 61 | : "=r" (*err), EAX_EDX_RET(val, low, high) |
65 | : "c" (msr), "i" (-EFAULT)); | 62 | : "c" (msr), "i" (-EFAULT)); |
66 | return EAX_EDX_VAL(val, low, high); | 63 | return EAX_EDX_VAL(val, low, high); |
@@ -81,10 +78,7 @@ static inline int native_write_msr_safe(unsigned int msr, | |||
81 | ".section .fixup,\"ax\"\n\t" | 78 | ".section .fixup,\"ax\"\n\t" |
82 | "3: mov %4,%0 ; jmp 1b\n\t" | 79 | "3: mov %4,%0 ; jmp 1b\n\t" |
83 | ".previous\n\t" | 80 | ".previous\n\t" |
84 | ".section __ex_table,\"a\"\n" | 81 | _ASM_EXTABLE(2b,3b) |
85 | _ASM_ALIGN "\n\t" | ||
86 | _ASM_PTR " 2b,3b\n\t" | ||
87 | ".previous" | ||
88 | : "=a" (err) | 82 | : "=a" (err) |
89 | : "c" (msr), "0" (low), "d" (high), | 83 | : "c" (msr), "0" (low), "d" (high), |
90 | "i" (-EFAULT)); | 84 | "i" (-EFAULT)); |
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h index c8b30efeed85..1cb7c51bc296 100644 --- a/include/asm-x86/page.h +++ b/include/asm-x86/page.h | |||
@@ -13,8 +13,8 @@ | |||
13 | #define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK) | 13 | #define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK) |
14 | #define PTE_MASK (_AT(long, PHYSICAL_PAGE_MASK)) | 14 | #define PTE_MASK (_AT(long, PHYSICAL_PAGE_MASK)) |
15 | 15 | ||
16 | #define LARGE_PAGE_SIZE (_AC(1,UL) << PMD_SHIFT) | 16 | #define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT) |
17 | #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) | 17 | #define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1)) |
18 | 18 | ||
19 | #define HPAGE_SHIFT PMD_SHIFT | 19 | #define HPAGE_SHIFT PMD_SHIFT |
20 | #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) | 20 | #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) |
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h index c1ac42d8707f..dcf0c0746075 100644 --- a/include/asm-x86/page_64.h +++ b/include/asm-x86/page_64.h | |||
@@ -23,6 +23,9 @@ | |||
23 | #define MCE_STACK 5 | 23 | #define MCE_STACK 5 |
24 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ | 24 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ |
25 | 25 | ||
26 | #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) | ||
27 | #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) | ||
28 | |||
26 | #define __PAGE_OFFSET _AC(0xffff810000000000, UL) | 29 | #define __PAGE_OFFSET _AC(0xffff810000000000, UL) |
27 | 30 | ||
28 | #define __PHYSICAL_START CONFIG_PHYSICAL_START | 31 | #define __PHYSICAL_START CONFIG_PHYSICAL_START |
diff --git a/include/asm-x86/pgalloc_32.h b/include/asm-x86/pgalloc_32.h index 7641e7b5d931..6c21ef951dab 100644 --- a/include/asm-x86/pgalloc_32.h +++ b/include/asm-x86/pgalloc_32.h | |||
@@ -80,8 +80,10 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd) | |||
80 | set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT)); | 80 | set_pud(pudp, __pud(__pa(pmd) | _PAGE_PRESENT)); |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Pentium-II erratum A13: in PAE mode we explicitly have to flush | 83 | * According to Intel App note "TLBs, Paging-Structure Caches, |
84 | * the TLB via cr3 if the top-level pgd is changed... | 84 | * and Their Invalidation", April 2007, document 317080-001, |
85 | * section 8.1: in PAE mode we explicitly have to flush the | ||
86 | * TLB via cr3 if the top-level pgd is changed... | ||
85 | */ | 87 | */ |
86 | if (mm == current->active_mm) | 88 | if (mm == current->active_mm) |
87 | write_cr3(read_cr3()); | 89 | write_cr3(read_cr3()); |
diff --git a/include/asm-x86/pgtable-3level.h b/include/asm-x86/pgtable-3level.h index a195c3e757b9..1d763eec740f 100644 --- a/include/asm-x86/pgtable-3level.h +++ b/include/asm-x86/pgtable-3level.h | |||
@@ -93,26 +93,22 @@ static inline void native_pmd_clear(pmd_t *pmd) | |||
93 | 93 | ||
94 | static inline void pud_clear(pud_t *pudp) | 94 | static inline void pud_clear(pud_t *pudp) |
95 | { | 95 | { |
96 | unsigned long pgd; | ||
97 | |||
96 | set_pud(pudp, __pud(0)); | 98 | set_pud(pudp, __pud(0)); |
97 | 99 | ||
98 | /* | 100 | /* |
99 | * In principle we need to do a cr3 reload here to make sure | 101 | * According to Intel App note "TLBs, Paging-Structure Caches, |
100 | * the processor recognizes the changed pgd. In practice, all | 102 | * and Their Invalidation", April 2007, document 317080-001, |
101 | * the places where pud_clear() gets called are followed by | 103 | * section 8.1: in PAE mode we explicitly have to flush the |
102 | * full tlb flushes anyway, so we can defer the cost here. | 104 | * TLB via cr3 if the top-level pgd is changed... |
103 | * | ||
104 | * Specifically: | ||
105 | * | ||
106 | * mm/memory.c:free_pmd_range() - immediately after the | ||
107 | * pud_clear() it does a pmd_free_tlb(). We change the | ||
108 | * mmu_gather structure to do a full tlb flush (which has the | ||
109 | * effect of reloading cr3) when the pagetable free is | ||
110 | * complete. | ||
111 | * | 105 | * |
112 | * arch/x86/mm/hugetlbpage.c:huge_pmd_unshare() - the call to | 106 | * Make sure the pud entry we're updating is within the |
113 | * this is followed by a flush_tlb_range, which on x86 does a | 107 | * current pgd to avoid unnecessary TLB flushes. |
114 | * full tlb flush. | ||
115 | */ | 108 | */ |
109 | pgd = read_cr3(); | ||
110 | if (__pa(pudp) >= pgd && __pa(pudp) < (pgd + sizeof(pgd_t)*PTRS_PER_PGD)) | ||
111 | write_cr3(pgd); | ||
116 | } | 112 | } |
117 | 113 | ||
118 | #define pud_page(pud) \ | 114 | #define pud_page(pud) \ |
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index cd2524f07452..44c0a4f1b1eb 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -13,10 +13,12 @@ | |||
13 | #define _PAGE_BIT_DIRTY 6 | 13 | #define _PAGE_BIT_DIRTY 6 |
14 | #define _PAGE_BIT_FILE 6 | 14 | #define _PAGE_BIT_FILE 6 |
15 | #define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */ | 15 | #define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */ |
16 | #define _PAGE_BIT_PAT 7 /* on 4KB pages */ | ||
16 | #define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ | 17 | #define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ |
17 | #define _PAGE_BIT_UNUSED1 9 /* available for programmer */ | 18 | #define _PAGE_BIT_UNUSED1 9 /* available for programmer */ |
18 | #define _PAGE_BIT_UNUSED2 10 | 19 | #define _PAGE_BIT_UNUSED2 10 |
19 | #define _PAGE_BIT_UNUSED3 11 | 20 | #define _PAGE_BIT_UNUSED3 11 |
21 | #define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */ | ||
20 | #define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ | 22 | #define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ |
21 | 23 | ||
22 | /* | 24 | /* |
@@ -36,6 +38,8 @@ | |||
36 | #define _PAGE_UNUSED1 (_AC(1, L)<<_PAGE_BIT_UNUSED1) | 38 | #define _PAGE_UNUSED1 (_AC(1, L)<<_PAGE_BIT_UNUSED1) |
37 | #define _PAGE_UNUSED2 (_AC(1, L)<<_PAGE_BIT_UNUSED2) | 39 | #define _PAGE_UNUSED2 (_AC(1, L)<<_PAGE_BIT_UNUSED2) |
38 | #define _PAGE_UNUSED3 (_AC(1, L)<<_PAGE_BIT_UNUSED3) | 40 | #define _PAGE_UNUSED3 (_AC(1, L)<<_PAGE_BIT_UNUSED3) |
41 | #define _PAGE_PAT (_AC(1, L)<<_PAGE_BIT_PAT) | ||
42 | #define _PAGE_PAT_LARGE (_AC(1, L)<<_PAGE_BIT_PAT_LARGE) | ||
39 | 43 | ||
40 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) | 44 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) |
41 | #define _PAGE_NX (_AC(1, ULL) << _PAGE_BIT_NX) | 45 | #define _PAGE_NX (_AC(1, ULL) << _PAGE_BIT_NX) |
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h index 21e70fbf1dae..935630d17304 100644 --- a/include/asm-x86/pgtable_32.h +++ b/include/asm-x86/pgtable_32.h | |||
@@ -148,6 +148,8 @@ static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count) | |||
148 | */ | 148 | */ |
149 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | 149 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) |
150 | 150 | ||
151 | static inline int pud_large(pud_t pud) { return 0; } | ||
152 | |||
151 | /* | 153 | /* |
152 | * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD] | 154 | * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD] |
153 | * | 155 | * |
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h index 6e615a103c2f..bd4740a60f29 100644 --- a/include/asm-x86/pgtable_64.h +++ b/include/asm-x86/pgtable_64.h | |||
@@ -21,7 +21,6 @@ extern pgd_t init_level4_pgt[]; | |||
21 | #define swapper_pg_dir init_level4_pgt | 21 | #define swapper_pg_dir init_level4_pgt |
22 | 22 | ||
23 | extern void paging_init(void); | 23 | extern void paging_init(void); |
24 | extern void clear_kernel_mapping(unsigned long addr, unsigned long size); | ||
25 | 24 | ||
26 | #endif /* !__ASSEMBLY__ */ | 25 | #endif /* !__ASSEMBLY__ */ |
27 | 26 | ||
@@ -199,6 +198,12 @@ static inline unsigned long pmd_bad(pmd_t pmd) | |||
199 | #define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address)) | 198 | #define pud_offset(pgd, address) ((pud_t *) pgd_page_vaddr(*(pgd)) + pud_index(address)) |
200 | #define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT) | 199 | #define pud_present(pud) (pud_val(pud) & _PAGE_PRESENT) |
201 | 200 | ||
201 | static inline int pud_large(pud_t pte) | ||
202 | { | ||
203 | return (pud_val(pte) & (_PAGE_PSE|_PAGE_PRESENT)) == | ||
204 | (_PAGE_PSE|_PAGE_PRESENT); | ||
205 | } | ||
206 | |||
202 | /* PMD - Level 2 access */ | 207 | /* PMD - Level 2 access */ |
203 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) | 208 | #define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK)) |
204 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | 209 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) |
diff --git a/include/asm-x86/string_32.h b/include/asm-x86/string_32.h index 55bfa308f900..c5d13a86dea7 100644 --- a/include/asm-x86/string_32.h +++ b/include/asm-x86/string_32.h | |||
@@ -213,14 +213,14 @@ static __always_inline void * __constant_c_and_count_memset(void * s, unsigned l | |||
213 | case 0: | 213 | case 0: |
214 | return s; | 214 | return s; |
215 | case 1: | 215 | case 1: |
216 | *(unsigned char *)s = pattern; | 216 | *(unsigned char *)s = pattern & 0xff; |
217 | return s; | 217 | return s; |
218 | case 2: | 218 | case 2: |
219 | *(unsigned short *)s = pattern; | 219 | *(unsigned short *)s = pattern & 0xffff; |
220 | return s; | 220 | return s; |
221 | case 3: | 221 | case 3: |
222 | *(unsigned short *)s = pattern; | 222 | *(unsigned short *)s = pattern & 0xffff; |
223 | *(2+(unsigned char *)s) = pattern; | 223 | *(2+(unsigned char *)s) = pattern & 0xff; |
224 | return s; | 224 | return s; |
225 | case 4: | 225 | case 4: |
226 | *(unsigned long *)s = pattern; | 226 | *(unsigned long *)s = pattern; |
diff --git a/include/asm-x86/system.h b/include/asm-x86/system.h index ee32ef9367f4..9cff02ffe6c2 100644 --- a/include/asm-x86/system.h +++ b/include/asm-x86/system.h | |||
@@ -20,8 +20,8 @@ | |||
20 | #ifdef CONFIG_X86_32 | 20 | #ifdef CONFIG_X86_32 |
21 | 21 | ||
22 | struct task_struct; /* one of the stranger aspects of C forward declarations */ | 22 | struct task_struct; /* one of the stranger aspects of C forward declarations */ |
23 | extern struct task_struct *FASTCALL(__switch_to(struct task_struct *prev, | 23 | struct task_struct *__switch_to(struct task_struct *prev, |
24 | struct task_struct *next)); | 24 | struct task_struct *next); |
25 | 25 | ||
26 | /* | 26 | /* |
27 | * Saving eflags is important. It switches not only IOPL between tasks, | 27 | * Saving eflags is important. It switches not only IOPL between tasks, |
@@ -130,10 +130,7 @@ extern void load_gs_index(unsigned); | |||
130 | "movl %k1, %%" #seg "\n\t" \ | 130 | "movl %k1, %%" #seg "\n\t" \ |
131 | "jmp 2b\n" \ | 131 | "jmp 2b\n" \ |
132 | ".previous\n" \ | 132 | ".previous\n" \ |
133 | ".section __ex_table,\"a\"\n\t" \ | 133 | _ASM_EXTABLE(1b,3b) \ |
134 | _ASM_ALIGN "\n\t" \ | ||
135 | _ASM_PTR " 1b,3b\n" \ | ||
136 | ".previous" \ | ||
137 | : :"r" (value), "r" (0)) | 134 | : :"r" (value), "r" (0)) |
138 | 135 | ||
139 | 136 | ||
@@ -214,12 +211,10 @@ static inline unsigned long native_read_cr4_safe(void) | |||
214 | /* This could fault if %cr4 does not exist. In x86_64, a cr4 always | 211 | /* This could fault if %cr4 does not exist. In x86_64, a cr4 always |
215 | * exists, so it will never fail. */ | 212 | * exists, so it will never fail. */ |
216 | #ifdef CONFIG_X86_32 | 213 | #ifdef CONFIG_X86_32 |
217 | asm volatile("1: mov %%cr4, %0 \n" | 214 | asm volatile("1: mov %%cr4, %0\n" |
218 | "2: \n" | 215 | "2:\n" |
219 | ".section __ex_table,\"a\" \n" | 216 | _ASM_EXTABLE(1b,2b) |
220 | ".long 1b,2b \n" | 217 | : "=r" (val), "=m" (__force_order) : "0" (0)); |
221 | ".previous \n" | ||
222 | : "=r" (val), "=m" (__force_order) : "0" (0)); | ||
223 | #else | 218 | #else |
224 | val = native_read_cr4(); | 219 | val = native_read_cr4(); |
225 | #endif | 220 | #endif |
@@ -276,9 +271,9 @@ static inline void native_wbinvd(void) | |||
276 | 271 | ||
277 | #endif /* __KERNEL__ */ | 272 | #endif /* __KERNEL__ */ |
278 | 273 | ||
279 | static inline void clflush(void *__p) | 274 | static inline void clflush(volatile void *__p) |
280 | { | 275 | { |
281 | asm volatile("clflush %0" : "+m" (*(char __force *)__p)); | 276 | asm volatile("clflush %0" : "+m" (*(volatile char __force *)__p)); |
282 | } | 277 | } |
283 | 278 | ||
284 | #define nop() __asm__ __volatile__ ("nop") | 279 | #define nop() __asm__ __volatile__ ("nop") |
diff --git a/include/asm-x86/uaccess_32.h b/include/asm-x86/uaccess_32.h index d2a4f7be9c2c..fcc570ec4fee 100644 --- a/include/asm-x86/uaccess_32.h +++ b/include/asm-x86/uaccess_32.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/thread_info.h> | 8 | #include <linux/thread_info.h> |
9 | #include <linux/prefetch.h> | 9 | #include <linux/prefetch.h> |
10 | #include <linux/string.h> | 10 | #include <linux/string.h> |
11 | #include <asm/asm.h> | ||
11 | #include <asm/page.h> | 12 | #include <asm/page.h> |
12 | 13 | ||
13 | #define VERIFY_READ 0 | 14 | #define VERIFY_READ 0 |
@@ -287,11 +288,8 @@ extern void __put_user_8(void); | |||
287 | "4: movl %3,%0\n" \ | 288 | "4: movl %3,%0\n" \ |
288 | " jmp 3b\n" \ | 289 | " jmp 3b\n" \ |
289 | ".previous\n" \ | 290 | ".previous\n" \ |
290 | ".section __ex_table,\"a\"\n" \ | 291 | _ASM_EXTABLE(1b,4b) \ |
291 | " .align 4\n" \ | 292 | _ASM_EXTABLE(2b,4b) \ |
292 | " .long 1b,4b\n" \ | ||
293 | " .long 2b,4b\n" \ | ||
294 | ".previous" \ | ||
295 | : "=r"(err) \ | 293 | : "=r"(err) \ |
296 | : "A" (x), "r" (addr), "i"(-EFAULT), "0"(err)) | 294 | : "A" (x), "r" (addr), "i"(-EFAULT), "0"(err)) |
297 | 295 | ||
@@ -338,10 +336,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
338 | "3: movl %3,%0\n" \ | 336 | "3: movl %3,%0\n" \ |
339 | " jmp 2b\n" \ | 337 | " jmp 2b\n" \ |
340 | ".previous\n" \ | 338 | ".previous\n" \ |
341 | ".section __ex_table,\"a\"\n" \ | 339 | _ASM_EXTABLE(1b,3b) \ |
342 | " .align 4\n" \ | ||
343 | " .long 1b,3b\n" \ | ||
344 | ".previous" \ | ||
345 | : "=r"(err) \ | 340 | : "=r"(err) \ |
346 | : ltype (x), "m"(__m(addr)), "i"(errret), "0"(err)) | 341 | : ltype (x), "m"(__m(addr)), "i"(errret), "0"(err)) |
347 | 342 | ||
@@ -378,10 +373,7 @@ do { \ | |||
378 | " xor"itype" %"rtype"1,%"rtype"1\n" \ | 373 | " xor"itype" %"rtype"1,%"rtype"1\n" \ |
379 | " jmp 2b\n" \ | 374 | " jmp 2b\n" \ |
380 | ".previous\n" \ | 375 | ".previous\n" \ |
381 | ".section __ex_table,\"a\"\n" \ | 376 | _ASM_EXTABLE(1b,3b) \ |
382 | " .align 4\n" \ | ||
383 | " .long 1b,3b\n" \ | ||
384 | ".previous" \ | ||
385 | : "=r"(err), ltype (x) \ | 377 | : "=r"(err), ltype (x) \ |
386 | : "m"(__m(addr)), "i"(errret), "0"(err)) | 378 | : "m"(__m(addr)), "i"(errret), "0"(err)) |
387 | 379 | ||
diff --git a/include/asm-x86/uaccess_64.h b/include/asm-x86/uaccess_64.h index 31d794702719..b87eb4ba8f9d 100644 --- a/include/asm-x86/uaccess_64.h +++ b/include/asm-x86/uaccess_64.h | |||
@@ -181,10 +181,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
181 | "3: mov %3,%0\n" \ | 181 | "3: mov %3,%0\n" \ |
182 | " jmp 2b\n" \ | 182 | " jmp 2b\n" \ |
183 | ".previous\n" \ | 183 | ".previous\n" \ |
184 | ".section __ex_table,\"a\"\n" \ | 184 | _ASM_EXTABLE(1b,3b) \ |
185 | " .align 8\n" \ | ||
186 | " .quad 1b,3b\n" \ | ||
187 | ".previous" \ | ||
188 | : "=r"(err) \ | 185 | : "=r"(err) \ |
189 | : ltype (x), "m"(__m(addr)), "i"(errno), "0"(err)) | 186 | : ltype (x), "m"(__m(addr)), "i"(errno), "0"(err)) |
190 | 187 | ||
@@ -226,10 +223,7 @@ do { \ | |||
226 | " xor"itype" %"rtype"1,%"rtype"1\n" \ | 223 | " xor"itype" %"rtype"1,%"rtype"1\n" \ |
227 | " jmp 2b\n" \ | 224 | " jmp 2b\n" \ |
228 | ".previous\n" \ | 225 | ".previous\n" \ |
229 | ".section __ex_table,\"a\"\n" \ | 226 | _ASM_EXTABLE(1b,3b) \ |
230 | " .align 8\n" \ | ||
231 | " .quad 1b,3b\n" \ | ||
232 | ".previous" \ | ||
233 | : "=r"(err), ltype (x) \ | 227 | : "=r"(err), ltype (x) \ |
234 | : "m"(__m(addr)), "i"(errno), "0"(err)) | 228 | : "m"(__m(addr)), "i"(errno), "0"(err)) |
235 | 229 | ||
diff --git a/include/asm-x86/vm86.h b/include/asm-x86/vm86.h index a5edf517b992..c92fe4af52e8 100644 --- a/include/asm-x86/vm86.h +++ b/include/asm-x86/vm86.h | |||
@@ -195,6 +195,7 @@ struct kernel_vm86_struct { | |||
195 | 195 | ||
196 | void handle_vm86_fault(struct kernel_vm86_regs *, long); | 196 | void handle_vm86_fault(struct kernel_vm86_regs *, long); |
197 | int handle_vm86_trap(struct kernel_vm86_regs *, long, int); | 197 | int handle_vm86_trap(struct kernel_vm86_regs *, long, int); |
198 | struct pt_regs *save_v86_state(struct kernel_vm86_regs *); | ||
198 | 199 | ||
199 | struct task_struct; | 200 | struct task_struct; |
200 | void release_vm86_irqs(struct task_struct *); | 201 | void release_vm86_irqs(struct task_struct *); |
diff --git a/include/linux/aspm.h b/include/linux/aspm.h deleted file mode 100644 index f41a69895485..000000000000 --- a/include/linux/aspm.h +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* | ||
2 | * aspm.h | ||
3 | * | ||
4 | * PCI Express ASPM defines and function prototypes | ||
5 | * | ||
6 | * Copyright (C) 2007 Intel Corp. | ||
7 | * Zhang Yanmin (yanmin.zhang@intel.com) | ||
8 | * Shaohua Li (shaohua.li@intel.com) | ||
9 | * | ||
10 | * For more information, please consult the following manuals (look at | ||
11 | * http://www.pcisig.com/ for how to get them): | ||
12 | * | ||
13 | * PCI Express Specification | ||
14 | */ | ||
15 | |||
16 | #ifndef LINUX_ASPM_H | ||
17 | #define LINUX_ASPM_H | ||
18 | |||
19 | #include <linux/pci.h> | ||
20 | |||
21 | #define PCIE_LINK_STATE_L0S 1 | ||
22 | #define PCIE_LINK_STATE_L1 2 | ||
23 | #define PCIE_LINK_STATE_CLKPM 4 | ||
24 | |||
25 | #ifdef CONFIG_PCIEASPM | ||
26 | extern void pcie_aspm_init_link_state(struct pci_dev *pdev); | ||
27 | extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); | ||
28 | extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); | ||
29 | extern void pci_disable_link_state(struct pci_dev *pdev, int state); | ||
30 | #else | ||
31 | #define pcie_aspm_init_link_state(pdev) do {} while (0) | ||
32 | #define pcie_aspm_exit_link_state(pdev) do {} while (0) | ||
33 | #define pcie_aspm_pm_state_change(pdev) do {} while (0) | ||
34 | #define pci_disable_link_state(pdev, state) do {} while (0) | ||
35 | #endif | ||
36 | |||
37 | #ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ | ||
38 | extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); | ||
39 | extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); | ||
40 | #else | ||
41 | #define pcie_aspm_create_sysfs_dev_files(pdev) do {} while (0) | ||
42 | #define pcie_aspm_remove_sysfs_dev_files(pdev) do {} while (0) | ||
43 | #endif | ||
44 | #endif /* LINUX_ASPM_H */ | ||
diff --git a/include/linux/chio.h b/include/linux/chio.h index a404c111c937..519248d8b2b6 100644 --- a/include/linux/chio.h +++ b/include/linux/chio.h | |||
@@ -108,7 +108,7 @@ struct changer_element_status { | |||
108 | 108 | ||
109 | /* | 109 | /* |
110 | * CHIOGELEM | 110 | * CHIOGELEM |
111 | * get more detailed status informtion for a single element | 111 | * get more detailed status information for a single element |
112 | */ | 112 | */ |
113 | struct changer_get_element { | 113 | struct changer_get_element { |
114 | int cge_type; /* type/unit */ | 114 | int cge_type; /* type/unit */ |
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h index 8f3dcd30828f..504cb2c3fa9a 100644 --- a/include/linux/cyclades.h +++ b/include/linux/cyclades.h | |||
@@ -177,7 +177,7 @@ struct CUSTOM_REG { | |||
177 | __u32 fpga_version; /* FPGA Version Number Register */ | 177 | __u32 fpga_version; /* FPGA Version Number Register */ |
178 | __u32 cpu_start; /* CPU start Register (write) */ | 178 | __u32 cpu_start; /* CPU start Register (write) */ |
179 | __u32 cpu_stop; /* CPU stop Register (write) */ | 179 | __u32 cpu_stop; /* CPU stop Register (write) */ |
180 | __u32 misc_reg; /* Miscelaneous Register */ | 180 | __u32 misc_reg; /* Miscellaneous Register */ |
181 | __u32 idt_mode; /* IDT mode Register */ | 181 | __u32 idt_mode; /* IDT mode Register */ |
182 | __u32 uart_irq_status; /* UART IRQ status Register */ | 182 | __u32 uart_irq_status; /* UART IRQ status Register */ |
183 | __u32 clear_timer0_irq; /* Clear timer interrupt Register */ | 183 | __u32 clear_timer0_irq; /* Clear timer interrupt Register */ |
diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h index f7a906583463..362bf19d6cf1 100644 --- a/include/linux/cycx_x25.h +++ b/include/linux/cycx_x25.h | |||
@@ -81,7 +81,7 @@ struct cycx_x25_cmd { | |||
81 | * @n2win - level 2 window (values: 1 thru 7) | 81 | * @n2win - level 2 window (values: 1 thru 7) |
82 | * @n3win - level 3 window (values: 1 thru 7) | 82 | * @n3win - level 3 window (values: 1 thru 7) |
83 | * @nvc - # of logical channels (values: 1 thru 64) | 83 | * @nvc - # of logical channels (values: 1 thru 64) |
84 | * @pktlen - level 3 packet lenght - log base 2 of size | 84 | * @pktlen - level 3 packet length - log base 2 of size |
85 | * @locaddr - my address | 85 | * @locaddr - my address |
86 | * @remaddr - remote address | 86 | * @remaddr - remote address |
87 | * @t1 - time, in seconds | 87 | * @t1 - time, in seconds |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 484e45c7c89a..aa0737019e37 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -525,6 +525,7 @@ struct dccp_sock { | |||
525 | __u64 dccps_gsr; | 525 | __u64 dccps_gsr; |
526 | __u64 dccps_gar; | 526 | __u64 dccps_gar; |
527 | __be32 dccps_service; | 527 | __be32 dccps_service; |
528 | __u32 dccps_mss_cache; | ||
528 | struct dccp_service_list *dccps_service_list; | 529 | struct dccp_service_list *dccps_service_list; |
529 | __u32 dccps_timestamp_echo; | 530 | __u32 dccps_timestamp_echo; |
530 | __u32 dccps_timestamp_time; | 531 | __u32 dccps_timestamp_time; |
@@ -533,7 +534,6 @@ struct dccp_sock { | |||
533 | __u16 dccps_pcslen; | 534 | __u16 dccps_pcslen; |
534 | __u16 dccps_pcrlen; | 535 | __u16 dccps_pcrlen; |
535 | unsigned long dccps_ndp_count; | 536 | unsigned long dccps_ndp_count; |
536 | __u32 dccps_mss_cache; | ||
537 | unsigned long dccps_rate_last; | 537 | unsigned long dccps_rate_last; |
538 | struct dccp_minisock dccps_minisock; | 538 | struct dccp_minisock dccps_minisock; |
539 | struct dccp_ackvec *dccps_hc_rx_ackvec; | 539 | struct dccp_ackvec *dccps_hc_rx_ackvec; |
diff --git a/include/linux/device.h b/include/linux/device.h index db375be333c7..479c0b31593c 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -534,11 +534,17 @@ extern struct device *device_create(struct class *cls, struct device *parent, | |||
534 | extern void device_destroy(struct class *cls, dev_t devt); | 534 | extern void device_destroy(struct class *cls, dev_t devt); |
535 | #ifdef CONFIG_PM_SLEEP | 535 | #ifdef CONFIG_PM_SLEEP |
536 | extern void destroy_suspended_device(struct class *cls, dev_t devt); | 536 | extern void destroy_suspended_device(struct class *cls, dev_t devt); |
537 | extern void device_pm_schedule_removal(struct device *); | ||
537 | #else /* !CONFIG_PM_SLEEP */ | 538 | #else /* !CONFIG_PM_SLEEP */ |
538 | static inline void destroy_suspended_device(struct class *cls, dev_t devt) | 539 | static inline void destroy_suspended_device(struct class *cls, dev_t devt) |
539 | { | 540 | { |
540 | device_destroy(cls, devt); | 541 | device_destroy(cls, devt); |
541 | } | 542 | } |
543 | |||
544 | static inline void device_pm_schedule_removal(struct device *dev) | ||
545 | { | ||
546 | device_unregister(dev); | ||
547 | } | ||
542 | #endif /* !CONFIG_PM_SLEEP */ | 548 | #endif /* !CONFIG_PM_SLEEP */ |
543 | 549 | ||
544 | /* | 550 | /* |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 101a2d4636be..4470950892be 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _ASM_LINUX_DMA_MAPPING_H | 1 | #ifndef _LINUX_DMA_MAPPING_H |
2 | #define _ASM_LINUX_DMA_MAPPING_H | 2 | #define _LINUX_DMA_MAPPING_H |
3 | 3 | ||
4 | #include <linux/device.h> | 4 | #include <linux/device.h> |
5 | #include <linux/err.h> | 5 | #include <linux/err.h> |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 55c9a6952f44..5c84bf897593 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/dma-mapping.h> | 29 | #include <linux/dma-mapping.h> |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * enum dma_state - resource PNP/power managment state | 32 | * enum dma_state - resource PNP/power management state |
33 | * @DMA_RESOURCE_SUSPEND: DMA device going into low power state | 33 | * @DMA_RESOURCE_SUSPEND: DMA device going into low power state |
34 | * @DMA_RESOURCE_RESUME: DMA device returning to full power | 34 | * @DMA_RESOURCE_RESUME: DMA device returning to full power |
35 | * @DMA_RESOURCE_AVAILABLE: DMA device available to the system | 35 | * @DMA_RESOURCE_AVAILABLE: DMA device available to the system |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 71d4ada6f315..fcbe8b640ffb 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -309,7 +309,7 @@ int ethtool_op_set_flags(struct net_device *dev, u32 data); | |||
309 | * get_ringparam: Report ring sizes | 309 | * get_ringparam: Report ring sizes |
310 | * set_ringparam: Set ring sizes | 310 | * set_ringparam: Set ring sizes |
311 | * get_pauseparam: Report pause parameters | 311 | * get_pauseparam: Report pause parameters |
312 | * set_pauseparam: Set pause paramters | 312 | * set_pauseparam: Set pause parameters |
313 | * get_rx_csum: Report whether receive checksums are turned on or off | 313 | * get_rx_csum: Report whether receive checksums are turned on or off |
314 | * set_rx_csum: Turn receive checksum on or off | 314 | * set_rx_csum: Turn receive checksum on or off |
315 | * get_tx_csum: Report whether transmit checksums are turned on or off | 315 | * get_tx_csum: Report whether transmit checksums are turned on or off |
diff --git a/include/linux/fs.h b/include/linux/fs.h index a516b6716870..56bd421c1208 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -872,6 +872,7 @@ struct file_lock { | |||
872 | struct list_head fl_block; /* circular list of blocked processes */ | 872 | struct list_head fl_block; /* circular list of blocked processes */ |
873 | fl_owner_t fl_owner; | 873 | fl_owner_t fl_owner; |
874 | unsigned int fl_pid; | 874 | unsigned int fl_pid; |
875 | struct pid *fl_nspid; | ||
875 | wait_queue_head_t fl_wait; | 876 | wait_queue_head_t fl_wait; |
876 | struct file *fl_file; | 877 | struct file *fl_file; |
877 | unsigned char fl_flags; | 878 | unsigned char fl_flags; |
@@ -1307,7 +1308,7 @@ struct super_operations { | |||
1307 | * being set. find_inode() uses this to prevent returning | 1308 | * being set. find_inode() uses this to prevent returning |
1308 | * nearly-dead inodes. | 1309 | * nearly-dead inodes. |
1309 | * I_SYNC Similar to I_LOCK, but limited in scope to writeback | 1310 | * I_SYNC Similar to I_LOCK, but limited in scope to writeback |
1310 | * of inode dirty data. Having a seperate lock for this | 1311 | * of inode dirty data. Having a separate lock for this |
1311 | * purpose reduces latency and prevents some filesystem- | 1312 | * purpose reduces latency and prevents some filesystem- |
1312 | * specific deadlocks. | 1313 | * specific deadlocks. |
1313 | * | 1314 | * |
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h index ff43f8d6b5b3..e38e75967e74 100644 --- a/include/linux/hdreg.h +++ b/include/linux/hdreg.h | |||
@@ -364,7 +364,7 @@ typedef struct hd_drive_hob_hdr { | |||
364 | #define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */ | 364 | #define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */ |
365 | #define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */ | 365 | #define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */ |
366 | #define SETFEATURES_EN_REST 0xAC /* ATA-1 */ | 366 | #define SETFEATURES_EN_REST 0xAC /* ATA-1 */ |
367 | #define SETFEATURES_4B_RW_LONG 0xBB /* Set Lenght of 4 bytes */ | 367 | #define SETFEATURES_4B_RW_LONG 0xBB /* Set Length of 4 bytes */ |
368 | #define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */ | 368 | #define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */ |
369 | #define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */ | 369 | #define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */ |
370 | #define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */ | 370 | #define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */ |
@@ -706,8 +706,10 @@ struct hd_driveid { | |||
706 | */ | 706 | */ |
707 | #define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ | 707 | #define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ |
708 | #define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ | 708 | #define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ |
709 | #define IDE_NICE_0 (2) /* when sure that it won't affect us */ | ||
710 | #define IDE_NICE_1 (3) /* when probably won't affect us much */ | 709 | #define IDE_NICE_1 (3) /* when probably won't affect us much */ |
710 | #ifndef __KERNEL__ | ||
711 | #define IDE_NICE_0 (2) /* when sure that it won't affect us */ | ||
711 | #define IDE_NICE_2 (4) /* when we know it's on our expense */ | 712 | #define IDE_NICE_2 (4) /* when we know it's on our expense */ |
713 | #endif | ||
712 | 714 | ||
713 | #endif /* _LINUX_HDREG_H */ | 715 | #endif /* _LINUX_HDREG_H */ |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 49067f14fac1..f79dcba4b2c1 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -147,7 +147,6 @@ struct hrtimer_sleeper { | |||
147 | * @get_time: function to retrieve the current time of the clock | 147 | * @get_time: function to retrieve the current time of the clock |
148 | * @get_softirq_time: function to retrieve the current time from the softirq | 148 | * @get_softirq_time: function to retrieve the current time from the softirq |
149 | * @softirq_time: the time when running the hrtimer queue in the softirq | 149 | * @softirq_time: the time when running the hrtimer queue in the softirq |
150 | * @cb_pending: list of timers where the callback is pending | ||
151 | * @offset: offset of this clock to the monotonic base | 150 | * @offset: offset of this clock to the monotonic base |
152 | * @reprogram: function to reprogram the timer event | 151 | * @reprogram: function to reprogram the timer event |
153 | */ | 152 | */ |
diff --git a/include/linux/ide.h b/include/linux/ide.h index ec10b2a3bb6e..367c17084a28 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -112,18 +112,12 @@ typedef unsigned char byte; /* used everywhere */ | |||
112 | #define SATA_NR_PORTS (3) /* 16 possible ?? */ | 112 | #define SATA_NR_PORTS (3) /* 16 possible ?? */ |
113 | 113 | ||
114 | #define SATA_STATUS_OFFSET (0) | 114 | #define SATA_STATUS_OFFSET (0) |
115 | #define SATA_STATUS_REG (HWIF(drive)->sata_scr[SATA_STATUS_OFFSET]) | ||
116 | #define SATA_ERROR_OFFSET (1) | 115 | #define SATA_ERROR_OFFSET (1) |
117 | #define SATA_ERROR_REG (HWIF(drive)->sata_scr[SATA_ERROR_OFFSET]) | ||
118 | #define SATA_CONTROL_OFFSET (2) | 116 | #define SATA_CONTROL_OFFSET (2) |
119 | #define SATA_CONTROL_REG (HWIF(drive)->sata_scr[SATA_CONTROL_OFFSET]) | ||
120 | 117 | ||
121 | #define SATA_MISC_OFFSET (0) | 118 | #define SATA_MISC_OFFSET (0) |
122 | #define SATA_MISC_REG (HWIF(drive)->sata_misc[SATA_MISC_OFFSET]) | ||
123 | #define SATA_PHY_OFFSET (1) | 119 | #define SATA_PHY_OFFSET (1) |
124 | #define SATA_PHY_REG (HWIF(drive)->sata_misc[SATA_PHY_OFFSET]) | ||
125 | #define SATA_IEN_OFFSET (2) | 120 | #define SATA_IEN_OFFSET (2) |
126 | #define SATA_IEN_REG (HWIF(drive)->sata_misc[SATA_IEN_OFFSET]) | ||
127 | 121 | ||
128 | /* | 122 | /* |
129 | * Our Physical Region Descriptor (PRD) table should be large enough | 123 | * Our Physical Region Descriptor (PRD) table should be large enough |
@@ -196,6 +190,7 @@ typedef struct hw_regs_s { | |||
196 | } hw_regs_t; | 190 | } hw_regs_t; |
197 | 191 | ||
198 | struct hwif_s * ide_find_port(unsigned long); | 192 | struct hwif_s * ide_find_port(unsigned long); |
193 | struct hwif_s *ide_deprecated_find_port(unsigned long); | ||
199 | void ide_init_port_data(struct hwif_s *, unsigned int); | 194 | void ide_init_port_data(struct hwif_s *, unsigned int); |
200 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); | 195 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); |
201 | 196 | ||
@@ -406,8 +401,6 @@ typedef struct ide_drive_s { | |||
406 | unsigned no_unmask : 1; /* disallow setting unmask bit */ | 401 | unsigned no_unmask : 1; /* disallow setting unmask bit */ |
407 | unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ | 402 | unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ |
408 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ | 403 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ |
409 | unsigned nice0 : 1; /* give obvious excess bandwidth */ | ||
410 | unsigned nice2 : 1; /* give a share in our own bandwidth */ | ||
411 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ | 404 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ |
412 | unsigned nodma : 1; /* disallow DMA */ | 405 | unsigned nodma : 1; /* disallow DMA */ |
413 | unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ | 406 | unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ |
@@ -487,7 +480,6 @@ typedef struct hwif_s { | |||
487 | u8 major; /* our major number */ | 480 | u8 major; /* our major number */ |
488 | u8 index; /* 0 for ide0; 1 for ide1; ... */ | 481 | u8 index; /* 0 for ide0; 1 for ide1; ... */ |
489 | u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ | 482 | u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ |
490 | u8 straight8; /* Alan's straight 8 check */ | ||
491 | u8 bus_state; /* power state of the IDE bus */ | 483 | u8 bus_state; /* power state of the IDE bus */ |
492 | 484 | ||
493 | u32 host_flags; | 485 | u32 host_flags; |
@@ -513,6 +505,8 @@ typedef struct hwif_s { | |||
513 | #if 0 | 505 | #if 0 |
514 | ide_hwif_ops_t *hwifops; | 506 | ide_hwif_ops_t *hwifops; |
515 | #else | 507 | #else |
508 | /* host specific initialization of devices on a port */ | ||
509 | void (*port_init_devs)(struct hwif_s *); | ||
516 | /* routine to program host for PIO mode */ | 510 | /* routine to program host for PIO mode */ |
517 | void (*set_pio_mode)(ide_drive_t *, const u8); | 511 | void (*set_pio_mode)(ide_drive_t *, const u8); |
518 | /* routine to program host for DMA mode */ | 512 | /* routine to program host for DMA mode */ |
@@ -535,6 +529,8 @@ typedef struct hwif_s { | |||
535 | u8 (*mdma_filter)(ide_drive_t *); | 529 | u8 (*mdma_filter)(ide_drive_t *); |
536 | u8 (*udma_filter)(ide_drive_t *); | 530 | u8 (*udma_filter)(ide_drive_t *); |
537 | 531 | ||
532 | u8 (*cable_detect)(struct hwif_s *); | ||
533 | |||
538 | void (*ata_input_data)(ide_drive_t *, void *, u32); | 534 | void (*ata_input_data)(ide_drive_t *, void *, u32); |
539 | void (*ata_output_data)(ide_drive_t *, void *, u32); | 535 | void (*ata_output_data)(ide_drive_t *, void *, u32); |
540 | 536 | ||
@@ -602,10 +598,9 @@ typedef struct hwif_s { | |||
602 | unsigned serialized : 1; /* serialized all channel operation */ | 598 | unsigned serialized : 1; /* serialized all channel operation */ |
603 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ | 599 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ |
604 | unsigned reset : 1; /* reset after probe */ | 600 | unsigned reset : 1; /* reset after probe */ |
605 | unsigned auto_poll : 1; /* supports nop auto-poll */ | ||
606 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ | 601 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ |
607 | unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ | ||
608 | unsigned mmio : 1; /* host uses MMIO */ | 602 | unsigned mmio : 1; /* host uses MMIO */ |
603 | unsigned straight8 : 1; /* Alan's straight 8 check */ | ||
609 | 604 | ||
610 | struct device gendev; | 605 | struct device gendev; |
611 | struct completion gendev_rel_comp; /* To deal with device release() */ | 606 | struct completion gendev_rel_comp; /* To deal with device release() */ |
@@ -625,6 +620,9 @@ typedef struct hwif_s { | |||
625 | typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); | 620 | typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); |
626 | typedef int (ide_expiry_t)(ide_drive_t *); | 621 | typedef int (ide_expiry_t)(ide_drive_t *); |
627 | 622 | ||
623 | /* used by ide-cd, ide-floppy, etc. */ | ||
624 | typedef void (xfer_func_t)(ide_drive_t *, void *, u32); | ||
625 | |||
628 | typedef struct hwgroup_s { | 626 | typedef struct hwgroup_s { |
629 | /* irq handler, if active */ | 627 | /* irq handler, if active */ |
630 | ide_startstop_t (*handler)(ide_drive_t *); | 628 | ide_startstop_t (*handler)(ide_drive_t *); |
@@ -708,6 +706,7 @@ typedef struct { | |||
708 | void proc_ide_create(void); | 706 | void proc_ide_create(void); |
709 | void proc_ide_destroy(void); | 707 | void proc_ide_destroy(void); |
710 | void ide_proc_register_port(ide_hwif_t *); | 708 | void ide_proc_register_port(ide_hwif_t *); |
709 | void ide_proc_port_register_devices(ide_hwif_t *); | ||
711 | void ide_proc_unregister_port(ide_hwif_t *); | 710 | void ide_proc_unregister_port(ide_hwif_t *); |
712 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); | 711 | void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); |
713 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); | 712 | void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); |
@@ -740,6 +739,7 @@ void ide_pci_create_host_proc(const char *, get_info_t *); | |||
740 | static inline void proc_ide_create(void) { ; } | 739 | static inline void proc_ide_create(void) { ; } |
741 | static inline void proc_ide_destroy(void) { ; } | 740 | static inline void proc_ide_destroy(void) { ; } |
742 | static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } | 741 | static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } |
742 | static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } | ||
743 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } | 743 | static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } |
744 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 744 | static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
745 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } | 745 | static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } |
@@ -988,10 +988,8 @@ int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); | |||
988 | extern int system_bus_clock(void); | 988 | extern int system_bus_clock(void); |
989 | 989 | ||
990 | extern int ide_driveid_update(ide_drive_t *); | 990 | extern int ide_driveid_update(ide_drive_t *); |
991 | extern int ide_ata66_check(ide_drive_t *, ide_task_t *); | ||
992 | extern int ide_config_drive_speed(ide_drive_t *, u8); | 991 | extern int ide_config_drive_speed(ide_drive_t *, u8); |
993 | extern u8 eighty_ninty_three (ide_drive_t *); | 992 | extern u8 eighty_ninty_three (ide_drive_t *); |
994 | extern int set_transfer(ide_drive_t *, ide_task_t *); | ||
995 | extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); | 993 | extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); |
996 | 994 | ||
997 | extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); | 995 | extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); |
@@ -1016,6 +1014,13 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o | |||
1016 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); | 1014 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); |
1017 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); | 1015 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); |
1018 | 1016 | ||
1017 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | ||
1018 | void ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); | ||
1019 | #else | ||
1020 | static inline void ide_hwif_setup_dma(ide_hwif_t *hwif, | ||
1021 | const struct ide_port_info *d) { } | ||
1022 | #endif | ||
1023 | |||
1019 | extern void default_hwif_iops(ide_hwif_t *); | 1024 | extern void default_hwif_iops(ide_hwif_t *); |
1020 | extern void default_hwif_mmiops(ide_hwif_t *); | 1025 | extern void default_hwif_mmiops(ide_hwif_t *); |
1021 | extern void default_hwif_transport(ide_hwif_t *); | 1026 | extern void default_hwif_transport(ide_hwif_t *); |
@@ -1052,7 +1057,7 @@ enum { | |||
1052 | IDE_HFLAG_NO_SET_MODE = (1 << 9), | 1057 | IDE_HFLAG_NO_SET_MODE = (1 << 9), |
1053 | /* trust BIOS for programming chipset/device for DMA */ | 1058 | /* trust BIOS for programming chipset/device for DMA */ |
1054 | IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), | 1059 | IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), |
1055 | /* host uses VDMA */ | 1060 | /* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */ |
1056 | IDE_HFLAG_VDMA = (1 << 11), | 1061 | IDE_HFLAG_VDMA = (1 << 11), |
1057 | /* ATAPI DMA is unsupported */ | 1062 | /* ATAPI DMA is unsupported */ |
1058 | IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), | 1063 | IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), |
@@ -1062,8 +1067,10 @@ enum { | |||
1062 | IDE_HFLAG_NO_DMA = (1 << 14), | 1067 | IDE_HFLAG_NO_DMA = (1 << 14), |
1063 | /* check if host is PCI IDE device before allowing DMA */ | 1068 | /* check if host is PCI IDE device before allowing DMA */ |
1064 | IDE_HFLAG_NO_AUTODMA = (1 << 15), | 1069 | IDE_HFLAG_NO_AUTODMA = (1 << 15), |
1070 | /* don't autotune PIO */ | ||
1071 | IDE_HFLAG_NO_AUTOTUNE = (1 << 16), | ||
1065 | /* host is CS5510/CS5520 */ | 1072 | /* host is CS5510/CS5520 */ |
1066 | IDE_HFLAG_CS5520 = (1 << 16), | 1073 | IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, |
1067 | /* no LBA48 */ | 1074 | /* no LBA48 */ |
1068 | IDE_HFLAG_NO_LBA48 = (1 << 17), | 1075 | IDE_HFLAG_NO_LBA48 = (1 << 17), |
1069 | /* no LBA48 DMA */ | 1076 | /* no LBA48 DMA */ |
@@ -1089,6 +1096,10 @@ enum { | |||
1089 | IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), | 1096 | IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), |
1090 | /* DSC overlap is unsupported */ | 1097 | /* DSC overlap is unsupported */ |
1091 | IDE_HFLAG_NO_DSC = (1 << 29), | 1098 | IDE_HFLAG_NO_DSC = (1 << 29), |
1099 | /* never use 32-bit I/O ops */ | ||
1100 | IDE_HFLAG_NO_IO_32BIT = (1 << 30), | ||
1101 | /* never unmask IRQs */ | ||
1102 | IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31), | ||
1092 | }; | 1103 | }; |
1093 | 1104 | ||
1094 | #ifdef CONFIG_BLK_DEV_OFFBOARD | 1105 | #ifdef CONFIG_BLK_DEV_OFFBOARD |
@@ -1144,6 +1155,7 @@ void ide_dma_off_quietly(ide_drive_t *); | |||
1144 | void ide_dma_off(ide_drive_t *); | 1155 | void ide_dma_off(ide_drive_t *); |
1145 | void ide_dma_on(ide_drive_t *); | 1156 | void ide_dma_on(ide_drive_t *); |
1146 | int ide_set_dma(ide_drive_t *); | 1157 | int ide_set_dma(ide_drive_t *); |
1158 | void ide_check_dma_crc(ide_drive_t *); | ||
1147 | ide_startstop_t ide_dma_intr(ide_drive_t *); | 1159 | ide_startstop_t ide_dma_intr(ide_drive_t *); |
1148 | 1160 | ||
1149 | int ide_build_sglist(ide_drive_t *, struct request *); | 1161 | int ide_build_sglist(ide_drive_t *, struct request *); |
@@ -1171,6 +1183,7 @@ static inline void ide_dma_off(ide_drive_t *drive) { ; } | |||
1171 | static inline void ide_dma_on(ide_drive_t *drive) { ; } | 1183 | static inline void ide_dma_on(ide_drive_t *drive) { ; } |
1172 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } | 1184 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } |
1173 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } | 1185 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } |
1186 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } | ||
1174 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | 1187 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
1175 | 1188 | ||
1176 | #ifndef CONFIG_BLK_DEV_IDEDMA_PCI | 1189 | #ifndef CONFIG_BLK_DEV_IDEDMA_PCI |
@@ -1182,27 +1195,29 @@ extern int ide_acpi_exec_tfs(ide_drive_t *drive); | |||
1182 | extern void ide_acpi_get_timing(ide_hwif_t *hwif); | 1195 | extern void ide_acpi_get_timing(ide_hwif_t *hwif); |
1183 | extern void ide_acpi_push_timing(ide_hwif_t *hwif); | 1196 | extern void ide_acpi_push_timing(ide_hwif_t *hwif); |
1184 | extern void ide_acpi_init(ide_hwif_t *hwif); | 1197 | extern void ide_acpi_init(ide_hwif_t *hwif); |
1198 | void ide_acpi_port_init_devices(ide_hwif_t *); | ||
1185 | extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); | 1199 | extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); |
1186 | #else | 1200 | #else |
1187 | static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } | 1201 | static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } |
1188 | static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } | 1202 | static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } |
1189 | static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } | 1203 | static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } |
1190 | static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } | 1204 | static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } |
1205 | static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } | ||
1191 | static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | 1206 | static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} |
1192 | #endif | 1207 | #endif |
1193 | 1208 | ||
1194 | void ide_remove_port_from_hwgroup(ide_hwif_t *); | 1209 | void ide_remove_port_from_hwgroup(ide_hwif_t *); |
1195 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); | 1210 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); |
1196 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); | 1211 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); |
1197 | extern void ide_unregister (unsigned int index); | 1212 | void ide_unregister(unsigned int, int, int); |
1198 | 1213 | ||
1199 | void ide_register_region(struct gendisk *); | 1214 | void ide_register_region(struct gendisk *); |
1200 | void ide_unregister_region(struct gendisk *); | 1215 | void ide_unregister_region(struct gendisk *); |
1201 | 1216 | ||
1202 | void ide_undecoded_slave(ide_drive_t *); | 1217 | void ide_undecoded_slave(ide_drive_t *); |
1203 | 1218 | ||
1204 | int ide_device_add_all(u8 *idx); | 1219 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); |
1205 | int ide_device_add(u8 idx[4]); | 1220 | int ide_device_add(u8 idx[4], const struct ide_port_info *); |
1206 | 1221 | ||
1207 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) | 1222 | static inline void *ide_get_hwifdata (ide_hwif_t * hwif) |
1208 | { | 1223 | { |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 5de6d911cdf7..f577c8f1c66d 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -287,6 +287,12 @@ struct ieee80211_ht_addt_info { | |||
287 | #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 | 287 | #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 |
288 | #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 | 288 | #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 |
289 | 289 | ||
290 | /* MIMO Power Save Modes */ | ||
291 | #define WLAN_HT_CAP_MIMO_PS_STATIC 0 | ||
292 | #define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1 | ||
293 | #define WLAN_HT_CAP_MIMO_PS_INVALID 2 | ||
294 | #define WLAN_HT_CAP_MIMO_PS_DISABLED 3 | ||
295 | |||
290 | /* Authentication algorithms */ | 296 | /* Authentication algorithms */ |
291 | #define WLAN_AUTH_OPEN 0 | 297 | #define WLAN_AUTH_OPEN 0 |
292 | #define WLAN_AUTH_SHARED_KEY 1 | 298 | #define WLAN_AUTH_SHARED_KEY 1 |
diff --git a/include/linux/init.h b/include/linux/init.h index 2efbda016741..90cdbbbbe077 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -124,9 +124,6 @@ | |||
124 | #define __REF .section ".ref.text", "ax" | 124 | #define __REF .section ".ref.text", "ax" |
125 | #define __REFDATA .section ".ref.data", "aw" | 125 | #define __REFDATA .section ".ref.data", "aw" |
126 | #define __REFCONST .section ".ref.rodata", "aw" | 126 | #define __REFCONST .section ".ref.rodata", "aw" |
127 | /* backward compatibility */ | ||
128 | #define __INIT_REFOK .section __REF | ||
129 | #define __INITDATA_REFOK .section __REFDATA | ||
130 | 127 | ||
131 | #ifndef __ASSEMBLY__ | 128 | #ifndef __ASSEMBLY__ |
132 | /* | 129 | /* |
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h index 697104da91f1..589be3e1f3ac 100644 --- a/include/linux/lguest_launcher.h +++ b/include/linux/lguest_launcher.h | |||
@@ -23,7 +23,12 @@ | |||
23 | struct lguest_device_desc { | 23 | struct lguest_device_desc { |
24 | /* The device type: console, network, disk etc. Type 0 terminates. */ | 24 | /* The device type: console, network, disk etc. Type 0 terminates. */ |
25 | __u8 type; | 25 | __u8 type; |
26 | /* The number of bytes of the config array. */ | 26 | /* The number of virtqueues (first in config array) */ |
27 | __u8 num_vq; | ||
28 | /* The number of bytes of feature bits. Multiply by 2: one for host | ||
29 | * features and one for guest acknowledgements. */ | ||
30 | __u8 feature_len; | ||
31 | /* The number of bytes of the config array after virtqueues. */ | ||
27 | __u8 config_len; | 32 | __u8 config_len; |
28 | /* A status byte, written by the Guest. */ | 33 | /* A status byte, written by the Guest. */ |
29 | __u8 status; | 34 | __u8 status; |
@@ -31,7 +36,7 @@ struct lguest_device_desc { | |||
31 | }; | 36 | }; |
32 | 37 | ||
33 | /*D:135 This is how we expect the device configuration field for a virtqueue | 38 | /*D:135 This is how we expect the device configuration field for a virtqueue |
34 | * (type VIRTIO_CONFIG_F_VIRTQUEUE) to be laid out: */ | 39 | * to be laid out in config space. */ |
35 | struct lguest_vqconfig { | 40 | struct lguest_vqconfig { |
36 | /* The number of entries in the virtio_ring */ | 41 | /* The number of entries in the virtio_ring */ |
37 | __u16 num; | 42 | __u16 num; |
diff --git a/include/linux/llc.h b/include/linux/llc.h index 09f2e6d0e9eb..7733585603f1 100644 --- a/include/linux/llc.h +++ b/include/linux/llc.h | |||
@@ -49,9 +49,9 @@ enum llc_sockopts { | |||
49 | 49 | ||
50 | /* LLC SAP types. */ | 50 | /* LLC SAP types. */ |
51 | #define LLC_SAP_NULL 0x00 /* NULL SAP. */ | 51 | #define LLC_SAP_NULL 0x00 /* NULL SAP. */ |
52 | #define LLC_SAP_LLC 0x02 /* LLC Sublayer Managment. */ | 52 | #define LLC_SAP_LLC 0x02 /* LLC Sublayer Management. */ |
53 | #define LLC_SAP_SNA 0x04 /* SNA Path Control. */ | 53 | #define LLC_SAP_SNA 0x04 /* SNA Path Control. */ |
54 | #define LLC_SAP_PNM 0x0E /* Proway Network Managment. */ | 54 | #define LLC_SAP_PNM 0x0E /* Proway Network Management. */ |
55 | #define LLC_SAP_IP 0x06 /* TCP/IP. */ | 55 | #define LLC_SAP_IP 0x06 /* TCP/IP. */ |
56 | #define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */ | 56 | #define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */ |
57 | #define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */ | 57 | #define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */ |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 4f96f1d94ac4..cee75c0ff6e7 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -128,7 +128,6 @@ struct pci_cap_saved_state { | |||
128 | u32 data[0]; | 128 | u32 data[0]; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | struct pcie_link_state; | ||
132 | /* | 131 | /* |
133 | * The pci_dev structure is used to describe PCI devices. | 132 | * The pci_dev structure is used to describe PCI devices. |
134 | */ | 133 | */ |
@@ -164,10 +163,6 @@ struct pci_dev { | |||
164 | this is D0-D3, D0 being fully functional, | 163 | this is D0-D3, D0 being fully functional, |
165 | and D3 being off. */ | 164 | and D3 being off. */ |
166 | 165 | ||
167 | #ifdef CONFIG_PCIEASPM | ||
168 | struct pcie_link_state *link_state; /* ASPM link state. */ | ||
169 | #endif | ||
170 | |||
171 | pci_channel_state_t error_state; /* current connectivity state */ | 166 | pci_channel_state_t error_state; /* current connectivity state */ |
172 | struct device dev; /* Generic device interface */ | 167 | struct device dev; /* Generic device interface */ |
173 | 168 | ||
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index c0c1223c9194..c1914a8b94a9 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -395,17 +395,9 @@ | |||
395 | #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ | 395 | #define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ |
396 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ | 396 | #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ |
397 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ | 397 | #define PCI_EXP_LNKCAP 12 /* Link Capabilities */ |
398 | #define PCI_EXP_LNKCAP_ASPMS 0xc00 /* ASPM Support */ | ||
399 | #define PCI_EXP_LNKCAP_L0SEL 0x7000 /* L0s Exit Latency */ | ||
400 | #define PCI_EXP_LNKCAP_L1EL 0x38000 /* L1 Exit Latency */ | ||
401 | #define PCI_EXP_LNKCAP_CLKPM 0x40000 /* L1 Clock Power Management */ | ||
402 | #define PCI_EXP_LNKCTL 16 /* Link Control */ | 398 | #define PCI_EXP_LNKCTL 16 /* Link Control */ |
403 | #define PCI_EXP_LNKCTL_RL 0x20 /* Retrain Link */ | ||
404 | #define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clock COnfiguration */ | ||
405 | #define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ | 399 | #define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ |
406 | #define PCI_EXP_LNKSTA 18 /* Link Status */ | 400 | #define PCI_EXP_LNKSTA 18 /* Link Status */ |
407 | #define PCI_EXP_LNKSTA_LT 0x800 /* Link Training */ | ||
408 | #define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ | ||
409 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ | 401 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ |
410 | #define PCI_EXP_SLTCTL 24 /* Slot Control */ | 402 | #define PCI_EXP_SLTCTL 24 /* Slot Control */ |
411 | #define PCI_EXP_SLTSTA 26 /* Slot Status */ | 403 | #define PCI_EXP_SLTSTA 26 /* Slot Status */ |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 554836edd915..5e43ae751412 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -88,7 +88,7 @@ struct mii_bus { | |||
88 | 88 | ||
89 | /* A lock to ensure that only one thing can read/write | 89 | /* A lock to ensure that only one thing can read/write |
90 | * the MDIO bus at a time */ | 90 | * the MDIO bus at a time */ |
91 | spinlock_t mdio_lock; | 91 | struct mutex mdio_lock; |
92 | 92 | ||
93 | struct device *dev; | 93 | struct device *dev; |
94 | 94 | ||
@@ -284,10 +284,11 @@ struct phy_device { | |||
284 | 284 | ||
285 | /* Interrupt and Polling infrastructure */ | 285 | /* Interrupt and Polling infrastructure */ |
286 | struct work_struct phy_queue; | 286 | struct work_struct phy_queue; |
287 | struct work_struct state_queue; | ||
287 | struct timer_list phy_timer; | 288 | struct timer_list phy_timer; |
288 | atomic_t irq_disable; | 289 | atomic_t irq_disable; |
289 | 290 | ||
290 | spinlock_t lock; | 291 | struct mutex lock; |
291 | 292 | ||
292 | struct net_device *attached_dev; | 293 | struct net_device *attached_dev; |
293 | 294 | ||
diff --git a/include/linux/pm.h b/include/linux/pm.h index b78e0295adf4..eccf59ea2a77 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -95,7 +95,7 @@ struct pm_dev | |||
95 | }; | 95 | }; |
96 | 96 | ||
97 | /* Functions above this comment are list-based old-style power | 97 | /* Functions above this comment are list-based old-style power |
98 | * managment. Please avoid using them. */ | 98 | * management. Please avoid using them. */ |
99 | 99 | ||
100 | /* | 100 | /* |
101 | * Callbacks for platform drivers to implement. | 101 | * Callbacks for platform drivers to implement. |
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 2a6d62c7d2d1..b9339d8b95bc 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
@@ -126,7 +126,7 @@ struct pnp_resource_table { | |||
126 | }; | 126 | }; |
127 | 127 | ||
128 | /* | 128 | /* |
129 | * Device Managemnt | 129 | * Device Management |
130 | */ | 130 | */ |
131 | 131 | ||
132 | struct pnp_card { | 132 | struct pnp_card { |
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index b6116b4445c7..b8ce2b444bb5 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -91,7 +91,7 @@ do { \ | |||
91 | * | 91 | * |
92 | * For API usage, in general, | 92 | * For API usage, in general, |
93 | * - any function _modifying_ the tree or tags (inserting or deleting | 93 | * - any function _modifying_ the tree or tags (inserting or deleting |
94 | * items, setting or clearing tags must exclude other modifications, and | 94 | * items, setting or clearing tags) must exclude other modifications, and |
95 | * exclude any functions reading the tree. | 95 | * exclude any functions reading the tree. |
96 | * - any function _reading_ the tree or tags (looking up items or tags, | 96 | * - any function _reading_ the tree or tags (looking up items or tags, |
97 | * gang lookups) must exclude modifications to the tree, but may occur | 97 | * gang lookups) must exclude modifications to the tree, but may occur |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 10fa0c832018..db5ef9b83c3f 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -185,7 +185,7 @@ struct reiserfs_journal { | |||
185 | unsigned long j_trans_id; | 185 | unsigned long j_trans_id; |
186 | unsigned long j_mount_id; | 186 | unsigned long j_mount_id; |
187 | unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ | 187 | unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ |
188 | unsigned long j_len; /* lenght of current waiting commit */ | 188 | unsigned long j_len; /* length of current waiting commit */ |
189 | unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */ | 189 | unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */ |
190 | atomic_t j_wcount; /* count of writers for current commit */ | 190 | atomic_t j_wcount; /* count of writers for current commit */ |
191 | unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */ | 191 | unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */ |
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h index 86f9b1ef0e09..ea037f28df91 100644 --- a/include/linux/signalfd.h +++ b/include/linux/signalfd.h | |||
@@ -29,7 +29,7 @@ struct signalfd_siginfo { | |||
29 | 29 | ||
30 | /* | 30 | /* |
31 | * Pad strcture to 128 bytes. Remember to update the | 31 | * Pad strcture to 128 bytes. Remember to update the |
32 | * pad size when you add new memebers. We use a fixed | 32 | * pad size when you add new members. We use a fixed |
33 | * size structure to avoid compatibility problems with | 33 | * size structure to avoid compatibility problems with |
34 | * future versions, and we leave extra space for additional | 34 | * future versions, and we leave extra space for additional |
35 | * members. We use fixed size members because this strcture | 35 | * members. We use fixed size members because this strcture |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index dfe975a9967e..412672a79e8a 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1810,5 +1810,6 @@ static inline void skb_forward_csum(struct sk_buff *skb) | |||
1810 | skb->ip_summed = CHECKSUM_NONE; | 1810 | skb->ip_summed = CHECKSUM_NONE; |
1811 | } | 1811 | } |
1812 | 1812 | ||
1813 | bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); | ||
1813 | #endif /* __KERNEL__ */ | 1814 | #endif /* __KERNEL__ */ |
1814 | #endif /* _LINUX_SKBUFF_H */ | 1815 | #endif /* _LINUX_SKBUFF_H */ |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 40801e754afb..ddb1a706b144 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -12,11 +12,11 @@ | |||
12 | #include <linux/kobject.h> | 12 | #include <linux/kobject.h> |
13 | 13 | ||
14 | struct kmem_cache_cpu { | 14 | struct kmem_cache_cpu { |
15 | void **freelist; | 15 | void **freelist; /* Pointer to first free per cpu object */ |
16 | struct page *page; | 16 | struct page *page; /* The slab from which we are allocating */ |
17 | int node; | 17 | int node; /* The node of the page (or -1 for debug) */ |
18 | unsigned int offset; | 18 | unsigned int offset; /* Freepointer offset (in word units) */ |
19 | unsigned int objsize; | 19 | unsigned int objsize; /* Size of an object (from kmem_cache) */ |
20 | }; | 20 | }; |
21 | 21 | ||
22 | struct kmem_cache_node { | 22 | struct kmem_cache_node { |
@@ -59,7 +59,10 @@ struct kmem_cache { | |||
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #ifdef CONFIG_NUMA | 61 | #ifdef CONFIG_NUMA |
62 | int defrag_ratio; | 62 | /* |
63 | * Defragmentation by allocating from a remote node. | ||
64 | */ | ||
65 | int remote_node_defrag_ratio; | ||
63 | struct kmem_cache_node *node[MAX_NUMNODES]; | 66 | struct kmem_cache_node *node[MAX_NUMNODES]; |
64 | #endif | 67 | #endif |
65 | #ifdef CONFIG_SMP | 68 | #ifdef CONFIG_SMP |
diff --git a/include/linux/sm501-regs.h b/include/linux/sm501-regs.h index df7620dd8f31..64236b73c724 100644 --- a/include/linux/sm501-regs.h +++ b/include/linux/sm501-regs.h | |||
@@ -171,7 +171,7 @@ | |||
171 | /* USB slave/gadget data port base */ | 171 | /* USB slave/gadget data port base */ |
172 | #define SM501_USB_GADGET_DATA (0x070000) | 172 | #define SM501_USB_GADGET_DATA (0x070000) |
173 | 173 | ||
174 | /* Display contoller/video engine base */ | 174 | /* Display controller/video engine base */ |
175 | #define SM501_DC (0x080000) | 175 | #define SM501_DC (0x080000) |
176 | 176 | ||
177 | /* common defines for the SM501 address registers */ | 177 | /* common defines for the SM501 address registers */ |
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h index 67faa044c5f5..04e1d3164576 100644 --- a/include/linux/spinlock_api_up.h +++ b/include/linux/spinlock_api_up.h | |||
@@ -21,7 +21,7 @@ | |||
21 | /* | 21 | /* |
22 | * In the UP-nondebug case there's no real locking going on, so the | 22 | * In the UP-nondebug case there's no real locking going on, so the |
23 | * only thing we have to do is to keep the preempt counts and irq | 23 | * only thing we have to do is to keep the preempt counts and irq |
24 | * flags straight, to supress compiler warnings of unused lock | 24 | * flags straight, to suppress compiler warnings of unused lock |
25 | * variables, and to add the proper checker annotations: | 25 | * variables, and to add the proper checker annotations: |
26 | */ | 26 | */ |
27 | #define __LOCK(lock) \ | 27 | #define __LOCK(lock) \ |
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 14e1379876d3..260d1fcf29a4 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
@@ -11,15 +11,13 @@ | |||
11 | /** | 11 | /** |
12 | * virtqueue - a queue to register buffers for sending or receiving. | 12 | * virtqueue - a queue to register buffers for sending or receiving. |
13 | * @callback: the function to call when buffers are consumed (can be NULL). | 13 | * @callback: the function to call when buffers are consumed (can be NULL). |
14 | * If this returns false, callbacks are suppressed until vq_ops->restart | ||
15 | * is called. | ||
16 | * @vdev: the virtio device this queue was created for. | 14 | * @vdev: the virtio device this queue was created for. |
17 | * @vq_ops: the operations for this virtqueue (see below). | 15 | * @vq_ops: the operations for this virtqueue (see below). |
18 | * @priv: a pointer for the virtqueue implementation to use. | 16 | * @priv: a pointer for the virtqueue implementation to use. |
19 | */ | 17 | */ |
20 | struct virtqueue | 18 | struct virtqueue |
21 | { | 19 | { |
22 | bool (*callback)(struct virtqueue *vq); | 20 | void (*callback)(struct virtqueue *vq); |
23 | struct virtio_device *vdev; | 21 | struct virtio_device *vdev; |
24 | struct virtqueue_ops *vq_ops; | 22 | struct virtqueue_ops *vq_ops; |
25 | void *priv; | 23 | void *priv; |
@@ -41,13 +39,12 @@ struct virtqueue | |||
41 | * vq: the struct virtqueue we're talking about. | 39 | * vq: the struct virtqueue we're talking about. |
42 | * len: the length written into the buffer | 40 | * len: the length written into the buffer |
43 | * Returns NULL or the "data" token handed to add_buf. | 41 | * Returns NULL or the "data" token handed to add_buf. |
44 | * @restart: restart callbacks after callback returned false. | 42 | * @disable_cb: disable callbacks |
43 | * vq: the struct virtqueue we're talking about. | ||
44 | * @enable_cb: restart callbacks after disable_cb. | ||
45 | * vq: the struct virtqueue we're talking about. | 45 | * vq: the struct virtqueue we're talking about. |
46 | * This returns "false" (and doesn't re-enable) if there are pending | 46 | * This returns "false" (and doesn't re-enable) if there are pending |
47 | * buffers in the queue, to avoid a race. | 47 | * buffers in the queue, to avoid a race. |
48 | * @shutdown: "unadd" all buffers. | ||
49 | * vq: the struct virtqueue we're talking about. | ||
50 | * Remove everything from the queue. | ||
51 | * | 48 | * |
52 | * Locking rules are straightforward: the driver is responsible for | 49 | * Locking rules are straightforward: the driver is responsible for |
53 | * locking. No two operations may be invoked simultaneously. | 50 | * locking. No two operations may be invoked simultaneously. |
@@ -65,9 +62,8 @@ struct virtqueue_ops { | |||
65 | 62 | ||
66 | void *(*get_buf)(struct virtqueue *vq, unsigned int *len); | 63 | void *(*get_buf)(struct virtqueue *vq, unsigned int *len); |
67 | 64 | ||
68 | bool (*restart)(struct virtqueue *vq); | 65 | void (*disable_cb)(struct virtqueue *vq); |
69 | 66 | bool (*enable_cb)(struct virtqueue *vq); | |
70 | void (*shutdown)(struct virtqueue *vq); | ||
71 | }; | 67 | }; |
72 | 68 | ||
73 | /** | 69 | /** |
@@ -97,12 +93,15 @@ void unregister_virtio_device(struct virtio_device *dev); | |||
97 | * @probe: the function to call when a device is found. Returns a token for | 93 | * @probe: the function to call when a device is found. Returns a token for |
98 | * remove, or PTR_ERR(). | 94 | * remove, or PTR_ERR(). |
99 | * @remove: the function when a device is removed. | 95 | * @remove: the function when a device is removed. |
96 | * @config_changed: optional function to call when the device configuration | ||
97 | * changes; may be called in interrupt context. | ||
100 | */ | 98 | */ |
101 | struct virtio_driver { | 99 | struct virtio_driver { |
102 | struct device_driver driver; | 100 | struct device_driver driver; |
103 | const struct virtio_device_id *id_table; | 101 | const struct virtio_device_id *id_table; |
104 | int (*probe)(struct virtio_device *dev); | 102 | int (*probe)(struct virtio_device *dev); |
105 | void (*remove)(struct virtio_device *dev); | 103 | void (*remove)(struct virtio_device *dev); |
104 | void (*config_changed)(struct virtio_device *dev); | ||
106 | }; | 105 | }; |
107 | 106 | ||
108 | int register_virtio_driver(struct virtio_driver *drv); | 107 | int register_virtio_driver(struct virtio_driver *drv); |
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h new file mode 100644 index 000000000000..979524ee75b7 --- /dev/null +++ b/include/linux/virtio_balloon.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _LINUX_VIRTIO_BALLOON_H | ||
2 | #define _LINUX_VIRTIO_BALLOON_H | ||
3 | #include <linux/virtio_config.h> | ||
4 | |||
5 | /* The ID for virtio_balloon */ | ||
6 | #define VIRTIO_ID_BALLOON 5 | ||
7 | |||
8 | /* The feature bitmap for virtio balloon */ | ||
9 | #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ | ||
10 | |||
11 | struct virtio_balloon_config | ||
12 | { | ||
13 | /* Number of pages host wants Guest to give up. */ | ||
14 | __le32 num_pages; | ||
15 | /* Number of pages we've actually got in balloon. */ | ||
16 | __le32 actual; | ||
17 | }; | ||
18 | #endif /* _LINUX_VIRTIO_BALLOON_H */ | ||
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h index 7bd2bce0cfd9..bca0b10d7947 100644 --- a/include/linux/virtio_blk.h +++ b/include/linux/virtio_blk.h | |||
@@ -6,15 +6,19 @@ | |||
6 | #define VIRTIO_ID_BLOCK 2 | 6 | #define VIRTIO_ID_BLOCK 2 |
7 | 7 | ||
8 | /* Feature bits */ | 8 | /* Feature bits */ |
9 | #define VIRTIO_CONFIG_BLK_F 0x40 | 9 | #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ |
10 | #define VIRTIO_BLK_F_BARRIER 1 /* Does host support barriers? */ | 10 | #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ |
11 | #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ | ||
11 | 12 | ||
12 | /* The capacity (in 512-byte sectors). */ | 13 | struct virtio_blk_config |
13 | #define VIRTIO_CONFIG_BLK_F_CAPACITY 0x41 | 14 | { |
14 | /* The maximum segment size. */ | 15 | /* The capacity (in 512-byte sectors). */ |
15 | #define VIRTIO_CONFIG_BLK_F_SIZE_MAX 0x42 | 16 | __le64 capacity; |
16 | /* The maximum number of segments. */ | 17 | /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ |
17 | #define VIRTIO_CONFIG_BLK_F_SEG_MAX 0x43 | 18 | __le32 size_max; |
19 | /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ | ||
20 | __le32 seg_max; | ||
21 | } __attribute__((packed)); | ||
18 | 22 | ||
19 | /* These two define direction. */ | 23 | /* These two define direction. */ |
20 | #define VIRTIO_BLK_T_IN 0 | 24 | #define VIRTIO_BLK_T_IN 0 |
@@ -35,8 +39,6 @@ struct virtio_blk_outhdr | |||
35 | __u32 ioprio; | 39 | __u32 ioprio; |
36 | /* Sector (ie. 512 byte offset) */ | 40 | /* Sector (ie. 512 byte offset) */ |
37 | __u64 sector; | 41 | __u64 sector; |
38 | /* Where to put reply. */ | ||
39 | __u64 id; | ||
40 | }; | 42 | }; |
41 | 43 | ||
42 | #define VIRTIO_BLK_S_OK 0 | 44 | #define VIRTIO_BLK_S_OK 0 |
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index bcc01888df78..d581b2914b34 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * store and access that space differently. */ | 5 | * store and access that space differently. */ |
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | 7 | ||
8 | /* Status byte for guest to report progress, and synchronize config. */ | 8 | /* Status byte for guest to report progress, and synchronize features. */ |
9 | /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */ | 9 | /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */ |
10 | #define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 | 10 | #define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 |
11 | /* We have found a driver for the device. */ | 11 | /* We have found a driver for the device. */ |
@@ -15,34 +15,27 @@ | |||
15 | /* We've given up on this device. */ | 15 | /* We've given up on this device. */ |
16 | #define VIRTIO_CONFIG_S_FAILED 0x80 | 16 | #define VIRTIO_CONFIG_S_FAILED 0x80 |
17 | 17 | ||
18 | /* Feature byte (actually 7 bits availabe): */ | ||
19 | /* Requirements/features of the virtio implementation. */ | ||
20 | #define VIRTIO_CONFIG_F_VIRTIO 1 | ||
21 | /* Requirements/features of the virtqueue (may have more than one). */ | ||
22 | #define VIRTIO_CONFIG_F_VIRTQUEUE 2 | ||
23 | |||
24 | #ifdef __KERNEL__ | 18 | #ifdef __KERNEL__ |
25 | struct virtio_device; | 19 | struct virtio_device; |
26 | 20 | ||
27 | /** | 21 | /** |
28 | * virtio_config_ops - operations for configuring a virtio device | 22 | * virtio_config_ops - operations for configuring a virtio device |
29 | * @find: search for the next configuration field of the given type. | 23 | * @feature: search for a feature in this config |
30 | * vdev: the virtio_device | 24 | * vdev: the virtio_device |
31 | * type: the feature type | 25 | * bit: the feature bit |
32 | * len: the (returned) length of the field if found. | 26 | * Returns true if the feature is supported. Acknowledges the feature |
33 | * Returns a token if found, or NULL. Never returnes the same field twice | 27 | * so the host can see it. |
34 | * (ie. it's used up). | 28 | * @get: read the value of a configuration field |
35 | * @get: read the value of a configuration field after find(). | ||
36 | * vdev: the virtio_device | 29 | * vdev: the virtio_device |
37 | * token: the token returned from find(). | 30 | * offset: the offset of the configuration field |
38 | * buf: the buffer to write the field value into. | 31 | * buf: the buffer to write the field value into. |
39 | * len: the length of the buffer (given by find()). | 32 | * len: the length of the buffer |
40 | * Note that contents are conventionally little-endian. | 33 | * Note that contents are conventionally little-endian. |
41 | * @set: write the value of a configuration field after find(). | 34 | * @set: write the value of a configuration field |
42 | * vdev: the virtio_device | 35 | * vdev: the virtio_device |
43 | * token: the token returned from find(). | 36 | * offset: the offset of the configuration field |
44 | * buf: the buffer to read the field value from. | 37 | * buf: the buffer to read the field value from. |
45 | * len: the length of the buffer (given by find()). | 38 | * len: the length of the buffer |
46 | * Note that contents are conventionally little-endian. | 39 | * Note that contents are conventionally little-endian. |
47 | * @get_status: read the status byte | 40 | * @get_status: read the status byte |
48 | * vdev: the virtio_device | 41 | * vdev: the virtio_device |
@@ -50,62 +43,67 @@ struct virtio_device; | |||
50 | * @set_status: write the status byte | 43 | * @set_status: write the status byte |
51 | * vdev: the virtio_device | 44 | * vdev: the virtio_device |
52 | * status: the new status byte | 45 | * status: the new status byte |
53 | * @find_vq: find the first VIRTIO_CONFIG_F_VIRTQUEUE and create a virtqueue. | 46 | * @reset: reset the device |
47 | * vdev: the virtio device | ||
48 | * After this, status and feature negotiation must be done again | ||
49 | * @find_vq: find a virtqueue and instantiate it. | ||
54 | * vdev: the virtio_device | 50 | * vdev: the virtio_device |
51 | * index: the 0-based virtqueue number in case there's more than one. | ||
55 | * callback: the virqtueue callback | 52 | * callback: the virqtueue callback |
56 | * Returns the new virtqueue or ERR_PTR(). | 53 | * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT). |
57 | * @del_vq: free a virtqueue found by find_vq(). | 54 | * @del_vq: free a virtqueue found by find_vq(). |
58 | */ | 55 | */ |
59 | struct virtio_config_ops | 56 | struct virtio_config_ops |
60 | { | 57 | { |
61 | void *(*find)(struct virtio_device *vdev, u8 type, unsigned *len); | 58 | bool (*feature)(struct virtio_device *vdev, unsigned bit); |
62 | void (*get)(struct virtio_device *vdev, void *token, | 59 | void (*get)(struct virtio_device *vdev, unsigned offset, |
63 | void *buf, unsigned len); | 60 | void *buf, unsigned len); |
64 | void (*set)(struct virtio_device *vdev, void *token, | 61 | void (*set)(struct virtio_device *vdev, unsigned offset, |
65 | const void *buf, unsigned len); | 62 | const void *buf, unsigned len); |
66 | u8 (*get_status)(struct virtio_device *vdev); | 63 | u8 (*get_status)(struct virtio_device *vdev); |
67 | void (*set_status)(struct virtio_device *vdev, u8 status); | 64 | void (*set_status)(struct virtio_device *vdev, u8 status); |
65 | void (*reset)(struct virtio_device *vdev); | ||
68 | struct virtqueue *(*find_vq)(struct virtio_device *vdev, | 66 | struct virtqueue *(*find_vq)(struct virtio_device *vdev, |
69 | bool (*callback)(struct virtqueue *)); | 67 | unsigned index, |
68 | void (*callback)(struct virtqueue *)); | ||
70 | void (*del_vq)(struct virtqueue *vq); | 69 | void (*del_vq)(struct virtqueue *vq); |
71 | }; | 70 | }; |
72 | 71 | ||
73 | /** | 72 | /** |
74 | * virtio_config_val - get a single virtio config and mark it used. | 73 | * virtio_config_val - look for a feature and get a single virtio config. |
75 | * @config: the virtio config space | 74 | * @vdev: the virtio device |
76 | * @type: the type to search for. | 75 | * @fbit: the feature bit |
76 | * @offset: the type to search for. | ||
77 | * @val: a pointer to the value to fill in. | 77 | * @val: a pointer to the value to fill in. |
78 | * | 78 | * |
79 | * Once used, the config type is marked with VIRTIO_CONFIG_F_USED so it can't | 79 | * The return value is -ENOENT if the feature doesn't exist. Otherwise |
80 | * be found again. This version does endian conversion. */ | 80 | * the value is endian-corrected and returned in v. */ |
81 | #define virtio_config_val(vdev, type, v) ({ \ | 81 | #define virtio_config_val(vdev, fbit, offset, v) ({ \ |
82 | int _err = __virtio_config_val((vdev),(type),(v),sizeof(*(v))); \ | 82 | int _err; \ |
83 | \ | 83 | if ((vdev)->config->feature((vdev), (fbit))) { \ |
84 | BUILD_BUG_ON(sizeof(*(v)) != 1 && sizeof(*(v)) != 2 \ | 84 | __virtio_config_val((vdev), (offset), (v)); \ |
85 | && sizeof(*(v)) != 4 && sizeof(*(v)) != 8); \ | 85 | _err = 0; \ |
86 | if (!_err) { \ | 86 | } else \ |
87 | switch (sizeof(*(v))) { \ | 87 | _err = -ENOENT; \ |
88 | case 2: le16_to_cpus((__u16 *) v); break; \ | ||
89 | case 4: le32_to_cpus((__u32 *) v); break; \ | ||
90 | case 8: le64_to_cpus((__u64 *) v); break; \ | ||
91 | } \ | ||
92 | } \ | ||
93 | _err; \ | 88 | _err; \ |
94 | }) | 89 | }) |
95 | 90 | ||
96 | int __virtio_config_val(struct virtio_device *dev, | ||
97 | u8 type, void *val, size_t size); | ||
98 | |||
99 | /** | 91 | /** |
100 | * virtio_use_bit - helper to use a feature bit in a bitfield value. | 92 | * __virtio_config_val - get a single virtio config without feature check. |
101 | * @dev: the virtio device | 93 | * @vdev: the virtio device |
102 | * @token: the token as returned from vdev->config->find(). | 94 | * @offset: the type to search for. |
103 | * @len: the length of the field. | 95 | * @val: a pointer to the value to fill in. |
104 | * @bitnum: the bit to test. | ||
105 | * | 96 | * |
106 | * If handed a NULL token, it returns false, otherwise returns bit status. | 97 | * The value is endian-corrected and returned in v. */ |
107 | * If it's one, it sets the mirroring acknowledgement bit. */ | 98 | #define __virtio_config_val(vdev, offset, v) do { \ |
108 | int virtio_use_bit(struct virtio_device *vdev, | 99 | BUILD_BUG_ON(sizeof(*(v)) != 1 && sizeof(*(v)) != 2 \ |
109 | void *token, unsigned int len, unsigned int bitnum); | 100 | && sizeof(*(v)) != 4 && sizeof(*(v)) != 8); \ |
101 | (vdev)->config->get((vdev), (offset), (v), sizeof(*(v))); \ | ||
102 | switch (sizeof(*(v))) { \ | ||
103 | case 2: le16_to_cpus((__u16 *) v); break; \ | ||
104 | case 4: le32_to_cpus((__u32 *) v); break; \ | ||
105 | case 8: le64_to_cpus((__u64 *) v); break; \ | ||
106 | } \ | ||
107 | } while(0) | ||
110 | #endif /* __KERNEL__ */ | 108 | #endif /* __KERNEL__ */ |
111 | #endif /* _LINUX_VIRTIO_CONFIG_H */ | 109 | #endif /* _LINUX_VIRTIO_CONFIG_H */ |
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index ae469ae55d36..1ea3351df609 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h | |||
@@ -5,32 +5,32 @@ | |||
5 | /* The ID for virtio_net */ | 5 | /* The ID for virtio_net */ |
6 | #define VIRTIO_ID_NET 1 | 6 | #define VIRTIO_ID_NET 1 |
7 | 7 | ||
8 | /* The bitmap of config for virtio net */ | 8 | /* The feature bitmap for virtio net */ |
9 | #define VIRTIO_CONFIG_NET_F 0x40 | 9 | #define VIRTIO_NET_F_CSUM 0 /* Can handle pkts w/ partial csum */ |
10 | #define VIRTIO_NET_F_NO_CSUM 0 | 10 | #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ |
11 | #define VIRTIO_NET_F_TSO4 1 | 11 | #define VIRTIO_NET_F_GSO 6 /* Can handle pkts w/ any GSO type */ |
12 | #define VIRTIO_NET_F_UFO 2 | ||
13 | #define VIRTIO_NET_F_TSO4_ECN 3 | ||
14 | #define VIRTIO_NET_F_TSO6 4 | ||
15 | 12 | ||
16 | /* The config defining mac address. */ | 13 | struct virtio_net_config |
17 | #define VIRTIO_CONFIG_NET_MAC_F 0x41 | 14 | { |
15 | /* The config defining mac address (if VIRTIO_NET_F_MAC) */ | ||
16 | __u8 mac[6]; | ||
17 | } __attribute__((packed)); | ||
18 | 18 | ||
19 | /* This is the first element of the scatter-gather list. If you don't | 19 | /* This is the first element of the scatter-gather list. If you don't |
20 | * specify GSO or CSUM features, you can simply ignore the header. */ | 20 | * specify GSO or CSUM features, you can simply ignore the header. */ |
21 | struct virtio_net_hdr | 21 | struct virtio_net_hdr |
22 | { | 22 | { |
23 | #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset | 23 | #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset |
24 | __u8 flags; | 24 | __u8 flags; |
25 | #define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame | 25 | #define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame |
26 | #define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) | 26 | #define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) |
27 | /* FIXME: Do we need this? If they said they can handle ECN, do they care? */ | ||
28 | #define VIRTIO_NET_HDR_GSO_TCPV4_ECN 2 // GSO frame, IPv4 TCP w/ ECN | ||
29 | #define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) | 27 | #define VIRTIO_NET_HDR_GSO_UDP 3 // GSO frame, IPv4 UDP (UFO) |
30 | #define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP | 28 | #define VIRTIO_NET_HDR_GSO_TCPV6 4 // GSO frame, IPv6 TCP |
31 | __u8 gso_type; | 29 | #define VIRTIO_NET_HDR_GSO_ECN 0x80 // TCP has ECN set |
32 | __u16 gso_size; | 30 | __u8 gso_type; |
33 | __u16 csum_start; | 31 | __u16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ |
34 | __u16 csum_offset; | 32 | __u16 gso_size; /* Bytes to append to gso_hdr_len per frame */ |
33 | __u16 csum_start; /* Position to start checksumming from */ | ||
34 | __u16 csum_offset; /* Offset after that to place checksum */ | ||
35 | }; | 35 | }; |
36 | #endif /* _LINUX_VIRTIO_NET_H */ | 36 | #endif /* _LINUX_VIRTIO_NET_H */ |
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h new file mode 100644 index 000000000000..b3151659cf49 --- /dev/null +++ b/include/linux/virtio_pci.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Virtio PCI driver | ||
3 | * | ||
4 | * This module allows virtio devices to be used over a virtual PCI device. | ||
5 | * This can be used with QEMU based VMMs like KVM or Xen. | ||
6 | * | ||
7 | * Copyright IBM Corp. 2007 | ||
8 | * | ||
9 | * Authors: | ||
10 | * Anthony Liguori <aliguori@us.ibm.com> | ||
11 | * | ||
12 | * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
13 | * See the COPYING file in the top-level directory. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef _LINUX_VIRTIO_PCI_H | ||
18 | #define _LINUX_VIRTIO_PCI_H | ||
19 | |||
20 | #include <linux/virtio_config.h> | ||
21 | |||
22 | /* A 32-bit r/o bitmask of the features supported by the host */ | ||
23 | #define VIRTIO_PCI_HOST_FEATURES 0 | ||
24 | |||
25 | /* A 32-bit r/w bitmask of features activated by the guest */ | ||
26 | #define VIRTIO_PCI_GUEST_FEATURES 4 | ||
27 | |||
28 | /* A 32-bit r/w PFN for the currently selected queue */ | ||
29 | #define VIRTIO_PCI_QUEUE_PFN 8 | ||
30 | |||
31 | /* A 16-bit r/o queue size for the currently selected queue */ | ||
32 | #define VIRTIO_PCI_QUEUE_NUM 12 | ||
33 | |||
34 | /* A 16-bit r/w queue selector */ | ||
35 | #define VIRTIO_PCI_QUEUE_SEL 14 | ||
36 | |||
37 | /* A 16-bit r/w queue notifier */ | ||
38 | #define VIRTIO_PCI_QUEUE_NOTIFY 16 | ||
39 | |||
40 | /* An 8-bit device status register. */ | ||
41 | #define VIRTIO_PCI_STATUS 18 | ||
42 | |||
43 | /* An 8-bit r/o interrupt status register. Reading the value will return the | ||
44 | * current contents of the ISR and will also clear it. This is effectively | ||
45 | * a read-and-acknowledge. */ | ||
46 | #define VIRTIO_PCI_ISR 19 | ||
47 | |||
48 | /* The bit of the ISR which indicates a device configuration change. */ | ||
49 | #define VIRTIO_PCI_ISR_CONFIG 0x2 | ||
50 | |||
51 | /* The remaining space is defined by each driver as the per-driver | ||
52 | * configuration space */ | ||
53 | #define VIRTIO_PCI_CONFIG 20 | ||
54 | |||
55 | /* Virtio ABI version, this must match exactly */ | ||
56 | #define VIRTIO_PCI_ABI_VERSION 0 | ||
57 | #endif | ||
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index 1a4ed49f6478..abe481ed990e 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h | |||
@@ -15,9 +15,13 @@ | |||
15 | /* This marks a buffer as write-only (otherwise read-only). */ | 15 | /* This marks a buffer as write-only (otherwise read-only). */ |
16 | #define VRING_DESC_F_WRITE 2 | 16 | #define VRING_DESC_F_WRITE 2 |
17 | 17 | ||
18 | /* This means don't notify other side when buffer added. */ | 18 | /* The Host uses this in used->flags to advise the Guest: don't kick me when |
19 | * you add a buffer. It's unreliable, so it's simply an optimization. Guest | ||
20 | * will still kick if it's out of buffers. */ | ||
19 | #define VRING_USED_F_NO_NOTIFY 1 | 21 | #define VRING_USED_F_NO_NOTIFY 1 |
20 | /* This means don't interrupt guest when buffer consumed. */ | 22 | /* The Guest uses this in avail->flags to advise the Host: don't interrupt me |
23 | * when you consume a buffer. It's unreliable, so it's simply an | ||
24 | * optimization. */ | ||
21 | #define VRING_AVAIL_F_NO_INTERRUPT 1 | 25 | #define VRING_AVAIL_F_NO_INTERRUPT 1 |
22 | 26 | ||
23 | /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ | 27 | /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ |
@@ -89,7 +93,7 @@ struct vring { | |||
89 | * }; | 93 | * }; |
90 | */ | 94 | */ |
91 | static inline void vring_init(struct vring *vr, unsigned int num, void *p, | 95 | static inline void vring_init(struct vring *vr, unsigned int num, void *p, |
92 | unsigned int pagesize) | 96 | unsigned long pagesize) |
93 | { | 97 | { |
94 | vr->num = num; | 98 | vr->num = num; |
95 | vr->desc = p; | 99 | vr->desc = p; |
@@ -98,7 +102,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p, | |||
98 | & ~(pagesize - 1)); | 102 | & ~(pagesize - 1)); |
99 | } | 103 | } |
100 | 104 | ||
101 | static inline unsigned vring_size(unsigned int num, unsigned int pagesize) | 105 | static inline unsigned vring_size(unsigned int num, unsigned long pagesize) |
102 | { | 106 | { |
103 | return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) | 107 | return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) |
104 | + pagesize - 1) & ~(pagesize - 1)) | 108 | + pagesize - 1) & ~(pagesize - 1)) |
@@ -114,7 +118,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int num, | |||
114 | struct virtio_device *vdev, | 118 | struct virtio_device *vdev, |
115 | void *pages, | 119 | void *pages, |
116 | void (*notify)(struct virtqueue *vq), | 120 | void (*notify)(struct virtqueue *vq), |
117 | bool (*callback)(struct virtqueue *vq)); | 121 | void (*callback)(struct virtqueue *vq)); |
118 | void vring_del_virtqueue(struct virtqueue *vq); | 122 | void vring_del_virtqueue(struct virtqueue *vq); |
119 | 123 | ||
120 | irqreturn_t vring_interrupt(int irq, void *_vq); | 124 | irqreturn_t vring_interrupt(int irq, void *_vq); |
diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 74e84caa1e20..3160dfed73ca 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h | |||
@@ -1079,7 +1079,7 @@ struct iw_priv_args | |||
1079 | */ | 1079 | */ |
1080 | struct iw_event | 1080 | struct iw_event |
1081 | { | 1081 | { |
1082 | __u16 len; /* Real lenght of this stuff */ | 1082 | __u16 len; /* Real length of this stuff */ |
1083 | __u16 cmd; /* Wireless IOCTL */ | 1083 | __u16 cmd; /* Wireless IOCTL */ |
1084 | union iwreq_data u; /* IOCTL fixed payload */ | 1084 | union iwreq_data u; /* IOCTL fixed payload */ |
1085 | }; | 1085 | }; |
diff --git a/include/media/rds.h b/include/media/rds.h index 951c1ae0be74..a89426667618 100644 --- a/include/media/rds.h +++ b/include/media/rds.h | |||
@@ -4,7 +4,7 @@ | |||
4 | saa6588.c and every driver (e.g. bttv-driver.c) that wants | 4 | saa6588.c and every driver (e.g. bttv-driver.c) that wants |
5 | to use the saa6588 module. | 5 | to use the saa6588 module. |
6 | 6 | ||
7 | Instead of having a seperate rds.h, I'd prefer to include | 7 | Instead of having a separate rds.h, I'd prefer to include |
8 | this stuff in one of the already existing files like tuner.h | 8 | this stuff in one of the already existing files like tuner.h |
9 | 9 | ||
10 | (c) 2005 by Hans J. Koch | 10 | (c) 2005 by Hans J. Koch |
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index b24508abb850..b2cfc4927257 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h | |||
@@ -112,13 +112,13 @@ struct ifmcaddr6 | |||
112 | struct ip6_sf_list *mca_sources; | 112 | struct ip6_sf_list *mca_sources; |
113 | struct ip6_sf_list *mca_tomb; | 113 | struct ip6_sf_list *mca_tomb; |
114 | unsigned int mca_sfmode; | 114 | unsigned int mca_sfmode; |
115 | unsigned char mca_crcount; | ||
115 | unsigned long mca_sfcount[2]; | 116 | unsigned long mca_sfcount[2]; |
116 | struct timer_list mca_timer; | 117 | struct timer_list mca_timer; |
117 | unsigned mca_flags; | 118 | unsigned mca_flags; |
118 | int mca_users; | 119 | int mca_users; |
119 | atomic_t mca_refcnt; | 120 | atomic_t mca_refcnt; |
120 | spinlock_t mca_lock; | 121 | spinlock_t mca_lock; |
121 | unsigned char mca_crcount; | ||
122 | unsigned long mca_cstamp; | 122 | unsigned long mca_cstamp; |
123 | unsigned long mca_tstamp; | 123 | unsigned long mca_tstamp; |
124 | }; | 124 | }; |
@@ -166,11 +166,11 @@ struct inet6_dev | |||
166 | struct ifmcaddr6 *mc_list; | 166 | struct ifmcaddr6 *mc_list; |
167 | struct ifmcaddr6 *mc_tomb; | 167 | struct ifmcaddr6 *mc_tomb; |
168 | rwlock_t mc_lock; | 168 | rwlock_t mc_lock; |
169 | unsigned long mc_v1_seen; | ||
170 | unsigned long mc_maxdelay; | ||
171 | unsigned char mc_qrv; | 169 | unsigned char mc_qrv; |
172 | unsigned char mc_gq_running; | 170 | unsigned char mc_gq_running; |
173 | unsigned char mc_ifc_count; | 171 | unsigned char mc_ifc_count; |
172 | unsigned long mc_v1_seen; | ||
173 | unsigned long mc_maxdelay; | ||
174 | struct timer_list mc_gq_timer; /* general query timer */ | 174 | struct timer_list mc_gq_timer; /* general query timer */ |
175 | struct timer_list mc_ifc_timer; /* interface change timer */ | 175 | struct timer_list mc_ifc_timer; /* interface change timer */ |
176 | 176 | ||
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index fdff630708ce..62a5b691858e 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -49,7 +49,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk) | |||
49 | return inet6_ehashfn(laddr, lport, faddr, fport); | 49 | return inet6_ehashfn(laddr, lport, faddr, fport); |
50 | } | 50 | } |
51 | 51 | ||
52 | extern void __inet6_hash(struct inet_hashinfo *hashinfo, struct sock *sk); | 52 | extern void __inet6_hash(struct sock *sk); |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so | 55 | * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 133cf30d2d79..f00f0573627b 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #undef INET_CSK_CLEAR_TIMERS | 29 | #undef INET_CSK_CLEAR_TIMERS |
30 | 30 | ||
31 | struct inet_bind_bucket; | 31 | struct inet_bind_bucket; |
32 | struct inet_hashinfo; | ||
33 | struct tcp_congestion_ops; | 32 | struct tcp_congestion_ops; |
34 | 33 | ||
35 | /* | 34 | /* |
@@ -59,6 +58,8 @@ struct inet_connection_sock_af_ops { | |||
59 | int level, int optname, | 58 | int level, int optname, |
60 | char __user *optval, int __user *optlen); | 59 | char __user *optval, int __user *optlen); |
61 | void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); | 60 | void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); |
61 | int (*bind_conflict)(const struct sock *sk, | ||
62 | const struct inet_bind_bucket *tb); | ||
62 | }; | 63 | }; |
63 | 64 | ||
64 | /** inet_connection_sock - INET connection oriented sock | 65 | /** inet_connection_sock - INET connection oriented sock |
@@ -244,10 +245,7 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk, | |||
244 | const __be32 laddr); | 245 | const __be32 laddr); |
245 | extern int inet_csk_bind_conflict(const struct sock *sk, | 246 | extern int inet_csk_bind_conflict(const struct sock *sk, |
246 | const struct inet_bind_bucket *tb); | 247 | const struct inet_bind_bucket *tb); |
247 | extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, | 248 | extern int inet_csk_get_port(struct sock *sk, unsigned short snum); |
248 | struct sock *sk, unsigned short snum, | ||
249 | int (*bind_conflict)(const struct sock *sk, | ||
250 | const struct inet_bind_bucket *tb)); | ||
251 | 249 | ||
252 | extern struct dst_entry* inet_csk_route_req(struct sock *sk, | 250 | extern struct dst_entry* inet_csk_route_req(struct sock *sk, |
253 | const struct request_sock *req); | 251 | const struct request_sock *req); |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index c23c4ed30724..48ac620cb846 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -221,9 +221,9 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk) | |||
221 | } | 221 | } |
222 | 222 | ||
223 | /* Caller must disable local BH processing. */ | 223 | /* Caller must disable local BH processing. */ |
224 | static inline void __inet_inherit_port(struct inet_hashinfo *table, | 224 | static inline void __inet_inherit_port(struct sock *sk, struct sock *child) |
225 | struct sock *sk, struct sock *child) | ||
226 | { | 225 | { |
226 | struct inet_hashinfo *table = sk->sk_prot->hashinfo; | ||
227 | const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size); | 227 | const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size); |
228 | struct inet_bind_hashbucket *head = &table->bhash[bhash]; | 228 | struct inet_bind_hashbucket *head = &table->bhash[bhash]; |
229 | struct inet_bind_bucket *tb; | 229 | struct inet_bind_bucket *tb; |
@@ -235,15 +235,14 @@ static inline void __inet_inherit_port(struct inet_hashinfo *table, | |||
235 | spin_unlock(&head->lock); | 235 | spin_unlock(&head->lock); |
236 | } | 236 | } |
237 | 237 | ||
238 | static inline void inet_inherit_port(struct inet_hashinfo *table, | 238 | static inline void inet_inherit_port(struct sock *sk, struct sock *child) |
239 | struct sock *sk, struct sock *child) | ||
240 | { | 239 | { |
241 | local_bh_disable(); | 240 | local_bh_disable(); |
242 | __inet_inherit_port(table, sk, child); | 241 | __inet_inherit_port(sk, child); |
243 | local_bh_enable(); | 242 | local_bh_enable(); |
244 | } | 243 | } |
245 | 244 | ||
246 | extern void inet_put_port(struct inet_hashinfo *table, struct sock *sk); | 245 | extern void inet_put_port(struct sock *sk); |
247 | 246 | ||
248 | extern void inet_listen_wlock(struct inet_hashinfo *hashinfo); | 247 | extern void inet_listen_wlock(struct inet_hashinfo *hashinfo); |
249 | 248 | ||
@@ -266,41 +265,9 @@ static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo) | |||
266 | wake_up(&hashinfo->lhash_wait); | 265 | wake_up(&hashinfo->lhash_wait); |
267 | } | 266 | } |
268 | 267 | ||
269 | extern void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk); | 268 | extern void __inet_hash_nolisten(struct sock *sk); |
270 | extern void __inet_hash_nolisten(struct inet_hashinfo *hinfo, struct sock *sk); | 269 | extern void inet_hash(struct sock *sk); |
271 | 270 | extern void inet_unhash(struct sock *sk); | |
272 | static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk) | ||
273 | { | ||
274 | if (sk->sk_state != TCP_CLOSE) { | ||
275 | local_bh_disable(); | ||
276 | __inet_hash(hashinfo, sk); | ||
277 | local_bh_enable(); | ||
278 | } | ||
279 | } | ||
280 | |||
281 | static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk) | ||
282 | { | ||
283 | rwlock_t *lock; | ||
284 | |||
285 | if (sk_unhashed(sk)) | ||
286 | goto out; | ||
287 | |||
288 | if (sk->sk_state == TCP_LISTEN) { | ||
289 | local_bh_disable(); | ||
290 | inet_listen_wlock(hashinfo); | ||
291 | lock = &hashinfo->lhash_lock; | ||
292 | } else { | ||
293 | lock = inet_ehash_lockp(hashinfo, sk->sk_hash); | ||
294 | write_lock_bh(lock); | ||
295 | } | ||
296 | |||
297 | if (__sk_del_node_init(sk)) | ||
298 | sock_prot_inuse_add(sk->sk_prot, -1); | ||
299 | write_unlock_bh(lock); | ||
300 | out: | ||
301 | if (sk->sk_state == TCP_LISTEN) | ||
302 | wake_up(&hashinfo->lhash_wait); | ||
303 | } | ||
304 | 271 | ||
305 | extern struct sock *__inet_lookup_listener(struct net *net, | 272 | extern struct sock *__inet_lookup_listener(struct net *net, |
306 | struct inet_hashinfo *hashinfo, | 273 | struct inet_hashinfo *hashinfo, |
@@ -425,7 +392,7 @@ extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, | |||
425 | struct sock *sk, | 392 | struct sock *sk, |
426 | int (*check_established)(struct inet_timewait_death_row *, | 393 | int (*check_established)(struct inet_timewait_death_row *, |
427 | struct sock *, __u16, struct inet_timewait_sock **), | 394 | struct sock *, __u16, struct inet_timewait_sock **), |
428 | void (*hash)(struct inet_hashinfo *, struct sock *)); | 395 | void (*hash)(struct sock *sk)); |
429 | extern int inet_hash_connect(struct inet_timewait_death_row *death_row, | 396 | extern int inet_hash_connect(struct inet_timewait_death_row *death_row, |
430 | struct sock *sk); | 397 | struct sock *sk); |
431 | #endif /* _INET_HASHTABLES_H */ | 398 | #endif /* _INET_HASHTABLES_H */ |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 67e925065aae..296547bfb0b7 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -116,6 +116,7 @@ struct inet_timewait_sock { | |||
116 | #define tw_hash __tw_common.skc_hash | 116 | #define tw_hash __tw_common.skc_hash |
117 | #define tw_prot __tw_common.skc_prot | 117 | #define tw_prot __tw_common.skc_prot |
118 | #define tw_net __tw_common.skc_net | 118 | #define tw_net __tw_common.skc_net |
119 | int tw_timeout; | ||
119 | volatile unsigned char tw_substate; | 120 | volatile unsigned char tw_substate; |
120 | /* 3 bits hole, try to pack */ | 121 | /* 3 bits hole, try to pack */ |
121 | unsigned char tw_rcv_wscale; | 122 | unsigned char tw_rcv_wscale; |
@@ -130,7 +131,6 @@ struct inet_timewait_sock { | |||
130 | __u8 tw_ipv6only:1; | 131 | __u8 tw_ipv6only:1; |
131 | /* 15 bits hole, try to pack */ | 132 | /* 15 bits hole, try to pack */ |
132 | __u16 tw_ipv6_offset; | 133 | __u16 tw_ipv6_offset; |
133 | int tw_timeout; | ||
134 | unsigned long tw_ttd; | 134 | unsigned long tw_ttd; |
135 | struct inet_bind_bucket *tw_tb; | 135 | struct inet_bind_bucket *tw_tb; |
136 | struct hlist_node tw_death_node; | 136 | struct hlist_node tw_death_node; |
diff --git a/include/net/sock.h b/include/net/sock.h index e3fb4c047f4c..8a7889b35810 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -496,6 +496,7 @@ extern int sk_wait_data(struct sock *sk, long *timeo); | |||
496 | 496 | ||
497 | struct request_sock_ops; | 497 | struct request_sock_ops; |
498 | struct timewait_sock_ops; | 498 | struct timewait_sock_ops; |
499 | struct inet_hashinfo; | ||
499 | 500 | ||
500 | /* Networking protocol blocks we attach to sockets. | 501 | /* Networking protocol blocks we attach to sockets. |
501 | * socket layer -> transport layer interface | 502 | * socket layer -> transport layer interface |
@@ -578,6 +579,8 @@ struct proto { | |||
578 | struct request_sock_ops *rsk_prot; | 579 | struct request_sock_ops *rsk_prot; |
579 | struct timewait_sock_ops *twsk_prot; | 580 | struct timewait_sock_ops *twsk_prot; |
580 | 581 | ||
582 | struct inet_hashinfo *hashinfo; | ||
583 | |||
581 | struct module *owner; | 584 | struct module *owner; |
582 | 585 | ||
583 | char name[32]; | 586 | char name[32]; |
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index e466d886e192..4769efd4db24 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h | |||
@@ -176,7 +176,7 @@ struct class_device_attribute class_device_attr_vport_##_name = \ | |||
176 | * ports has a unique presense on the SAN, and may be instantiated via | 176 | * ports has a unique presense on the SAN, and may be instantiated via |
177 | * NPIV, Virtual Fabrics, or via additional ALPAs. As the vport is a | 177 | * NPIV, Virtual Fabrics, or via additional ALPAs. As the vport is a |
178 | * unique presense, each vport has it's own view of the fabric, | 178 | * unique presense, each vport has it's own view of the fabric, |
179 | * authentication priviledge, and priorities. | 179 | * authentication privilege, and priorities. |
180 | * | 180 | * |
181 | * A virtual port may support 1 or more FC4 roles. Typically it is a | 181 | * A virtual port may support 1 or more FC4 roles. Typically it is a |
182 | * FCP Initiator. It could be a FCP Target, or exist sole for an IP over FC | 182 | * FCP Initiator. It could be a FCP Target, or exist sole for an IP over FC |
diff --git a/init/Kconfig b/init/Kconfig index dcc96a8c8c69..b2acdeb2d312 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -665,6 +665,20 @@ config SLOB | |||
665 | 665 | ||
666 | endchoice | 666 | endchoice |
667 | 667 | ||
668 | config PROFILING | ||
669 | bool "Profiling support (EXPERIMENTAL)" | ||
670 | help | ||
671 | Say Y here to enable the extended profiling support mechanisms used | ||
672 | by profilers such as OProfile. | ||
673 | |||
674 | config MARKERS | ||
675 | bool "Activate markers" | ||
676 | help | ||
677 | Place an empty function call at each marker site. Can be | ||
678 | dynamically changed for a probe function. | ||
679 | |||
680 | source "arch/Kconfig" | ||
681 | |||
668 | endmenu # General setup | 682 | endmenu # General setup |
669 | 683 | ||
670 | config SLABINFO | 684 | config SLABINFO |
diff --git a/kernel/Kconfig.instrumentation b/kernel/Kconfig.instrumentation deleted file mode 100644 index 468f47ad7503..000000000000 --- a/kernel/Kconfig.instrumentation +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | menuconfig INSTRUMENTATION | ||
2 | bool "Instrumentation Support" | ||
3 | default y | ||
4 | ---help--- | ||
5 | Say Y here to get to see options related to performance measurement, | ||
6 | system-wide debugging, and testing. This option alone does not add any | ||
7 | kernel code. | ||
8 | |||
9 | If you say N, all options in this submenu will be skipped and | ||
10 | disabled. If you're trying to debug the kernel itself, go see the | ||
11 | Kernel Hacking menu. | ||
12 | |||
13 | if INSTRUMENTATION | ||
14 | |||
15 | config PROFILING | ||
16 | bool "Profiling support (EXPERIMENTAL)" | ||
17 | help | ||
18 | Say Y here to enable the extended profiling support mechanisms used | ||
19 | by profilers such as OProfile. | ||
20 | |||
21 | config OPROFILE | ||
22 | tristate "OProfile system profiling (EXPERIMENTAL)" | ||
23 | depends on PROFILING && !UML | ||
24 | depends on ARCH_SUPPORTS_OPROFILE || ALPHA || ARM || BLACKFIN || IA64 || M32R || PARISC || PPC || S390 || SUPERH || SPARC | ||
25 | help | ||
26 | OProfile is a profiling system capable of profiling the | ||
27 | whole system, include the kernel, kernel modules, libraries, | ||
28 | and applications. | ||
29 | |||
30 | If unsure, say N. | ||
31 | |||
32 | config KPROBES | ||
33 | bool "Kprobes" | ||
34 | depends on KALLSYMS && MODULES && !UML | ||
35 | depends on X86_32 || IA64 || PPC || S390 || SPARC64 || X86_64 || AVR32 | ||
36 | help | ||
37 | Kprobes allows you to trap at almost any kernel address and | ||
38 | execute a callback function. register_kprobe() establishes | ||
39 | a probepoint and specifies the callback. Kprobes is useful | ||
40 | for kernel debugging, non-intrusive instrumentation and testing. | ||
41 | If in doubt, say "N". | ||
42 | |||
43 | config MARKERS | ||
44 | bool "Activate markers" | ||
45 | help | ||
46 | Place an empty function call at each marker site. Can be | ||
47 | dynamically changed for a probe function. | ||
48 | |||
49 | endif # INSTRUMENTATION | ||
diff --git a/kernel/Makefile b/kernel/Makefile index 8885627ea021..db9af707ff5b 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -9,7 +9,7 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \ | |||
9 | rcupdate.o extable.o params.o posix-timers.o \ | 9 | rcupdate.o extable.o params.o posix-timers.o \ |
10 | kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ | 10 | kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ |
11 | hrtimer.o rwsem.o latency.o nsproxy.o srcu.o \ | 11 | hrtimer.o rwsem.o latency.o nsproxy.o srcu.o \ |
12 | utsname.o notifier.o | 12 | utsname.o notifier.o ksysfs.o |
13 | 13 | ||
14 | obj-$(CONFIG_SYSCTL) += sysctl_check.o | 14 | obj-$(CONFIG_SYSCTL) += sysctl_check.o |
15 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 15 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
@@ -49,7 +49,6 @@ obj-$(CONFIG_AUDIT) += audit.o auditfilter.o | |||
49 | obj-$(CONFIG_AUDITSYSCALL) += auditsc.o | 49 | obj-$(CONFIG_AUDITSYSCALL) += auditsc.o |
50 | obj-$(CONFIG_AUDIT_TREE) += audit_tree.o | 50 | obj-$(CONFIG_AUDIT_TREE) += audit_tree.o |
51 | obj-$(CONFIG_KPROBES) += kprobes.o | 51 | obj-$(CONFIG_KPROBES) += kprobes.o |
52 | obj-$(CONFIG_SYSFS) += ksysfs.o | ||
53 | obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o | 52 | obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o |
54 | obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ | 53 | obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ |
55 | obj-$(CONFIG_SECCOMP) += seccomp.o | 54 | obj-$(CONFIG_SECCOMP) += seccomp.o |
diff --git a/kernel/exit.c b/kernel/exit.c index bfb1c0e940e8..9e459fefda77 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -50,8 +50,6 @@ | |||
50 | #include <asm/pgtable.h> | 50 | #include <asm/pgtable.h> |
51 | #include <asm/mmu_context.h> | 51 | #include <asm/mmu_context.h> |
52 | 52 | ||
53 | extern void sem_exit (void); | ||
54 | |||
55 | static void exit_mm(struct task_struct * tsk); | 53 | static void exit_mm(struct task_struct * tsk); |
56 | 54 | ||
57 | static void __unhash_process(struct task_struct *p) | 55 | static void __unhash_process(struct task_struct *p) |
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 35b4bbfc78ff..36d563fd9e3b 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -493,7 +493,7 @@ sys_timer_create(const clockid_t which_clock, | |||
493 | goto retry; | 493 | goto retry; |
494 | else if (error) { | 494 | else if (error) { |
495 | /* | 495 | /* |
496 | * Wierd looking, but we return EAGAIN if the IDR is | 496 | * Weird looking, but we return EAGAIN if the IDR is |
497 | * full (proper POSIX return value for this) | 497 | * full (proper POSIX return value for this) |
498 | */ | 498 | */ |
499 | error = -EAGAIN; | 499 | error = -EAGAIN; |
diff --git a/kernel/relay.c b/kernel/relay.c index 61134eb7a0c8..7c0373322f18 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -92,6 +92,7 @@ static int relay_mmap_buf(struct rchan_buf *buf, struct vm_area_struct *vma) | |||
92 | return -EINVAL; | 92 | return -EINVAL; |
93 | 93 | ||
94 | vma->vm_ops = &relay_file_mmap_ops; | 94 | vma->vm_ops = &relay_file_mmap_ops; |
95 | vma->vm_flags |= VM_DONTEXPAND; | ||
95 | vma->vm_private_data = buf; | 96 | vma->vm_private_data = buf; |
96 | buf->chan->cb->buf_mapped(buf, filp); | 97 | buf->chan->cb->buf_mapped(buf, filp); |
97 | 98 | ||
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 0d8a5a4a789d..0d385be682db 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -81,7 +81,7 @@ config HEADERS_CHECK | |||
81 | 81 | ||
82 | config DEBUG_SECTION_MISMATCH | 82 | config DEBUG_SECTION_MISMATCH |
83 | bool "Enable full Section mismatch analysis" | 83 | bool "Enable full Section mismatch analysis" |
84 | default n | 84 | depends on UNDEFINED |
85 | help | 85 | help |
86 | The section mismatch analysis checks if there are illegal | 86 | The section mismatch analysis checks if there are illegal |
87 | references from one section to another section. | 87 | references from one section to another section. |
@@ -90,19 +90,19 @@ config DEBUG_SECTION_MISMATCH | |||
90 | most likely result in an oops. | 90 | most likely result in an oops. |
91 | In the code functions and variables are annotated with | 91 | In the code functions and variables are annotated with |
92 | __init, __devinit etc. (see full list in include/linux/init.h) | 92 | __init, __devinit etc. (see full list in include/linux/init.h) |
93 | which result in the code/data being placed in specific sections. | 93 | which results in the code/data being placed in specific sections. |
94 | The section mismatch anaylsis are always done after a full | 94 | The section mismatch analysis is always done after a full |
95 | kernel build but enabling this options will in addition | 95 | kernel build but enabling this option will in addition |
96 | do the following: | 96 | do the following: |
97 | - Add the option -fno-inline-functions-called-once to gcc | 97 | - Add the option -fno-inline-functions-called-once to gcc |
98 | When inlining a function annotated __init in a non-init | 98 | When inlining a function annotated __init in a non-init |
99 | function we would loose the section information and thus | 99 | function we would lose the section information and thus |
100 | the analysis would not catch the illegal reference. | 100 | the analysis would not catch the illegal reference. |
101 | This options tell gcc to inline less but will also | 101 | This option tells gcc to inline less but will also |
102 | result in a larger kernel. | 102 | result in a larger kernel. |
103 | - Run the section mismatch analysis for each module/built-in.o | 103 | - Run the section mismatch analysis for each module/built-in.o |
104 | When we run the section mismatch analysis on vmlinux.o we | 104 | When we run the section mismatch analysis on vmlinux.o we |
105 | looses valueable information about where the mismatch was | 105 | lose valueble information about where the mismatch was |
106 | introduced. | 106 | introduced. |
107 | Running the analysis for each module/built-in.o file | 107 | Running the analysis for each module/built-in.o file |
108 | will tell where the mismatch happens much closer to the | 108 | will tell where the mismatch happens much closer to the |
diff --git a/lib/crc32.c b/lib/crc32.c index d2c2f257bedd..49d1c9e3ce38 100644 --- a/lib/crc32.c +++ b/lib/crc32.c | |||
@@ -348,7 +348,7 @@ EXPORT_SYMBOL(crc32_be); | |||
348 | * but again the multiple of the polynomial to subtract depends only on | 348 | * but again the multiple of the polynomial to subtract depends only on |
349 | * the high bits, the high 8 bits in this case. | 349 | * the high bits, the high 8 bits in this case. |
350 | * | 350 | * |
351 | * The multile we need in that case is the low 32 bits of a 40-bit | 351 | * The multiple we need in that case is the low 32 bits of a 40-bit |
352 | * value whose high 8 bits are given, and which is a multiple of the | 352 | * value whose high 8 bits are given, and which is a multiple of the |
353 | * generator polynomial. This is simply the CRC-32 of the given | 353 | * generator polynomial. This is simply the CRC-32 of the given |
354 | * one-byte message. | 354 | * one-byte message. |
diff --git a/lib/kobject.c b/lib/kobject.c index 1d63ead1815e..d784daeb8571 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -637,7 +637,7 @@ struct kobject *kobject_create(void) | |||
637 | * @name: the name for the kset | 637 | * @name: the name for the kset |
638 | * @parent: the parent kobject of this kobject, if any. | 638 | * @parent: the parent kobject of this kobject, if any. |
639 | * | 639 | * |
640 | * This function creates a kset structure dynamically and registers it | 640 | * This function creates a kobject structure dynamically and registers it |
641 | * with sysfs. When you are finished with this structure, call | 641 | * with sysfs. When you are finished with this structure, call |
642 | * kobject_put() and the structure will be dynamically freed when | 642 | * kobject_put() and the structure will be dynamically freed when |
643 | * it is no longer being used. | 643 | * it is no longer being used. |
diff --git a/lib/zlib_deflate/defutil.h b/lib/zlib_deflate/defutil.h index d9feaf638608..6b15a909ca3f 100644 --- a/lib/zlib_deflate/defutil.h +++ b/lib/zlib_deflate/defutil.h | |||
@@ -164,7 +164,7 @@ typedef struct deflate_state { | |||
164 | int nice_match; /* Stop searching when current match exceeds this */ | 164 | int nice_match; /* Stop searching when current match exceeds this */ |
165 | 165 | ||
166 | /* used by trees.c: */ | 166 | /* used by trees.c: */ |
167 | /* Didn't use ct_data typedef below to supress compiler warning */ | 167 | /* Didn't use ct_data typedef below to suppress compiler warning */ |
168 | struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ | 168 | struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ |
169 | struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ | 169 | struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ |
170 | struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ | 170 | struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ |
diff --git a/mm/filemap.c b/mm/filemap.c index 89ce6fe5f8be..76bea88cbebc 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1750,7 +1750,11 @@ static void __iov_iter_advance_iov(struct iov_iter *i, size_t bytes) | |||
1750 | const struct iovec *iov = i->iov; | 1750 | const struct iovec *iov = i->iov; |
1751 | size_t base = i->iov_offset; | 1751 | size_t base = i->iov_offset; |
1752 | 1752 | ||
1753 | while (bytes) { | 1753 | /* |
1754 | * The !iov->iov_len check ensures we skip over unlikely | ||
1755 | * zero-length segments. | ||
1756 | */ | ||
1757 | while (bytes || !iov->iov_len) { | ||
1754 | int copy = min(bytes, iov->iov_len - base); | 1758 | int copy = min(bytes, iov->iov_len - base); |
1755 | 1759 | ||
1756 | bytes -= copy; | 1760 | bytes -= copy; |
@@ -2268,6 +2272,7 @@ again: | |||
2268 | 2272 | ||
2269 | cond_resched(); | 2273 | cond_resched(); |
2270 | 2274 | ||
2275 | iov_iter_advance(i, copied); | ||
2271 | if (unlikely(copied == 0)) { | 2276 | if (unlikely(copied == 0)) { |
2272 | /* | 2277 | /* |
2273 | * If we were unable to copy any data at all, we must | 2278 | * If we were unable to copy any data at all, we must |
@@ -2281,7 +2286,6 @@ again: | |||
2281 | iov_iter_single_seg_count(i)); | 2286 | iov_iter_single_seg_count(i)); |
2282 | goto again; | 2287 | goto again; |
2283 | } | 2288 | } |
2284 | iov_iter_advance(i, copied); | ||
2285 | pos += copied; | 2289 | pos += copied; |
2286 | written += copied; | 2290 | written += copied; |
2287 | 2291 | ||
@@ -2216,7 +2216,7 @@ int install_special_mapping(struct mm_struct *mm, | |||
2216 | vma->vm_start = addr; | 2216 | vma->vm_start = addr; |
2217 | vma->vm_end = addr + len; | 2217 | vma->vm_end = addr + len; |
2218 | 2218 | ||
2219 | vma->vm_flags = vm_flags | mm->def_flags; | 2219 | vma->vm_flags = vm_flags | mm->def_flags | VM_DONTEXPAND; |
2220 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); | 2220 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); |
2221 | 2221 | ||
2222 | vma->vm_ops = &special_mapping_vmops; | 2222 | vma->vm_ops = &special_mapping_vmops; |
@@ -247,7 +247,10 @@ static void sysfs_slab_remove(struct kmem_cache *); | |||
247 | static inline int sysfs_slab_add(struct kmem_cache *s) { return 0; } | 247 | static inline int sysfs_slab_add(struct kmem_cache *s) { return 0; } |
248 | static inline int sysfs_slab_alias(struct kmem_cache *s, const char *p) | 248 | static inline int sysfs_slab_alias(struct kmem_cache *s, const char *p) |
249 | { return 0; } | 249 | { return 0; } |
250 | static inline void sysfs_slab_remove(struct kmem_cache *s) {} | 250 | static inline void sysfs_slab_remove(struct kmem_cache *s) |
251 | { | ||
252 | kfree(s); | ||
253 | } | ||
251 | #endif | 254 | #endif |
252 | 255 | ||
253 | /******************************************************************** | 256 | /******************************************************************** |
@@ -354,22 +357,22 @@ static void print_section(char *text, u8 *addr, unsigned int length) | |||
354 | printk(KERN_ERR "%8s 0x%p: ", text, addr + i); | 357 | printk(KERN_ERR "%8s 0x%p: ", text, addr + i); |
355 | newline = 0; | 358 | newline = 0; |
356 | } | 359 | } |
357 | printk(" %02x", addr[i]); | 360 | printk(KERN_CONT " %02x", addr[i]); |
358 | offset = i % 16; | 361 | offset = i % 16; |
359 | ascii[offset] = isgraph(addr[i]) ? addr[i] : '.'; | 362 | ascii[offset] = isgraph(addr[i]) ? addr[i] : '.'; |
360 | if (offset == 15) { | 363 | if (offset == 15) { |
361 | printk(" %s\n",ascii); | 364 | printk(KERN_CONT " %s\n", ascii); |
362 | newline = 1; | 365 | newline = 1; |
363 | } | 366 | } |
364 | } | 367 | } |
365 | if (!newline) { | 368 | if (!newline) { |
366 | i %= 16; | 369 | i %= 16; |
367 | while (i < 16) { | 370 | while (i < 16) { |
368 | printk(" "); | 371 | printk(KERN_CONT " "); |
369 | ascii[i] = ' '; | 372 | ascii[i] = ' '; |
370 | i++; | 373 | i++; |
371 | } | 374 | } |
372 | printk(" %s\n", ascii); | 375 | printk(KERN_CONT " %s\n", ascii); |
373 | } | 376 | } |
374 | } | 377 | } |
375 | 378 | ||
@@ -529,7 +532,7 @@ static void init_object(struct kmem_cache *s, void *object, int active) | |||
529 | 532 | ||
530 | if (s->flags & __OBJECT_POISON) { | 533 | if (s->flags & __OBJECT_POISON) { |
531 | memset(p, POISON_FREE, s->objsize - 1); | 534 | memset(p, POISON_FREE, s->objsize - 1); |
532 | p[s->objsize -1] = POISON_END; | 535 | p[s->objsize - 1] = POISON_END; |
533 | } | 536 | } |
534 | 537 | ||
535 | if (s->flags & SLAB_RED_ZONE) | 538 | if (s->flags & SLAB_RED_ZONE) |
@@ -558,7 +561,7 @@ static void restore_bytes(struct kmem_cache *s, char *message, u8 data, | |||
558 | 561 | ||
559 | static int check_bytes_and_report(struct kmem_cache *s, struct page *page, | 562 | static int check_bytes_and_report(struct kmem_cache *s, struct page *page, |
560 | u8 *object, char *what, | 563 | u8 *object, char *what, |
561 | u8* start, unsigned int value, unsigned int bytes) | 564 | u8 *start, unsigned int value, unsigned int bytes) |
562 | { | 565 | { |
563 | u8 *fault; | 566 | u8 *fault; |
564 | u8 *end; | 567 | u8 *end; |
@@ -692,7 +695,7 @@ static int check_object(struct kmem_cache *s, struct page *page, | |||
692 | (!check_bytes_and_report(s, page, p, "Poison", p, | 695 | (!check_bytes_and_report(s, page, p, "Poison", p, |
693 | POISON_FREE, s->objsize - 1) || | 696 | POISON_FREE, s->objsize - 1) || |
694 | !check_bytes_and_report(s, page, p, "Poison", | 697 | !check_bytes_and_report(s, page, p, "Poison", |
695 | p + s->objsize -1, POISON_END, 1))) | 698 | p + s->objsize - 1, POISON_END, 1))) |
696 | return 0; | 699 | return 0; |
697 | /* | 700 | /* |
698 | * check_pad_bytes cleans up on its own. | 701 | * check_pad_bytes cleans up on its own. |
@@ -900,8 +903,7 @@ static int free_debug_processing(struct kmem_cache *s, struct page *page, | |||
900 | "SLUB <none>: no slab for object 0x%p.\n", | 903 | "SLUB <none>: no slab for object 0x%p.\n", |
901 | object); | 904 | object); |
902 | dump_stack(); | 905 | dump_stack(); |
903 | } | 906 | } else |
904 | else | ||
905 | object_err(s, page, object, | 907 | object_err(s, page, object, |
906 | "page slab pointer corrupt."); | 908 | "page slab pointer corrupt."); |
907 | goto fail; | 909 | goto fail; |
@@ -947,7 +949,7 @@ static int __init setup_slub_debug(char *str) | |||
947 | /* | 949 | /* |
948 | * Determine which debug features should be switched on | 950 | * Determine which debug features should be switched on |
949 | */ | 951 | */ |
950 | for ( ;*str && *str != ','; str++) { | 952 | for (; *str && *str != ','; str++) { |
951 | switch (tolower(*str)) { | 953 | switch (tolower(*str)) { |
952 | case 'f': | 954 | case 'f': |
953 | slub_debug |= SLAB_DEBUG_FREE; | 955 | slub_debug |= SLAB_DEBUG_FREE; |
@@ -966,7 +968,7 @@ static int __init setup_slub_debug(char *str) | |||
966 | break; | 968 | break; |
967 | default: | 969 | default: |
968 | printk(KERN_ERR "slub_debug option '%c' " | 970 | printk(KERN_ERR "slub_debug option '%c' " |
969 | "unknown. skipped\n",*str); | 971 | "unknown. skipped\n", *str); |
970 | } | 972 | } |
971 | } | 973 | } |
972 | 974 | ||
@@ -1039,7 +1041,7 @@ static inline unsigned long kmem_cache_flags(unsigned long objsize, | |||
1039 | */ | 1041 | */ |
1040 | static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) | 1042 | static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) |
1041 | { | 1043 | { |
1042 | struct page * page; | 1044 | struct page *page; |
1043 | int pages = 1 << s->order; | 1045 | int pages = 1 << s->order; |
1044 | 1046 | ||
1045 | if (s->order) | 1047 | if (s->order) |
@@ -1135,7 +1137,7 @@ static void __free_slab(struct kmem_cache *s, struct page *page) | |||
1135 | mod_zone_page_state(page_zone(page), | 1137 | mod_zone_page_state(page_zone(page), |
1136 | (s->flags & SLAB_RECLAIM_ACCOUNT) ? | 1138 | (s->flags & SLAB_RECLAIM_ACCOUNT) ? |
1137 | NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE, | 1139 | NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE, |
1138 | - pages); | 1140 | -pages); |
1139 | 1141 | ||
1140 | __free_pages(page, s->order); | 1142 | __free_pages(page, s->order); |
1141 | } | 1143 | } |
@@ -1195,19 +1197,15 @@ static __always_inline int slab_trylock(struct page *page) | |||
1195 | /* | 1197 | /* |
1196 | * Management of partially allocated slabs | 1198 | * Management of partially allocated slabs |
1197 | */ | 1199 | */ |
1198 | static void add_partial_tail(struct kmem_cache_node *n, struct page *page) | 1200 | static void add_partial(struct kmem_cache_node *n, |
1199 | { | 1201 | struct page *page, int tail) |
1200 | spin_lock(&n->list_lock); | ||
1201 | n->nr_partial++; | ||
1202 | list_add_tail(&page->lru, &n->partial); | ||
1203 | spin_unlock(&n->list_lock); | ||
1204 | } | ||
1205 | |||
1206 | static void add_partial(struct kmem_cache_node *n, struct page *page) | ||
1207 | { | 1202 | { |
1208 | spin_lock(&n->list_lock); | 1203 | spin_lock(&n->list_lock); |
1209 | n->nr_partial++; | 1204 | n->nr_partial++; |
1210 | list_add(&page->lru, &n->partial); | 1205 | if (tail) |
1206 | list_add_tail(&page->lru, &n->partial); | ||
1207 | else | ||
1208 | list_add(&page->lru, &n->partial); | ||
1211 | spin_unlock(&n->list_lock); | 1209 | spin_unlock(&n->list_lock); |
1212 | } | 1210 | } |
1213 | 1211 | ||
@@ -1292,7 +1290,8 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags) | |||
1292 | * expensive if we do it every time we are trying to find a slab | 1290 | * expensive if we do it every time we are trying to find a slab |
1293 | * with available objects. | 1291 | * with available objects. |
1294 | */ | 1292 | */ |
1295 | if (!s->defrag_ratio || get_cycles() % 1024 > s->defrag_ratio) | 1293 | if (!s->remote_node_defrag_ratio || |
1294 | get_cycles() % 1024 > s->remote_node_defrag_ratio) | ||
1296 | return NULL; | 1295 | return NULL; |
1297 | 1296 | ||
1298 | zonelist = &NODE_DATA(slab_node(current->mempolicy)) | 1297 | zonelist = &NODE_DATA(slab_node(current->mempolicy)) |
@@ -1335,7 +1334,7 @@ static struct page *get_partial(struct kmem_cache *s, gfp_t flags, int node) | |||
1335 | * | 1334 | * |
1336 | * On exit the slab lock will have been dropped. | 1335 | * On exit the slab lock will have been dropped. |
1337 | */ | 1336 | */ |
1338 | static void unfreeze_slab(struct kmem_cache *s, struct page *page) | 1337 | static void unfreeze_slab(struct kmem_cache *s, struct page *page, int tail) |
1339 | { | 1338 | { |
1340 | struct kmem_cache_node *n = get_node(s, page_to_nid(page)); | 1339 | struct kmem_cache_node *n = get_node(s, page_to_nid(page)); |
1341 | 1340 | ||
@@ -1343,7 +1342,7 @@ static void unfreeze_slab(struct kmem_cache *s, struct page *page) | |||
1343 | if (page->inuse) { | 1342 | if (page->inuse) { |
1344 | 1343 | ||
1345 | if (page->freelist) | 1344 | if (page->freelist) |
1346 | add_partial(n, page); | 1345 | add_partial(n, page, tail); |
1347 | else if (SlabDebug(page) && (s->flags & SLAB_STORE_USER)) | 1346 | else if (SlabDebug(page) && (s->flags & SLAB_STORE_USER)) |
1348 | add_full(n, page); | 1347 | add_full(n, page); |
1349 | slab_unlock(page); | 1348 | slab_unlock(page); |
@@ -1358,7 +1357,7 @@ static void unfreeze_slab(struct kmem_cache *s, struct page *page) | |||
1358 | * partial list stays small. kmem_cache_shrink can | 1357 | * partial list stays small. kmem_cache_shrink can |
1359 | * reclaim empty slabs from the partial list. | 1358 | * reclaim empty slabs from the partial list. |
1360 | */ | 1359 | */ |
1361 | add_partial_tail(n, page); | 1360 | add_partial(n, page, 1); |
1362 | slab_unlock(page); | 1361 | slab_unlock(page); |
1363 | } else { | 1362 | } else { |
1364 | slab_unlock(page); | 1363 | slab_unlock(page); |
@@ -1373,6 +1372,7 @@ static void unfreeze_slab(struct kmem_cache *s, struct page *page) | |||
1373 | static void deactivate_slab(struct kmem_cache *s, struct kmem_cache_cpu *c) | 1372 | static void deactivate_slab(struct kmem_cache *s, struct kmem_cache_cpu *c) |
1374 | { | 1373 | { |
1375 | struct page *page = c->page; | 1374 | struct page *page = c->page; |
1375 | int tail = 1; | ||
1376 | /* | 1376 | /* |
1377 | * Merge cpu freelist into freelist. Typically we get here | 1377 | * Merge cpu freelist into freelist. Typically we get here |
1378 | * because both freelists are empty. So this is unlikely | 1378 | * because both freelists are empty. So this is unlikely |
@@ -1381,6 +1381,8 @@ static void deactivate_slab(struct kmem_cache *s, struct kmem_cache_cpu *c) | |||
1381 | while (unlikely(c->freelist)) { | 1381 | while (unlikely(c->freelist)) { |
1382 | void **object; | 1382 | void **object; |
1383 | 1383 | ||
1384 | tail = 0; /* Hot objects. Put the slab first */ | ||
1385 | |||
1384 | /* Retrieve object from cpu_freelist */ | 1386 | /* Retrieve object from cpu_freelist */ |
1385 | object = c->freelist; | 1387 | object = c->freelist; |
1386 | c->freelist = c->freelist[c->offset]; | 1388 | c->freelist = c->freelist[c->offset]; |
@@ -1391,7 +1393,7 @@ static void deactivate_slab(struct kmem_cache *s, struct kmem_cache_cpu *c) | |||
1391 | page->inuse--; | 1393 | page->inuse--; |
1392 | } | 1394 | } |
1393 | c->page = NULL; | 1395 | c->page = NULL; |
1394 | unfreeze_slab(s, page); | 1396 | unfreeze_slab(s, page, tail); |
1395 | } | 1397 | } |
1396 | 1398 | ||
1397 | static inline void flush_slab(struct kmem_cache *s, struct kmem_cache_cpu *c) | 1399 | static inline void flush_slab(struct kmem_cache *s, struct kmem_cache_cpu *c) |
@@ -1539,7 +1541,7 @@ debug: | |||
1539 | * | 1541 | * |
1540 | * Otherwise we can simply pick the next object from the lockless free list. | 1542 | * Otherwise we can simply pick the next object from the lockless free list. |
1541 | */ | 1543 | */ |
1542 | static void __always_inline *slab_alloc(struct kmem_cache *s, | 1544 | static __always_inline void *slab_alloc(struct kmem_cache *s, |
1543 | gfp_t gfpflags, int node, void *addr) | 1545 | gfp_t gfpflags, int node, void *addr) |
1544 | { | 1546 | { |
1545 | void **object; | 1547 | void **object; |
@@ -1613,7 +1615,7 @@ checks_ok: | |||
1613 | * then add it. | 1615 | * then add it. |
1614 | */ | 1616 | */ |
1615 | if (unlikely(!prior)) | 1617 | if (unlikely(!prior)) |
1616 | add_partial_tail(get_node(s, page_to_nid(page)), page); | 1618 | add_partial(get_node(s, page_to_nid(page)), page, 1); |
1617 | 1619 | ||
1618 | out_unlock: | 1620 | out_unlock: |
1619 | slab_unlock(page); | 1621 | slab_unlock(page); |
@@ -1647,7 +1649,7 @@ debug: | |||
1647 | * If fastpath is not possible then fall back to __slab_free where we deal | 1649 | * If fastpath is not possible then fall back to __slab_free where we deal |
1648 | * with all sorts of special processing. | 1650 | * with all sorts of special processing. |
1649 | */ | 1651 | */ |
1650 | static void __always_inline slab_free(struct kmem_cache *s, | 1652 | static __always_inline void slab_free(struct kmem_cache *s, |
1651 | struct page *page, void *x, void *addr) | 1653 | struct page *page, void *x, void *addr) |
1652 | { | 1654 | { |
1653 | void **object = (void *)x; | 1655 | void **object = (void *)x; |
@@ -1997,6 +1999,7 @@ static struct kmem_cache_node *early_kmem_cache_node_alloc(gfp_t gfpflags, | |||
1997 | { | 1999 | { |
1998 | struct page *page; | 2000 | struct page *page; |
1999 | struct kmem_cache_node *n; | 2001 | struct kmem_cache_node *n; |
2002 | unsigned long flags; | ||
2000 | 2003 | ||
2001 | BUG_ON(kmalloc_caches->size < sizeof(struct kmem_cache_node)); | 2004 | BUG_ON(kmalloc_caches->size < sizeof(struct kmem_cache_node)); |
2002 | 2005 | ||
@@ -2021,7 +2024,14 @@ static struct kmem_cache_node *early_kmem_cache_node_alloc(gfp_t gfpflags, | |||
2021 | #endif | 2024 | #endif |
2022 | init_kmem_cache_node(n); | 2025 | init_kmem_cache_node(n); |
2023 | atomic_long_inc(&n->nr_slabs); | 2026 | atomic_long_inc(&n->nr_slabs); |
2024 | add_partial(n, page); | 2027 | /* |
2028 | * lockdep requires consistent irq usage for each lock | ||
2029 | * so even though there cannot be a race this early in | ||
2030 | * the boot sequence, we still disable irqs. | ||
2031 | */ | ||
2032 | local_irq_save(flags); | ||
2033 | add_partial(n, page, 0); | ||
2034 | local_irq_restore(flags); | ||
2025 | return n; | 2035 | return n; |
2026 | } | 2036 | } |
2027 | 2037 | ||
@@ -2206,7 +2216,7 @@ static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags, | |||
2206 | 2216 | ||
2207 | s->refcount = 1; | 2217 | s->refcount = 1; |
2208 | #ifdef CONFIG_NUMA | 2218 | #ifdef CONFIG_NUMA |
2209 | s->defrag_ratio = 100; | 2219 | s->remote_node_defrag_ratio = 100; |
2210 | #endif | 2220 | #endif |
2211 | if (!init_kmem_cache_nodes(s, gfpflags & ~SLUB_DMA)) | 2221 | if (!init_kmem_cache_nodes(s, gfpflags & ~SLUB_DMA)) |
2212 | goto error; | 2222 | goto error; |
@@ -2228,7 +2238,7 @@ error: | |||
2228 | */ | 2238 | */ |
2229 | int kmem_ptr_validate(struct kmem_cache *s, const void *object) | 2239 | int kmem_ptr_validate(struct kmem_cache *s, const void *object) |
2230 | { | 2240 | { |
2231 | struct page * page; | 2241 | struct page *page; |
2232 | 2242 | ||
2233 | page = get_object_page(object); | 2243 | page = get_object_page(object); |
2234 | 2244 | ||
@@ -2322,7 +2332,6 @@ void kmem_cache_destroy(struct kmem_cache *s) | |||
2322 | if (kmem_cache_close(s)) | 2332 | if (kmem_cache_close(s)) |
2323 | WARN_ON(1); | 2333 | WARN_ON(1); |
2324 | sysfs_slab_remove(s); | 2334 | sysfs_slab_remove(s); |
2325 | kfree(s); | ||
2326 | } else | 2335 | } else |
2327 | up_write(&slub_lock); | 2336 | up_write(&slub_lock); |
2328 | } | 2337 | } |
@@ -2341,7 +2350,7 @@ static struct kmem_cache *kmalloc_caches_dma[PAGE_SHIFT]; | |||
2341 | 2350 | ||
2342 | static int __init setup_slub_min_order(char *str) | 2351 | static int __init setup_slub_min_order(char *str) |
2343 | { | 2352 | { |
2344 | get_option (&str, &slub_min_order); | 2353 | get_option(&str, &slub_min_order); |
2345 | 2354 | ||
2346 | return 1; | 2355 | return 1; |
2347 | } | 2356 | } |
@@ -2350,7 +2359,7 @@ __setup("slub_min_order=", setup_slub_min_order); | |||
2350 | 2359 | ||
2351 | static int __init setup_slub_max_order(char *str) | 2360 | static int __init setup_slub_max_order(char *str) |
2352 | { | 2361 | { |
2353 | get_option (&str, &slub_max_order); | 2362 | get_option(&str, &slub_max_order); |
2354 | 2363 | ||
2355 | return 1; | 2364 | return 1; |
2356 | } | 2365 | } |
@@ -2359,7 +2368,7 @@ __setup("slub_max_order=", setup_slub_max_order); | |||
2359 | 2368 | ||
2360 | static int __init setup_slub_min_objects(char *str) | 2369 | static int __init setup_slub_min_objects(char *str) |
2361 | { | 2370 | { |
2362 | get_option (&str, &slub_min_objects); | 2371 | get_option(&str, &slub_min_objects); |
2363 | 2372 | ||
2364 | return 1; | 2373 | return 1; |
2365 | } | 2374 | } |
@@ -2605,6 +2614,19 @@ void kfree(const void *x) | |||
2605 | } | 2614 | } |
2606 | EXPORT_SYMBOL(kfree); | 2615 | EXPORT_SYMBOL(kfree); |
2607 | 2616 | ||
2617 | static unsigned long count_partial(struct kmem_cache_node *n) | ||
2618 | { | ||
2619 | unsigned long flags; | ||
2620 | unsigned long x = 0; | ||
2621 | struct page *page; | ||
2622 | |||
2623 | spin_lock_irqsave(&n->list_lock, flags); | ||
2624 | list_for_each_entry(page, &n->partial, lru) | ||
2625 | x += page->inuse; | ||
2626 | spin_unlock_irqrestore(&n->list_lock, flags); | ||
2627 | return x; | ||
2628 | } | ||
2629 | |||
2608 | /* | 2630 | /* |
2609 | * kmem_cache_shrink removes empty slabs from the partial lists and sorts | 2631 | * kmem_cache_shrink removes empty slabs from the partial lists and sorts |
2610 | * the remaining slabs by the number of items in use. The slabs with the | 2632 | * the remaining slabs by the number of items in use. The slabs with the |
@@ -2931,7 +2953,7 @@ static struct kmem_cache *find_mergeable(size_t size, | |||
2931 | * Check if alignment is compatible. | 2953 | * Check if alignment is compatible. |
2932 | * Courtesy of Adrian Drzewiecki | 2954 | * Courtesy of Adrian Drzewiecki |
2933 | */ | 2955 | */ |
2934 | if ((s->size & ~(align -1)) != s->size) | 2956 | if ((s->size & ~(align - 1)) != s->size) |
2935 | continue; | 2957 | continue; |
2936 | 2958 | ||
2937 | if (s->size - size >= sizeof(void *)) | 2959 | if (s->size - size >= sizeof(void *)) |
@@ -3040,8 +3062,9 @@ static int __cpuinit slab_cpuup_callback(struct notifier_block *nfb, | |||
3040 | return NOTIFY_OK; | 3062 | return NOTIFY_OK; |
3041 | } | 3063 | } |
3042 | 3064 | ||
3043 | static struct notifier_block __cpuinitdata slab_notifier = | 3065 | static struct notifier_block __cpuinitdata slab_notifier = { |
3044 | { &slab_cpuup_callback, NULL, 0 }; | 3066 | &slab_cpuup_callback, NULL, 0 |
3067 | }; | ||
3045 | 3068 | ||
3046 | #endif | 3069 | #endif |
3047 | 3070 | ||
@@ -3076,19 +3099,6 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags, | |||
3076 | return slab_alloc(s, gfpflags, node, caller); | 3099 | return slab_alloc(s, gfpflags, node, caller); |
3077 | } | 3100 | } |
3078 | 3101 | ||
3079 | static unsigned long count_partial(struct kmem_cache_node *n) | ||
3080 | { | ||
3081 | unsigned long flags; | ||
3082 | unsigned long x = 0; | ||
3083 | struct page *page; | ||
3084 | |||
3085 | spin_lock_irqsave(&n->list_lock, flags); | ||
3086 | list_for_each_entry(page, &n->partial, lru) | ||
3087 | x += page->inuse; | ||
3088 | spin_unlock_irqrestore(&n->list_lock, flags); | ||
3089 | return x; | ||
3090 | } | ||
3091 | |||
3092 | #if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG) | 3102 | #if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG) |
3093 | static int validate_slab(struct kmem_cache *s, struct page *page, | 3103 | static int validate_slab(struct kmem_cache *s, struct page *page, |
3094 | unsigned long *map) | 3104 | unsigned long *map) |
@@ -3390,7 +3400,7 @@ static void process_slab(struct loc_track *t, struct kmem_cache *s, | |||
3390 | static int list_locations(struct kmem_cache *s, char *buf, | 3400 | static int list_locations(struct kmem_cache *s, char *buf, |
3391 | enum track_item alloc) | 3401 | enum track_item alloc) |
3392 | { | 3402 | { |
3393 | int n = 0; | 3403 | int len = 0; |
3394 | unsigned long i; | 3404 | unsigned long i; |
3395 | struct loc_track t = { 0, 0, NULL }; | 3405 | struct loc_track t = { 0, 0, NULL }; |
3396 | int node; | 3406 | int node; |
@@ -3421,54 +3431,54 @@ static int list_locations(struct kmem_cache *s, char *buf, | |||
3421 | for (i = 0; i < t.count; i++) { | 3431 | for (i = 0; i < t.count; i++) { |
3422 | struct location *l = &t.loc[i]; | 3432 | struct location *l = &t.loc[i]; |
3423 | 3433 | ||
3424 | if (n > PAGE_SIZE - 100) | 3434 | if (len > PAGE_SIZE - 100) |
3425 | break; | 3435 | break; |
3426 | n += sprintf(buf + n, "%7ld ", l->count); | 3436 | len += sprintf(buf + len, "%7ld ", l->count); |
3427 | 3437 | ||
3428 | if (l->addr) | 3438 | if (l->addr) |
3429 | n += sprint_symbol(buf + n, (unsigned long)l->addr); | 3439 | len += sprint_symbol(buf + len, (unsigned long)l->addr); |
3430 | else | 3440 | else |
3431 | n += sprintf(buf + n, "<not-available>"); | 3441 | len += sprintf(buf + len, "<not-available>"); |
3432 | 3442 | ||
3433 | if (l->sum_time != l->min_time) { | 3443 | if (l->sum_time != l->min_time) { |
3434 | unsigned long remainder; | 3444 | unsigned long remainder; |
3435 | 3445 | ||
3436 | n += sprintf(buf + n, " age=%ld/%ld/%ld", | 3446 | len += sprintf(buf + len, " age=%ld/%ld/%ld", |
3437 | l->min_time, | 3447 | l->min_time, |
3438 | div_long_long_rem(l->sum_time, l->count, &remainder), | 3448 | div_long_long_rem(l->sum_time, l->count, &remainder), |
3439 | l->max_time); | 3449 | l->max_time); |
3440 | } else | 3450 | } else |
3441 | n += sprintf(buf + n, " age=%ld", | 3451 | len += sprintf(buf + len, " age=%ld", |
3442 | l->min_time); | 3452 | l->min_time); |
3443 | 3453 | ||
3444 | if (l->min_pid != l->max_pid) | 3454 | if (l->min_pid != l->max_pid) |
3445 | n += sprintf(buf + n, " pid=%ld-%ld", | 3455 | len += sprintf(buf + len, " pid=%ld-%ld", |
3446 | l->min_pid, l->max_pid); | 3456 | l->min_pid, l->max_pid); |
3447 | else | 3457 | else |
3448 | n += sprintf(buf + n, " pid=%ld", | 3458 | len += sprintf(buf + len, " pid=%ld", |
3449 | l->min_pid); | 3459 | l->min_pid); |
3450 | 3460 | ||
3451 | if (num_online_cpus() > 1 && !cpus_empty(l->cpus) && | 3461 | if (num_online_cpus() > 1 && !cpus_empty(l->cpus) && |
3452 | n < PAGE_SIZE - 60) { | 3462 | len < PAGE_SIZE - 60) { |
3453 | n += sprintf(buf + n, " cpus="); | 3463 | len += sprintf(buf + len, " cpus="); |
3454 | n += cpulist_scnprintf(buf + n, PAGE_SIZE - n - 50, | 3464 | len += cpulist_scnprintf(buf + len, PAGE_SIZE - len - 50, |
3455 | l->cpus); | 3465 | l->cpus); |
3456 | } | 3466 | } |
3457 | 3467 | ||
3458 | if (num_online_nodes() > 1 && !nodes_empty(l->nodes) && | 3468 | if (num_online_nodes() > 1 && !nodes_empty(l->nodes) && |
3459 | n < PAGE_SIZE - 60) { | 3469 | len < PAGE_SIZE - 60) { |
3460 | n += sprintf(buf + n, " nodes="); | 3470 | len += sprintf(buf + len, " nodes="); |
3461 | n += nodelist_scnprintf(buf + n, PAGE_SIZE - n - 50, | 3471 | len += nodelist_scnprintf(buf + len, PAGE_SIZE - len - 50, |
3462 | l->nodes); | 3472 | l->nodes); |
3463 | } | 3473 | } |
3464 | 3474 | ||
3465 | n += sprintf(buf + n, "\n"); | 3475 | len += sprintf(buf + len, "\n"); |
3466 | } | 3476 | } |
3467 | 3477 | ||
3468 | free_loc_track(&t); | 3478 | free_loc_track(&t); |
3469 | if (!t.count) | 3479 | if (!t.count) |
3470 | n += sprintf(buf, "No data\n"); | 3480 | len += sprintf(buf, "No data\n"); |
3471 | return n; | 3481 | return len; |
3472 | } | 3482 | } |
3473 | 3483 | ||
3474 | enum slab_stat_type { | 3484 | enum slab_stat_type { |
@@ -3498,7 +3508,6 @@ static unsigned long slab_objects(struct kmem_cache *s, | |||
3498 | 3508 | ||
3499 | for_each_possible_cpu(cpu) { | 3509 | for_each_possible_cpu(cpu) { |
3500 | struct page *page; | 3510 | struct page *page; |
3501 | int node; | ||
3502 | struct kmem_cache_cpu *c = get_cpu_slab(s, cpu); | 3511 | struct kmem_cache_cpu *c = get_cpu_slab(s, cpu); |
3503 | 3512 | ||
3504 | if (!c) | 3513 | if (!c) |
@@ -3510,8 +3519,6 @@ static unsigned long slab_objects(struct kmem_cache *s, | |||
3510 | continue; | 3519 | continue; |
3511 | if (page) { | 3520 | if (page) { |
3512 | if (flags & SO_CPU) { | 3521 | if (flags & SO_CPU) { |
3513 | int x = 0; | ||
3514 | |||
3515 | if (flags & SO_OBJECTS) | 3522 | if (flags & SO_OBJECTS) |
3516 | x = page->inuse; | 3523 | x = page->inuse; |
3517 | else | 3524 | else |
@@ -3848,24 +3855,24 @@ static ssize_t free_calls_show(struct kmem_cache *s, char *buf) | |||
3848 | SLAB_ATTR_RO(free_calls); | 3855 | SLAB_ATTR_RO(free_calls); |
3849 | 3856 | ||
3850 | #ifdef CONFIG_NUMA | 3857 | #ifdef CONFIG_NUMA |
3851 | static ssize_t defrag_ratio_show(struct kmem_cache *s, char *buf) | 3858 | static ssize_t remote_node_defrag_ratio_show(struct kmem_cache *s, char *buf) |
3852 | { | 3859 | { |
3853 | return sprintf(buf, "%d\n", s->defrag_ratio / 10); | 3860 | return sprintf(buf, "%d\n", s->remote_node_defrag_ratio / 10); |
3854 | } | 3861 | } |
3855 | 3862 | ||
3856 | static ssize_t defrag_ratio_store(struct kmem_cache *s, | 3863 | static ssize_t remote_node_defrag_ratio_store(struct kmem_cache *s, |
3857 | const char *buf, size_t length) | 3864 | const char *buf, size_t length) |
3858 | { | 3865 | { |
3859 | int n = simple_strtoul(buf, NULL, 10); | 3866 | int n = simple_strtoul(buf, NULL, 10); |
3860 | 3867 | ||
3861 | if (n < 100) | 3868 | if (n < 100) |
3862 | s->defrag_ratio = n * 10; | 3869 | s->remote_node_defrag_ratio = n * 10; |
3863 | return length; | 3870 | return length; |
3864 | } | 3871 | } |
3865 | SLAB_ATTR(defrag_ratio); | 3872 | SLAB_ATTR(remote_node_defrag_ratio); |
3866 | #endif | 3873 | #endif |
3867 | 3874 | ||
3868 | static struct attribute * slab_attrs[] = { | 3875 | static struct attribute *slab_attrs[] = { |
3869 | &slab_size_attr.attr, | 3876 | &slab_size_attr.attr, |
3870 | &object_size_attr.attr, | 3877 | &object_size_attr.attr, |
3871 | &objs_per_slab_attr.attr, | 3878 | &objs_per_slab_attr.attr, |
@@ -3893,7 +3900,7 @@ static struct attribute * slab_attrs[] = { | |||
3893 | &cache_dma_attr.attr, | 3900 | &cache_dma_attr.attr, |
3894 | #endif | 3901 | #endif |
3895 | #ifdef CONFIG_NUMA | 3902 | #ifdef CONFIG_NUMA |
3896 | &defrag_ratio_attr.attr, | 3903 | &remote_node_defrag_ratio_attr.attr, |
3897 | #endif | 3904 | #endif |
3898 | NULL | 3905 | NULL |
3899 | }; | 3906 | }; |
@@ -3940,6 +3947,13 @@ static ssize_t slab_attr_store(struct kobject *kobj, | |||
3940 | return err; | 3947 | return err; |
3941 | } | 3948 | } |
3942 | 3949 | ||
3950 | static void kmem_cache_release(struct kobject *kobj) | ||
3951 | { | ||
3952 | struct kmem_cache *s = to_slab(kobj); | ||
3953 | |||
3954 | kfree(s); | ||
3955 | } | ||
3956 | |||
3943 | static struct sysfs_ops slab_sysfs_ops = { | 3957 | static struct sysfs_ops slab_sysfs_ops = { |
3944 | .show = slab_attr_show, | 3958 | .show = slab_attr_show, |
3945 | .store = slab_attr_store, | 3959 | .store = slab_attr_store, |
@@ -3947,6 +3961,7 @@ static struct sysfs_ops slab_sysfs_ops = { | |||
3947 | 3961 | ||
3948 | static struct kobj_type slab_ktype = { | 3962 | static struct kobj_type slab_ktype = { |
3949 | .sysfs_ops = &slab_sysfs_ops, | 3963 | .sysfs_ops = &slab_sysfs_ops, |
3964 | .release = kmem_cache_release | ||
3950 | }; | 3965 | }; |
3951 | 3966 | ||
3952 | static int uevent_filter(struct kset *kset, struct kobject *kobj) | 3967 | static int uevent_filter(struct kset *kset, struct kobject *kobj) |
@@ -4048,6 +4063,7 @@ static void sysfs_slab_remove(struct kmem_cache *s) | |||
4048 | { | 4063 | { |
4049 | kobject_uevent(&s->kobj, KOBJ_REMOVE); | 4064 | kobject_uevent(&s->kobj, KOBJ_REMOVE); |
4050 | kobject_del(&s->kobj); | 4065 | kobject_del(&s->kobj); |
4066 | kobject_put(&s->kobj); | ||
4051 | } | 4067 | } |
4052 | 4068 | ||
4053 | /* | 4069 | /* |
diff --git a/mm/truncate.c b/mm/truncate.c index cadc15653dde..c3123b08ff6d 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | 22 | ||
23 | /** | 23 | /** |
24 | * do_invalidatepage - invalidate part of all of a page | 24 | * do_invalidatepage - invalidate part or all of a page |
25 | * @page: the page which is affected | 25 | * @page: the page which is affected |
26 | * @offset: the index of the truncation point | 26 | * @offset: the index of the truncation point |
27 | * | 27 | * |
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 40b71a29fc3f..42eea5fe2628 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -199,14 +199,12 @@ static void p9_virtio_close(struct p9_trans *trans) | |||
199 | kfree(trans); | 199 | kfree(trans); |
200 | } | 200 | } |
201 | 201 | ||
202 | static bool p9_virtio_intr(struct virtqueue *q) | 202 | static void p9_virtio_intr(struct virtqueue *q) |
203 | { | 203 | { |
204 | struct virtio_chan *chan = q->vdev->priv; | 204 | struct virtio_chan *chan = q->vdev->priv; |
205 | 205 | ||
206 | P9_DPRINTK(P9_DEBUG_TRANS, "9p poll_wakeup: %p\n", &chan->wq); | 206 | P9_DPRINTK(P9_DEBUG_TRANS, "9p poll_wakeup: %p\n", &chan->wq); |
207 | wake_up_interruptible(&chan->wq); | 207 | wake_up_interruptible(&chan->wq); |
208 | |||
209 | return true; | ||
210 | } | 208 | } |
211 | 209 | ||
212 | static int p9_virtio_probe(struct virtio_device *dev) | 210 | static int p9_virtio_probe(struct virtio_device *dev) |
@@ -236,13 +234,13 @@ static int p9_virtio_probe(struct virtio_device *dev) | |||
236 | 234 | ||
237 | /* Find the input queue. */ | 235 | /* Find the input queue. */ |
238 | dev->priv = chan; | 236 | dev->priv = chan; |
239 | chan->in_vq = dev->config->find_vq(dev, p9_virtio_intr); | 237 | chan->in_vq = dev->config->find_vq(dev, 0, p9_virtio_intr); |
240 | if (IS_ERR(chan->in_vq)) { | 238 | if (IS_ERR(chan->in_vq)) { |
241 | err = PTR_ERR(chan->in_vq); | 239 | err = PTR_ERR(chan->in_vq); |
242 | goto free; | 240 | goto free; |
243 | } | 241 | } |
244 | 242 | ||
245 | chan->out_vq = dev->config->find_vq(dev, NULL); | 243 | chan->out_vq = dev->config->find_vq(dev, 1, NULL); |
246 | if (IS_ERR(chan->out_vq)) { | 244 | if (IS_ERR(chan->out_vq)) { |
247 | err = PTR_ERR(chan->out_vq); | 245 | err = PTR_ERR(chan->out_vq); |
248 | goto free_in_vq; | 246 | goto free_in_vq; |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 26e941d912e8..7b660834a4c2 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -287,7 +287,7 @@ EXPORT_SYMBOL_GPL(register_pernet_subsys); | |||
287 | * @ops: pernet operations structure to manipulate | 287 | * @ops: pernet operations structure to manipulate |
288 | * | 288 | * |
289 | * Remove the pernet operations structure from the list to be | 289 | * Remove the pernet operations structure from the list to be |
290 | * used when network namespaces are created or destoryed. In | 290 | * used when network namespaces are created or destroyed. In |
291 | * addition run the exit method for all existing network | 291 | * addition run the exit method for all existing network |
292 | * namespaces. | 292 | * namespaces. |
293 | */ | 293 | */ |
@@ -335,7 +335,7 @@ EXPORT_SYMBOL_GPL(register_pernet_device); | |||
335 | * @ops: pernet operations structure to manipulate | 335 | * @ops: pernet operations structure to manipulate |
336 | * | 336 | * |
337 | * Remove the pernet operations structure from the list to be | 337 | * Remove the pernet operations structure from the list to be |
338 | * used when network namespaces are created or destoryed. In | 338 | * used when network namespaces are created or destroyed. In |
339 | * addition run the exit method for all existing network | 339 | * addition run the exit method for all existing network |
340 | * namespaces. | 340 | * namespaces. |
341 | */ | 341 | */ |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 98420f9c4b6d..4e354221ec23 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2461,6 +2461,34 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer) | |||
2461 | return elt; | 2461 | return elt; |
2462 | } | 2462 | } |
2463 | 2463 | ||
2464 | /** | ||
2465 | * skb_partial_csum_set - set up and verify partial csum values for packet | ||
2466 | * @skb: the skb to set | ||
2467 | * @start: the number of bytes after skb->data to start checksumming. | ||
2468 | * @off: the offset from start to place the checksum. | ||
2469 | * | ||
2470 | * For untrusted partially-checksummed packets, we need to make sure the values | ||
2471 | * for skb->csum_start and skb->csum_offset are valid so we don't oops. | ||
2472 | * | ||
2473 | * This function checks and sets those values and skb->ip_summed: if this | ||
2474 | * returns false you should drop the packet. | ||
2475 | */ | ||
2476 | bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off) | ||
2477 | { | ||
2478 | if (unlikely(start > skb->len - 2) || | ||
2479 | unlikely((int)start + off > skb->len - 2)) { | ||
2480 | if (net_ratelimit()) | ||
2481 | printk(KERN_WARNING | ||
2482 | "bad partial csum: csum=%u/%u len=%u\n", | ||
2483 | start, off, skb->len); | ||
2484 | return false; | ||
2485 | } | ||
2486 | skb->ip_summed = CHECKSUM_PARTIAL; | ||
2487 | skb->csum_start = skb_headroom(skb) + start; | ||
2488 | skb->csum_offset = off; | ||
2489 | return true; | ||
2490 | } | ||
2491 | |||
2464 | EXPORT_SYMBOL(___pskb_trim); | 2492 | EXPORT_SYMBOL(___pskb_trim); |
2465 | EXPORT_SYMBOL(__kfree_skb); | 2493 | EXPORT_SYMBOL(__kfree_skb); |
2466 | EXPORT_SYMBOL(kfree_skb); | 2494 | EXPORT_SYMBOL(kfree_skb); |
@@ -2497,3 +2525,4 @@ EXPORT_SYMBOL(skb_append_datato_frags); | |||
2497 | 2525 | ||
2498 | EXPORT_SYMBOL_GPL(skb_to_sgvec); | 2526 | EXPORT_SYMBOL_GPL(skb_to_sgvec); |
2499 | EXPORT_SYMBOL_GPL(skb_cow_data); | 2527 | EXPORT_SYMBOL_GPL(skb_cow_data); |
2528 | EXPORT_SYMBOL_GPL(skb_partial_csum_set); | ||
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index ebe59d98721a..287a62bc2e0f 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -271,8 +271,6 @@ extern struct sk_buff *dccp_make_response(struct sock *sk, | |||
271 | 271 | ||
272 | extern int dccp_connect(struct sock *sk); | 272 | extern int dccp_connect(struct sock *sk); |
273 | extern int dccp_disconnect(struct sock *sk, int flags); | 273 | extern int dccp_disconnect(struct sock *sk, int flags); |
274 | extern void dccp_hash(struct sock *sk); | ||
275 | extern void dccp_unhash(struct sock *sk); | ||
276 | extern int dccp_getsockopt(struct sock *sk, int level, int optname, | 274 | extern int dccp_getsockopt(struct sock *sk, int level, int optname, |
277 | char __user *optval, int __user *optlen); | 275 | char __user *optval, int __user *optlen); |
278 | extern int dccp_setsockopt(struct sock *sk, int level, int optname, | 276 | extern int dccp_setsockopt(struct sock *sk, int level, int optname, |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index c982ad88223d..474075adbde4 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -38,12 +38,6 @@ | |||
38 | */ | 38 | */ |
39 | static struct socket *dccp_v4_ctl_socket; | 39 | static struct socket *dccp_v4_ctl_socket; |
40 | 40 | ||
41 | static int dccp_v4_get_port(struct sock *sk, const unsigned short snum) | ||
42 | { | ||
43 | return inet_csk_get_port(&dccp_hashinfo, sk, snum, | ||
44 | inet_csk_bind_conflict); | ||
45 | } | ||
46 | |||
47 | int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | 41 | int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) |
48 | { | 42 | { |
49 | struct inet_sock *inet = inet_sk(sk); | 43 | struct inet_sock *inet = inet_sk(sk); |
@@ -408,8 +402,8 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
408 | 402 | ||
409 | dccp_sync_mss(newsk, dst_mtu(dst)); | 403 | dccp_sync_mss(newsk, dst_mtu(dst)); |
410 | 404 | ||
411 | __inet_hash_nolisten(&dccp_hashinfo, newsk); | 405 | __inet_hash_nolisten(newsk); |
412 | __inet_inherit_port(&dccp_hashinfo, sk, newsk); | 406 | __inet_inherit_port(sk, newsk); |
413 | 407 | ||
414 | return newsk; | 408 | return newsk; |
415 | 409 | ||
@@ -898,6 +892,7 @@ static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { | |||
898 | .getsockopt = ip_getsockopt, | 892 | .getsockopt = ip_getsockopt, |
899 | .addr2sockaddr = inet_csk_addr2sockaddr, | 893 | .addr2sockaddr = inet_csk_addr2sockaddr, |
900 | .sockaddr_len = sizeof(struct sockaddr_in), | 894 | .sockaddr_len = sizeof(struct sockaddr_in), |
895 | .bind_conflict = inet_csk_bind_conflict, | ||
901 | #ifdef CONFIG_COMPAT | 896 | #ifdef CONFIG_COMPAT |
902 | .compat_setsockopt = compat_ip_setsockopt, | 897 | .compat_setsockopt = compat_ip_setsockopt, |
903 | .compat_getsockopt = compat_ip_getsockopt, | 898 | .compat_getsockopt = compat_ip_getsockopt, |
@@ -937,10 +932,10 @@ static struct proto dccp_v4_prot = { | |||
937 | .sendmsg = dccp_sendmsg, | 932 | .sendmsg = dccp_sendmsg, |
938 | .recvmsg = dccp_recvmsg, | 933 | .recvmsg = dccp_recvmsg, |
939 | .backlog_rcv = dccp_v4_do_rcv, | 934 | .backlog_rcv = dccp_v4_do_rcv, |
940 | .hash = dccp_hash, | 935 | .hash = inet_hash, |
941 | .unhash = dccp_unhash, | 936 | .unhash = inet_unhash, |
942 | .accept = inet_csk_accept, | 937 | .accept = inet_csk_accept, |
943 | .get_port = dccp_v4_get_port, | 938 | .get_port = inet_csk_get_port, |
944 | .shutdown = dccp_shutdown, | 939 | .shutdown = dccp_shutdown, |
945 | .destroy = dccp_destroy_sock, | 940 | .destroy = dccp_destroy_sock, |
946 | .orphan_count = &dccp_orphan_count, | 941 | .orphan_count = &dccp_orphan_count, |
@@ -948,6 +943,7 @@ static struct proto dccp_v4_prot = { | |||
948 | .obj_size = sizeof(struct dccp_sock), | 943 | .obj_size = sizeof(struct dccp_sock), |
949 | .rsk_prot = &dccp_request_sock_ops, | 944 | .rsk_prot = &dccp_request_sock_ops, |
950 | .twsk_prot = &dccp_timewait_sock_ops, | 945 | .twsk_prot = &dccp_timewait_sock_ops, |
946 | .hashinfo = &dccp_hashinfo, | ||
951 | #ifdef CONFIG_COMPAT | 947 | #ifdef CONFIG_COMPAT |
952 | .compat_setsockopt = compat_dccp_setsockopt, | 948 | .compat_setsockopt = compat_dccp_setsockopt, |
953 | .compat_getsockopt = compat_dccp_getsockopt, | 949 | .compat_getsockopt = compat_dccp_getsockopt, |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index ed0a0053a797..490333d47c7b 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -39,21 +39,15 @@ static struct socket *dccp_v6_ctl_socket; | |||
39 | static struct inet_connection_sock_af_ops dccp_ipv6_mapped; | 39 | static struct inet_connection_sock_af_ops dccp_ipv6_mapped; |
40 | static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; | 40 | static struct inet_connection_sock_af_ops dccp_ipv6_af_ops; |
41 | 41 | ||
42 | static int dccp_v6_get_port(struct sock *sk, unsigned short snum) | ||
43 | { | ||
44 | return inet_csk_get_port(&dccp_hashinfo, sk, snum, | ||
45 | inet6_csk_bind_conflict); | ||
46 | } | ||
47 | |||
48 | static void dccp_v6_hash(struct sock *sk) | 42 | static void dccp_v6_hash(struct sock *sk) |
49 | { | 43 | { |
50 | if (sk->sk_state != DCCP_CLOSED) { | 44 | if (sk->sk_state != DCCP_CLOSED) { |
51 | if (inet_csk(sk)->icsk_af_ops == &dccp_ipv6_mapped) { | 45 | if (inet_csk(sk)->icsk_af_ops == &dccp_ipv6_mapped) { |
52 | dccp_hash(sk); | 46 | inet_hash(sk); |
53 | return; | 47 | return; |
54 | } | 48 | } |
55 | local_bh_disable(); | 49 | local_bh_disable(); |
56 | __inet6_hash(&dccp_hashinfo, sk); | 50 | __inet6_hash(sk); |
57 | local_bh_enable(); | 51 | local_bh_enable(); |
58 | } | 52 | } |
59 | } | 53 | } |
@@ -630,8 +624,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
630 | 624 | ||
631 | newinet->daddr = newinet->saddr = newinet->rcv_saddr = LOOPBACK4_IPV6; | 625 | newinet->daddr = newinet->saddr = newinet->rcv_saddr = LOOPBACK4_IPV6; |
632 | 626 | ||
633 | __inet6_hash(&dccp_hashinfo, newsk); | 627 | __inet6_hash(newsk); |
634 | inet_inherit_port(&dccp_hashinfo, sk, newsk); | 628 | inet_inherit_port(sk, newsk); |
635 | 629 | ||
636 | return newsk; | 630 | return newsk; |
637 | 631 | ||
@@ -1054,6 +1048,7 @@ static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = { | |||
1054 | .getsockopt = ipv6_getsockopt, | 1048 | .getsockopt = ipv6_getsockopt, |
1055 | .addr2sockaddr = inet6_csk_addr2sockaddr, | 1049 | .addr2sockaddr = inet6_csk_addr2sockaddr, |
1056 | .sockaddr_len = sizeof(struct sockaddr_in6), | 1050 | .sockaddr_len = sizeof(struct sockaddr_in6), |
1051 | .bind_conflict = inet6_csk_bind_conflict, | ||
1057 | #ifdef CONFIG_COMPAT | 1052 | #ifdef CONFIG_COMPAT |
1058 | .compat_setsockopt = compat_ipv6_setsockopt, | 1053 | .compat_setsockopt = compat_ipv6_setsockopt, |
1059 | .compat_getsockopt = compat_ipv6_getsockopt, | 1054 | .compat_getsockopt = compat_ipv6_getsockopt, |
@@ -1123,9 +1118,9 @@ static struct proto dccp_v6_prot = { | |||
1123 | .recvmsg = dccp_recvmsg, | 1118 | .recvmsg = dccp_recvmsg, |
1124 | .backlog_rcv = dccp_v6_do_rcv, | 1119 | .backlog_rcv = dccp_v6_do_rcv, |
1125 | .hash = dccp_v6_hash, | 1120 | .hash = dccp_v6_hash, |
1126 | .unhash = dccp_unhash, | 1121 | .unhash = inet_unhash, |
1127 | .accept = inet_csk_accept, | 1122 | .accept = inet_csk_accept, |
1128 | .get_port = dccp_v6_get_port, | 1123 | .get_port = inet_csk_get_port, |
1129 | .shutdown = dccp_shutdown, | 1124 | .shutdown = dccp_shutdown, |
1130 | .destroy = dccp_v6_destroy_sock, | 1125 | .destroy = dccp_v6_destroy_sock, |
1131 | .orphan_count = &dccp_orphan_count, | 1126 | .orphan_count = &dccp_orphan_count, |
@@ -1133,6 +1128,7 @@ static struct proto dccp_v6_prot = { | |||
1133 | .obj_size = sizeof(struct dccp6_sock), | 1128 | .obj_size = sizeof(struct dccp6_sock), |
1134 | .rsk_prot = &dccp6_request_sock_ops, | 1129 | .rsk_prot = &dccp6_request_sock_ops, |
1135 | .twsk_prot = &dccp6_timewait_sock_ops, | 1130 | .twsk_prot = &dccp6_timewait_sock_ops, |
1131 | .hashinfo = &dccp_hashinfo, | ||
1136 | #ifdef CONFIG_COMPAT | 1132 | #ifdef CONFIG_COMPAT |
1137 | .compat_setsockopt = compat_dccp_setsockopt, | 1133 | .compat_setsockopt = compat_dccp_setsockopt, |
1138 | .compat_getsockopt = compat_dccp_getsockopt, | 1134 | .compat_getsockopt = compat_dccp_getsockopt, |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 0bed4a6095b7..e3f5d37b84be 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -78,7 +78,7 @@ void dccp_set_state(struct sock *sk, const int state) | |||
78 | sk->sk_prot->unhash(sk); | 78 | sk->sk_prot->unhash(sk); |
79 | if (inet_csk(sk)->icsk_bind_hash != NULL && | 79 | if (inet_csk(sk)->icsk_bind_hash != NULL && |
80 | !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) | 80 | !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) |
81 | inet_put_port(&dccp_hashinfo, sk); | 81 | inet_put_port(sk); |
82 | /* fall through */ | 82 | /* fall through */ |
83 | default: | 83 | default: |
84 | if (oldstate == DCCP_OPEN) | 84 | if (oldstate == DCCP_OPEN) |
@@ -173,20 +173,6 @@ const char *dccp_state_name(const int state) | |||
173 | 173 | ||
174 | EXPORT_SYMBOL_GPL(dccp_state_name); | 174 | EXPORT_SYMBOL_GPL(dccp_state_name); |
175 | 175 | ||
176 | void dccp_hash(struct sock *sk) | ||
177 | { | ||
178 | inet_hash(&dccp_hashinfo, sk); | ||
179 | } | ||
180 | |||
181 | EXPORT_SYMBOL_GPL(dccp_hash); | ||
182 | |||
183 | void dccp_unhash(struct sock *sk) | ||
184 | { | ||
185 | inet_unhash(&dccp_hashinfo, sk); | ||
186 | } | ||
187 | |||
188 | EXPORT_SYMBOL_GPL(dccp_unhash); | ||
189 | |||
190 | int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized) | 176 | int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized) |
191 | { | 177 | { |
192 | struct dccp_sock *dp = dccp_sk(sk); | 178 | struct dccp_sock *dp = dccp_sk(sk); |
@@ -268,7 +254,7 @@ int dccp_destroy_sock(struct sock *sk) | |||
268 | 254 | ||
269 | /* Clean up a referenced DCCP bind bucket. */ | 255 | /* Clean up a referenced DCCP bind bucket. */ |
270 | if (inet_csk(sk)->icsk_bind_hash != NULL) | 256 | if (inet_csk(sk)->icsk_bind_hash != NULL) |
271 | inet_put_port(&dccp_hashinfo, sk); | 257 | inet_put_port(sk); |
272 | 258 | ||
273 | kfree(dp->dccps_service_list); | 259 | kfree(dp->dccps_service_list); |
274 | dp->dccps_service_list = NULL; | 260 | dp->dccps_service_list = NULL; |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index de5a41de191a..b189278c7bc1 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -78,11 +78,9 @@ EXPORT_SYMBOL_GPL(inet_csk_bind_conflict); | |||
78 | /* Obtain a reference to a local port for the given sock, | 78 | /* Obtain a reference to a local port for the given sock, |
79 | * if snum is zero it means select any available local port. | 79 | * if snum is zero it means select any available local port. |
80 | */ | 80 | */ |
81 | int inet_csk_get_port(struct inet_hashinfo *hashinfo, | 81 | int inet_csk_get_port(struct sock *sk, unsigned short snum) |
82 | struct sock *sk, unsigned short snum, | ||
83 | int (*bind_conflict)(const struct sock *sk, | ||
84 | const struct inet_bind_bucket *tb)) | ||
85 | { | 82 | { |
83 | struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo; | ||
86 | struct inet_bind_hashbucket *head; | 84 | struct inet_bind_hashbucket *head; |
87 | struct hlist_node *node; | 85 | struct hlist_node *node; |
88 | struct inet_bind_bucket *tb; | 86 | struct inet_bind_bucket *tb; |
@@ -142,7 +140,7 @@ tb_found: | |||
142 | goto success; | 140 | goto success; |
143 | } else { | 141 | } else { |
144 | ret = 1; | 142 | ret = 1; |
145 | if (bind_conflict(sk, tb)) | 143 | if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) |
146 | goto fail_unlock; | 144 | goto fail_unlock; |
147 | } | 145 | } |
148 | } | 146 | } |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 48d45008f749..90f422c9447b 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -66,8 +66,9 @@ void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, | |||
66 | /* | 66 | /* |
67 | * Get rid of any references to a local port held by the given sock. | 67 | * Get rid of any references to a local port held by the given sock. |
68 | */ | 68 | */ |
69 | static void __inet_put_port(struct inet_hashinfo *hashinfo, struct sock *sk) | 69 | static void __inet_put_port(struct sock *sk) |
70 | { | 70 | { |
71 | struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo; | ||
71 | const int bhash = inet_bhashfn(inet_sk(sk)->num, hashinfo->bhash_size); | 72 | const int bhash = inet_bhashfn(inet_sk(sk)->num, hashinfo->bhash_size); |
72 | struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash]; | 73 | struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash]; |
73 | struct inet_bind_bucket *tb; | 74 | struct inet_bind_bucket *tb; |
@@ -81,10 +82,10 @@ static void __inet_put_port(struct inet_hashinfo *hashinfo, struct sock *sk) | |||
81 | spin_unlock(&head->lock); | 82 | spin_unlock(&head->lock); |
82 | } | 83 | } |
83 | 84 | ||
84 | void inet_put_port(struct inet_hashinfo *hashinfo, struct sock *sk) | 85 | void inet_put_port(struct sock *sk) |
85 | { | 86 | { |
86 | local_bh_disable(); | 87 | local_bh_disable(); |
87 | __inet_put_port(hashinfo, sk); | 88 | __inet_put_port(sk); |
88 | local_bh_enable(); | 89 | local_bh_enable(); |
89 | } | 90 | } |
90 | 91 | ||
@@ -317,8 +318,9 @@ static inline u32 inet_sk_port_offset(const struct sock *sk) | |||
317 | inet->dport); | 318 | inet->dport); |
318 | } | 319 | } |
319 | 320 | ||
320 | void __inet_hash_nolisten(struct inet_hashinfo *hashinfo, struct sock *sk) | 321 | void __inet_hash_nolisten(struct sock *sk) |
321 | { | 322 | { |
323 | struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo; | ||
322 | struct hlist_head *list; | 324 | struct hlist_head *list; |
323 | rwlock_t *lock; | 325 | rwlock_t *lock; |
324 | struct inet_ehash_bucket *head; | 326 | struct inet_ehash_bucket *head; |
@@ -337,13 +339,14 @@ void __inet_hash_nolisten(struct inet_hashinfo *hashinfo, struct sock *sk) | |||
337 | } | 339 | } |
338 | EXPORT_SYMBOL_GPL(__inet_hash_nolisten); | 340 | EXPORT_SYMBOL_GPL(__inet_hash_nolisten); |
339 | 341 | ||
340 | void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk) | 342 | static void __inet_hash(struct sock *sk) |
341 | { | 343 | { |
344 | struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo; | ||
342 | struct hlist_head *list; | 345 | struct hlist_head *list; |
343 | rwlock_t *lock; | 346 | rwlock_t *lock; |
344 | 347 | ||
345 | if (sk->sk_state != TCP_LISTEN) { | 348 | if (sk->sk_state != TCP_LISTEN) { |
346 | __inet_hash_nolisten(hashinfo, sk); | 349 | __inet_hash_nolisten(sk); |
347 | return; | 350 | return; |
348 | } | 351 | } |
349 | 352 | ||
@@ -357,13 +360,48 @@ void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk) | |||
357 | write_unlock(lock); | 360 | write_unlock(lock); |
358 | wake_up(&hashinfo->lhash_wait); | 361 | wake_up(&hashinfo->lhash_wait); |
359 | } | 362 | } |
360 | EXPORT_SYMBOL_GPL(__inet_hash); | 363 | |
364 | void inet_hash(struct sock *sk) | ||
365 | { | ||
366 | if (sk->sk_state != TCP_CLOSE) { | ||
367 | local_bh_disable(); | ||
368 | __inet_hash(sk); | ||
369 | local_bh_enable(); | ||
370 | } | ||
371 | } | ||
372 | EXPORT_SYMBOL_GPL(inet_hash); | ||
373 | |||
374 | void inet_unhash(struct sock *sk) | ||
375 | { | ||
376 | rwlock_t *lock; | ||
377 | struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo; | ||
378 | |||
379 | if (sk_unhashed(sk)) | ||
380 | goto out; | ||
381 | |||
382 | if (sk->sk_state == TCP_LISTEN) { | ||
383 | local_bh_disable(); | ||
384 | inet_listen_wlock(hashinfo); | ||
385 | lock = &hashinfo->lhash_lock; | ||
386 | } else { | ||
387 | lock = inet_ehash_lockp(hashinfo, sk->sk_hash); | ||
388 | write_lock_bh(lock); | ||
389 | } | ||
390 | |||
391 | if (__sk_del_node_init(sk)) | ||
392 | sock_prot_inuse_add(sk->sk_prot, -1); | ||
393 | write_unlock_bh(lock); | ||
394 | out: | ||
395 | if (sk->sk_state == TCP_LISTEN) | ||
396 | wake_up(&hashinfo->lhash_wait); | ||
397 | } | ||
398 | EXPORT_SYMBOL_GPL(inet_unhash); | ||
361 | 399 | ||
362 | int __inet_hash_connect(struct inet_timewait_death_row *death_row, | 400 | int __inet_hash_connect(struct inet_timewait_death_row *death_row, |
363 | struct sock *sk, | 401 | struct sock *sk, |
364 | int (*check_established)(struct inet_timewait_death_row *, | 402 | int (*check_established)(struct inet_timewait_death_row *, |
365 | struct sock *, __u16, struct inet_timewait_sock **), | 403 | struct sock *, __u16, struct inet_timewait_sock **), |
366 | void (*hash)(struct inet_hashinfo *, struct sock *)) | 404 | void (*hash)(struct sock *sk)) |
367 | { | 405 | { |
368 | struct inet_hashinfo *hinfo = death_row->hashinfo; | 406 | struct inet_hashinfo *hinfo = death_row->hashinfo; |
369 | const unsigned short snum = inet_sk(sk)->num; | 407 | const unsigned short snum = inet_sk(sk)->num; |
@@ -427,7 +465,7 @@ ok: | |||
427 | inet_bind_hash(sk, tb, port); | 465 | inet_bind_hash(sk, tb, port); |
428 | if (sk_unhashed(sk)) { | 466 | if (sk_unhashed(sk)) { |
429 | inet_sk(sk)->sport = htons(port); | 467 | inet_sk(sk)->sport = htons(port); |
430 | hash(hinfo, sk); | 468 | hash(sk); |
431 | } | 469 | } |
432 | spin_unlock(&head->lock); | 470 | spin_unlock(&head->lock); |
433 | 471 | ||
@@ -444,7 +482,7 @@ ok: | |||
444 | tb = inet_csk(sk)->icsk_bind_hash; | 482 | tb = inet_csk(sk)->icsk_bind_hash; |
445 | spin_lock_bh(&head->lock); | 483 | spin_lock_bh(&head->lock); |
446 | if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) { | 484 | if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) { |
447 | hash(hinfo, sk); | 485 | hash(sk); |
448 | spin_unlock_bh(&head->lock); | 486 | spin_unlock_bh(&head->lock); |
449 | return 0; | 487 | return 0; |
450 | } else { | 488 | } else { |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a0d373bd9065..071e83a894ad 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1669,7 +1669,7 @@ void tcp_set_state(struct sock *sk, int state) | |||
1669 | sk->sk_prot->unhash(sk); | 1669 | sk->sk_prot->unhash(sk); |
1670 | if (inet_csk(sk)->icsk_bind_hash && | 1670 | if (inet_csk(sk)->icsk_bind_hash && |
1671 | !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) | 1671 | !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) |
1672 | inet_put_port(&tcp_hashinfo, sk); | 1672 | inet_put_port(sk); |
1673 | /* fall through */ | 1673 | /* fall through */ |
1674 | default: | 1674 | default: |
1675 | if (oldstate==TCP_ESTABLISHED) | 1675 | if (oldstate==TCP_ESTABLISHED) |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 77c1939a2b0d..63414ea427c5 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -108,22 +108,6 @@ struct inet_hashinfo __cacheline_aligned tcp_hashinfo = { | |||
108 | .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait), | 108 | .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait), |
109 | }; | 109 | }; |
110 | 110 | ||
111 | static int tcp_v4_get_port(struct sock *sk, unsigned short snum) | ||
112 | { | ||
113 | return inet_csk_get_port(&tcp_hashinfo, sk, snum, | ||
114 | inet_csk_bind_conflict); | ||
115 | } | ||
116 | |||
117 | static void tcp_v4_hash(struct sock *sk) | ||
118 | { | ||
119 | inet_hash(&tcp_hashinfo, sk); | ||
120 | } | ||
121 | |||
122 | void tcp_unhash(struct sock *sk) | ||
123 | { | ||
124 | inet_unhash(&tcp_hashinfo, sk); | ||
125 | } | ||
126 | |||
127 | static inline __u32 tcp_v4_init_sequence(struct sk_buff *skb) | 111 | static inline __u32 tcp_v4_init_sequence(struct sk_buff *skb) |
128 | { | 112 | { |
129 | return secure_tcp_sequence_number(ip_hdr(skb)->daddr, | 113 | return secure_tcp_sequence_number(ip_hdr(skb)->daddr, |
@@ -1478,8 +1462,8 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1478 | } | 1462 | } |
1479 | #endif | 1463 | #endif |
1480 | 1464 | ||
1481 | __inet_hash_nolisten(&tcp_hashinfo, newsk); | 1465 | __inet_hash_nolisten(newsk); |
1482 | __inet_inherit_port(&tcp_hashinfo, sk, newsk); | 1466 | __inet_inherit_port(sk, newsk); |
1483 | 1467 | ||
1484 | return newsk; | 1468 | return newsk; |
1485 | 1469 | ||
@@ -1827,6 +1811,7 @@ struct inet_connection_sock_af_ops ipv4_specific = { | |||
1827 | .getsockopt = ip_getsockopt, | 1811 | .getsockopt = ip_getsockopt, |
1828 | .addr2sockaddr = inet_csk_addr2sockaddr, | 1812 | .addr2sockaddr = inet_csk_addr2sockaddr, |
1829 | .sockaddr_len = sizeof(struct sockaddr_in), | 1813 | .sockaddr_len = sizeof(struct sockaddr_in), |
1814 | .bind_conflict = inet_csk_bind_conflict, | ||
1830 | #ifdef CONFIG_COMPAT | 1815 | #ifdef CONFIG_COMPAT |
1831 | .compat_setsockopt = compat_ip_setsockopt, | 1816 | .compat_setsockopt = compat_ip_setsockopt, |
1832 | .compat_getsockopt = compat_ip_getsockopt, | 1817 | .compat_getsockopt = compat_ip_getsockopt, |
@@ -1926,7 +1911,7 @@ int tcp_v4_destroy_sock(struct sock *sk) | |||
1926 | 1911 | ||
1927 | /* Clean up a referenced TCP bind bucket. */ | 1912 | /* Clean up a referenced TCP bind bucket. */ |
1928 | if (inet_csk(sk)->icsk_bind_hash) | 1913 | if (inet_csk(sk)->icsk_bind_hash) |
1929 | inet_put_port(&tcp_hashinfo, sk); | 1914 | inet_put_port(sk); |
1930 | 1915 | ||
1931 | /* | 1916 | /* |
1932 | * If sendmsg cached page exists, toss it. | 1917 | * If sendmsg cached page exists, toss it. |
@@ -2435,9 +2420,9 @@ struct proto tcp_prot = { | |||
2435 | .getsockopt = tcp_getsockopt, | 2420 | .getsockopt = tcp_getsockopt, |
2436 | .recvmsg = tcp_recvmsg, | 2421 | .recvmsg = tcp_recvmsg, |
2437 | .backlog_rcv = tcp_v4_do_rcv, | 2422 | .backlog_rcv = tcp_v4_do_rcv, |
2438 | .hash = tcp_v4_hash, | 2423 | .hash = inet_hash, |
2439 | .unhash = tcp_unhash, | 2424 | .unhash = inet_unhash, |
2440 | .get_port = tcp_v4_get_port, | 2425 | .get_port = inet_csk_get_port, |
2441 | .enter_memory_pressure = tcp_enter_memory_pressure, | 2426 | .enter_memory_pressure = tcp_enter_memory_pressure, |
2442 | .sockets_allocated = &tcp_sockets_allocated, | 2427 | .sockets_allocated = &tcp_sockets_allocated, |
2443 | .orphan_count = &tcp_orphan_count, | 2428 | .orphan_count = &tcp_orphan_count, |
@@ -2450,6 +2435,7 @@ struct proto tcp_prot = { | |||
2450 | .obj_size = sizeof(struct tcp_sock), | 2435 | .obj_size = sizeof(struct tcp_sock), |
2451 | .twsk_prot = &tcp_timewait_sock_ops, | 2436 | .twsk_prot = &tcp_timewait_sock_ops, |
2452 | .rsk_prot = &tcp_request_sock_ops, | 2437 | .rsk_prot = &tcp_request_sock_ops, |
2438 | .hashinfo = &tcp_hashinfo, | ||
2453 | #ifdef CONFIG_COMPAT | 2439 | #ifdef CONFIG_COMPAT |
2454 | .compat_setsockopt = compat_tcp_setsockopt, | 2440 | .compat_setsockopt = compat_tcp_setsockopt, |
2455 | .compat_getsockopt = compat_tcp_getsockopt, | 2441 | .compat_getsockopt = compat_tcp_getsockopt, |
@@ -2467,7 +2453,6 @@ void __init tcp_v4_init(struct net_proto_family *ops) | |||
2467 | EXPORT_SYMBOL(ipv4_specific); | 2453 | EXPORT_SYMBOL(ipv4_specific); |
2468 | EXPORT_SYMBOL(tcp_hashinfo); | 2454 | EXPORT_SYMBOL(tcp_hashinfo); |
2469 | EXPORT_SYMBOL(tcp_prot); | 2455 | EXPORT_SYMBOL(tcp_prot); |
2470 | EXPORT_SYMBOL(tcp_unhash); | ||
2471 | EXPORT_SYMBOL(tcp_v4_conn_request); | 2456 | EXPORT_SYMBOL(tcp_v4_conn_request); |
2472 | EXPORT_SYMBOL(tcp_v4_connect); | 2457 | EXPORT_SYMBOL(tcp_v4_connect); |
2473 | EXPORT_SYMBOL(tcp_v4_do_rcv); | 2458 | EXPORT_SYMBOL(tcp_v4_do_rcv); |
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index d325a9958909..43f3993e1f30 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -22,9 +22,9 @@ | |||
22 | #include <net/inet6_hashtables.h> | 22 | #include <net/inet6_hashtables.h> |
23 | #include <net/ip.h> | 23 | #include <net/ip.h> |
24 | 24 | ||
25 | void __inet6_hash(struct inet_hashinfo *hashinfo, | 25 | void __inet6_hash(struct sock *sk) |
26 | struct sock *sk) | ||
27 | { | 26 | { |
27 | struct inet_hashinfo *hashinfo = sk->sk_prot->hashinfo; | ||
28 | struct hlist_head *list; | 28 | struct hlist_head *list; |
29 | rwlock_t *lock; | 29 | rwlock_t *lock; |
30 | 30 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 59d0029e93a7..12750f2b05ab 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -86,12 +86,6 @@ static struct tcp_sock_af_ops tcp_sock_ipv6_specific; | |||
86 | static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific; | 86 | static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific; |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | static int tcp_v6_get_port(struct sock *sk, unsigned short snum) | ||
90 | { | ||
91 | return inet_csk_get_port(&tcp_hashinfo, sk, snum, | ||
92 | inet6_csk_bind_conflict); | ||
93 | } | ||
94 | |||
95 | static void tcp_v6_hash(struct sock *sk) | 89 | static void tcp_v6_hash(struct sock *sk) |
96 | { | 90 | { |
97 | if (sk->sk_state != TCP_CLOSE) { | 91 | if (sk->sk_state != TCP_CLOSE) { |
@@ -100,7 +94,7 @@ static void tcp_v6_hash(struct sock *sk) | |||
100 | return; | 94 | return; |
101 | } | 95 | } |
102 | local_bh_disable(); | 96 | local_bh_disable(); |
103 | __inet6_hash(&tcp_hashinfo, sk); | 97 | __inet6_hash(sk); |
104 | local_bh_enable(); | 98 | local_bh_enable(); |
105 | } | 99 | } |
106 | } | 100 | } |
@@ -1504,8 +1498,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1504 | } | 1498 | } |
1505 | #endif | 1499 | #endif |
1506 | 1500 | ||
1507 | __inet6_hash(&tcp_hashinfo, newsk); | 1501 | __inet6_hash(newsk); |
1508 | inet_inherit_port(&tcp_hashinfo, sk, newsk); | 1502 | inet_inherit_port(sk, newsk); |
1509 | 1503 | ||
1510 | return newsk; | 1504 | return newsk; |
1511 | 1505 | ||
@@ -1833,6 +1827,7 @@ static struct inet_connection_sock_af_ops ipv6_specific = { | |||
1833 | .getsockopt = ipv6_getsockopt, | 1827 | .getsockopt = ipv6_getsockopt, |
1834 | .addr2sockaddr = inet6_csk_addr2sockaddr, | 1828 | .addr2sockaddr = inet6_csk_addr2sockaddr, |
1835 | .sockaddr_len = sizeof(struct sockaddr_in6), | 1829 | .sockaddr_len = sizeof(struct sockaddr_in6), |
1830 | .bind_conflict = inet6_csk_bind_conflict, | ||
1836 | #ifdef CONFIG_COMPAT | 1831 | #ifdef CONFIG_COMPAT |
1837 | .compat_setsockopt = compat_ipv6_setsockopt, | 1832 | .compat_setsockopt = compat_ipv6_setsockopt, |
1838 | .compat_getsockopt = compat_ipv6_getsockopt, | 1833 | .compat_getsockopt = compat_ipv6_getsockopt, |
@@ -1864,6 +1859,7 @@ static struct inet_connection_sock_af_ops ipv6_mapped = { | |||
1864 | .getsockopt = ipv6_getsockopt, | 1859 | .getsockopt = ipv6_getsockopt, |
1865 | .addr2sockaddr = inet6_csk_addr2sockaddr, | 1860 | .addr2sockaddr = inet6_csk_addr2sockaddr, |
1866 | .sockaddr_len = sizeof(struct sockaddr_in6), | 1861 | .sockaddr_len = sizeof(struct sockaddr_in6), |
1862 | .bind_conflict = inet6_csk_bind_conflict, | ||
1867 | #ifdef CONFIG_COMPAT | 1863 | #ifdef CONFIG_COMPAT |
1868 | .compat_setsockopt = compat_ipv6_setsockopt, | 1864 | .compat_setsockopt = compat_ipv6_setsockopt, |
1869 | .compat_getsockopt = compat_ipv6_getsockopt, | 1865 | .compat_getsockopt = compat_ipv6_getsockopt, |
@@ -2127,8 +2123,8 @@ struct proto tcpv6_prot = { | |||
2127 | .recvmsg = tcp_recvmsg, | 2123 | .recvmsg = tcp_recvmsg, |
2128 | .backlog_rcv = tcp_v6_do_rcv, | 2124 | .backlog_rcv = tcp_v6_do_rcv, |
2129 | .hash = tcp_v6_hash, | 2125 | .hash = tcp_v6_hash, |
2130 | .unhash = tcp_unhash, | 2126 | .unhash = inet_unhash, |
2131 | .get_port = tcp_v6_get_port, | 2127 | .get_port = inet_csk_get_port, |
2132 | .enter_memory_pressure = tcp_enter_memory_pressure, | 2128 | .enter_memory_pressure = tcp_enter_memory_pressure, |
2133 | .sockets_allocated = &tcp_sockets_allocated, | 2129 | .sockets_allocated = &tcp_sockets_allocated, |
2134 | .memory_allocated = &tcp_memory_allocated, | 2130 | .memory_allocated = &tcp_memory_allocated, |
@@ -2141,6 +2137,7 @@ struct proto tcpv6_prot = { | |||
2141 | .obj_size = sizeof(struct tcp6_sock), | 2137 | .obj_size = sizeof(struct tcp6_sock), |
2142 | .twsk_prot = &tcp6_timewait_sock_ops, | 2138 | .twsk_prot = &tcp6_timewait_sock_ops, |
2143 | .rsk_prot = &tcp6_request_sock_ops, | 2139 | .rsk_prot = &tcp6_request_sock_ops, |
2140 | .hashinfo = &tcp_hashinfo, | ||
2144 | #ifdef CONFIG_COMPAT | 2141 | #ifdef CONFIG_COMPAT |
2145 | .compat_setsockopt = compat_tcp_setsockopt, | 2142 | .compat_setsockopt = compat_tcp_setsockopt, |
2146 | .compat_getsockopt = compat_tcp_getsockopt, | 2143 | .compat_getsockopt = compat_tcp_getsockopt, |
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 09c255002e56..e77592d050ce 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
@@ -98,6 +98,18 @@ config MAC80211_DEBUGFS | |||
98 | 98 | ||
99 | Say N unless you know you need this. | 99 | Say N unless you know you need this. |
100 | 100 | ||
101 | config MAC80211_DEBUG_PACKET_ALIGNMENT | ||
102 | bool "Enable packet alignment debugging" | ||
103 | depends on MAC80211 | ||
104 | help | ||
105 | This option is recommended for driver authors and strongly | ||
106 | discouraged for everybody else, it will trigger a warning | ||
107 | when a driver hands mac80211 a buffer that is aligned in | ||
108 | a way that will cause problems with the IP stack on some | ||
109 | architectures. | ||
110 | |||
111 | Say N unless you're writing a mac80211 based driver. | ||
112 | |||
101 | config MAC80211_DEBUG | 113 | config MAC80211_DEBUG |
102 | bool "Enable debugging output" | 114 | bool "Enable debugging output" |
103 | depends on MAC80211 | 115 | depends on MAC80211 |
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 5dcc2d61551f..67b7c75c430d 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -1344,17 +1344,17 @@ static int __init ieee80211_init(void) | |||
1344 | 1344 | ||
1345 | ret = rc80211_simple_init(); | 1345 | ret = rc80211_simple_init(); |
1346 | if (ret) | 1346 | if (ret) |
1347 | goto fail; | 1347 | goto out; |
1348 | 1348 | ||
1349 | ret = rc80211_pid_init(); | 1349 | ret = rc80211_pid_init(); |
1350 | if (ret) | 1350 | if (ret) |
1351 | goto fail_simple; | 1351 | goto out_cleanup_simple; |
1352 | 1352 | ||
1353 | ret = ieee80211_wme_register(); | 1353 | ret = ieee80211_wme_register(); |
1354 | if (ret) { | 1354 | if (ret) { |
1355 | printk(KERN_DEBUG "ieee80211_init: failed to " | 1355 | printk(KERN_DEBUG "ieee80211_init: failed to " |
1356 | "initialize WME (err=%d)\n", ret); | 1356 | "initialize WME (err=%d)\n", ret); |
1357 | goto fail_pid; | 1357 | goto out_cleanup_pid; |
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | ieee80211_debugfs_netdev_init(); | 1360 | ieee80211_debugfs_netdev_init(); |
@@ -1362,11 +1362,11 @@ static int __init ieee80211_init(void) | |||
1362 | 1362 | ||
1363 | return 0; | 1363 | return 0; |
1364 | 1364 | ||
1365 | fail_pid: | 1365 | out_cleanup_pid: |
1366 | rc80211_simple_exit(); | ||
1367 | fail_simple: | ||
1368 | rc80211_pid_exit(); | 1366 | rc80211_pid_exit(); |
1369 | fail: | 1367 | out_cleanup_simple: |
1368 | rc80211_simple_exit(); | ||
1369 | out: | ||
1370 | return ret; | 1370 | return ret; |
1371 | } | 1371 | } |
1372 | 1372 | ||
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c index 554c4baed6fb..c339571632b2 100644 --- a/net/mac80211/rc80211_pid_algo.c +++ b/net/mac80211/rc80211_pid_algo.c | |||
@@ -538,7 +538,7 @@ int __init rc80211_pid_init(void) | |||
538 | return ieee80211_rate_control_register(&mac80211_rcpid); | 538 | return ieee80211_rate_control_register(&mac80211_rcpid); |
539 | } | 539 | } |
540 | 540 | ||
541 | void __exit rc80211_pid_exit(void) | 541 | void rc80211_pid_exit(void) |
542 | { | 542 | { |
543 | ieee80211_rate_control_unregister(&mac80211_rcpid); | 543 | ieee80211_rate_control_unregister(&mac80211_rcpid); |
544 | } | 544 | } |
diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c index 934676d687d6..9a78b116acff 100644 --- a/net/mac80211/rc80211_simple.c +++ b/net/mac80211/rc80211_simple.c | |||
@@ -389,7 +389,7 @@ int __init rc80211_simple_init(void) | |||
389 | return ieee80211_rate_control_register(&mac80211_rcsimple); | 389 | return ieee80211_rate_control_register(&mac80211_rcsimple); |
390 | } | 390 | } |
391 | 391 | ||
392 | void __exit rc80211_simple_exit(void) | 392 | void rc80211_simple_exit(void) |
393 | { | 393 | { |
394 | ieee80211_rate_control_unregister(&mac80211_rcsimple); | 394 | ieee80211_rate_control_unregister(&mac80211_rcsimple); |
395 | } | 395 | } |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index d44c87269bcb..535407d07fa4 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -340,11 +340,15 @@ static u32 ieee80211_rx_load_stats(struct ieee80211_local *local, | |||
340 | return load; | 340 | return load; |
341 | } | 341 | } |
342 | 342 | ||
343 | #ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT | ||
343 | static ieee80211_txrx_result | 344 | static ieee80211_txrx_result |
344 | ieee80211_rx_h_verify_ip_alignment(struct ieee80211_txrx_data *rx) | 345 | ieee80211_rx_h_verify_ip_alignment(struct ieee80211_txrx_data *rx) |
345 | { | 346 | { |
346 | int hdrlen; | 347 | int hdrlen; |
347 | 348 | ||
349 | if (!WLAN_FC_DATA_PRESENT(rx->fc)) | ||
350 | return TXRX_CONTINUE; | ||
351 | |||
348 | /* | 352 | /* |
349 | * Drivers are required to align the payload data in a way that | 353 | * Drivers are required to align the payload data in a way that |
350 | * guarantees that the contained IP header is aligned to a four- | 354 | * guarantees that the contained IP header is aligned to a four- |
@@ -371,11 +375,14 @@ ieee80211_rx_h_verify_ip_alignment(struct ieee80211_txrx_data *rx) | |||
371 | 375 | ||
372 | return TXRX_CONTINUE; | 376 | return TXRX_CONTINUE; |
373 | } | 377 | } |
378 | #endif | ||
374 | 379 | ||
375 | ieee80211_rx_handler ieee80211_rx_pre_handlers[] = | 380 | ieee80211_rx_handler ieee80211_rx_pre_handlers[] = |
376 | { | 381 | { |
377 | ieee80211_rx_h_parse_qos, | 382 | ieee80211_rx_h_parse_qos, |
383 | #ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT | ||
378 | ieee80211_rx_h_verify_ip_alignment, | 384 | ieee80211_rx_h_verify_ip_alignment, |
385 | #endif | ||
379 | NULL | 386 | NULL |
380 | }; | 387 | }; |
381 | 388 | ||
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index 6562f868e82f..1a47f5d1be17 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c | |||
@@ -340,7 +340,7 @@ EXPORT_SYMBOL(rfkill_allocate); | |||
340 | * rfkill_free - Mark rfkill structure for deletion | 340 | * rfkill_free - Mark rfkill structure for deletion |
341 | * @rfkill: rfkill structure to be destroyed | 341 | * @rfkill: rfkill structure to be destroyed |
342 | * | 342 | * |
343 | * Decrements reference count of rfkill structure so it is destoryed. | 343 | * Decrements reference count of rfkill structure so it is destroyed. |
344 | * Note that rfkill_free() should _not_ be called after rfkill_unregister(). | 344 | * Note that rfkill_free() should _not_ be called after rfkill_unregister(). |
345 | */ | 345 | */ |
346 | void rfkill_free(struct rfkill *rfkill) | 346 | void rfkill_free(struct rfkill *rfkill) |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 61cbd5a8dd0c..5df0c4bd415b 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -537,7 +537,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep, | |||
537 | * | 537 | * |
538 | * This means that if we only want to abort associations | 538 | * This means that if we only want to abort associations |
539 | * in an authenticated way (i.e AUTH+ABORT), then we | 539 | * in an authenticated way (i.e AUTH+ABORT), then we |
540 | * can't destory this association just becuase the packet | 540 | * can't destroy this association just becuase the packet |
541 | * was malformed. | 541 | * was malformed. |
542 | */ | 542 | */ |
543 | if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)) | 543 | if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)) |
@@ -4130,7 +4130,7 @@ static sctp_disposition_t sctp_sf_abort_violation( | |||
4130 | * | 4130 | * |
4131 | * This means that if we only want to abort associations | 4131 | * This means that if we only want to abort associations |
4132 | * in an authenticated way (i.e AUTH+ABORT), then we | 4132 | * in an authenticated way (i.e AUTH+ABORT), then we |
4133 | * can't destory this association just becuase the packet | 4133 | * can't destroy this association just becuase the packet |
4134 | * was malformed. | 4134 | * was malformed. |
4135 | */ | 4135 | */ |
4136 | if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)) | 4136 | if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc)) |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 50e61c411bc0..734cf4f3131e 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -821,6 +821,7 @@ static void conf_load(void) | |||
821 | return; | 821 | return; |
822 | if (!conf_read(dialog_input_result)) { | 822 | if (!conf_read(dialog_input_result)) { |
823 | set_config_filename(dialog_input_result); | 823 | set_config_filename(dialog_input_result); |
824 | sym_set_change_count(1); | ||
824 | return; | 825 | return; |
825 | } | 826 | } |
826 | show_textbox(NULL, _("File does not exist!"), 5, 38); | 827 | show_textbox(NULL, _("File does not exist!"), 5, 38); |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index fdad17367f61..606ceb9e746e 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -203,12 +203,9 @@ void sym_check_prop(struct symbol *sym) | |||
203 | prop_warn(prop, | 203 | prop_warn(prop, |
204 | "config symbol '%s' uses select, but is " | 204 | "config symbol '%s' uses select, but is " |
205 | "not boolean or tristate", sym->name); | 205 | "not boolean or tristate", sym->name); |
206 | else if (sym2->type == S_UNKNOWN) | 206 | else if (sym2->type != S_UNKNOWN && |
207 | prop_warn(prop, | 207 | sym2->type != S_BOOLEAN && |
208 | "'select' used by config symbol '%s' " | 208 | sym2->type != S_TRISTATE) |
209 | "refers to undefined symbol '%s'", | ||
210 | sym->name, sym2->name); | ||
211 | else if (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE) | ||
212 | prop_warn(prop, | 209 | prop_warn(prop, |
213 | "'%s' has wrong type. 'select' only " | 210 | "'%s' has wrong type. 'select' only " |
214 | "accept arguments of boolean and " | 211 | "accept arguments of boolean and " |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index f8efc93eb700..5d546466e6b1 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -870,7 +870,7 @@ const struct sectioncheck sectioncheck[] = { | |||
870 | /* Do not export init/exit functions or data */ | 870 | /* Do not export init/exit functions or data */ |
871 | { | 871 | { |
872 | .fromsec = { "__ksymtab*", NULL }, | 872 | .fromsec = { "__ksymtab*", NULL }, |
873 | .tosec = { ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL }, | 873 | .tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL }, |
874 | .mismatch = EXPORT_TO_INIT_EXIT | 874 | .mismatch = EXPORT_TO_INIT_EXIT |
875 | } | 875 | } |
876 | }; | 876 | }; |
@@ -1125,15 +1125,15 @@ static void report_sec_mismatch(const char *modname, enum mismatch mismatch, | |||
1125 | to = to_is_func ? "function" : "variable"; | 1125 | to = to_is_func ? "function" : "variable"; |
1126 | to_p = to_is_func ? "()" : ""; | 1126 | to_p = to_is_func ? "()" : ""; |
1127 | 1127 | ||
1128 | sec_mismatch_count++; | ||
1129 | if (!sec_mismatch_verbose) | ||
1130 | return; | ||
1131 | |||
1128 | fprintf(stderr, "WARNING: %s(%s+0x%llx): Section mismatch in" | 1132 | fprintf(stderr, "WARNING: %s(%s+0x%llx): Section mismatch in" |
1129 | " reference from the %s %s%s to the %s %s:%s%s\n", | 1133 | " reference from the %s %s%s to the %s %s:%s%s\n", |
1130 | modname, fromsec, fromaddr, from, fromsym, from_p, | 1134 | modname, fromsec, fromaddr, from, fromsym, from_p, |
1131 | to, tosec, tosym, to_p); | 1135 | to, tosec, tosym, to_p); |
1132 | 1136 | ||
1133 | sec_mismatch_count++; | ||
1134 | if (!sec_mismatch_verbose) | ||
1135 | return; | ||
1136 | |||
1137 | switch (mismatch) { | 1137 | switch (mismatch) { |
1138 | case TEXT_TO_INIT: | 1138 | case TEXT_TO_INIT: |
1139 | fprintf(stderr, | 1139 | fprintf(stderr, |
@@ -1939,10 +1939,9 @@ int main(int argc, char **argv) | |||
1939 | write_dump(dump_write); | 1939 | write_dump(dump_write); |
1940 | if (sec_mismatch_count && !sec_mismatch_verbose) | 1940 | if (sec_mismatch_count && !sec_mismatch_verbose) |
1941 | fprintf(stderr, "modpost: Found %d section mismatch(es).\n" | 1941 | fprintf(stderr, "modpost: Found %d section mismatch(es).\n" |
1942 | "To see additional details select \"Enable full " | 1942 | "To see full details build your kernel with:\n" |
1943 | "Section mismatch analysis\"\n" | 1943 | "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", |
1944 | "in the Kernel Hacking menu " | 1944 | sec_mismatch_count); |
1945 | "(CONFIG_SECTION_MISMATCH).\n", sec_mismatch_count); | ||
1946 | 1945 | ||
1947 | return err; | 1946 | return err; |
1948 | } | 1947 | } |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 52f032e409a3..1c1bdaf7348a 100644..100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -45,3 +45,19 @@ if hgid=`hg id 2>/dev/null`; then | |||
45 | # All done with mercurial | 45 | # All done with mercurial |
46 | exit | 46 | exit |
47 | fi | 47 | fi |
48 | |||
49 | # Check for svn and a svn repo. | ||
50 | if rev=`svn info 2>/dev/null | grep '^Revision'`; then | ||
51 | rev=`echo $rev | awk '{print $NF}'` | ||
52 | changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` | ||
53 | |||
54 | # Are there uncommitted changes? | ||
55 | if [ $changes != 0 ]; then | ||
56 | printf -- '-svn%s%s%s' "$rev" -dirty "$changes" | ||
57 | else | ||
58 | printf -- '-svn%s' "$rev" | ||
59 | fi | ||
60 | |||
61 | # All done with svn | ||
62 | exit | ||
63 | fi | ||
diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c index 5d3c0372df32..f95aa0946758 100644 --- a/sound/oss/via82cxxx_audio.c +++ b/sound/oss/via82cxxx_audio.c | |||
@@ -2104,6 +2104,7 @@ static struct page * via_mm_nopage (struct vm_area_struct * vma, | |||
2104 | { | 2104 | { |
2105 | struct via_info *card = vma->vm_private_data; | 2105 | struct via_info *card = vma->vm_private_data; |
2106 | struct via_channel *chan = &card->ch_out; | 2106 | struct via_channel *chan = &card->ch_out; |
2107 | unsigned long max_bufs; | ||
2107 | struct page *dmapage; | 2108 | struct page *dmapage; |
2108 | unsigned long pgoff; | 2109 | unsigned long pgoff; |
2109 | int rd, wr; | 2110 | int rd, wr; |
@@ -2127,14 +2128,11 @@ static struct page * via_mm_nopage (struct vm_area_struct * vma, | |||
2127 | rd = card->ch_in.is_mapped; | 2128 | rd = card->ch_in.is_mapped; |
2128 | wr = card->ch_out.is_mapped; | 2129 | wr = card->ch_out.is_mapped; |
2129 | 2130 | ||
2130 | #ifndef VIA_NDEBUG | 2131 | max_bufs = chan->frag_number; |
2131 | { | 2132 | if (rd && wr) |
2132 | unsigned long max_bufs = chan->frag_number; | 2133 | max_bufs *= 2; |
2133 | if (rd && wr) max_bufs *= 2; | 2134 | if (pgoff >= max_bufs) |
2134 | /* via_dsp_mmap() should ensure this */ | 2135 | return NOPAGE_SIGBUS; |
2135 | assert (pgoff < max_bufs); | ||
2136 | } | ||
2137 | #endif | ||
2138 | 2136 | ||
2139 | /* if full-duplex (read+write) and we have two sets of bufs, | 2137 | /* if full-duplex (read+write) and we have two sets of bufs, |
2140 | * then the playback buffers come first, sez soundcard.c */ | 2138 | * then the playback buffers come first, sez soundcard.c */ |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 6495534e5bf6..1558a5c4094f 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -84,7 +84,7 @@ static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct v | |||
84 | us428->us428ctls_sharedmem->CtlSnapShotLast = -2; | 84 | us428->us428ctls_sharedmem->CtlSnapShotLast = -2; |
85 | } | 85 | } |
86 | area->vm_ops = &us428ctls_vm_ops; | 86 | area->vm_ops = &us428ctls_vm_ops; |
87 | area->vm_flags |= VM_RESERVED; | 87 | area->vm_flags |= VM_RESERVED | VM_DONTEXPAND; |
88 | area->vm_private_data = hw->private_data; | 88 | area->vm_private_data = hw->private_data; |
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 800b5cecfc80..117946f2debb 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -722,7 +722,7 @@ static int snd_usX2Y_hwdep_pcm_mmap(struct snd_hwdep * hw, struct file *filp, st | |||
722 | return -ENODEV; | 722 | return -ENODEV; |
723 | } | 723 | } |
724 | area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops; | 724 | area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops; |
725 | area->vm_flags |= VM_RESERVED; | 725 | area->vm_flags |= VM_RESERVED | VM_DONTEXPAND; |
726 | area->vm_private_data = hw->private_data; | 726 | area->vm_private_data = hw->private_data; |
727 | return 0; | 727 | return 0; |
728 | } | 728 | } |