diff options
278 files changed, 5017 insertions, 1903 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 5c8695a3d139..2d7ea85075ba 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -62,7 +62,7 @@ Who: Dan Dennedy <dan@dennedy.org>, Stefan Richter <stefanr@s5r6.in-berlin.de> | |||
62 | What: old NCR53C9x driver | 62 | What: old NCR53C9x driver |
63 | When: October 2007 | 63 | When: October 2007 |
64 | Why: Replaced by the much better esp_scsi driver. Actual low-level | 64 | Why: Replaced by the much better esp_scsi driver. Actual low-level |
65 | driver can ported over almost trivially. | 65 | driver can be ported over almost trivially. |
66 | Who: David Miller <davem@davemloft.net> | 66 | Who: David Miller <davem@davemloft.net> |
67 | Christoph Hellwig <hch@lst.de> | 67 | Christoph Hellwig <hch@lst.de> |
68 | 68 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index aae2282600ca..ce91560229f5 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1132,9 +1132,9 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1132 | when set. | 1132 | when set. |
1133 | Format: <int> | 1133 | Format: <int> |
1134 | 1134 | ||
1135 | noaliencache [MM, NUMA] Disables the allcoation of alien caches in | 1135 | noaliencache [MM, NUMA, SLAB] Disables the allocation of alien |
1136 | the slab allocator. Saves per-node memory, but will | 1136 | caches in the slab allocator. Saves per-node memory, |
1137 | impact performance on real NUMA hardware. | 1137 | but will impact performance. |
1138 | 1138 | ||
1139 | noalign [KNL,ARM] | 1139 | noalign [KNL,ARM] |
1140 | 1140 | ||
@@ -1613,6 +1613,37 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1613 | 1613 | ||
1614 | slram= [HW,MTD] | 1614 | slram= [HW,MTD] |
1615 | 1615 | ||
1616 | slub_debug [MM, SLUB] | ||
1617 | Enabling slub_debug allows one to determine the culprit | ||
1618 | if slab objects become corrupted. Enabling slub_debug | ||
1619 | creates guard zones around objects and poisons objects | ||
1620 | when not in use. Also tracks the last alloc / free. | ||
1621 | For more information see Documentation/vm/slub.txt. | ||
1622 | |||
1623 | slub_max_order= [MM, SLUB] | ||
1624 | Determines the maximum allowed order for slabs. Setting | ||
1625 | this too high may cause fragmentation. | ||
1626 | For more information see Documentation/vm/slub.txt. | ||
1627 | |||
1628 | slub_min_objects= [MM, SLUB] | ||
1629 | The minimum objects per slab. SLUB will increase the | ||
1630 | slab order up to slub_max_order to generate a | ||
1631 | sufficiently big slab to satisfy the number of objects. | ||
1632 | The higher the number of objects the smaller the overhead | ||
1633 | of tracking slabs. | ||
1634 | For more information see Documentation/vm/slub.txt. | ||
1635 | |||
1636 | slub_min_order= [MM, SLUB] | ||
1637 | Determines the mininum page order for slabs. Must be | ||
1638 | lower than slub_max_order | ||
1639 | For more information see Documentation/vm/slub.txt. | ||
1640 | |||
1641 | slub_nomerge [MM, SLUB] | ||
1642 | Disable merging of slabs of similar size. May be | ||
1643 | necessary if there is some reason to distinguish | ||
1644 | allocs to different slabs. | ||
1645 | For more information see Documentation/vm/slub.txt. | ||
1646 | |||
1616 | smart2= [HW] | 1647 | smart2= [HW] |
1617 | Format: <io1>[,<io2>[,...,<io8>]] | 1648 | Format: <io1>[,<io2>[,...,<io8>]] |
1618 | 1649 | ||
diff --git a/Documentation/networking/xfrm_sysctl.txt b/Documentation/networking/xfrm_sysctl.txt new file mode 100644 index 000000000000..5bbd16792fe1 --- /dev/null +++ b/Documentation/networking/xfrm_sysctl.txt | |||
@@ -0,0 +1,4 @@ | |||
1 | /proc/sys/net/core/xfrm_* Variables: | ||
2 | |||
3 | xfrm_acq_expires - INTEGER | ||
4 | default 30 - hard timeout in seconds for acquire requests | ||
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index 57b878cc393c..355ff0a2bb7c 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -917,6 +917,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
917 | ref Reference board, base config | 917 | ref Reference board, base config |
918 | m2-2 Some Gateway MX series laptops | 918 | m2-2 Some Gateway MX series laptops |
919 | m6 Some Gateway NX series laptops | 919 | m6 Some Gateway NX series laptops |
920 | pa6 Gateway NX860 series | ||
920 | 921 | ||
921 | STAC9227/9228/9229/927x | 922 | STAC9227/9228/9229/927x |
922 | ref Reference board | 923 | ref Reference board |
diff --git a/Documentation/vm/slub.txt b/Documentation/vm/slub.txt index 727c8d81aeaf..1523320abd87 100644 --- a/Documentation/vm/slub.txt +++ b/Documentation/vm/slub.txt | |||
@@ -1,13 +1,9 @@ | |||
1 | Short users guide for SLUB | 1 | Short users guide for SLUB |
2 | -------------------------- | 2 | -------------------------- |
3 | 3 | ||
4 | First of all slub should transparently replace SLAB. If you enable | ||
5 | SLUB then everything should work the same (Note the word "should". | ||
6 | There is likely not much value in that word at this point). | ||
7 | |||
8 | The basic philosophy of SLUB is very different from SLAB. SLAB | 4 | The basic philosophy of SLUB is very different from SLAB. SLAB |
9 | requires rebuilding the kernel to activate debug options for all | 5 | requires rebuilding the kernel to activate debug options for all |
10 | SLABS. SLUB always includes full debugging but its off by default. | 6 | slab caches. SLUB always includes full debugging but it is off by default. |
11 | SLUB can enable debugging only for selected slabs in order to avoid | 7 | SLUB can enable debugging only for selected slabs in order to avoid |
12 | an impact on overall system performance which may make a bug more | 8 | an impact on overall system performance which may make a bug more |
13 | difficult to find. | 9 | difficult to find. |
@@ -76,13 +72,28 @@ of objects. | |||
76 | Careful with tracing: It may spew out lots of information and never stop if | 72 | Careful with tracing: It may spew out lots of information and never stop if |
77 | used on the wrong slab. | 73 | used on the wrong slab. |
78 | 74 | ||
79 | SLAB Merging | 75 | Slab merging |
80 | ------------ | 76 | ------------ |
81 | 77 | ||
82 | If no debugging is specified then SLUB may merge similar slabs together | 78 | If no debug options are specified then SLUB may merge similar slabs together |
83 | in order to reduce overhead and increase cache hotness of objects. | 79 | in order to reduce overhead and increase cache hotness of objects. |
84 | slabinfo -a displays which slabs were merged together. | 80 | slabinfo -a displays which slabs were merged together. |
85 | 81 | ||
82 | Slab validation | ||
83 | --------------- | ||
84 | |||
85 | SLUB can validate all object if the kernel was booted with slub_debug. In | ||
86 | order to do so you must have the slabinfo tool. Then you can do | ||
87 | |||
88 | slabinfo -v | ||
89 | |||
90 | which will test all objects. Output will be generated to the syslog. | ||
91 | |||
92 | This also works in a more limited way if boot was without slab debug. | ||
93 | In that case slabinfo -v simply tests all reachable objects. Usually | ||
94 | these are in the cpu slabs and the partial slabs. Full slabs are not | ||
95 | tracked by SLUB in a non debug situation. | ||
96 | |||
86 | Getting more performance | 97 | Getting more performance |
87 | ------------------------ | 98 | ------------------------ |
88 | 99 | ||
@@ -91,9 +102,9 @@ list_lock once in a while to deal with partial slabs. That overhead is | |||
91 | governed by the order of the allocation for each slab. The allocations | 102 | governed by the order of the allocation for each slab. The allocations |
92 | can be influenced by kernel parameters: | 103 | can be influenced by kernel parameters: |
93 | 104 | ||
94 | slub_min_objects=x (default 8) | 105 | slub_min_objects=x (default 4) |
95 | slub_min_order=x (default 0) | 106 | slub_min_order=x (default 0) |
96 | slub_max_order=x (default 4) | 107 | slub_max_order=x (default 1) |
97 | 108 | ||
98 | slub_min_objects allows to specify how many objects must at least fit | 109 | slub_min_objects allows to specify how many objects must at least fit |
99 | into one slab in order for the allocation order to be acceptable. | 110 | into one slab in order for the allocation order to be acceptable. |
@@ -109,5 +120,107 @@ longer be checked. This is useful to avoid SLUB trying to generate | |||
109 | super large order pages to fit slub_min_objects of a slab cache with | 120 | super large order pages to fit slub_min_objects of a slab cache with |
110 | large object sizes into one high order page. | 121 | large object sizes into one high order page. |
111 | 122 | ||
112 | 123 | SLUB Debug output | |
113 | Christoph Lameter, <clameter@sgi.com>, April 10, 2007 | 124 | ----------------- |
125 | |||
126 | Here is a sample of slub debug output: | ||
127 | |||
128 | *** SLUB kmalloc-8: Redzone Active@0xc90f6d20 slab 0xc528c530 offset=3360 flags=0x400000c3 inuse=61 freelist=0xc90f6d58 | ||
129 | Bytes b4 0xc90f6d10: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ | ||
130 | Object 0xc90f6d20: 31 30 31 39 2e 30 30 35 1019.005 | ||
131 | Redzone 0xc90f6d28: 00 cc cc cc . | ||
132 | FreePointer 0xc90f6d2c -> 0xc90f6d58 | ||
133 | Last alloc: get_modalias+0x61/0xf5 jiffies_ago=53 cpu=1 pid=554 | ||
134 | Filler 0xc90f6d50: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ | ||
135 | [<c010523d>] dump_trace+0x63/0x1eb | ||
136 | [<c01053df>] show_trace_log_lvl+0x1a/0x2f | ||
137 | [<c010601d>] show_trace+0x12/0x14 | ||
138 | [<c0106035>] dump_stack+0x16/0x18 | ||
139 | [<c017e0fa>] object_err+0x143/0x14b | ||
140 | [<c017e2cc>] check_object+0x66/0x234 | ||
141 | [<c017eb43>] __slab_free+0x239/0x384 | ||
142 | [<c017f446>] kfree+0xa6/0xc6 | ||
143 | [<c02e2335>] get_modalias+0xb9/0xf5 | ||
144 | [<c02e23b7>] dmi_dev_uevent+0x27/0x3c | ||
145 | [<c027866a>] dev_uevent+0x1ad/0x1da | ||
146 | [<c0205024>] kobject_uevent_env+0x20a/0x45b | ||
147 | [<c020527f>] kobject_uevent+0xa/0xf | ||
148 | [<c02779f1>] store_uevent+0x4f/0x58 | ||
149 | [<c027758e>] dev_attr_store+0x29/0x2f | ||
150 | [<c01bec4f>] sysfs_write_file+0x16e/0x19c | ||
151 | [<c0183ba7>] vfs_write+0xd1/0x15a | ||
152 | [<c01841d7>] sys_write+0x3d/0x72 | ||
153 | [<c0104112>] sysenter_past_esp+0x5f/0x99 | ||
154 | [<b7f7b410>] 0xb7f7b410 | ||
155 | ======================= | ||
156 | @@@ SLUB kmalloc-8: Restoring redzone (0xcc) from 0xc90f6d28-0xc90f6d2b | ||
157 | |||
158 | |||
159 | |||
160 | If SLUB encounters a corrupted object then it will perform the following | ||
161 | actions: | ||
162 | |||
163 | 1. Isolation and report of the issue | ||
164 | |||
165 | This will be a message in the system log starting with | ||
166 | |||
167 | *** SLUB <slab cache affected>: <What went wrong>@<object address> | ||
168 | offset=<offset of object into slab> flags=<slabflags> | ||
169 | inuse=<objects in use in this slab> freelist=<first free object in slab> | ||
170 | |||
171 | 2. Report on how the problem was dealt with in order to ensure the continued | ||
172 | operation of the system. | ||
173 | |||
174 | These are messages in the system log beginning with | ||
175 | |||
176 | @@@ SLUB <slab cache affected>: <corrective action taken> | ||
177 | |||
178 | |||
179 | In the above sample SLUB found that the Redzone of an active object has | ||
180 | been overwritten. Here a string of 8 characters was written into a slab that | ||
181 | has the length of 8 characters. However, a 8 character string needs a | ||
182 | terminating 0. That zero has overwritten the first byte of the Redzone field. | ||
183 | After reporting the details of the issue encountered the @@@ SLUB message | ||
184 | tell us that SLUB has restored the redzone to its proper value and then | ||
185 | system operations continue. | ||
186 | |||
187 | Various types of lines can follow the @@@ SLUB line: | ||
188 | |||
189 | Bytes b4 <address> : <bytes> | ||
190 | Show a few bytes before the object where the problem was detected. | ||
191 | Can be useful if the corruption does not stop with the start of the | ||
192 | object. | ||
193 | |||
194 | Object <address> : <bytes> | ||
195 | The bytes of the object. If the object is inactive then the bytes | ||
196 | typically contain poisoning values. Any non-poison value shows a | ||
197 | corruption by a write after free. | ||
198 | |||
199 | Redzone <address> : <bytes> | ||
200 | The redzone following the object. The redzone is used to detect | ||
201 | writes after the object. All bytes should always have the same | ||
202 | value. If there is any deviation then it is due to a write after | ||
203 | the object boundary. | ||
204 | |||
205 | Freepointer | ||
206 | The pointer to the next free object in the slab. May become | ||
207 | corrupted if overwriting continues after the red zone. | ||
208 | |||
209 | Last alloc: | ||
210 | Last free: | ||
211 | Shows the address from which the object was allocated/freed last. | ||
212 | We note the pid, the time and the CPU that did so. This is usually | ||
213 | the most useful information to figure out where things went wrong. | ||
214 | Here get_modalias() did an kmalloc(8) instead of a kmalloc(9). | ||
215 | |||
216 | Filler <address> : <bytes> | ||
217 | Unused data to fill up the space in order to get the next object | ||
218 | properly aligned. In the debug case we make sure that there are | ||
219 | at least 4 bytes of filler. This allow for the detection of writes | ||
220 | before the object. | ||
221 | |||
222 | Following the filler will be a stackdump. That stackdump describes the | ||
223 | location where the error was detected. The cause of the corruption is more | ||
224 | likely to be found by looking at the information about the last alloc / free. | ||
225 | |||
226 | Christoph Lameter, <clameter@sgi.com>, May 23, 2007 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 953291d08c76..4cc17b993b6a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2334,7 +2334,7 @@ S: Maintained | |||
2334 | 2334 | ||
2335 | MEGARAID SCSI DRIVERS | 2335 | MEGARAID SCSI DRIVERS |
2336 | P: Neela Syam Kolli | 2336 | P: Neela Syam Kolli |
2337 | M: Neela.Kolli@engenio.com | 2337 | M: megaraidlinux@lsi.com |
2338 | S: linux-scsi@vger.kernel.org | 2338 | S: linux-scsi@vger.kernel.org |
2339 | W: http://megaraid.lsilogic.com | 2339 | W: http://megaraid.lsilogic.com |
2340 | S: Maintained | 2340 | S: Maintained |
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index c95e95e1ab04..debc8f03886c 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S | |||
@@ -391,11 +391,10 @@ $work_resched: | |||
391 | bne $2, $work_resched | 391 | bne $2, $work_resched |
392 | 392 | ||
393 | $work_notifysig: | 393 | $work_notifysig: |
394 | mov $sp, $17 | 394 | mov $sp, $16 |
395 | br $1, do_switch_stack | 395 | br $1, do_switch_stack |
396 | mov $5, $21 | 396 | mov $sp, $17 |
397 | mov $sp, $18 | 397 | mov $5, $18 |
398 | mov $31, $16 | ||
399 | jsr $26, do_notify_resume | 398 | jsr $26, do_notify_resume |
400 | bsr $1, undo_switch_stack | 399 | bsr $1, undo_switch_stack |
401 | br restore_all | 400 | br restore_all |
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c index 6e7d1fe6e935..28c84e55feb9 100644 --- a/arch/alpha/kernel/pci_iommu.c +++ b/arch/alpha/kernel/pci_iommu.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/pci.h> | 7 | #include <linux/pci.h> |
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <linux/bootmem.h> | 9 | #include <linux/bootmem.h> |
10 | #include <linux/log2.h> | ||
10 | 11 | ||
11 | #include <asm/io.h> | 12 | #include <asm/io.h> |
12 | #include <asm/hwrpb.h> | 13 | #include <asm/hwrpb.h> |
@@ -53,7 +54,7 @@ size_for_memory(unsigned long max) | |||
53 | { | 54 | { |
54 | unsigned long mem = max_low_pfn << PAGE_SHIFT; | 55 | unsigned long mem = max_low_pfn << PAGE_SHIFT; |
55 | if (mem < max) | 56 | if (mem < max) |
56 | max = 1UL << ceil_log2(mem); | 57 | max = roundup_pow_of_two(mem); |
57 | return max; | 58 | return max; |
58 | } | 59 | } |
59 | 60 | ||
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index 915f26345c45..bd5e68cd61e8 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/notifier.h> | 43 | #include <linux/notifier.h> |
44 | #include <asm/setup.h> | 44 | #include <asm/setup.h> |
45 | #include <asm/io.h> | 45 | #include <asm/io.h> |
46 | #include <linux/log2.h> | ||
46 | 47 | ||
47 | extern struct atomic_notifier_head panic_notifier_list; | 48 | extern struct atomic_notifier_head panic_notifier_list; |
48 | static int alpha_panic_event(struct notifier_block *, unsigned long, void *); | 49 | static int alpha_panic_event(struct notifier_block *, unsigned long, void *); |
@@ -1303,7 +1304,7 @@ external_cache_probe(int minsize, int width) | |||
1303 | long size = minsize, maxsize = MAX_BCACHE_SIZE * 2; | 1304 | long size = minsize, maxsize = MAX_BCACHE_SIZE * 2; |
1304 | 1305 | ||
1305 | if (maxsize > (max_low_pfn + 1) << PAGE_SHIFT) | 1306 | if (maxsize > (max_low_pfn + 1) << PAGE_SHIFT) |
1306 | maxsize = 1 << (floor_log2(max_low_pfn + 1) + PAGE_SHIFT); | 1307 | maxsize = 1 << (ilog2(max_low_pfn + 1) + PAGE_SHIFT); |
1307 | 1308 | ||
1308 | /* Get the first block cached. */ | 1309 | /* Get the first block cached. */ |
1309 | read_mem_block(__va(0), stride, size); | 1310 | read_mem_block(__va(0), stride, size); |
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c index 7f64aa767d5a..410af4f3140e 100644 --- a/arch/alpha/kernel/signal.c +++ b/arch/alpha/kernel/signal.c | |||
@@ -32,8 +32,8 @@ | |||
32 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 32 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
33 | 33 | ||
34 | asmlinkage void ret_from_sys_call(void); | 34 | asmlinkage void ret_from_sys_call(void); |
35 | static int do_signal(sigset_t *, struct pt_regs *, struct switch_stack *, | 35 | static void do_signal(struct pt_regs *, struct switch_stack *, |
36 | unsigned long, unsigned long); | 36 | unsigned long, unsigned long); |
37 | 37 | ||
38 | 38 | ||
39 | /* | 39 | /* |
@@ -146,11 +146,9 @@ sys_rt_sigaction(int sig, const struct sigaction __user *act, | |||
146 | asmlinkage int | 146 | asmlinkage int |
147 | do_sigsuspend(old_sigset_t mask, struct pt_regs *regs, struct switch_stack *sw) | 147 | do_sigsuspend(old_sigset_t mask, struct pt_regs *regs, struct switch_stack *sw) |
148 | { | 148 | { |
149 | sigset_t oldset; | ||
150 | |||
151 | mask &= _BLOCKABLE; | 149 | mask &= _BLOCKABLE; |
152 | spin_lock_irq(¤t->sighand->siglock); | 150 | spin_lock_irq(¤t->sighand->siglock); |
153 | oldset = current->blocked; | 151 | current->saved_sigmask = current->blocked; |
154 | siginitset(¤t->blocked, mask); | 152 | siginitset(¤t->blocked, mask); |
155 | recalc_sigpending(); | 153 | recalc_sigpending(); |
156 | spin_unlock_irq(¤t->sighand->siglock); | 154 | spin_unlock_irq(¤t->sighand->siglock); |
@@ -160,19 +158,17 @@ do_sigsuspend(old_sigset_t mask, struct pt_regs *regs, struct switch_stack *sw) | |||
160 | regs->r0 = EINTR; | 158 | regs->r0 = EINTR; |
161 | regs->r19 = 1; | 159 | regs->r19 = 1; |
162 | 160 | ||
163 | while (1) { | 161 | current->state = TASK_INTERRUPTIBLE; |
164 | current->state = TASK_INTERRUPTIBLE; | 162 | schedule(); |
165 | schedule(); | 163 | set_thread_flag(TIF_RESTORE_SIGMASK); |
166 | if (do_signal(&oldset, regs, sw, 0, 0)) | 164 | return -ERESTARTNOHAND; |
167 | return -EINTR; | ||
168 | } | ||
169 | } | 165 | } |
170 | 166 | ||
171 | asmlinkage int | 167 | asmlinkage int |
172 | do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, | 168 | do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, |
173 | struct pt_regs *regs, struct switch_stack *sw) | 169 | struct pt_regs *regs, struct switch_stack *sw) |
174 | { | 170 | { |
175 | sigset_t oldset, set; | 171 | sigset_t set; |
176 | 172 | ||
177 | /* XXX: Don't preclude handling different sized sigset_t's. */ | 173 | /* XXX: Don't preclude handling different sized sigset_t's. */ |
178 | if (sigsetsize != sizeof(sigset_t)) | 174 | if (sigsetsize != sizeof(sigset_t)) |
@@ -182,7 +178,7 @@ do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, | |||
182 | 178 | ||
183 | sigdelsetmask(&set, ~_BLOCKABLE); | 179 | sigdelsetmask(&set, ~_BLOCKABLE); |
184 | spin_lock_irq(¤t->sighand->siglock); | 180 | spin_lock_irq(¤t->sighand->siglock); |
185 | oldset = current->blocked; | 181 | current->saved_sigmask = current->blocked; |
186 | current->blocked = set; | 182 | current->blocked = set; |
187 | recalc_sigpending(); | 183 | recalc_sigpending(); |
188 | spin_unlock_irq(¤t->sighand->siglock); | 184 | spin_unlock_irq(¤t->sighand->siglock); |
@@ -192,12 +188,10 @@ do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, | |||
192 | regs->r0 = EINTR; | 188 | regs->r0 = EINTR; |
193 | regs->r19 = 1; | 189 | regs->r19 = 1; |
194 | 190 | ||
195 | while (1) { | 191 | current->state = TASK_INTERRUPTIBLE; |
196 | current->state = TASK_INTERRUPTIBLE; | 192 | schedule(); |
197 | schedule(); | 193 | set_thread_flag(TIF_RESTORE_SIGMASK); |
198 | if (do_signal(&oldset, regs, sw, 0, 0)) | 194 | return -ERESTARTNOHAND; |
199 | return -EINTR; | ||
200 | } | ||
201 | } | 195 | } |
202 | 196 | ||
203 | asmlinkage int | 197 | asmlinkage int |
@@ -436,7 +430,7 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, | |||
436 | return err; | 430 | return err; |
437 | } | 431 | } |
438 | 432 | ||
439 | static void | 433 | static int |
440 | setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, | 434 | setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, |
441 | struct pt_regs *regs, struct switch_stack * sw) | 435 | struct pt_regs *regs, struct switch_stack * sw) |
442 | { | 436 | { |
@@ -481,13 +475,14 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, | |||
481 | current->comm, current->pid, frame, regs->pc, regs->r26); | 475 | current->comm, current->pid, frame, regs->pc, regs->r26); |
482 | #endif | 476 | #endif |
483 | 477 | ||
484 | return; | 478 | return 0; |
485 | 479 | ||
486 | give_sigsegv: | 480 | give_sigsegv: |
487 | force_sigsegv(sig, current); | 481 | force_sigsegv(sig, current); |
482 | return -EFAULT; | ||
488 | } | 483 | } |
489 | 484 | ||
490 | static void | 485 | static int |
491 | setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 486 | setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
492 | sigset_t *set, struct pt_regs *regs, struct switch_stack * sw) | 487 | sigset_t *set, struct pt_regs *regs, struct switch_stack * sw) |
493 | { | 488 | { |
@@ -543,34 +538,38 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
543 | current->comm, current->pid, frame, regs->pc, regs->r26); | 538 | current->comm, current->pid, frame, regs->pc, regs->r26); |
544 | #endif | 539 | #endif |
545 | 540 | ||
546 | return; | 541 | return 0; |
547 | 542 | ||
548 | give_sigsegv: | 543 | give_sigsegv: |
549 | force_sigsegv(sig, current); | 544 | force_sigsegv(sig, current); |
545 | return -EFAULT; | ||
550 | } | 546 | } |
551 | 547 | ||
552 | 548 | ||
553 | /* | 549 | /* |
554 | * OK, we're invoking a handler. | 550 | * OK, we're invoking a handler. |
555 | */ | 551 | */ |
556 | static inline void | 552 | static inline int |
557 | handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, | 553 | handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, |
558 | sigset_t *oldset, struct pt_regs * regs, struct switch_stack *sw) | 554 | sigset_t *oldset, struct pt_regs * regs, struct switch_stack *sw) |
559 | { | 555 | { |
556 | int ret; | ||
557 | |||
560 | if (ka->sa.sa_flags & SA_SIGINFO) | 558 | if (ka->sa.sa_flags & SA_SIGINFO) |
561 | setup_rt_frame(sig, ka, info, oldset, regs, sw); | 559 | ret = setup_rt_frame(sig, ka, info, oldset, regs, sw); |
562 | else | 560 | else |
563 | setup_frame(sig, ka, oldset, regs, sw); | 561 | ret = setup_frame(sig, ka, oldset, regs, sw); |
564 | 562 | ||
565 | if (ka->sa.sa_flags & SA_RESETHAND) | 563 | if (ret == 0) { |
566 | ka->sa.sa_handler = SIG_DFL; | 564 | spin_lock_irq(¤t->sighand->siglock); |
565 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | ||
566 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
567 | sigaddset(¤t->blocked,sig); | ||
568 | recalc_sigpending(); | ||
569 | spin_unlock_irq(¤t->sighand->siglock); | ||
570 | } | ||
567 | 571 | ||
568 | spin_lock_irq(¤t->sighand->siglock); | 572 | return ret; |
569 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | ||
570 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
571 | sigaddset(¤t->blocked,sig); | ||
572 | recalc_sigpending(); | ||
573 | spin_unlock_irq(¤t->sighand->siglock); | ||
574 | } | 573 | } |
575 | 574 | ||
576 | static inline void | 575 | static inline void |
@@ -611,30 +610,42 @@ syscall_restart(unsigned long r0, unsigned long r19, | |||
611 | * restart. "r0" is also used as an indicator whether we can restart at | 610 | * restart. "r0" is also used as an indicator whether we can restart at |
612 | * all (if we get here from anything but a syscall return, it will be 0) | 611 | * all (if we get here from anything but a syscall return, it will be 0) |
613 | */ | 612 | */ |
614 | static int | 613 | static void |
615 | do_signal(sigset_t *oldset, struct pt_regs * regs, struct switch_stack * sw, | 614 | do_signal(struct pt_regs * regs, struct switch_stack * sw, |
616 | unsigned long r0, unsigned long r19) | 615 | unsigned long r0, unsigned long r19) |
617 | { | 616 | { |
618 | siginfo_t info; | 617 | siginfo_t info; |
619 | int signr; | 618 | int signr; |
620 | unsigned long single_stepping = ptrace_cancel_bpt(current); | 619 | unsigned long single_stepping = ptrace_cancel_bpt(current); |
621 | struct k_sigaction ka; | 620 | struct k_sigaction ka; |
621 | sigset_t *oldset; | ||
622 | 622 | ||
623 | if (!oldset) | 623 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
624 | oldset = ¤t->saved_sigmask; | ||
625 | else | ||
624 | oldset = ¤t->blocked; | 626 | oldset = ¤t->blocked; |
625 | 627 | ||
626 | /* This lets the debugger run, ... */ | 628 | /* This lets the debugger run, ... */ |
627 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 629 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
630 | |||
628 | /* ... so re-check the single stepping. */ | 631 | /* ... so re-check the single stepping. */ |
629 | single_stepping |= ptrace_cancel_bpt(current); | 632 | single_stepping |= ptrace_cancel_bpt(current); |
630 | 633 | ||
631 | if (signr > 0) { | 634 | if (signr > 0) { |
632 | /* Whee! Actually deliver the signal. */ | 635 | /* Whee! Actually deliver the signal. */ |
633 | if (r0) syscall_restart(r0, r19, regs, &ka); | 636 | if (r0) |
634 | handle_signal(signr, &ka, &info, oldset, regs, sw); | 637 | syscall_restart(r0, r19, regs, &ka); |
638 | if (handle_signal(signr, &ka, &info, oldset, regs, sw) == 0) { | ||
639 | /* A signal was successfully delivered, and the | ||
640 | saved sigmask was stored on the signal frame, | ||
641 | and will be restored by sigreturn. So we can | ||
642 | simply clear the restore sigmask flag. */ | ||
643 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | ||
644 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
645 | } | ||
635 | if (single_stepping) | 646 | if (single_stepping) |
636 | ptrace_set_bpt(current); /* re-set bpt */ | 647 | ptrace_set_bpt(current); /* re-set bpt */ |
637 | return 1; | 648 | return; |
638 | } | 649 | } |
639 | 650 | ||
640 | if (r0) { | 651 | if (r0) { |
@@ -654,17 +665,22 @@ do_signal(sigset_t *oldset, struct pt_regs * regs, struct switch_stack * sw, | |||
654 | break; | 665 | break; |
655 | } | 666 | } |
656 | } | 667 | } |
668 | |||
669 | /* If there's no signal to deliver, we just restore the saved mask. */ | ||
670 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | ||
671 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
672 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
673 | } | ||
674 | |||
657 | if (single_stepping) | 675 | if (single_stepping) |
658 | ptrace_set_bpt(current); /* re-set breakpoint */ | 676 | ptrace_set_bpt(current); /* re-set breakpoint */ |
659 | |||
660 | return 0; | ||
661 | } | 677 | } |
662 | 678 | ||
663 | void | 679 | void |
664 | do_notify_resume(sigset_t *oldset, struct pt_regs *regs, | 680 | do_notify_resume(struct pt_regs *regs, struct switch_stack *sw, |
665 | struct switch_stack *sw, unsigned long r0, | 681 | unsigned long thread_info_flags, |
666 | unsigned long r19, unsigned long thread_info_flags) | 682 | unsigned long r0, unsigned long r19) |
667 | { | 683 | { |
668 | if (thread_info_flags & _TIF_SIGPENDING) | 684 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) |
669 | do_signal(oldset, regs, sw, r0, r19); | 685 | do_signal(regs, sw, r0, r19); |
670 | } | 686 | } |
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S index f6cfe8ce3f96..79de99e32c35 100644 --- a/arch/alpha/kernel/systbls.S +++ b/arch/alpha/kernel/systbls.S | |||
@@ -465,6 +465,38 @@ sys_call_table: | |||
465 | .quad sys_inotify_init | 465 | .quad sys_inotify_init |
466 | .quad sys_inotify_add_watch /* 445 */ | 466 | .quad sys_inotify_add_watch /* 445 */ |
467 | .quad sys_inotify_rm_watch | 467 | .quad sys_inotify_rm_watch |
468 | .quad sys_fdatasync | ||
469 | .quad sys_kexec_load | ||
470 | .quad sys_migrate_pages | ||
471 | .quad sys_openat /* 450 */ | ||
472 | .quad sys_mkdirat | ||
473 | .quad sys_mknodat | ||
474 | .quad sys_fchownat | ||
475 | .quad sys_futimesat | ||
476 | .quad sys_fstatat64 /* 455 */ | ||
477 | .quad sys_unlinkat | ||
478 | .quad sys_renameat | ||
479 | .quad sys_linkat | ||
480 | .quad sys_symlinkat | ||
481 | .quad sys_readlinkat /* 460 */ | ||
482 | .quad sys_fchmodat | ||
483 | .quad sys_faccessat | ||
484 | .quad sys_pselect6 | ||
485 | .quad sys_ppoll | ||
486 | .quad sys_unshare /* 465 */ | ||
487 | .quad sys_set_robust_list | ||
488 | .quad sys_get_robust_list | ||
489 | .quad sys_splice | ||
490 | .quad sys_sync_file_range | ||
491 | .quad sys_tee /* 470 */ | ||
492 | .quad sys_vmsplice | ||
493 | .quad sys_move_pages | ||
494 | .quad sys_getcpu | ||
495 | .quad sys_epoll_pwait | ||
496 | .quad sys_utimensat /* 475 */ | ||
497 | .quad sys_signalfd | ||
498 | .quad sys_timerfd | ||
499 | .quad sys_eventfd | ||
468 | 500 | ||
469 | .size sys_call_table, . - sys_call_table | 501 | .size sys_call_table, . - sys_call_table |
470 | .type sys_call_table, @object | 502 | .type sys_call_table, @object |
diff --git a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile index ea098f3b629f..266f78e13076 100644 --- a/arch/alpha/lib/Makefile +++ b/arch/alpha/lib/Makefile | |||
@@ -37,7 +37,8 @@ lib-y = __divqu.o __remqu.o __divlu.o __remlu.o \ | |||
37 | $(ev6-y)clear_page.o \ | 37 | $(ev6-y)clear_page.o \ |
38 | $(ev6-y)copy_page.o \ | 38 | $(ev6-y)copy_page.o \ |
39 | fpreg.o \ | 39 | fpreg.o \ |
40 | callback_srm.o srm_puts.o srm_printk.o | 40 | callback_srm.o srm_puts.o srm_printk.o \ |
41 | fls.o | ||
41 | 42 | ||
42 | lib-$(CONFIG_SMP) += dec_and_lock.o | 43 | lib-$(CONFIG_SMP) += dec_and_lock.o |
43 | 44 | ||
diff --git a/arch/alpha/lib/fls.c b/arch/alpha/lib/fls.c new file mode 100644 index 000000000000..7ad84ea0acf8 --- /dev/null +++ b/arch/alpha/lib/fls.c | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * arch/alpha/lib/fls.c | ||
3 | */ | ||
4 | |||
5 | #include <linux/module.h> | ||
6 | #include <asm/bitops.h> | ||
7 | |||
8 | /* This is fls(x)-1, except zero is held to zero. This allows most | ||
9 | efficent input into extbl, plus it allows easy handling of fls(0)=0. */ | ||
10 | |||
11 | const unsigned char __flsm1_tab[256] = | ||
12 | { | ||
13 | 0, | ||
14 | 0, | ||
15 | 1, 1, | ||
16 | 2, 2, 2, 2, | ||
17 | 3, 3, 3, 3, 3, 3, 3, 3, | ||
18 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | ||
19 | |||
20 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
21 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
22 | |||
23 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
24 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
25 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
26 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
27 | |||
28 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
29 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
30 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
31 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
32 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
33 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
34 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
35 | 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | ||
36 | }; | ||
37 | |||
38 | EXPORT_SYMBOL(__flsm1_tab); | ||
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index 9179e8220314..f73d62e8ab60 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c | |||
@@ -57,7 +57,7 @@ extern void fp_enter(void); | |||
57 | #define EXPORT_SYMBOL_ALIAS(sym,orig) \ | 57 | #define EXPORT_SYMBOL_ALIAS(sym,orig) \ |
58 | EXPORT_CRC_ALIAS(sym) \ | 58 | EXPORT_CRC_ALIAS(sym) \ |
59 | static const struct kernel_symbol __ksymtab_##sym \ | 59 | static const struct kernel_symbol __ksymtab_##sym \ |
60 | __attribute_used__ __attribute__((section("__ksymtab"))) = \ | 60 | __used __attribute__((section("__ksymtab"))) = \ |
61 | { (unsigned long)&orig, #sym }; | 61 | { (unsigned long)&orig, #sym }; |
62 | 62 | ||
63 | /* | 63 | /* |
diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index 8b63ad89d0a8..ae31deb2d065 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c | |||
@@ -13,7 +13,7 @@ int walk_stackframe(unsigned long fp, unsigned long low, unsigned long high, | |||
13 | /* | 13 | /* |
14 | * Check current frame pointer is within bounds | 14 | * Check current frame pointer is within bounds |
15 | */ | 15 | */ |
16 | if ((fp - 12) < low || fp + 4 >= high) | 16 | if (fp < (low + 12) || fp + 4 >= high) |
17 | break; | 17 | break; |
18 | 18 | ||
19 | frame = (struct stackframe *)(fp - 12); | 19 | frame = (struct stackframe *)(fp - 12); |
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c index 6043c38c0a9e..af497896a96c 100644 --- a/arch/arm/mach-at91/board-dk.c +++ b/arch/arm/mach-at91/board-dk.c | |||
@@ -132,7 +132,7 @@ static struct mtd_partition __initdata dk_nand_partition[] = { | |||
132 | }, | 132 | }, |
133 | }; | 133 | }; |
134 | 134 | ||
135 | static struct mtd_partition *nand_partitions(int size, int *num_partitions) | 135 | static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) |
136 | { | 136 | { |
137 | *num_partitions = ARRAY_SIZE(dk_nand_partition); | 137 | *num_partitions = ARRAY_SIZE(dk_nand_partition); |
138 | return dk_nand_partition; | 138 | return dk_nand_partition; |
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c index 76f6e1e553ea..7d9b1a278fd6 100644 --- a/arch/arm/mach-at91/board-kb9202.c +++ b/arch/arm/mach-at91/board-kb9202.c | |||
@@ -96,7 +96,7 @@ static struct mtd_partition __initdata kb9202_nand_partition[] = { | |||
96 | }, | 96 | }, |
97 | }; | 97 | }; |
98 | 98 | ||
99 | static struct mtd_partition *nand_partitions(int size, int *num_partitions) | 99 | static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) |
100 | { | 100 | { |
101 | *num_partitions = ARRAY_SIZE(kb9202_nand_partition); | 101 | *num_partitions = ARRAY_SIZE(kb9202_nand_partition); |
102 | return kb9202_nand_partition; | 102 | return kb9202_nand_partition; |
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index 1f0c8a400b3a..26ca8ab3f62a 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -178,7 +178,7 @@ static struct mtd_partition __initdata ek_nand_partition[] = { | |||
178 | }, | 178 | }, |
179 | }; | 179 | }; |
180 | 180 | ||
181 | static struct mtd_partition *nand_partitions(int size, int *num_partitions) | 181 | static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) |
182 | { | 182 | { |
183 | *num_partitions = ARRAY_SIZE(ek_nand_partition); | 183 | *num_partitions = ARRAY_SIZE(ek_nand_partition); |
184 | return ek_nand_partition; | 184 | return ek_nand_partition; |
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c index f57458559fb6..c164c8e58ae6 100644 --- a/arch/arm/mach-at91/board-sam9263ek.c +++ b/arch/arm/mach-at91/board-sam9263ek.c | |||
@@ -180,7 +180,7 @@ static struct mtd_partition __initdata ek_nand_partition[] = { | |||
180 | }, | 180 | }, |
181 | }; | 181 | }; |
182 | 182 | ||
183 | static struct mtd_partition *nand_partitions(int size, int *num_partitions) | 183 | static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) |
184 | { | 184 | { |
185 | *num_partitions = ARRAY_SIZE(ek_nand_partition); | 185 | *num_partitions = ARRAY_SIZE(ek_nand_partition); |
186 | return ek_nand_partition; | 186 | return ek_nand_partition; |
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c index 30c79aca84d4..9b61320f295a 100644 --- a/arch/arm/mach-at91/board-sam9rlek.c +++ b/arch/arm/mach-at91/board-sam9rlek.c | |||
@@ -87,7 +87,7 @@ static struct mtd_partition __initdata ek_nand_partition[] = { | |||
87 | }, | 87 | }, |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static struct mtd_partition *nand_partitions(int size, int *num_partitions) | 90 | static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) |
91 | { | 91 | { |
92 | *num_partitions = ARRAY_SIZE(ek_nand_partition); | 92 | *num_partitions = ARRAY_SIZE(ek_nand_partition); |
93 | return ek_nand_partition; | 93 | return ek_nand_partition; |
diff --git a/arch/arm/mach-footbridge/cats-pci.c b/arch/arm/mach-footbridge/cats-pci.c index 4f984fde7375..35eb232a649a 100644 --- a/arch/arm/mach-footbridge/cats-pci.c +++ b/arch/arm/mach-footbridge/cats-pci.c | |||
@@ -45,7 +45,7 @@ static struct hw_pci cats_pci __initdata = { | |||
45 | .postinit = dc21285_postinit, | 45 | .postinit = dc21285_postinit, |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static int cats_pci_init(void) | 48 | static int __init cats_pci_init(void) |
49 | { | 49 | { |
50 | if (machine_is_cats()) | 50 | if (machine_is_cats()) |
51 | pci_common_init(&cats_pci); | 51 | pci_common_init(&cats_pci); |
diff --git a/arch/arm/mach-imx/generic.c b/arch/arm/mach-imx/generic.c index 7a7fa51ec62c..1c474cf709ca 100644 --- a/arch/arm/mach-imx/generic.c +++ b/arch/arm/mach-imx/generic.c | |||
@@ -201,7 +201,6 @@ void __init imx_set_mmc_info(struct imxmmc_platform_data *info) | |||
201 | { | 201 | { |
202 | imx_mmc_device.dev.platform_data = info; | 202 | imx_mmc_device.dev.platform_data = info; |
203 | } | 203 | } |
204 | EXPORT_SYMBOL(imx_set_mmc_info); | ||
205 | 204 | ||
206 | static struct imxfb_mach_info imx_fb_info; | 205 | static struct imxfb_mach_info imx_fb_info; |
207 | 206 | ||
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c index 0fdd03ab36e6..ce7c15c73004 100644 --- a/arch/arm/mach-ixp2000/ixdp2400.c +++ b/arch/arm/mach-ixp2000/ixdp2400.c | |||
@@ -164,7 +164,7 @@ int __init ixdp2400_pci_init(void) | |||
164 | 164 | ||
165 | subsys_initcall(ixdp2400_pci_init); | 165 | subsys_initcall(ixdp2400_pci_init); |
166 | 166 | ||
167 | void ixdp2400_init_irq(void) | 167 | void __init ixdp2400_init_irq(void) |
168 | { | 168 | { |
169 | ixdp2x00_init_irq(IXDP2400_CPLD_INT_STAT, IXDP2400_CPLD_INT_MASK, IXDP2400_NR_IRQS); | 169 | ixdp2x00_init_irq(IXDP2400_CPLD_INT_STAT, IXDP2400_CPLD_INT_MASK, IXDP2400_NR_IRQS); |
170 | } | 170 | } |
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c index 70d247f09a7e..14f09b80ab77 100644 --- a/arch/arm/mach-ixp2000/ixdp2800.c +++ b/arch/arm/mach-ixp2000/ixdp2800.c | |||
@@ -279,7 +279,7 @@ int __init ixdp2800_pci_init(void) | |||
279 | 279 | ||
280 | subsys_initcall(ixdp2800_pci_init); | 280 | subsys_initcall(ixdp2800_pci_init); |
281 | 281 | ||
282 | void ixdp2800_init_irq(void) | 282 | void __init ixdp2800_init_irq(void) |
283 | { | 283 | { |
284 | ixdp2x00_init_irq(IXDP2800_CPLD_INT_STAT, IXDP2800_CPLD_INT_MASK, IXDP2800_NR_IRQS); | 284 | ixdp2x00_init_irq(IXDP2800_CPLD_INT_STAT, IXDP2800_CPLD_INT_MASK, IXDP2800_NR_IRQS); |
285 | } | 285 | } |
diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c index 011065b967b4..73c651e83d92 100644 --- a/arch/arm/mach-ixp2000/ixdp2x00.c +++ b/arch/arm/mach-ixp2000/ixdp2x00.c | |||
@@ -145,7 +145,7 @@ static struct irq_chip ixdp2x00_cpld_irq_chip = { | |||
145 | .unmask = ixdp2x00_irq_unmask | 145 | .unmask = ixdp2x00_irq_unmask |
146 | }; | 146 | }; |
147 | 147 | ||
148 | void ixdp2x00_init_irq(volatile unsigned long *stat_reg, volatile unsigned long *mask_reg, unsigned long nr_irqs) | 148 | void __init ixdp2x00_init_irq(volatile unsigned long *stat_reg, volatile unsigned long *mask_reg, unsigned long nr_irqs) |
149 | { | 149 | { |
150 | unsigned int irq; | 150 | unsigned int irq; |
151 | 151 | ||
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c index 7a86a2516eaa..c41a6b5a0acc 100644 --- a/arch/arm/mach-ixp23xx/ixdp2351.c +++ b/arch/arm/mach-ixp23xx/ixdp2351.c | |||
@@ -124,7 +124,7 @@ static struct irq_chip ixdp2351_intb_chip = { | |||
124 | .unmask = ixdp2351_intb_unmask | 124 | .unmask = ixdp2351_intb_unmask |
125 | }; | 125 | }; |
126 | 126 | ||
127 | void ixdp2351_init_irq(void) | 127 | void __init ixdp2351_init_irq(void) |
128 | { | 128 | { |
129 | int irq; | 129 | int irq; |
130 | 130 | ||
diff --git a/arch/arm/mach-ixp23xx/pci.c b/arch/arm/mach-ixp23xx/pci.c index ac7d43d23c28..227f808dc0ec 100644 --- a/arch/arm/mach-ixp23xx/pci.c +++ b/arch/arm/mach-ixp23xx/pci.c | |||
@@ -284,7 +284,7 @@ int ixp23xx_pci_setup(int nr, struct pci_sys_data *sys) | |||
284 | return 1; | 284 | return 1; |
285 | } | 285 | } |
286 | 286 | ||
287 | void ixp23xx_pci_slave_init(void) | 287 | void __init ixp23xx_pci_slave_init(void) |
288 | { | 288 | { |
289 | ixp23xx_pci_common_init(); | 289 | ixp23xx_pci_common_init(); |
290 | } | 290 | } |
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c index d06e21b70de5..e35644961aa4 100644 --- a/arch/arm/mach-ixp23xx/roadrunner.c +++ b/arch/arm/mach-ixp23xx/roadrunner.c | |||
@@ -110,7 +110,7 @@ static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin) | |||
110 | return NO_IRQ; | 110 | return NO_IRQ; |
111 | } | 111 | } |
112 | 112 | ||
113 | static void roadrunner_pci_preinit(void) | 113 | static void __init roadrunner_pci_preinit(void) |
114 | { | 114 | { |
115 | set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQT_LOW); | 115 | set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQT_LOW); |
116 | set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQT_LOW); | 116 | set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQT_LOW); |
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig index 9715ef506c24..060909870b50 100644 --- a/arch/arm/mach-ixp4xx/Kconfig +++ b/arch/arm/mach-ixp4xx/Kconfig | |||
@@ -104,9 +104,6 @@ config MACH_DSMG600 | |||
104 | DSM-G600 RevA device. For more information on this platform, | 104 | DSM-G600 RevA device. For more information on this platform, |
105 | see http://www.nslu2-linux.org/wiki/DSMG600/HomePage | 105 | see http://www.nslu2-linux.org/wiki/DSMG600/HomePage |
106 | 106 | ||
107 | # | ||
108 | # Avila and IXDP share the same source for now. Will change in future | ||
109 | # | ||
110 | config ARCH_IXDP4XX | 107 | config ARCH_IXDP4XX |
111 | bool | 108 | bool |
112 | depends on ARCH_IXDP425 || MACH_IXDP465 || MACH_KIXRP435 | 109 | depends on ARCH_IXDP425 || MACH_IXDP465 || MACH_KIXRP435 |
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 64685da1462d..8112f726ffa0 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c | |||
@@ -283,7 +283,7 @@ static struct irqaction ixp4xx_timer_irq = { | |||
283 | .handler = ixp4xx_timer_interrupt, | 283 | .handler = ixp4xx_timer_interrupt, |
284 | }; | 284 | }; |
285 | 285 | ||
286 | static void __init ixp4xx_timer_init(void) | 286 | void __init ixp4xx_timer_init(void) |
287 | { | 287 | { |
288 | /* Reset/disable counter */ | 288 | /* Reset/disable counter */ |
289 | *IXP4XX_OSRT1 = 0; | 289 | *IXP4XX_OSRT1 = 0; |
diff --git a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c index 7bc94f3def1c..ad2e5b97966e 100644 --- a/arch/arm/mach-ixp4xx/coyote-pci.c +++ b/arch/arm/mach-ixp4xx/coyote-pci.c | |||
@@ -25,10 +25,6 @@ | |||
25 | 25 | ||
26 | #include <asm/mach/pci.h> | 26 | #include <asm/mach/pci.h> |
27 | 27 | ||
28 | extern void ixp4xx_pci_preinit(void); | ||
29 | extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); | ||
30 | extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); | ||
31 | |||
32 | void __init coyote_pci_preinit(void) | 28 | void __init coyote_pci_preinit(void) |
33 | { | 29 | { |
34 | set_irq_type(IRQ_COYOTE_PCI_SLOT0, IRQT_LOW); | 30 | set_irq_type(IRQ_COYOTE_PCI_SLOT0, IRQT_LOW); |
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c index 1caff65e22cc..1e75e105c4f7 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/mach-types.h> | 18 | #include <asm/mach-types.h> |
19 | #include <asm/mach/arch.h> | 19 | #include <asm/mach/arch.h> |
20 | #include <asm/mach/flash.h> | 20 | #include <asm/mach/flash.h> |
21 | #include <asm/mach/time.h> | ||
21 | 22 | ||
22 | static struct flash_platform_data dsmg600_flash_data = { | 23 | static struct flash_platform_data dsmg600_flash_data = { |
23 | .map_name = "cfi_probe", | 24 | .map_name = "cfi_probe", |
@@ -128,6 +129,19 @@ static void dsmg600_power_off(void) | |||
128 | gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); | 129 | gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); |
129 | } | 130 | } |
130 | 131 | ||
132 | static void __init dsmg600_timer_init(void) | ||
133 | { | ||
134 | /* The xtal on this machine is non-standard. */ | ||
135 | ixp4xx_timer_freq = DSMG600_FREQ; | ||
136 | |||
137 | /* Call standard timer_init function. */ | ||
138 | ixp4xx_timer_init(); | ||
139 | } | ||
140 | |||
141 | static struct sys_timer dsmg600_timer = { | ||
142 | .init = dsmg600_timer_init, | ||
143 | }; | ||
144 | |||
131 | static void __init dsmg600_init(void) | 145 | static void __init dsmg600_init(void) |
132 | { | 146 | { |
133 | ixp4xx_sys_init(); | 147 | ixp4xx_sys_init(); |
@@ -155,21 +169,13 @@ static void __init dsmg600_init(void) | |||
155 | #endif | 169 | #endif |
156 | } | 170 | } |
157 | 171 | ||
158 | static void __init dsmg600_fixup(struct machine_desc *desc, | ||
159 | struct tag *tags, char **cmdline, struct meminfo *mi) | ||
160 | { | ||
161 | /* The xtal on this machine is non-standard. */ | ||
162 | ixp4xx_timer_freq = DSMG600_FREQ; | ||
163 | } | ||
164 | |||
165 | MACHINE_START(DSMG600, "D-Link DSM-G600 RevA") | 172 | MACHINE_START(DSMG600, "D-Link DSM-G600 RevA") |
166 | /* Maintainer: www.nslu2-linux.org */ | 173 | /* Maintainer: www.nslu2-linux.org */ |
167 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, | 174 | .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, |
168 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, | 175 | .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, |
169 | .boot_params = 0x00000100, | 176 | .boot_params = 0x00000100, |
170 | .fixup = dsmg600_fixup, | ||
171 | .map_io = ixp4xx_map_io, | 177 | .map_io = ixp4xx_map_io, |
172 | .init_irq = ixp4xx_init_irq, | 178 | .init_irq = ixp4xx_init_irq, |
173 | .timer = &ixp4xx_timer, | 179 | .timer = &dsmg600_timer, |
174 | .init_machine = dsmg600_init, | 180 | .init_machine = dsmg600_init, |
175 | MACHINE_END | 181 | MACHINE_END |
diff --git a/arch/arm/mach-ixp4xx/ixdpg425-pci.c b/arch/arm/mach-ixp4xx/ixdpg425-pci.c index 509a95a692a4..d1e75b7dc3b1 100644 --- a/arch/arm/mach-ixp4xx/ixdpg425-pci.c +++ b/arch/arm/mach-ixp4xx/ixdpg425-pci.c | |||
@@ -23,10 +23,6 @@ | |||
23 | 23 | ||
24 | #include <asm/mach/pci.h> | 24 | #include <asm/mach/pci.h> |
25 | 25 | ||
26 | extern void ixp4xx_pci_preinit(void); | ||
27 | extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); | ||
28 | extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); | ||
29 | |||
30 | void __init ixdpg425_pci_preinit(void) | 26 | void __init ixdpg425_pci_preinit(void) |
31 | { | 27 | { |
32 | set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW); | 28 | set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW); |
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index 9a31444d9214..78a17413ceca 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c | |||
@@ -155,7 +155,8 @@ static void __init nas100d_init(void) | |||
155 | 155 | ||
156 | pm_power_off = nas100d_power_off; | 156 | pm_power_off = nas100d_power_off; |
157 | 157 | ||
158 | /* This is only useful on a modified machine, but it is valuable | 158 | /* |
159 | * This is only useful on a modified machine, but it is valuable | ||
159 | * to have it first in order to see debug messages, and so that | 160 | * to have it first in order to see debug messages, and so that |
160 | * it does *not* get removed if platform_add_devices fails! | 161 | * it does *not* get removed if platform_add_devices fails! |
161 | */ | 162 | */ |
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index 162c266e5f8f..9bf8ccbcaccf 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/mach-types.h> | 22 | #include <asm/mach-types.h> |
23 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
24 | #include <asm/mach/flash.h> | 24 | #include <asm/mach/flash.h> |
25 | #include <asm/mach/time.h> | ||
25 | 26 | ||
26 | static struct flash_platform_data nslu2_flash_data = { | 27 | static struct flash_platform_data nslu2_flash_data = { |
27 | .map_name = "cfi_probe", | 28 | .map_name = "cfi_probe", |
@@ -49,26 +50,26 @@ static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = { | |||
49 | static struct resource nslu2_led_resources[] = { | 50 | static struct resource nslu2_led_resources[] = { |
50 | { | 51 | { |
51 | .name = "ready", /* green led */ | 52 | .name = "ready", /* green led */ |
52 | .start = NSLU2_LED_GRN, | 53 | .start = NSLU2_LED_GRN_GPIO, |
53 | .end = NSLU2_LED_GRN, | 54 | .end = NSLU2_LED_GRN_GPIO, |
54 | .flags = IXP4XX_GPIO_HIGH, | 55 | .flags = IXP4XX_GPIO_HIGH, |
55 | }, | 56 | }, |
56 | { | 57 | { |
57 | .name = "status", /* red led */ | 58 | .name = "status", /* red led */ |
58 | .start = NSLU2_LED_RED, | 59 | .start = NSLU2_LED_RED_GPIO, |
59 | .end = NSLU2_LED_RED, | 60 | .end = NSLU2_LED_RED_GPIO, |
60 | .flags = IXP4XX_GPIO_HIGH, | 61 | .flags = IXP4XX_GPIO_HIGH, |
61 | }, | 62 | }, |
62 | { | 63 | { |
63 | .name = "disk-1", | 64 | .name = "disk-1", |
64 | .start = NSLU2_LED_DISK1, | 65 | .start = NSLU2_LED_DISK1_GPIO, |
65 | .end = NSLU2_LED_DISK1, | 66 | .end = NSLU2_LED_DISK1_GPIO, |
66 | .flags = IXP4XX_GPIO_LOW, | 67 | .flags = IXP4XX_GPIO_LOW, |
67 | }, | 68 | }, |
68 | { | 69 | { |
69 | .name = "disk-2", | 70 | .name = "disk-2", |
70 | .start = NSLU2_LED_DISK2, | 71 | .start = NSLU2_LED_DISK2_GPIO, |
71 | .end = NSLU2_LED_DISK2, | 72 | .end = NSLU2_LED_DISK2_GPIO, |
72 | .flags = IXP4XX_GPIO_LOW, | 73 | .flags = IXP4XX_GPIO_LOW, |
73 | }, | 74 | }, |
74 | }; | 75 | }; |
@@ -157,10 +158,21 @@ static void nslu2_power_off(void) | |||
157 | gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); | 158 | gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); |
158 | } | 159 | } |
159 | 160 | ||
160 | static void __init nslu2_init(void) | 161 | static void __init nslu2_timer_init(void) |
161 | { | 162 | { |
162 | ixp4xx_timer_freq = NSLU2_FREQ; | 163 | /* The xtal on this machine is non-standard. */ |
164 | ixp4xx_timer_freq = NSLU2_FREQ; | ||
165 | |||
166 | /* Call standard timer_init function. */ | ||
167 | ixp4xx_timer_init(); | ||
168 | } | ||
163 | 169 | ||
170 | static struct sys_timer nslu2_timer = { | ||
171 | .init = nslu2_timer_init, | ||
172 | }; | ||
173 | |||
174 | static void __init nslu2_init(void) | ||
175 | { | ||
164 | ixp4xx_sys_init(); | 176 | ixp4xx_sys_init(); |
165 | 177 | ||
166 | nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); | 178 | nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); |
@@ -169,7 +181,8 @@ static void __init nslu2_init(void) | |||
169 | 181 | ||
170 | pm_power_off = nslu2_power_off; | 182 | pm_power_off = nslu2_power_off; |
171 | 183 | ||
172 | /* This is only useful on a modified machine, but it is valuable | 184 | /* |
185 | * This is only useful on a modified machine, but it is valuable | ||
173 | * to have it first in order to see debug messages, and so that | 186 | * to have it first in order to see debug messages, and so that |
174 | * it does *not* get removed if platform_add_devices fails! | 187 | * it does *not* get removed if platform_add_devices fails! |
175 | */ | 188 | */ |
@@ -185,6 +198,6 @@ MACHINE_START(NSLU2, "Linksys NSLU2") | |||
185 | .boot_params = 0x00000100, | 198 | .boot_params = 0x00000100, |
186 | .map_io = ixp4xx_map_io, | 199 | .map_io = ixp4xx_map_io, |
187 | .init_irq = ixp4xx_init_irq, | 200 | .init_irq = ixp4xx_init_irq, |
188 | .timer = &ixp4xx_timer, | 201 | .timer = &nslu2_timer, |
189 | .init_machine = nslu2_init, | 202 | .init_machine = nslu2_init, |
190 | MACHINE_END | 203 | MACHINE_END |
diff --git a/arch/arm/mach-s3c2410/bast.h b/arch/arm/mach-s3c2410/bast.h deleted file mode 100644 index e98543742eb9..000000000000 --- a/arch/arm/mach-s3c2410/bast.h +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/bast.h | ||
2 | extern void bast_init_irq(void); | ||
diff --git a/arch/arm/mach-s3c2410/mach-amlm5900.c b/arch/arm/mach-s3c2410/mach-amlm5900.c index bc308ceb91c3..435adcce6482 100644 --- a/arch/arm/mach-s3c2410/mach-amlm5900.c +++ b/arch/arm/mach-s3c2410/mach-amlm5900.c | |||
@@ -160,7 +160,7 @@ static struct platform_device *amlm5900_devices[] __initdata = { | |||
160 | #endif | 160 | #endif |
161 | }; | 161 | }; |
162 | 162 | ||
163 | void __init amlm5900_map_io(void) | 163 | static void __init amlm5900_map_io(void) |
164 | { | 164 | { |
165 | s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); | 165 | s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); |
166 | s3c24xx_init_clocks(0); | 166 | s3c24xx_init_clocks(0); |
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c index c602aa39f9c4..782b5814ced2 100644 --- a/arch/arm/mach-s3c2412/s3c2412.c +++ b/arch/arm/mach-s3c2412/s3c2412.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/list.h> | 16 | #include <linux/list.h> |
17 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/delay.h> | ||
19 | #include <linux/sysdev.h> | 20 | #include <linux/sysdev.h> |
20 | #include <linux/serial_core.h> | 21 | #include <linux/serial_core.h> |
21 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
@@ -29,6 +30,7 @@ | |||
29 | #include <asm/io.h> | 30 | #include <asm/io.h> |
30 | #include <asm/irq.h> | 31 | #include <asm/irq.h> |
31 | 32 | ||
33 | #include <asm/arch/reset.h> | ||
32 | #include <asm/arch/idle.h> | 34 | #include <asm/arch/idle.h> |
33 | 35 | ||
34 | #include <asm/arch/regs-clock.h> | 36 | #include <asm/arch/regs-clock.h> |
@@ -38,6 +40,7 @@ | |||
38 | #include <asm/arch/regs-gpioj.h> | 40 | #include <asm/arch/regs-gpioj.h> |
39 | #include <asm/arch/regs-dsc.h> | 41 | #include <asm/arch/regs-dsc.h> |
40 | #include <asm/arch/regs-spi.h> | 42 | #include <asm/arch/regs-spi.h> |
43 | #include <asm/arch/regs-s3c2412.h> | ||
41 | 44 | ||
42 | #include <asm/plat-s3c24xx/s3c2412.h> | 45 | #include <asm/plat-s3c24xx/s3c2412.h> |
43 | #include <asm/plat-s3c24xx/cpu.h> | 46 | #include <asm/plat-s3c24xx/cpu.h> |
@@ -106,6 +109,23 @@ static void s3c2412_idle(void) | |||
106 | cpu_do_idle(); | 109 | cpu_do_idle(); |
107 | } | 110 | } |
108 | 111 | ||
112 | static void s3c2412_hard_reset(void) | ||
113 | { | ||
114 | /* errata "Watch-dog/Software Reset Problem" specifies that | ||
115 | * this reset must be done with the SYSCLK sourced from | ||
116 | * EXTCLK instead of FOUT to avoid a glitch in the reset | ||
117 | * mechanism. | ||
118 | * | ||
119 | * See the watchdog section of the S3C2412 manual for more | ||
120 | * information on this fix. | ||
121 | */ | ||
122 | |||
123 | __raw_writel(0x00, S3C2412_CLKSRC); | ||
124 | __raw_writel(S3C2412_SWRST_RESET, S3C2412_SWRST); | ||
125 | |||
126 | mdelay(1); | ||
127 | } | ||
128 | |||
109 | /* s3c2412_map_io | 129 | /* s3c2412_map_io |
110 | * | 130 | * |
111 | * register the standard cpu IO areas, and any passed in from the | 131 | * register the standard cpu IO areas, and any passed in from the |
@@ -122,6 +142,10 @@ void __init s3c2412_map_io(struct map_desc *mach_desc, int mach_size) | |||
122 | 142 | ||
123 | s3c24xx_idle = s3c2412_idle; | 143 | s3c24xx_idle = s3c2412_idle; |
124 | 144 | ||
145 | /* set custom reset hook */ | ||
146 | |||
147 | s3c24xx_reset_hook = s3c2412_hard_reset; | ||
148 | |||
125 | /* register our io-tables */ | 149 | /* register our io-tables */ |
126 | 150 | ||
127 | iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc)); | 151 | iotable_init(s3c2412_iodesc, ARRAY_SIZE(s3c2412_iodesc)); |
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c index 5955efb5de8d..58402948c47c 100644 --- a/arch/arm/mach-s3c2443/clock.c +++ b/arch/arm/mach-s3c2443/clock.c | |||
@@ -394,7 +394,7 @@ static int s3c2443_setrate_usbhost(struct clk *clk, unsigned long rate) | |||
394 | return 0; | 394 | return 0; |
395 | } | 395 | } |
396 | 396 | ||
397 | struct clk clk_usb_bus_host = { | 397 | static struct clk clk_usb_bus_host = { |
398 | .name = "usb-bus-host-parent", | 398 | .name = "usb-bus-host-parent", |
399 | .id = -1, | 399 | .id = -1, |
400 | .parent = &clk_esysclk, | 400 | .parent = &clk_esysclk, |
@@ -758,7 +758,6 @@ static struct clk init_clocks[] = { | |||
758 | .parent = &clk_h, | 758 | .parent = &clk_h, |
759 | .enable = s3c2443_clkcon_enable_h, | 759 | .enable = s3c2443_clkcon_enable_h, |
760 | .ctrlbit = S3C2443_HCLKCON_CFC, | 760 | .ctrlbit = S3C2443_HCLKCON_CFC, |
761 | .ctrlbit = S3C2443_HCLKCON_HSMMC, | ||
762 | }, { | 761 | }, { |
763 | .name = "ssmc", | 762 | .name = "ssmc", |
764 | .id = -1, | 763 | .id = -1, |
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c index d7c038a0256b..4cbf9468f654 100644 --- a/arch/arm/mach-sa1100/neponset.c +++ b/arch/arm/mach-sa1100/neponset.c | |||
@@ -139,12 +139,12 @@ static u_int neponset_get_mctrl(struct uart_port *port) | |||
139 | return ret; | 139 | return ret; |
140 | } | 140 | } |
141 | 141 | ||
142 | static struct sa1100_port_fns neponset_port_fns __initdata = { | 142 | static struct sa1100_port_fns neponset_port_fns __devinitdata = { |
143 | .set_mctrl = neponset_set_mctrl, | 143 | .set_mctrl = neponset_set_mctrl, |
144 | .get_mctrl = neponset_get_mctrl, | 144 | .get_mctrl = neponset_get_mctrl, |
145 | }; | 145 | }; |
146 | 146 | ||
147 | static int neponset_probe(struct platform_device *dev) | 147 | static int __devinit neponset_probe(struct platform_device *dev) |
148 | { | 148 | { |
149 | sa1100_register_uart_fns(&neponset_port_fns); | 149 | sa1100_register_uart_fns(&neponset_port_fns); |
150 | 150 | ||
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index 5f472a8b406a..e7904bc92c73 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -379,7 +379,7 @@ config CPU_V7 | |||
379 | select CPU_CP15_MMU | 379 | select CPU_CP15_MMU |
380 | select CPU_HAS_ASID | 380 | select CPU_HAS_ASID |
381 | select CPU_COPY_V6 if MMU | 381 | select CPU_COPY_V6 if MMU |
382 | select CPU_TLB_V6 if MMU | 382 | select CPU_TLB_V7 if MMU |
383 | 383 | ||
384 | # Figure out what processor architecture version we should be using. | 384 | # Figure out what processor architecture version we should be using. |
385 | # This defines the compiler instruction set which depends on the machine type. | 385 | # This defines the compiler instruction set which depends on the machine type. |
@@ -498,6 +498,9 @@ config CPU_TLB_V4WBI | |||
498 | config CPU_TLB_V6 | 498 | config CPU_TLB_V6 |
499 | bool | 499 | bool |
500 | 500 | ||
501 | config CPU_TLB_V7 | ||
502 | bool | ||
503 | |||
501 | endif | 504 | endif |
502 | 505 | ||
503 | config CPU_HAS_ASID | 506 | config CPU_HAS_ASID |
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile index b5bd335ff14a..762702765fc3 100644 --- a/arch/arm/mm/Makefile +++ b/arch/arm/mm/Makefile | |||
@@ -46,6 +46,7 @@ obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o | |||
46 | obj-$(CONFIG_CPU_TLB_V4WB) += tlb-v4wb.o | 46 | obj-$(CONFIG_CPU_TLB_V4WB) += tlb-v4wb.o |
47 | obj-$(CONFIG_CPU_TLB_V4WBI) += tlb-v4wbi.o | 47 | obj-$(CONFIG_CPU_TLB_V4WBI) += tlb-v4wbi.o |
48 | obj-$(CONFIG_CPU_TLB_V6) += tlb-v6.o | 48 | obj-$(CONFIG_CPU_TLB_V6) += tlb-v6.o |
49 | obj-$(CONFIG_CPU_TLB_V7) += tlb-v7.o | ||
49 | 50 | ||
50 | obj-$(CONFIG_CPU_ARM610) += proc-arm6_7.o | 51 | obj-$(CONFIG_CPU_ARM610) += proc-arm6_7.o |
51 | obj-$(CONFIG_CPU_ARM710) += proc-arm6_7.o | 52 | obj-$(CONFIG_CPU_ARM710) += proc-arm6_7.o |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index dd823dd4a374..718f4782ee8b 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -256,7 +256,7 @@ __v7_proc_info: | |||
256 | .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP | 256 | .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP |
257 | .long cpu_v7_name | 257 | .long cpu_v7_name |
258 | .long v7_processor_functions | 258 | .long v7_processor_functions |
259 | .long v6wbi_tlb_fns | 259 | .long v7wbi_tlb_fns |
260 | .long v6_user_fns | 260 | .long v6_user_fns |
261 | .long v7_cache_fns | 261 | .long v7_cache_fns |
262 | .size __v7_proc_info, . - __v7_proc_info | 262 | .size __v7_proc_info, . - __v7_proc_info |
diff --git a/arch/arm/mm/tlb-v7.S b/arch/arm/mm/tlb-v7.S new file mode 100644 index 000000000000..b56dda8052f7 --- /dev/null +++ b/arch/arm/mm/tlb-v7.S | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mm/tlb-v7.S | ||
3 | * | ||
4 | * Copyright (C) 1997-2002 Russell King | ||
5 | * Modified for ARMv7 by Catalin Marinas | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * ARM architecture version 6 TLB handling functions. | ||
12 | * These assume a split I/D TLB. | ||
13 | */ | ||
14 | #include <linux/linkage.h> | ||
15 | #include <asm/asm-offsets.h> | ||
16 | #include <asm/page.h> | ||
17 | #include <asm/tlbflush.h> | ||
18 | #include "proc-macros.S" | ||
19 | |||
20 | /* | ||
21 | * v7wbi_flush_user_tlb_range(start, end, vma) | ||
22 | * | ||
23 | * Invalidate a range of TLB entries in the specified address space. | ||
24 | * | ||
25 | * - start - start address (may not be aligned) | ||
26 | * - end - end address (exclusive, may not be aligned) | ||
27 | * - vma - vma_struct describing address range | ||
28 | * | ||
29 | * It is assumed that: | ||
30 | * - the "Invalidate single entry" instruction will invalidate | ||
31 | * both the I and the D TLBs on Harvard-style TLBs | ||
32 | */ | ||
33 | ENTRY(v7wbi_flush_user_tlb_range) | ||
34 | vma_vm_mm r3, r2 @ get vma->vm_mm | ||
35 | mmid r3, r3 @ get vm_mm->context.id | ||
36 | dsb | ||
37 | mov r0, r0, lsr #PAGE_SHIFT @ align address | ||
38 | mov r1, r1, lsr #PAGE_SHIFT | ||
39 | asid r3, r3 @ mask ASID | ||
40 | orr r0, r3, r0, lsl #PAGE_SHIFT @ Create initial MVA | ||
41 | mov r1, r1, lsl #PAGE_SHIFT | ||
42 | vma_vm_flags r2, r2 @ get vma->vm_flags | ||
43 | 1: | ||
44 | mcr p15, 0, r0, c8, c6, 1 @ TLB invalidate D MVA (was 1) | ||
45 | tst r2, #VM_EXEC @ Executable area ? | ||
46 | mcrne p15, 0, r0, c8, c5, 1 @ TLB invalidate I MVA (was 1) | ||
47 | add r0, r0, #PAGE_SZ | ||
48 | cmp r0, r1 | ||
49 | blo 1b | ||
50 | mov ip, #0 | ||
51 | mcr p15, 0, ip, c7, c5, 6 @ flush BTAC/BTB | ||
52 | dsb | ||
53 | mov pc, lr | ||
54 | |||
55 | /* | ||
56 | * v7wbi_flush_kern_tlb_range(start,end) | ||
57 | * | ||
58 | * Invalidate a range of kernel TLB entries | ||
59 | * | ||
60 | * - start - start address (may not be aligned) | ||
61 | * - end - end address (exclusive, may not be aligned) | ||
62 | */ | ||
63 | ENTRY(v7wbi_flush_kern_tlb_range) | ||
64 | dsb | ||
65 | mov r0, r0, lsr #PAGE_SHIFT @ align address | ||
66 | mov r1, r1, lsr #PAGE_SHIFT | ||
67 | mov r0, r0, lsl #PAGE_SHIFT | ||
68 | mov r1, r1, lsl #PAGE_SHIFT | ||
69 | 1: | ||
70 | mcr p15, 0, r0, c8, c6, 1 @ TLB invalidate D MVA | ||
71 | mcr p15, 0, r0, c8, c5, 1 @ TLB invalidate I MVA | ||
72 | add r0, r0, #PAGE_SZ | ||
73 | cmp r0, r1 | ||
74 | blo 1b | ||
75 | mov r2, #0 | ||
76 | mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB | ||
77 | dsb | ||
78 | isb | ||
79 | mov pc, lr | ||
80 | |||
81 | .section ".text.init", #alloc, #execinstr | ||
82 | |||
83 | .type v7wbi_tlb_fns, #object | ||
84 | ENTRY(v7wbi_tlb_fns) | ||
85 | .long v7wbi_flush_user_tlb_range | ||
86 | .long v7wbi_flush_kern_tlb_range | ||
87 | .long v6wbi_tlb_flags | ||
88 | .size v7wbi_tlb_fns, . - v7wbi_tlb_fns | ||
diff --git a/arch/arm/nwfpe/softfloat.h b/arch/arm/nwfpe/softfloat.h index 0a3067452cd2..260fe29d73f5 100644 --- a/arch/arm/nwfpe/softfloat.h +++ b/arch/arm/nwfpe/softfloat.h | |||
@@ -273,4 +273,7 @@ static inline flag float64_lt_nocheck(float64 a, float64 b) | |||
273 | extern flag float32_is_nan( float32 a ); | 273 | extern flag float32_is_nan( float32 a ); |
274 | extern flag float64_is_nan( float64 a ); | 274 | extern flag float64_is_nan( float64 a ); |
275 | 275 | ||
276 | extern int32 float64_to_uint32( struct roundingData *roundData, float64 a ); | ||
277 | extern int32 float64_to_uint32_round_to_zero( float64 a ); | ||
278 | |||
276 | #endif | 279 | #endif |
diff --git a/arch/arm/oprofile/op_model_mpcore.c b/arch/arm/oprofile/op_model_mpcore.c index 898500718249..7791da791f5f 100644 --- a/arch/arm/oprofile/op_model_mpcore.c +++ b/arch/arm/oprofile/op_model_mpcore.c | |||
@@ -257,8 +257,13 @@ static void em_stop(void) | |||
257 | */ | 257 | */ |
258 | static void em_route_irq(int irq, unsigned int cpu) | 258 | static void em_route_irq(int irq, unsigned int cpu) |
259 | { | 259 | { |
260 | irq_desc[irq].affinity = cpumask_of_cpu(cpu); | 260 | struct irq_desc *desc = irq_desc + irq; |
261 | irq_desc[irq].chip->set_affinity(irq, cpumask_of_cpu(cpu)); | 261 | cpumask_t mask = cpumask_of_cpu(cpu); |
262 | |||
263 | spin_lock_irq(&desc->lock); | ||
264 | desc->affinity = mask; | ||
265 | desc->chip->set_affinity(irq, mask); | ||
266 | spin_unlock_irq(&desc->lock); | ||
262 | } | 267 | } |
263 | 268 | ||
264 | static int em_setup(void) | 269 | static int em_setup(void) |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 08f07a74a9d3..88baed1e7e83 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -943,10 +943,9 @@ exit: | |||
943 | 943 | ||
944 | static void smp_tune_scheduling(void) | 944 | static void smp_tune_scheduling(void) |
945 | { | 945 | { |
946 | unsigned long cachesize; /* kB */ | ||
947 | |||
948 | if (cpu_khz) { | 946 | if (cpu_khz) { |
949 | cachesize = boot_cpu_data.x86_cache_size; | 947 | /* cache size in kB */ |
948 | long cachesize = boot_cpu_data.x86_cache_size; | ||
950 | 949 | ||
951 | if (cachesize > 0) | 950 | if (cachesize > 0) |
952 | max_cache_size = cachesize * 1024; | 951 | max_cache_size = cachesize * 1024; |
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index b8536c7c0877..85cdd23b0447 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -355,8 +355,9 @@ config RMW_INSNS | |||
355 | adventurous. | 355 | adventurous. |
356 | 356 | ||
357 | config SINGLE_MEMORY_CHUNK | 357 | config SINGLE_MEMORY_CHUNK |
358 | bool "Use one physical chunk of memory only" | 358 | bool "Use one physical chunk of memory only" if ADVANCED && !SUN3 |
359 | depends on ADVANCED && !SUN3 | 359 | default y if SUN3 |
360 | select NEED_MULTIPLE_NODES | ||
360 | help | 361 | help |
361 | Ignore all but the first contiguous chunk of physical memory for VM | 362 | Ignore all but the first contiguous chunk of physical memory for VM |
362 | purposes. This will save a few bytes kernel size and may speed up | 363 | purposes. This will save a few bytes kernel size and may speed up |
@@ -377,6 +378,14 @@ config 060_WRITETHROUGH | |||
377 | is hardwired on. The 53c710 SCSI driver is known to suffer from | 378 | is hardwired on. The 53c710 SCSI driver is known to suffer from |
378 | this problem. | 379 | this problem. |
379 | 380 | ||
381 | config ARCH_DISCONTIGMEM_ENABLE | ||
382 | def_bool !SINGLE_MEMORY_CHUNK | ||
383 | |||
384 | config NODES_SHIFT | ||
385 | int | ||
386 | default "3" | ||
387 | depends on !SINGLE_MEMORY_CHUNK | ||
388 | |||
380 | source "mm/Kconfig" | 389 | source "mm/Kconfig" |
381 | 390 | ||
382 | endmenu | 391 | endmenu |
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile index c20831a7e1a9..aa383a5ea7ac 100644 --- a/arch/m68k/Makefile +++ b/arch/m68k/Makefile | |||
@@ -19,6 +19,7 @@ COMPILE_ARCH = $(shell uname -m) | |||
19 | # override top level makefile | 19 | # override top level makefile |
20 | AS += -m68020 | 20 | AS += -m68020 |
21 | LDFLAGS := -m m68kelf | 21 | LDFLAGS := -m m68kelf |
22 | LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds | ||
22 | ifneq ($(COMPILE_ARCH),$(ARCH)) | 23 | ifneq ($(COMPILE_ARCH),$(ARCH)) |
23 | # prefix for cross-compiling binaries | 24 | # prefix for cross-compiling binaries |
24 | CROSS_COMPILE = m68k-linux-gnu- | 25 | CROSS_COMPILE = m68k-linux-gnu- |
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile index 0b68ab8d63d1..a806208c7fb5 100644 --- a/arch/m68k/kernel/Makefile +++ b/arch/m68k/kernel/Makefile | |||
@@ -9,13 +9,12 @@ else | |||
9 | endif | 9 | endif |
10 | extra-y += vmlinux.lds | 10 | extra-y += vmlinux.lds |
11 | 11 | ||
12 | obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o \ | 12 | obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o module.o \ |
13 | sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o devres.o | 13 | sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o devres.o |
14 | 14 | ||
15 | devres-y = ../../../kernel/irq/devres.o | 15 | devres-y = ../../../kernel/irq/devres.o |
16 | 16 | ||
17 | obj-$(CONFIG_PCI) += bios32.o | 17 | obj-$(CONFIG_PCI) += bios32.o |
18 | obj-$(CONFIG_MODULES) += module.o | ||
19 | obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo | 18 | obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo |
20 | 19 | ||
21 | EXTRA_AFLAGS := -traditional | 20 | EXTRA_AFLAGS := -traditional |
diff --git a/arch/m68k/kernel/module.c b/arch/m68k/kernel/module.c index 3b1a2ff61ddc..774862bc6977 100644 --- a/arch/m68k/kernel/module.c +++ b/arch/m68k/kernel/module.c | |||
@@ -1,3 +1,9 @@ | |||
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 | |||
1 | #include <linux/moduleloader.h> | 7 | #include <linux/moduleloader.h> |
2 | #include <linux/elf.h> | 8 | #include <linux/elf.h> |
3 | #include <linux/vmalloc.h> | 9 | #include <linux/vmalloc.h> |
@@ -11,6 +17,8 @@ | |||
11 | #define DEBUGP(fmt...) | 17 | #define DEBUGP(fmt...) |
12 | #endif | 18 | #endif |
13 | 19 | ||
20 | #ifdef CONFIG_MODULES | ||
21 | |||
14 | void *module_alloc(unsigned long size) | 22 | void *module_alloc(unsigned long size) |
15 | { | 23 | { |
16 | if (size == 0) | 24 | if (size == 0) |
@@ -118,11 +126,32 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, | |||
118 | 126 | ||
119 | int module_finalize(const Elf_Ehdr *hdr, | 127 | int module_finalize(const Elf_Ehdr *hdr, |
120 | const Elf_Shdr *sechdrs, | 128 | const Elf_Shdr *sechdrs, |
121 | struct module *me) | 129 | struct module *mod) |
122 | { | 130 | { |
131 | module_fixup(mod, mod->arch.fixup_start, mod->arch.fixup_end); | ||
132 | |||
123 | return 0; | 133 | return 0; |
124 | } | 134 | } |
125 | 135 | ||
126 | void module_arch_cleanup(struct module *mod) | 136 | void module_arch_cleanup(struct module *mod) |
127 | { | 137 | { |
128 | } | 138 | } |
139 | |||
140 | #endif /* CONFIG_MODULES */ | ||
141 | |||
142 | void module_fixup(struct module *mod, struct m68k_fixup_info *start, | ||
143 | struct m68k_fixup_info *end) | ||
144 | { | ||
145 | struct m68k_fixup_info *fixup; | ||
146 | |||
147 | for (fixup = start; fixup < end; fixup++) { | ||
148 | switch (fixup->type) { | ||
149 | case m68k_fixup_memoffset: | ||
150 | *(u32 *)fixup->addr = m68k_memoffset; | ||
151 | break; | ||
152 | case m68k_fixup_vnode_shift: | ||
153 | *(u16 *)fixup->addr += m68k_virt_to_node_shift; | ||
154 | break; | ||
155 | } | ||
156 | } | ||
157 | } | ||
diff --git a/arch/m68k/kernel/module.lds b/arch/m68k/kernel/module.lds new file mode 100644 index 000000000000..fda94fa38243 --- /dev/null +++ b/arch/m68k/kernel/module.lds | |||
@@ -0,0 +1,7 @@ | |||
1 | SECTIONS { | ||
2 | .m68k_fixup : { | ||
3 | __start_fixup = .; | ||
4 | *(.m68k_fixup) | ||
5 | __stop_fixup = .; | ||
6 | } | ||
7 | } | ||
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c index 610319356691..215c7bd43924 100644 --- a/arch/m68k/kernel/setup.c +++ b/arch/m68k/kernel/setup.c | |||
@@ -60,14 +60,12 @@ extern unsigned long availmem; | |||
60 | int m68k_num_memory; | 60 | int m68k_num_memory; |
61 | int m68k_realnum_memory; | 61 | int m68k_realnum_memory; |
62 | EXPORT_SYMBOL(m68k_realnum_memory); | 62 | EXPORT_SYMBOL(m68k_realnum_memory); |
63 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
64 | unsigned long m68k_memoffset; | 63 | unsigned long m68k_memoffset; |
65 | EXPORT_SYMBOL(m68k_memoffset); | 64 | EXPORT_SYMBOL(m68k_memoffset); |
66 | #endif | ||
67 | struct mem_info m68k_memory[NUM_MEMINFO]; | 65 | struct mem_info m68k_memory[NUM_MEMINFO]; |
68 | EXPORT_SYMBOL(m68k_memory); | 66 | EXPORT_SYMBOL(m68k_memory); |
69 | 67 | ||
70 | static struct mem_info m68k_ramdisk; | 68 | struct mem_info m68k_ramdisk; |
71 | 69 | ||
72 | static char m68k_command_line[CL_SIZE]; | 70 | static char m68k_command_line[CL_SIZE]; |
73 | 71 | ||
@@ -208,9 +206,6 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record) | |||
208 | void __init setup_arch(char **cmdline_p) | 206 | void __init setup_arch(char **cmdline_p) |
209 | { | 207 | { |
210 | extern int _etext, _edata, _end; | 208 | extern int _etext, _edata, _end; |
211 | #ifndef CONFIG_SUN3 | ||
212 | unsigned long endmem, startmem; | ||
213 | #endif | ||
214 | int i; | 209 | int i; |
215 | 210 | ||
216 | /* The bootinfo is located right after the kernel bss */ | 211 | /* The bootinfo is located right after the kernel bss */ |
@@ -320,30 +315,16 @@ void __init setup_arch(char **cmdline_p) | |||
320 | panic("No configuration setup"); | 315 | panic("No configuration setup"); |
321 | } | 316 | } |
322 | 317 | ||
323 | #ifndef CONFIG_SUN3 | 318 | paging_init(); |
324 | startmem= m68k_memory[0].addr; | ||
325 | endmem = startmem + m68k_memory[0].size; | ||
326 | high_memory = (void *)PAGE_OFFSET; | ||
327 | for (i = 0; i < m68k_num_memory; i++) { | ||
328 | m68k_memory[i].size &= MASK_256K; | ||
329 | if (m68k_memory[i].addr < startmem) | ||
330 | startmem = m68k_memory[i].addr; | ||
331 | if (m68k_memory[i].addr+m68k_memory[i].size > endmem) | ||
332 | endmem = m68k_memory[i].addr+m68k_memory[i].size; | ||
333 | high_memory += m68k_memory[i].size; | ||
334 | } | ||
335 | |||
336 | availmem += init_bootmem_node(NODE_DATA(0), availmem >> PAGE_SHIFT, | ||
337 | startmem >> PAGE_SHIFT, endmem >> PAGE_SHIFT); | ||
338 | |||
339 | for (i = 0; i < m68k_num_memory; i++) | ||
340 | free_bootmem(m68k_memory[i].addr, m68k_memory[i].size); | ||
341 | |||
342 | reserve_bootmem(m68k_memory[0].addr, availmem - m68k_memory[0].addr); | ||
343 | 319 | ||
320 | #ifndef CONFIG_SUN3 | ||
321 | for (i = 1; i < m68k_num_memory; i++) | ||
322 | free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr, | ||
323 | m68k_memory[i].size); | ||
344 | #ifdef CONFIG_BLK_DEV_INITRD | 324 | #ifdef CONFIG_BLK_DEV_INITRD |
345 | if (m68k_ramdisk.size) { | 325 | if (m68k_ramdisk.size) { |
346 | reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size); | 326 | reserve_bootmem_node(__virt_to_node(phys_to_virt(m68k_ramdisk.addr)), |
327 | m68k_ramdisk.addr, m68k_ramdisk.size); | ||
347 | initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); | 328 | initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); |
348 | initrd_end = initrd_start + m68k_ramdisk.size; | 329 | initrd_end = initrd_start + m68k_ramdisk.size; |
349 | printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end); | 330 | printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end); |
@@ -362,8 +343,6 @@ void __init setup_arch(char **cmdline_p) | |||
362 | 343 | ||
363 | #endif /* !CONFIG_SUN3 */ | 344 | #endif /* !CONFIG_SUN3 */ |
364 | 345 | ||
365 | paging_init(); | ||
366 | |||
367 | /* set ISA defs early as possible */ | 346 | /* set ISA defs early as possible */ |
368 | #if defined(CONFIG_ISA) && defined(MULTI_ISA) | 347 | #if defined(CONFIG_ISA) && defined(MULTI_ISA) |
369 | #if defined(CONFIG_Q40) | 348 | #if defined(CONFIG_Q40) |
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds index 78f139226a1b..40f02b128f22 100644 --- a/arch/m68k/kernel/vmlinux-std.lds +++ b/arch/m68k/kernel/vmlinux-std.lds | |||
@@ -60,6 +60,11 @@ SECTIONS | |||
60 | __con_initcall_start = .; | 60 | __con_initcall_start = .; |
61 | .con_initcall.init : { *(.con_initcall.init) } | 61 | .con_initcall.init : { *(.con_initcall.init) } |
62 | __con_initcall_end = .; | 62 | __con_initcall_end = .; |
63 | .m68k_fixup : { | ||
64 | __start_fixup = .; | ||
65 | *(.m68k_fixup) | ||
66 | __stop_fixup = .; | ||
67 | } | ||
63 | SECURITY_INIT | 68 | SECURITY_INIT |
64 | #ifdef CONFIG_BLK_DEV_INITRD | 69 | #ifdef CONFIG_BLK_DEV_INITRD |
65 | . = ALIGN(8192); | 70 | . = ALIGN(8192); |
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds index c8999b2db23b..f06425b6d206 100644 --- a/arch/m68k/kernel/vmlinux-sun3.lds +++ b/arch/m68k/kernel/vmlinux-sun3.lds | |||
@@ -54,6 +54,11 @@ __init_begin = .; | |||
54 | __con_initcall_start = .; | 54 | __con_initcall_start = .; |
55 | .con_initcall.init : { *(.con_initcall.init) } | 55 | .con_initcall.init : { *(.con_initcall.init) } |
56 | __con_initcall_end = .; | 56 | __con_initcall_end = .; |
57 | .m68k_fixup : { | ||
58 | __start_fixup = .; | ||
59 | *(.m68k_fixup) | ||
60 | __stop_fixup = .; | ||
61 | } | ||
57 | SECURITY_INIT | 62 | SECURITY_INIT |
58 | #ifdef CONFIG_BLK_DEV_INITRD | 63 | #ifdef CONFIG_BLK_DEV_INITRD |
59 | . = ALIGN(8192); | 64 | . = ALIGN(8192); |
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c index ab90213e5c54..f1de19e1dde6 100644 --- a/arch/m68k/mm/init.c +++ b/arch/m68k/mm/init.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * to motorola.c and sun3mmu.c | 7 | * to motorola.c and sun3mmu.c |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/module.h> | ||
10 | #include <linux/signal.h> | 11 | #include <linux/signal.h> |
11 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
12 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
@@ -31,6 +32,37 @@ | |||
31 | 32 | ||
32 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); | 33 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); |
33 | 34 | ||
35 | static bootmem_data_t __initdata bootmem_data[MAX_NUMNODES]; | ||
36 | |||
37 | pg_data_t pg_data_map[MAX_NUMNODES]; | ||
38 | EXPORT_SYMBOL(pg_data_map); | ||
39 | |||
40 | int m68k_virt_to_node_shift; | ||
41 | |||
42 | #ifndef CONFIG_SINGLE_MEMORY_CHUNK | ||
43 | pg_data_t *pg_data_table[65]; | ||
44 | EXPORT_SYMBOL(pg_data_table); | ||
45 | #endif | ||
46 | |||
47 | void m68k_setup_node(int node) | ||
48 | { | ||
49 | #ifndef CONFIG_SINGLE_MEMORY_CHUNK | ||
50 | struct mem_info *info = m68k_memory + node; | ||
51 | int i, end; | ||
52 | |||
53 | i = (unsigned long)phys_to_virt(info->addr) >> __virt_to_node_shift(); | ||
54 | end = (unsigned long)phys_to_virt(info->addr + info->size - 1) >> __virt_to_node_shift(); | ||
55 | for (; i <= end; i++) { | ||
56 | if (pg_data_table[i]) | ||
57 | printk("overlap at %u for chunk %u\n", i, node); | ||
58 | pg_data_table[i] = pg_data_map + node; | ||
59 | } | ||
60 | #endif | ||
61 | pg_data_map[node].bdata = bootmem_data + node; | ||
62 | node_set_online(node); | ||
63 | } | ||
64 | |||
65 | |||
34 | /* | 66 | /* |
35 | * ZERO_PAGE is a special page that is used for zero-initialized | 67 | * ZERO_PAGE is a special page that is used for zero-initialized |
36 | * data and COW. | 68 | * data and COW. |
@@ -40,52 +72,51 @@ void *empty_zero_page; | |||
40 | 72 | ||
41 | void show_mem(void) | 73 | void show_mem(void) |
42 | { | 74 | { |
43 | unsigned long i; | 75 | pg_data_t *pgdat; |
44 | int free = 0, total = 0, reserved = 0, shared = 0; | 76 | int free = 0, total = 0, reserved = 0, shared = 0; |
45 | int cached = 0; | 77 | int cached = 0; |
46 | 78 | int i; | |
47 | printk("\nMem-info:\n"); | 79 | |
48 | show_free_areas(); | 80 | printk("\nMem-info:\n"); |
49 | printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); | 81 | show_free_areas(); |
50 | i = max_mapnr; | 82 | printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); |
51 | while (i-- > 0) { | 83 | for_each_online_pgdat(pgdat) { |
52 | total++; | 84 | for (i = 0; i < pgdat->node_spanned_pages; i++) { |
53 | if (PageReserved(mem_map+i)) | 85 | struct page *page = pgdat->node_mem_map + i; |
54 | reserved++; | 86 | total++; |
55 | else if (PageSwapCache(mem_map+i)) | 87 | if (PageReserved(page)) |
56 | cached++; | 88 | reserved++; |
57 | else if (!page_count(mem_map+i)) | 89 | else if (PageSwapCache(page)) |
58 | free++; | 90 | cached++; |
59 | else | 91 | else if (!page_count(page)) |
60 | shared += page_count(mem_map+i) - 1; | 92 | free++; |
61 | } | 93 | else |
62 | printk("%d pages of RAM\n",total); | 94 | shared += page_count(page) - 1; |
63 | printk("%d free pages\n",free); | 95 | } |
64 | printk("%d reserved pages\n",reserved); | 96 | } |
65 | printk("%d pages shared\n",shared); | 97 | printk("%d pages of RAM\n",total); |
66 | printk("%d pages swap cached\n",cached); | 98 | printk("%d free pages\n",free); |
99 | printk("%d reserved pages\n",reserved); | ||
100 | printk("%d pages shared\n",shared); | ||
101 | printk("%d pages swap cached\n",cached); | ||
67 | } | 102 | } |
68 | 103 | ||
69 | extern void init_pointer_table(unsigned long ptable); | 104 | extern void init_pointer_table(unsigned long ptable); |
70 | 105 | ||
71 | /* References to section boundaries */ | 106 | /* References to section boundaries */ |
72 | 107 | ||
73 | extern char _text, _etext, _edata, __bss_start, _end; | 108 | extern char _text[], _etext[]; |
74 | extern char __init_begin, __init_end; | 109 | extern char __init_begin[], __init_end[]; |
75 | 110 | ||
76 | extern pmd_t *zero_pgtable; | 111 | extern pmd_t *zero_pgtable; |
77 | 112 | ||
78 | void __init mem_init(void) | 113 | void __init mem_init(void) |
79 | { | 114 | { |
115 | pg_data_t *pgdat; | ||
80 | int codepages = 0; | 116 | int codepages = 0; |
81 | int datapages = 0; | 117 | int datapages = 0; |
82 | int initpages = 0; | 118 | int initpages = 0; |
83 | unsigned long tmp; | ||
84 | #ifndef CONFIG_SUN3 | ||
85 | int i; | 119 | int i; |
86 | #endif | ||
87 | |||
88 | max_mapnr = num_physpages = (((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT); | ||
89 | 120 | ||
90 | #ifdef CONFIG_ATARI | 121 | #ifdef CONFIG_ATARI |
91 | if (MACH_IS_ATARI) | 122 | if (MACH_IS_ATARI) |
@@ -93,19 +124,25 @@ void __init mem_init(void) | |||
93 | #endif | 124 | #endif |
94 | 125 | ||
95 | /* this will put all memory onto the freelists */ | 126 | /* this will put all memory onto the freelists */ |
96 | totalram_pages = free_all_bootmem(); | 127 | totalram_pages = num_physpages = 0; |
97 | 128 | for_each_online_pgdat(pgdat) { | |
98 | for (tmp = PAGE_OFFSET ; tmp < (unsigned long)high_memory; tmp += PAGE_SIZE) { | 129 | num_physpages += pgdat->node_present_pages; |
99 | if (PageReserved(virt_to_page(tmp))) { | 130 | |
100 | if (tmp >= (unsigned long)&_text | 131 | totalram_pages += free_all_bootmem_node(pgdat); |
101 | && tmp < (unsigned long)&_etext) | 132 | for (i = 0; i < pgdat->node_spanned_pages; i++) { |
133 | struct page *page = pgdat->node_mem_map + i; | ||
134 | char *addr = page_to_virt(page); | ||
135 | |||
136 | if (!PageReserved(page)) | ||
137 | continue; | ||
138 | if (addr >= _text && | ||
139 | addr < _etext) | ||
102 | codepages++; | 140 | codepages++; |
103 | else if (tmp >= (unsigned long) &__init_begin | 141 | else if (addr >= __init_begin && |
104 | && tmp < (unsigned long) &__init_end) | 142 | addr < __init_end) |
105 | initpages++; | 143 | initpages++; |
106 | else | 144 | else |
107 | datapages++; | 145 | datapages++; |
108 | continue; | ||
109 | } | 146 | } |
110 | } | 147 | } |
111 | 148 | ||
@@ -124,7 +161,7 @@ void __init mem_init(void) | |||
124 | 161 | ||
125 | printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n", | 162 | printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n", |
126 | (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), | 163 | (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), |
127 | max_mapnr << (PAGE_SHIFT-10), | 164 | totalram_pages << (PAGE_SHIFT-10), |
128 | codepages << (PAGE_SHIFT-10), | 165 | codepages << (PAGE_SHIFT-10), |
129 | datapages << (PAGE_SHIFT-10), | 166 | datapages << (PAGE_SHIFT-10), |
130 | initpages << (PAGE_SHIFT-10)); | 167 | initpages << (PAGE_SHIFT-10)); |
diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c index 13c0b4ad01eb..b7473525b431 100644 --- a/arch/m68k/mm/memory.c +++ b/arch/m68k/mm/memory.c | |||
@@ -127,67 +127,6 @@ int free_pointer_table (pmd_t *ptable) | |||
127 | return 0; | 127 | return 0; |
128 | } | 128 | } |
129 | 129 | ||
130 | #ifdef DEBUG_INVALID_PTOV | ||
131 | int mm_inv_cnt = 5; | ||
132 | #endif | ||
133 | |||
134 | #ifndef CONFIG_SINGLE_MEMORY_CHUNK | ||
135 | /* | ||
136 | * The following two routines map from a physical address to a kernel | ||
137 | * virtual address and vice versa. | ||
138 | */ | ||
139 | unsigned long mm_vtop(unsigned long vaddr) | ||
140 | { | ||
141 | int i=0; | ||
142 | unsigned long voff = (unsigned long)vaddr - PAGE_OFFSET; | ||
143 | |||
144 | do { | ||
145 | if (voff < m68k_memory[i].size) { | ||
146 | #ifdef DEBUGPV | ||
147 | printk ("VTOP(%p)=%lx\n", vaddr, | ||
148 | m68k_memory[i].addr + voff); | ||
149 | #endif | ||
150 | return m68k_memory[i].addr + voff; | ||
151 | } | ||
152 | voff -= m68k_memory[i].size; | ||
153 | } while (++i < m68k_num_memory); | ||
154 | |||
155 | /* As a special case allow `__pa(high_memory)'. */ | ||
156 | if (voff == 0) | ||
157 | return m68k_memory[i-1].addr + m68k_memory[i-1].size; | ||
158 | |||
159 | return -1; | ||
160 | } | ||
161 | EXPORT_SYMBOL(mm_vtop); | ||
162 | |||
163 | unsigned long mm_ptov (unsigned long paddr) | ||
164 | { | ||
165 | int i = 0; | ||
166 | unsigned long poff, voff = PAGE_OFFSET; | ||
167 | |||
168 | do { | ||
169 | poff = paddr - m68k_memory[i].addr; | ||
170 | if (poff < m68k_memory[i].size) { | ||
171 | #ifdef DEBUGPV | ||
172 | printk ("PTOV(%lx)=%lx\n", paddr, poff + voff); | ||
173 | #endif | ||
174 | return poff + voff; | ||
175 | } | ||
176 | voff += m68k_memory[i].size; | ||
177 | } while (++i < m68k_num_memory); | ||
178 | |||
179 | #ifdef DEBUG_INVALID_PTOV | ||
180 | if (mm_inv_cnt > 0) { | ||
181 | mm_inv_cnt--; | ||
182 | printk("Invalid use of phys_to_virt(0x%lx) at 0x%p!\n", | ||
183 | paddr, __builtin_return_address(0)); | ||
184 | } | ||
185 | #endif | ||
186 | return -1; | ||
187 | } | ||
188 | EXPORT_SYMBOL(mm_ptov); | ||
189 | #endif | ||
190 | |||
191 | /* invalidate page in both caches */ | 130 | /* invalidate page in both caches */ |
192 | static inline void clear040(unsigned long paddr) | 131 | static inline void clear040(unsigned long paddr) |
193 | { | 132 | { |
@@ -354,15 +293,3 @@ void cache_push (unsigned long paddr, int len) | |||
354 | } | 293 | } |
355 | EXPORT_SYMBOL(cache_push); | 294 | EXPORT_SYMBOL(cache_push); |
356 | 295 | ||
357 | #ifndef CONFIG_SINGLE_MEMORY_CHUNK | ||
358 | int mm_end_of_chunk (unsigned long addr, int len) | ||
359 | { | ||
360 | int i; | ||
361 | |||
362 | for (i = 0; i < m68k_num_memory; i++) | ||
363 | if (m68k_memory[i].addr + m68k_memory[i].size == addr + len) | ||
364 | return 1; | ||
365 | return 0; | ||
366 | } | ||
367 | EXPORT_SYMBOL(mm_end_of_chunk); | ||
368 | #endif | ||
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index afcccdc6ad45..7d571a2b44dd 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c | |||
@@ -43,6 +43,11 @@ unsigned long mm_cachebits; | |||
43 | EXPORT_SYMBOL(mm_cachebits); | 43 | EXPORT_SYMBOL(mm_cachebits); |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | /* size of memory already mapped in head.S */ | ||
47 | #define INIT_MAPPED_SIZE (4UL<<20) | ||
48 | |||
49 | extern unsigned long availmem; | ||
50 | |||
46 | static pte_t * __init kernel_page_table(void) | 51 | static pte_t * __init kernel_page_table(void) |
47 | { | 52 | { |
48 | pte_t *ptablep; | 53 | pte_t *ptablep; |
@@ -98,19 +103,20 @@ static pmd_t * __init kernel_ptr_table(void) | |||
98 | return last_pgtable; | 103 | return last_pgtable; |
99 | } | 104 | } |
100 | 105 | ||
101 | static unsigned long __init | 106 | static void __init map_node(int node) |
102 | map_chunk (unsigned long addr, long size) | ||
103 | { | 107 | { |
104 | #define PTRTREESIZE (256*1024) | 108 | #define PTRTREESIZE (256*1024) |
105 | #define ROOTTREESIZE (32*1024*1024) | 109 | #define ROOTTREESIZE (32*1024*1024) |
106 | static unsigned long virtaddr = PAGE_OFFSET; | 110 | unsigned long physaddr, virtaddr, size; |
107 | unsigned long physaddr; | ||
108 | pgd_t *pgd_dir; | 111 | pgd_t *pgd_dir; |
109 | pmd_t *pmd_dir; | 112 | pmd_t *pmd_dir; |
110 | pte_t *pte_dir; | 113 | pte_t *pte_dir; |
111 | 114 | ||
112 | physaddr = (addr | m68k_supervisor_cachemode | | 115 | size = m68k_memory[node].size; |
113 | _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY); | 116 | physaddr = m68k_memory[node].addr; |
117 | virtaddr = (unsigned long)phys_to_virt(physaddr); | ||
118 | physaddr |= m68k_supervisor_cachemode | | ||
119 | _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY; | ||
114 | if (CPU_IS_040_OR_060) | 120 | if (CPU_IS_040_OR_060) |
115 | physaddr |= _PAGE_GLOBAL040; | 121 | physaddr |= _PAGE_GLOBAL040; |
116 | 122 | ||
@@ -190,8 +196,6 @@ map_chunk (unsigned long addr, long size) | |||
190 | #ifdef DEBUG | 196 | #ifdef DEBUG |
191 | printk("\n"); | 197 | printk("\n"); |
192 | #endif | 198 | #endif |
193 | |||
194 | return virtaddr; | ||
195 | } | 199 | } |
196 | 200 | ||
197 | /* | 201 | /* |
@@ -200,15 +204,16 @@ map_chunk (unsigned long addr, long size) | |||
200 | */ | 204 | */ |
201 | void __init paging_init(void) | 205 | void __init paging_init(void) |
202 | { | 206 | { |
203 | int chunk; | ||
204 | unsigned long mem_avail = 0; | ||
205 | unsigned long zones_size[MAX_NR_ZONES] = { 0, }; | 207 | unsigned long zones_size[MAX_NR_ZONES] = { 0, }; |
208 | unsigned long min_addr, max_addr; | ||
209 | unsigned long addr, size, end; | ||
210 | int i; | ||
206 | 211 | ||
207 | #ifdef DEBUG | 212 | #ifdef DEBUG |
208 | { | 213 | { |
209 | extern unsigned long availmem; | 214 | extern unsigned long availmem; |
210 | printk ("start of paging_init (%p, %lx, %lx, %lx)\n", | 215 | printk ("start of paging_init (%p, %lx)\n", |
211 | kernel_pg_dir, availmem, start_mem, end_mem); | 216 | kernel_pg_dir, availmem); |
212 | } | 217 | } |
213 | #endif | 218 | #endif |
214 | 219 | ||
@@ -222,24 +227,62 @@ void __init paging_init(void) | |||
222 | pgprot_val(protection_map[i]) |= _PAGE_CACHE040; | 227 | pgprot_val(protection_map[i]) |= _PAGE_CACHE040; |
223 | } | 228 | } |
224 | 229 | ||
230 | min_addr = m68k_memory[0].addr; | ||
231 | max_addr = min_addr + m68k_memory[0].size; | ||
232 | for (i = 1; i < m68k_num_memory;) { | ||
233 | if (m68k_memory[i].addr < min_addr) { | ||
234 | printk("Ignoring memory chunk at 0x%lx:0x%lx before the first chunk\n", | ||
235 | m68k_memory[i].addr, m68k_memory[i].size); | ||
236 | printk("Fix your bootloader or use a memfile to make use of this area!\n"); | ||
237 | m68k_num_memory--; | ||
238 | memmove(m68k_memory + i, m68k_memory + i + 1, | ||
239 | (m68k_num_memory - i) * sizeof(struct mem_info)); | ||
240 | continue; | ||
241 | } | ||
242 | addr = m68k_memory[i].addr + m68k_memory[i].size; | ||
243 | if (addr > max_addr) | ||
244 | max_addr = addr; | ||
245 | i++; | ||
246 | } | ||
247 | m68k_memoffset = min_addr - PAGE_OFFSET; | ||
248 | m68k_virt_to_node_shift = fls(max_addr - min_addr - 1) - 6; | ||
249 | |||
250 | module_fixup(NULL, __start_fixup, __stop_fixup); | ||
251 | flush_icache(); | ||
252 | |||
253 | high_memory = phys_to_virt(max_addr); | ||
254 | |||
255 | min_low_pfn = availmem >> PAGE_SHIFT; | ||
256 | max_low_pfn = max_addr >> PAGE_SHIFT; | ||
257 | |||
258 | for (i = 0; i < m68k_num_memory; i++) { | ||
259 | addr = m68k_memory[i].addr; | ||
260 | end = addr + m68k_memory[i].size; | ||
261 | m68k_setup_node(i); | ||
262 | availmem = PAGE_ALIGN(availmem); | ||
263 | availmem += init_bootmem_node(NODE_DATA(i), | ||
264 | availmem >> PAGE_SHIFT, | ||
265 | addr >> PAGE_SHIFT, | ||
266 | end >> PAGE_SHIFT); | ||
267 | } | ||
268 | |||
225 | /* | 269 | /* |
226 | * Map the physical memory available into the kernel virtual | 270 | * Map the physical memory available into the kernel virtual |
227 | * address space. It may allocate some memory for page | 271 | * address space. First initialize the bootmem allocator with |
228 | * tables and thus modify availmem. | 272 | * the memory we already mapped, so map_node() has something |
273 | * to allocate. | ||
229 | */ | 274 | */ |
275 | addr = m68k_memory[0].addr; | ||
276 | size = m68k_memory[0].size; | ||
277 | free_bootmem_node(NODE_DATA(0), availmem, min(INIT_MAPPED_SIZE, size) - (availmem - addr)); | ||
278 | map_node(0); | ||
279 | if (size > INIT_MAPPED_SIZE) | ||
280 | free_bootmem_node(NODE_DATA(0), addr + INIT_MAPPED_SIZE, size - INIT_MAPPED_SIZE); | ||
230 | 281 | ||
231 | for (chunk = 0; chunk < m68k_num_memory; chunk++) { | 282 | for (i = 1; i < m68k_num_memory; i++) |
232 | mem_avail = map_chunk (m68k_memory[chunk].addr, | 283 | map_node(i); |
233 | m68k_memory[chunk].size); | ||
234 | |||
235 | } | ||
236 | 284 | ||
237 | flush_tlb_all(); | 285 | flush_tlb_all(); |
238 | #ifdef DEBUG | ||
239 | printk ("memory available is %ldKB\n", mem_avail >> 10); | ||
240 | printk ("start_mem is %#lx\nvirtual_end is %#lx\n", | ||
241 | start_mem, end_mem); | ||
242 | #endif | ||
243 | 286 | ||
244 | /* | 287 | /* |
245 | * initialize the bad page table and bad page to point | 288 | * initialize the bad page table and bad page to point |
@@ -256,14 +299,11 @@ void __init paging_init(void) | |||
256 | #ifdef DEBUG | 299 | #ifdef DEBUG |
257 | printk ("before free_area_init\n"); | 300 | printk ("before free_area_init\n"); |
258 | #endif | 301 | #endif |
259 | zones_size[ZONE_DMA] = (mach_max_dma_address < (unsigned long)high_memory ? | 302 | for (i = 0; i < m68k_num_memory; i++) { |
260 | (mach_max_dma_address+1) : (unsigned long)high_memory); | 303 | zones_size[ZONE_DMA] = m68k_memory[i].size >> PAGE_SHIFT; |
261 | zones_size[ZONE_NORMAL] = (unsigned long)high_memory - zones_size[0]; | 304 | free_area_init_node(i, pg_data_map + i, zones_size, |
262 | 305 | m68k_memory[i].addr >> PAGE_SHIFT, NULL); | |
263 | zones_size[ZONE_DMA] = (zones_size[ZONE_DMA] - PAGE_OFFSET) >> PAGE_SHIFT; | 306 | } |
264 | zones_size[ZONE_NORMAL] >>= PAGE_SHIFT; | ||
265 | |||
266 | free_area_init(zones_size); | ||
267 | } | 307 | } |
268 | 308 | ||
269 | extern char __init_begin, __init_end; | 309 | extern char __init_begin, __init_end; |
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c index 4851b8437a87..c0fbd278fbb1 100644 --- a/arch/m68k/sun3/config.c +++ b/arch/m68k/sun3/config.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/contregs.h> | 21 | #include <asm/contregs.h> |
22 | #include <asm/movs.h> | 22 | #include <asm/movs.h> |
23 | #include <asm/pgtable.h> | 23 | #include <asm/pgtable.h> |
24 | #include <asm/pgalloc.h> | ||
24 | #include <asm/sun3-head.h> | 25 | #include <asm/sun3-head.h> |
25 | #include <asm/sun3mmu.h> | 26 | #include <asm/sun3mmu.h> |
26 | #include <asm/rtc.h> | 27 | #include <asm/rtc.h> |
@@ -127,6 +128,7 @@ void __init sun3_bootmem_alloc(unsigned long memory_start, unsigned long memory_ | |||
127 | high_memory = (void *)memory_end; | 128 | high_memory = (void *)memory_end; |
128 | availmem = memory_start; | 129 | availmem = memory_start; |
129 | 130 | ||
131 | m68k_setup_node(0); | ||
130 | availmem += init_bootmem_node(NODE_DATA(0), start_page, 0, num_pages); | 132 | availmem += init_bootmem_node(NODE_DATA(0), start_page, 0, num_pages); |
131 | availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK; | 133 | availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK; |
132 | 134 | ||
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 56d3c0dcd2b8..5eaeafd30bdf 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -118,6 +118,7 @@ config GENERIC_BUG | |||
118 | depends on BUG | 118 | depends on BUG |
119 | 119 | ||
120 | config SYS_SUPPORTS_APM_EMULATION | 120 | config SYS_SUPPORTS_APM_EMULATION |
121 | default y if PMAC_APM_EMU | ||
121 | bool | 122 | bool |
122 | 123 | ||
123 | config DEFAULT_UIMAGE | 124 | config DEFAULT_UIMAGE |
diff --git a/arch/powerpc/boot/dts/lite5200.dts b/arch/powerpc/boot/dts/lite5200.dts index eae68ab1177f..d29308fe4c24 100644 --- a/arch/powerpc/boot/dts/lite5200.dts +++ b/arch/powerpc/boot/dts/lite5200.dts | |||
@@ -67,7 +67,7 @@ | |||
67 | interrupt-controller; | 67 | interrupt-controller; |
68 | #interrupt-cells = <3>; | 68 | #interrupt-cells = <3>; |
69 | device_type = "interrupt-controller"; | 69 | device_type = "interrupt-controller"; |
70 | compatible = "mpc5200_pic"; | 70 | compatible = "mpc5200-pic"; |
71 | reg = <500 80>; | 71 | reg = <500 80>; |
72 | built-in; | 72 | built-in; |
73 | }; | 73 | }; |
diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts index 5185625a9419..f242531f0451 100644 --- a/arch/powerpc/boot/dts/lite5200b.dts +++ b/arch/powerpc/boot/dts/lite5200b.dts | |||
@@ -67,7 +67,7 @@ | |||
67 | interrupt-controller; | 67 | interrupt-controller; |
68 | #interrupt-cells = <3>; | 68 | #interrupt-cells = <3>; |
69 | device_type = "interrupt-controller"; | 69 | device_type = "interrupt-controller"; |
70 | compatible = "mpc5200b-pic\0mpc5200_pic"; | 70 | compatible = "mpc5200b-pic\0mpc5200-pic"; |
71 | reg = <500 80>; | 71 | reg = <500 80>; |
72 | built-in; | 72 | built-in; |
73 | }; | 73 | }; |
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index d8232b7a08f7..f6ae1a57d652 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c | |||
@@ -93,7 +93,7 @@ void pgd_free(pgd_t *pgd) | |||
93 | free_pages((unsigned long)pgd, PGDIR_ORDER); | 93 | free_pages((unsigned long)pgd, PGDIR_ORDER); |
94 | } | 94 | } |
95 | 95 | ||
96 | pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | 96 | __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) |
97 | { | 97 | { |
98 | pte_t *pte; | 98 | pte_t *pte; |
99 | extern int mem_init_done; | 99 | extern int mem_init_done; |
diff --git a/arch/powerpc/platforms/chrp/pegasos_eth.c b/arch/powerpc/platforms/chrp/pegasos_eth.c index 71045677559a..5bcc58d9a4dd 100644 --- a/arch/powerpc/platforms/chrp/pegasos_eth.c +++ b/arch/powerpc/platforms/chrp/pegasos_eth.c | |||
@@ -169,7 +169,7 @@ static int Enable_SRAM(void) | |||
169 | 169 | ||
170 | /***********/ | 170 | /***********/ |
171 | /***********/ | 171 | /***********/ |
172 | int mv643xx_eth_add_pds(void) | 172 | static int __init mv643xx_eth_add_pds(void) |
173 | { | 173 | { |
174 | int ret = 0; | 174 | int ret = 0; |
175 | static struct pci_device_id pci_marvell_mv64360[] = { | 175 | static struct pci_device_id pci_marvell_mv64360[] = { |
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index a410bc76a8a8..07b1c4ec428d 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -384,7 +384,7 @@ int boot_part; | |||
384 | static dev_t boot_dev; | 384 | static dev_t boot_dev; |
385 | 385 | ||
386 | #ifdef CONFIG_SCSI | 386 | #ifdef CONFIG_SCSI |
387 | void __init note_scsi_host(struct device_node *node, void *host) | 387 | void note_scsi_host(struct device_node *node, void *host) |
388 | { | 388 | { |
389 | int l; | 389 | int l; |
390 | char *p; | 390 | char *p; |
diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig b/arch/powerpc/sysdev/qe_lib/Kconfig index 887739f3badc..f611d344a126 100644 --- a/arch/powerpc/sysdev/qe_lib/Kconfig +++ b/arch/powerpc/sysdev/qe_lib/Kconfig | |||
@@ -5,15 +5,13 @@ | |||
5 | config UCC_SLOW | 5 | config UCC_SLOW |
6 | bool | 6 | bool |
7 | default n | 7 | default n |
8 | select UCC | ||
9 | help | 8 | help |
10 | This option provides qe_lib support to UCC slow | 9 | This option provides qe_lib support to UCC slow |
11 | protocols: UART, BISYNC, QMC | 10 | protocols: UART, BISYNC, QMC |
12 | 11 | ||
13 | config UCC_FAST | 12 | config UCC_FAST |
14 | bool | 13 | bool |
15 | default n | 14 | default y if UCC_GETH |
16 | select UCC | ||
17 | help | 15 | help |
18 | This option provides qe_lib support to UCC fast | 16 | This option provides qe_lib support to UCC fast |
19 | protocols: HDLC, Ethernet, ATM, transparent | 17 | protocols: HDLC, Ethernet, ATM, transparent |
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index ab64256110bd..fba7ca17a67e 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S | |||
@@ -596,7 +596,11 @@ fast_exception_return: | |||
596 | mr r12,r4 /* restart at exc_exit_restart */ | 596 | mr r12,r4 /* restart at exc_exit_restart */ |
597 | b 2b | 597 | b 2b |
598 | 598 | ||
599 | .comm fee_restarts,4 | 599 | .section .bss |
600 | .align 2 | ||
601 | fee_restarts: | ||
602 | .space 4 | ||
603 | .previous | ||
600 | 604 | ||
601 | /* aargh, a nonrecoverable interrupt, panic */ | 605 | /* aargh, a nonrecoverable interrupt, panic */ |
602 | /* aargh, we don't know which trap this is */ | 606 | /* aargh, we don't know which trap this is */ |
@@ -851,7 +855,11 @@ load_dbcr0: | |||
851 | mtspr SPRN_DBSR,r11 /* clear all pending debug events */ | 855 | mtspr SPRN_DBSR,r11 /* clear all pending debug events */ |
852 | blr | 856 | blr |
853 | 857 | ||
854 | .comm global_dbcr0,8 | 858 | .section .bss |
859 | .align 4 | ||
860 | global_dbcr0: | ||
861 | .space 8 | ||
862 | .previous | ||
855 | #endif /* !(CONFIG_4xx || CONFIG_BOOKE) */ | 863 | #endif /* !(CONFIG_4xx || CONFIG_BOOKE) */ |
856 | 864 | ||
857 | do_work: /* r10 contains MSR_KERNEL here */ | 865 | do_work: /* r10 contains MSR_KERNEL here */ |
@@ -926,4 +934,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_601) | |||
926 | /* shouldn't return */ | 934 | /* shouldn't return */ |
927 | b 4b | 935 | b 4b |
928 | 936 | ||
929 | .comm ee_restarts,4 | 937 | .section .bss |
938 | .align 2 | ||
939 | ee_restarts: | ||
940 | .space 4 | ||
941 | .previous | ||
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c index 4ad499605d05..a4165209ac7c 100644 --- a/arch/ppc/kernel/ppc_ksyms.c +++ b/arch/ppc/kernel/ppc_ksyms.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <asm/time.h> | 40 | #include <asm/time.h> |
41 | #include <asm/cputable.h> | 41 | #include <asm/cputable.h> |
42 | #include <asm/btext.h> | 42 | #include <asm/btext.h> |
43 | #include <asm/div64.h> | ||
44 | #include <asm/xmon.h> | 43 | #include <asm/xmon.h> |
45 | #include <asm/signal.h> | 44 | #include <asm/signal.h> |
46 | #include <asm/dcr.h> | 45 | #include <asm/dcr.h> |
@@ -93,7 +92,6 @@ EXPORT_SYMBOL(strncpy); | |||
93 | EXPORT_SYMBOL(strcat); | 92 | EXPORT_SYMBOL(strcat); |
94 | EXPORT_SYMBOL(strlen); | 93 | EXPORT_SYMBOL(strlen); |
95 | EXPORT_SYMBOL(strcmp); | 94 | EXPORT_SYMBOL(strcmp); |
96 | EXPORT_SYMBOL(__div64_32); | ||
97 | 95 | ||
98 | EXPORT_SYMBOL(csum_partial); | 96 | EXPORT_SYMBOL(csum_partial); |
99 | EXPORT_SYMBOL(csum_partial_copy_generic); | 97 | EXPORT_SYMBOL(csum_partial_copy_generic); |
diff --git a/arch/ppc/mm/hashtable.S b/arch/ppc/mm/hashtable.S index e756942e65c4..5f364dc50154 100644 --- a/arch/ppc/mm/hashtable.S +++ b/arch/ppc/mm/hashtable.S | |||
@@ -30,7 +30,11 @@ | |||
30 | #include <asm/asm-offsets.h> | 30 | #include <asm/asm-offsets.h> |
31 | 31 | ||
32 | #ifdef CONFIG_SMP | 32 | #ifdef CONFIG_SMP |
33 | .comm mmu_hash_lock,4 | 33 | .section .bss |
34 | .align 2 | ||
35 | .globl mmu_hash_lock | ||
36 | mmu_hash_lock: | ||
37 | .space 4 | ||
34 | #endif /* CONFIG_SMP */ | 38 | #endif /* CONFIG_SMP */ |
35 | 39 | ||
36 | /* | 40 | /* |
@@ -461,9 +465,17 @@ found_slot: | |||
461 | sync /* make sure pte updates get to memory */ | 465 | sync /* make sure pte updates get to memory */ |
462 | blr | 466 | blr |
463 | 467 | ||
464 | .comm next_slot,4 | 468 | .section .bss |
465 | .comm primary_pteg_full,4 | 469 | .align 2 |
466 | .comm htab_hash_searches,4 | 470 | next_slot: |
471 | .space 4 | ||
472 | .globl primary_pteg_full | ||
473 | primary_pteg_full: | ||
474 | .space 4 | ||
475 | .globl htab_hash_searches | ||
476 | htab_hash_searches: | ||
477 | .space 4 | ||
478 | .previous | ||
467 | 479 | ||
468 | /* | 480 | /* |
469 | * Flush the entry for a particular page from the hash table. | 481 | * Flush the entry for a particular page from the hash table. |
diff --git a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c index c023b7298809..35ebb6395ae3 100644 --- a/arch/ppc/mm/pgtable.c +++ b/arch/ppc/mm/pgtable.c | |||
@@ -92,7 +92,7 @@ void pgd_free(pgd_t *pgd) | |||
92 | free_pages((unsigned long)pgd, PGDIR_ORDER); | 92 | free_pages((unsigned long)pgd, PGDIR_ORDER); |
93 | } | 93 | } |
94 | 94 | ||
95 | pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | 95 | __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) |
96 | { | 96 | { |
97 | pte_t *pte; | 97 | pte_t *pte; |
98 | extern int mem_init_done; | 98 | extern int mem_init_done; |
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c index 2782cf9da5b4..b9a1ce1f28e4 100644 --- a/arch/s390/hypfs/hypfs_diag.c +++ b/arch/s390/hypfs/hypfs_diag.c | |||
@@ -481,9 +481,17 @@ out: | |||
481 | 481 | ||
482 | /* Diagnose 224 functions */ | 482 | /* Diagnose 224 functions */ |
483 | 483 | ||
484 | static void diag224(void *ptr) | 484 | static int diag224(void *ptr) |
485 | { | 485 | { |
486 | asm volatile("diag %0,%1,0x224" : :"d" (0), "d"(ptr) : "memory"); | 486 | int rc = -ENOTSUPP; |
487 | |||
488 | asm volatile( | ||
489 | " diag %1,%2,0x224\n" | ||
490 | "0: lhi %0,0x0\n" | ||
491 | "1:\n" | ||
492 | EX_TABLE(0b,1b) | ||
493 | : "+d" (rc) :"d" (0), "d" (ptr) : "memory"); | ||
494 | return rc; | ||
487 | } | 495 | } |
488 | 496 | ||
489 | static int diag224_get_name_table(void) | 497 | static int diag224_get_name_table(void) |
@@ -492,7 +500,10 @@ static int diag224_get_name_table(void) | |||
492 | diag224_cpu_names = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); | 500 | diag224_cpu_names = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); |
493 | if (!diag224_cpu_names) | 501 | if (!diag224_cpu_names) |
494 | return -ENOMEM; | 502 | return -ENOMEM; |
495 | diag224(diag224_cpu_names); | 503 | if (diag224(diag224_cpu_names)) { |
504 | kfree(diag224_cpu_names); | ||
505 | return -ENOTSUPP; | ||
506 | } | ||
496 | EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16); | 507 | EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16); |
497 | return 0; | 508 | return 0; |
498 | } | 509 | } |
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c index dca6eaf82c80..1b2f5ce45320 100644 --- a/arch/s390/kernel/debug.c +++ b/arch/s390/kernel/debug.c | |||
@@ -163,7 +163,7 @@ unsigned int debug_feature_version = __DEBUG_FEATURE_VERSION; | |||
163 | 163 | ||
164 | static debug_info_t *debug_area_first = NULL; | 164 | static debug_info_t *debug_area_first = NULL; |
165 | static debug_info_t *debug_area_last = NULL; | 165 | static debug_info_t *debug_area_last = NULL; |
166 | static DECLARE_MUTEX(debug_lock); | 166 | static DEFINE_MUTEX(debug_mutex); |
167 | 167 | ||
168 | static int initialized; | 168 | static int initialized; |
169 | 169 | ||
@@ -576,7 +576,7 @@ debug_input(struct file *file, const char __user *user_buf, size_t length, | |||
576 | int rc = 0; | 576 | int rc = 0; |
577 | file_private_info_t *p_info; | 577 | file_private_info_t *p_info; |
578 | 578 | ||
579 | down(&debug_lock); | 579 | mutex_lock(&debug_mutex); |
580 | p_info = ((file_private_info_t *) file->private_data); | 580 | p_info = ((file_private_info_t *) file->private_data); |
581 | if (p_info->view->input_proc) | 581 | if (p_info->view->input_proc) |
582 | rc = p_info->view->input_proc(p_info->debug_info_org, | 582 | rc = p_info->view->input_proc(p_info->debug_info_org, |
@@ -584,7 +584,7 @@ debug_input(struct file *file, const char __user *user_buf, size_t length, | |||
584 | length, offset); | 584 | length, offset); |
585 | else | 585 | else |
586 | rc = -EPERM; | 586 | rc = -EPERM; |
587 | up(&debug_lock); | 587 | mutex_unlock(&debug_mutex); |
588 | return rc; /* number of input characters */ | 588 | return rc; /* number of input characters */ |
589 | } | 589 | } |
590 | 590 | ||
@@ -602,7 +602,7 @@ debug_open(struct inode *inode, struct file *file) | |||
602 | file_private_info_t *p_info; | 602 | file_private_info_t *p_info; |
603 | debug_info_t *debug_info, *debug_info_snapshot; | 603 | debug_info_t *debug_info, *debug_info_snapshot; |
604 | 604 | ||
605 | down(&debug_lock); | 605 | mutex_lock(&debug_mutex); |
606 | debug_info = file->f_path.dentry->d_inode->i_private; | 606 | debug_info = file->f_path.dentry->d_inode->i_private; |
607 | /* find debug view */ | 607 | /* find debug view */ |
608 | for (i = 0; i < DEBUG_MAX_VIEWS; i++) { | 608 | for (i = 0; i < DEBUG_MAX_VIEWS; i++) { |
@@ -653,7 +653,7 @@ found: | |||
653 | file->private_data = p_info; | 653 | file->private_data = p_info; |
654 | debug_info_get(debug_info); | 654 | debug_info_get(debug_info); |
655 | out: | 655 | out: |
656 | up(&debug_lock); | 656 | mutex_unlock(&debug_mutex); |
657 | return rc; | 657 | return rc; |
658 | } | 658 | } |
659 | 659 | ||
@@ -688,7 +688,7 @@ debug_register (char *name, int pages_per_area, int nr_areas, int buf_size) | |||
688 | 688 | ||
689 | if (!initialized) | 689 | if (!initialized) |
690 | BUG(); | 690 | BUG(); |
691 | down(&debug_lock); | 691 | mutex_lock(&debug_mutex); |
692 | 692 | ||
693 | /* create new debug_info */ | 693 | /* create new debug_info */ |
694 | 694 | ||
@@ -702,7 +702,7 @@ out: | |||
702 | if (!rc){ | 702 | if (!rc){ |
703 | printk(KERN_ERR "debug: debug_register failed for %s\n",name); | 703 | printk(KERN_ERR "debug: debug_register failed for %s\n",name); |
704 | } | 704 | } |
705 | up(&debug_lock); | 705 | mutex_unlock(&debug_mutex); |
706 | return rc; | 706 | return rc; |
707 | } | 707 | } |
708 | 708 | ||
@@ -716,9 +716,9 @@ debug_unregister(debug_info_t * id) | |||
716 | { | 716 | { |
717 | if (!id) | 717 | if (!id) |
718 | goto out; | 718 | goto out; |
719 | down(&debug_lock); | 719 | mutex_lock(&debug_mutex); |
720 | debug_info_put(id); | 720 | debug_info_put(id); |
721 | up(&debug_lock); | 721 | mutex_unlock(&debug_mutex); |
722 | 722 | ||
723 | out: | 723 | out: |
724 | return; | 724 | return; |
@@ -1054,11 +1054,11 @@ __init debug_init(void) | |||
1054 | int rc = 0; | 1054 | int rc = 0; |
1055 | 1055 | ||
1056 | s390dbf_sysctl_header = register_sysctl_table(s390dbf_dir_table); | 1056 | s390dbf_sysctl_header = register_sysctl_table(s390dbf_dir_table); |
1057 | down(&debug_lock); | 1057 | mutex_lock(&debug_mutex); |
1058 | debug_debugfs_root_entry = debugfs_create_dir(DEBUG_DIR_ROOT,NULL); | 1058 | debug_debugfs_root_entry = debugfs_create_dir(DEBUG_DIR_ROOT,NULL); |
1059 | printk(KERN_INFO "debug: Initialization complete\n"); | 1059 | printk(KERN_INFO "debug: Initialization complete\n"); |
1060 | initialized = 1; | 1060 | initialized = 1; |
1061 | up(&debug_lock); | 1061 | mutex_unlock(&debug_mutex); |
1062 | 1062 | ||
1063 | return rc; | 1063 | return rc; |
1064 | } | 1064 | } |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 6bfb0889eb10..51d6309e7f3b 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -102,7 +102,7 @@ static struct resource data_resource = { | |||
102 | /* | 102 | /* |
103 | * cpu_init() initializes state that is per-CPU. | 103 | * cpu_init() initializes state that is per-CPU. |
104 | */ | 104 | */ |
105 | void __devinit cpu_init (void) | 105 | void __cpuinit cpu_init(void) |
106 | { | 106 | { |
107 | int addr = hard_smp_processor_id(); | 107 | int addr = hard_smp_processor_id(); |
108 | 108 | ||
@@ -915,7 +915,7 @@ setup_arch(char **cmdline_p) | |||
915 | setup_zfcpdump(console_devno); | 915 | setup_zfcpdump(console_devno); |
916 | } | 916 | } |
917 | 917 | ||
918 | void print_cpu_info(struct cpuinfo_S390 *cpuinfo) | 918 | void __cpuinit print_cpu_info(struct cpuinfo_S390 *cpuinfo) |
919 | { | 919 | { |
920 | printk("cpu %d " | 920 | printk("cpu %d " |
921 | #ifdef CONFIG_SMP | 921 | #ifdef CONFIG_SMP |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 09f028a3266b..8ff2feaf9b00 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -492,7 +492,7 @@ static unsigned int __init smp_count_cpus(void) | |||
492 | /* | 492 | /* |
493 | * Activate a secondary processor. | 493 | * Activate a secondary processor. |
494 | */ | 494 | */ |
495 | int __devinit start_secondary(void *cpuvoid) | 495 | int __cpuinit start_secondary(void *cpuvoid) |
496 | { | 496 | { |
497 | /* Setup the cpu */ | 497 | /* Setup the cpu */ |
498 | cpu_init(); | 498 | cpu_init(); |
@@ -741,7 +741,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
741 | smp_create_idle(cpu); | 741 | smp_create_idle(cpu); |
742 | } | 742 | } |
743 | 743 | ||
744 | void __devinit smp_prepare_boot_cpu(void) | 744 | void __init smp_prepare_boot_cpu(void) |
745 | { | 745 | { |
746 | BUG_ON(smp_processor_id() != 0); | 746 | BUG_ON(smp_processor_id() != 0); |
747 | 747 | ||
@@ -750,7 +750,7 @@ void __devinit smp_prepare_boot_cpu(void) | |||
750 | current_set[0] = current; | 750 | current_set[0] = current; |
751 | } | 751 | } |
752 | 752 | ||
753 | void smp_cpus_done(unsigned int max_cpus) | 753 | void __init smp_cpus_done(unsigned int max_cpus) |
754 | { | 754 | { |
755 | cpu_present_map = cpu_possible_map; | 755 | cpu_present_map = cpu_possible_map; |
756 | } | 756 | } |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index 7b1122417050..883b03b040c4 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
@@ -39,7 +39,7 @@ cflags-$(CONFIG_CPU_SH2A) := -m2a $(call cc-option,-m2a-nofpu,) | |||
39 | cflags-$(CONFIG_CPU_SH3) := -m3 | 39 | cflags-$(CONFIG_CPU_SH3) := -m3 |
40 | cflags-$(CONFIG_CPU_SH4) := -m4 \ | 40 | cflags-$(CONFIG_CPU_SH4) := -m4 \ |
41 | $(call cc-option,-mno-implicit-fp,-m4-nofpu) | 41 | $(call cc-option,-mno-implicit-fp,-m4-nofpu) |
42 | cflags-$(CONFIG_CPU_SH4A) := -m4a $(call cc-option,-m4a-nofpu,) | 42 | cflags-$(CONFIG_CPU_SH4A) := $(call cc-option,-m4a,) $(call cc-option,-m4a-nofpu,) |
43 | 43 | ||
44 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb | 44 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb |
45 | cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml | 45 | cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml |
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c index 8057a27a1bc6..cf8e11994330 100644 --- a/arch/sh/drivers/dma/dma-api.c +++ b/arch/sh/drivers/dma/dma-api.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/list.h> | 16 | #include <linux/list.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/sched.h> | ||
19 | #include <asm/dma.h> | 20 | #include <asm/dma.h> |
20 | 21 | ||
21 | DEFINE_SPINLOCK(dma_spin_lock); | 22 | DEFINE_SPINLOCK(dma_spin_lock); |
diff --git a/arch/sh/kernel/cf-enabler.c b/arch/sh/kernel/cf-enabler.c index 849a9e191391..ebc73b85094a 100644 --- a/arch/sh/kernel/cf-enabler.c +++ b/arch/sh/kernel/cf-enabler.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
14 | #include <linux/vmalloc.h> | 14 | #include <linux/vmalloc.h> |
15 | #include <linux/interrupt.h> | ||
15 | #include <asm/io.h> | 16 | #include <asm/io.h> |
16 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
17 | 18 | ||
@@ -149,6 +150,11 @@ static int __init cf_init_se(void) | |||
149 | ctrl_outb(0x42, PA_MRSHPC_MW2 + 0x200); | 150 | ctrl_outb(0x42, PA_MRSHPC_MW2 + 0x200); |
150 | return 0; | 151 | return 0; |
151 | } | 152 | } |
153 | #else | ||
154 | static int __init cf_init_se(void) | ||
155 | { | ||
156 | return -1; | ||
157 | } | ||
152 | #endif | 158 | #endif |
153 | 159 | ||
154 | int __init cf_init(void) | 160 | int __init cf_init(void) |
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S index 832c0b4a1e6c..659cc081e5e7 100644 --- a/arch/sh/kernel/cpu/sh3/entry.S +++ b/arch/sh/kernel/cpu/sh3/entry.S | |||
@@ -320,6 +320,7 @@ skip_restore: | |||
320 | 320 | ||
321 | .align 2 | 321 | .align 2 |
322 | 5: .long 0x00001000 ! DSP | 322 | 5: .long 0x00001000 ! DSP |
323 | 6: .long in_nmi | ||
323 | 7: .long 0x30000000 | 324 | 7: .long 0x30000000 |
324 | 325 | ||
325 | ! common exception handler | 326 | ! common exception handler |
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c index 8cd04904c77a..fab2eb07196b 100644 --- a/arch/sh/kernel/cpu/sh4/probe.c +++ b/arch/sh/kernel/cpu/sh4/probe.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/smp.h> | ||
15 | #include <asm/processor.h> | 16 | #include <asm/processor.h> |
16 | #include <asm/cache.h> | 17 | #include <asm/cache.h> |
17 | 18 | ||
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index dbebaddcfe39..283e1425ced5 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * Free Software Foundation; either version 2 of the License, or (at your | 10 | * Free Software Foundation; either version 2 of the License, or (at your |
11 | * option) any later version. | 11 | * option) any later version. |
12 | */ | 12 | */ |
13 | |||
14 | #include <linux/err.h> | ||
13 | #include <linux/cache.h> | 15 | #include <linux/cache.h> |
14 | #include <linux/cpumask.h> | 16 | #include <linux/cpumask.h> |
15 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
diff --git a/arch/sh/kernel/timers/timer.c b/arch/sh/kernel/timers/timer.c index a6bcc913d25e..4e7e747d1b69 100644 --- a/arch/sh/kernel/timers/timer.c +++ b/arch/sh/kernel/timers/timer.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/string.h> | 13 | #include <linux/string.h> |
14 | #include <asm/timer.h> | 14 | #include <asm/timer.h> |
15 | 15 | ||
16 | static struct sys_timer *sys_timers[] __initdata = { | 16 | static struct sys_timer *sys_timers[] = { |
17 | #ifdef CONFIG_SH_TMU | 17 | #ifdef CONFIG_SH_TMU |
18 | &tmu_timer, | 18 | &tmu_timer, |
19 | #endif | 19 | #endif |
@@ -26,7 +26,7 @@ static struct sys_timer *sys_timers[] __initdata = { | |||
26 | NULL, | 26 | NULL, |
27 | }; | 27 | }; |
28 | 28 | ||
29 | static char timer_override[10] __initdata; | 29 | static char timer_override[10]; |
30 | static int __init timer_setup(char *str) | 30 | static int __init timer_setup(char *str) |
31 | { | 31 | { |
32 | if (str) | 32 | if (str) |
@@ -53,4 +53,3 @@ struct sys_timer *get_sys_timer(void) | |||
53 | 53 | ||
54 | return NULL; | 54 | return NULL; |
55 | } | 55 | } |
56 | |||
diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c index e146bafcd14f..2aa9438361bc 100644 --- a/arch/sh/kernel/vsyscall/vsyscall.c +++ b/arch/sh/kernel/vsyscall/vsyscall.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/gfp.h> | 17 | #include <linux/gfp.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/elf.h> | 19 | #include <linux/elf.h> |
20 | #include <linux/sched.h> | ||
20 | 21 | ||
21 | /* | 22 | /* |
22 | * Should the kernel map a VDSO page into processes and pass its | 23 | * Should the kernel map a VDSO page into processes and pass its |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index bd992c0048f0..fbcc00c6c06e 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -178,6 +178,13 @@ config ARCH_HAS_ILOG2_U64 | |||
178 | bool | 178 | bool |
179 | default n | 179 | default n |
180 | 180 | ||
181 | config EMULATED_CMPXCHG | ||
182 | bool | ||
183 | default y | ||
184 | help | ||
185 | Sparc32 does not have a CAS instruction like sparc64. cmpxchg() | ||
186 | is emulated, and therefore it is not completely atomic. | ||
187 | |||
181 | config SUN_PM | 188 | config SUN_PM |
182 | bool | 189 | bool |
183 | default y | 190 | default y |
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c index f1401b57ccc7..7b4612da74a6 100644 --- a/arch/sparc/kernel/time.c +++ b/arch/sparc/kernel/time.c | |||
@@ -148,7 +148,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
148 | } | 148 | } |
149 | 149 | ||
150 | /* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ | 150 | /* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ |
151 | static void __init kick_start_clock(void) | 151 | static void __devinit kick_start_clock(void) |
152 | { | 152 | { |
153 | struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs; | 153 | struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs; |
154 | unsigned char sec; | 154 | unsigned char sec; |
@@ -223,7 +223,7 @@ static __inline__ int has_low_battery(void) | |||
223 | return (data1 == data2); /* Was the write blocked? */ | 223 | return (data1 == data2); /* Was the write blocked? */ |
224 | } | 224 | } |
225 | 225 | ||
226 | static void __init mostek_set_system_time(void) | 226 | static void __devinit mostek_set_system_time(void) |
227 | { | 227 | { |
228 | unsigned int year, mon, day, hour, min, sec; | 228 | unsigned int year, mon, day, hour, min, sec; |
229 | struct mostek48t02 *mregs; | 229 | struct mostek48t02 *mregs; |
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index 559335f4917d..cbddeb38ffda 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * atomic32.c: 32-bit atomic_t implementation | 2 | * atomic32.c: 32-bit atomic_t implementation |
3 | * | 3 | * |
4 | * Copyright (C) 2004 Keith M Wesolowski | 4 | * Copyright (C) 2004 Keith M Wesolowski |
5 | * Copyright (C) 2007 Kyle McMartin | ||
5 | * | 6 | * |
6 | * Based on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf | 7 | * Based on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf |
7 | */ | 8 | */ |
@@ -117,3 +118,17 @@ unsigned long ___change_bit(unsigned long *addr, unsigned long mask) | |||
117 | return old & mask; | 118 | return old & mask; |
118 | } | 119 | } |
119 | EXPORT_SYMBOL(___change_bit); | 120 | EXPORT_SYMBOL(___change_bit); |
121 | |||
122 | unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new) | ||
123 | { | ||
124 | unsigned long flags; | ||
125 | u32 prev; | ||
126 | |||
127 | spin_lock_irqsave(ATOMIC_HASH(ptr), flags); | ||
128 | if ((prev = *ptr) == old) | ||
129 | *ptr = new; | ||
130 | spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags); | ||
131 | |||
132 | return (unsigned long)prev; | ||
133 | } | ||
134 | EXPORT_SYMBOL(__cmpxchg_u32); | ||
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 831781cab271..bd00f89eed1e 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -147,10 +147,10 @@ config SMP | |||
147 | If you don't know what to do here, say N. | 147 | If you don't know what to do here, say N. |
148 | 148 | ||
149 | config NR_CPUS | 149 | config NR_CPUS |
150 | int "Maximum number of CPUs (2-64)" | 150 | int "Maximum number of CPUs (2-1024)" |
151 | range 2 64 | 151 | range 2 1024 |
152 | depends on SMP | 152 | depends on SMP |
153 | default "32" | 153 | default "64" |
154 | 154 | ||
155 | source "drivers/cpufreq/Kconfig" | 155 | source "drivers/cpufreq/Kconfig" |
156 | 156 | ||
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile index c749dccacc32..d8d19093d12f 100644 --- a/arch/sparc64/kernel/Makefile +++ b/arch/sparc64/kernel/Makefile | |||
@@ -8,11 +8,11 @@ EXTRA_CFLAGS := -Werror | |||
8 | extra-y := head.o init_task.o vmlinux.lds | 8 | extra-y := head.o init_task.o vmlinux.lds |
9 | 9 | ||
10 | obj-y := process.o setup.o cpu.o idprom.o \ | 10 | obj-y := process.o setup.o cpu.o idprom.o \ |
11 | traps.o devices.o auxio.o una_asm.o \ | 11 | traps.o auxio.o una_asm.o \ |
12 | irq.o ptrace.o time.o sys_sparc.o signal.o \ | 12 | irq.o ptrace.o time.o sys_sparc.o signal.o \ |
13 | unaligned.o central.o pci.o starfire.o semaphore.o \ | 13 | unaligned.o central.o pci.o starfire.o semaphore.o \ |
14 | power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ | 14 | power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ |
15 | visemul.o prom.o of_device.o hvapi.o | 15 | visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o |
16 | 16 | ||
17 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 17 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
18 | obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \ | 18 | obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \ |
diff --git a/arch/sparc64/kernel/devices.c b/arch/sparc64/kernel/devices.c deleted file mode 100644 index 0e03c8e218cd..000000000000 --- a/arch/sparc64/kernel/devices.c +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | /* devices.c: Initial scan of the prom device tree for important | ||
2 | * Sparc device nodes which we need to find. | ||
3 | * | ||
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/threads.h> | ||
9 | #include <linux/init.h> | ||
10 | #include <linux/ioport.h> | ||
11 | #include <linux/string.h> | ||
12 | #include <linux/spinlock.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/bootmem.h> | ||
15 | |||
16 | #include <asm/page.h> | ||
17 | #include <asm/oplib.h> | ||
18 | #include <asm/system.h> | ||
19 | #include <asm/smp.h> | ||
20 | #include <asm/spitfire.h> | ||
21 | #include <asm/timer.h> | ||
22 | #include <asm/cpudata.h> | ||
23 | |||
24 | /* Used to synchronize accesses to NatSemi SUPER I/O chip configure | ||
25 | * operations in asm/ns87303.h | ||
26 | */ | ||
27 | DEFINE_SPINLOCK(ns87303_lock); | ||
28 | |||
29 | extern void cpu_probe(void); | ||
30 | extern void central_probe(void); | ||
31 | |||
32 | static const char *cpu_mid_prop(void) | ||
33 | { | ||
34 | if (tlb_type == spitfire) | ||
35 | return "upa-portid"; | ||
36 | return "portid"; | ||
37 | } | ||
38 | |||
39 | static int get_cpu_mid(struct device_node *dp) | ||
40 | { | ||
41 | struct property *prop; | ||
42 | |||
43 | if (tlb_type == hypervisor) { | ||
44 | struct linux_prom64_registers *reg; | ||
45 | int len; | ||
46 | |||
47 | prop = of_find_property(dp, "cpuid", &len); | ||
48 | if (prop && len == 4) | ||
49 | return *(int *) prop->value; | ||
50 | |||
51 | prop = of_find_property(dp, "reg", NULL); | ||
52 | reg = prop->value; | ||
53 | return (reg[0].phys_addr >> 32) & 0x0fffffffUL; | ||
54 | } else { | ||
55 | const char *prop_name = cpu_mid_prop(); | ||
56 | |||
57 | prop = of_find_property(dp, prop_name, NULL); | ||
58 | if (prop) | ||
59 | return *(int *) prop->value; | ||
60 | return 0; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | static int check_cpu_node(struct device_node *dp, int *cur_inst, | ||
65 | int (*compare)(struct device_node *, int, void *), | ||
66 | void *compare_arg, | ||
67 | struct device_node **dev_node, int *mid) | ||
68 | { | ||
69 | if (!compare(dp, *cur_inst, compare_arg)) { | ||
70 | if (dev_node) | ||
71 | *dev_node = dp; | ||
72 | if (mid) | ||
73 | *mid = get_cpu_mid(dp); | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | (*cur_inst)++; | ||
78 | |||
79 | return -ENODEV; | ||
80 | } | ||
81 | |||
82 | static int __cpu_find_by(int (*compare)(struct device_node *, int, void *), | ||
83 | void *compare_arg, | ||
84 | struct device_node **dev_node, int *mid) | ||
85 | { | ||
86 | struct device_node *dp; | ||
87 | int cur_inst; | ||
88 | |||
89 | cur_inst = 0; | ||
90 | for_each_node_by_type(dp, "cpu") { | ||
91 | int err = check_cpu_node(dp, &cur_inst, | ||
92 | compare, compare_arg, | ||
93 | dev_node, mid); | ||
94 | if (err == 0) | ||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | return -ENODEV; | ||
99 | } | ||
100 | |||
101 | static int cpu_instance_compare(struct device_node *dp, int instance, void *_arg) | ||
102 | { | ||
103 | int desired_instance = (int) (long) _arg; | ||
104 | |||
105 | if (instance == desired_instance) | ||
106 | return 0; | ||
107 | return -ENODEV; | ||
108 | } | ||
109 | |||
110 | int cpu_find_by_instance(int instance, struct device_node **dev_node, int *mid) | ||
111 | { | ||
112 | return __cpu_find_by(cpu_instance_compare, (void *)(long)instance, | ||
113 | dev_node, mid); | ||
114 | } | ||
115 | |||
116 | static int cpu_mid_compare(struct device_node *dp, int instance, void *_arg) | ||
117 | { | ||
118 | int desired_mid = (int) (long) _arg; | ||
119 | int this_mid; | ||
120 | |||
121 | this_mid = get_cpu_mid(dp); | ||
122 | if (this_mid == desired_mid) | ||
123 | return 0; | ||
124 | return -ENODEV; | ||
125 | } | ||
126 | |||
127 | int cpu_find_by_mid(int mid, struct device_node **dev_node) | ||
128 | { | ||
129 | return __cpu_find_by(cpu_mid_compare, (void *)(long)mid, | ||
130 | dev_node, NULL); | ||
131 | } | ||
132 | |||
133 | void __init device_scan(void) | ||
134 | { | ||
135 | /* FIX ME FAST... -DaveM */ | ||
136 | ioport_resource.end = 0xffffffffffffffffUL; | ||
137 | |||
138 | prom_printf("Booting Linux...\n"); | ||
139 | |||
140 | #ifndef CONFIG_SMP | ||
141 | { | ||
142 | struct device_node *dp; | ||
143 | int err, def; | ||
144 | |||
145 | err = cpu_find_by_instance(0, &dp, NULL); | ||
146 | if (err) { | ||
147 | prom_printf("No cpu nodes, cannot continue\n"); | ||
148 | prom_halt(); | ||
149 | } | ||
150 | cpu_data(0).clock_tick = | ||
151 | of_getintprop_default(dp, "clock-frequency", 0); | ||
152 | |||
153 | def = ((tlb_type == hypervisor) ? | ||
154 | (8 * 1024) : | ||
155 | (16 * 1024)); | ||
156 | cpu_data(0).dcache_size = of_getintprop_default(dp, | ||
157 | "dcache-size", | ||
158 | def); | ||
159 | |||
160 | def = 32; | ||
161 | cpu_data(0).dcache_line_size = | ||
162 | of_getintprop_default(dp, "dcache-line-size", def); | ||
163 | |||
164 | def = 16 * 1024; | ||
165 | cpu_data(0).icache_size = of_getintprop_default(dp, | ||
166 | "icache-size", | ||
167 | def); | ||
168 | |||
169 | def = 32; | ||
170 | cpu_data(0).icache_line_size = | ||
171 | of_getintprop_default(dp, "icache-line-size", def); | ||
172 | |||
173 | def = ((tlb_type == hypervisor) ? | ||
174 | (3 * 1024 * 1024) : | ||
175 | (4 * 1024 * 1024)); | ||
176 | cpu_data(0).ecache_size = of_getintprop_default(dp, | ||
177 | "ecache-size", | ||
178 | def); | ||
179 | |||
180 | def = 64; | ||
181 | cpu_data(0).ecache_line_size = | ||
182 | of_getintprop_default(dp, "ecache-line-size", def); | ||
183 | printk("CPU[0]: Caches " | ||
184 | "D[sz(%d):line_sz(%d)] " | ||
185 | "I[sz(%d):line_sz(%d)] " | ||
186 | "E[sz(%d):line_sz(%d)]\n", | ||
187 | cpu_data(0).dcache_size, cpu_data(0).dcache_line_size, | ||
188 | cpu_data(0).icache_size, cpu_data(0).icache_line_size, | ||
189 | cpu_data(0).ecache_size, cpu_data(0).ecache_line_size); | ||
190 | } | ||
191 | #endif | ||
192 | |||
193 | central_probe(); | ||
194 | |||
195 | cpu_probe(); | ||
196 | } | ||
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S index 732b77cb71f8..ed712e0b3372 100644 --- a/arch/sparc64/kernel/entry.S +++ b/arch/sparc64/kernel/entry.S | |||
@@ -1725,96 +1725,142 @@ real_hard_smp_processor_id: | |||
1725 | * returns %o0: sysino | 1725 | * returns %o0: sysino |
1726 | */ | 1726 | */ |
1727 | .globl sun4v_devino_to_sysino | 1727 | .globl sun4v_devino_to_sysino |
1728 | .type sun4v_devino_to_sysino,#function | ||
1728 | sun4v_devino_to_sysino: | 1729 | sun4v_devino_to_sysino: |
1729 | mov HV_FAST_INTR_DEVINO2SYSINO, %o5 | 1730 | mov HV_FAST_INTR_DEVINO2SYSINO, %o5 |
1730 | ta HV_FAST_TRAP | 1731 | ta HV_FAST_TRAP |
1731 | retl | 1732 | retl |
1732 | mov %o1, %o0 | 1733 | mov %o1, %o0 |
1734 | .size sun4v_devino_to_sysino, .-sun4v_devino_to_sysino | ||
1733 | 1735 | ||
1734 | /* %o0: sysino | 1736 | /* %o0: sysino |
1735 | * | 1737 | * |
1736 | * returns %o0: intr_enabled (HV_INTR_{DISABLED,ENABLED}) | 1738 | * returns %o0: intr_enabled (HV_INTR_{DISABLED,ENABLED}) |
1737 | */ | 1739 | */ |
1738 | .globl sun4v_intr_getenabled | 1740 | .globl sun4v_intr_getenabled |
1741 | .type sun4v_intr_getenabled,#function | ||
1739 | sun4v_intr_getenabled: | 1742 | sun4v_intr_getenabled: |
1740 | mov HV_FAST_INTR_GETENABLED, %o5 | 1743 | mov HV_FAST_INTR_GETENABLED, %o5 |
1741 | ta HV_FAST_TRAP | 1744 | ta HV_FAST_TRAP |
1742 | retl | 1745 | retl |
1743 | mov %o1, %o0 | 1746 | mov %o1, %o0 |
1747 | .size sun4v_intr_getenabled, .-sun4v_intr_getenabled | ||
1744 | 1748 | ||
1745 | /* %o0: sysino | 1749 | /* %o0: sysino |
1746 | * %o1: intr_enabled (HV_INTR_{DISABLED,ENABLED}) | 1750 | * %o1: intr_enabled (HV_INTR_{DISABLED,ENABLED}) |
1747 | */ | 1751 | */ |
1748 | .globl sun4v_intr_setenabled | 1752 | .globl sun4v_intr_setenabled |
1753 | .type sun4v_intr_setenabled,#function | ||
1749 | sun4v_intr_setenabled: | 1754 | sun4v_intr_setenabled: |
1750 | mov HV_FAST_INTR_SETENABLED, %o5 | 1755 | mov HV_FAST_INTR_SETENABLED, %o5 |
1751 | ta HV_FAST_TRAP | 1756 | ta HV_FAST_TRAP |
1752 | retl | 1757 | retl |
1753 | nop | 1758 | nop |
1759 | .size sun4v_intr_setenabled, .-sun4v_intr_setenabled | ||
1754 | 1760 | ||
1755 | /* %o0: sysino | 1761 | /* %o0: sysino |
1756 | * | 1762 | * |
1757 | * returns %o0: intr_state (HV_INTR_STATE_*) | 1763 | * returns %o0: intr_state (HV_INTR_STATE_*) |
1758 | */ | 1764 | */ |
1759 | .globl sun4v_intr_getstate | 1765 | .globl sun4v_intr_getstate |
1766 | .type sun4v_intr_getstate,#function | ||
1760 | sun4v_intr_getstate: | 1767 | sun4v_intr_getstate: |
1761 | mov HV_FAST_INTR_GETSTATE, %o5 | 1768 | mov HV_FAST_INTR_GETSTATE, %o5 |
1762 | ta HV_FAST_TRAP | 1769 | ta HV_FAST_TRAP |
1763 | retl | 1770 | retl |
1764 | mov %o1, %o0 | 1771 | mov %o1, %o0 |
1772 | .size sun4v_intr_getstate, .-sun4v_intr_getstate | ||
1765 | 1773 | ||
1766 | /* %o0: sysino | 1774 | /* %o0: sysino |
1767 | * %o1: intr_state (HV_INTR_STATE_*) | 1775 | * %o1: intr_state (HV_INTR_STATE_*) |
1768 | */ | 1776 | */ |
1769 | .globl sun4v_intr_setstate | 1777 | .globl sun4v_intr_setstate |
1778 | .type sun4v_intr_setstate,#function | ||
1770 | sun4v_intr_setstate: | 1779 | sun4v_intr_setstate: |
1771 | mov HV_FAST_INTR_SETSTATE, %o5 | 1780 | mov HV_FAST_INTR_SETSTATE, %o5 |
1772 | ta HV_FAST_TRAP | 1781 | ta HV_FAST_TRAP |
1773 | retl | 1782 | retl |
1774 | nop | 1783 | nop |
1784 | .size sun4v_intr_setstate, .-sun4v_intr_setstate | ||
1775 | 1785 | ||
1776 | /* %o0: sysino | 1786 | /* %o0: sysino |
1777 | * | 1787 | * |
1778 | * returns %o0: cpuid | 1788 | * returns %o0: cpuid |
1779 | */ | 1789 | */ |
1780 | .globl sun4v_intr_gettarget | 1790 | .globl sun4v_intr_gettarget |
1791 | .type sun4v_intr_gettarget,#function | ||
1781 | sun4v_intr_gettarget: | 1792 | sun4v_intr_gettarget: |
1782 | mov HV_FAST_INTR_GETTARGET, %o5 | 1793 | mov HV_FAST_INTR_GETTARGET, %o5 |
1783 | ta HV_FAST_TRAP | 1794 | ta HV_FAST_TRAP |
1784 | retl | 1795 | retl |
1785 | mov %o1, %o0 | 1796 | mov %o1, %o0 |
1797 | .size sun4v_intr_gettarget, .-sun4v_intr_gettarget | ||
1786 | 1798 | ||
1787 | /* %o0: sysino | 1799 | /* %o0: sysino |
1788 | * %o1: cpuid | 1800 | * %o1: cpuid |
1789 | */ | 1801 | */ |
1790 | .globl sun4v_intr_settarget | 1802 | .globl sun4v_intr_settarget |
1803 | .type sun4v_intr_settarget,#function | ||
1791 | sun4v_intr_settarget: | 1804 | sun4v_intr_settarget: |
1792 | mov HV_FAST_INTR_SETTARGET, %o5 | 1805 | mov HV_FAST_INTR_SETTARGET, %o5 |
1793 | ta HV_FAST_TRAP | 1806 | ta HV_FAST_TRAP |
1794 | retl | 1807 | retl |
1795 | nop | 1808 | nop |
1809 | .size sun4v_intr_settarget, .-sun4v_intr_settarget | ||
1796 | 1810 | ||
1797 | /* %o0: type | 1811 | /* %o0: cpuid |
1798 | * %o1: queue paddr | 1812 | * %o1: pc |
1799 | * %o2: num queue entries | 1813 | * %o2: rtba |
1814 | * %o3: arg0 | ||
1800 | * | 1815 | * |
1801 | * returns %o0: status | 1816 | * returns %o0: status |
1802 | */ | 1817 | */ |
1803 | .globl sun4v_cpu_qconf | 1818 | .globl sun4v_cpu_start |
1804 | sun4v_cpu_qconf: | 1819 | .type sun4v_cpu_start,#function |
1805 | mov HV_FAST_CPU_QCONF, %o5 | 1820 | sun4v_cpu_start: |
1821 | mov HV_FAST_CPU_START, %o5 | ||
1806 | ta HV_FAST_TRAP | 1822 | ta HV_FAST_TRAP |
1807 | retl | 1823 | retl |
1808 | nop | 1824 | nop |
1825 | .size sun4v_cpu_start, .-sun4v_cpu_start | ||
1809 | 1826 | ||
1810 | /* returns %o0: status | 1827 | /* %o0: cpuid |
1828 | * | ||
1829 | * returns %o0: status | ||
1811 | */ | 1830 | */ |
1831 | .globl sun4v_cpu_stop | ||
1832 | .type sun4v_cpu_stop,#function | ||
1833 | sun4v_cpu_stop: | ||
1834 | mov HV_FAST_CPU_STOP, %o5 | ||
1835 | ta HV_FAST_TRAP | ||
1836 | retl | ||
1837 | nop | ||
1838 | .size sun4v_cpu_stop, .-sun4v_cpu_stop | ||
1839 | |||
1840 | /* returns %o0: status */ | ||
1812 | .globl sun4v_cpu_yield | 1841 | .globl sun4v_cpu_yield |
1842 | .type sun4v_cpu_yield, #function | ||
1813 | sun4v_cpu_yield: | 1843 | sun4v_cpu_yield: |
1814 | mov HV_FAST_CPU_YIELD, %o5 | 1844 | mov HV_FAST_CPU_YIELD, %o5 |
1815 | ta HV_FAST_TRAP | 1845 | ta HV_FAST_TRAP |
1816 | retl | 1846 | retl |
1817 | nop | 1847 | nop |
1848 | .size sun4v_cpu_yield, .-sun4v_cpu_yield | ||
1849 | |||
1850 | /* %o0: type | ||
1851 | * %o1: queue paddr | ||
1852 | * %o2: num queue entries | ||
1853 | * | ||
1854 | * returns %o0: status | ||
1855 | */ | ||
1856 | .globl sun4v_cpu_qconf | ||
1857 | .type sun4v_cpu_qconf,#function | ||
1858 | sun4v_cpu_qconf: | ||
1859 | mov HV_FAST_CPU_QCONF, %o5 | ||
1860 | ta HV_FAST_TRAP | ||
1861 | retl | ||
1862 | nop | ||
1863 | .size sun4v_cpu_qconf, .-sun4v_cpu_qconf | ||
1818 | 1864 | ||
1819 | /* %o0: num cpus in cpu list | 1865 | /* %o0: num cpus in cpu list |
1820 | * %o1: cpu list paddr | 1866 | * %o1: cpu list paddr |
@@ -1823,11 +1869,13 @@ sun4v_cpu_yield: | |||
1823 | * returns %o0: status | 1869 | * returns %o0: status |
1824 | */ | 1870 | */ |
1825 | .globl sun4v_cpu_mondo_send | 1871 | .globl sun4v_cpu_mondo_send |
1872 | .type sun4v_cpu_mondo_send,#function | ||
1826 | sun4v_cpu_mondo_send: | 1873 | sun4v_cpu_mondo_send: |
1827 | mov HV_FAST_CPU_MONDO_SEND, %o5 | 1874 | mov HV_FAST_CPU_MONDO_SEND, %o5 |
1828 | ta HV_FAST_TRAP | 1875 | ta HV_FAST_TRAP |
1829 | retl | 1876 | retl |
1830 | nop | 1877 | nop |
1878 | .size sun4v_cpu_mondo_send, .-sun4v_cpu_mondo_send | ||
1831 | 1879 | ||
1832 | /* %o0: CPU ID | 1880 | /* %o0: CPU ID |
1833 | * | 1881 | * |
@@ -1835,6 +1883,7 @@ sun4v_cpu_mondo_send: | |||
1835 | * %o0: cpu state as HV_CPU_STATE_* | 1883 | * %o0: cpu state as HV_CPU_STATE_* |
1836 | */ | 1884 | */ |
1837 | .globl sun4v_cpu_state | 1885 | .globl sun4v_cpu_state |
1886 | .type sun4v_cpu_state,#function | ||
1838 | sun4v_cpu_state: | 1887 | sun4v_cpu_state: |
1839 | mov HV_FAST_CPU_STATE, %o5 | 1888 | mov HV_FAST_CPU_STATE, %o5 |
1840 | ta HV_FAST_TRAP | 1889 | ta HV_FAST_TRAP |
@@ -1843,6 +1892,37 @@ sun4v_cpu_state: | |||
1843 | mov %o1, %o0 | 1892 | mov %o1, %o0 |
1844 | 1: retl | 1893 | 1: retl |
1845 | nop | 1894 | nop |
1895 | .size sun4v_cpu_state, .-sun4v_cpu_state | ||
1896 | |||
1897 | /* %o0: virtual address | ||
1898 | * %o1: must be zero | ||
1899 | * %o2: TTE | ||
1900 | * %o3: HV_MMU_* flags | ||
1901 | * | ||
1902 | * returns %o0: status | ||
1903 | */ | ||
1904 | .globl sun4v_mmu_map_perm_addr | ||
1905 | .type sun4v_mmu_map_perm_addr,#function | ||
1906 | sun4v_mmu_map_perm_addr: | ||
1907 | mov HV_FAST_MMU_MAP_PERM_ADDR, %o5 | ||
1908 | ta HV_FAST_TRAP | ||
1909 | retl | ||
1910 | nop | ||
1911 | .size sun4v_mmu_map_perm_addr, .-sun4v_mmu_map_perm_addr | ||
1912 | |||
1913 | /* %o0: number of TSB descriptions | ||
1914 | * %o1: TSB descriptions real address | ||
1915 | * | ||
1916 | * returns %o0: status | ||
1917 | */ | ||
1918 | .globl sun4v_mmu_tsb_ctx0 | ||
1919 | .type sun4v_mmu_tsb_ctx0,#function | ||
1920 | sun4v_mmu_tsb_ctx0: | ||
1921 | mov HV_FAST_MMU_TSB_CTX0, %o5 | ||
1922 | ta HV_FAST_TRAP | ||
1923 | retl | ||
1924 | nop | ||
1925 | .size sun4v_mmu_tsb_ctx0, .-sun4v_mmu_tsb_ctx0 | ||
1846 | 1926 | ||
1847 | /* %o0: API group number | 1927 | /* %o0: API group number |
1848 | * %o1: pointer to unsigned long major number storage | 1928 | * %o1: pointer to unsigned long major number storage |
@@ -1851,6 +1931,7 @@ sun4v_cpu_state: | |||
1851 | * returns %o0: status | 1931 | * returns %o0: status |
1852 | */ | 1932 | */ |
1853 | .globl sun4v_get_version | 1933 | .globl sun4v_get_version |
1934 | .type sun4v_get_version,#function | ||
1854 | sun4v_get_version: | 1935 | sun4v_get_version: |
1855 | mov HV_CORE_GET_VER, %o5 | 1936 | mov HV_CORE_GET_VER, %o5 |
1856 | mov %o1, %o3 | 1937 | mov %o1, %o3 |
@@ -1859,6 +1940,7 @@ sun4v_get_version: | |||
1859 | stx %o1, [%o3] | 1940 | stx %o1, [%o3] |
1860 | retl | 1941 | retl |
1861 | stx %o2, [%o4] | 1942 | stx %o2, [%o4] |
1943 | .size sun4v_get_version, .-sun4v_get_version | ||
1862 | 1944 | ||
1863 | /* %o0: API group number | 1945 | /* %o0: API group number |
1864 | * %o1: desired major number | 1946 | * %o1: desired major number |
@@ -1868,18 +1950,49 @@ sun4v_get_version: | |||
1868 | * returns %o0: status | 1950 | * returns %o0: status |
1869 | */ | 1951 | */ |
1870 | .globl sun4v_set_version | 1952 | .globl sun4v_set_version |
1953 | .type sun4v_set_version,#function | ||
1871 | sun4v_set_version: | 1954 | sun4v_set_version: |
1872 | mov HV_CORE_SET_VER, %o5 | 1955 | mov HV_CORE_SET_VER, %o5 |
1873 | mov %o3, %o4 | 1956 | mov %o3, %o4 |
1874 | ta HV_CORE_TRAP | 1957 | ta HV_CORE_TRAP |
1875 | retl | 1958 | retl |
1876 | stx %o1, [%o4] | 1959 | stx %o1, [%o4] |
1960 | .size sun4v_set_version, .-sun4v_set_version | ||
1961 | |||
1962 | /* %o0: pointer to unsigned long time | ||
1963 | * | ||
1964 | * returns %o0: status | ||
1965 | */ | ||
1966 | .globl sun4v_tod_get | ||
1967 | .type sun4v_tod_get,#function | ||
1968 | sun4v_tod_get: | ||
1969 | mov %o0, %o4 | ||
1970 | mov HV_FAST_TOD_GET, %o5 | ||
1971 | ta HV_FAST_TRAP | ||
1972 | stx %o1, [%o4] | ||
1973 | retl | ||
1974 | nop | ||
1975 | .size sun4v_tod_get, .-sun4v_tod_get | ||
1976 | |||
1977 | /* %o0: time | ||
1978 | * | ||
1979 | * returns %o0: status | ||
1980 | */ | ||
1981 | .globl sun4v_tod_set | ||
1982 | .type sun4v_tod_set,#function | ||
1983 | sun4v_tod_set: | ||
1984 | mov HV_FAST_TOD_SET, %o5 | ||
1985 | ta HV_FAST_TRAP | ||
1986 | retl | ||
1987 | nop | ||
1988 | .size sun4v_tod_set, .-sun4v_tod_set | ||
1877 | 1989 | ||
1878 | /* %o0: pointer to unsigned long status | 1990 | /* %o0: pointer to unsigned long status |
1879 | * | 1991 | * |
1880 | * returns %o0: signed character | 1992 | * returns %o0: signed character |
1881 | */ | 1993 | */ |
1882 | .globl sun4v_con_getchar | 1994 | .globl sun4v_con_getchar |
1995 | .type sun4v_con_getchar,#function | ||
1883 | sun4v_con_getchar: | 1996 | sun4v_con_getchar: |
1884 | mov %o0, %o4 | 1997 | mov %o0, %o4 |
1885 | mov HV_FAST_CONS_GETCHAR, %o5 | 1998 | mov HV_FAST_CONS_GETCHAR, %o5 |
@@ -1889,17 +2002,20 @@ sun4v_con_getchar: | |||
1889 | stx %o0, [%o4] | 2002 | stx %o0, [%o4] |
1890 | retl | 2003 | retl |
1891 | sra %o1, 0, %o0 | 2004 | sra %o1, 0, %o0 |
2005 | .size sun4v_con_getchar, .-sun4v_con_getchar | ||
1892 | 2006 | ||
1893 | /* %o0: signed long character | 2007 | /* %o0: signed long character |
1894 | * | 2008 | * |
1895 | * returns %o0: status | 2009 | * returns %o0: status |
1896 | */ | 2010 | */ |
1897 | .globl sun4v_con_putchar | 2011 | .globl sun4v_con_putchar |
2012 | .type sun4v_con_putchar,#function | ||
1898 | sun4v_con_putchar: | 2013 | sun4v_con_putchar: |
1899 | mov HV_FAST_CONS_PUTCHAR, %o5 | 2014 | mov HV_FAST_CONS_PUTCHAR, %o5 |
1900 | ta HV_FAST_TRAP | 2015 | ta HV_FAST_TRAP |
1901 | retl | 2016 | retl |
1902 | sra %o0, 0, %o0 | 2017 | sra %o0, 0, %o0 |
2018 | .size sun4v_con_putchar, .-sun4v_con_putchar | ||
1903 | 2019 | ||
1904 | /* %o0: buffer real address | 2020 | /* %o0: buffer real address |
1905 | * %o1: buffer size | 2021 | * %o1: buffer size |
@@ -1908,6 +2024,7 @@ sun4v_con_putchar: | |||
1908 | * returns %o0: status | 2024 | * returns %o0: status |
1909 | */ | 2025 | */ |
1910 | .globl sun4v_con_read | 2026 | .globl sun4v_con_read |
2027 | .type sun4v_con_read,#function | ||
1911 | sun4v_con_read: | 2028 | sun4v_con_read: |
1912 | mov %o2, %o4 | 2029 | mov %o2, %o4 |
1913 | mov HV_FAST_CONS_READ, %o5 | 2030 | mov HV_FAST_CONS_READ, %o5 |
@@ -1922,6 +2039,7 @@ sun4v_con_read: | |||
1922 | stx %o1, [%o4] | 2039 | stx %o1, [%o4] |
1923 | 1: retl | 2040 | 1: retl |
1924 | nop | 2041 | nop |
2042 | .size sun4v_con_read, .-sun4v_con_read | ||
1925 | 2043 | ||
1926 | /* %o0: buffer real address | 2044 | /* %o0: buffer real address |
1927 | * %o1: buffer size | 2045 | * %o1: buffer size |
@@ -1930,6 +2048,7 @@ sun4v_con_read: | |||
1930 | * returns %o0: status | 2048 | * returns %o0: status |
1931 | */ | 2049 | */ |
1932 | .globl sun4v_con_write | 2050 | .globl sun4v_con_write |
2051 | .type sun4v_con_write,#function | ||
1933 | sun4v_con_write: | 2052 | sun4v_con_write: |
1934 | mov %o2, %o4 | 2053 | mov %o2, %o4 |
1935 | mov HV_FAST_CONS_WRITE, %o5 | 2054 | mov HV_FAST_CONS_WRITE, %o5 |
@@ -1937,3 +2056,517 @@ sun4v_con_write: | |||
1937 | stx %o1, [%o4] | 2056 | stx %o1, [%o4] |
1938 | retl | 2057 | retl |
1939 | nop | 2058 | nop |
2059 | .size sun4v_con_write, .-sun4v_con_write | ||
2060 | |||
2061 | /* %o0: soft state | ||
2062 | * %o1: address of description string | ||
2063 | * | ||
2064 | * returns %o0: status | ||
2065 | */ | ||
2066 | .globl sun4v_mach_set_soft_state | ||
2067 | .type sun4v_mach_set_soft_state,#function | ||
2068 | sun4v_mach_set_soft_state: | ||
2069 | mov HV_FAST_MACH_SET_SOFT_STATE, %o5 | ||
2070 | ta HV_FAST_TRAP | ||
2071 | retl | ||
2072 | nop | ||
2073 | .size sun4v_mach_set_soft_state, .-sun4v_mach_set_soft_state | ||
2074 | |||
2075 | /* %o0: exit code | ||
2076 | * | ||
2077 | * Does not return. | ||
2078 | */ | ||
2079 | .globl sun4v_mach_exit | ||
2080 | .type sun4v_mach_exit,#function | ||
2081 | sun4v_mach_exit: | ||
2082 | mov HV_FAST_MACH_EXIT, %o5 | ||
2083 | ta HV_FAST_TRAP | ||
2084 | retl | ||
2085 | nop | ||
2086 | .size sun4v_mach_exit, .-sun4v_mach_exit | ||
2087 | |||
2088 | /* %o0: buffer real address | ||
2089 | * %o1: buffer length | ||
2090 | * %o2: pointer to unsigned long real_buf_len | ||
2091 | * | ||
2092 | * returns %o0: status | ||
2093 | */ | ||
2094 | .globl sun4v_mach_desc | ||
2095 | .type sun4v_mach_desc,#function | ||
2096 | sun4v_mach_desc: | ||
2097 | mov %o2, %o4 | ||
2098 | mov HV_FAST_MACH_DESC, %o5 | ||
2099 | ta HV_FAST_TRAP | ||
2100 | stx %o1, [%o4] | ||
2101 | retl | ||
2102 | nop | ||
2103 | .size sun4v_mach_desc, .-sun4v_mach_desc | ||
2104 | |||
2105 | /* %o0: new timeout in milliseconds | ||
2106 | * %o1: pointer to unsigned long orig_timeout | ||
2107 | * | ||
2108 | * returns %o0: status | ||
2109 | */ | ||
2110 | .globl sun4v_mach_set_watchdog | ||
2111 | .type sun4v_mach_set_watchdog,#function | ||
2112 | sun4v_mach_set_watchdog: | ||
2113 | mov %o1, %o4 | ||
2114 | mov HV_FAST_MACH_SET_WATCHDOG, %o5 | ||
2115 | ta HV_FAST_TRAP | ||
2116 | stx %o1, [%o4] | ||
2117 | retl | ||
2118 | nop | ||
2119 | .size sun4v_mach_set_watchdog, .-sun4v_mach_set_watchdog | ||
2120 | |||
2121 | /* No inputs and does not return. */ | ||
2122 | .globl sun4v_mach_sir | ||
2123 | .type sun4v_mach_sir,#function | ||
2124 | sun4v_mach_sir: | ||
2125 | mov %o1, %o4 | ||
2126 | mov HV_FAST_MACH_SIR, %o5 | ||
2127 | ta HV_FAST_TRAP | ||
2128 | stx %o1, [%o4] | ||
2129 | retl | ||
2130 | nop | ||
2131 | .size sun4v_mach_sir, .-sun4v_mach_sir | ||
2132 | |||
2133 | /* %o0: channel | ||
2134 | * %o1: ra | ||
2135 | * %o2: num_entries | ||
2136 | * | ||
2137 | * returns %o0: status | ||
2138 | */ | ||
2139 | .globl sun4v_ldc_tx_qconf | ||
2140 | .type sun4v_ldc_tx_qconf,#function | ||
2141 | sun4v_ldc_tx_qconf: | ||
2142 | mov HV_FAST_LDC_TX_QCONF, %o5 | ||
2143 | ta HV_FAST_TRAP | ||
2144 | retl | ||
2145 | nop | ||
2146 | .size sun4v_ldc_tx_qconf, .-sun4v_ldc_tx_qconf | ||
2147 | |||
2148 | /* %o0: channel | ||
2149 | * %o1: pointer to unsigned long ra | ||
2150 | * %o2: pointer to unsigned long num_entries | ||
2151 | * | ||
2152 | * returns %o0: status | ||
2153 | */ | ||
2154 | .globl sun4v_ldc_tx_qinfo | ||
2155 | .type sun4v_ldc_tx_qinfo,#function | ||
2156 | sun4v_ldc_tx_qinfo: | ||
2157 | mov %o1, %g1 | ||
2158 | mov %o2, %g2 | ||
2159 | mov HV_FAST_LDC_TX_QINFO, %o5 | ||
2160 | ta HV_FAST_TRAP | ||
2161 | stx %o1, [%g1] | ||
2162 | stx %o2, [%g2] | ||
2163 | retl | ||
2164 | nop | ||
2165 | .size sun4v_ldc_tx_qinfo, .-sun4v_ldc_tx_qinfo | ||
2166 | |||
2167 | /* %o0: channel | ||
2168 | * %o1: pointer to unsigned long head_off | ||
2169 | * %o2: pointer to unsigned long tail_off | ||
2170 | * %o2: pointer to unsigned long chan_state | ||
2171 | * | ||
2172 | * returns %o0: status | ||
2173 | */ | ||
2174 | .globl sun4v_ldc_tx_get_state | ||
2175 | .type sun4v_ldc_tx_get_state,#function | ||
2176 | sun4v_ldc_tx_get_state: | ||
2177 | mov %o1, %g1 | ||
2178 | mov %o2, %g2 | ||
2179 | mov %o3, %g3 | ||
2180 | mov HV_FAST_LDC_TX_GET_STATE, %o5 | ||
2181 | ta HV_FAST_TRAP | ||
2182 | stx %o1, [%g1] | ||
2183 | stx %o2, [%g2] | ||
2184 | stx %o3, [%g3] | ||
2185 | retl | ||
2186 | nop | ||
2187 | .size sun4v_ldc_tx_get_state, .-sun4v_ldc_tx_get_state | ||
2188 | |||
2189 | /* %o0: channel | ||
2190 | * %o1: tail_off | ||
2191 | * | ||
2192 | * returns %o0: status | ||
2193 | */ | ||
2194 | .globl sun4v_ldc_tx_set_qtail | ||
2195 | .type sun4v_ldc_tx_set_qtail,#function | ||
2196 | sun4v_ldc_tx_set_qtail: | ||
2197 | mov HV_FAST_LDC_TX_SET_QTAIL, %o5 | ||
2198 | ta HV_FAST_TRAP | ||
2199 | retl | ||
2200 | nop | ||
2201 | .size sun4v_ldc_tx_set_qtail, .-sun4v_ldc_tx_set_qtail | ||
2202 | |||
2203 | /* %o0: channel | ||
2204 | * %o1: ra | ||
2205 | * %o2: num_entries | ||
2206 | * | ||
2207 | * returns %o0: status | ||
2208 | */ | ||
2209 | .globl sun4v_ldc_rx_qconf | ||
2210 | .type sun4v_ldc_rx_qconf,#function | ||
2211 | sun4v_ldc_rx_qconf: | ||
2212 | mov HV_FAST_LDC_RX_QCONF, %o5 | ||
2213 | ta HV_FAST_TRAP | ||
2214 | retl | ||
2215 | nop | ||
2216 | .size sun4v_ldc_rx_qconf, .-sun4v_ldc_rx_qconf | ||
2217 | |||
2218 | /* %o0: channel | ||
2219 | * %o1: pointer to unsigned long ra | ||
2220 | * %o2: pointer to unsigned long num_entries | ||
2221 | * | ||
2222 | * returns %o0: status | ||
2223 | */ | ||
2224 | .globl sun4v_ldc_rx_qinfo | ||
2225 | .type sun4v_ldc_rx_qinfo,#function | ||
2226 | sun4v_ldc_rx_qinfo: | ||
2227 | mov %o1, %g1 | ||
2228 | mov %o2, %g2 | ||
2229 | mov HV_FAST_LDC_RX_QINFO, %o5 | ||
2230 | ta HV_FAST_TRAP | ||
2231 | stx %o1, [%g1] | ||
2232 | stx %o2, [%g2] | ||
2233 | retl | ||
2234 | nop | ||
2235 | .size sun4v_ldc_rx_qinfo, .-sun4v_ldc_rx_qinfo | ||
2236 | |||
2237 | /* %o0: channel | ||
2238 | * %o1: pointer to unsigned long head_off | ||
2239 | * %o2: pointer to unsigned long tail_off | ||
2240 | * %o2: pointer to unsigned long chan_state | ||
2241 | * | ||
2242 | * returns %o0: status | ||
2243 | */ | ||
2244 | .globl sun4v_ldc_rx_get_state | ||
2245 | .type sun4v_ldc_rx_get_state,#function | ||
2246 | sun4v_ldc_rx_get_state: | ||
2247 | mov %o1, %g1 | ||
2248 | mov %o2, %g2 | ||
2249 | mov %o3, %g3 | ||
2250 | mov HV_FAST_LDC_RX_GET_STATE, %o5 | ||
2251 | ta HV_FAST_TRAP | ||
2252 | stx %o1, [%g1] | ||
2253 | stx %o2, [%g2] | ||
2254 | stx %o3, [%g3] | ||
2255 | retl | ||
2256 | nop | ||
2257 | .size sun4v_ldc_rx_get_state, .-sun4v_ldc_rx_get_state | ||
2258 | |||
2259 | /* %o0: channel | ||
2260 | * %o1: head_off | ||
2261 | * | ||
2262 | * returns %o0: status | ||
2263 | */ | ||
2264 | .globl sun4v_ldc_rx_set_qhead | ||
2265 | .type sun4v_ldc_rx_set_qhead,#function | ||
2266 | sun4v_ldc_rx_set_qhead: | ||
2267 | mov HV_FAST_LDC_RX_SET_QHEAD, %o5 | ||
2268 | ta HV_FAST_TRAP | ||
2269 | retl | ||
2270 | nop | ||
2271 | .size sun4v_ldc_rx_set_qhead, .-sun4v_ldc_rx_set_qhead | ||
2272 | |||
2273 | /* %o0: channel | ||
2274 | * %o1: ra | ||
2275 | * %o2: num_entries | ||
2276 | * | ||
2277 | * returns %o0: status | ||
2278 | */ | ||
2279 | .globl sun4v_ldc_set_map_table | ||
2280 | .type sun4v_ldc_set_map_table,#function | ||
2281 | sun4v_ldc_set_map_table: | ||
2282 | mov HV_FAST_LDC_SET_MAP_TABLE, %o5 | ||
2283 | ta HV_FAST_TRAP | ||
2284 | retl | ||
2285 | nop | ||
2286 | .size sun4v_ldc_set_map_table, .-sun4v_ldc_set_map_table | ||
2287 | |||
2288 | /* %o0: channel | ||
2289 | * %o1: pointer to unsigned long ra | ||
2290 | * %o2: pointer to unsigned long num_entries | ||
2291 | * | ||
2292 | * returns %o0: status | ||
2293 | */ | ||
2294 | .globl sun4v_ldc_get_map_table | ||
2295 | .type sun4v_ldc_get_map_table,#function | ||
2296 | sun4v_ldc_get_map_table: | ||
2297 | mov %o1, %g1 | ||
2298 | mov %o2, %g2 | ||
2299 | mov HV_FAST_LDC_GET_MAP_TABLE, %o5 | ||
2300 | ta HV_FAST_TRAP | ||
2301 | stx %o1, [%g1] | ||
2302 | stx %o2, [%g2] | ||
2303 | retl | ||
2304 | nop | ||
2305 | .size sun4v_ldc_get_map_table, .-sun4v_ldc_get_map_table | ||
2306 | |||
2307 | /* %o0: channel | ||
2308 | * %o1: dir_code | ||
2309 | * %o2: tgt_raddr | ||
2310 | * %o3: lcl_raddr | ||
2311 | * %o4: len | ||
2312 | * %o5: pointer to unsigned long actual_len | ||
2313 | * | ||
2314 | * returns %o0: status | ||
2315 | */ | ||
2316 | .globl sun4v_ldc_copy | ||
2317 | .type sun4v_ldc_copy,#function | ||
2318 | sun4v_ldc_copy: | ||
2319 | mov %o5, %g1 | ||
2320 | mov HV_FAST_LDC_COPY, %o5 | ||
2321 | ta HV_FAST_TRAP | ||
2322 | stx %o1, [%g1] | ||
2323 | retl | ||
2324 | nop | ||
2325 | .size sun4v_ldc_copy, .-sun4v_ldc_copy | ||
2326 | |||
2327 | /* %o0: channel | ||
2328 | * %o1: cookie | ||
2329 | * %o2: pointer to unsigned long ra | ||
2330 | * %o3: pointer to unsigned long perm | ||
2331 | * | ||
2332 | * returns %o0: status | ||
2333 | */ | ||
2334 | .globl sun4v_ldc_mapin | ||
2335 | .type sun4v_ldc_mapin,#function | ||
2336 | sun4v_ldc_mapin: | ||
2337 | mov %o2, %g1 | ||
2338 | mov %o3, %g2 | ||
2339 | mov HV_FAST_LDC_MAPIN, %o5 | ||
2340 | ta HV_FAST_TRAP | ||
2341 | stx %o1, [%g1] | ||
2342 | stx %o2, [%g2] | ||
2343 | retl | ||
2344 | nop | ||
2345 | .size sun4v_ldc_mapin, .-sun4v_ldc_mapin | ||
2346 | |||
2347 | /* %o0: ra | ||
2348 | * | ||
2349 | * returns %o0: status | ||
2350 | */ | ||
2351 | .globl sun4v_ldc_unmap | ||
2352 | .type sun4v_ldc_unmap,#function | ||
2353 | sun4v_ldc_unmap: | ||
2354 | mov HV_FAST_LDC_UNMAP, %o5 | ||
2355 | ta HV_FAST_TRAP | ||
2356 | retl | ||
2357 | nop | ||
2358 | .size sun4v_ldc_unmap, .-sun4v_ldc_unmap | ||
2359 | |||
2360 | /* %o0: cookie | ||
2361 | * %o1: mte_cookie | ||
2362 | * | ||
2363 | * returns %o0: status | ||
2364 | */ | ||
2365 | .globl sun4v_ldc_revoke | ||
2366 | .type sun4v_ldc_revoke,#function | ||
2367 | sun4v_ldc_revoke: | ||
2368 | mov HV_FAST_LDC_REVOKE, %o5 | ||
2369 | ta HV_FAST_TRAP | ||
2370 | retl | ||
2371 | nop | ||
2372 | .size sun4v_ldc_revoke, .-sun4v_ldc_revoke | ||
2373 | |||
2374 | /* %o0: device handle | ||
2375 | * %o1: device INO | ||
2376 | * %o2: pointer to unsigned long cookie | ||
2377 | * | ||
2378 | * returns %o0: status | ||
2379 | */ | ||
2380 | .globl sun4v_vintr_get_cookie | ||
2381 | .type sun4v_vintr_get_cookie,#function | ||
2382 | sun4v_vintr_get_cookie: | ||
2383 | mov %o2, %g1 | ||
2384 | mov HV_FAST_VINTR_GET_COOKIE, %o5 | ||
2385 | ta HV_FAST_TRAP | ||
2386 | stx %o1, [%g1] | ||
2387 | retl | ||
2388 | nop | ||
2389 | .size sun4v_vintr_get_cookie, .-sun4v_vintr_get_cookie | ||
2390 | |||
2391 | /* %o0: device handle | ||
2392 | * %o1: device INO | ||
2393 | * %o2: cookie | ||
2394 | * | ||
2395 | * returns %o0: status | ||
2396 | */ | ||
2397 | .globl sun4v_vintr_set_cookie | ||
2398 | .type sun4v_vintr_set_cookie,#function | ||
2399 | sun4v_vintr_set_cookie: | ||
2400 | mov HV_FAST_VINTR_SET_COOKIE, %o5 | ||
2401 | ta HV_FAST_TRAP | ||
2402 | retl | ||
2403 | nop | ||
2404 | .size sun4v_vintr_set_cookie, .-sun4v_vintr_set_cookie | ||
2405 | |||
2406 | /* %o0: device handle | ||
2407 | * %o1: device INO | ||
2408 | * %o2: pointer to unsigned long valid_state | ||
2409 | * | ||
2410 | * returns %o0: status | ||
2411 | */ | ||
2412 | .globl sun4v_vintr_get_valid | ||
2413 | .type sun4v_vintr_get_valid,#function | ||
2414 | sun4v_vintr_get_valid: | ||
2415 | mov %o2, %g1 | ||
2416 | mov HV_FAST_VINTR_GET_VALID, %o5 | ||
2417 | ta HV_FAST_TRAP | ||
2418 | stx %o1, [%g1] | ||
2419 | retl | ||
2420 | nop | ||
2421 | .size sun4v_vintr_get_valid, .-sun4v_vintr_get_valid | ||
2422 | |||
2423 | /* %o0: device handle | ||
2424 | * %o1: device INO | ||
2425 | * %o2: valid_state | ||
2426 | * | ||
2427 | * returns %o0: status | ||
2428 | */ | ||
2429 | .globl sun4v_vintr_set_valid | ||
2430 | .type sun4v_vintr_set_valid,#function | ||
2431 | sun4v_vintr_set_valid: | ||
2432 | mov HV_FAST_VINTR_SET_VALID, %o5 | ||
2433 | ta HV_FAST_TRAP | ||
2434 | retl | ||
2435 | nop | ||
2436 | .size sun4v_vintr_set_valid, .-sun4v_vintr_set_valid | ||
2437 | |||
2438 | /* %o0: device handle | ||
2439 | * %o1: device INO | ||
2440 | * %o2: pointer to unsigned long state | ||
2441 | * | ||
2442 | * returns %o0: status | ||
2443 | */ | ||
2444 | .globl sun4v_vintr_get_state | ||
2445 | .type sun4v_vintr_get_state,#function | ||
2446 | sun4v_vintr_get_state: | ||
2447 | mov %o2, %g1 | ||
2448 | mov HV_FAST_VINTR_GET_STATE, %o5 | ||
2449 | ta HV_FAST_TRAP | ||
2450 | stx %o1, [%g1] | ||
2451 | retl | ||
2452 | nop | ||
2453 | .size sun4v_vintr_get_state, .-sun4v_vintr_get_state | ||
2454 | |||
2455 | /* %o0: device handle | ||
2456 | * %o1: device INO | ||
2457 | * %o2: state | ||
2458 | * | ||
2459 | * returns %o0: status | ||
2460 | */ | ||
2461 | .globl sun4v_vintr_set_state | ||
2462 | .type sun4v_vintr_set_state,#function | ||
2463 | sun4v_vintr_set_state: | ||
2464 | mov HV_FAST_VINTR_SET_STATE, %o5 | ||
2465 | ta HV_FAST_TRAP | ||
2466 | retl | ||
2467 | nop | ||
2468 | .size sun4v_vintr_set_state, .-sun4v_vintr_set_state | ||
2469 | |||
2470 | /* %o0: device handle | ||
2471 | * %o1: device INO | ||
2472 | * %o2: pointer to unsigned long cpuid | ||
2473 | * | ||
2474 | * returns %o0: status | ||
2475 | */ | ||
2476 | .globl sun4v_vintr_get_target | ||
2477 | .type sun4v_vintr_get_target,#function | ||
2478 | sun4v_vintr_get_target: | ||
2479 | mov %o2, %g1 | ||
2480 | mov HV_FAST_VINTR_GET_TARGET, %o5 | ||
2481 | ta HV_FAST_TRAP | ||
2482 | stx %o1, [%g1] | ||
2483 | retl | ||
2484 | nop | ||
2485 | .size sun4v_vintr_get_target, .-sun4v_vintr_get_target | ||
2486 | |||
2487 | /* %o0: device handle | ||
2488 | * %o1: device INO | ||
2489 | * %o2: cpuid | ||
2490 | * | ||
2491 | * returns %o0: status | ||
2492 | */ | ||
2493 | .globl sun4v_vintr_set_target | ||
2494 | .type sun4v_vintr_set_target,#function | ||
2495 | sun4v_vintr_set_target: | ||
2496 | mov HV_FAST_VINTR_SET_TARGET, %o5 | ||
2497 | ta HV_FAST_TRAP | ||
2498 | retl | ||
2499 | nop | ||
2500 | .size sun4v_vintr_set_target, .-sun4v_vintr_set_target | ||
2501 | |||
2502 | /* %o0: NCS sub-function | ||
2503 | * %o1: sub-function arg real-address | ||
2504 | * %o2: sub-function arg size | ||
2505 | * | ||
2506 | * returns %o0: status | ||
2507 | */ | ||
2508 | .globl sun4v_ncs_request | ||
2509 | .type sun4v_ncs_request,#function | ||
2510 | sun4v_ncs_request: | ||
2511 | mov HV_FAST_NCS_REQUEST, %o5 | ||
2512 | ta HV_FAST_TRAP | ||
2513 | retl | ||
2514 | nop | ||
2515 | .size sun4v_ncs_request, .-sun4v_ncs_request | ||
2516 | |||
2517 | .globl sun4v_scv_send | ||
2518 | .type sun4v_scv_send,#function | ||
2519 | sun4v_scv_send: | ||
2520 | save %sp, -192, %sp | ||
2521 | mov %i0, %o0 | ||
2522 | mov %i1, %o1 | ||
2523 | mov %i2, %o2 | ||
2524 | mov HV_FAST_SVC_SEND, %o5 | ||
2525 | ta HV_FAST_TRAP | ||
2526 | stx %o1, [%i3] | ||
2527 | ret | ||
2528 | restore | ||
2529 | .size sun4v_scv_send, .-sun4v_scv_send | ||
2530 | |||
2531 | .globl sun4v_scv_recv | ||
2532 | .type sun4v_scv_recv,#function | ||
2533 | sun4v_scv_recv: | ||
2534 | save %sp, -192, %sp | ||
2535 | mov %i0, %o0 | ||
2536 | mov %i1, %o1 | ||
2537 | mov %i2, %o2 | ||
2538 | mov HV_FAST_SVC_RECV, %o5 | ||
2539 | ta HV_FAST_TRAP | ||
2540 | stx %o1, [%i3] | ||
2541 | ret | ||
2542 | restore | ||
2543 | .size sun4v_scv_recv, .-sun4v_scv_recv | ||
2544 | |||
2545 | .globl sun4v_scv_getstatus | ||
2546 | .type sun4v_scv_getstatus,#function | ||
2547 | sun4v_scv_getstatus: | ||
2548 | mov HV_FAST_SVC_GETSTATUS, %o5 | ||
2549 | mov %o1, %o4 | ||
2550 | ta HV_FAST_TRAP | ||
2551 | stx %o1, [%o4] | ||
2552 | retl | ||
2553 | nop | ||
2554 | .size sun4v_scv_getstatus, .-sun4v_scv_getstatus | ||
2555 | |||
2556 | .globl sun4v_scv_setstatus | ||
2557 | .type sun4v_scv_setstatus,#function | ||
2558 | sun4v_scv_setstatus: | ||
2559 | mov HV_FAST_SVC_SETSTATUS, %o5 | ||
2560 | ta HV_FAST_TRAP | ||
2561 | retl | ||
2562 | nop | ||
2563 | .size sun4v_scv_setstatus, .-sun4v_scv_setstatus | ||
2564 | |||
2565 | .globl sun4v_scv_clrstatus | ||
2566 | .type sun4v_scv_clrstatus,#function | ||
2567 | sun4v_scv_clrstatus: | ||
2568 | mov HV_FAST_SVC_CLRSTATUS, %o5 | ||
2569 | ta HV_FAST_TRAP | ||
2570 | retl | ||
2571 | nop | ||
2572 | .size sun4v_scv_clrstatus, .-sun4v_scv_clrstatus | ||
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S index baea10a98196..77259526cb15 100644 --- a/arch/sparc64/kernel/head.S +++ b/arch/sparc64/kernel/head.S | |||
@@ -523,7 +523,7 @@ tlb_fixup_done: | |||
523 | #else | 523 | #else |
524 | mov 0, %o0 | 524 | mov 0, %o0 |
525 | #endif | 525 | #endif |
526 | stb %o0, [%g6 + TI_CPU] | 526 | sth %o0, [%g6 + TI_CPU] |
527 | 527 | ||
528 | /* Off we go.... */ | 528 | /* Off we go.... */ |
529 | call start_kernel | 529 | call start_kernel |
@@ -653,33 +653,54 @@ setup_tba: | |||
653 | restore | 653 | restore |
654 | sparc64_boot_end: | 654 | sparc64_boot_end: |
655 | 655 | ||
656 | #include "ktlb.S" | ||
657 | #include "tsb.S" | ||
658 | #include "etrap.S" | 656 | #include "etrap.S" |
659 | #include "rtrap.S" | 657 | #include "rtrap.S" |
660 | #include "winfixup.S" | 658 | #include "winfixup.S" |
661 | #include "entry.S" | 659 | #include "entry.S" |
662 | #include "sun4v_tlb_miss.S" | 660 | #include "sun4v_tlb_miss.S" |
663 | #include "sun4v_ivec.S" | 661 | #include "sun4v_ivec.S" |
662 | #include "ktlb.S" | ||
663 | #include "tsb.S" | ||
664 | 664 | ||
665 | /* | 665 | /* |
666 | * The following skip makes sure the trap table in ttable.S is aligned | 666 | * The following skip makes sure the trap table in ttable.S is aligned |
667 | * on a 32K boundary as required by the v9 specs for TBA register. | 667 | * on a 32K boundary as required by the v9 specs for TBA register. |
668 | * | 668 | * |
669 | * We align to a 32K boundary, then we have the 32K kernel TSB, | 669 | * We align to a 32K boundary, then we have the 32K kernel TSB, |
670 | * then the 32K aligned trap table. | 670 | * the 64K kernel 4MB TSB, and then the 32K aligned trap table. |
671 | */ | 671 | */ |
672 | 1: | 672 | 1: |
673 | .skip 0x4000 + _start - 1b | 673 | .skip 0x4000 + _start - 1b |
674 | 674 | ||
675 | ! 0x0000000000408000 | ||
676 | |||
675 | .globl swapper_tsb | 677 | .globl swapper_tsb |
676 | swapper_tsb: | 678 | swapper_tsb: |
677 | .skip (32 * 1024) | 679 | .skip (32 * 1024) |
678 | 680 | ||
679 | ! 0x0000000000408000 | 681 | .globl swapper_4m_tsb |
682 | swapper_4m_tsb: | ||
683 | .skip (64 * 1024) | ||
684 | |||
685 | ! 0x0000000000420000 | ||
680 | 686 | ||
687 | /* Some care needs to be exercised if you try to move the | ||
688 | * location of the trap table relative to other things. For | ||
689 | * one thing there are br* instructions in some of the | ||
690 | * trap table entires which branch back to code in ktlb.S | ||
691 | * Those instructions can only handle a signed 16-bit | ||
692 | * displacement. | ||
693 | * | ||
694 | * There is a binutils bug (bugzilla #4558) which causes | ||
695 | * the relocation overflow checks for such instructions to | ||
696 | * not be done correctly. So bintuils will not notice the | ||
697 | * error and will instead write junk into the relocation and | ||
698 | * you'll have an unbootable kernel. | ||
699 | */ | ||
681 | #include "ttable.S" | 700 | #include "ttable.S" |
682 | 701 | ||
702 | ! 0x0000000000428000 | ||
703 | |||
683 | #include "systbls.S" | 704 | #include "systbls.S" |
684 | 705 | ||
685 | .data | 706 | .data |
diff --git a/arch/sparc64/kernel/hvapi.c b/arch/sparc64/kernel/hvapi.c index f03ffc829c7a..f34f5d6181ef 100644 --- a/arch/sparc64/kernel/hvapi.c +++ b/arch/sparc64/kernel/hvapi.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <asm/hypervisor.h> | 10 | #include <asm/hypervisor.h> |
11 | #include <asm/oplib.h> | 11 | #include <asm/oplib.h> |
12 | #include <asm/sstate.h> | ||
12 | 13 | ||
13 | /* If the hypervisor indicates that the API setting | 14 | /* If the hypervisor indicates that the API setting |
14 | * calls are unsupported, by returning HV_EBADTRAP or | 15 | * calls are unsupported, by returning HV_EBADTRAP or |
@@ -107,7 +108,7 @@ int sun4v_hvapi_register(unsigned long group, unsigned long major, | |||
107 | p->minor = actual_minor; | 108 | p->minor = actual_minor; |
108 | ret = 0; | 109 | ret = 0; |
109 | } else if (hv_ret == HV_EBADTRAP || | 110 | } else if (hv_ret == HV_EBADTRAP || |
110 | HV_ENOTSUPPORTED) { | 111 | hv_ret == HV_ENOTSUPPORTED) { |
111 | if (p->flags & FLAG_PRE_API) { | 112 | if (p->flags & FLAG_PRE_API) { |
112 | if (major == 1) { | 113 | if (major == 1) { |
113 | p->major = 1; | 114 | p->major = 1; |
@@ -179,6 +180,8 @@ void __init sun4v_hvapi_init(void) | |||
179 | if (sun4v_hvapi_register(group, major, &minor)) | 180 | if (sun4v_hvapi_register(group, major, &minor)) |
180 | goto bad; | 181 | goto bad; |
181 | 182 | ||
183 | sun4v_sstate_init(); | ||
184 | |||
182 | return; | 185 | return; |
183 | 186 | ||
184 | bad: | 187 | bad: |
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index 3edc18e1b818..a36f8dd0c021 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c | |||
@@ -171,8 +171,6 @@ skip: | |||
171 | return 0; | 171 | return 0; |
172 | } | 172 | } |
173 | 173 | ||
174 | extern unsigned long real_hard_smp_processor_id(void); | ||
175 | |||
176 | static unsigned int sun4u_compute_tid(unsigned long imap, unsigned long cpuid) | 174 | static unsigned int sun4u_compute_tid(unsigned long imap, unsigned long cpuid) |
177 | { | 175 | { |
178 | unsigned int tid; | 176 | unsigned int tid; |
@@ -694,9 +692,20 @@ void init_irqwork_curcpu(void) | |||
694 | trap_block[cpu].irq_worklist = 0; | 692 | trap_block[cpu].irq_worklist = 0; |
695 | } | 693 | } |
696 | 694 | ||
697 | static void __cpuinit register_one_mondo(unsigned long paddr, unsigned long type) | 695 | /* Please be very careful with register_one_mondo() and |
696 | * sun4v_register_mondo_queues(). | ||
697 | * | ||
698 | * On SMP this gets invoked from the CPU trampoline before | ||
699 | * the cpu has fully taken over the trap table from OBP, | ||
700 | * and it's kernel stack + %g6 thread register state is | ||
701 | * not fully cooked yet. | ||
702 | * | ||
703 | * Therefore you cannot make any OBP calls, not even prom_printf, | ||
704 | * from these two routines. | ||
705 | */ | ||
706 | static void __cpuinit register_one_mondo(unsigned long paddr, unsigned long type, unsigned long qmask) | ||
698 | { | 707 | { |
699 | unsigned long num_entries = 128; | 708 | unsigned long num_entries = (qmask + 1) / 64; |
700 | unsigned long status; | 709 | unsigned long status; |
701 | 710 | ||
702 | status = sun4v_cpu_qconf(type, paddr, num_entries); | 711 | status = sun4v_cpu_qconf(type, paddr, num_entries); |
@@ -711,44 +720,58 @@ static void __cpuinit sun4v_register_mondo_queues(int this_cpu) | |||
711 | { | 720 | { |
712 | struct trap_per_cpu *tb = &trap_block[this_cpu]; | 721 | struct trap_per_cpu *tb = &trap_block[this_cpu]; |
713 | 722 | ||
714 | register_one_mondo(tb->cpu_mondo_pa, HV_CPU_QUEUE_CPU_MONDO); | 723 | register_one_mondo(tb->cpu_mondo_pa, HV_CPU_QUEUE_CPU_MONDO, |
715 | register_one_mondo(tb->dev_mondo_pa, HV_CPU_QUEUE_DEVICE_MONDO); | 724 | tb->cpu_mondo_qmask); |
716 | register_one_mondo(tb->resum_mondo_pa, HV_CPU_QUEUE_RES_ERROR); | 725 | register_one_mondo(tb->dev_mondo_pa, HV_CPU_QUEUE_DEVICE_MONDO, |
717 | register_one_mondo(tb->nonresum_mondo_pa, HV_CPU_QUEUE_NONRES_ERROR); | 726 | tb->dev_mondo_qmask); |
727 | register_one_mondo(tb->resum_mondo_pa, HV_CPU_QUEUE_RES_ERROR, | ||
728 | tb->resum_qmask); | ||
729 | register_one_mondo(tb->nonresum_mondo_pa, HV_CPU_QUEUE_NONRES_ERROR, | ||
730 | tb->nonresum_qmask); | ||
718 | } | 731 | } |
719 | 732 | ||
720 | static void __cpuinit alloc_one_mondo(unsigned long *pa_ptr, int use_bootmem) | 733 | static void __cpuinit alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask, int use_bootmem) |
721 | { | 734 | { |
722 | void *page; | 735 | unsigned long size = PAGE_ALIGN(qmask + 1); |
736 | unsigned long order = get_order(size); | ||
737 | void *p = NULL; | ||
723 | 738 | ||
724 | if (use_bootmem) | 739 | if (use_bootmem) { |
725 | page = alloc_bootmem_low_pages(PAGE_SIZE); | 740 | p = __alloc_bootmem_low(size, size, 0); |
726 | else | 741 | } else { |
727 | page = (void *) get_zeroed_page(GFP_ATOMIC); | 742 | struct page *page = alloc_pages(GFP_ATOMIC | __GFP_ZERO, order); |
743 | if (page) | ||
744 | p = page_address(page); | ||
745 | } | ||
728 | 746 | ||
729 | if (!page) { | 747 | if (!p) { |
730 | prom_printf("SUN4V: Error, cannot allocate mondo queue.\n"); | 748 | prom_printf("SUN4V: Error, cannot allocate mondo queue.\n"); |
731 | prom_halt(); | 749 | prom_halt(); |
732 | } | 750 | } |
733 | 751 | ||
734 | *pa_ptr = __pa(page); | 752 | *pa_ptr = __pa(p); |
735 | } | 753 | } |
736 | 754 | ||
737 | static void __cpuinit alloc_one_kbuf(unsigned long *pa_ptr, int use_bootmem) | 755 | static void __cpuinit alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask, int use_bootmem) |
738 | { | 756 | { |
739 | void *page; | 757 | unsigned long size = PAGE_ALIGN(qmask + 1); |
758 | unsigned long order = get_order(size); | ||
759 | void *p = NULL; | ||
740 | 760 | ||
741 | if (use_bootmem) | 761 | if (use_bootmem) { |
742 | page = alloc_bootmem_low_pages(PAGE_SIZE); | 762 | p = __alloc_bootmem_low(size, size, 0); |
743 | else | 763 | } else { |
744 | page = (void *) get_zeroed_page(GFP_ATOMIC); | 764 | struct page *page = alloc_pages(GFP_ATOMIC | __GFP_ZERO, order); |
765 | if (page) | ||
766 | p = page_address(page); | ||
767 | } | ||
745 | 768 | ||
746 | if (!page) { | 769 | if (!p) { |
747 | prom_printf("SUN4V: Error, cannot allocate kbuf page.\n"); | 770 | prom_printf("SUN4V: Error, cannot allocate kbuf page.\n"); |
748 | prom_halt(); | 771 | prom_halt(); |
749 | } | 772 | } |
750 | 773 | ||
751 | *pa_ptr = __pa(page); | 774 | *pa_ptr = __pa(p); |
752 | } | 775 | } |
753 | 776 | ||
754 | static void __cpuinit init_cpu_send_mondo_info(struct trap_per_cpu *tb, int use_bootmem) | 777 | static void __cpuinit init_cpu_send_mondo_info(struct trap_per_cpu *tb, int use_bootmem) |
@@ -779,12 +802,12 @@ void __cpuinit sun4v_init_mondo_queues(int use_bootmem, int cpu, int alloc, int | |||
779 | struct trap_per_cpu *tb = &trap_block[cpu]; | 802 | struct trap_per_cpu *tb = &trap_block[cpu]; |
780 | 803 | ||
781 | if (alloc) { | 804 | if (alloc) { |
782 | alloc_one_mondo(&tb->cpu_mondo_pa, use_bootmem); | 805 | alloc_one_mondo(&tb->cpu_mondo_pa, tb->cpu_mondo_qmask, use_bootmem); |
783 | alloc_one_mondo(&tb->dev_mondo_pa, use_bootmem); | 806 | alloc_one_mondo(&tb->dev_mondo_pa, tb->dev_mondo_qmask, use_bootmem); |
784 | alloc_one_mondo(&tb->resum_mondo_pa, use_bootmem); | 807 | alloc_one_mondo(&tb->resum_mondo_pa, tb->resum_qmask, use_bootmem); |
785 | alloc_one_kbuf(&tb->resum_kernel_buf_pa, use_bootmem); | 808 | alloc_one_kbuf(&tb->resum_kernel_buf_pa, tb->resum_qmask, use_bootmem); |
786 | alloc_one_mondo(&tb->nonresum_mondo_pa, use_bootmem); | 809 | alloc_one_mondo(&tb->nonresum_mondo_pa, tb->nonresum_qmask, use_bootmem); |
787 | alloc_one_kbuf(&tb->nonresum_kernel_buf_pa, use_bootmem); | 810 | alloc_one_kbuf(&tb->nonresum_kernel_buf_pa, tb->nonresum_qmask, use_bootmem); |
788 | 811 | ||
789 | init_cpu_send_mondo_info(tb, use_bootmem); | 812 | init_cpu_send_mondo_info(tb, use_bootmem); |
790 | } | 813 | } |
diff --git a/arch/sparc64/kernel/itlb_miss.S b/arch/sparc64/kernel/itlb_miss.S index ad46e2024f4b..5a8377b54955 100644 --- a/arch/sparc64/kernel/itlb_miss.S +++ b/arch/sparc64/kernel/itlb_miss.S | |||
@@ -11,12 +11,12 @@ | |||
11 | /* ITLB ** ICACHE line 2: TSB compare and TLB load */ | 11 | /* ITLB ** ICACHE line 2: TSB compare and TLB load */ |
12 | bne,pn %xcc, tsb_miss_itlb ! Miss | 12 | bne,pn %xcc, tsb_miss_itlb ! Miss |
13 | mov FAULT_CODE_ITLB, %g3 | 13 | mov FAULT_CODE_ITLB, %g3 |
14 | andcc %g5, _PAGE_EXEC_4U, %g0 ! Executable? | 14 | sethi %hi(_PAGE_EXEC_4U), %g4 |
15 | andcc %g5, %g4, %g0 ! Executable? | ||
15 | be,pn %xcc, tsb_do_fault | 16 | be,pn %xcc, tsb_do_fault |
16 | nop ! Delay slot, fill me | 17 | nop ! Delay slot, fill me |
17 | stxa %g5, [%g0] ASI_ITLB_DATA_IN ! Load TLB | 18 | stxa %g5, [%g0] ASI_ITLB_DATA_IN ! Load TLB |
18 | retry ! Trap done | 19 | retry ! Trap done |
19 | nop | ||
20 | 20 | ||
21 | /* ITLB ** ICACHE line 3: */ | 21 | /* ITLB ** ICACHE line 3: */ |
22 | nop | 22 | nop |
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c new file mode 100644 index 000000000000..9246c2cf9574 --- /dev/null +++ b/arch/sparc64/kernel/mdesc.c | |||
@@ -0,0 +1,619 @@ | |||
1 | /* mdesc.c: Sun4V machine description handling. | ||
2 | * | ||
3 | * Copyright (C) 2007 David S. Miller <davem@davemloft.net> | ||
4 | */ | ||
5 | #include <linux/kernel.h> | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/bootmem.h> | ||
8 | #include <linux/log2.h> | ||
9 | |||
10 | #include <asm/hypervisor.h> | ||
11 | #include <asm/mdesc.h> | ||
12 | #include <asm/prom.h> | ||
13 | #include <asm/oplib.h> | ||
14 | #include <asm/smp.h> | ||
15 | |||
16 | /* Unlike the OBP device tree, the machine description is a full-on | ||
17 | * DAG. An arbitrary number of ARCs are possible from one | ||
18 | * node to other nodes and thus we can't use the OBP device_node | ||
19 | * data structure to represent these nodes inside of the kernel. | ||
20 | * | ||
21 | * Actually, it isn't even a DAG, because there are back pointers | ||
22 | * which create cycles in the graph. | ||
23 | * | ||
24 | * mdesc_hdr and mdesc_elem describe the layout of the data structure | ||
25 | * we get from the Hypervisor. | ||
26 | */ | ||
27 | struct mdesc_hdr { | ||
28 | u32 version; /* Transport version */ | ||
29 | u32 node_sz; /* node block size */ | ||
30 | u32 name_sz; /* name block size */ | ||
31 | u32 data_sz; /* data block size */ | ||
32 | }; | ||
33 | |||
34 | struct mdesc_elem { | ||
35 | u8 tag; | ||
36 | #define MD_LIST_END 0x00 | ||
37 | #define MD_NODE 0x4e | ||
38 | #define MD_NODE_END 0x45 | ||
39 | #define MD_NOOP 0x20 | ||
40 | #define MD_PROP_ARC 0x61 | ||
41 | #define MD_PROP_VAL 0x76 | ||
42 | #define MD_PROP_STR 0x73 | ||
43 | #define MD_PROP_DATA 0x64 | ||
44 | u8 name_len; | ||
45 | u16 resv; | ||
46 | u32 name_offset; | ||
47 | union { | ||
48 | struct { | ||
49 | u32 data_len; | ||
50 | u32 data_offset; | ||
51 | } data; | ||
52 | u64 val; | ||
53 | } d; | ||
54 | }; | ||
55 | |||
56 | static struct mdesc_hdr *main_mdesc; | ||
57 | static struct mdesc_node *allnodes; | ||
58 | |||
59 | static struct mdesc_node *allnodes_tail; | ||
60 | static unsigned int unique_id; | ||
61 | |||
62 | static struct mdesc_node **mdesc_hash; | ||
63 | static unsigned int mdesc_hash_size; | ||
64 | |||
65 | static inline unsigned int node_hashfn(u64 node) | ||
66 | { | ||
67 | return ((unsigned int) (node ^ (node >> 8) ^ (node >> 16))) | ||
68 | & (mdesc_hash_size - 1); | ||
69 | } | ||
70 | |||
71 | static inline void hash_node(struct mdesc_node *mp) | ||
72 | { | ||
73 | struct mdesc_node **head = &mdesc_hash[node_hashfn(mp->node)]; | ||
74 | |||
75 | mp->hash_next = *head; | ||
76 | *head = mp; | ||
77 | |||
78 | if (allnodes_tail) { | ||
79 | allnodes_tail->allnodes_next = mp; | ||
80 | allnodes_tail = mp; | ||
81 | } else { | ||
82 | allnodes = allnodes_tail = mp; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | static struct mdesc_node *find_node(u64 node) | ||
87 | { | ||
88 | struct mdesc_node *mp = mdesc_hash[node_hashfn(node)]; | ||
89 | |||
90 | while (mp) { | ||
91 | if (mp->node == node) | ||
92 | return mp; | ||
93 | |||
94 | mp = mp->hash_next; | ||
95 | } | ||
96 | return NULL; | ||
97 | } | ||
98 | |||
99 | struct property *md_find_property(const struct mdesc_node *mp, | ||
100 | const char *name, | ||
101 | int *lenp) | ||
102 | { | ||
103 | struct property *pp; | ||
104 | |||
105 | for (pp = mp->properties; pp != 0; pp = pp->next) { | ||
106 | if (strcasecmp(pp->name, name) == 0) { | ||
107 | if (lenp) | ||
108 | *lenp = pp->length; | ||
109 | break; | ||
110 | } | ||
111 | } | ||
112 | return pp; | ||
113 | } | ||
114 | EXPORT_SYMBOL(md_find_property); | ||
115 | |||
116 | /* | ||
117 | * Find a property with a given name for a given node | ||
118 | * and return the value. | ||
119 | */ | ||
120 | const void *md_get_property(const struct mdesc_node *mp, const char *name, | ||
121 | int *lenp) | ||
122 | { | ||
123 | struct property *pp = md_find_property(mp, name, lenp); | ||
124 | return pp ? pp->value : NULL; | ||
125 | } | ||
126 | EXPORT_SYMBOL(md_get_property); | ||
127 | |||
128 | struct mdesc_node *md_find_node_by_name(struct mdesc_node *from, | ||
129 | const char *name) | ||
130 | { | ||
131 | struct mdesc_node *mp; | ||
132 | |||
133 | mp = from ? from->allnodes_next : allnodes; | ||
134 | for (; mp != NULL; mp = mp->allnodes_next) { | ||
135 | if (strcmp(mp->name, name) == 0) | ||
136 | break; | ||
137 | } | ||
138 | return mp; | ||
139 | } | ||
140 | EXPORT_SYMBOL(md_find_node_by_name); | ||
141 | |||
142 | static unsigned int mdesc_early_allocated; | ||
143 | |||
144 | static void * __init mdesc_early_alloc(unsigned long size) | ||
145 | { | ||
146 | void *ret; | ||
147 | |||
148 | ret = __alloc_bootmem(size, SMP_CACHE_BYTES, 0UL); | ||
149 | if (ret == NULL) { | ||
150 | prom_printf("MDESC: alloc of %lu bytes failed.\n", size); | ||
151 | prom_halt(); | ||
152 | } | ||
153 | |||
154 | memset(ret, 0, size); | ||
155 | |||
156 | mdesc_early_allocated += size; | ||
157 | |||
158 | return ret; | ||
159 | } | ||
160 | |||
161 | static unsigned int __init count_arcs(struct mdesc_elem *ep) | ||
162 | { | ||
163 | unsigned int ret = 0; | ||
164 | |||
165 | ep++; | ||
166 | while (ep->tag != MD_NODE_END) { | ||
167 | if (ep->tag == MD_PROP_ARC) | ||
168 | ret++; | ||
169 | ep++; | ||
170 | } | ||
171 | return ret; | ||
172 | } | ||
173 | |||
174 | static void __init mdesc_node_alloc(u64 node, struct mdesc_elem *ep, const char *names) | ||
175 | { | ||
176 | unsigned int num_arcs = count_arcs(ep); | ||
177 | struct mdesc_node *mp; | ||
178 | |||
179 | mp = mdesc_early_alloc(sizeof(*mp) + | ||
180 | (num_arcs * sizeof(struct mdesc_arc))); | ||
181 | mp->name = names + ep->name_offset; | ||
182 | mp->node = node; | ||
183 | mp->unique_id = unique_id++; | ||
184 | mp->num_arcs = num_arcs; | ||
185 | |||
186 | hash_node(mp); | ||
187 | } | ||
188 | |||
189 | static inline struct mdesc_elem *node_block(struct mdesc_hdr *mdesc) | ||
190 | { | ||
191 | return (struct mdesc_elem *) (mdesc + 1); | ||
192 | } | ||
193 | |||
194 | static inline void *name_block(struct mdesc_hdr *mdesc) | ||
195 | { | ||
196 | return ((void *) node_block(mdesc)) + mdesc->node_sz; | ||
197 | } | ||
198 | |||
199 | static inline void *data_block(struct mdesc_hdr *mdesc) | ||
200 | { | ||
201 | return ((void *) name_block(mdesc)) + mdesc->name_sz; | ||
202 | } | ||
203 | |||
204 | /* In order to avoid recursion (the graph can be very deep) we use a | ||
205 | * two pass algorithm. First we allocate all the nodes and hash them. | ||
206 | * Then we iterate over each node, filling in the arcs and properties. | ||
207 | */ | ||
208 | static void __init build_all_nodes(struct mdesc_hdr *mdesc) | ||
209 | { | ||
210 | struct mdesc_elem *start, *ep; | ||
211 | struct mdesc_node *mp; | ||
212 | const char *names; | ||
213 | void *data; | ||
214 | u64 last_node; | ||
215 | |||
216 | start = ep = node_block(mdesc); | ||
217 | last_node = mdesc->node_sz / 16; | ||
218 | |||
219 | names = name_block(mdesc); | ||
220 | |||
221 | while (1) { | ||
222 | u64 node = ep - start; | ||
223 | |||
224 | if (ep->tag == MD_LIST_END) | ||
225 | break; | ||
226 | |||
227 | if (ep->tag != MD_NODE) { | ||
228 | prom_printf("MDESC: Inconsistent element list.\n"); | ||
229 | prom_halt(); | ||
230 | } | ||
231 | |||
232 | mdesc_node_alloc(node, ep, names); | ||
233 | |||
234 | if (ep->d.val >= last_node) { | ||
235 | printk("MDESC: Warning, early break out of node scan.\n"); | ||
236 | printk("MDESC: Next node [%lu] last_node [%lu].\n", | ||
237 | node, last_node); | ||
238 | break; | ||
239 | } | ||
240 | |||
241 | ep = start + ep->d.val; | ||
242 | } | ||
243 | |||
244 | data = data_block(mdesc); | ||
245 | for (mp = allnodes; mp; mp = mp->allnodes_next) { | ||
246 | struct mdesc_elem *ep = start + mp->node; | ||
247 | struct property **link = &mp->properties; | ||
248 | unsigned int this_arc = 0; | ||
249 | |||
250 | ep++; | ||
251 | while (ep->tag != MD_NODE_END) { | ||
252 | switch (ep->tag) { | ||
253 | case MD_PROP_ARC: { | ||
254 | struct mdesc_node *target; | ||
255 | |||
256 | if (this_arc >= mp->num_arcs) { | ||
257 | prom_printf("MDESC: ARC overrun [%u:%u]\n", | ||
258 | this_arc, mp->num_arcs); | ||
259 | prom_halt(); | ||
260 | } | ||
261 | target = find_node(ep->d.val); | ||
262 | if (!target) { | ||
263 | printk("MDESC: Warning, arc points to " | ||
264 | "missing node, ignoring.\n"); | ||
265 | break; | ||
266 | } | ||
267 | mp->arcs[this_arc].name = | ||
268 | (names + ep->name_offset); | ||
269 | mp->arcs[this_arc].arc = target; | ||
270 | this_arc++; | ||
271 | break; | ||
272 | } | ||
273 | |||
274 | case MD_PROP_VAL: | ||
275 | case MD_PROP_STR: | ||
276 | case MD_PROP_DATA: { | ||
277 | struct property *p = mdesc_early_alloc(sizeof(*p)); | ||
278 | |||
279 | p->unique_id = unique_id++; | ||
280 | p->name = (char *) names + ep->name_offset; | ||
281 | if (ep->tag == MD_PROP_VAL) { | ||
282 | p->value = &ep->d.val; | ||
283 | p->length = 8; | ||
284 | } else { | ||
285 | p->value = data + ep->d.data.data_offset; | ||
286 | p->length = ep->d.data.data_len; | ||
287 | } | ||
288 | *link = p; | ||
289 | link = &p->next; | ||
290 | break; | ||
291 | } | ||
292 | |||
293 | case MD_NOOP: | ||
294 | break; | ||
295 | |||
296 | default: | ||
297 | printk("MDESC: Warning, ignoring unknown tag type %02x\n", | ||
298 | ep->tag); | ||
299 | } | ||
300 | ep++; | ||
301 | } | ||
302 | } | ||
303 | } | ||
304 | |||
305 | static unsigned int __init count_nodes(struct mdesc_hdr *mdesc) | ||
306 | { | ||
307 | struct mdesc_elem *ep = node_block(mdesc); | ||
308 | struct mdesc_elem *end; | ||
309 | unsigned int cnt = 0; | ||
310 | |||
311 | end = ((void *)ep) + mdesc->node_sz; | ||
312 | while (ep < end) { | ||
313 | if (ep->tag == MD_NODE) | ||
314 | cnt++; | ||
315 | ep++; | ||
316 | } | ||
317 | return cnt; | ||
318 | } | ||
319 | |||
320 | static void __init report_platform_properties(void) | ||
321 | { | ||
322 | struct mdesc_node *pn = md_find_node_by_name(NULL, "platform"); | ||
323 | const char *s; | ||
324 | const u64 *v; | ||
325 | |||
326 | if (!pn) { | ||
327 | prom_printf("No platform node in machine-description.\n"); | ||
328 | prom_halt(); | ||
329 | } | ||
330 | |||
331 | s = md_get_property(pn, "banner-name", NULL); | ||
332 | printk("PLATFORM: banner-name [%s]\n", s); | ||
333 | s = md_get_property(pn, "name", NULL); | ||
334 | printk("PLATFORM: name [%s]\n", s); | ||
335 | |||
336 | v = md_get_property(pn, "hostid", NULL); | ||
337 | if (v) | ||
338 | printk("PLATFORM: hostid [%08lx]\n", *v); | ||
339 | v = md_get_property(pn, "serial#", NULL); | ||
340 | if (v) | ||
341 | printk("PLATFORM: serial# [%08lx]\n", *v); | ||
342 | v = md_get_property(pn, "stick-frequency", NULL); | ||
343 | printk("PLATFORM: stick-frequency [%08lx]\n", *v); | ||
344 | v = md_get_property(pn, "mac-address", NULL); | ||
345 | if (v) | ||
346 | printk("PLATFORM: mac-address [%lx]\n", *v); | ||
347 | v = md_get_property(pn, "watchdog-resolution", NULL); | ||
348 | if (v) | ||
349 | printk("PLATFORM: watchdog-resolution [%lu ms]\n", *v); | ||
350 | v = md_get_property(pn, "watchdog-max-timeout", NULL); | ||
351 | if (v) | ||
352 | printk("PLATFORM: watchdog-max-timeout [%lu ms]\n", *v); | ||
353 | v = md_get_property(pn, "max-cpus", NULL); | ||
354 | if (v) | ||
355 | printk("PLATFORM: max-cpus [%lu]\n", *v); | ||
356 | } | ||
357 | |||
358 | static int inline find_in_proplist(const char *list, const char *match, int len) | ||
359 | { | ||
360 | while (len > 0) { | ||
361 | int l; | ||
362 | |||
363 | if (!strcmp(list, match)) | ||
364 | return 1; | ||
365 | l = strlen(list) + 1; | ||
366 | list += l; | ||
367 | len -= l; | ||
368 | } | ||
369 | return 0; | ||
370 | } | ||
371 | |||
372 | static void __init fill_in_one_cache(cpuinfo_sparc *c, struct mdesc_node *mp) | ||
373 | { | ||
374 | const u64 *level = md_get_property(mp, "level", NULL); | ||
375 | const u64 *size = md_get_property(mp, "size", NULL); | ||
376 | const u64 *line_size = md_get_property(mp, "line-size", NULL); | ||
377 | const char *type; | ||
378 | int type_len; | ||
379 | |||
380 | type = md_get_property(mp, "type", &type_len); | ||
381 | |||
382 | switch (*level) { | ||
383 | case 1: | ||
384 | if (find_in_proplist(type, "instn", type_len)) { | ||
385 | c->icache_size = *size; | ||
386 | c->icache_line_size = *line_size; | ||
387 | } else if (find_in_proplist(type, "data", type_len)) { | ||
388 | c->dcache_size = *size; | ||
389 | c->dcache_line_size = *line_size; | ||
390 | } | ||
391 | break; | ||
392 | |||
393 | case 2: | ||
394 | c->ecache_size = *size; | ||
395 | c->ecache_line_size = *line_size; | ||
396 | break; | ||
397 | |||
398 | default: | ||
399 | break; | ||
400 | } | ||
401 | |||
402 | if (*level == 1) { | ||
403 | unsigned int i; | ||
404 | |||
405 | for (i = 0; i < mp->num_arcs; i++) { | ||
406 | struct mdesc_node *t = mp->arcs[i].arc; | ||
407 | |||
408 | if (strcmp(mp->arcs[i].name, "fwd")) | ||
409 | continue; | ||
410 | |||
411 | if (!strcmp(t->name, "cache")) | ||
412 | fill_in_one_cache(c, t); | ||
413 | } | ||
414 | } | ||
415 | } | ||
416 | |||
417 | static void __init mark_core_ids(struct mdesc_node *mp, int core_id) | ||
418 | { | ||
419 | unsigned int i; | ||
420 | |||
421 | for (i = 0; i < mp->num_arcs; i++) { | ||
422 | struct mdesc_node *t = mp->arcs[i].arc; | ||
423 | const u64 *id; | ||
424 | |||
425 | if (strcmp(mp->arcs[i].name, "back")) | ||
426 | continue; | ||
427 | |||
428 | if (!strcmp(t->name, "cpu")) { | ||
429 | id = md_get_property(t, "id", NULL); | ||
430 | if (*id < NR_CPUS) | ||
431 | cpu_data(*id).core_id = core_id; | ||
432 | } else { | ||
433 | unsigned int j; | ||
434 | |||
435 | for (j = 0; j < t->num_arcs; j++) { | ||
436 | struct mdesc_node *n = t->arcs[j].arc; | ||
437 | |||
438 | if (strcmp(t->arcs[j].name, "back")) | ||
439 | continue; | ||
440 | |||
441 | if (strcmp(n->name, "cpu")) | ||
442 | continue; | ||
443 | |||
444 | id = md_get_property(n, "id", NULL); | ||
445 | if (*id < NR_CPUS) | ||
446 | cpu_data(*id).core_id = core_id; | ||
447 | } | ||
448 | } | ||
449 | } | ||
450 | } | ||
451 | |||
452 | static void __init set_core_ids(void) | ||
453 | { | ||
454 | struct mdesc_node *mp; | ||
455 | int idx; | ||
456 | |||
457 | idx = 1; | ||
458 | md_for_each_node_by_name(mp, "cache") { | ||
459 | const u64 *level = md_get_property(mp, "level", NULL); | ||
460 | const char *type; | ||
461 | int len; | ||
462 | |||
463 | if (*level != 1) | ||
464 | continue; | ||
465 | |||
466 | type = md_get_property(mp, "type", &len); | ||
467 | if (!find_in_proplist(type, "instn", len)) | ||
468 | continue; | ||
469 | |||
470 | mark_core_ids(mp, idx); | ||
471 | |||
472 | idx++; | ||
473 | } | ||
474 | } | ||
475 | |||
476 | static void __init get_one_mondo_bits(const u64 *p, unsigned int *mask, unsigned char def) | ||
477 | { | ||
478 | u64 val; | ||
479 | |||
480 | if (!p) | ||
481 | goto use_default; | ||
482 | val = *p; | ||
483 | |||
484 | if (!val || val >= 64) | ||
485 | goto use_default; | ||
486 | |||
487 | *mask = ((1U << val) * 64U) - 1U; | ||
488 | return; | ||
489 | |||
490 | use_default: | ||
491 | *mask = ((1U << def) * 64U) - 1U; | ||
492 | } | ||
493 | |||
494 | static void __init get_mondo_data(struct mdesc_node *mp, struct trap_per_cpu *tb) | ||
495 | { | ||
496 | const u64 *val; | ||
497 | |||
498 | val = md_get_property(mp, "q-cpu-mondo-#bits", NULL); | ||
499 | get_one_mondo_bits(val, &tb->cpu_mondo_qmask, 7); | ||
500 | |||
501 | val = md_get_property(mp, "q-dev-mondo-#bits", NULL); | ||
502 | get_one_mondo_bits(val, &tb->dev_mondo_qmask, 7); | ||
503 | |||
504 | val = md_get_property(mp, "q-resumable-#bits", NULL); | ||
505 | get_one_mondo_bits(val, &tb->resum_qmask, 6); | ||
506 | |||
507 | val = md_get_property(mp, "q-nonresumable-#bits", NULL); | ||
508 | get_one_mondo_bits(val, &tb->nonresum_qmask, 2); | ||
509 | } | ||
510 | |||
511 | static void __init mdesc_fill_in_cpu_data(void) | ||
512 | { | ||
513 | struct mdesc_node *mp; | ||
514 | |||
515 | ncpus_probed = 0; | ||
516 | md_for_each_node_by_name(mp, "cpu") { | ||
517 | const u64 *id = md_get_property(mp, "id", NULL); | ||
518 | const u64 *cfreq = md_get_property(mp, "clock-frequency", NULL); | ||
519 | struct trap_per_cpu *tb; | ||
520 | cpuinfo_sparc *c; | ||
521 | unsigned int i; | ||
522 | int cpuid; | ||
523 | |||
524 | ncpus_probed++; | ||
525 | |||
526 | cpuid = *id; | ||
527 | |||
528 | #ifdef CONFIG_SMP | ||
529 | if (cpuid >= NR_CPUS) | ||
530 | continue; | ||
531 | #else | ||
532 | /* On uniprocessor we only want the values for the | ||
533 | * real physical cpu the kernel booted onto, however | ||
534 | * cpu_data() only has one entry at index 0. | ||
535 | */ | ||
536 | if (cpuid != real_hard_smp_processor_id()) | ||
537 | continue; | ||
538 | cpuid = 0; | ||
539 | #endif | ||
540 | |||
541 | c = &cpu_data(cpuid); | ||
542 | c->clock_tick = *cfreq; | ||
543 | |||
544 | tb = &trap_block[cpuid]; | ||
545 | get_mondo_data(mp, tb); | ||
546 | |||
547 | for (i = 0; i < mp->num_arcs; i++) { | ||
548 | struct mdesc_node *t = mp->arcs[i].arc; | ||
549 | unsigned int j; | ||
550 | |||
551 | if (strcmp(mp->arcs[i].name, "fwd")) | ||
552 | continue; | ||
553 | |||
554 | if (!strcmp(t->name, "cache")) { | ||
555 | fill_in_one_cache(c, t); | ||
556 | continue; | ||
557 | } | ||
558 | |||
559 | for (j = 0; j < t->num_arcs; j++) { | ||
560 | struct mdesc_node *n; | ||
561 | |||
562 | n = t->arcs[j].arc; | ||
563 | if (strcmp(t->arcs[j].name, "fwd")) | ||
564 | continue; | ||
565 | |||
566 | if (!strcmp(n->name, "cache")) | ||
567 | fill_in_one_cache(c, n); | ||
568 | } | ||
569 | } | ||
570 | |||
571 | #ifdef CONFIG_SMP | ||
572 | cpu_set(cpuid, cpu_present_map); | ||
573 | cpu_set(cpuid, phys_cpu_present_map); | ||
574 | #endif | ||
575 | |||
576 | c->core_id = 0; | ||
577 | } | ||
578 | |||
579 | set_core_ids(); | ||
580 | |||
581 | smp_fill_in_sib_core_maps(); | ||
582 | } | ||
583 | |||
584 | void __init sun4v_mdesc_init(void) | ||
585 | { | ||
586 | unsigned long len, real_len, status; | ||
587 | |||
588 | (void) sun4v_mach_desc(0UL, 0UL, &len); | ||
589 | |||
590 | printk("MDESC: Size is %lu bytes.\n", len); | ||
591 | |||
592 | main_mdesc = mdesc_early_alloc(len); | ||
593 | |||
594 | status = sun4v_mach_desc(__pa(main_mdesc), len, &real_len); | ||
595 | if (status != HV_EOK || real_len > len) { | ||
596 | prom_printf("sun4v_mach_desc fails, err(%lu), " | ||
597 | "len(%lu), real_len(%lu)\n", | ||
598 | status, len, real_len); | ||
599 | prom_halt(); | ||
600 | } | ||
601 | |||
602 | len = count_nodes(main_mdesc); | ||
603 | printk("MDESC: %lu nodes.\n", len); | ||
604 | |||
605 | len = roundup_pow_of_two(len); | ||
606 | |||
607 | mdesc_hash = mdesc_early_alloc(len * sizeof(struct mdesc_node *)); | ||
608 | mdesc_hash_size = len; | ||
609 | |||
610 | printk("MDESC: Hash size %lu entries.\n", len); | ||
611 | |||
612 | build_all_nodes(main_mdesc); | ||
613 | |||
614 | printk("MDESC: Built graph with %u bytes of memory.\n", | ||
615 | mdesc_early_allocated); | ||
616 | |||
617 | report_platform_properties(); | ||
618 | mdesc_fill_in_cpu_data(); | ||
619 | } | ||
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index d4c077dc5e85..38a32bc95d22 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c | |||
@@ -306,6 +306,20 @@ static void __init pci_controller_probe(void) | |||
306 | pci_controller_scan(pci_controller_init); | 306 | pci_controller_scan(pci_controller_init); |
307 | } | 307 | } |
308 | 308 | ||
309 | static int ofpci_verbose; | ||
310 | |||
311 | static int __init ofpci_debug(char *str) | ||
312 | { | ||
313 | int val = 0; | ||
314 | |||
315 | get_option(&str, &val); | ||
316 | if (val) | ||
317 | ofpci_verbose = 1; | ||
318 | return 1; | ||
319 | } | ||
320 | |||
321 | __setup("ofpci_debug=", ofpci_debug); | ||
322 | |||
309 | static unsigned long pci_parse_of_flags(u32 addr0) | 323 | static unsigned long pci_parse_of_flags(u32 addr0) |
310 | { | 324 | { |
311 | unsigned long flags = 0; | 325 | unsigned long flags = 0; |
@@ -337,7 +351,9 @@ static void pci_parse_of_addrs(struct of_device *op, | |||
337 | addrs = of_get_property(node, "assigned-addresses", &proplen); | 351 | addrs = of_get_property(node, "assigned-addresses", &proplen); |
338 | if (!addrs) | 352 | if (!addrs) |
339 | return; | 353 | return; |
340 | printk(" parse addresses (%d bytes) @ %p\n", proplen, addrs); | 354 | if (ofpci_verbose) |
355 | printk(" parse addresses (%d bytes) @ %p\n", | ||
356 | proplen, addrs); | ||
341 | op_res = &op->resource[0]; | 357 | op_res = &op->resource[0]; |
342 | for (; proplen >= 20; proplen -= 20, addrs += 5, op_res++) { | 358 | for (; proplen >= 20; proplen -= 20, addrs += 5, op_res++) { |
343 | struct resource *res; | 359 | struct resource *res; |
@@ -348,8 +364,9 @@ static void pci_parse_of_addrs(struct of_device *op, | |||
348 | if (!flags) | 364 | if (!flags) |
349 | continue; | 365 | continue; |
350 | i = addrs[0] & 0xff; | 366 | i = addrs[0] & 0xff; |
351 | printk(" start: %lx, end: %lx, i: %x\n", | 367 | if (ofpci_verbose) |
352 | op_res->start, op_res->end, i); | 368 | printk(" start: %lx, end: %lx, i: %x\n", |
369 | op_res->start, op_res->end, i); | ||
353 | 370 | ||
354 | if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) { | 371 | if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) { |
355 | res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2]; | 372 | res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2]; |
@@ -393,8 +410,9 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, | |||
393 | if (type == NULL) | 410 | if (type == NULL) |
394 | type = ""; | 411 | type = ""; |
395 | 412 | ||
396 | printk(" create device, devfn: %x, type: %s hostcontroller(%d)\n", | 413 | if (ofpci_verbose) |
397 | devfn, type, host_controller); | 414 | printk(" create device, devfn: %x, type: %s\n", |
415 | devfn, type); | ||
398 | 416 | ||
399 | dev->bus = bus; | 417 | dev->bus = bus; |
400 | dev->sysdata = node; | 418 | dev->sysdata = node; |
@@ -434,8 +452,9 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, | |||
434 | sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), | 452 | sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), |
435 | dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); | 453 | dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); |
436 | } | 454 | } |
437 | printk(" class: 0x%x device name: %s\n", | 455 | if (ofpci_verbose) |
438 | dev->class, pci_name(dev)); | 456 | printk(" class: 0x%x device name: %s\n", |
457 | dev->class, pci_name(dev)); | ||
439 | 458 | ||
440 | /* I have seen IDE devices which will not respond to | 459 | /* I have seen IDE devices which will not respond to |
441 | * the bmdma simplex check reads if bus mastering is | 460 | * the bmdma simplex check reads if bus mastering is |
@@ -469,7 +488,8 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, | |||
469 | } | 488 | } |
470 | pci_parse_of_addrs(sd->op, node, dev); | 489 | pci_parse_of_addrs(sd->op, node, dev); |
471 | 490 | ||
472 | printk(" adding to system ...\n"); | 491 | if (ofpci_verbose) |
492 | printk(" adding to system ...\n"); | ||
473 | 493 | ||
474 | pci_device_add(dev, bus); | 494 | pci_device_add(dev, bus); |
475 | 495 | ||
@@ -547,7 +567,8 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
547 | unsigned int flags; | 567 | unsigned int flags; |
548 | u64 size; | 568 | u64 size; |
549 | 569 | ||
550 | printk("of_scan_pci_bridge(%s)\n", node->full_name); | 570 | if (ofpci_verbose) |
571 | printk("of_scan_pci_bridge(%s)\n", node->full_name); | ||
551 | 572 | ||
552 | /* parse bus-range property */ | 573 | /* parse bus-range property */ |
553 | busrange = of_get_property(node, "bus-range", &len); | 574 | busrange = of_get_property(node, "bus-range", &len); |
@@ -632,7 +653,8 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
632 | simba_cont: | 653 | simba_cont: |
633 | sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), | 654 | sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), |
634 | bus->number); | 655 | bus->number); |
635 | printk(" bus name: %s\n", bus->name); | 656 | if (ofpci_verbose) |
657 | printk(" bus name: %s\n", bus->name); | ||
636 | 658 | ||
637 | pci_of_scan_bus(pbm, node, bus); | 659 | pci_of_scan_bus(pbm, node, bus); |
638 | } | 660 | } |
@@ -646,12 +668,14 @@ static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, | |||
646 | int reglen, devfn; | 668 | int reglen, devfn; |
647 | struct pci_dev *dev; | 669 | struct pci_dev *dev; |
648 | 670 | ||
649 | printk("PCI: scan_bus[%s] bus no %d\n", | 671 | if (ofpci_verbose) |
650 | node->full_name, bus->number); | 672 | printk("PCI: scan_bus[%s] bus no %d\n", |
673 | node->full_name, bus->number); | ||
651 | 674 | ||
652 | child = NULL; | 675 | child = NULL; |
653 | while ((child = of_get_next_child(node, child)) != NULL) { | 676 | while ((child = of_get_next_child(node, child)) != NULL) { |
654 | printk(" * %s\n", child->full_name); | 677 | if (ofpci_verbose) |
678 | printk(" * %s\n", child->full_name); | ||
655 | reg = of_get_property(child, "reg", ®len); | 679 | reg = of_get_property(child, "reg", ®len); |
656 | if (reg == NULL || reglen < 20) | 680 | if (reg == NULL || reglen < 20) |
657 | continue; | 681 | continue; |
@@ -661,7 +685,9 @@ static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, | |||
661 | dev = of_create_pci_dev(pbm, child, bus, devfn, 0); | 685 | dev = of_create_pci_dev(pbm, child, bus, devfn, 0); |
662 | if (!dev) | 686 | if (!dev) |
663 | continue; | 687 | continue; |
664 | printk("PCI: dev header type: %x\n", dev->hdr_type); | 688 | if (ofpci_verbose) |
689 | printk("PCI: dev header type: %x\n", | ||
690 | dev->hdr_type); | ||
665 | 691 | ||
666 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | 692 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || |
667 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | 693 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) |
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index e2377796de89..323d6c278518 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c | |||
@@ -762,9 +762,10 @@ void sabre_init(struct device_node *dp, char *model_name) | |||
762 | /* Of course, Sun has to encode things a thousand | 762 | /* Of course, Sun has to encode things a thousand |
763 | * different ways, inconsistently. | 763 | * different ways, inconsistently. |
764 | */ | 764 | */ |
765 | cpu_find_by_instance(0, &dp, NULL); | 765 | for_each_node_by_type(dp, "cpu") { |
766 | if (!strcmp(dp->name, "SUNW,UltraSPARC-IIe")) | 766 | if (!strcmp(dp->name, "SUNW,UltraSPARC-IIe")) |
767 | hummingbird_p = 1; | 767 | hummingbird_p = 1; |
768 | } | ||
768 | } | 769 | } |
769 | } | 770 | } |
770 | 771 | ||
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 044e8ec4c0f5..6b3fe2c1d65e 100644 --- a/arch/sparc64/kernel/pci_sun4v.c +++ b/arch/sparc64/kernel/pci_sun4v.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/percpu.h> | 12 | #include <linux/percpu.h> |
13 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
14 | #include <linux/msi.h> | 14 | #include <linux/msi.h> |
15 | #include <linux/log2.h> | ||
15 | 16 | ||
16 | #include <asm/iommu.h> | 17 | #include <asm/iommu.h> |
17 | #include <asm/irq.h> | 18 | #include <asm/irq.h> |
@@ -26,6 +27,9 @@ | |||
26 | 27 | ||
27 | #include "pci_sun4v.h" | 28 | #include "pci_sun4v.h" |
28 | 29 | ||
30 | static unsigned long vpci_major = 1; | ||
31 | static unsigned long vpci_minor = 1; | ||
32 | |||
29 | #define PGLIST_NENTS (PAGE_SIZE / sizeof(u64)) | 33 | #define PGLIST_NENTS (PAGE_SIZE / sizeof(u64)) |
30 | 34 | ||
31 | struct iommu_batch { | 35 | struct iommu_batch { |
@@ -638,9 +642,8 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) | |||
638 | { | 642 | { |
639 | struct iommu *iommu = pbm->iommu; | 643 | struct iommu *iommu = pbm->iommu; |
640 | struct property *prop; | 644 | struct property *prop; |
641 | unsigned long num_tsb_entries, sz; | 645 | unsigned long num_tsb_entries, sz, tsbsize; |
642 | u32 vdma[2], dma_mask, dma_offset; | 646 | u32 vdma[2], dma_mask, dma_offset; |
643 | int tsbsize; | ||
644 | 647 | ||
645 | prop = of_find_property(pbm->prom_node, "virtual-dma", NULL); | 648 | prop = of_find_property(pbm->prom_node, "virtual-dma", NULL); |
646 | if (prop) { | 649 | if (prop) { |
@@ -654,31 +657,15 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) | |||
654 | vdma[1] = 0x80000000; | 657 | vdma[1] = 0x80000000; |
655 | } | 658 | } |
656 | 659 | ||
657 | dma_mask = vdma[0]; | 660 | if ((vdma[0] | vdma[1]) & ~IO_PAGE_MASK) { |
658 | switch (vdma[1]) { | 661 | prom_printf("PCI-SUN4V: strange virtual-dma[%08x:%08x].\n", |
659 | case 0x20000000: | 662 | vdma[0], vdma[1]); |
660 | dma_mask |= 0x1fffffff; | 663 | prom_halt(); |
661 | tsbsize = 64; | ||
662 | break; | ||
663 | |||
664 | case 0x40000000: | ||
665 | dma_mask |= 0x3fffffff; | ||
666 | tsbsize = 128; | ||
667 | break; | ||
668 | |||
669 | case 0x80000000: | ||
670 | dma_mask |= 0x7fffffff; | ||
671 | tsbsize = 256; | ||
672 | break; | ||
673 | |||
674 | default: | ||
675 | prom_printf("PCI-SUN4V: strange virtual-dma size.\n"); | ||
676 | prom_halt(); | ||
677 | }; | 664 | }; |
678 | 665 | ||
679 | tsbsize *= (8 * 1024); | 666 | dma_mask = (roundup_pow_of_two(vdma[1]) - 1UL); |
680 | 667 | num_tsb_entries = vdma[1] / IO_PAGE_SIZE; | |
681 | num_tsb_entries = tsbsize / sizeof(iopte_t); | 668 | tsbsize = num_tsb_entries * sizeof(iopte_t); |
682 | 669 | ||
683 | dma_offset = vdma[0]; | 670 | dma_offset = vdma[0]; |
684 | 671 | ||
@@ -689,7 +676,7 @@ static void pci_sun4v_iommu_init(struct pci_pbm_info *pbm) | |||
689 | iommu->dma_addr_mask = dma_mask; | 676 | iommu->dma_addr_mask = dma_mask; |
690 | 677 | ||
691 | /* Allocate and initialize the free area map. */ | 678 | /* Allocate and initialize the free area map. */ |
692 | sz = num_tsb_entries / 8; | 679 | sz = (num_tsb_entries + 7) / 8; |
693 | sz = (sz + 7UL) & ~7UL; | 680 | sz = (sz + 7UL) & ~7UL; |
694 | iommu->arena.map = kzalloc(sz, GFP_KERNEL); | 681 | iommu->arena.map = kzalloc(sz, GFP_KERNEL); |
695 | if (!iommu->arena.map) { | 682 | if (!iommu->arena.map) { |
@@ -1178,6 +1165,7 @@ static void pci_sun4v_pbm_init(struct pci_controller_info *p, struct device_node | |||
1178 | 1165 | ||
1179 | void sun4v_pci_init(struct device_node *dp, char *model_name) | 1166 | void sun4v_pci_init(struct device_node *dp, char *model_name) |
1180 | { | 1167 | { |
1168 | static int hvapi_negotiated = 0; | ||
1181 | struct pci_controller_info *p; | 1169 | struct pci_controller_info *p; |
1182 | struct pci_pbm_info *pbm; | 1170 | struct pci_pbm_info *pbm; |
1183 | struct iommu *iommu; | 1171 | struct iommu *iommu; |
@@ -1186,6 +1174,20 @@ void sun4v_pci_init(struct device_node *dp, char *model_name) | |||
1186 | u32 devhandle; | 1174 | u32 devhandle; |
1187 | int i; | 1175 | int i; |
1188 | 1176 | ||
1177 | if (!hvapi_negotiated++) { | ||
1178 | int err = sun4v_hvapi_register(HV_GRP_PCI, | ||
1179 | vpci_major, | ||
1180 | &vpci_minor); | ||
1181 | |||
1182 | if (err) { | ||
1183 | prom_printf("SUN4V_PCI: Could not register hvapi, " | ||
1184 | "err=%d\n", err); | ||
1185 | prom_halt(); | ||
1186 | } | ||
1187 | printk("SUN4V_PCI: Registered hvapi major[%lu] minor[%lu]\n", | ||
1188 | vpci_major, vpci_minor); | ||
1189 | } | ||
1190 | |||
1189 | prop = of_find_property(dp, "reg", NULL); | 1191 | prop = of_find_property(dp, "reg", NULL); |
1190 | regs = prop->value; | 1192 | regs = prop->value; |
1191 | 1193 | ||
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c index 699b24b890df..5d6adea3967f 100644 --- a/arch/sparc64/kernel/power.c +++ b/arch/sparc64/kernel/power.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/prom.h> | 19 | #include <asm/prom.h> |
20 | #include <asm/of_device.h> | 20 | #include <asm/of_device.h> |
21 | #include <asm/io.h> | 21 | #include <asm/io.h> |
22 | #include <asm/sstate.h> | ||
22 | 23 | ||
23 | #include <linux/unistd.h> | 24 | #include <linux/unistd.h> |
24 | 25 | ||
@@ -53,6 +54,7 @@ static void (*poweroff_method)(void) = machine_alt_power_off; | |||
53 | 54 | ||
54 | void machine_power_off(void) | 55 | void machine_power_off(void) |
55 | { | 56 | { |
57 | sstate_poweroff(); | ||
56 | if (!serial_console || scons_pwroff) { | 58 | if (!serial_console || scons_pwroff) { |
57 | #ifdef CONFIG_PCI | 59 | #ifdef CONFIG_PCI |
58 | if (power_reg) { | 60 | if (power_reg) { |
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index 952762bfb4c0..f5f97e2c669c 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <asm/mmu_context.h> | 45 | #include <asm/mmu_context.h> |
46 | #include <asm/unistd.h> | 46 | #include <asm/unistd.h> |
47 | #include <asm/hypervisor.h> | 47 | #include <asm/hypervisor.h> |
48 | #include <asm/sstate.h> | ||
48 | 49 | ||
49 | /* #define VERBOSE_SHOWREGS */ | 50 | /* #define VERBOSE_SHOWREGS */ |
50 | 51 | ||
@@ -106,6 +107,7 @@ extern void (*prom_keyboard)(void); | |||
106 | 107 | ||
107 | void machine_halt(void) | 108 | void machine_halt(void) |
108 | { | 109 | { |
110 | sstate_halt(); | ||
109 | if (!serial_console && prom_palette) | 111 | if (!serial_console && prom_palette) |
110 | prom_palette (1); | 112 | prom_palette (1); |
111 | if (prom_keyboard) | 113 | if (prom_keyboard) |
@@ -116,6 +118,7 @@ void machine_halt(void) | |||
116 | 118 | ||
117 | void machine_alt_power_off(void) | 119 | void machine_alt_power_off(void) |
118 | { | 120 | { |
121 | sstate_poweroff(); | ||
119 | if (!serial_console && prom_palette) | 122 | if (!serial_console && prom_palette) |
120 | prom_palette(1); | 123 | prom_palette(1); |
121 | if (prom_keyboard) | 124 | if (prom_keyboard) |
@@ -128,6 +131,7 @@ void machine_restart(char * cmd) | |||
128 | { | 131 | { |
129 | char *p; | 132 | char *p; |
130 | 133 | ||
134 | sstate_reboot(); | ||
131 | p = strchr (reboot_command, '\n'); | 135 | p = strchr (reboot_command, '\n'); |
132 | if (p) *p = 0; | 136 | if (p) *p = 0; |
133 | if (!serial_console && prom_palette) | 137 | if (!serial_console && prom_palette) |
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c index 02830e4671f5..dad4b3ba705f 100644 --- a/arch/sparc64/kernel/prom.c +++ b/arch/sparc64/kernel/prom.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/irq.h> | 28 | #include <asm/irq.h> |
29 | #include <asm/asi.h> | 29 | #include <asm/asi.h> |
30 | #include <asm/upa.h> | 30 | #include <asm/upa.h> |
31 | #include <asm/smp.h> | ||
31 | 32 | ||
32 | static struct device_node *allnodes; | 33 | static struct device_node *allnodes; |
33 | 34 | ||
@@ -1665,6 +1666,150 @@ static struct device_node * __init build_tree(struct device_node *parent, phandl | |||
1665 | return ret; | 1666 | return ret; |
1666 | } | 1667 | } |
1667 | 1668 | ||
1669 | static const char *get_mid_prop(void) | ||
1670 | { | ||
1671 | return (tlb_type == spitfire ? "upa-portid" : "portid"); | ||
1672 | } | ||
1673 | |||
1674 | struct device_node *of_find_node_by_cpuid(int cpuid) | ||
1675 | { | ||
1676 | struct device_node *dp; | ||
1677 | const char *mid_prop = get_mid_prop(); | ||
1678 | |||
1679 | for_each_node_by_type(dp, "cpu") { | ||
1680 | int id = of_getintprop_default(dp, mid_prop, -1); | ||
1681 | const char *this_mid_prop = mid_prop; | ||
1682 | |||
1683 | if (id < 0) { | ||
1684 | this_mid_prop = "cpuid"; | ||
1685 | id = of_getintprop_default(dp, this_mid_prop, -1); | ||
1686 | } | ||
1687 | |||
1688 | if (id < 0) { | ||
1689 | prom_printf("OF: Serious problem, cpu lacks " | ||
1690 | "%s property", this_mid_prop); | ||
1691 | prom_halt(); | ||
1692 | } | ||
1693 | if (cpuid == id) | ||
1694 | return dp; | ||
1695 | } | ||
1696 | return NULL; | ||
1697 | } | ||
1698 | |||
1699 | static void __init of_fill_in_cpu_data(void) | ||
1700 | { | ||
1701 | struct device_node *dp; | ||
1702 | const char *mid_prop = get_mid_prop(); | ||
1703 | |||
1704 | ncpus_probed = 0; | ||
1705 | for_each_node_by_type(dp, "cpu") { | ||
1706 | int cpuid = of_getintprop_default(dp, mid_prop, -1); | ||
1707 | const char *this_mid_prop = mid_prop; | ||
1708 | struct device_node *portid_parent; | ||
1709 | int portid = -1; | ||
1710 | |||
1711 | portid_parent = NULL; | ||
1712 | if (cpuid < 0) { | ||
1713 | this_mid_prop = "cpuid"; | ||
1714 | cpuid = of_getintprop_default(dp, this_mid_prop, -1); | ||
1715 | if (cpuid >= 0) { | ||
1716 | int limit = 2; | ||
1717 | |||
1718 | portid_parent = dp; | ||
1719 | while (limit--) { | ||
1720 | portid_parent = portid_parent->parent; | ||
1721 | if (!portid_parent) | ||
1722 | break; | ||
1723 | portid = of_getintprop_default(portid_parent, | ||
1724 | "portid", -1); | ||
1725 | if (portid >= 0) | ||
1726 | break; | ||
1727 | } | ||
1728 | } | ||
1729 | } | ||
1730 | |||
1731 | if (cpuid < 0) { | ||
1732 | prom_printf("OF: Serious problem, cpu lacks " | ||
1733 | "%s property", this_mid_prop); | ||
1734 | prom_halt(); | ||
1735 | } | ||
1736 | |||
1737 | ncpus_probed++; | ||
1738 | |||
1739 | #ifdef CONFIG_SMP | ||
1740 | if (cpuid >= NR_CPUS) | ||
1741 | continue; | ||
1742 | #else | ||
1743 | /* On uniprocessor we only want the values for the | ||
1744 | * real physical cpu the kernel booted onto, however | ||
1745 | * cpu_data() only has one entry at index 0. | ||
1746 | */ | ||
1747 | if (cpuid != real_hard_smp_processor_id()) | ||
1748 | continue; | ||
1749 | cpuid = 0; | ||
1750 | #endif | ||
1751 | |||
1752 | cpu_data(cpuid).clock_tick = | ||
1753 | of_getintprop_default(dp, "clock-frequency", 0); | ||
1754 | |||
1755 | if (portid_parent) { | ||
1756 | cpu_data(cpuid).dcache_size = | ||
1757 | of_getintprop_default(dp, "l1-dcache-size", | ||
1758 | 16 * 1024); | ||
1759 | cpu_data(cpuid).dcache_line_size = | ||
1760 | of_getintprop_default(dp, "l1-dcache-line-size", | ||
1761 | 32); | ||
1762 | cpu_data(cpuid).icache_size = | ||
1763 | of_getintprop_default(dp, "l1-icache-size", | ||
1764 | 8 * 1024); | ||
1765 | cpu_data(cpuid).icache_line_size = | ||
1766 | of_getintprop_default(dp, "l1-icache-line-size", | ||
1767 | 32); | ||
1768 | cpu_data(cpuid).ecache_size = | ||
1769 | of_getintprop_default(dp, "l2-cache-size", 0); | ||
1770 | cpu_data(cpuid).ecache_line_size = | ||
1771 | of_getintprop_default(dp, "l2-cache-line-size", 0); | ||
1772 | if (!cpu_data(cpuid).ecache_size || | ||
1773 | !cpu_data(cpuid).ecache_line_size) { | ||
1774 | cpu_data(cpuid).ecache_size = | ||
1775 | of_getintprop_default(portid_parent, | ||
1776 | "l2-cache-size", | ||
1777 | (4 * 1024 * 1024)); | ||
1778 | cpu_data(cpuid).ecache_line_size = | ||
1779 | of_getintprop_default(portid_parent, | ||
1780 | "l2-cache-line-size", 64); | ||
1781 | } | ||
1782 | |||
1783 | cpu_data(cpuid).core_id = portid + 1; | ||
1784 | } else { | ||
1785 | cpu_data(cpuid).dcache_size = | ||
1786 | of_getintprop_default(dp, "dcache-size", 16 * 1024); | ||
1787 | cpu_data(cpuid).dcache_line_size = | ||
1788 | of_getintprop_default(dp, "dcache-line-size", 32); | ||
1789 | |||
1790 | cpu_data(cpuid).icache_size = | ||
1791 | of_getintprop_default(dp, "icache-size", 16 * 1024); | ||
1792 | cpu_data(cpuid).icache_line_size = | ||
1793 | of_getintprop_default(dp, "icache-line-size", 32); | ||
1794 | |||
1795 | cpu_data(cpuid).ecache_size = | ||
1796 | of_getintprop_default(dp, "ecache-size", | ||
1797 | (4 * 1024 * 1024)); | ||
1798 | cpu_data(cpuid).ecache_line_size = | ||
1799 | of_getintprop_default(dp, "ecache-line-size", 64); | ||
1800 | |||
1801 | cpu_data(cpuid).core_id = 0; | ||
1802 | } | ||
1803 | |||
1804 | #ifdef CONFIG_SMP | ||
1805 | cpu_set(cpuid, cpu_present_map); | ||
1806 | cpu_set(cpuid, phys_cpu_present_map); | ||
1807 | #endif | ||
1808 | } | ||
1809 | |||
1810 | smp_fill_in_sib_core_maps(); | ||
1811 | } | ||
1812 | |||
1668 | void __init prom_build_devicetree(void) | 1813 | void __init prom_build_devicetree(void) |
1669 | { | 1814 | { |
1670 | struct device_node **nextp; | 1815 | struct device_node **nextp; |
@@ -1679,4 +1824,7 @@ void __init prom_build_devicetree(void) | |||
1679 | &nextp); | 1824 | &nextp); |
1680 | printk("PROM: Built device tree with %u bytes of memory.\n", | 1825 | printk("PROM: Built device tree with %u bytes of memory.\n", |
1681 | prom_early_allocated); | 1826 | prom_early_allocated); |
1827 | |||
1828 | if (tlb_type != hypervisor) | ||
1829 | of_fill_in_cpu_data(); | ||
1682 | } | 1830 | } |
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index dea9c3c9ec5f..de9b4c13f1c7 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c | |||
@@ -46,11 +46,17 @@ | |||
46 | #include <asm/sections.h> | 46 | #include <asm/sections.h> |
47 | #include <asm/setup.h> | 47 | #include <asm/setup.h> |
48 | #include <asm/mmu.h> | 48 | #include <asm/mmu.h> |
49 | #include <asm/ns87303.h> | ||
49 | 50 | ||
50 | #ifdef CONFIG_IP_PNP | 51 | #ifdef CONFIG_IP_PNP |
51 | #include <net/ipconfig.h> | 52 | #include <net/ipconfig.h> |
52 | #endif | 53 | #endif |
53 | 54 | ||
55 | /* Used to synchronize accesses to NatSemi SUPER I/O chip configure | ||
56 | * operations in asm/ns87303.h | ||
57 | */ | ||
58 | DEFINE_SPINLOCK(ns87303_lock); | ||
59 | |||
54 | struct screen_info screen_info = { | 60 | struct screen_info screen_info = { |
55 | 0, 0, /* orig-x, orig-y */ | 61 | 0, 0, /* orig-x, orig-y */ |
56 | 0, /* unused */ | 62 | 0, /* unused */ |
@@ -370,8 +376,6 @@ void __init setup_arch(char **cmdline_p) | |||
370 | init_cur_cpu_trap(current_thread_info()); | 376 | init_cur_cpu_trap(current_thread_info()); |
371 | 377 | ||
372 | paging_init(); | 378 | paging_init(); |
373 | |||
374 | smp_setup_cpu_possible_map(); | ||
375 | } | 379 | } |
376 | 380 | ||
377 | static int __init set_preferred_console(void) | 381 | static int __init set_preferred_console(void) |
@@ -424,7 +428,7 @@ extern void mmu_info(struct seq_file *); | |||
424 | unsigned int dcache_parity_tl1_occurred; | 428 | unsigned int dcache_parity_tl1_occurred; |
425 | unsigned int icache_parity_tl1_occurred; | 429 | unsigned int icache_parity_tl1_occurred; |
426 | 430 | ||
427 | static int ncpus_probed; | 431 | int ncpus_probed; |
428 | 432 | ||
429 | static int show_cpuinfo(struct seq_file *m, void *__unused) | 433 | static int show_cpuinfo(struct seq_file *m, void *__unused) |
430 | { | 434 | { |
@@ -516,14 +520,6 @@ static int __init topology_init(void) | |||
516 | 520 | ||
517 | err = -ENOMEM; | 521 | err = -ENOMEM; |
518 | 522 | ||
519 | /* Count the number of physically present processors in | ||
520 | * the machine, even on uniprocessor, so that /proc/cpuinfo | ||
521 | * output is consistent with 2.4.x | ||
522 | */ | ||
523 | ncpus_probed = 0; | ||
524 | while (!cpu_find_by_instance(ncpus_probed, NULL, NULL)) | ||
525 | ncpus_probed++; | ||
526 | |||
527 | for_each_possible_cpu(i) { | 523 | for_each_possible_cpu(i) { |
528 | struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL); | 524 | struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL); |
529 | if (p) { | 525 | if (p) { |
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 24fdf1d0adc5..c550bba3490a 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <asm/tlb.h> | 40 | #include <asm/tlb.h> |
41 | #include <asm/sections.h> | 41 | #include <asm/sections.h> |
42 | #include <asm/prom.h> | 42 | #include <asm/prom.h> |
43 | #include <asm/mdesc.h> | ||
43 | 44 | ||
44 | extern void calibrate_delay(void); | 45 | extern void calibrate_delay(void); |
45 | 46 | ||
@@ -75,53 +76,6 @@ void smp_bogo(struct seq_file *m) | |||
75 | i, cpu_data(i).clock_tick); | 76 | i, cpu_data(i).clock_tick); |
76 | } | 77 | } |
77 | 78 | ||
78 | void __init smp_store_cpu_info(int id) | ||
79 | { | ||
80 | struct device_node *dp; | ||
81 | int def; | ||
82 | |||
83 | cpu_data(id).udelay_val = loops_per_jiffy; | ||
84 | |||
85 | cpu_find_by_mid(id, &dp); | ||
86 | cpu_data(id).clock_tick = | ||
87 | of_getintprop_default(dp, "clock-frequency", 0); | ||
88 | |||
89 | def = ((tlb_type == hypervisor) ? (8 * 1024) : (16 * 1024)); | ||
90 | cpu_data(id).dcache_size = | ||
91 | of_getintprop_default(dp, "dcache-size", def); | ||
92 | |||
93 | def = 32; | ||
94 | cpu_data(id).dcache_line_size = | ||
95 | of_getintprop_default(dp, "dcache-line-size", def); | ||
96 | |||
97 | def = 16 * 1024; | ||
98 | cpu_data(id).icache_size = | ||
99 | of_getintprop_default(dp, "icache-size", def); | ||
100 | |||
101 | def = 32; | ||
102 | cpu_data(id).icache_line_size = | ||
103 | of_getintprop_default(dp, "icache-line-size", def); | ||
104 | |||
105 | def = ((tlb_type == hypervisor) ? | ||
106 | (3 * 1024 * 1024) : | ||
107 | (4 * 1024 * 1024)); | ||
108 | cpu_data(id).ecache_size = | ||
109 | of_getintprop_default(dp, "ecache-size", def); | ||
110 | |||
111 | def = 64; | ||
112 | cpu_data(id).ecache_line_size = | ||
113 | of_getintprop_default(dp, "ecache-line-size", def); | ||
114 | |||
115 | printk("CPU[%d]: Caches " | ||
116 | "D[sz(%d):line_sz(%d)] " | ||
117 | "I[sz(%d):line_sz(%d)] " | ||
118 | "E[sz(%d):line_sz(%d)]\n", | ||
119 | id, | ||
120 | cpu_data(id).dcache_size, cpu_data(id).dcache_line_size, | ||
121 | cpu_data(id).icache_size, cpu_data(id).icache_line_size, | ||
122 | cpu_data(id).ecache_size, cpu_data(id).ecache_line_size); | ||
123 | } | ||
124 | |||
125 | extern void setup_sparc64_timer(void); | 79 | extern void setup_sparc64_timer(void); |
126 | 80 | ||
127 | static volatile unsigned long callin_flag = 0; | 81 | static volatile unsigned long callin_flag = 0; |
@@ -145,7 +99,7 @@ void __init smp_callin(void) | |||
145 | local_irq_enable(); | 99 | local_irq_enable(); |
146 | 100 | ||
147 | calibrate_delay(); | 101 | calibrate_delay(); |
148 | smp_store_cpu_info(cpuid); | 102 | cpu_data(cpuid).udelay_val = loops_per_jiffy; |
149 | callin_flag = 1; | 103 | callin_flag = 1; |
150 | __asm__ __volatile__("membar #Sync\n\t" | 104 | __asm__ __volatile__("membar #Sync\n\t" |
151 | "flush %%g6" : : : "memory"); | 105 | "flush %%g6" : : : "memory"); |
@@ -340,9 +294,8 @@ static int __devinit smp_boot_one_cpu(unsigned int cpu) | |||
340 | 294 | ||
341 | prom_startcpu_cpuid(cpu, entry, cookie); | 295 | prom_startcpu_cpuid(cpu, entry, cookie); |
342 | } else { | 296 | } else { |
343 | struct device_node *dp; | 297 | struct device_node *dp = of_find_node_by_cpuid(cpu); |
344 | 298 | ||
345 | cpu_find_by_mid(cpu, &dp); | ||
346 | prom_startcpu(dp->node, entry, cookie); | 299 | prom_startcpu(dp->node, entry, cookie); |
347 | } | 300 | } |
348 | 301 | ||
@@ -447,7 +400,7 @@ static __inline__ void spitfire_xcall_deliver(u64 data0, u64 data1, u64 data2, c | |||
447 | static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask) | 400 | static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask) |
448 | { | 401 | { |
449 | u64 pstate, ver; | 402 | u64 pstate, ver; |
450 | int nack_busy_id, is_jbus; | 403 | int nack_busy_id, is_jbus, need_more; |
451 | 404 | ||
452 | if (cpus_empty(mask)) | 405 | if (cpus_empty(mask)) |
453 | return; | 406 | return; |
@@ -463,6 +416,7 @@ static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mas | |||
463 | __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate)); | 416 | __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate)); |
464 | 417 | ||
465 | retry: | 418 | retry: |
419 | need_more = 0; | ||
466 | __asm__ __volatile__("wrpr %0, %1, %%pstate\n\t" | 420 | __asm__ __volatile__("wrpr %0, %1, %%pstate\n\t" |
467 | : : "r" (pstate), "i" (PSTATE_IE)); | 421 | : : "r" (pstate), "i" (PSTATE_IE)); |
468 | 422 | ||
@@ -491,6 +445,10 @@ retry: | |||
491 | : /* no outputs */ | 445 | : /* no outputs */ |
492 | : "r" (target), "i" (ASI_INTR_W)); | 446 | : "r" (target), "i" (ASI_INTR_W)); |
493 | nack_busy_id++; | 447 | nack_busy_id++; |
448 | if (nack_busy_id == 32) { | ||
449 | need_more = 1; | ||
450 | break; | ||
451 | } | ||
494 | } | 452 | } |
495 | } | 453 | } |
496 | 454 | ||
@@ -507,6 +465,16 @@ retry: | |||
507 | if (dispatch_stat == 0UL) { | 465 | if (dispatch_stat == 0UL) { |
508 | __asm__ __volatile__("wrpr %0, 0x0, %%pstate" | 466 | __asm__ __volatile__("wrpr %0, 0x0, %%pstate" |
509 | : : "r" (pstate)); | 467 | : : "r" (pstate)); |
468 | if (unlikely(need_more)) { | ||
469 | int i, cnt = 0; | ||
470 | for_each_cpu_mask(i, mask) { | ||
471 | cpu_clear(i, mask); | ||
472 | cnt++; | ||
473 | if (cnt == 32) | ||
474 | break; | ||
475 | } | ||
476 | goto retry; | ||
477 | } | ||
510 | return; | 478 | return; |
511 | } | 479 | } |
512 | if (!--stuck) | 480 | if (!--stuck) |
@@ -544,6 +512,8 @@ retry: | |||
544 | if ((dispatch_stat & check_mask) == 0) | 512 | if ((dispatch_stat & check_mask) == 0) |
545 | cpu_clear(i, mask); | 513 | cpu_clear(i, mask); |
546 | this_busy_nack += 2; | 514 | this_busy_nack += 2; |
515 | if (this_busy_nack == 64) | ||
516 | break; | ||
547 | } | 517 | } |
548 | 518 | ||
549 | goto retry; | 519 | goto retry; |
@@ -1191,23 +1161,14 @@ int setup_profiling_timer(unsigned int multiplier) | |||
1191 | 1161 | ||
1192 | static void __init smp_tune_scheduling(void) | 1162 | static void __init smp_tune_scheduling(void) |
1193 | { | 1163 | { |
1194 | struct device_node *dp; | 1164 | unsigned int smallest = ~0U; |
1195 | int instance; | 1165 | int i; |
1196 | unsigned int def, smallest = ~0U; | ||
1197 | |||
1198 | def = ((tlb_type == hypervisor) ? | ||
1199 | (3 * 1024 * 1024) : | ||
1200 | (4 * 1024 * 1024)); | ||
1201 | 1166 | ||
1202 | instance = 0; | 1167 | for (i = 0; i < NR_CPUS; i++) { |
1203 | while (!cpu_find_by_instance(instance, &dp, NULL)) { | 1168 | unsigned int val = cpu_data(i).ecache_size; |
1204 | unsigned int val; | ||
1205 | 1169 | ||
1206 | val = of_getintprop_default(dp, "ecache-size", def); | 1170 | if (val && val < smallest) |
1207 | if (val < smallest) | ||
1208 | smallest = val; | 1171 | smallest = val; |
1209 | |||
1210 | instance++; | ||
1211 | } | 1172 | } |
1212 | 1173 | ||
1213 | /* Any value less than 256K is nonsense. */ | 1174 | /* Any value less than 256K is nonsense. */ |
@@ -1230,58 +1191,42 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
1230 | int i; | 1191 | int i; |
1231 | 1192 | ||
1232 | if (num_possible_cpus() > max_cpus) { | 1193 | if (num_possible_cpus() > max_cpus) { |
1233 | int instance, mid; | 1194 | for_each_possible_cpu(i) { |
1234 | 1195 | if (i != boot_cpu_id) { | |
1235 | instance = 0; | 1196 | cpu_clear(i, phys_cpu_present_map); |
1236 | while (!cpu_find_by_instance(instance, NULL, &mid)) { | 1197 | cpu_clear(i, cpu_present_map); |
1237 | if (mid != boot_cpu_id) { | ||
1238 | cpu_clear(mid, phys_cpu_present_map); | ||
1239 | cpu_clear(mid, cpu_present_map); | ||
1240 | if (num_possible_cpus() <= max_cpus) | 1198 | if (num_possible_cpus() <= max_cpus) |
1241 | break; | 1199 | break; |
1242 | } | 1200 | } |
1243 | instance++; | ||
1244 | } | 1201 | } |
1245 | } | 1202 | } |
1246 | 1203 | ||
1247 | for_each_possible_cpu(i) { | 1204 | cpu_data(boot_cpu_id).udelay_val = loops_per_jiffy; |
1248 | if (tlb_type == hypervisor) { | ||
1249 | int j; | ||
1250 | |||
1251 | /* XXX get this mapping from machine description */ | ||
1252 | for_each_possible_cpu(j) { | ||
1253 | if ((j >> 2) == (i >> 2)) | ||
1254 | cpu_set(j, cpu_sibling_map[i]); | ||
1255 | } | ||
1256 | } else { | ||
1257 | cpu_set(i, cpu_sibling_map[i]); | ||
1258 | } | ||
1259 | } | ||
1260 | |||
1261 | smp_store_cpu_info(boot_cpu_id); | ||
1262 | smp_tune_scheduling(); | 1205 | smp_tune_scheduling(); |
1263 | } | 1206 | } |
1264 | 1207 | ||
1265 | /* Set this up early so that things like the scheduler can init | 1208 | void __devinit smp_prepare_boot_cpu(void) |
1266 | * properly. We use the same cpu mask for both the present and | ||
1267 | * possible cpu map. | ||
1268 | */ | ||
1269 | void __init smp_setup_cpu_possible_map(void) | ||
1270 | { | 1209 | { |
1271 | int instance, mid; | ||
1272 | |||
1273 | instance = 0; | ||
1274 | while (!cpu_find_by_instance(instance, NULL, &mid)) { | ||
1275 | if (mid < NR_CPUS) { | ||
1276 | cpu_set(mid, phys_cpu_present_map); | ||
1277 | cpu_set(mid, cpu_present_map); | ||
1278 | } | ||
1279 | instance++; | ||
1280 | } | ||
1281 | } | 1210 | } |
1282 | 1211 | ||
1283 | void __devinit smp_prepare_boot_cpu(void) | 1212 | void __devinit smp_fill_in_sib_core_maps(void) |
1284 | { | 1213 | { |
1214 | unsigned int i; | ||
1215 | |||
1216 | for_each_possible_cpu(i) { | ||
1217 | unsigned int j; | ||
1218 | |||
1219 | if (cpu_data(i).core_id == 0) { | ||
1220 | cpu_set(i, cpu_sibling_map[i]); | ||
1221 | continue; | ||
1222 | } | ||
1223 | |||
1224 | for_each_possible_cpu(j) { | ||
1225 | if (cpu_data(i).core_id == | ||
1226 | cpu_data(j).core_id) | ||
1227 | cpu_set(j, cpu_sibling_map[i]); | ||
1228 | } | ||
1229 | } | ||
1285 | } | 1230 | } |
1286 | 1231 | ||
1287 | int __cpuinit __cpu_up(unsigned int cpu) | 1232 | int __cpuinit __cpu_up(unsigned int cpu) |
@@ -1337,7 +1282,7 @@ unsigned long __per_cpu_shift __read_mostly; | |||
1337 | EXPORT_SYMBOL(__per_cpu_base); | 1282 | EXPORT_SYMBOL(__per_cpu_base); |
1338 | EXPORT_SYMBOL(__per_cpu_shift); | 1283 | EXPORT_SYMBOL(__per_cpu_shift); |
1339 | 1284 | ||
1340 | void __init setup_per_cpu_areas(void) | 1285 | void __init real_setup_per_cpu_areas(void) |
1341 | { | 1286 | { |
1342 | unsigned long goal, size, i; | 1287 | unsigned long goal, size, i; |
1343 | char *ptr; | 1288 | char *ptr; |
diff --git a/arch/sparc64/kernel/sstate.c b/arch/sparc64/kernel/sstate.c new file mode 100644 index 000000000000..5b6e75b7f052 --- /dev/null +++ b/arch/sparc64/kernel/sstate.c | |||
@@ -0,0 +1,104 @@ | |||
1 | /* sstate.c: System soft state support. | ||
2 | * | ||
3 | * Copyright (C) 2007 David S. Miller <davem@davemloft.net> | ||
4 | */ | ||
5 | |||
6 | #include <linux/kernel.h> | ||
7 | #include <linux/notifier.h> | ||
8 | #include <linux/init.h> | ||
9 | |||
10 | #include <asm/hypervisor.h> | ||
11 | #include <asm/sstate.h> | ||
12 | #include <asm/oplib.h> | ||
13 | #include <asm/head.h> | ||
14 | #include <asm/io.h> | ||
15 | |||
16 | static int hv_supports_soft_state; | ||
17 | |||
18 | static unsigned long kimage_addr_to_ra(const char *p) | ||
19 | { | ||
20 | unsigned long val = (unsigned long) p; | ||
21 | |||
22 | return kern_base + (val - KERNBASE); | ||
23 | } | ||
24 | |||
25 | static void do_set_sstate(unsigned long state, const char *msg) | ||
26 | { | ||
27 | unsigned long err; | ||
28 | |||
29 | if (!hv_supports_soft_state) | ||
30 | return; | ||
31 | |||
32 | err = sun4v_mach_set_soft_state(state, kimage_addr_to_ra(msg)); | ||
33 | if (err) { | ||
34 | printk(KERN_WARNING "SSTATE: Failed to set soft-state to " | ||
35 | "state[%lx] msg[%s], err=%lu\n", | ||
36 | state, msg, err); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | static const char booting_msg[32] __attribute__((aligned(32))) = | ||
41 | "Linux booting"; | ||
42 | static const char running_msg[32] __attribute__((aligned(32))) = | ||
43 | "Linux running"; | ||
44 | static const char halting_msg[32] __attribute__((aligned(32))) = | ||
45 | "Linux halting"; | ||
46 | static const char poweroff_msg[32] __attribute__((aligned(32))) = | ||
47 | "Linux powering off"; | ||
48 | static const char rebooting_msg[32] __attribute__((aligned(32))) = | ||
49 | "Linux rebooting"; | ||
50 | static const char panicing_msg[32] __attribute__((aligned(32))) = | ||
51 | "Linux panicing"; | ||
52 | |||
53 | void sstate_booting(void) | ||
54 | { | ||
55 | do_set_sstate(HV_SOFT_STATE_TRANSITION, booting_msg); | ||
56 | } | ||
57 | |||
58 | void sstate_running(void) | ||
59 | { | ||
60 | do_set_sstate(HV_SOFT_STATE_NORMAL, running_msg); | ||
61 | } | ||
62 | |||
63 | void sstate_halt(void) | ||
64 | { | ||
65 | do_set_sstate(HV_SOFT_STATE_TRANSITION, halting_msg); | ||
66 | } | ||
67 | |||
68 | void sstate_poweroff(void) | ||
69 | { | ||
70 | do_set_sstate(HV_SOFT_STATE_TRANSITION, poweroff_msg); | ||
71 | } | ||
72 | |||
73 | void sstate_reboot(void) | ||
74 | { | ||
75 | do_set_sstate(HV_SOFT_STATE_TRANSITION, rebooting_msg); | ||
76 | } | ||
77 | |||
78 | static int sstate_panic_event(struct notifier_block *n, unsigned long event, void *ptr) | ||
79 | { | ||
80 | do_set_sstate(HV_SOFT_STATE_TRANSITION, panicing_msg); | ||
81 | |||
82 | return NOTIFY_DONE; | ||
83 | } | ||
84 | |||
85 | static struct notifier_block sstate_panic_block = { | ||
86 | .notifier_call = sstate_panic_event, | ||
87 | .priority = INT_MAX, | ||
88 | }; | ||
89 | |||
90 | void __init sun4v_sstate_init(void) | ||
91 | { | ||
92 | unsigned long major, minor; | ||
93 | |||
94 | major = 1; | ||
95 | minor = 0; | ||
96 | if (sun4v_hvapi_register(HV_GRP_SOFT_STATE, major, &minor)) | ||
97 | return; | ||
98 | |||
99 | hv_supports_soft_state = 1; | ||
100 | |||
101 | prom_sun4v_guest_soft_state(); | ||
102 | atomic_notifier_chain_register(&panic_notifier_list, | ||
103 | &sstate_panic_block); | ||
104 | } | ||
diff --git a/arch/sparc64/kernel/sun4v_ivec.S b/arch/sparc64/kernel/sun4v_ivec.S index 405855dd886b..574bc248bca6 100644 --- a/arch/sparc64/kernel/sun4v_ivec.S +++ b/arch/sparc64/kernel/sun4v_ivec.S | |||
@@ -22,12 +22,12 @@ sun4v_cpu_mondo: | |||
22 | be,pn %xcc, sun4v_cpu_mondo_queue_empty | 22 | be,pn %xcc, sun4v_cpu_mondo_queue_empty |
23 | nop | 23 | nop |
24 | 24 | ||
25 | /* Get &trap_block[smp_processor_id()] into %g3. */ | 25 | /* Get &trap_block[smp_processor_id()] into %g4. */ |
26 | ldxa [%g0] ASI_SCRATCHPAD, %g3 | 26 | ldxa [%g0] ASI_SCRATCHPAD, %g4 |
27 | sub %g3, TRAP_PER_CPU_FAULT_INFO, %g3 | 27 | sub %g4, TRAP_PER_CPU_FAULT_INFO, %g4 |
28 | 28 | ||
29 | /* Get CPU mondo queue base phys address into %g7. */ | 29 | /* Get CPU mondo queue base phys address into %g7. */ |
30 | ldx [%g3 + TRAP_PER_CPU_CPU_MONDO_PA], %g7 | 30 | ldx [%g4 + TRAP_PER_CPU_CPU_MONDO_PA], %g7 |
31 | 31 | ||
32 | /* Now get the cross-call arguments and handler PC, same | 32 | /* Now get the cross-call arguments and handler PC, same |
33 | * layout as sun4u: | 33 | * layout as sun4u: |
@@ -47,8 +47,7 @@ sun4v_cpu_mondo: | |||
47 | add %g2, 0x40 - 0x8 - 0x8, %g2 | 47 | add %g2, 0x40 - 0x8 - 0x8, %g2 |
48 | 48 | ||
49 | /* Update queue head pointer. */ | 49 | /* Update queue head pointer. */ |
50 | sethi %hi(8192 - 1), %g4 | 50 | lduw [%g4 + TRAP_PER_CPU_CPU_MONDO_QMASK], %g4 |
51 | or %g4, %lo(8192 - 1), %g4 | ||
52 | and %g2, %g4, %g2 | 51 | and %g2, %g4, %g2 |
53 | 52 | ||
54 | mov INTRQ_CPU_MONDO_HEAD, %g4 | 53 | mov INTRQ_CPU_MONDO_HEAD, %g4 |
@@ -71,12 +70,12 @@ sun4v_dev_mondo: | |||
71 | be,pn %xcc, sun4v_dev_mondo_queue_empty | 70 | be,pn %xcc, sun4v_dev_mondo_queue_empty |
72 | nop | 71 | nop |
73 | 72 | ||
74 | /* Get &trap_block[smp_processor_id()] into %g3. */ | 73 | /* Get &trap_block[smp_processor_id()] into %g4. */ |
75 | ldxa [%g0] ASI_SCRATCHPAD, %g3 | 74 | ldxa [%g0] ASI_SCRATCHPAD, %g4 |
76 | sub %g3, TRAP_PER_CPU_FAULT_INFO, %g3 | 75 | sub %g4, TRAP_PER_CPU_FAULT_INFO, %g4 |
77 | 76 | ||
78 | /* Get DEV mondo queue base phys address into %g5. */ | 77 | /* Get DEV mondo queue base phys address into %g5. */ |
79 | ldx [%g3 + TRAP_PER_CPU_DEV_MONDO_PA], %g5 | 78 | ldx [%g4 + TRAP_PER_CPU_DEV_MONDO_PA], %g5 |
80 | 79 | ||
81 | /* Load IVEC into %g3. */ | 80 | /* Load IVEC into %g3. */ |
82 | ldxa [%g5 + %g2] ASI_PHYS_USE_EC, %g3 | 81 | ldxa [%g5 + %g2] ASI_PHYS_USE_EC, %g3 |
@@ -90,8 +89,7 @@ sun4v_dev_mondo: | |||
90 | */ | 89 | */ |
91 | 90 | ||
92 | /* Update queue head pointer, this frees up some registers. */ | 91 | /* Update queue head pointer, this frees up some registers. */ |
93 | sethi %hi(8192 - 1), %g4 | 92 | lduw [%g4 + TRAP_PER_CPU_DEV_MONDO_QMASK], %g4 |
94 | or %g4, %lo(8192 - 1), %g4 | ||
95 | and %g2, %g4, %g2 | 93 | and %g2, %g4, %g2 |
96 | 94 | ||
97 | mov INTRQ_DEVICE_MONDO_HEAD, %g4 | 95 | mov INTRQ_DEVICE_MONDO_HEAD, %g4 |
@@ -143,6 +141,8 @@ sun4v_res_mondo: | |||
143 | brnz,pn %g1, sun4v_res_mondo_queue_full | 141 | brnz,pn %g1, sun4v_res_mondo_queue_full |
144 | nop | 142 | nop |
145 | 143 | ||
144 | lduw [%g3 + TRAP_PER_CPU_RESUM_QMASK], %g4 | ||
145 | |||
146 | /* Remember this entry's offset in %g1. */ | 146 | /* Remember this entry's offset in %g1. */ |
147 | mov %g2, %g1 | 147 | mov %g2, %g1 |
148 | 148 | ||
@@ -173,8 +173,6 @@ sun4v_res_mondo: | |||
173 | add %g2, 0x08, %g2 | 173 | add %g2, 0x08, %g2 |
174 | 174 | ||
175 | /* Update queue head pointer. */ | 175 | /* Update queue head pointer. */ |
176 | sethi %hi(8192 - 1), %g4 | ||
177 | or %g4, %lo(8192 - 1), %g4 | ||
178 | and %g2, %g4, %g2 | 176 | and %g2, %g4, %g2 |
179 | 177 | ||
180 | mov INTRQ_RESUM_MONDO_HEAD, %g4 | 178 | mov INTRQ_RESUM_MONDO_HEAD, %g4 |
@@ -254,6 +252,8 @@ sun4v_nonres_mondo: | |||
254 | brnz,pn %g1, sun4v_nonres_mondo_queue_full | 252 | brnz,pn %g1, sun4v_nonres_mondo_queue_full |
255 | nop | 253 | nop |
256 | 254 | ||
255 | lduw [%g3 + TRAP_PER_CPU_NONRESUM_QMASK], %g4 | ||
256 | |||
257 | /* Remember this entry's offset in %g1. */ | 257 | /* Remember this entry's offset in %g1. */ |
258 | mov %g2, %g1 | 258 | mov %g2, %g1 |
259 | 259 | ||
@@ -284,8 +284,6 @@ sun4v_nonres_mondo: | |||
284 | add %g2, 0x08, %g2 | 284 | add %g2, 0x08, %g2 |
285 | 285 | ||
286 | /* Update queue head pointer. */ | 286 | /* Update queue head pointer. */ |
287 | sethi %hi(8192 - 1), %g4 | ||
288 | or %g4, %lo(8192 - 1), %g4 | ||
289 | and %g2, %g4, %g2 | 287 | and %g2, %g4, %g2 |
290 | 288 | ||
291 | mov INTRQ_NONRESUM_MONDO_HEAD, %g4 | 289 | mov INTRQ_NONRESUM_MONDO_HEAD, %g4 |
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c index 2d63d7689962..a31a0439244f 100644 --- a/arch/sparc64/kernel/time.c +++ b/arch/sparc64/kernel/time.c | |||
@@ -680,22 +680,14 @@ static int starfire_set_time(u32 val) | |||
680 | 680 | ||
681 | static u32 hypervisor_get_time(void) | 681 | static u32 hypervisor_get_time(void) |
682 | { | 682 | { |
683 | register unsigned long func asm("%o5"); | 683 | unsigned long ret, time; |
684 | register unsigned long arg0 asm("%o0"); | ||
685 | register unsigned long arg1 asm("%o1"); | ||
686 | int retries = 10000; | 684 | int retries = 10000; |
687 | 685 | ||
688 | retry: | 686 | retry: |
689 | func = HV_FAST_TOD_GET; | 687 | ret = sun4v_tod_get(&time); |
690 | arg0 = 0; | 688 | if (ret == HV_EOK) |
691 | arg1 = 0; | 689 | return time; |
692 | __asm__ __volatile__("ta %6" | 690 | if (ret == HV_EWOULDBLOCK) { |
693 | : "=&r" (func), "=&r" (arg0), "=&r" (arg1) | ||
694 | : "0" (func), "1" (arg0), "2" (arg1), | ||
695 | "i" (HV_FAST_TRAP)); | ||
696 | if (arg0 == HV_EOK) | ||
697 | return arg1; | ||
698 | if (arg0 == HV_EWOULDBLOCK) { | ||
699 | if (--retries > 0) { | 691 | if (--retries > 0) { |
700 | udelay(100); | 692 | udelay(100); |
701 | goto retry; | 693 | goto retry; |
@@ -709,20 +701,14 @@ retry: | |||
709 | 701 | ||
710 | static int hypervisor_set_time(u32 secs) | 702 | static int hypervisor_set_time(u32 secs) |
711 | { | 703 | { |
712 | register unsigned long func asm("%o5"); | 704 | unsigned long ret; |
713 | register unsigned long arg0 asm("%o0"); | ||
714 | int retries = 10000; | 705 | int retries = 10000; |
715 | 706 | ||
716 | retry: | 707 | retry: |
717 | func = HV_FAST_TOD_SET; | 708 | ret = sun4v_tod_set(secs); |
718 | arg0 = secs; | 709 | if (ret == HV_EOK) |
719 | __asm__ __volatile__("ta %4" | ||
720 | : "=&r" (func), "=&r" (arg0) | ||
721 | : "0" (func), "1" (arg0), | ||
722 | "i" (HV_FAST_TRAP)); | ||
723 | if (arg0 == HV_EOK) | ||
724 | return 0; | 710 | return 0; |
725 | if (arg0 == HV_EWOULDBLOCK) { | 711 | if (ret == HV_EWOULDBLOCK) { |
726 | if (--retries > 0) { | 712 | if (--retries > 0) { |
727 | udelay(100); | 713 | udelay(100); |
728 | goto retry; | 714 | goto retry; |
@@ -862,7 +848,6 @@ fs_initcall(clock_init); | |||
862 | static unsigned long sparc64_init_timers(void) | 848 | static unsigned long sparc64_init_timers(void) |
863 | { | 849 | { |
864 | struct device_node *dp; | 850 | struct device_node *dp; |
865 | struct property *prop; | ||
866 | unsigned long clock; | 851 | unsigned long clock; |
867 | #ifdef CONFIG_SMP | 852 | #ifdef CONFIG_SMP |
868 | extern void smp_tick_init(void); | 853 | extern void smp_tick_init(void); |
@@ -879,17 +864,15 @@ static unsigned long sparc64_init_timers(void) | |||
879 | if (manuf == 0x17 && impl == 0x13) { | 864 | if (manuf == 0x17 && impl == 0x13) { |
880 | /* Hummingbird, aka Ultra-IIe */ | 865 | /* Hummingbird, aka Ultra-IIe */ |
881 | tick_ops = &hbtick_operations; | 866 | tick_ops = &hbtick_operations; |
882 | prop = of_find_property(dp, "stick-frequency", NULL); | 867 | clock = of_getintprop_default(dp, "stick-frequency", 0); |
883 | } else { | 868 | } else { |
884 | tick_ops = &tick_operations; | 869 | tick_ops = &tick_operations; |
885 | cpu_find_by_instance(0, &dp, NULL); | 870 | clock = local_cpu_data().clock_tick; |
886 | prop = of_find_property(dp, "clock-frequency", NULL); | ||
887 | } | 871 | } |
888 | } else { | 872 | } else { |
889 | tick_ops = &stick_operations; | 873 | tick_ops = &stick_operations; |
890 | prop = of_find_property(dp, "stick-frequency", NULL); | 874 | clock = of_getintprop_default(dp, "stick-frequency", 0); |
891 | } | 875 | } |
892 | clock = *(unsigned int *) prop->value; | ||
893 | 876 | ||
894 | #ifdef CONFIG_SMP | 877 | #ifdef CONFIG_SMP |
895 | smp_tick_init(); | 878 | smp_tick_init(); |
@@ -1365,6 +1348,7 @@ static int hypervisor_set_rtc_time(struct rtc_time *time) | |||
1365 | return hypervisor_set_time(seconds); | 1348 | return hypervisor_set_time(seconds); |
1366 | } | 1349 | } |
1367 | 1350 | ||
1351 | #ifdef CONFIG_PCI | ||
1368 | static void bq4802_get_rtc_time(struct rtc_time *time) | 1352 | static void bq4802_get_rtc_time(struct rtc_time *time) |
1369 | { | 1353 | { |
1370 | unsigned char val = readb(bq4802_regs + 0x0e); | 1354 | unsigned char val = readb(bq4802_regs + 0x0e); |
@@ -1436,6 +1420,7 @@ static int bq4802_set_rtc_time(struct rtc_time *time) | |||
1436 | 1420 | ||
1437 | return 0; | 1421 | return 0; |
1438 | } | 1422 | } |
1423 | #endif /* CONFIG_PCI */ | ||
1439 | 1424 | ||
1440 | struct mini_rtc_ops { | 1425 | struct mini_rtc_ops { |
1441 | void (*get_rtc_time)(struct rtc_time *); | 1426 | void (*get_rtc_time)(struct rtc_time *); |
@@ -1452,10 +1437,12 @@ static struct mini_rtc_ops hypervisor_rtc_ops = { | |||
1452 | .set_rtc_time = hypervisor_set_rtc_time, | 1437 | .set_rtc_time = hypervisor_set_rtc_time, |
1453 | }; | 1438 | }; |
1454 | 1439 | ||
1440 | #ifdef CONFIG_PCI | ||
1455 | static struct mini_rtc_ops bq4802_rtc_ops = { | 1441 | static struct mini_rtc_ops bq4802_rtc_ops = { |
1456 | .get_rtc_time = bq4802_get_rtc_time, | 1442 | .get_rtc_time = bq4802_get_rtc_time, |
1457 | .set_rtc_time = bq4802_set_rtc_time, | 1443 | .set_rtc_time = bq4802_set_rtc_time, |
1458 | }; | 1444 | }; |
1445 | #endif /* CONFIG_PCI */ | ||
1459 | 1446 | ||
1460 | static struct mini_rtc_ops *mini_rtc_ops; | 1447 | static struct mini_rtc_ops *mini_rtc_ops; |
1461 | 1448 | ||
@@ -1579,8 +1566,10 @@ static int __init rtc_mini_init(void) | |||
1579 | mini_rtc_ops = &hypervisor_rtc_ops; | 1566 | mini_rtc_ops = &hypervisor_rtc_ops; |
1580 | else if (this_is_starfire) | 1567 | else if (this_is_starfire) |
1581 | mini_rtc_ops = &starfire_rtc_ops; | 1568 | mini_rtc_ops = &starfire_rtc_ops; |
1569 | #ifdef CONFIG_PCI | ||
1582 | else if (bq4802_regs) | 1570 | else if (bq4802_regs) |
1583 | mini_rtc_ops = &bq4802_rtc_ops; | 1571 | mini_rtc_ops = &bq4802_rtc_ops; |
1572 | #endif /* CONFIG_PCI */ | ||
1584 | else | 1573 | else |
1585 | return -ENODEV; | 1574 | return -ENODEV; |
1586 | 1575 | ||
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index d0fde36395b4..00a9e3286c83 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c | |||
@@ -795,8 +795,7 @@ extern unsigned int cheetah_deferred_trap_vector[], cheetah_deferred_trap_vector | |||
795 | void __init cheetah_ecache_flush_init(void) | 795 | void __init cheetah_ecache_flush_init(void) |
796 | { | 796 | { |
797 | unsigned long largest_size, smallest_linesize, order, ver; | 797 | unsigned long largest_size, smallest_linesize, order, ver; |
798 | struct device_node *dp; | 798 | int i, sz; |
799 | int i, instance, sz; | ||
800 | 799 | ||
801 | /* Scan all cpu device tree nodes, note two values: | 800 | /* Scan all cpu device tree nodes, note two values: |
802 | * 1) largest E-cache size | 801 | * 1) largest E-cache size |
@@ -805,18 +804,20 @@ void __init cheetah_ecache_flush_init(void) | |||
805 | largest_size = 0UL; | 804 | largest_size = 0UL; |
806 | smallest_linesize = ~0UL; | 805 | smallest_linesize = ~0UL; |
807 | 806 | ||
808 | instance = 0; | 807 | for (i = 0; i < NR_CPUS; i++) { |
809 | while (!cpu_find_by_instance(instance, &dp, NULL)) { | ||
810 | unsigned long val; | 808 | unsigned long val; |
811 | 809 | ||
812 | val = of_getintprop_default(dp, "ecache-size", | 810 | val = cpu_data(i).ecache_size; |
813 | (2 * 1024 * 1024)); | 811 | if (!val) |
812 | continue; | ||
813 | |||
814 | if (val > largest_size) | 814 | if (val > largest_size) |
815 | largest_size = val; | 815 | largest_size = val; |
816 | val = of_getintprop_default(dp, "ecache-line-size", 64); | 816 | |
817 | val = cpu_data(i).ecache_line_size; | ||
817 | if (val < smallest_linesize) | 818 | if (val < smallest_linesize) |
818 | smallest_linesize = val; | 819 | smallest_linesize = val; |
819 | instance++; | 820 | |
820 | } | 821 | } |
821 | 822 | ||
822 | if (largest_size == 0UL || smallest_linesize == ~0UL) { | 823 | if (largest_size == 0UL || smallest_linesize == ~0UL) { |
@@ -2564,7 +2565,15 @@ void __init trap_init(void) | |||
2564 | (TRAP_PER_CPU_TSB_HUGE_TEMP != | 2565 | (TRAP_PER_CPU_TSB_HUGE_TEMP != |
2565 | offsetof(struct trap_per_cpu, tsb_huge_temp)) || | 2566 | offsetof(struct trap_per_cpu, tsb_huge_temp)) || |
2566 | (TRAP_PER_CPU_IRQ_WORKLIST != | 2567 | (TRAP_PER_CPU_IRQ_WORKLIST != |
2567 | offsetof(struct trap_per_cpu, irq_worklist))) | 2568 | offsetof(struct trap_per_cpu, irq_worklist)) || |
2569 | (TRAP_PER_CPU_CPU_MONDO_QMASK != | ||
2570 | offsetof(struct trap_per_cpu, cpu_mondo_qmask)) || | ||
2571 | (TRAP_PER_CPU_DEV_MONDO_QMASK != | ||
2572 | offsetof(struct trap_per_cpu, dev_mondo_qmask)) || | ||
2573 | (TRAP_PER_CPU_RESUM_QMASK != | ||
2574 | offsetof(struct trap_per_cpu, resum_qmask)) || | ||
2575 | (TRAP_PER_CPU_NONRESUM_QMASK != | ||
2576 | offsetof(struct trap_per_cpu, nonresum_qmask))) | ||
2568 | trap_per_cpu_offsets_are_bolixed_dave(); | 2577 | trap_per_cpu_offsets_are_bolixed_dave(); |
2569 | 2578 | ||
2570 | if ((TSB_CONFIG_TSB != | 2579 | if ((TSB_CONFIG_TSB != |
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 6e5b01d779d2..3010227fe243 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/kprobes.h> | 23 | #include <linux/kprobes.h> |
24 | #include <linux/cache.h> | 24 | #include <linux/cache.h> |
25 | #include <linux/sort.h> | 25 | #include <linux/sort.h> |
26 | #include <linux/percpu.h> | ||
26 | 27 | ||
27 | #include <asm/head.h> | 28 | #include <asm/head.h> |
28 | #include <asm/system.h> | 29 | #include <asm/system.h> |
@@ -43,8 +44,8 @@ | |||
43 | #include <asm/tsb.h> | 44 | #include <asm/tsb.h> |
44 | #include <asm/hypervisor.h> | 45 | #include <asm/hypervisor.h> |
45 | #include <asm/prom.h> | 46 | #include <asm/prom.h> |
46 | 47 | #include <asm/sstate.h> | |
47 | extern void device_scan(void); | 48 | #include <asm/mdesc.h> |
48 | 49 | ||
49 | #define MAX_PHYS_ADDRESS (1UL << 42UL) | 50 | #define MAX_PHYS_ADDRESS (1UL << 42UL) |
50 | #define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL) | 51 | #define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL) |
@@ -60,8 +61,11 @@ unsigned long kern_linear_pte_xor[2] __read_mostly; | |||
60 | unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)]; | 61 | unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)]; |
61 | 62 | ||
62 | #ifndef CONFIG_DEBUG_PAGEALLOC | 63 | #ifndef CONFIG_DEBUG_PAGEALLOC |
63 | /* A special kernel TSB for 4MB and 256MB linear mappings. */ | 64 | /* A special kernel TSB for 4MB and 256MB linear mappings. |
64 | struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES]; | 65 | * Space is allocated for this right after the trap table |
66 | * in arch/sparc64/kernel/head.S | ||
67 | */ | ||
68 | extern struct tsb swapper_4m_tsb[KERNEL_TSB4M_NENTRIES]; | ||
65 | #endif | 69 | #endif |
66 | 70 | ||
67 | #define MAX_BANKS 32 | 71 | #define MAX_BANKS 32 |
@@ -190,12 +194,9 @@ inline void flush_dcache_page_impl(struct page *page) | |||
190 | } | 194 | } |
191 | 195 | ||
192 | #define PG_dcache_dirty PG_arch_1 | 196 | #define PG_dcache_dirty PG_arch_1 |
193 | #define PG_dcache_cpu_shift 24UL | 197 | #define PG_dcache_cpu_shift 32UL |
194 | #define PG_dcache_cpu_mask (256UL - 1UL) | 198 | #define PG_dcache_cpu_mask \ |
195 | 199 | ((1UL<<ilog2(roundup_pow_of_two(NR_CPUS)))-1UL) | |
196 | #if NR_CPUS > 256 | ||
197 | #error D-cache dirty tracking and thread_info->cpu need fixing for > 256 cpus | ||
198 | #endif | ||
199 | 200 | ||
200 | #define dcache_dirty_cpu(page) \ | 201 | #define dcache_dirty_cpu(page) \ |
201 | (((page)->flags >> PG_dcache_cpu_shift) & PG_dcache_cpu_mask) | 202 | (((page)->flags >> PG_dcache_cpu_shift) & PG_dcache_cpu_mask) |
@@ -557,26 +558,11 @@ static void __init hypervisor_tlb_lock(unsigned long vaddr, | |||
557 | unsigned long pte, | 558 | unsigned long pte, |
558 | unsigned long mmu) | 559 | unsigned long mmu) |
559 | { | 560 | { |
560 | register unsigned long func asm("%o5"); | 561 | unsigned long ret = sun4v_mmu_map_perm_addr(vaddr, 0, pte, mmu); |
561 | register unsigned long arg0 asm("%o0"); | 562 | |
562 | register unsigned long arg1 asm("%o1"); | 563 | if (ret != 0) { |
563 | register unsigned long arg2 asm("%o2"); | ||
564 | register unsigned long arg3 asm("%o3"); | ||
565 | |||
566 | func = HV_FAST_MMU_MAP_PERM_ADDR; | ||
567 | arg0 = vaddr; | ||
568 | arg1 = 0; | ||
569 | arg2 = pte; | ||
570 | arg3 = mmu; | ||
571 | __asm__ __volatile__("ta 0x80" | ||
572 | : "=&r" (func), "=&r" (arg0), | ||
573 | "=&r" (arg1), "=&r" (arg2), | ||
574 | "=&r" (arg3) | ||
575 | : "0" (func), "1" (arg0), "2" (arg1), | ||
576 | "3" (arg2), "4" (arg3)); | ||
577 | if (arg0 != 0) { | ||
578 | prom_printf("hypervisor_tlb_lock[%lx:%lx:%lx:%lx]: " | 564 | prom_printf("hypervisor_tlb_lock[%lx:%lx:%lx:%lx]: " |
579 | "errors with %lx\n", vaddr, 0, pte, mmu, arg0); | 565 | "errors with %lx\n", vaddr, 0, pte, mmu, ret); |
580 | prom_halt(); | 566 | prom_halt(); |
581 | } | 567 | } |
582 | } | 568 | } |
@@ -1313,20 +1299,16 @@ static void __init sun4v_ktsb_init(void) | |||
1313 | 1299 | ||
1314 | void __cpuinit sun4v_ktsb_register(void) | 1300 | void __cpuinit sun4v_ktsb_register(void) |
1315 | { | 1301 | { |
1316 | register unsigned long func asm("%o5"); | 1302 | unsigned long pa, ret; |
1317 | register unsigned long arg0 asm("%o0"); | ||
1318 | register unsigned long arg1 asm("%o1"); | ||
1319 | unsigned long pa; | ||
1320 | 1303 | ||
1321 | pa = kern_base + ((unsigned long)&ktsb_descr[0] - KERNBASE); | 1304 | pa = kern_base + ((unsigned long)&ktsb_descr[0] - KERNBASE); |
1322 | 1305 | ||
1323 | func = HV_FAST_MMU_TSB_CTX0; | 1306 | ret = sun4v_mmu_tsb_ctx0(NUM_KTSB_DESCR, pa); |
1324 | arg0 = NUM_KTSB_DESCR; | 1307 | if (ret != 0) { |
1325 | arg1 = pa; | 1308 | prom_printf("hypervisor_mmu_tsb_ctx0[%lx]: " |
1326 | __asm__ __volatile__("ta %6" | 1309 | "errors with %lx\n", pa, ret); |
1327 | : "=&r" (func), "=&r" (arg0), "=&r" (arg1) | 1310 | prom_halt(); |
1328 | : "0" (func), "1" (arg0), "2" (arg1), | 1311 | } |
1329 | "i" (HV_FAST_TRAP)); | ||
1330 | } | 1312 | } |
1331 | 1313 | ||
1332 | /* paging_init() sets up the page tables */ | 1314 | /* paging_init() sets up the page tables */ |
@@ -1334,6 +1316,9 @@ void __cpuinit sun4v_ktsb_register(void) | |||
1334 | extern void cheetah_ecache_flush_init(void); | 1316 | extern void cheetah_ecache_flush_init(void); |
1335 | extern void sun4v_patch_tlb_handlers(void); | 1317 | extern void sun4v_patch_tlb_handlers(void); |
1336 | 1318 | ||
1319 | extern void cpu_probe(void); | ||
1320 | extern void central_probe(void); | ||
1321 | |||
1337 | static unsigned long last_valid_pfn; | 1322 | static unsigned long last_valid_pfn; |
1338 | pgd_t swapper_pg_dir[2048]; | 1323 | pgd_t swapper_pg_dir[2048]; |
1339 | 1324 | ||
@@ -1345,9 +1330,24 @@ void __init paging_init(void) | |||
1345 | unsigned long end_pfn, pages_avail, shift, phys_base; | 1330 | unsigned long end_pfn, pages_avail, shift, phys_base; |
1346 | unsigned long real_end, i; | 1331 | unsigned long real_end, i; |
1347 | 1332 | ||
1333 | /* These build time checkes make sure that the dcache_dirty_cpu() | ||
1334 | * page->flags usage will work. | ||
1335 | * | ||
1336 | * When a page gets marked as dcache-dirty, we store the | ||
1337 | * cpu number starting at bit 32 in the page->flags. Also, | ||
1338 | * functions like clear_dcache_dirty_cpu use the cpu mask | ||
1339 | * in 13-bit signed-immediate instruction fields. | ||
1340 | */ | ||
1341 | BUILD_BUG_ON(FLAGS_RESERVED != 32); | ||
1342 | BUILD_BUG_ON(SECTIONS_WIDTH + NODES_WIDTH + ZONES_WIDTH + | ||
1343 | ilog2(roundup_pow_of_two(NR_CPUS)) > FLAGS_RESERVED); | ||
1344 | BUILD_BUG_ON(NR_CPUS > 4096); | ||
1345 | |||
1348 | kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL; | 1346 | kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL; |
1349 | kern_size = (unsigned long)&_end - (unsigned long)KERNBASE; | 1347 | kern_size = (unsigned long)&_end - (unsigned long)KERNBASE; |
1350 | 1348 | ||
1349 | sstate_booting(); | ||
1350 | |||
1351 | /* Invalidate both kernel TSBs. */ | 1351 | /* Invalidate both kernel TSBs. */ |
1352 | memset(swapper_tsb, 0x40, sizeof(swapper_tsb)); | 1352 | memset(swapper_tsb, 0x40, sizeof(swapper_tsb)); |
1353 | #ifndef CONFIG_DEBUG_PAGEALLOC | 1353 | #ifndef CONFIG_DEBUG_PAGEALLOC |
@@ -1416,8 +1416,13 @@ void __init paging_init(void) | |||
1416 | 1416 | ||
1417 | kernel_physical_mapping_init(); | 1417 | kernel_physical_mapping_init(); |
1418 | 1418 | ||
1419 | real_setup_per_cpu_areas(); | ||
1420 | |||
1419 | prom_build_devicetree(); | 1421 | prom_build_devicetree(); |
1420 | 1422 | ||
1423 | if (tlb_type == hypervisor) | ||
1424 | sun4v_mdesc_init(); | ||
1425 | |||
1421 | { | 1426 | { |
1422 | unsigned long zones_size[MAX_NR_ZONES]; | 1427 | unsigned long zones_size[MAX_NR_ZONES]; |
1423 | unsigned long zholes_size[MAX_NR_ZONES]; | 1428 | unsigned long zholes_size[MAX_NR_ZONES]; |
@@ -1434,7 +1439,10 @@ void __init paging_init(void) | |||
1434 | zholes_size); | 1439 | zholes_size); |
1435 | } | 1440 | } |
1436 | 1441 | ||
1437 | device_scan(); | 1442 | prom_printf("Booting Linux...\n"); |
1443 | |||
1444 | central_probe(); | ||
1445 | cpu_probe(); | ||
1438 | } | 1446 | } |
1439 | 1447 | ||
1440 | static void __init taint_real_pages(void) | 1448 | static void __init taint_real_pages(void) |
diff --git a/arch/sparc64/prom/misc.c b/arch/sparc64/prom/misc.c index 0b4213720d43..f3e0c14e9eef 100644 --- a/arch/sparc64/prom/misc.c +++ b/arch/sparc64/prom/misc.c | |||
@@ -15,6 +15,25 @@ | |||
15 | #include <asm/oplib.h> | 15 | #include <asm/oplib.h> |
16 | #include <asm/system.h> | 16 | #include <asm/system.h> |
17 | 17 | ||
18 | int prom_service_exists(const char *service_name) | ||
19 | { | ||
20 | int err = p1275_cmd("test", P1275_ARG(0, P1275_ARG_IN_STRING) | | ||
21 | P1275_INOUT(1, 1), service_name); | ||
22 | |||
23 | if (err) | ||
24 | return 0; | ||
25 | return 1; | ||
26 | } | ||
27 | |||
28 | void prom_sun4v_guest_soft_state(void) | ||
29 | { | ||
30 | const char *svc = "SUNW,soft-state-supported"; | ||
31 | |||
32 | if (!prom_service_exists(svc)) | ||
33 | return; | ||
34 | p1275_cmd(svc, P1275_INOUT(0, 0)); | ||
35 | } | ||
36 | |||
18 | /* Reset and reboot the machine with the command 'bcommand'. */ | 37 | /* Reset and reboot the machine with the command 'bcommand'. */ |
19 | void prom_reboot(const char *bcommand) | 38 | void prom_reboot(const char *bcommand) |
20 | { | 39 | { |
diff --git a/crypto/cryptd.c b/crypto/cryptd.c index 3ff4e1f0f032..ac6dce2e7596 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c | |||
@@ -298,7 +298,7 @@ static inline int cryptd_create_thread(struct cryptd_state *state, | |||
298 | mutex_init(&state->mutex); | 298 | mutex_init(&state->mutex); |
299 | crypto_init_queue(&state->queue, CRYPTD_MAX_QLEN); | 299 | crypto_init_queue(&state->queue, CRYPTD_MAX_QLEN); |
300 | 300 | ||
301 | state->task = kthread_create(fn, state, name); | 301 | state->task = kthread_run(fn, state, name); |
302 | if (IS_ERR(state->task)) | 302 | if (IS_ERR(state->task)) |
303 | return PTR_ERR(state->task); | 303 | return PTR_ERR(state->task); |
304 | 304 | ||
@@ -316,6 +316,8 @@ static int cryptd_thread(void *data) | |||
316 | struct cryptd_state *state = data; | 316 | struct cryptd_state *state = data; |
317 | int stop; | 317 | int stop; |
318 | 318 | ||
319 | current->flags |= PF_NOFREEZE; | ||
320 | |||
319 | do { | 321 | do { |
320 | struct crypto_async_request *req, *backlog; | 322 | struct crypto_async_request *req, *backlog; |
321 | 323 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 3ca9c610c110..af625147df62 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3783,6 +3783,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3783 | { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, | 3783 | { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, |
3784 | /* NCQ is broken */ | 3784 | /* NCQ is broken */ |
3785 | { "Maxtor 6L250S0", "BANC1G10", ATA_HORKAGE_NONCQ }, | 3785 | { "Maxtor 6L250S0", "BANC1G10", ATA_HORKAGE_NONCQ }, |
3786 | { "Maxtor 6B200M0", "BANC1B10", ATA_HORKAGE_NONCQ }, | ||
3786 | /* NCQ hard hangs device under heavier load, needs hard power cycle */ | 3787 | /* NCQ hard hangs device under heavier load, needs hard power cycle */ |
3787 | { "Maxtor 6B250S0", "BANC1B70", ATA_HORKAGE_NONCQ }, | 3788 | { "Maxtor 6B250S0", "BANC1B70", ATA_HORKAGE_NONCQ }, |
3788 | /* Blacklist entries taken from Silicon Image 3124/3132 | 3789 | /* Blacklist entries taken from Silicon Image 3124/3132 |
diff --git a/drivers/char/drm/Kconfig b/drivers/char/drm/Kconfig index ef833a1c27eb..0b7ffa5191c6 100644 --- a/drivers/char/drm/Kconfig +++ b/drivers/char/drm/Kconfig | |||
@@ -6,7 +6,7 @@ | |||
6 | # | 6 | # |
7 | config DRM | 7 | config DRM |
8 | tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" | 8 | tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" |
9 | depends on (AGP || AGP=n) && PCI | 9 | depends on (AGP || AGP=n) && PCI && !EMULATED_CMPXCHG |
10 | help | 10 | help |
11 | Kernel-level support for the Direct Rendering Infrastructure (DRI) | 11 | Kernel-level support for the Direct Rendering Infrastructure (DRI) |
12 | introduced in XFree86 4.0. If you say Y here, you need to select | 12 | introduced in XFree86 4.0. If you say Y here, you need to select |
diff --git a/drivers/char/drm/drm_drawable.c b/drivers/char/drm/drm_drawable.c index de37d5f74563..b33313be2547 100644 --- a/drivers/char/drm/drm_drawable.c +++ b/drivers/char/drm/drm_drawable.c | |||
@@ -172,38 +172,49 @@ int drm_rmdraw(DRM_IOCTL_ARGS) | |||
172 | 172 | ||
173 | bitfield_length = idx + 1; | 173 | bitfield_length = idx + 1; |
174 | 174 | ||
175 | if (idx != id / (8 * sizeof(*bitfield))) | 175 | bitfield = NULL; |
176 | bitfield = drm_alloc(bitfield_length * | ||
177 | sizeof(*bitfield), DRM_MEM_BUFS); | ||
178 | 176 | ||
179 | if (!bitfield && bitfield_length) { | 177 | if (bitfield_length) { |
180 | bitfield = dev->drw_bitfield; | 178 | if (bitfield_length != dev->drw_bitfield_length) |
181 | bitfield_length = dev->drw_bitfield_length; | 179 | bitfield = drm_alloc(bitfield_length * |
180 | sizeof(*bitfield), | ||
181 | DRM_MEM_BUFS); | ||
182 | |||
183 | if (!bitfield) { | ||
184 | bitfield = dev->drw_bitfield; | ||
185 | bitfield_length = dev->drw_bitfield_length; | ||
186 | } | ||
182 | } | 187 | } |
183 | } | 188 | } |
184 | 189 | ||
185 | if (bitfield != dev->drw_bitfield) { | 190 | if (bitfield != dev->drw_bitfield) { |
186 | info_length = 8 * sizeof(*bitfield) * bitfield_length; | 191 | info_length = 8 * sizeof(*bitfield) * bitfield_length; |
187 | 192 | ||
188 | info = drm_alloc(info_length * sizeof(*info), DRM_MEM_BUFS); | 193 | if (info_length) { |
194 | info = drm_alloc(info_length * sizeof(*info), | ||
195 | DRM_MEM_BUFS); | ||
189 | 196 | ||
190 | if (!info && info_length) { | 197 | if (!info) { |
191 | info = dev->drw_info; | 198 | info = dev->drw_info; |
192 | info_length = dev->drw_info_length; | 199 | info_length = dev->drw_info_length; |
193 | } | 200 | } |
201 | } else | ||
202 | info = NULL; | ||
194 | 203 | ||
195 | spin_lock_irqsave(&dev->drw_lock, irqflags); | 204 | spin_lock_irqsave(&dev->drw_lock, irqflags); |
196 | 205 | ||
197 | memcpy(bitfield, dev->drw_bitfield, bitfield_length * | 206 | if (bitfield) |
198 | sizeof(*bitfield)); | 207 | memcpy(bitfield, dev->drw_bitfield, bitfield_length * |
208 | sizeof(*bitfield)); | ||
199 | drm_free(dev->drw_bitfield, sizeof(*bitfield) * | 209 | drm_free(dev->drw_bitfield, sizeof(*bitfield) * |
200 | dev->drw_bitfield_length, DRM_MEM_BUFS); | 210 | dev->drw_bitfield_length, DRM_MEM_BUFS); |
201 | dev->drw_bitfield = bitfield; | 211 | dev->drw_bitfield = bitfield; |
202 | dev->drw_bitfield_length = bitfield_length; | 212 | dev->drw_bitfield_length = bitfield_length; |
203 | 213 | ||
204 | if (info != dev->drw_info) { | 214 | if (info != dev->drw_info) { |
205 | memcpy(info, dev->drw_info, info_length * | 215 | if (info) |
206 | sizeof(*info)); | 216 | memcpy(info, dev->drw_info, info_length * |
217 | sizeof(*info)); | ||
207 | drm_free(dev->drw_info, sizeof(*info) * | 218 | drm_free(dev->drw_info, sizeof(*info) * |
208 | dev->drw_info_length, DRM_MEM_BUFS); | 219 | dev->drw_info_length, DRM_MEM_BUFS); |
209 | dev->drw_info = info; | 220 | dev->drw_info = info; |
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h index 31cdde83713b..177ccc07f968 100644 --- a/drivers/char/drm/drm_pciids.h +++ b/drivers/char/drm/drm_pciids.h | |||
@@ -102,13 +102,20 @@ | |||
102 | {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 102 | {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
103 | {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \ | 103 | {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \ |
104 | {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ | 104 | {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ |
105 | {0x1002, 0x5954, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | ||
105 | {0x1002, 0x5955, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | 106 | {0x1002, 0x5955, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ |
107 | {0x1002, 0x5974, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | ||
108 | {0x1002, 0x5975, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | ||
106 | {0x1002, 0x5960, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 109 | {0x1002, 0x5960, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
107 | {0x1002, 0x5961, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 110 | {0x1002, 0x5961, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
108 | {0x1002, 0x5962, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 111 | {0x1002, 0x5962, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
109 | {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 112 | {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
110 | {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 113 | {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
111 | {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ | 114 | {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ |
115 | {0x1002, 0x5a41, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | ||
116 | {0x1002, 0x5a42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | ||
117 | {0x1002, 0x5a61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | ||
118 | {0x1002, 0x5a62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | ||
112 | {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ | 119 | {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ |
113 | {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ | 120 | {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ |
114 | {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ | 121 | {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ |
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c index 78c1ae28f17c..b92062a239f1 100644 --- a/drivers/char/drm/i915_irq.c +++ b/drivers/char/drm/i915_irq.c | |||
@@ -582,7 +582,7 @@ void i915_driver_irq_postinstall(drm_device_t * dev) | |||
582 | { | 582 | { |
583 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 583 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
584 | 584 | ||
585 | dev_priv->swaps_lock = SPIN_LOCK_UNLOCKED; | 585 | spin_lock_init(&dev_priv->swaps_lock); |
586 | INIT_LIST_HEAD(&dev_priv->vbl_swaps.head); | 586 | INIT_LIST_HEAD(&dev_priv->vbl_swaps.head); |
587 | dev_priv->swaps_pending = 0; | 587 | dev_priv->swaps_pending = 0; |
588 | 588 | ||
diff --git a/drivers/char/random.c b/drivers/char/random.c index 46c1b97748b6..0474cac4a84e 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -760,7 +760,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | |||
760 | 760 | ||
761 | static void extract_buf(struct entropy_store *r, __u8 *out) | 761 | static void extract_buf(struct entropy_store *r, __u8 *out) |
762 | { | 762 | { |
763 | int i, x; | 763 | int i; |
764 | __u32 data[16], buf[5 + SHA_WORKSPACE_WORDS]; | 764 | __u32 data[16], buf[5 + SHA_WORKSPACE_WORDS]; |
765 | 765 | ||
766 | sha_init(buf); | 766 | sha_init(buf); |
@@ -772,9 +772,11 @@ static void extract_buf(struct entropy_store *r, __u8 *out) | |||
772 | * attempts to find previous ouputs), unless the hash | 772 | * attempts to find previous ouputs), unless the hash |
773 | * function can be inverted. | 773 | * function can be inverted. |
774 | */ | 774 | */ |
775 | for (i = 0, x = 0; i < r->poolinfo->poolwords; i += 16, x+=2) { | 775 | for (i = 0; i < r->poolinfo->poolwords; i += 16) { |
776 | sha_transform(buf, (__u8 *)r->pool+i, buf + 5); | 776 | /* hash blocks of 16 words = 512 bits */ |
777 | add_entropy_words(r, &buf[x % 5], 1); | 777 | sha_transform(buf, (__u8 *)(r->pool + i), buf + 5); |
778 | /* feed back portion of the resulting hash */ | ||
779 | add_entropy_words(r, &buf[i % 5], 1); | ||
778 | } | 780 | } |
779 | 781 | ||
780 | /* | 782 | /* |
@@ -782,7 +784,7 @@ static void extract_buf(struct entropy_store *r, __u8 *out) | |||
782 | * portion of the pool while mixing, and hash one | 784 | * portion of the pool while mixing, and hash one |
783 | * final time. | 785 | * final time. |
784 | */ | 786 | */ |
785 | __add_entropy_words(r, &buf[x % 5], 1, data); | 787 | __add_entropy_words(r, &buf[i % 5], 1, data); |
786 | sha_transform(buf, (__u8 *)data, buf + 5); | 788 | sha_transform(buf, (__u8 *)data, buf + 5); |
787 | 789 | ||
788 | /* | 790 | /* |
@@ -1018,37 +1020,44 @@ random_poll(struct file *file, poll_table * wait) | |||
1018 | return mask; | 1020 | return mask; |
1019 | } | 1021 | } |
1020 | 1022 | ||
1021 | static ssize_t | 1023 | static int |
1022 | random_write(struct file * file, const char __user * buffer, | 1024 | write_pool(struct entropy_store *r, const char __user *buffer, size_t count) |
1023 | size_t count, loff_t *ppos) | ||
1024 | { | 1025 | { |
1025 | int ret = 0; | ||
1026 | size_t bytes; | 1026 | size_t bytes; |
1027 | __u32 buf[16]; | 1027 | __u32 buf[16]; |
1028 | const char __user *p = buffer; | 1028 | const char __user *p = buffer; |
1029 | size_t c = count; | ||
1030 | 1029 | ||
1031 | while (c > 0) { | 1030 | while (count > 0) { |
1032 | bytes = min(c, sizeof(buf)); | 1031 | bytes = min(count, sizeof(buf)); |
1032 | if (copy_from_user(&buf, p, bytes)) | ||
1033 | return -EFAULT; | ||
1033 | 1034 | ||
1034 | bytes -= copy_from_user(&buf, p, bytes); | 1035 | count -= bytes; |
1035 | if (!bytes) { | ||
1036 | ret = -EFAULT; | ||
1037 | break; | ||
1038 | } | ||
1039 | c -= bytes; | ||
1040 | p += bytes; | 1036 | p += bytes; |
1041 | 1037 | ||
1042 | add_entropy_words(&input_pool, buf, (bytes + 3) / 4); | 1038 | add_entropy_words(r, buf, (bytes + 3) / 4); |
1043 | } | ||
1044 | if (p == buffer) { | ||
1045 | return (ssize_t)ret; | ||
1046 | } else { | ||
1047 | struct inode *inode = file->f_path.dentry->d_inode; | ||
1048 | inode->i_mtime = current_fs_time(inode->i_sb); | ||
1049 | mark_inode_dirty(inode); | ||
1050 | return (ssize_t)(p - buffer); | ||
1051 | } | 1039 | } |
1040 | |||
1041 | return 0; | ||
1042 | } | ||
1043 | |||
1044 | static ssize_t | ||
1045 | random_write(struct file * file, const char __user * buffer, | ||
1046 | size_t count, loff_t *ppos) | ||
1047 | { | ||
1048 | size_t ret; | ||
1049 | struct inode *inode = file->f_path.dentry->d_inode; | ||
1050 | |||
1051 | ret = write_pool(&blocking_pool, buffer, count); | ||
1052 | if (ret) | ||
1053 | return ret; | ||
1054 | ret = write_pool(&nonblocking_pool, buffer, count); | ||
1055 | if (ret) | ||
1056 | return ret; | ||
1057 | |||
1058 | inode->i_mtime = current_fs_time(inode->i_sb); | ||
1059 | mark_inode_dirty(inode); | ||
1060 | return (ssize_t)count; | ||
1052 | } | 1061 | } |
1053 | 1062 | ||
1054 | static int | 1063 | static int |
@@ -1087,8 +1096,8 @@ random_ioctl(struct inode * inode, struct file * file, | |||
1087 | return -EINVAL; | 1096 | return -EINVAL; |
1088 | if (get_user(size, p++)) | 1097 | if (get_user(size, p++)) |
1089 | return -EFAULT; | 1098 | return -EFAULT; |
1090 | retval = random_write(file, (const char __user *) p, | 1099 | retval = write_pool(&input_pool, (const char __user *)p, |
1091 | size, &file->f_pos); | 1100 | size); |
1092 | if (retval < 0) | 1101 | if (retval < 0) |
1093 | return retval; | 1102 | return retval; |
1094 | credit_entropy_store(&input_pool, ent_count); | 1103 | credit_entropy_store(&input_pool, ent_count); |
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig index 5932c72f9e42..396dade731f9 100644 --- a/drivers/firewire/Kconfig +++ b/drivers/firewire/Kconfig | |||
@@ -18,7 +18,7 @@ config FIREWIRE | |||
18 | your IEEE 1394 adapter. | 18 | your IEEE 1394 adapter. |
19 | 19 | ||
20 | To compile this driver as a module, say M here: the module will be | 20 | To compile this driver as a module, say M here: the module will be |
21 | called fw-core. | 21 | called firewire-core. |
22 | 22 | ||
23 | This is the "JUJU" FireWire stack, an alternative implementation | 23 | This is the "JUJU" FireWire stack, an alternative implementation |
24 | designed for robustness and simplicity. You can build either this | 24 | designed for robustness and simplicity. You can build either this |
@@ -34,11 +34,11 @@ config FIREWIRE_OHCI | |||
34 | is the only chipset in use, so say Y here. | 34 | is the only chipset in use, so say Y here. |
35 | 35 | ||
36 | To compile this driver as a module, say M here: The module will be | 36 | To compile this driver as a module, say M here: The module will be |
37 | called fw-ohci. | 37 | called firewire-ohci. |
38 | 38 | ||
39 | If you also build ohci1394 of the classic IEEE 1394 driver stack, | 39 | If you also build ohci1394 of the classic IEEE 1394 driver stack, |
40 | blacklist either ohci1394 or fw-ohci to let hotplug load the desired | 40 | blacklist either ohci1394 or firewire-ohci to let hotplug load the |
41 | driver. | 41 | desired driver. |
42 | 42 | ||
43 | config FIREWIRE_SBP2 | 43 | config FIREWIRE_SBP2 |
44 | tristate "Support for storage devices (SBP-2 protocol driver)" | 44 | tristate "Support for storage devices (SBP-2 protocol driver)" |
@@ -50,12 +50,12 @@ config FIREWIRE_SBP2 | |||
50 | like scanners. | 50 | like scanners. |
51 | 51 | ||
52 | To compile this driver as a module, say M here: The module will be | 52 | To compile this driver as a module, say M here: The module will be |
53 | called fw-sbp2. | 53 | called firewire-sbp2. |
54 | 54 | ||
55 | You should also enable support for disks, CD-ROMs, etc. in the SCSI | 55 | You should also enable support for disks, CD-ROMs, etc. in the SCSI |
56 | configuration section. | 56 | configuration section. |
57 | 57 | ||
58 | If you also build sbp2 of the classic IEEE 1394 driver stack, | 58 | If you also build sbp2 of the classic IEEE 1394 driver stack, |
59 | blacklist either sbp2 or fw-sbp2 to let hotplug load the desired | 59 | blacklist either sbp2 or firewire-sbp2 to let hotplug load the |
60 | driver. | 60 | desired driver. |
61 | 61 | ||
diff --git a/drivers/firewire/Makefile b/drivers/firewire/Makefile index fc7d59d4bce0..a7c31e9039c1 100644 --- a/drivers/firewire/Makefile +++ b/drivers/firewire/Makefile | |||
@@ -2,9 +2,11 @@ | |||
2 | # Makefile for the Linux IEEE 1394 implementation | 2 | # Makefile for the Linux IEEE 1394 implementation |
3 | # | 3 | # |
4 | 4 | ||
5 | fw-core-y += fw-card.o fw-topology.o fw-transaction.o fw-iso.o \ | 5 | firewire-core-y += fw-card.o fw-topology.o fw-transaction.o fw-iso.o \ |
6 | fw-device.o fw-cdev.o | 6 | fw-device.o fw-cdev.o |
7 | firewire-ohci-y += fw-ohci.o | ||
8 | firewire-sbp2-y += fw-sbp2.o | ||
7 | 9 | ||
8 | obj-$(CONFIG_FIREWIRE) += fw-core.o | 10 | obj-$(CONFIG_FIREWIRE) += firewire-core.o |
9 | obj-$(CONFIG_FIREWIRE_OHCI) += fw-ohci.o | 11 | obj-$(CONFIG_FIREWIRE_OHCI) += firewire-ohci.o |
10 | obj-$(CONFIG_FIREWIRE_SBP2) += fw-sbp2.o | 12 | obj-$(CONFIG_FIREWIRE_SBP2) += firewire-sbp2.o |
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c index 0fa5bd54c6a1..3ab3585d3601 100644 --- a/drivers/firewire/fw-cdev.c +++ b/drivers/firewire/fw-cdev.c | |||
@@ -365,7 +365,7 @@ complete_transaction(struct fw_card *card, int rcode, | |||
365 | response->response.data, response->response.length); | 365 | response->response.data, response->response.length); |
366 | } | 366 | } |
367 | 367 | ||
368 | static ssize_t ioctl_send_request(struct client *client, void *buffer) | 368 | static int ioctl_send_request(struct client *client, void *buffer) |
369 | { | 369 | { |
370 | struct fw_device *device = client->device; | 370 | struct fw_device *device = client->device; |
371 | struct fw_cdev_send_request *request = buffer; | 371 | struct fw_cdev_send_request *request = buffer; |
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index c17342d3e6fd..2e4cfa57126d 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c | |||
@@ -268,7 +268,7 @@ static int ar_context_add_page(struct ar_context *ctx) | |||
268 | 268 | ||
269 | dma_sync_single_for_device(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL); | 269 | dma_sync_single_for_device(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL); |
270 | 270 | ||
271 | ctx->last_buffer->descriptor.branch_address = ab_bus | 1; | 271 | ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1); |
272 | ctx->last_buffer->next = ab; | 272 | ctx->last_buffer->next = ab; |
273 | ctx->last_buffer = ab; | 273 | ctx->last_buffer = ab; |
274 | 274 | ||
@@ -417,7 +417,8 @@ ar_context_init(struct ar_context *ctx, struct fw_ohci *ohci, u32 regs) | |||
417 | ctx->current_buffer = ab.next; | 417 | ctx->current_buffer = ab.next; |
418 | ctx->pointer = ctx->current_buffer->data; | 418 | ctx->pointer = ctx->current_buffer->data; |
419 | 419 | ||
420 | reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), ab.descriptor.branch_address); | 420 | reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), |
421 | le32_to_cpu(ab.descriptor.branch_address)); | ||
421 | reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN); | 422 | reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN); |
422 | flush_writes(ctx->ohci); | 423 | flush_writes(ctx->ohci); |
423 | 424 | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 4d1cb5b855d1..13eea47dceb3 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -620,7 +620,7 @@ config SENSORS_HDAPS | |||
620 | 620 | ||
621 | config SENSORS_APPLESMC | 621 | config SENSORS_APPLESMC |
622 | tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" | 622 | tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" |
623 | depends on HWMON && INPUT && X86 | 623 | depends on INPUT && X86 |
624 | select NEW_LEDS | 624 | select NEW_LEDS |
625 | select LEDS_CLASS | 625 | select LEDS_CLASS |
626 | default n | 626 | default n |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 366f4a1a2cb8..fd1281f42209 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -1206,11 +1206,13 @@ static int __init applesmc_init(void) | |||
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr); | 1208 | ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr); |
1209 | if (ret) | ||
1210 | goto out_device; | ||
1209 | 1211 | ||
1210 | /* Create key enumeration sysfs files */ | 1212 | /* Create key enumeration sysfs files */ |
1211 | ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); | 1213 | ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); |
1212 | if (ret) | 1214 | if (ret) |
1213 | goto out_device; | 1215 | goto out_name; |
1214 | 1216 | ||
1215 | /* create fan files */ | 1217 | /* create fan files */ |
1216 | count = applesmc_get_fan_count(); | 1218 | count = applesmc_get_fan_count(); |
@@ -1310,6 +1312,8 @@ out_fan_1: | |||
1310 | sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); | 1312 | sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); |
1311 | out_key_enumeration: | 1313 | out_key_enumeration: |
1312 | sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); | 1314 | sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); |
1315 | out_name: | ||
1316 | sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); | ||
1313 | out_device: | 1317 | out_device: |
1314 | platform_device_unregister(pdev); | 1318 | platform_device_unregister(pdev); |
1315 | out_driver: | 1319 | out_driver: |
@@ -1335,6 +1339,7 @@ static void __exit applesmc_exit(void) | |||
1335 | sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); | 1339 | sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); |
1336 | sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); | 1340 | sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); |
1337 | sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); | 1341 | sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); |
1342 | sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); | ||
1338 | platform_device_unregister(pdev); | 1343 | platform_device_unregister(pdev); |
1339 | platform_driver_unregister(&applesmc_driver); | 1344 | platform_driver_unregister(&applesmc_driver); |
1340 | release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); | 1345 | release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS); |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 75e3911810a3..0328382df8fa 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -176,6 +176,22 @@ static int __devinit coretemp_probe(struct platform_device *pdev) | |||
176 | goto exit_free; | 176 | goto exit_free; |
177 | } | 177 | } |
178 | 178 | ||
179 | /* Check if we have problem with errata AE18 of Core processors: | ||
180 | Readings might stop update when processor visited too deep sleep, | ||
181 | fixed for stepping D0 (6EC). | ||
182 | */ | ||
183 | |||
184 | if ((c->x86_model == 0xe) && (c->x86_mask < 0xc)) { | ||
185 | /* check for microcode update */ | ||
186 | rdmsr_on_cpu(data->id, MSR_IA32_UCODE_REV, &eax, &edx); | ||
187 | if (edx < 0x39) { | ||
188 | dev_err(&pdev->dev, | ||
189 | "Errata AE18 not fixed, update BIOS or " | ||
190 | "microcode of the CPU!\n"); | ||
191 | goto exit_free; | ||
192 | } | ||
193 | } | ||
194 | |||
179 | /* Some processors have Tjmax 85 following magic should detect it | 195 | /* Some processors have Tjmax 85 following magic should detect it |
180 | Intel won't disclose the information without signed NDA, but | 196 | Intel won't disclose the information without signed NDA, but |
181 | individuals cannot sign it. Catch(ed) 22. | 197 | individuals cannot sign it. Catch(ed) 22. |
@@ -193,6 +209,19 @@ static int __devinit coretemp_probe(struct platform_device *pdev) | |||
193 | } | 209 | } |
194 | } | 210 | } |
195 | 211 | ||
212 | /* Intel says that above should not work for desktop Core2 processors, | ||
213 | but it seems to work. There is no other way how get the absolute | ||
214 | readings. Warn the user about this. First check if are desktop, | ||
215 | bit 50 of MSR_IA32_PLATFORM_ID should be 0. | ||
216 | */ | ||
217 | |||
218 | rdmsr_safe_on_cpu(data->id, MSR_IA32_PLATFORM_ID, &eax, &edx); | ||
219 | |||
220 | if ((c->x86_model == 0xf) && (!(edx & 0x00040000))) { | ||
221 | dev_warn(&pdev->dev, "Using undocumented features, absolute " | ||
222 | "temperature might be wrong!\n"); | ||
223 | } | ||
224 | |||
196 | platform_set_drvdata(pdev, data); | 225 | platform_set_drvdata(pdev, data); |
197 | 226 | ||
198 | if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group))) | 227 | if ((err = sysfs_create_group(&pdev->dev.kobj, &coretemp_group))) |
@@ -330,9 +359,6 @@ static int __init coretemp_init(void) | |||
330 | int i, err = -ENODEV; | 359 | int i, err = -ENODEV; |
331 | struct pdev_entry *p, *n; | 360 | struct pdev_entry *p, *n; |
332 | 361 | ||
333 | printk(KERN_NOTICE DRVNAME ": This driver uses undocumented features " | ||
334 | "of Core CPU. Temperature might be wrong!\n"); | ||
335 | |||
336 | /* quick check if we run Intel */ | 362 | /* quick check if we run Intel */ |
337 | if (cpu_data[0].x86_vendor != X86_VENDOR_INTEL) | 363 | if (cpu_data[0].x86_vendor != X86_VENDOR_INTEL) |
338 | goto exit; | 364 | goto exit; |
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index c849c0c6ee9c..d5ac422d73b2 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
@@ -53,8 +53,8 @@ MODULE_PARM_DESC(polarity, "Output's polarity: 0 = active high, 1 = active low") | |||
53 | 53 | ||
54 | /* The DS1621 registers */ | 54 | /* The DS1621 registers */ |
55 | #define DS1621_REG_TEMP 0xAA /* word, RO */ | 55 | #define DS1621_REG_TEMP 0xAA /* word, RO */ |
56 | #define DS1621_REG_TEMP_MIN 0xA1 /* word, RW */ | 56 | #define DS1621_REG_TEMP_MIN 0xA2 /* word, RW */ |
57 | #define DS1621_REG_TEMP_MAX 0xA2 /* word, RW */ | 57 | #define DS1621_REG_TEMP_MAX 0xA1 /* word, RW */ |
58 | #define DS1621_REG_CONF 0xAC /* byte, RW */ | 58 | #define DS1621_REG_CONF 0xAC /* byte, RW */ |
59 | #define DS1621_COM_START 0xEE /* no data */ | 59 | #define DS1621_COM_START 0xEE /* no data */ |
60 | #define DS1621_COM_STOP 0x22 /* no data */ | 60 | #define DS1621_COM_STOP 0x22 /* no data */ |
@@ -328,9 +328,9 @@ static struct ds1621_data *ds1621_update_client(struct device *dev) | |||
328 | 328 | ||
329 | /* reset alarms if necessary */ | 329 | /* reset alarms if necessary */ |
330 | new_conf = data->conf; | 330 | new_conf = data->conf; |
331 | if (data->temp < data->temp_min) | 331 | if (data->temp > data->temp_min) |
332 | new_conf &= ~DS1621_ALARM_TEMP_LOW; | 332 | new_conf &= ~DS1621_ALARM_TEMP_LOW; |
333 | if (data->temp > data->temp_max) | 333 | if (data->temp < data->temp_max) |
334 | new_conf &= ~DS1621_ALARM_TEMP_HIGH; | 334 | new_conf &= ~DS1621_ALARM_TEMP_HIGH; |
335 | if (data->conf != new_conf) | 335 | if (data->conf != new_conf) |
336 | ds1621_write_value(client, DS1621_REG_CONF, | 336 | ds1621_write_value(client, DS1621_REG_CONF, |
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index 5aab23b93e24..f17e771e42f8 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c | |||
@@ -132,7 +132,9 @@ int vid_from_reg(int val, u8 vrm) | |||
132 | val &= 0x7f; | 132 | val &= 0x7f; |
133 | return(val > 0x77 ? 0 : (1500000 - (val * 12500) + 500) / 1000); | 133 | return(val > 0x77 ? 0 : (1500000 - (val * 12500) + 500) / 1000); |
134 | default: /* report 0 for unknown */ | 134 | default: /* report 0 for unknown */ |
135 | printk(KERN_INFO "hwmon-vid: requested unknown VRM version\n"); | 135 | if (vrm) |
136 | printk(KERN_WARNING "hwmon-vid: Requested unsupported " | ||
137 | "VRM version (%u)\n", (unsigned int)vrm); | ||
136 | return 0; | 138 | return 0; |
137 | } | 139 | } |
138 | } | 140 | } |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index a5b774b07cbd..12cb40a975de 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -965,8 +965,10 @@ static int __init w83627hf_find(int sioaddr, unsigned short *addr, | |||
965 | case W687THF_DEVID: | 965 | case W687THF_DEVID: |
966 | sio_data->type = w83687thf; | 966 | sio_data->type = w83687thf; |
967 | break; | 967 | break; |
968 | case 0xff: /* No device at all */ | ||
969 | goto exit; | ||
968 | default: | 970 | default: |
969 | pr_debug(DRVNAME ": Unsupported chip (DEVID=0x%x)\n", val); | 971 | pr_debug(DRVNAME ": Unsupported chip (DEVID=0x%02x)\n", val); |
970 | goto exit; | 972 | goto exit; |
971 | } | 973 | } |
972 | 974 | ||
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 8a0a99b93641..28e7b91a4553 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -837,20 +837,10 @@ static const struct i2c_algorithm i2c_pxa_algorithm = { | |||
837 | .functionality = i2c_pxa_functionality, | 837 | .functionality = i2c_pxa_functionality, |
838 | }; | 838 | }; |
839 | 839 | ||
840 | static struct pxa_i2c i2c_pxa = { | ||
841 | .lock = __SPIN_LOCK_UNLOCKED(i2c_pxa.lock), | ||
842 | .adap = { | ||
843 | .owner = THIS_MODULE, | ||
844 | .algo = &i2c_pxa_algorithm, | ||
845 | .name = "pxa2xx-i2c.0", | ||
846 | .retries = 5, | ||
847 | }, | ||
848 | }; | ||
849 | |||
850 | #define res_len(r) ((r)->end - (r)->start + 1) | 840 | #define res_len(r) ((r)->end - (r)->start + 1) |
851 | static int i2c_pxa_probe(struct platform_device *dev) | 841 | static int i2c_pxa_probe(struct platform_device *dev) |
852 | { | 842 | { |
853 | struct pxa_i2c *i2c = &i2c_pxa; | 843 | struct pxa_i2c *i2c; |
854 | struct resource *res; | 844 | struct resource *res; |
855 | struct i2c_pxa_platform_data *plat = dev->dev.platform_data; | 845 | struct i2c_pxa_platform_data *plat = dev->dev.platform_data; |
856 | int ret; | 846 | int ret; |
@@ -864,15 +854,20 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
864 | if (!request_mem_region(res->start, res_len(res), res->name)) | 854 | if (!request_mem_region(res->start, res_len(res), res->name)) |
865 | return -ENOMEM; | 855 | return -ENOMEM; |
866 | 856 | ||
867 | i2c = kmalloc(sizeof(struct pxa_i2c), GFP_KERNEL); | 857 | i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL); |
868 | if (!i2c) { | 858 | if (!i2c) { |
869 | ret = -ENOMEM; | 859 | ret = -ENOMEM; |
870 | goto emalloc; | 860 | goto emalloc; |
871 | } | 861 | } |
872 | 862 | ||
873 | memcpy(i2c, &i2c_pxa, sizeof(struct pxa_i2c)); | 863 | i2c->adap.owner = THIS_MODULE; |
864 | i2c->adap.algo = &i2c_pxa_algorithm; | ||
865 | i2c->adap.retries = 5; | ||
866 | |||
867 | spin_lock_init(&i2c->lock); | ||
874 | init_waitqueue_head(&i2c->wait); | 868 | init_waitqueue_head(&i2c->wait); |
875 | i2c->adap.name[strlen(i2c->adap.name) - 1] = '0' + dev->id % 10; | 869 | |
870 | sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id); | ||
876 | 871 | ||
877 | i2c->reg_base = ioremap(res->start, res_len(res)); | 872 | i2c->reg_base = ioremap(res->start, res_len(res)); |
878 | if (!i2c->reg_base) { | 873 | if (!i2c->reg_base) { |
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 2296d43a2414..5f026b5d7857 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/types.h> | 47 | #include <linux/types.h> |
48 | #include <linux/delay.h> | 48 | #include <linux/delay.h> |
49 | #include <linux/init.h> | 49 | #include <linux/init.h> |
50 | #include <linux/workqueue.h> | ||
50 | 51 | ||
51 | #include <linux/netdevice.h> | 52 | #include <linux/netdevice.h> |
52 | #include <linux/inetdevice.h> | 53 | #include <linux/inetdevice.h> |
@@ -235,6 +236,9 @@ static int ether1394_open(struct net_device *dev) | |||
235 | /* This is called after an "ifdown" */ | 236 | /* This is called after an "ifdown" */ |
236 | static int ether1394_stop(struct net_device *dev) | 237 | static int ether1394_stop(struct net_device *dev) |
237 | { | 238 | { |
239 | /* flush priv->wake */ | ||
240 | flush_scheduled_work(); | ||
241 | |||
238 | netif_stop_queue(dev); | 242 | netif_stop_queue(dev); |
239 | return 0; | 243 | return 0; |
240 | } | 244 | } |
@@ -531,6 +535,37 @@ static void ether1394_init_dev(struct net_device *dev) | |||
531 | } | 535 | } |
532 | 536 | ||
533 | /* | 537 | /* |
538 | * Wake the queue up after commonly encountered transmit failure conditions are | ||
539 | * hopefully over. Currently only tlabel exhaustion is accounted for. | ||
540 | */ | ||
541 | static void ether1394_wake_queue(struct work_struct *work) | ||
542 | { | ||
543 | struct eth1394_priv *priv; | ||
544 | struct hpsb_packet *packet; | ||
545 | |||
546 | priv = container_of(work, struct eth1394_priv, wake); | ||
547 | packet = hpsb_alloc_packet(0); | ||
548 | |||
549 | /* This is really bad, but unjam the queue anyway. */ | ||
550 | if (!packet) | ||
551 | goto out; | ||
552 | |||
553 | packet->host = priv->host; | ||
554 | packet->node_id = priv->wake_node; | ||
555 | /* | ||
556 | * A transaction label is all we really want. If we get one, it almost | ||
557 | * always means we can get a lot more because the ieee1394 core recycled | ||
558 | * a whole batch of tlabels, at last. | ||
559 | */ | ||
560 | if (hpsb_get_tlabel(packet) == 0) | ||
561 | hpsb_free_tlabel(packet); | ||
562 | |||
563 | hpsb_free_packet(packet); | ||
564 | out: | ||
565 | netif_wake_queue(priv->wake_dev); | ||
566 | } | ||
567 | |||
568 | /* | ||
534 | * This function is called every time a card is found. It is generally called | 569 | * This function is called every time a card is found. It is generally called |
535 | * when the module is installed. This is where we add all of our ethernet | 570 | * when the module is installed. This is where we add all of our ethernet |
536 | * devices. One for each host. | 571 | * devices. One for each host. |
@@ -564,16 +599,17 @@ static void ether1394_add_host(struct hpsb_host *host) | |||
564 | } | 599 | } |
565 | 600 | ||
566 | SET_MODULE_OWNER(dev); | 601 | SET_MODULE_OWNER(dev); |
567 | #if 0 | 602 | |
568 | /* FIXME - Is this the correct parent device anyway? */ | 603 | /* This used to be &host->device in Linux 2.6.20 and before. */ |
569 | SET_NETDEV_DEV(dev, &host->device); | 604 | SET_NETDEV_DEV(dev, host->device.parent); |
570 | #endif | ||
571 | 605 | ||
572 | priv = netdev_priv(dev); | 606 | priv = netdev_priv(dev); |
573 | INIT_LIST_HEAD(&priv->ip_node_list); | 607 | INIT_LIST_HEAD(&priv->ip_node_list); |
574 | spin_lock_init(&priv->lock); | 608 | spin_lock_init(&priv->lock); |
575 | priv->host = host; | 609 | priv->host = host; |
576 | priv->local_fifo = fifo_addr; | 610 | priv->local_fifo = fifo_addr; |
611 | INIT_WORK(&priv->wake, ether1394_wake_queue); | ||
612 | priv->wake_dev = dev; | ||
577 | 613 | ||
578 | hi = hpsb_create_hostinfo(ð1394_highlevel, host, sizeof(*hi)); | 614 | hi = hpsb_create_hostinfo(ð1394_highlevel, host, sizeof(*hi)); |
579 | if (hi == NULL) { | 615 | if (hi == NULL) { |
@@ -1390,22 +1426,17 @@ static int ether1394_prep_write_packet(struct hpsb_packet *p, | |||
1390 | u64 addr, void *data, int tx_len) | 1426 | u64 addr, void *data, int tx_len) |
1391 | { | 1427 | { |
1392 | p->node_id = node; | 1428 | p->node_id = node; |
1393 | p->data = NULL; | ||
1394 | 1429 | ||
1395 | p->tcode = TCODE_WRITEB; | 1430 | if (hpsb_get_tlabel(p)) |
1396 | p->header[1] = host->node_id << 16 | addr >> 32; | 1431 | return -EAGAIN; |
1397 | p->header[2] = addr & 0xffffffff; | ||
1398 | 1432 | ||
1433 | p->tcode = TCODE_WRITEB; | ||
1399 | p->header_size = 16; | 1434 | p->header_size = 16; |
1400 | p->expect_response = 1; | 1435 | p->expect_response = 1; |
1401 | |||
1402 | if (hpsb_get_tlabel(p)) { | ||
1403 | ETH1394_PRINT_G(KERN_ERR, "Out of tlabels\n"); | ||
1404 | return -1; | ||
1405 | } | ||
1406 | p->header[0] = | 1436 | p->header[0] = |
1407 | p->node_id << 16 | p->tlabel << 10 | 1 << 8 | TCODE_WRITEB << 4; | 1437 | p->node_id << 16 | p->tlabel << 10 | 1 << 8 | TCODE_WRITEB << 4; |
1408 | 1438 | p->header[1] = host->node_id << 16 | addr >> 32; | |
1439 | p->header[2] = addr & 0xffffffff; | ||
1409 | p->header[3] = tx_len << 16; | 1440 | p->header[3] = tx_len << 16; |
1410 | p->data_size = (tx_len + 3) & ~3; | 1441 | p->data_size = (tx_len + 3) & ~3; |
1411 | p->data = data; | 1442 | p->data = data; |
@@ -1451,7 +1482,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len) | |||
1451 | 1482 | ||
1452 | packet = ether1394_alloc_common_packet(priv->host); | 1483 | packet = ether1394_alloc_common_packet(priv->host); |
1453 | if (!packet) | 1484 | if (!packet) |
1454 | return -1; | 1485 | return -ENOMEM; |
1455 | 1486 | ||
1456 | if (ptask->tx_type == ETH1394_GASP) { | 1487 | if (ptask->tx_type == ETH1394_GASP) { |
1457 | int length = tx_len + 2 * sizeof(quadlet_t); | 1488 | int length = tx_len + 2 * sizeof(quadlet_t); |
@@ -1462,7 +1493,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len) | |||
1462 | ptask->addr, ptask->skb->data, | 1493 | ptask->addr, ptask->skb->data, |
1463 | tx_len)) { | 1494 | tx_len)) { |
1464 | hpsb_free_packet(packet); | 1495 | hpsb_free_packet(packet); |
1465 | return -1; | 1496 | return -EAGAIN; |
1466 | } | 1497 | } |
1467 | 1498 | ||
1468 | ptask->packet = packet; | 1499 | ptask->packet = packet; |
@@ -1471,7 +1502,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len) | |||
1471 | 1502 | ||
1472 | if (hpsb_send_packet(packet) < 0) { | 1503 | if (hpsb_send_packet(packet) < 0) { |
1473 | ether1394_free_packet(packet); | 1504 | ether1394_free_packet(packet); |
1474 | return -1; | 1505 | return -EIO; |
1475 | } | 1506 | } |
1476 | 1507 | ||
1477 | return 0; | 1508 | return 0; |
@@ -1514,13 +1545,18 @@ static void ether1394_complete_cb(void *__ptask) | |||
1514 | 1545 | ||
1515 | ptask->outstanding_pkts--; | 1546 | ptask->outstanding_pkts--; |
1516 | if (ptask->outstanding_pkts > 0 && !fail) { | 1547 | if (ptask->outstanding_pkts > 0 && !fail) { |
1517 | int tx_len; | 1548 | int tx_len, err; |
1518 | 1549 | ||
1519 | /* Add the encapsulation header to the fragment */ | 1550 | /* Add the encapsulation header to the fragment */ |
1520 | tx_len = ether1394_encapsulate(ptask->skb, ptask->max_payload, | 1551 | tx_len = ether1394_encapsulate(ptask->skb, ptask->max_payload, |
1521 | &ptask->hdr); | 1552 | &ptask->hdr); |
1522 | if (ether1394_send_packet(ptask, tx_len)) | 1553 | err = ether1394_send_packet(ptask, tx_len); |
1554 | if (err) { | ||
1555 | if (err == -EAGAIN) | ||
1556 | ETH1394_PRINT_G(KERN_ERR, "Out of tlabels\n"); | ||
1557 | |||
1523 | ether1394_dg_complete(ptask, 1); | 1558 | ether1394_dg_complete(ptask, 1); |
1559 | } | ||
1524 | } else { | 1560 | } else { |
1525 | ether1394_dg_complete(ptask, fail); | 1561 | ether1394_dg_complete(ptask, fail); |
1526 | } | 1562 | } |
@@ -1633,10 +1669,18 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev) | |||
1633 | /* Add the encapsulation header to the fragment */ | 1669 | /* Add the encapsulation header to the fragment */ |
1634 | tx_len = ether1394_encapsulate(skb, max_payload, &ptask->hdr); | 1670 | tx_len = ether1394_encapsulate(skb, max_payload, &ptask->hdr); |
1635 | dev->trans_start = jiffies; | 1671 | dev->trans_start = jiffies; |
1636 | if (ether1394_send_packet(ptask, tx_len)) | 1672 | if (ether1394_send_packet(ptask, tx_len)) { |
1637 | goto fail; | 1673 | if (dest_node == (LOCAL_BUS | ALL_NODES)) |
1674 | goto fail; | ||
1675 | |||
1676 | /* Most failures of ether1394_send_packet are recoverable. */ | ||
1677 | netif_stop_queue(dev); | ||
1678 | priv->wake_node = dest_node; | ||
1679 | schedule_work(&priv->wake); | ||
1680 | kmem_cache_free(packet_task_cache, ptask); | ||
1681 | return NETDEV_TX_BUSY; | ||
1682 | } | ||
1638 | 1683 | ||
1639 | netif_wake_queue(dev); | ||
1640 | return NETDEV_TX_OK; | 1684 | return NETDEV_TX_OK; |
1641 | fail: | 1685 | fail: |
1642 | if (ptask) | 1686 | if (ptask) |
@@ -1650,9 +1694,6 @@ fail: | |||
1650 | priv->stats.tx_errors++; | 1694 | priv->stats.tx_errors++; |
1651 | spin_unlock_irqrestore(&priv->lock, flags); | 1695 | spin_unlock_irqrestore(&priv->lock, flags); |
1652 | 1696 | ||
1653 | if (netif_queue_stopped(dev)) | ||
1654 | netif_wake_queue(dev); | ||
1655 | |||
1656 | /* | 1697 | /* |
1657 | * FIXME: According to a patch from 2003-02-26, "returning non-zero | 1698 | * FIXME: According to a patch from 2003-02-26, "returning non-zero |
1658 | * causes serious problems" here, allegedly. Before that patch, | 1699 | * causes serious problems" here, allegedly. Before that patch, |
diff --git a/drivers/ieee1394/eth1394.h b/drivers/ieee1394/eth1394.h index a3439ee7cb4e..4f3e2dd46f00 100644 --- a/drivers/ieee1394/eth1394.h +++ b/drivers/ieee1394/eth1394.h | |||
@@ -66,6 +66,10 @@ struct eth1394_priv { | |||
66 | int bc_dgl; /* Outgoing broadcast datagram label */ | 66 | int bc_dgl; /* Outgoing broadcast datagram label */ |
67 | struct list_head ip_node_list; /* List of IP capable nodes */ | 67 | struct list_head ip_node_list; /* List of IP capable nodes */ |
68 | struct unit_directory *ud_list[ALL_NODES]; /* Cached unit dir list */ | 68 | struct unit_directory *ud_list[ALL_NODES]; /* Cached unit dir list */ |
69 | |||
70 | struct work_struct wake; /* Wake up after xmit failure */ | ||
71 | struct net_device *wake_dev; /* Stupid backlink for .wake */ | ||
72 | nodeid_t wake_node; /* Destination of failed xmit */ | ||
69 | }; | 73 | }; |
70 | 74 | ||
71 | 75 | ||
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index d382500f4210..f1d05eeb9f51 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -936,6 +936,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req) | |||
936 | struct hpsb_packet *packet; | 936 | struct hpsb_packet *packet; |
937 | int header_length = req->req.misc & 0xffff; | 937 | int header_length = req->req.misc & 0xffff; |
938 | int expect_response = req->req.misc >> 16; | 938 | int expect_response = req->req.misc >> 16; |
939 | size_t data_size; | ||
939 | 940 | ||
940 | if (header_length > req->req.length || header_length < 12 || | 941 | if (header_length > req->req.length || header_length < 12 || |
941 | header_length > FIELD_SIZEOF(struct hpsb_packet, header)) { | 942 | header_length > FIELD_SIZEOF(struct hpsb_packet, header)) { |
@@ -945,7 +946,8 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req) | |||
945 | return sizeof(struct raw1394_request); | 946 | return sizeof(struct raw1394_request); |
946 | } | 947 | } |
947 | 948 | ||
948 | packet = hpsb_alloc_packet(req->req.length - header_length); | 949 | data_size = req->req.length - header_length; |
950 | packet = hpsb_alloc_packet(data_size); | ||
949 | req->packet = packet; | 951 | req->packet = packet; |
950 | if (!packet) | 952 | if (!packet) |
951 | return -ENOMEM; | 953 | return -ENOMEM; |
@@ -960,7 +962,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req) | |||
960 | 962 | ||
961 | if (copy_from_user | 963 | if (copy_from_user |
962 | (packet->data, int2ptr(req->req.sendb) + header_length, | 964 | (packet->data, int2ptr(req->req.sendb) + header_length, |
963 | packet->data_size)) { | 965 | data_size)) { |
964 | req->req.error = RAW1394_ERROR_MEMFAULT; | 966 | req->req.error = RAW1394_ERROR_MEMFAULT; |
965 | req->req.length = 0; | 967 | req->req.length = 0; |
966 | queue_complete_req(req); | 968 | queue_complete_req(req); |
@@ -974,7 +976,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req) | |||
974 | packet->host = fi->host; | 976 | packet->host = fi->host; |
975 | packet->expect_response = expect_response; | 977 | packet->expect_response = expect_response; |
976 | packet->header_size = header_length; | 978 | packet->header_size = header_length; |
977 | packet->data_size = req->req.length - header_length; | 979 | packet->data_size = data_size; |
978 | 980 | ||
979 | req->req.length = 0; | 981 | req->req.length = 0; |
980 | hpsb_set_packet_complete_task(packet, | 982 | hpsb_set_packet_complete_task(packet, |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 4cb6fa2bcfb7..875eadd5e8f5 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -70,6 +70,7 @@ | |||
70 | #include <linux/stringify.h> | 70 | #include <linux/stringify.h> |
71 | #include <linux/types.h> | 71 | #include <linux/types.h> |
72 | #include <linux/wait.h> | 72 | #include <linux/wait.h> |
73 | #include <linux/workqueue.h> | ||
73 | 74 | ||
74 | #include <asm/byteorder.h> | 75 | #include <asm/byteorder.h> |
75 | #include <asm/errno.h> | 76 | #include <asm/errno.h> |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index e840434a96d8..40c004a2697e 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -1297,26 +1297,29 @@ static struct cm_id_private * cm_match_req(struct cm_work *work, | |||
1297 | 1297 | ||
1298 | req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad; | 1298 | req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad; |
1299 | 1299 | ||
1300 | /* Check for duplicate REQ and stale connections. */ | 1300 | /* Check for possible duplicate REQ. */ |
1301 | spin_lock_irqsave(&cm.lock, flags); | 1301 | spin_lock_irqsave(&cm.lock, flags); |
1302 | timewait_info = cm_insert_remote_id(cm_id_priv->timewait_info); | 1302 | timewait_info = cm_insert_remote_id(cm_id_priv->timewait_info); |
1303 | if (!timewait_info) | ||
1304 | timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info); | ||
1305 | |||
1306 | if (timewait_info) { | 1303 | if (timewait_info) { |
1307 | cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, | 1304 | cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, |
1308 | timewait_info->work.remote_id); | 1305 | timewait_info->work.remote_id); |
1309 | cm_cleanup_timewait(cm_id_priv->timewait_info); | ||
1310 | spin_unlock_irqrestore(&cm.lock, flags); | 1306 | spin_unlock_irqrestore(&cm.lock, flags); |
1311 | if (cur_cm_id_priv) { | 1307 | if (cur_cm_id_priv) { |
1312 | cm_dup_req_handler(work, cur_cm_id_priv); | 1308 | cm_dup_req_handler(work, cur_cm_id_priv); |
1313 | cm_deref_id(cur_cm_id_priv); | 1309 | cm_deref_id(cur_cm_id_priv); |
1314 | } else | 1310 | } |
1315 | cm_issue_rej(work->port, work->mad_recv_wc, | 1311 | return NULL; |
1316 | IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ, | 1312 | } |
1317 | NULL, 0); | 1313 | |
1318 | listen_cm_id_priv = NULL; | 1314 | /* Check for stale connections. */ |
1319 | goto out; | 1315 | timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info); |
1316 | if (timewait_info) { | ||
1317 | cm_cleanup_timewait(cm_id_priv->timewait_info); | ||
1318 | spin_unlock_irqrestore(&cm.lock, flags); | ||
1319 | cm_issue_rej(work->port, work->mad_recv_wc, | ||
1320 | IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ, | ||
1321 | NULL, 0); | ||
1322 | return NULL; | ||
1320 | } | 1323 | } |
1321 | 1324 | ||
1322 | /* Find matching listen request. */ | 1325 | /* Find matching listen request. */ |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 027664979fe2..eef415b12b2e 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -2284,10 +2284,10 @@ void mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send, | |||
2284 | struct mthca_next_seg *next; | 2284 | struct mthca_next_seg *next; |
2285 | 2285 | ||
2286 | /* | 2286 | /* |
2287 | * For SRQs, all WQEs generate a CQE, so we're always at the | 2287 | * For SRQs, all receive WQEs generate a CQE, so we're always |
2288 | * end of the doorbell chain. | 2288 | * at the end of the doorbell chain. |
2289 | */ | 2289 | */ |
2290 | if (qp->ibqp.srq) { | 2290 | if (qp->ibqp.srq && !is_send) { |
2291 | *new_wqe = 0; | 2291 | *new_wqe = 0; |
2292 | return; | 2292 | return; |
2293 | } | 2293 | } |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 158759e28a5b..285c143115cc 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -156,7 +156,7 @@ struct ipoib_cm_data { | |||
156 | * - and then invoke a Destroy QP or Reset QP. | 156 | * - and then invoke a Destroy QP or Reset QP. |
157 | * | 157 | * |
158 | * We use the second option and wait for a completion on the | 158 | * We use the second option and wait for a completion on the |
159 | * rx_drain_qp before destroying QPs attached to our SRQ. | 159 | * same CQ before destroying QPs attached to our SRQ. |
160 | */ | 160 | */ |
161 | 161 | ||
162 | enum ipoib_cm_state { | 162 | enum ipoib_cm_state { |
@@ -199,7 +199,6 @@ struct ipoib_cm_dev_priv { | |||
199 | struct ib_srq *srq; | 199 | struct ib_srq *srq; |
200 | struct ipoib_cm_rx_buf *srq_ring; | 200 | struct ipoib_cm_rx_buf *srq_ring; |
201 | struct ib_cm_id *id; | 201 | struct ib_cm_id *id; |
202 | struct ib_qp *rx_drain_qp; /* generates WR described in 10.3.1 */ | ||
203 | struct list_head passive_ids; /* state: LIVE */ | 202 | struct list_head passive_ids; /* state: LIVE */ |
204 | struct list_head rx_error_list; /* state: ERROR */ | 203 | struct list_head rx_error_list; /* state: ERROR */ |
205 | struct list_head rx_flush_list; /* state: FLUSH, drain not started */ | 204 | struct list_head rx_flush_list; /* state: FLUSH, drain not started */ |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index f133b56fd978..076a0bbb63d7 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -69,8 +69,9 @@ static struct ib_qp_attr ipoib_cm_err_attr = { | |||
69 | 69 | ||
70 | #define IPOIB_CM_RX_DRAIN_WRID 0x7fffffff | 70 | #define IPOIB_CM_RX_DRAIN_WRID 0x7fffffff |
71 | 71 | ||
72 | static struct ib_recv_wr ipoib_cm_rx_drain_wr = { | 72 | static struct ib_send_wr ipoib_cm_rx_drain_wr = { |
73 | .wr_id = IPOIB_CM_RX_DRAIN_WRID | 73 | .wr_id = IPOIB_CM_RX_DRAIN_WRID, |
74 | .opcode = IB_WR_SEND, | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | static int ipoib_cm_tx_handler(struct ib_cm_id *cm_id, | 77 | static int ipoib_cm_tx_handler(struct ib_cm_id *cm_id, |
@@ -163,16 +164,22 @@ partial_error: | |||
163 | 164 | ||
164 | static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv* priv) | 165 | static void ipoib_cm_start_rx_drain(struct ipoib_dev_priv* priv) |
165 | { | 166 | { |
166 | struct ib_recv_wr *bad_wr; | 167 | struct ib_send_wr *bad_wr; |
168 | struct ipoib_cm_rx *p; | ||
167 | 169 | ||
168 | /* rx_drain_qp send queue depth is 1, so | 170 | /* We only reserved 1 extra slot in CQ for drain WRs, so |
169 | * make sure we have at most 1 outstanding WR. */ | 171 | * make sure we have at most 1 outstanding WR. */ |
170 | if (list_empty(&priv->cm.rx_flush_list) || | 172 | if (list_empty(&priv->cm.rx_flush_list) || |
171 | !list_empty(&priv->cm.rx_drain_list)) | 173 | !list_empty(&priv->cm.rx_drain_list)) |
172 | return; | 174 | return; |
173 | 175 | ||
174 | if (ib_post_recv(priv->cm.rx_drain_qp, &ipoib_cm_rx_drain_wr, &bad_wr)) | 176 | /* |
175 | ipoib_warn(priv, "failed to post rx_drain wr\n"); | 177 | * QPs on flush list are error state. This way, a "flush |
178 | * error" WC will be immediately generated for each WR we post. | ||
179 | */ | ||
180 | p = list_entry(priv->cm.rx_flush_list.next, typeof(*p), list); | ||
181 | if (ib_post_send(p->qp, &ipoib_cm_rx_drain_wr, &bad_wr)) | ||
182 | ipoib_warn(priv, "failed to post drain wr\n"); | ||
176 | 183 | ||
177 | list_splice_init(&priv->cm.rx_flush_list, &priv->cm.rx_drain_list); | 184 | list_splice_init(&priv->cm.rx_flush_list, &priv->cm.rx_drain_list); |
178 | } | 185 | } |
@@ -199,10 +206,10 @@ static struct ib_qp *ipoib_cm_create_rx_qp(struct net_device *dev, | |||
199 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 206 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
200 | struct ib_qp_init_attr attr = { | 207 | struct ib_qp_init_attr attr = { |
201 | .event_handler = ipoib_cm_rx_event_handler, | 208 | .event_handler = ipoib_cm_rx_event_handler, |
202 | .send_cq = priv->cq, /* does not matter, we never send anything */ | 209 | .send_cq = priv->cq, /* For drain WR */ |
203 | .recv_cq = priv->cq, | 210 | .recv_cq = priv->cq, |
204 | .srq = priv->cm.srq, | 211 | .srq = priv->cm.srq, |
205 | .cap.max_send_wr = 1, /* FIXME: 0 Seems not to work */ | 212 | .cap.max_send_wr = 1, /* For drain WR */ |
206 | .cap.max_send_sge = 1, /* FIXME: 0 Seems not to work */ | 213 | .cap.max_send_sge = 1, /* FIXME: 0 Seems not to work */ |
207 | .sq_sig_type = IB_SIGNAL_ALL_WR, | 214 | .sq_sig_type = IB_SIGNAL_ALL_WR, |
208 | .qp_type = IB_QPT_RC, | 215 | .qp_type = IB_QPT_RC, |
@@ -242,6 +249,27 @@ static int ipoib_cm_modify_rx_qp(struct net_device *dev, | |||
242 | ipoib_warn(priv, "failed to modify QP to RTR: %d\n", ret); | 249 | ipoib_warn(priv, "failed to modify QP to RTR: %d\n", ret); |
243 | return ret; | 250 | return ret; |
244 | } | 251 | } |
252 | |||
253 | /* | ||
254 | * Current Mellanox HCA firmware won't generate completions | ||
255 | * with error for drain WRs unless the QP has been moved to | ||
256 | * RTS first. This work-around leaves a window where a QP has | ||
257 | * moved to error asynchronously, but this will eventually get | ||
258 | * fixed in firmware, so let's not error out if modify QP | ||
259 | * fails. | ||
260 | */ | ||
261 | qp_attr.qp_state = IB_QPS_RTS; | ||
262 | ret = ib_cm_init_qp_attr(cm_id, &qp_attr, &qp_attr_mask); | ||
263 | if (ret) { | ||
264 | ipoib_warn(priv, "failed to init QP attr for RTS: %d\n", ret); | ||
265 | return 0; | ||
266 | } | ||
267 | ret = ib_modify_qp(qp, &qp_attr, qp_attr_mask); | ||
268 | if (ret) { | ||
269 | ipoib_warn(priv, "failed to modify QP to RTS: %d\n", ret); | ||
270 | return 0; | ||
271 | } | ||
272 | |||
245 | return 0; | 273 | return 0; |
246 | } | 274 | } |
247 | 275 | ||
@@ -623,38 +651,11 @@ static void ipoib_cm_tx_completion(struct ib_cq *cq, void *tx_ptr) | |||
623 | int ipoib_cm_dev_open(struct net_device *dev) | 651 | int ipoib_cm_dev_open(struct net_device *dev) |
624 | { | 652 | { |
625 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 653 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
626 | struct ib_qp_init_attr qp_init_attr = { | ||
627 | .send_cq = priv->cq, /* does not matter, we never send anything */ | ||
628 | .recv_cq = priv->cq, | ||
629 | .cap.max_send_wr = 1, /* FIXME: 0 Seems not to work */ | ||
630 | .cap.max_send_sge = 1, /* FIXME: 0 Seems not to work */ | ||
631 | .cap.max_recv_wr = 1, | ||
632 | .cap.max_recv_sge = 1, /* FIXME: 0 Seems not to work */ | ||
633 | .sq_sig_type = IB_SIGNAL_ALL_WR, | ||
634 | .qp_type = IB_QPT_UC, | ||
635 | }; | ||
636 | int ret; | 654 | int ret; |
637 | 655 | ||
638 | if (!IPOIB_CM_SUPPORTED(dev->dev_addr)) | 656 | if (!IPOIB_CM_SUPPORTED(dev->dev_addr)) |
639 | return 0; | 657 | return 0; |
640 | 658 | ||
641 | priv->cm.rx_drain_qp = ib_create_qp(priv->pd, &qp_init_attr); | ||
642 | if (IS_ERR(priv->cm.rx_drain_qp)) { | ||
643 | printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name); | ||
644 | ret = PTR_ERR(priv->cm.rx_drain_qp); | ||
645 | return ret; | ||
646 | } | ||
647 | |||
648 | /* | ||
649 | * We put the QP in error state directly. This way, a "flush | ||
650 | * error" WC will be immediately generated for each WR we post. | ||
651 | */ | ||
652 | ret = ib_modify_qp(priv->cm.rx_drain_qp, &ipoib_cm_err_attr, IB_QP_STATE); | ||
653 | if (ret) { | ||
654 | ipoib_warn(priv, "failed to modify drain QP to error: %d\n", ret); | ||
655 | goto err_qp; | ||
656 | } | ||
657 | |||
658 | priv->cm.id = ib_create_cm_id(priv->ca, ipoib_cm_rx_handler, dev); | 659 | priv->cm.id = ib_create_cm_id(priv->ca, ipoib_cm_rx_handler, dev); |
659 | if (IS_ERR(priv->cm.id)) { | 660 | if (IS_ERR(priv->cm.id)) { |
660 | printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name); | 661 | printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name); |
@@ -676,8 +677,6 @@ err_listen: | |||
676 | ib_destroy_cm_id(priv->cm.id); | 677 | ib_destroy_cm_id(priv->cm.id); |
677 | err_cm: | 678 | err_cm: |
678 | priv->cm.id = NULL; | 679 | priv->cm.id = NULL; |
679 | err_qp: | ||
680 | ib_destroy_qp(priv->cm.rx_drain_qp); | ||
681 | return ret; | 680 | return ret; |
682 | } | 681 | } |
683 | 682 | ||
@@ -740,7 +739,6 @@ void ipoib_cm_dev_stop(struct net_device *dev) | |||
740 | kfree(p); | 739 | kfree(p); |
741 | } | 740 | } |
742 | 741 | ||
743 | ib_destroy_qp(priv->cm.rx_drain_qp); | ||
744 | cancel_delayed_work(&priv->cm.stale_task); | 742 | cancel_delayed_work(&priv->cm.stale_task); |
745 | } | 743 | } |
746 | 744 | ||
diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c index 559508795af1..d31ece8f68e9 100644 --- a/drivers/input/serio/sa1111ps2.c +++ b/drivers/input/serio/sa1111ps2.c | |||
@@ -170,7 +170,7 @@ static void ps2_close(struct serio *io) | |||
170 | /* | 170 | /* |
171 | * Clear the input buffer. | 171 | * Clear the input buffer. |
172 | */ | 172 | */ |
173 | static void __init ps2_clear_input(struct ps2if *ps2if) | 173 | static void __devinit ps2_clear_input(struct ps2if *ps2if) |
174 | { | 174 | { |
175 | int maxread = 100; | 175 | int maxread = 100; |
176 | 176 | ||
@@ -228,7 +228,7 @@ static int __init ps2_test(struct ps2if *ps2if) | |||
228 | /* | 228 | /* |
229 | * Add one device to this driver. | 229 | * Add one device to this driver. |
230 | */ | 230 | */ |
231 | static int ps2_probe(struct sa1111_dev *dev) | 231 | static int __devinit ps2_probe(struct sa1111_dev *dev) |
232 | { | 232 | { |
233 | struct ps2if *ps2if; | 233 | struct ps2if *ps2if; |
234 | struct serio *serio; | 234 | struct serio *serio; |
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index 58926da0ae18..f44c94abd883 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig | |||
@@ -113,7 +113,6 @@ config PMAC_SMU | |||
113 | 113 | ||
114 | config PMAC_APM_EMU | 114 | config PMAC_APM_EMU |
115 | tristate "APM emulation" | 115 | tristate "APM emulation" |
116 | select SYS_SUPPORTS_APM_EMULATION | ||
117 | select APM_EMULATION | 116 | select APM_EMULATION |
118 | depends on ADB_PMU && PM | 117 | depends on ADB_PMU && PM |
119 | 118 | ||
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index d25d3be8fcd2..165f81d16d00 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h | |||
@@ -436,7 +436,7 @@ typedef struct _MPT_SAS_MGMT { | |||
436 | typedef struct _mpt_ioctl_events { | 436 | typedef struct _mpt_ioctl_events { |
437 | u32 event; /* Specified by define above */ | 437 | u32 event; /* Specified by define above */ |
438 | u32 eventContext; /* Index or counter */ | 438 | u32 eventContext; /* Index or counter */ |
439 | int data[2]; /* First 8 bytes of Event Data */ | 439 | u32 data[2]; /* First 8 bytes of Event Data */ |
440 | } MPT_IOCTL_EVENTS; | 440 | } MPT_IOCTL_EVENTS; |
441 | 441 | ||
442 | /* | 442 | /* |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index fa0f7761652a..3bd94f11e7d6 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -2463,11 +2463,11 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR | |||
2463 | ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE; | 2463 | ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE; |
2464 | ioc->events[idx].eventContext = ioc->eventContext; | 2464 | ioc->events[idx].eventContext = ioc->eventContext; |
2465 | 2465 | ||
2466 | ioc->events[idx].data[0] = (pReq->LUN[1] << 24) || | 2466 | ioc->events[idx].data[0] = (pReq->LUN[1] << 24) | |
2467 | (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA << 16) || | 2467 | (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA << 16) | |
2468 | (sc->device->channel << 8) || sc->device->id; | 2468 | (sc->device->channel << 8) | sc->device->id; |
2469 | 2469 | ||
2470 | ioc->events[idx].data[1] = (sense_data[13] << 8) || sense_data[12]; | 2470 | ioc->events[idx].data[1] = (sense_data[13] << 8) | sense_data[12]; |
2471 | 2471 | ||
2472 | ioc->eventContext++; | 2472 | ioc->eventContext++; |
2473 | if (hd->ioc->pcidev->vendor == | 2473 | if (hd->ioc->pcidev->vendor == |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 30fd479fea5e..1798a9f9fb25 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2280,7 +2280,6 @@ config GFAR_NAPI | |||
2280 | config UCC_GETH | 2280 | config UCC_GETH |
2281 | tristate "Freescale QE Gigabit Ethernet" | 2281 | tristate "Freescale QE Gigabit Ethernet" |
2282 | depends on QUICC_ENGINE | 2282 | depends on QUICC_ENGINE |
2283 | select UCC_FAST | ||
2284 | help | 2283 | help |
2285 | This driver supports the Gigabit Ethernet mode of the QUICC Engine, | 2284 | This driver supports the Gigabit Ethernet mode of the QUICC Engine, |
2286 | which is available on some Freescale SOCs. | 2285 | which is available on some Freescale SOCs. |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 9fe3a38883ee..59b9943b077d 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -4920,7 +4920,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev, | |||
4920 | pci_cmd |= PCI_COMMAND_PARITY; | 4920 | pci_cmd |= PCI_COMMAND_PARITY; |
4921 | pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); | 4921 | pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); |
4922 | if (pci_set_mwi(pdev)) | 4922 | if (pci_set_mwi(pdev)) |
4923 | printk(KERN_WARNING PFX "Could enable MWI for %s\n", | 4923 | printk(KERN_WARNING PFX "Could not enable MWI for %s\n", |
4924 | pci_name(pdev)); | 4924 | pci_name(pdev)); |
4925 | 4925 | ||
4926 | /* | 4926 | /* |
diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c index 571d82f8008c..7df23dc28190 100644 --- a/drivers/net/defxx.c +++ b/drivers/net/defxx.c | |||
@@ -566,6 +566,7 @@ static int __devinit dfx_register(struct device *bdev) | |||
566 | bp->base.mem = ioremap_nocache(bar_start, bar_len); | 566 | bp->base.mem = ioremap_nocache(bar_start, bar_len); |
567 | if (!bp->base.mem) { | 567 | if (!bp->base.mem) { |
568 | printk(KERN_ERR "%s: Cannot map MMIO\n", print_name); | 568 | printk(KERN_ERR "%s: Cannot map MMIO\n", print_name); |
569 | err = -ENOMEM; | ||
569 | goto err_out_region; | 570 | goto err_out_region; |
570 | } | 571 | } |
571 | } else { | 572 | } else { |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index cbc7febe9cdc..9ec35b7a8207 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -1325,7 +1325,10 @@ e1000_sw_init(struct e1000_adapter *adapter) | |||
1325 | spin_lock_init(&adapter->tx_queue_lock); | 1325 | spin_lock_init(&adapter->tx_queue_lock); |
1326 | #endif | 1326 | #endif |
1327 | 1327 | ||
1328 | atomic_set(&adapter->irq_sem, 1); | 1328 | /* Explicitly disable IRQ since the NIC can be in any state. */ |
1329 | atomic_set(&adapter->irq_sem, 0); | ||
1330 | e1000_irq_disable(adapter); | ||
1331 | |||
1329 | spin_lock_init(&adapter->stats_lock); | 1332 | spin_lock_init(&adapter->stats_lock); |
1330 | 1333 | ||
1331 | set_bit(__E1000_DOWN, &adapter->flags); | 1334 | set_bit(__E1000_DOWN, &adapter->flags); |
@@ -1431,6 +1434,10 @@ e1000_open(struct net_device *netdev) | |||
1431 | /* From here on the code is the same as e1000_up() */ | 1434 | /* From here on the code is the same as e1000_up() */ |
1432 | clear_bit(__E1000_DOWN, &adapter->flags); | 1435 | clear_bit(__E1000_DOWN, &adapter->flags); |
1433 | 1436 | ||
1437 | #ifdef CONFIG_E1000_NAPI | ||
1438 | netif_poll_enable(netdev); | ||
1439 | #endif | ||
1440 | |||
1434 | e1000_irq_enable(adapter); | 1441 | e1000_irq_enable(adapter); |
1435 | 1442 | ||
1436 | /* fire a link status change interrupt to start the watchdog */ | 1443 | /* fire a link status change interrupt to start the watchdog */ |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 602872dbe15f..e85a933a4762 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | 40 | ||
41 | #define DRV_NAME "ehea" | 41 | #define DRV_NAME "ehea" |
42 | #define DRV_VERSION "EHEA_0058" | 42 | #define DRV_VERSION "EHEA_0061" |
43 | 43 | ||
44 | #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ | 44 | #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ |
45 | | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) | 45 | | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index f6e0cb1ada1f..152bb2016a2c 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -428,7 +428,7 @@ static struct ehea_cqe *ehea_proc_rwqes(struct net_device *dev, | |||
428 | } | 428 | } |
429 | skb_copy_to_linear_data(skb, ((char*)cqe) + 64, | 429 | skb_copy_to_linear_data(skb, ((char*)cqe) + 64, |
430 | cqe->num_bytes_transfered - 4); | 430 | cqe->num_bytes_transfered - 4); |
431 | ehea_fill_skb(dev, skb, cqe); | 431 | ehea_fill_skb(port->netdev, skb, cqe); |
432 | } else if (rq == 2) { /* RQ2 */ | 432 | } else if (rq == 2) { /* RQ2 */ |
433 | skb = get_skb_by_index(skb_arr_rq2, | 433 | skb = get_skb_by_index(skb_arr_rq2, |
434 | skb_arr_rq2_len, cqe); | 434 | skb_arr_rq2_len, cqe); |
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c index dfbd5809d744..f8d63d39f592 100644 --- a/drivers/net/mlx4/alloc.c +++ b/drivers/net/mlx4/alloc.c | |||
@@ -51,8 +51,8 @@ u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap) | |||
51 | 51 | ||
52 | if (obj < bitmap->max) { | 52 | if (obj < bitmap->max) { |
53 | set_bit(obj, bitmap->table); | 53 | set_bit(obj, bitmap->table); |
54 | bitmap->last = (obj + 1) & (bitmap->max - 1); | ||
54 | obj |= bitmap->top; | 55 | obj |= bitmap->top; |
55 | bitmap->last = obj + 1; | ||
56 | } else | 56 | } else |
57 | obj = -1; | 57 | obj = -1; |
58 | 58 | ||
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 832fd69a0e59..adfbe81693a6 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -364,7 +364,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
364 | /* for SFP-module set SIGDET polarity to low */ | 364 | /* for SFP-module set SIGDET polarity to low */ |
365 | ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL); | 365 | ctrl = gm_phy_read(hw, port, PHY_MARV_PHY_CTRL); |
366 | ctrl |= PHY_M_FIB_SIGD_POL; | 366 | ctrl |= PHY_M_FIB_SIGD_POL; |
367 | gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); | 367 | gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, ctrl); |
368 | } | 368 | } |
369 | 369 | ||
370 | gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); | 370 | gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); |
@@ -658,7 +658,7 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) | |||
658 | const u8 *addr = hw->dev[port]->dev_addr; | 658 | const u8 *addr = hw->dev[port]->dev_addr; |
659 | 659 | ||
660 | sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); | 660 | sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); |
661 | sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR|GPC_ENA_PAUSE); | 661 | sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR); |
662 | 662 | ||
663 | sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR); | 663 | sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR); |
664 | 664 | ||
@@ -1432,7 +1432,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1432 | tcpsum = offset << 16; /* sum start */ | 1432 | tcpsum = offset << 16; /* sum start */ |
1433 | tcpsum |= offset + skb->csum_offset; /* sum write */ | 1433 | tcpsum |= offset + skb->csum_offset; /* sum write */ |
1434 | 1434 | ||
1435 | ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; | 1435 | ctrl |= CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; |
1436 | if (ip_hdr(skb)->protocol == IPPROTO_UDP) | 1436 | if (ip_hdr(skb)->protocol == IPPROTO_UDP) |
1437 | ctrl |= UDPTCP; | 1437 | ctrl |= UDPTCP; |
1438 | 1438 | ||
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 5efb5afc45ba..b8c4a3b5eadf 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -1149,7 +1149,7 @@ enum { | |||
1149 | PHY_M_IS_JABBER = 1<<0, /* Jabber */ | 1149 | PHY_M_IS_JABBER = 1<<0, /* Jabber */ |
1150 | 1150 | ||
1151 | PHY_M_DEF_MSK = PHY_M_IS_LSP_CHANGE | PHY_M_IS_LST_CHANGE | 1151 | PHY_M_DEF_MSK = PHY_M_IS_LSP_CHANGE | PHY_M_IS_LST_CHANGE |
1152 | | PHY_M_IS_FIFO_ERROR, | 1152 | | PHY_M_IS_DUP_CHANGE, |
1153 | PHY_M_AN_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_AN_COMPL, | 1153 | PHY_M_AN_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_AN_COMPL, |
1154 | }; | 1154 | }; |
1155 | 1155 | ||
@@ -1732,28 +1732,6 @@ enum { | |||
1732 | 1732 | ||
1733 | /* GPHY_CTRL 32 bit GPHY Control Reg (YUKON only) */ | 1733 | /* GPHY_CTRL 32 bit GPHY Control Reg (YUKON only) */ |
1734 | enum { | 1734 | enum { |
1735 | GPC_SEL_BDT = 1<<28, /* Select Bi-Dir. Transfer for MDC/MDIO */ | ||
1736 | GPC_INT_POL_HI = 1<<27, /* IRQ Polarity is Active HIGH */ | ||
1737 | GPC_75_OHM = 1<<26, /* Use 75 Ohm Termination instead of 50 */ | ||
1738 | GPC_DIS_FC = 1<<25, /* Disable Automatic Fiber/Copper Detection */ | ||
1739 | GPC_DIS_SLEEP = 1<<24, /* Disable Energy Detect */ | ||
1740 | GPC_HWCFG_M_3 = 1<<23, /* HWCFG_MODE[3] */ | ||
1741 | GPC_HWCFG_M_2 = 1<<22, /* HWCFG_MODE[2] */ | ||
1742 | GPC_HWCFG_M_1 = 1<<21, /* HWCFG_MODE[1] */ | ||
1743 | GPC_HWCFG_M_0 = 1<<20, /* HWCFG_MODE[0] */ | ||
1744 | GPC_ANEG_0 = 1<<19, /* ANEG[0] */ | ||
1745 | GPC_ENA_XC = 1<<18, /* Enable MDI crossover */ | ||
1746 | GPC_DIS_125 = 1<<17, /* Disable 125 MHz clock */ | ||
1747 | GPC_ANEG_3 = 1<<16, /* ANEG[3] */ | ||
1748 | GPC_ANEG_2 = 1<<15, /* ANEG[2] */ | ||
1749 | GPC_ANEG_1 = 1<<14, /* ANEG[1] */ | ||
1750 | GPC_ENA_PAUSE = 1<<13, /* Enable Pause (SYM_OR_REM) */ | ||
1751 | GPC_PHYADDR_4 = 1<<12, /* Bit 4 of Phy Addr */ | ||
1752 | GPC_PHYADDR_3 = 1<<11, /* Bit 3 of Phy Addr */ | ||
1753 | GPC_PHYADDR_2 = 1<<10, /* Bit 2 of Phy Addr */ | ||
1754 | GPC_PHYADDR_1 = 1<<9, /* Bit 1 of Phy Addr */ | ||
1755 | GPC_PHYADDR_0 = 1<<8, /* Bit 0 of Phy Addr */ | ||
1756 | /* Bits 7..2: reserved */ | ||
1757 | GPC_RST_CLR = 1<<1, /* Clear GPHY Reset */ | 1735 | GPC_RST_CLR = 1<<1, /* Clear GPHY Reset */ |
1758 | GPC_RST_SET = 1<<0, /* Set GPHY Reset */ | 1736 | GPC_RST_SET = 1<<0, /* Set GPHY Reset */ |
1759 | }; | 1737 | }; |
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c index 246fac0e8001..3df3c60263d4 100644 --- a/drivers/net/wireless/hostap/hostap_80211_tx.c +++ b/drivers/net/wireless/hostap/hostap_80211_tx.c | |||
@@ -311,7 +311,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
311 | local_info_t *local; | 311 | local_info_t *local; |
312 | struct ieee80211_hdr_4addr *hdr; | 312 | struct ieee80211_hdr_4addr *hdr; |
313 | u16 fc; | 313 | u16 fc; |
314 | int hdr_len, res; | 314 | int prefix_len, postfix_len, hdr_len, res; |
315 | 315 | ||
316 | iface = netdev_priv(skb->dev); | 316 | iface = netdev_priv(skb->dev); |
317 | local = iface->local; | 317 | local = iface->local; |
@@ -337,10 +337,13 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, | |||
337 | if (skb == NULL) | 337 | if (skb == NULL) |
338 | return NULL; | 338 | return NULL; |
339 | 339 | ||
340 | if ((skb_headroom(skb) < crypt->ops->extra_mpdu_prefix_len || | 340 | prefix_len = crypt->ops->extra_mpdu_prefix_len + |
341 | skb_tailroom(skb) < crypt->ops->extra_mpdu_postfix_len) && | 341 | crypt->ops->extra_msdu_prefix_len; |
342 | pskb_expand_head(skb, crypt->ops->extra_mpdu_prefix_len, | 342 | postfix_len = crypt->ops->extra_mpdu_postfix_len + |
343 | crypt->ops->extra_mpdu_postfix_len, GFP_ATOMIC)) { | 343 | crypt->ops->extra_msdu_postfix_len; |
344 | if ((skb_headroom(skb) < prefix_len || | ||
345 | skb_tailroom(skb) < postfix_len) && | ||
346 | pskb_expand_head(skb, prefix_len, postfix_len, GFP_ATOMIC)) { | ||
344 | kfree_skb(skb); | 347 | kfree_skb(skb); |
345 | return NULL; | 348 | return NULL; |
346 | } | 349 | } |
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c index dd070cccf324..f49eb068c7d0 100644 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ b/drivers/net/wireless/prism54/islpci_eth.c | |||
@@ -378,9 +378,10 @@ islpci_eth_receive(islpci_private *priv) | |||
378 | display_buffer((char *) skb->data, skb->len); | 378 | display_buffer((char *) skb->data, skb->len); |
379 | #endif | 379 | #endif |
380 | /* take care of monitor mode and spy monitoring. */ | 380 | /* take care of monitor mode and spy monitoring. */ |
381 | if (unlikely(priv->iw_mode == IW_MODE_MONITOR)) | 381 | if (unlikely(priv->iw_mode == IW_MODE_MONITOR)) { |
382 | skb->dev = ndev; | ||
382 | discard = islpci_monitor_rx(priv, &skb); | 383 | discard = islpci_monitor_rx(priv, &skb); |
383 | else { | 384 | } else { |
384 | if (unlikely(skb->data[2 * ETH_ALEN] == 0)) { | 385 | if (unlikely(skb->data[2 * ETH_ALEN] == 0)) { |
385 | /* The packet has a rx_annex. Read it for spy monitoring, Then | 386 | /* The packet has a rx_annex. Read it for spy monitoring, Then |
386 | * remove it, while keeping the 2 leading MAC addr. | 387 | * remove it, while keeping the 2 leading MAC addr. |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 6ccc2e95930a..1cff65fb9c43 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1625,18 +1625,20 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, | |||
1625 | quirk_nvidia_ck804_pcie_aer_ext_cap); | 1625 | quirk_nvidia_ck804_pcie_aer_ext_cap); |
1626 | 1626 | ||
1627 | #ifdef CONFIG_PCI_MSI | 1627 | #ifdef CONFIG_PCI_MSI |
1628 | /* The Serverworks PCI-X chipset does not support MSI. We cannot easily rely | 1628 | /* Some chipsets do not support MSI. We cannot easily rely on setting |
1629 | * on setting PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually | 1629 | * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually |
1630 | * some other busses controlled by the chipset even if Linux is not aware of it. | 1630 | * some other busses controlled by the chipset even if Linux is not |
1631 | * Instead of setting the flag on all busses in the machine, simply disable MSI | 1631 | * aware of it. Instead of setting the flag on all busses in the |
1632 | * globally. | 1632 | * machine, simply disable MSI globally. |
1633 | */ | 1633 | */ |
1634 | static void __init quirk_svw_msi(struct pci_dev *dev) | 1634 | static void __init quirk_disable_all_msi(struct pci_dev *dev) |
1635 | { | 1635 | { |
1636 | pci_no_msi(); | 1636 | pci_no_msi(); |
1637 | printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n"); | 1637 | printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n"); |
1638 | } | 1638 | } |
1639 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_svw_msi); | 1639 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi); |
1640 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi); | ||
1641 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi); | ||
1640 | 1642 | ||
1641 | /* Disable MSI on chipsets that are known to not support it */ | 1643 | /* Disable MSI on chipsets that are known to not support it */ |
1642 | static void __devinit quirk_disable_msi(struct pci_dev *dev) | 1644 | static void __devinit quirk_disable_msi(struct pci_dev *dev) |
@@ -1649,8 +1651,6 @@ static void __devinit quirk_disable_msi(struct pci_dev *dev) | |||
1649 | } | 1651 | } |
1650 | } | 1652 | } |
1651 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi); | 1653 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi); |
1652 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_msi); | ||
1653 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_msi); | ||
1654 | 1654 | ||
1655 | /* Go through the list of Hypertransport capabilities and | 1655 | /* Go through the list of Hypertransport capabilities and |
1656 | * return 1 if a HT MSI capability is found and enabled */ | 1656 | * return 1 if a HT MSI capability is found and enabled */ |
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c index 948efc775a78..eb6abd3f9221 100644 --- a/drivers/pcmcia/at91_cf.c +++ b/drivers/pcmcia/at91_cf.c | |||
@@ -336,16 +336,21 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
336 | enable_irq_wake(board->det_pin); | 336 | enable_irq_wake(board->det_pin); |
337 | if (board->irq_pin) | 337 | if (board->irq_pin) |
338 | enable_irq_wake(board->irq_pin); | 338 | enable_irq_wake(board->irq_pin); |
339 | } else { | ||
340 | disable_irq_wake(board->det_pin); | ||
341 | if (board->irq_pin) | ||
342 | disable_irq_wake(board->irq_pin); | ||
343 | } | 339 | } |
344 | return 0; | 340 | return 0; |
345 | } | 341 | } |
346 | 342 | ||
347 | static int at91_cf_resume(struct platform_device *pdev) | 343 | static int at91_cf_resume(struct platform_device *pdev) |
348 | { | 344 | { |
345 | struct at91_cf_socket *cf = platform_get_drvdata(pdev); | ||
346 | struct at91_cf_data *board = cf->board; | ||
347 | |||
348 | if (device_may_wakeup(&pdev->dev)) { | ||
349 | disable_irq_wake(board->det_pin); | ||
350 | if (board->irq_pin) | ||
351 | disable_irq_wake(board->irq_pin); | ||
352 | } | ||
353 | |||
349 | pcmcia_socket_dev_resume(&pdev->dev); | 354 | pcmcia_socket_dev_resume(&pdev->dev); |
350 | return 0; | 355 | return 0; |
351 | } | 356 | } |
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c index a1dc8c466ec9..0c081a664ee8 100644 --- a/drivers/s390/block/dasd_eer.c +++ b/drivers/s390/block/dasd_eer.c | |||
@@ -14,9 +14,9 @@ | |||
14 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/poll.h> | 16 | #include <linux/poll.h> |
17 | #include <linux/mutex.h> | ||
17 | 18 | ||
18 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
19 | #include <asm/semaphore.h> | ||
20 | #include <asm/atomic.h> | 20 | #include <asm/atomic.h> |
21 | #include <asm/ebcdic.h> | 21 | #include <asm/ebcdic.h> |
22 | 22 | ||
@@ -514,7 +514,7 @@ void dasd_eer_disable(struct dasd_device *device) | |||
514 | * to transfer in a readbuffer, which is protected by the readbuffer_mutex. | 514 | * to transfer in a readbuffer, which is protected by the readbuffer_mutex. |
515 | */ | 515 | */ |
516 | static char readbuffer[PAGE_SIZE]; | 516 | static char readbuffer[PAGE_SIZE]; |
517 | static DECLARE_MUTEX(readbuffer_mutex); | 517 | static DEFINE_MUTEX(readbuffer_mutex); |
518 | 518 | ||
519 | static int dasd_eer_open(struct inode *inp, struct file *filp) | 519 | static int dasd_eer_open(struct inode *inp, struct file *filp) |
520 | { | 520 | { |
@@ -579,7 +579,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf, | |||
579 | struct eerbuffer *eerb; | 579 | struct eerbuffer *eerb; |
580 | 580 | ||
581 | eerb = (struct eerbuffer *) filp->private_data; | 581 | eerb = (struct eerbuffer *) filp->private_data; |
582 | if (down_interruptible(&readbuffer_mutex)) | 582 | if (mutex_lock_interruptible(&readbuffer_mutex)) |
583 | return -ERESTARTSYS; | 583 | return -ERESTARTSYS; |
584 | 584 | ||
585 | spin_lock_irqsave(&bufferlock, flags); | 585 | spin_lock_irqsave(&bufferlock, flags); |
@@ -588,7 +588,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf, | |||
588 | /* has been deleted */ | 588 | /* has been deleted */ |
589 | eerb->residual = 0; | 589 | eerb->residual = 0; |
590 | spin_unlock_irqrestore(&bufferlock, flags); | 590 | spin_unlock_irqrestore(&bufferlock, flags); |
591 | up(&readbuffer_mutex); | 591 | mutex_unlock(&readbuffer_mutex); |
592 | return -EIO; | 592 | return -EIO; |
593 | } else if (eerb->residual > 0) { | 593 | } else if (eerb->residual > 0) { |
594 | /* OK we still have a second half of a record to deliver */ | 594 | /* OK we still have a second half of a record to deliver */ |
@@ -602,7 +602,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf, | |||
602 | if (!tc) { | 602 | if (!tc) { |
603 | /* no data available */ | 603 | /* no data available */ |
604 | spin_unlock_irqrestore(&bufferlock, flags); | 604 | spin_unlock_irqrestore(&bufferlock, flags); |
605 | up(&readbuffer_mutex); | 605 | mutex_unlock(&readbuffer_mutex); |
606 | if (filp->f_flags & O_NONBLOCK) | 606 | if (filp->f_flags & O_NONBLOCK) |
607 | return -EAGAIN; | 607 | return -EAGAIN; |
608 | rc = wait_event_interruptible( | 608 | rc = wait_event_interruptible( |
@@ -610,7 +610,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf, | |||
610 | eerb->head != eerb->tail); | 610 | eerb->head != eerb->tail); |
611 | if (rc) | 611 | if (rc) |
612 | return rc; | 612 | return rc; |
613 | if (down_interruptible(&readbuffer_mutex)) | 613 | if (mutex_lock_interruptible(&readbuffer_mutex)) |
614 | return -ERESTARTSYS; | 614 | return -ERESTARTSYS; |
615 | spin_lock_irqsave(&bufferlock, flags); | 615 | spin_lock_irqsave(&bufferlock, flags); |
616 | } | 616 | } |
@@ -626,11 +626,11 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf, | |||
626 | spin_unlock_irqrestore(&bufferlock, flags); | 626 | spin_unlock_irqrestore(&bufferlock, flags); |
627 | 627 | ||
628 | if (copy_to_user(buf, readbuffer, effective_count)) { | 628 | if (copy_to_user(buf, readbuffer, effective_count)) { |
629 | up(&readbuffer_mutex); | 629 | mutex_unlock(&readbuffer_mutex); |
630 | return -EFAULT; | 630 | return -EFAULT; |
631 | } | 631 | } |
632 | 632 | ||
633 | up(&readbuffer_mutex); | 633 | mutex_unlock(&readbuffer_mutex); |
634 | return effective_count; | 634 | return effective_count; |
635 | } | 635 | } |
636 | 636 | ||
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index f6ef90ee3e7d..743944ad61ec 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -487,7 +487,7 @@ struct raw3270_ua { /* Query Reply structure for Usable Area */ | |||
487 | } __attribute__ ((packed)); | 487 | } __attribute__ ((packed)); |
488 | 488 | ||
489 | static struct diag210 raw3270_init_diag210; | 489 | static struct diag210 raw3270_init_diag210; |
490 | static DECLARE_MUTEX(raw3270_init_sem); | 490 | static DEFINE_MUTEX(raw3270_init_mutex); |
491 | 491 | ||
492 | static int | 492 | static int |
493 | raw3270_init_irq(struct raw3270_view *view, struct raw3270_request *rq, | 493 | raw3270_init_irq(struct raw3270_view *view, struct raw3270_request *rq, |
@@ -713,7 +713,7 @@ raw3270_size_device(struct raw3270 *rp) | |||
713 | { | 713 | { |
714 | int rc; | 714 | int rc; |
715 | 715 | ||
716 | down(&raw3270_init_sem); | 716 | mutex_lock(&raw3270_init_mutex); |
717 | rp->view = &raw3270_init_view; | 717 | rp->view = &raw3270_init_view; |
718 | raw3270_init_view.dev = rp; | 718 | raw3270_init_view.dev = rp; |
719 | if (MACHINE_IS_VM) | 719 | if (MACHINE_IS_VM) |
@@ -722,7 +722,7 @@ raw3270_size_device(struct raw3270 *rp) | |||
722 | rc = __raw3270_size_device(rp); | 722 | rc = __raw3270_size_device(rp); |
723 | raw3270_init_view.dev = NULL; | 723 | raw3270_init_view.dev = NULL; |
724 | rp->view = NULL; | 724 | rp->view = NULL; |
725 | up(&raw3270_init_sem); | 725 | mutex_unlock(&raw3270_init_mutex); |
726 | if (rc == 0) { /* Found something. */ | 726 | if (rc == 0) { /* Found something. */ |
727 | /* Try to find a model. */ | 727 | /* Try to find a model. */ |
728 | rp->model = 0; | 728 | rp->model = 0; |
@@ -749,7 +749,7 @@ raw3270_reset_device(struct raw3270 *rp) | |||
749 | { | 749 | { |
750 | int rc; | 750 | int rc; |
751 | 751 | ||
752 | down(&raw3270_init_sem); | 752 | mutex_lock(&raw3270_init_mutex); |
753 | memset(&rp->init_request, 0, sizeof(rp->init_request)); | 753 | memset(&rp->init_request, 0, sizeof(rp->init_request)); |
754 | memset(&rp->init_data, 0, sizeof(rp->init_data)); | 754 | memset(&rp->init_data, 0, sizeof(rp->init_data)); |
755 | /* Store reset data stream to init_data/init_request */ | 755 | /* Store reset data stream to init_data/init_request */ |
@@ -764,7 +764,7 @@ raw3270_reset_device(struct raw3270 *rp) | |||
764 | rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); | 764 | rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); |
765 | raw3270_init_view.dev = NULL; | 765 | raw3270_init_view.dev = NULL; |
766 | rp->view = NULL; | 766 | rp->view = NULL; |
767 | up(&raw3270_init_sem); | 767 | mutex_unlock(&raw3270_init_mutex); |
768 | return rc; | 768 | return rc; |
769 | } | 769 | } |
770 | 770 | ||
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index a8b373f69cf0..6b264bdb5bfb 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -296,30 +296,57 @@ static void ccw_device_unregister(struct ccw_device *cdev) | |||
296 | device_del(&cdev->dev); | 296 | device_del(&cdev->dev); |
297 | } | 297 | } |
298 | 298 | ||
299 | static void ccw_device_remove_orphan_cb(struct device *dev) | ||
300 | { | ||
301 | struct ccw_device *cdev = to_ccwdev(dev); | ||
302 | |||
303 | ccw_device_unregister(cdev); | ||
304 | put_device(&cdev->dev); | ||
305 | } | ||
306 | |||
307 | static void ccw_device_remove_sch_cb(struct device *dev) | ||
308 | { | ||
309 | struct subchannel *sch; | ||
310 | |||
311 | sch = to_subchannel(dev); | ||
312 | css_sch_device_unregister(sch); | ||
313 | /* Reset intparm to zeroes. */ | ||
314 | sch->schib.pmcw.intparm = 0; | ||
315 | cio_modify(sch); | ||
316 | put_device(&sch->dev); | ||
317 | } | ||
318 | |||
299 | static void | 319 | static void |
300 | ccw_device_remove_disconnected(struct ccw_device *cdev) | 320 | ccw_device_remove_disconnected(struct ccw_device *cdev) |
301 | { | 321 | { |
302 | struct subchannel *sch; | ||
303 | unsigned long flags; | 322 | unsigned long flags; |
323 | int rc; | ||
324 | |||
304 | /* | 325 | /* |
305 | * Forced offline in disconnected state means | 326 | * Forced offline in disconnected state means |
306 | * 'throw away device'. | 327 | * 'throw away device'. |
307 | */ | 328 | */ |
308 | if (ccw_device_is_orphan(cdev)) { | 329 | if (ccw_device_is_orphan(cdev)) { |
309 | /* Deregister ccw device. */ | 330 | /* |
331 | * Deregister ccw device. | ||
332 | * Unfortunately, we cannot do this directly from the | ||
333 | * attribute method. | ||
334 | */ | ||
310 | spin_lock_irqsave(cdev->ccwlock, flags); | 335 | spin_lock_irqsave(cdev->ccwlock, flags); |
311 | cdev->private->state = DEV_STATE_NOT_OPER; | 336 | cdev->private->state = DEV_STATE_NOT_OPER; |
312 | spin_unlock_irqrestore(cdev->ccwlock, flags); | 337 | spin_unlock_irqrestore(cdev->ccwlock, flags); |
313 | ccw_device_unregister(cdev); | 338 | rc = device_schedule_callback(&cdev->dev, |
314 | put_device(&cdev->dev); | 339 | ccw_device_remove_orphan_cb); |
315 | return ; | 340 | if (rc) |
341 | dev_info(&cdev->dev, "Couldn't unregister orphan\n"); | ||
342 | return; | ||
316 | } | 343 | } |
317 | sch = to_subchannel(cdev->dev.parent); | 344 | /* Deregister subchannel, which will kill the ccw device. */ |
318 | css_sch_device_unregister(sch); | 345 | rc = device_schedule_callback(cdev->dev.parent, |
319 | /* Reset intparm to zeroes. */ | 346 | ccw_device_remove_sch_cb); |
320 | sch->schib.pmcw.intparm = 0; | 347 | if (rc) |
321 | cio_modify(sch); | 348 | dev_info(&cdev->dev, |
322 | put_device(&sch->dev); | 349 | "Couldn't unregister disconnected device\n"); |
323 | } | 350 | } |
324 | 351 | ||
325 | int | 352 | int |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 898ec3b2bebb..6bba80929577 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -688,6 +688,12 @@ ccw_device_disband_done(struct ccw_device *cdev, int err) | |||
688 | ccw_device_done(cdev, DEV_STATE_BOXED); | 688 | ccw_device_done(cdev, DEV_STATE_BOXED); |
689 | break; | 689 | break; |
690 | default: | 690 | default: |
691 | cdev->private->flags.donotify = 0; | ||
692 | if (get_device(&cdev->dev)) { | ||
693 | PREPARE_WORK(&cdev->private->kick_work, | ||
694 | ccw_device_call_sch_unregister); | ||
695 | queue_work(ccw_device_work, &cdev->private->kick_work); | ||
696 | } | ||
691 | ccw_device_done(cdev, DEV_STATE_NOT_OPER); | 697 | ccw_device_done(cdev, DEV_STATE_NOT_OPER); |
692 | break; | 698 | break; |
693 | } | 699 | } |
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index ddff40c4212c..821cde65e369 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -1127,6 +1127,7 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter) | |||
1127 | int retval = 0; | 1127 | int retval = 0; |
1128 | unsigned long flags; | 1128 | unsigned long flags; |
1129 | 1129 | ||
1130 | zfcp_adapter_scsi_unregister(adapter); | ||
1130 | device_unregister(&adapter->generic_services); | 1131 | device_unregister(&adapter->generic_services); |
1131 | zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev); | 1132 | zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev); |
1132 | dev_set_drvdata(&adapter->ccw_device->dev, NULL); | 1133 | dev_set_drvdata(&adapter->ccw_device->dev, NULL); |
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c index 81680efa1721..1c8f71a59855 100644 --- a/drivers/s390/scsi/zfcp_ccw.c +++ b/drivers/s390/scsi/zfcp_ccw.c | |||
@@ -189,9 +189,7 @@ zfcp_ccw_set_online(struct ccw_device *ccw_device) | |||
189 | * @ccw_device: pointer to belonging ccw device | 189 | * @ccw_device: pointer to belonging ccw device |
190 | * | 190 | * |
191 | * This function gets called by the common i/o layer and sets an adapter | 191 | * This function gets called by the common i/o layer and sets an adapter |
192 | * into state offline. Setting an fcp device offline means that it will be | 192 | * into state offline. |
193 | * unregistered from the SCSI stack and that the adapter will be shut down | ||
194 | * asynchronously. | ||
195 | */ | 193 | */ |
196 | static int | 194 | static int |
197 | zfcp_ccw_set_offline(struct ccw_device *ccw_device) | 195 | zfcp_ccw_set_offline(struct ccw_device *ccw_device) |
@@ -202,7 +200,6 @@ zfcp_ccw_set_offline(struct ccw_device *ccw_device) | |||
202 | adapter = dev_get_drvdata(&ccw_device->dev); | 200 | adapter = dev_get_drvdata(&ccw_device->dev); |
203 | zfcp_erp_adapter_shutdown(adapter, 0); | 201 | zfcp_erp_adapter_shutdown(adapter, 0); |
204 | zfcp_erp_wait(adapter); | 202 | zfcp_erp_wait(adapter); |
205 | zfcp_adapter_scsi_unregister(adapter); | ||
206 | zfcp_erp_thread_kill(adapter); | 203 | zfcp_erp_thread_kill(adapter); |
207 | zfcp_adapter_debug_unregister(adapter); | 204 | zfcp_adapter_debug_unregister(adapter); |
208 | up(&zfcp_data.config_sema); | 205 | up(&zfcp_data.config_sema); |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index a8b02542ac2d..0eb31e162b15 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -156,44 +156,30 @@ zfcp_fsf_req_free(struct zfcp_fsf_req *fsf_req) | |||
156 | kfree(fsf_req); | 156 | kfree(fsf_req); |
157 | } | 157 | } |
158 | 158 | ||
159 | /** | 159 | /* |
160 | * zfcp_fsf_req_dismiss - dismiss a single fsf request | 160 | * Never ever call this without shutting down the adapter first. |
161 | */ | 161 | * Otherwise the adapter would continue using and corrupting s390 storage. |
162 | static void zfcp_fsf_req_dismiss(struct zfcp_adapter *adapter, | 162 | * Included BUG_ON() call to ensure this is done. |
163 | struct zfcp_fsf_req *fsf_req, | 163 | * ERP is supposed to be the only user of this function. |
164 | unsigned int counter) | ||
165 | { | ||
166 | u64 dbg_tmp[2]; | ||
167 | |||
168 | dbg_tmp[0] = (u64) atomic_read(&adapter->reqs_active); | ||
169 | dbg_tmp[1] = (u64) counter; | ||
170 | debug_event(adapter->erp_dbf, 4, (void *) dbg_tmp, 16); | ||
171 | list_del(&fsf_req->list); | ||
172 | fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED; | ||
173 | zfcp_fsf_req_complete(fsf_req); | ||
174 | } | ||
175 | |||
176 | /** | ||
177 | * zfcp_fsf_req_dismiss_all - dismiss all remaining fsf requests | ||
178 | */ | 164 | */ |
179 | void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter) | 165 | void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter) |
180 | { | 166 | { |
181 | struct zfcp_fsf_req *request, *tmp; | 167 | struct zfcp_fsf_req *fsf_req, *tmp; |
182 | unsigned long flags; | 168 | unsigned long flags; |
183 | LIST_HEAD(remove_queue); | 169 | LIST_HEAD(remove_queue); |
184 | unsigned int i, counter; | 170 | unsigned int i; |
185 | 171 | ||
172 | BUG_ON(atomic_test_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status)); | ||
186 | spin_lock_irqsave(&adapter->req_list_lock, flags); | 173 | spin_lock_irqsave(&adapter->req_list_lock, flags); |
187 | atomic_set(&adapter->reqs_active, 0); | 174 | atomic_set(&adapter->reqs_active, 0); |
188 | for (i=0; i<REQUEST_LIST_SIZE; i++) | 175 | for (i = 0; i < REQUEST_LIST_SIZE; i++) |
189 | list_splice_init(&adapter->req_list[i], &remove_queue); | 176 | list_splice_init(&adapter->req_list[i], &remove_queue); |
190 | |||
191 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); | 177 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); |
192 | 178 | ||
193 | counter = 0; | 179 | list_for_each_entry_safe(fsf_req, tmp, &remove_queue, list) { |
194 | list_for_each_entry_safe(request, tmp, &remove_queue, list) { | 180 | list_del(&fsf_req->list); |
195 | zfcp_fsf_req_dismiss(adapter, request, counter); | 181 | fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED; |
196 | counter++; | 182 | zfcp_fsf_req_complete(fsf_req); |
197 | } | 183 | } |
198 | } | 184 | } |
199 | 185 | ||
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 16e2d64658af..0acf6db0a08d 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -569,6 +569,9 @@ zfcp_adapter_scsi_register(struct zfcp_adapter *adapter) | |||
569 | int retval = 0; | 569 | int retval = 0; |
570 | static unsigned int unique_id = 0; | 570 | static unsigned int unique_id = 0; |
571 | 571 | ||
572 | if (adapter->scsi_host) | ||
573 | goto out; | ||
574 | |||
572 | /* register adapter as SCSI host with mid layer of SCSI stack */ | 575 | /* register adapter as SCSI host with mid layer of SCSI stack */ |
573 | adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template, | 576 | adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template, |
574 | sizeof (struct zfcp_adapter *)); | 577 | sizeof (struct zfcp_adapter *)); |
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c index 262f01e68592..44e039865aa9 100644 --- a/drivers/sbus/char/flash.c +++ b/drivers/sbus/char/flash.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/smp_lock.h> | 15 | #include <linux/smp_lock.h> |
16 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
17 | #include <linux/mm.h> | ||
17 | 18 | ||
18 | #include <asm/system.h> | 19 | #include <asm/system.h> |
19 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index d28c14e23c32..572034ceb143 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -1753,23 +1753,9 @@ config SUN3X_ESP | |||
1753 | The ESP was an on-board SCSI controller used on Sun 3/80 | 1753 | The ESP was an on-board SCSI controller used on Sun 3/80 |
1754 | machines. Say Y here to compile in support for it. | 1754 | machines. Say Y here to compile in support for it. |
1755 | 1755 | ||
1756 | config SCSI_ESP_CORE | ||
1757 | tristate "ESP Scsi Driver Core" | ||
1758 | depends on SCSI | ||
1759 | select SCSI_SPI_ATTRS | ||
1760 | help | ||
1761 | This is a core driver for NCR53c9x based scsi chipsets, | ||
1762 | also known as "ESP" for Emulex Scsi Processor or | ||
1763 | Enhanced Scsi Processor. This driver does not exist by | ||
1764 | itself, there are front-end drivers which, when enabled, | ||
1765 | select and enable this driver. One example is SCSI_SUNESP. | ||
1766 | These front-end drivers provide probing, DMA, and register | ||
1767 | access support for the core driver. | ||
1768 | |||
1769 | config SCSI_SUNESP | 1756 | config SCSI_SUNESP |
1770 | tristate "Sparc ESP Scsi Driver" | 1757 | tristate "Sparc ESP Scsi Driver" |
1771 | depends on SBUS && SCSI | 1758 | depends on SBUS && SCSI |
1772 | select SCSI_ESP_CORE | ||
1773 | help | 1759 | help |
1774 | This is the driver for the Sun ESP SCSI host adapter. The ESP | 1760 | This is the driver for the Sun ESP SCSI host adapter. The ESP |
1775 | chipset is present in most SPARC SBUS-based computers. | 1761 | chipset is present in most SPARC SBUS-based computers. |
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 51e884fa10b0..b1b632791580 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile | |||
@@ -106,8 +106,7 @@ obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o | |||
106 | obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ | 106 | obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ |
107 | obj-$(CONFIG_MEGARAID_SAS) += megaraid/ | 107 | obj-$(CONFIG_MEGARAID_SAS) += megaraid/ |
108 | obj-$(CONFIG_SCSI_ACARD) += atp870u.o | 108 | obj-$(CONFIG_SCSI_ACARD) += atp870u.o |
109 | obj-$(CONFIG_SCSI_ESP_CORE) += esp_scsi.o | 109 | obj-$(CONFIG_SCSI_SUNESP) += esp_scsi.o sun_esp.o |
110 | obj-$(CONFIG_SCSI_SUNESP) += sun_esp.o | ||
111 | obj-$(CONFIG_SCSI_GDTH) += gdth.o | 110 | obj-$(CONFIG_SCSI_GDTH) += gdth.o |
112 | obj-$(CONFIG_SCSI_INITIO) += initio.o | 111 | obj-$(CONFIG_SCSI_INITIO) += initio.o |
113 | obj-$(CONFIG_SCSI_INIA100) += a100u2w.o | 112 | obj-$(CONFIG_SCSI_INIA100) += a100u2w.o |
@@ -121,7 +120,7 @@ obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o | |||
121 | obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o | 120 | obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o |
122 | obj-$(CONFIG_SCSI_PPA) += ppa.o | 121 | obj-$(CONFIG_SCSI_PPA) += ppa.o |
123 | obj-$(CONFIG_SCSI_IMM) += imm.o | 122 | obj-$(CONFIG_SCSI_IMM) += imm.o |
124 | obj-$(CONFIG_JAZZ_ESP) += NCR53C9x.o jazz_esp.o | 123 | obj-$(CONFIG_JAZZ_ESP) += esp_scsi.o jazz_esp.o |
125 | obj-$(CONFIG_SUN3X_ESP) += NCR53C9x.o sun3x_esp.o | 124 | obj-$(CONFIG_SUN3X_ESP) += NCR53C9x.o sun3x_esp.o |
126 | obj-$(CONFIG_SCSI_FCAL) += fcal.o | 125 | obj-$(CONFIG_SCSI_FCAL) += fcal.o |
127 | obj-$(CONFIG_SCSI_LASI700) += 53c700.o lasi700.o | 126 | obj-$(CONFIG_SCSI_LASI700) += 53c700.o lasi700.o |
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 1e82c69b36b0..8dcfe4ec35c2 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -146,7 +146,7 @@ static char *aac_get_status_string(u32 status); | |||
146 | static int nondasd = -1; | 146 | static int nondasd = -1; |
147 | static int dacmode = -1; | 147 | static int dacmode = -1; |
148 | 148 | ||
149 | static int commit = -1; | 149 | int aac_commit = -1; |
150 | int startup_timeout = 180; | 150 | int startup_timeout = 180; |
151 | int aif_timeout = 120; | 151 | int aif_timeout = 120; |
152 | 152 | ||
@@ -154,7 +154,7 @@ module_param(nondasd, int, S_IRUGO|S_IWUSR); | |||
154 | MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); | 154 | MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); |
155 | module_param(dacmode, int, S_IRUGO|S_IWUSR); | 155 | module_param(dacmode, int, S_IRUGO|S_IWUSR); |
156 | MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); | 156 | MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); |
157 | module_param(commit, int, S_IRUGO|S_IWUSR); | 157 | module_param_named(commit, aac_commit, int, S_IRUGO|S_IWUSR); |
158 | MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on"); | 158 | MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on"); |
159 | module_param(startup_timeout, int, S_IRUGO|S_IWUSR); | 159 | module_param(startup_timeout, int, S_IRUGO|S_IWUSR); |
160 | MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for adapter to have it's kernel up and\nrunning. This is typically adjusted for large systems that do not have a BIOS."); | 160 | MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for adapter to have it's kernel up and\nrunning. This is typically adjusted for large systems that do not have a BIOS."); |
@@ -173,6 +173,9 @@ int expose_physicals = -1; | |||
173 | module_param(expose_physicals, int, S_IRUGO|S_IWUSR); | 173 | module_param(expose_physicals, int, S_IRUGO|S_IWUSR); |
174 | MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); | 174 | MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); |
175 | 175 | ||
176 | int aac_reset_devices = 0; | ||
177 | module_param_named(reset_devices, aac_reset_devices, int, S_IRUGO|S_IWUSR); | ||
178 | MODULE_PARM_DESC(reset_devices, "Force an adapter reset at initialization."); | ||
176 | 179 | ||
177 | static inline int aac_valid_context(struct scsi_cmnd *scsicmd, | 180 | static inline int aac_valid_context(struct scsi_cmnd *scsicmd, |
178 | struct fib *fibptr) { | 181 | struct fib *fibptr) { |
@@ -246,7 +249,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) | |||
246 | aac_fib_complete(fibptr); | 249 | aac_fib_complete(fibptr); |
247 | /* Send a CT_COMMIT_CONFIG to enable discovery of devices */ | 250 | /* Send a CT_COMMIT_CONFIG to enable discovery of devices */ |
248 | if (status >= 0) { | 251 | if (status >= 0) { |
249 | if ((commit == 1) || commit_flag) { | 252 | if ((aac_commit == 1) || commit_flag) { |
250 | struct aac_commit_config * dinfo; | 253 | struct aac_commit_config * dinfo; |
251 | aac_fib_init(fibptr); | 254 | aac_fib_init(fibptr); |
252 | dinfo = (struct aac_commit_config *) fib_data(fibptr); | 255 | dinfo = (struct aac_commit_config *) fib_data(fibptr); |
@@ -261,7 +264,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) | |||
261 | 1, 1, | 264 | 1, 1, |
262 | NULL, NULL); | 265 | NULL, NULL); |
263 | aac_fib_complete(fibptr); | 266 | aac_fib_complete(fibptr); |
264 | } else if (commit == 0) { | 267 | } else if (aac_commit == 0) { |
265 | printk(KERN_WARNING | 268 | printk(KERN_WARNING |
266 | "aac_get_config_status: Foreign device configurations are being ignored\n"); | 269 | "aac_get_config_status: Foreign device configurations are being ignored\n"); |
267 | } | 270 | } |
@@ -340,7 +343,7 @@ int aac_get_containers(struct aac_dev *dev) | |||
340 | static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len) | 343 | static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len) |
341 | { | 344 | { |
342 | void *buf; | 345 | void *buf; |
343 | unsigned int transfer_len; | 346 | int transfer_len; |
344 | struct scatterlist *sg = scsicmd->request_buffer; | 347 | struct scatterlist *sg = scsicmd->request_buffer; |
345 | 348 | ||
346 | if (scsicmd->use_sg) { | 349 | if (scsicmd->use_sg) { |
@@ -351,7 +354,7 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne | |||
351 | transfer_len = min(scsicmd->request_bufflen, len + offset); | 354 | transfer_len = min(scsicmd->request_bufflen, len + offset); |
352 | } | 355 | } |
353 | transfer_len -= offset; | 356 | transfer_len -= offset; |
354 | if (buf && transfer_len) | 357 | if (buf && transfer_len > 0) |
355 | memcpy(buf + offset, data, transfer_len); | 358 | memcpy(buf + offset, data, transfer_len); |
356 | 359 | ||
357 | if (scsicmd->use_sg) | 360 | if (scsicmd->use_sg) |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 45ca3e801619..c81edf36913f 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -1823,9 +1823,12 @@ int aac_send_shutdown(struct aac_dev *dev); | |||
1823 | int aac_probe_container(struct aac_dev *dev, int cid); | 1823 | int aac_probe_container(struct aac_dev *dev, int cid); |
1824 | int _aac_rx_init(struct aac_dev *dev); | 1824 | int _aac_rx_init(struct aac_dev *dev); |
1825 | int aac_rx_select_comm(struct aac_dev *dev, int comm); | 1825 | int aac_rx_select_comm(struct aac_dev *dev, int comm); |
1826 | int aac_rx_deliver_producer(struct fib * fib); | ||
1826 | extern int numacb; | 1827 | extern int numacb; |
1827 | extern int acbsize; | 1828 | extern int acbsize; |
1828 | extern char aac_driver_version[]; | 1829 | extern char aac_driver_version[]; |
1829 | extern int startup_timeout; | 1830 | extern int startup_timeout; |
1830 | extern int aif_timeout; | 1831 | extern int aif_timeout; |
1831 | extern int expose_physicals; | 1832 | extern int expose_physicals; |
1833 | extern int aac_reset_devices; | ||
1834 | extern int aac_commit; | ||
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index 291cd14f4e98..ae978a373c56 100644 --- a/drivers/scsi/aacraid/rx.c +++ b/drivers/scsi/aacraid/rx.c | |||
@@ -378,7 +378,7 @@ static int aac_rx_check_health(struct aac_dev *dev) | |||
378 | * | 378 | * |
379 | * Will send a fib, returning 0 if successful. | 379 | * Will send a fib, returning 0 if successful. |
380 | */ | 380 | */ |
381 | static int aac_rx_deliver_producer(struct fib * fib) | 381 | int aac_rx_deliver_producer(struct fib * fib) |
382 | { | 382 | { |
383 | struct aac_dev *dev = fib->dev; | 383 | struct aac_dev *dev = fib->dev; |
384 | struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue]; | 384 | struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue]; |
@@ -488,6 +488,8 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int bled) | |||
488 | return -EINVAL; | 488 | return -EINVAL; |
489 | if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC) | 489 | if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC) |
490 | return -ENODEV; | 490 | return -ENODEV; |
491 | if (startup_timeout < 300) | ||
492 | startup_timeout = 300; | ||
491 | return 0; | 493 | return 0; |
492 | } | 494 | } |
493 | 495 | ||
@@ -542,7 +544,7 @@ int _aac_rx_init(struct aac_dev *dev) | |||
542 | dev->a_ops.adapter_sync_cmd = rx_sync_cmd; | 544 | dev->a_ops.adapter_sync_cmd = rx_sync_cmd; |
543 | dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt; | 545 | dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt; |
544 | dev->OIMR = status = rx_readb (dev, MUnit.OIMR); | 546 | dev->OIMR = status = rx_readb (dev, MUnit.OIMR); |
545 | if ((((status & 0x0c) != 0x0c) || reset_devices) && | 547 | if ((((status & 0x0c) != 0x0c) || aac_reset_devices || reset_devices) && |
546 | !aac_rx_restart_adapter(dev, 0)) | 548 | !aac_rx_restart_adapter(dev, 0)) |
547 | ++restart; | 549 | ++restart; |
548 | /* | 550 | /* |
@@ -594,6 +596,8 @@ int _aac_rx_init(struct aac_dev *dev) | |||
594 | } | 596 | } |
595 | msleep(1); | 597 | msleep(1); |
596 | } | 598 | } |
599 | if (restart) | ||
600 | aac_commit = 1; | ||
597 | /* | 601 | /* |
598 | * Fill in the common function dispatch table. | 602 | * Fill in the common function dispatch table. |
599 | */ | 603 | */ |
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c index f4b5e9742ab0..85b91bc578c9 100644 --- a/drivers/scsi/aacraid/sa.c +++ b/drivers/scsi/aacraid/sa.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * based on the old aacraid driver that is.. | 5 | * based on the old aacraid driver that is.. |
6 | * Adaptec aacraid device driver for Linux. | 6 | * Adaptec aacraid device driver for Linux. |
7 | * | 7 | * |
8 | * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) | 8 | * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com) |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
@@ -257,6 +257,11 @@ static void aac_sa_start_adapter(struct aac_dev *dev) | |||
257 | NULL, NULL, NULL, NULL, NULL); | 257 | NULL, NULL, NULL, NULL, NULL); |
258 | } | 258 | } |
259 | 259 | ||
260 | static int aac_sa_restart_adapter(struct aac_dev *dev, int bled) | ||
261 | { | ||
262 | return -EINVAL; | ||
263 | } | ||
264 | |||
260 | /** | 265 | /** |
261 | * aac_sa_check_health | 266 | * aac_sa_check_health |
262 | * @dev: device to check if healthy | 267 | * @dev: device to check if healthy |
@@ -366,7 +371,9 @@ int aac_sa_init(struct aac_dev *dev) | |||
366 | dev->a_ops.adapter_notify = aac_sa_notify_adapter; | 371 | dev->a_ops.adapter_notify = aac_sa_notify_adapter; |
367 | dev->a_ops.adapter_sync_cmd = sa_sync_cmd; | 372 | dev->a_ops.adapter_sync_cmd = sa_sync_cmd; |
368 | dev->a_ops.adapter_check_health = aac_sa_check_health; | 373 | dev->a_ops.adapter_check_health = aac_sa_check_health; |
374 | dev->a_ops.adapter_restart = aac_sa_restart_adapter; | ||
369 | dev->a_ops.adapter_intr = aac_sa_intr; | 375 | dev->a_ops.adapter_intr = aac_sa_intr; |
376 | dev->a_ops.adapter_deliver = aac_rx_deliver_producer; | ||
370 | dev->a_ops.adapter_ioremap = aac_sa_ioremap; | 377 | dev->a_ops.adapter_ioremap = aac_sa_ioremap; |
371 | 378 | ||
372 | /* | 379 | /* |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y index c328596def3c..6066998ed562 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y | |||
@@ -106,6 +106,7 @@ static void make_expression(expression_t *immed, int value); | |||
106 | static void add_conditional(symbol_t *symbol); | 106 | static void add_conditional(symbol_t *symbol); |
107 | static void add_version(const char *verstring); | 107 | static void add_version(const char *verstring); |
108 | static int is_download_const(expression_t *immed); | 108 | static int is_download_const(expression_t *immed); |
109 | void yyerror(const char *string); | ||
109 | 110 | ||
110 | #define SRAM_SYMNAME "SRAM_BASE" | 111 | #define SRAM_SYMNAME "SRAM_BASE" |
111 | #define SCB_SYMNAME "SCB_BASE" | 112 | #define SCB_SYMNAME "SCB_BASE" |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y index 439f760b34b5..ff46aa6801bf 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y | |||
@@ -65,6 +65,7 @@ | |||
65 | static symbol_t *macro_symbol; | 65 | static symbol_t *macro_symbol; |
66 | 66 | ||
67 | static void add_macro_arg(const char *argtext, int position); | 67 | static void add_macro_arg(const char *argtext, int position); |
68 | void mmerror(const char *string); | ||
68 | 69 | ||
69 | %} | 70 | %} |
70 | 71 | ||
diff --git a/drivers/scsi/aic94xx/aic94xx_tmf.c b/drivers/scsi/aic94xx/aic94xx_tmf.c index 9a14a6d97275..c0d0b7d7a8ce 100644 --- a/drivers/scsi/aic94xx/aic94xx_tmf.c +++ b/drivers/scsi/aic94xx/aic94xx_tmf.c | |||
@@ -290,6 +290,7 @@ static void asd_tmf_tasklet_complete(struct asd_ascb *ascb, | |||
290 | static inline int asd_clear_nexus(struct sas_task *task) | 290 | static inline int asd_clear_nexus(struct sas_task *task) |
291 | { | 291 | { |
292 | int res = TMF_RESP_FUNC_FAILED; | 292 | int res = TMF_RESP_FUNC_FAILED; |
293 | int leftover; | ||
293 | struct asd_ascb *tascb = task->lldd_task; | 294 | struct asd_ascb *tascb = task->lldd_task; |
294 | unsigned long flags; | 295 | unsigned long flags; |
295 | 296 | ||
@@ -298,10 +299,12 @@ static inline int asd_clear_nexus(struct sas_task *task) | |||
298 | res = asd_clear_nexus_tag(task); | 299 | res = asd_clear_nexus_tag(task); |
299 | else | 300 | else |
300 | res = asd_clear_nexus_index(task); | 301 | res = asd_clear_nexus_index(task); |
301 | wait_for_completion_timeout(&tascb->completion, | 302 | leftover = wait_for_completion_timeout(&tascb->completion, |
302 | AIC94XX_SCB_TIMEOUT); | 303 | AIC94XX_SCB_TIMEOUT); |
303 | ASD_DPRINTK("came back from clear nexus\n"); | 304 | ASD_DPRINTK("came back from clear nexus\n"); |
304 | spin_lock_irqsave(&task->task_state_lock, flags); | 305 | spin_lock_irqsave(&task->task_state_lock, flags); |
306 | if (leftover < 1) | ||
307 | res = TMF_RESP_FUNC_FAILED; | ||
305 | if (task->task_state_flags & SAS_TASK_STATE_DONE) | 308 | if (task->task_state_flags & SAS_TASK_STATE_DONE) |
306 | res = TMF_RESP_FUNC_COMPLETE; | 309 | res = TMF_RESP_FUNC_COMPLETE; |
307 | spin_unlock_irqrestore(&task->task_state_lock, flags); | 310 | spin_unlock_irqrestore(&task->task_state_lock, flags); |
@@ -350,6 +353,7 @@ int asd_abort_task(struct sas_task *task) | |||
350 | unsigned long flags; | 353 | unsigned long flags; |
351 | struct asd_ascb *ascb = NULL; | 354 | struct asd_ascb *ascb = NULL; |
352 | struct scb *scb; | 355 | struct scb *scb; |
356 | int leftover; | ||
353 | 357 | ||
354 | spin_lock_irqsave(&task->task_state_lock, flags); | 358 | spin_lock_irqsave(&task->task_state_lock, flags); |
355 | if (task->task_state_flags & SAS_TASK_STATE_DONE) { | 359 | if (task->task_state_flags & SAS_TASK_STATE_DONE) { |
@@ -455,9 +459,11 @@ int asd_abort_task(struct sas_task *task) | |||
455 | break; | 459 | break; |
456 | case TF_TMF_TASK_DONE + 0xFF00: /* done but not reported yet */ | 460 | case TF_TMF_TASK_DONE + 0xFF00: /* done but not reported yet */ |
457 | res = TMF_RESP_FUNC_FAILED; | 461 | res = TMF_RESP_FUNC_FAILED; |
458 | wait_for_completion_timeout(&tascb->completion, | 462 | leftover = wait_for_completion_timeout(&tascb->completion, |
459 | AIC94XX_SCB_TIMEOUT); | 463 | AIC94XX_SCB_TIMEOUT); |
460 | spin_lock_irqsave(&task->task_state_lock, flags); | 464 | spin_lock_irqsave(&task->task_state_lock, flags); |
465 | if (leftover < 1) | ||
466 | res = TMF_RESP_FUNC_FAILED; | ||
461 | if (task->task_state_flags & SAS_TASK_STATE_DONE) | 467 | if (task->task_state_flags & SAS_TASK_STATE_DONE) |
462 | res = TMF_RESP_FUNC_COMPLETE; | 468 | res = TMF_RESP_FUNC_COMPLETE; |
463 | spin_unlock_irqrestore(&task->task_state_lock, flags); | 469 | spin_unlock_irqrestore(&task->task_state_lock, flags); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 4baa79e68679..fa6ff295e568 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -3954,6 +3954,13 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd) | |||
3954 | spin_unlock_irq(scsi_cmd->device->host->host_lock); | 3954 | spin_unlock_irq(scsi_cmd->device->host->host_lock); |
3955 | ata_do_eh(ap, NULL, NULL, ipr_sata_reset, NULL); | 3955 | ata_do_eh(ap, NULL, NULL, ipr_sata_reset, NULL); |
3956 | spin_lock_irq(scsi_cmd->device->host->host_lock); | 3956 | spin_lock_irq(scsi_cmd->device->host->host_lock); |
3957 | |||
3958 | list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) { | ||
3959 | if (ipr_cmd->ioarcb.res_handle == res->cfgte.res_handle) { | ||
3960 | rc = -EIO; | ||
3961 | break; | ||
3962 | } | ||
3963 | } | ||
3957 | } else | 3964 | } else |
3958 | rc = ipr_device_reset(ioa_cfg, res); | 3965 | rc = ipr_device_reset(ioa_cfg, res); |
3959 | res->resetting_device = 0; | 3966 | res->resetting_device = 0; |
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c index 19dd4b962e18..81e497d9eae0 100644 --- a/drivers/scsi/jazz_esp.c +++ b/drivers/scsi/jazz_esp.c | |||
@@ -1,307 +1,244 @@ | |||
1 | /* | 1 | /* jazz_esp.c: ESP front-end for MIPS JAZZ systems. |
2 | * jazz_esp.c: Driver for SCSI chip on Mips Magnum Boards (JAZZ architecture) | ||
3 | * | 2 | * |
4 | * Copyright (C) 1997 Thomas Bogendoerfer (tsbogend@alpha.franken.de) | 3 | * Copyright (C) 2007 Thomas Bogendörfer (tsbogend@alpha.frankende) |
5 | * | ||
6 | * jazz_esp is based on David S. Miller's ESP driver and cyber_esp | ||
7 | */ | 4 | */ |
8 | 5 | ||
9 | #include <linux/init.h> | ||
10 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
11 | #include <linux/delay.h> | ||
12 | #include <linux/types.h> | 7 | #include <linux/types.h> |
13 | #include <linux/string.h> | 8 | #include <linux/module.h> |
14 | #include <linux/slab.h> | 9 | #include <linux/init.h> |
15 | #include <linux/blkdev.h> | 10 | #include <linux/interrupt.h> |
16 | #include <linux/proc_fs.h> | 11 | #include <linux/platform_device.h> |
17 | #include <linux/stat.h> | 12 | #include <linux/dma-mapping.h> |
18 | |||
19 | #include "scsi.h" | ||
20 | #include <scsi/scsi_host.h> | ||
21 | #include "NCR53C9x.h" | ||
22 | 13 | ||
23 | #include <asm/irq.h> | 14 | #include <asm/irq.h> |
15 | #include <asm/io.h> | ||
16 | #include <asm/dma.h> | ||
17 | |||
24 | #include <asm/jazz.h> | 18 | #include <asm/jazz.h> |
25 | #include <asm/jazzdma.h> | 19 | #include <asm/jazzdma.h> |
26 | #include <asm/dma.h> | ||
27 | 20 | ||
28 | #include <asm/pgtable.h> | 21 | #include <scsi/scsi_host.h> |
29 | |||
30 | static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count); | ||
31 | static int dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd *sp); | ||
32 | static void dma_dump_state(struct NCR_ESP *esp); | ||
33 | static void dma_init_read(struct NCR_ESP *esp, __u32 vaddress, int length); | ||
34 | static void dma_init_write(struct NCR_ESP *esp, __u32 vaddress, int length); | ||
35 | static void dma_ints_off(struct NCR_ESP *esp); | ||
36 | static void dma_ints_on(struct NCR_ESP *esp); | ||
37 | static int dma_irq_p(struct NCR_ESP *esp); | ||
38 | static int dma_ports_p(struct NCR_ESP *esp); | ||
39 | static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write); | ||
40 | static void dma_mmu_get_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp); | ||
41 | static void dma_mmu_get_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp); | ||
42 | static void dma_mmu_release_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp); | ||
43 | static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp); | ||
44 | static void dma_advance_sg (struct scsi_cmnd *sp); | ||
45 | static void dma_led_off(struct NCR_ESP *); | ||
46 | static void dma_led_on(struct NCR_ESP *); | ||
47 | |||
48 | |||
49 | static volatile unsigned char cmd_buffer[16]; | ||
50 | /* This is where all commands are put | ||
51 | * before they are trasfered to the ESP chip | ||
52 | * via PIO. | ||
53 | */ | ||
54 | |||
55 | static int jazz_esp_release(struct Scsi_Host *shost) | ||
56 | { | ||
57 | if (shost->irq) | ||
58 | free_irq(shost->irq, NULL); | ||
59 | if (shost->dma_channel != 0xff) | ||
60 | free_dma(shost->dma_channel); | ||
61 | if (shost->io_port && shost->n_io_port) | ||
62 | release_region(shost->io_port, shost->n_io_port); | ||
63 | scsi_unregister(shost); | ||
64 | return 0; | ||
65 | } | ||
66 | 22 | ||
67 | /***************************************************************** Detection */ | 23 | #include "esp_scsi.h" |
68 | static int jazz_esp_detect(struct scsi_host_template *tpnt) | ||
69 | { | ||
70 | struct NCR_ESP *esp; | ||
71 | struct ConfigDev *esp_dev; | ||
72 | |||
73 | /* | ||
74 | * first assumption it is there:-) | ||
75 | */ | ||
76 | if (1) { | ||
77 | esp_dev = NULL; | ||
78 | esp = esp_allocate(tpnt, esp_dev, 0); | ||
79 | |||
80 | /* Do command transfer with programmed I/O */ | ||
81 | esp->do_pio_cmds = 1; | ||
82 | |||
83 | /* Required functions */ | ||
84 | esp->dma_bytes_sent = &dma_bytes_sent; | ||
85 | esp->dma_can_transfer = &dma_can_transfer; | ||
86 | esp->dma_dump_state = &dma_dump_state; | ||
87 | esp->dma_init_read = &dma_init_read; | ||
88 | esp->dma_init_write = &dma_init_write; | ||
89 | esp->dma_ints_off = &dma_ints_off; | ||
90 | esp->dma_ints_on = &dma_ints_on; | ||
91 | esp->dma_irq_p = &dma_irq_p; | ||
92 | esp->dma_ports_p = &dma_ports_p; | ||
93 | esp->dma_setup = &dma_setup; | ||
94 | |||
95 | /* Optional functions */ | ||
96 | esp->dma_barrier = NULL; | ||
97 | esp->dma_drain = NULL; | ||
98 | esp->dma_invalidate = NULL; | ||
99 | esp->dma_irq_entry = NULL; | ||
100 | esp->dma_irq_exit = NULL; | ||
101 | esp->dma_poll = NULL; | ||
102 | esp->dma_reset = NULL; | ||
103 | esp->dma_led_off = &dma_led_off; | ||
104 | esp->dma_led_on = &dma_led_on; | ||
105 | |||
106 | /* virtual DMA functions */ | ||
107 | esp->dma_mmu_get_scsi_one = &dma_mmu_get_scsi_one; | ||
108 | esp->dma_mmu_get_scsi_sgl = &dma_mmu_get_scsi_sgl; | ||
109 | esp->dma_mmu_release_scsi_one = &dma_mmu_release_scsi_one; | ||
110 | esp->dma_mmu_release_scsi_sgl = &dma_mmu_release_scsi_sgl; | ||
111 | esp->dma_advance_sg = &dma_advance_sg; | ||
112 | |||
113 | |||
114 | /* SCSI chip speed */ | ||
115 | esp->cfreq = 40000000; | ||
116 | 24 | ||
117 | /* | 25 | #define DRV_MODULE_NAME "jazz_esp" |
118 | * we don't give the address of DMA channel, but the number | 26 | #define PFX DRV_MODULE_NAME ": " |
119 | * of DMA channel, so we can use the jazz DMA functions | 27 | #define DRV_VERSION "1.000" |
120 | * | 28 | #define DRV_MODULE_RELDATE "May 19, 2007" |
121 | */ | ||
122 | esp->dregs = (void *) JAZZ_SCSI_DMA; | ||
123 | |||
124 | /* ESP register base */ | ||
125 | esp->eregs = (struct ESP_regs *)(JAZZ_SCSI_BASE); | ||
126 | |||
127 | /* Set the command buffer */ | ||
128 | esp->esp_command = (volatile unsigned char *)cmd_buffer; | ||
129 | |||
130 | /* get virtual dma address for command buffer */ | ||
131 | esp->esp_command_dvma = vdma_alloc(CPHYSADDR(cmd_buffer), sizeof (cmd_buffer)); | ||
132 | |||
133 | esp->irq = JAZZ_SCSI_IRQ; | ||
134 | request_irq(JAZZ_SCSI_IRQ, esp_intr, IRQF_DISABLED, "JAZZ SCSI", | ||
135 | esp->ehost); | ||
136 | |||
137 | /* | ||
138 | * FIXME, look if the scsi id is available from NVRAM | ||
139 | */ | ||
140 | esp->scsi_id = 7; | ||
141 | |||
142 | /* Check for differential SCSI-bus */ | ||
143 | /* What is this stuff? */ | ||
144 | esp->diff = 0; | ||
145 | |||
146 | esp_initialize(esp); | ||
147 | |||
148 | printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps,esps_in_use); | ||
149 | esps_running = esps_in_use; | ||
150 | return esps_in_use; | ||
151 | } | ||
152 | return 0; | ||
153 | } | ||
154 | 29 | ||
155 | /************************************************************* DMA Functions */ | 30 | static void jazz_esp_write8(struct esp *esp, u8 val, unsigned long reg) |
156 | static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count) | ||
157 | { | 31 | { |
158 | return fifo_count; | 32 | *(volatile u8 *)(esp->regs + reg) = val; |
159 | } | 33 | } |
160 | 34 | ||
161 | static int dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd *sp) | 35 | static u8 jazz_esp_read8(struct esp *esp, unsigned long reg) |
162 | { | 36 | { |
163 | /* | 37 | return *(volatile u8 *)(esp->regs + reg); |
164 | * maximum DMA size is 1MB | ||
165 | */ | ||
166 | unsigned long sz = sp->SCp.this_residual; | ||
167 | if(sz > 0x100000) | ||
168 | sz = 0x100000; | ||
169 | return sz; | ||
170 | } | 38 | } |
171 | 39 | ||
172 | static void dma_dump_state(struct NCR_ESP *esp) | 40 | static dma_addr_t jazz_esp_map_single(struct esp *esp, void *buf, |
41 | size_t sz, int dir) | ||
173 | { | 42 | { |
174 | 43 | return dma_map_single(esp->dev, buf, sz, dir); | |
175 | ESPLOG(("esp%d: dma -- enable <%08x> residue <%08x\n", | ||
176 | esp->esp_id, vdma_get_enable((int)esp->dregs), vdma_get_residue((int)esp->dregs))); | ||
177 | } | 44 | } |
178 | 45 | ||
179 | static void dma_init_read(struct NCR_ESP *esp, __u32 vaddress, int length) | 46 | static int jazz_esp_map_sg(struct esp *esp, struct scatterlist *sg, |
47 | int num_sg, int dir) | ||
180 | { | 48 | { |
181 | dma_cache_wback_inv ((unsigned long)phys_to_virt(vdma_log2phys(vaddress)), length); | 49 | return dma_map_sg(esp->dev, sg, num_sg, dir); |
182 | vdma_disable ((int)esp->dregs); | ||
183 | vdma_set_mode ((int)esp->dregs, DMA_MODE_READ); | ||
184 | vdma_set_addr ((int)esp->dregs, vaddress); | ||
185 | vdma_set_count ((int)esp->dregs, length); | ||
186 | vdma_enable ((int)esp->dregs); | ||
187 | } | 50 | } |
188 | 51 | ||
189 | static void dma_init_write(struct NCR_ESP *esp, __u32 vaddress, int length) | 52 | static void jazz_esp_unmap_single(struct esp *esp, dma_addr_t addr, |
53 | size_t sz, int dir) | ||
190 | { | 54 | { |
191 | dma_cache_wback_inv ((unsigned long)phys_to_virt(vdma_log2phys(vaddress)), length); | 55 | dma_unmap_single(esp->dev, addr, sz, dir); |
192 | vdma_disable ((int)esp->dregs); | ||
193 | vdma_set_mode ((int)esp->dregs, DMA_MODE_WRITE); | ||
194 | vdma_set_addr ((int)esp->dregs, vaddress); | ||
195 | vdma_set_count ((int)esp->dregs, length); | ||
196 | vdma_enable ((int)esp->dregs); | ||
197 | } | 56 | } |
198 | 57 | ||
199 | static void dma_ints_off(struct NCR_ESP *esp) | 58 | static void jazz_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, |
59 | int num_sg, int dir) | ||
200 | { | 60 | { |
201 | disable_irq(esp->irq); | 61 | dma_unmap_sg(esp->dev, sg, num_sg, dir); |
202 | } | 62 | } |
203 | 63 | ||
204 | static void dma_ints_on(struct NCR_ESP *esp) | 64 | static int jazz_esp_irq_pending(struct esp *esp) |
205 | { | 65 | { |
206 | enable_irq(esp->irq); | 66 | if (jazz_esp_read8(esp, ESP_STATUS) & ESP_STAT_INTR) |
67 | return 1; | ||
68 | return 0; | ||
207 | } | 69 | } |
208 | 70 | ||
209 | static int dma_irq_p(struct NCR_ESP *esp) | 71 | static void jazz_esp_reset_dma(struct esp *esp) |
210 | { | 72 | { |
211 | return (esp_read(esp->eregs->esp_status) & ESP_STAT_INTR); | 73 | vdma_disable ((int)esp->dma_regs); |
212 | } | 74 | } |
213 | 75 | ||
214 | static int dma_ports_p(struct NCR_ESP *esp) | 76 | static void jazz_esp_dma_drain(struct esp *esp) |
215 | { | 77 | { |
216 | int enable = vdma_get_enable((int)esp->dregs); | 78 | /* nothing to do */ |
217 | |||
218 | return (enable & R4030_CHNL_ENABLE); | ||
219 | } | 79 | } |
220 | 80 | ||
221 | static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write) | 81 | static void jazz_esp_dma_invalidate(struct esp *esp) |
222 | { | 82 | { |
223 | /* | 83 | vdma_disable ((int)esp->dma_regs); |
224 | * On the Sparc, DMA_ST_WRITE means "move data from device to memory" | ||
225 | * so when (write) is true, it actually means READ! | ||
226 | */ | ||
227 | if(write){ | ||
228 | dma_init_read(esp, addr, count); | ||
229 | } else { | ||
230 | dma_init_write(esp, addr, count); | ||
231 | } | ||
232 | } | 84 | } |
233 | 85 | ||
234 | static void dma_mmu_get_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp) | 86 | static void jazz_esp_send_dma_cmd(struct esp *esp, u32 addr, u32 esp_count, |
87 | u32 dma_count, int write, u8 cmd) | ||
235 | { | 88 | { |
236 | sp->SCp.have_data_in = vdma_alloc(CPHYSADDR(sp->SCp.buffer), sp->SCp.this_residual); | 89 | BUG_ON(!(cmd & ESP_CMD_DMA)); |
237 | sp->SCp.ptr = (char *)((unsigned long)sp->SCp.have_data_in); | 90 | |
91 | jazz_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW); | ||
92 | jazz_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED); | ||
93 | vdma_disable ((int)esp->dma_regs); | ||
94 | if (write) | ||
95 | vdma_set_mode ((int)esp->dma_regs, DMA_MODE_READ); | ||
96 | else | ||
97 | vdma_set_mode ((int)esp->dma_regs, DMA_MODE_WRITE); | ||
98 | |||
99 | vdma_set_addr ((int)esp->dma_regs, addr); | ||
100 | vdma_set_count ((int)esp->dma_regs, dma_count); | ||
101 | vdma_enable ((int)esp->dma_regs); | ||
102 | |||
103 | scsi_esp_cmd(esp, cmd); | ||
238 | } | 104 | } |
239 | 105 | ||
240 | static void dma_mmu_get_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp) | 106 | static int jazz_esp_dma_error(struct esp *esp) |
241 | { | ||
242 | int sz = sp->SCp.buffers_residual; | ||
243 | struct scatterlist *sg = (struct scatterlist *) sp->SCp.buffer; | ||
244 | |||
245 | while (sz >= 0) { | ||
246 | sg[sz].dma_address = vdma_alloc(CPHYSADDR(page_address(sg[sz].page) + sg[sz].offset), sg[sz].length); | ||
247 | sz--; | ||
248 | } | ||
249 | sp->SCp.ptr=(char *)(sp->SCp.buffer->dma_address); | ||
250 | } | ||
251 | |||
252 | static void dma_mmu_release_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp) | ||
253 | { | 107 | { |
254 | vdma_free(sp->SCp.have_data_in); | 108 | u32 enable = vdma_get_enable((int)esp->dma_regs); |
109 | |||
110 | if (enable & (R4030_MEM_INTR|R4030_ADDR_INTR)) | ||
111 | return 1; | ||
112 | |||
113 | return 0; | ||
255 | } | 114 | } |
256 | 115 | ||
257 | static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp) | 116 | static const struct esp_driver_ops jazz_esp_ops = { |
117 | .esp_write8 = jazz_esp_write8, | ||
118 | .esp_read8 = jazz_esp_read8, | ||
119 | .map_single = jazz_esp_map_single, | ||
120 | .map_sg = jazz_esp_map_sg, | ||
121 | .unmap_single = jazz_esp_unmap_single, | ||
122 | .unmap_sg = jazz_esp_unmap_sg, | ||
123 | .irq_pending = jazz_esp_irq_pending, | ||
124 | .reset_dma = jazz_esp_reset_dma, | ||
125 | .dma_drain = jazz_esp_dma_drain, | ||
126 | .dma_invalidate = jazz_esp_dma_invalidate, | ||
127 | .send_dma_cmd = jazz_esp_send_dma_cmd, | ||
128 | .dma_error = jazz_esp_dma_error, | ||
129 | }; | ||
130 | |||
131 | static int __devinit esp_jazz_probe(struct platform_device *dev) | ||
258 | { | 132 | { |
259 | int sz = sp->use_sg - 1; | 133 | struct scsi_host_template *tpnt = &scsi_esp_template; |
260 | struct scatterlist *sg = (struct scatterlist *)sp->request_buffer; | 134 | struct Scsi_Host *host; |
261 | 135 | struct esp *esp; | |
262 | while(sz >= 0) { | 136 | struct resource *res; |
263 | vdma_free(sg[sz].dma_address); | 137 | int err; |
264 | sz--; | 138 | |
265 | } | 139 | host = scsi_host_alloc(tpnt, sizeof(struct esp)); |
140 | |||
141 | err = -ENOMEM; | ||
142 | if (!host) | ||
143 | goto fail; | ||
144 | |||
145 | host->max_id = 8; | ||
146 | esp = host_to_esp(host); | ||
147 | |||
148 | esp->host = host; | ||
149 | esp->dev = dev; | ||
150 | esp->ops = &jazz_esp_ops; | ||
151 | |||
152 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
153 | if (!res) | ||
154 | goto fail_unlink; | ||
155 | |||
156 | esp->regs = (void __iomem *)res->start; | ||
157 | if (!esp->regs) | ||
158 | goto fail_unlink; | ||
159 | |||
160 | res = platform_get_resource(dev, IORESOURCE_MEM, 1); | ||
161 | if (!res) | ||
162 | goto fail_unlink; | ||
163 | |||
164 | esp->dma_regs = (void __iomem *)res->start; | ||
165 | |||
166 | esp->command_block = dma_alloc_coherent(esp->dev, 16, | ||
167 | &esp->command_block_dma, | ||
168 | GFP_KERNEL); | ||
169 | if (!esp->command_block) | ||
170 | goto fail_unmap_regs; | ||
171 | |||
172 | host->irq = platform_get_irq(dev, 0); | ||
173 | err = request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp); | ||
174 | if (err < 0) | ||
175 | goto fail_unmap_command_block; | ||
176 | |||
177 | esp->scsi_id = 7; | ||
178 | esp->host->this_id = esp->scsi_id; | ||
179 | esp->scsi_id_mask = (1 << esp->scsi_id); | ||
180 | esp->cfreq = 40000000; | ||
181 | |||
182 | dev_set_drvdata(&dev->dev, esp); | ||
183 | |||
184 | err = scsi_esp_register(esp, &dev->dev); | ||
185 | if (err) | ||
186 | goto fail_free_irq; | ||
187 | |||
188 | return 0; | ||
189 | |||
190 | fail_free_irq: | ||
191 | free_irq(host->irq, esp); | ||
192 | fail_unmap_command_block: | ||
193 | dma_free_coherent(esp->dev, 16, | ||
194 | esp->command_block, | ||
195 | esp->command_block_dma); | ||
196 | fail_unmap_regs: | ||
197 | fail_unlink: | ||
198 | scsi_host_put(host); | ||
199 | fail: | ||
200 | return err; | ||
266 | } | 201 | } |
267 | 202 | ||
268 | static void dma_advance_sg (struct scsi_cmnd *sp) | 203 | static int __devexit esp_jazz_remove(struct platform_device *dev) |
269 | { | 204 | { |
270 | sp->SCp.ptr = (char *)(sp->SCp.buffer->dma_address); | 205 | struct esp *esp = dev_get_drvdata(&dev->dev); |
206 | unsigned int irq = esp->host->irq; | ||
207 | |||
208 | scsi_esp_unregister(esp); | ||
209 | |||
210 | free_irq(irq, esp); | ||
211 | dma_free_coherent(esp->dev, 16, | ||
212 | esp->command_block, | ||
213 | esp->command_block_dma); | ||
214 | |||
215 | scsi_host_put(esp->host); | ||
216 | |||
217 | return 0; | ||
271 | } | 218 | } |
272 | 219 | ||
273 | #define JAZZ_HDC_LED 0xe000d100 /* FIXME, find correct address */ | 220 | static struct platform_driver esp_jazz_driver = { |
221 | .probe = esp_jazz_probe, | ||
222 | .remove = __devexit_p(esp_jazz_remove), | ||
223 | .driver = { | ||
224 | .name = "jazz_esp", | ||
225 | }, | ||
226 | }; | ||
274 | 227 | ||
275 | static void dma_led_off(struct NCR_ESP *esp) | 228 | static int __init jazz_esp_init(void) |
276 | { | 229 | { |
277 | #if 0 | 230 | return platform_driver_register(&esp_jazz_driver); |
278 | *(unsigned char *)JAZZ_HDC_LED = 0; | ||
279 | #endif | ||
280 | } | 231 | } |
281 | 232 | ||
282 | static void dma_led_on(struct NCR_ESP *esp) | 233 | static void __exit jazz_esp_exit(void) |
283 | { | 234 | { |
284 | #if 0 | 235 | platform_driver_unregister(&esp_jazz_driver); |
285 | *(unsigned char *)JAZZ_HDC_LED = 1; | ||
286 | #endif | ||
287 | } | 236 | } |
288 | 237 | ||
289 | static struct scsi_host_template driver_template = { | 238 | MODULE_DESCRIPTION("JAZZ ESP SCSI driver"); |
290 | .proc_name = "jazz_esp", | 239 | MODULE_AUTHOR("Thomas Bogendoerfer (tsbogend@alpha.franken.de)"); |
291 | .proc_info = esp_proc_info, | 240 | MODULE_LICENSE("GPL"); |
292 | .name = "ESP 100/100a/200", | 241 | MODULE_VERSION(DRV_VERSION); |
293 | .detect = jazz_esp_detect, | 242 | |
294 | .slave_alloc = esp_slave_alloc, | 243 | module_init(jazz_esp_init); |
295 | .slave_destroy = esp_slave_destroy, | 244 | module_exit(jazz_esp_exit); |
296 | .release = jazz_esp_release, | ||
297 | .info = esp_info, | ||
298 | .queuecommand = esp_queue, | ||
299 | .eh_abort_handler = esp_abort, | ||
300 | .eh_bus_reset_handler = esp_reset, | ||
301 | .can_queue = 7, | ||
302 | .this_id = 7, | ||
303 | .sg_tablesize = SG_ALL, | ||
304 | .cmd_per_lun = 1, | ||
305 | .use_clustering = DISABLE_CLUSTERING, | ||
306 | }; | ||
307 | #include "scsi_module.c" | ||
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c index 5631c199a8eb..732446e63963 100644 --- a/drivers/scsi/libsrp.c +++ b/drivers/scsi/libsrp.c | |||
@@ -254,6 +254,7 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, | |||
254 | 254 | ||
255 | sg_init_one(&dummy, md, id->table_desc.len); | 255 | sg_init_one(&dummy, md, id->table_desc.len); |
256 | sg_dma_address(&dummy) = token; | 256 | sg_dma_address(&dummy) = token; |
257 | sg_dma_len(&dummy) = id->table_desc.len; | ||
257 | err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, | 258 | err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, |
258 | id->table_desc.len); | 259 | id->table_desc.len); |
259 | if (err) { | 260 | if (err) { |
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index 7a812677ff8a..e2cf12ef3688 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | * | 11 | * |
12 | * FILE : megaraid_sas.c | 12 | * FILE : megaraid_sas.c |
13 | * Version : v00.00.03.10-rc1 | 13 | * Version : v00.00.03.10-rc5 |
14 | * | 14 | * |
15 | * Authors: | 15 | * Authors: |
16 | * (email-id : megaraidlinux@lsi.com) | 16 | * (email-id : megaraidlinux@lsi.com) |
@@ -886,6 +886,7 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | |||
886 | goto out_return_cmd; | 886 | goto out_return_cmd; |
887 | 887 | ||
888 | cmd->scmd = scmd; | 888 | cmd->scmd = scmd; |
889 | scmd->SCp.ptr = (char *)cmd; | ||
889 | 890 | ||
890 | /* | 891 | /* |
891 | * Issue the command to the FW | 892 | * Issue the command to the FW |
@@ -919,7 +920,7 @@ static int megasas_slave_configure(struct scsi_device *sdev) | |||
919 | * The RAID firmware may require extended timeouts. | 920 | * The RAID firmware may require extended timeouts. |
920 | */ | 921 | */ |
921 | if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS) | 922 | if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS) |
922 | sdev->timeout = 90 * HZ; | 923 | sdev->timeout = MEGASAS_DEFAULT_CMD_TIMEOUT * HZ; |
923 | return 0; | 924 | return 0; |
924 | } | 925 | } |
925 | 926 | ||
@@ -981,8 +982,8 @@ static int megasas_generic_reset(struct scsi_cmnd *scmd) | |||
981 | 982 | ||
982 | instance = (struct megasas_instance *)scmd->device->host->hostdata; | 983 | instance = (struct megasas_instance *)scmd->device->host->hostdata; |
983 | 984 | ||
984 | scmd_printk(KERN_NOTICE, scmd, "megasas: RESET -%ld cmd=%x\n", | 985 | scmd_printk(KERN_NOTICE, scmd, "megasas: RESET -%ld cmd=%x retries=%x\n", |
985 | scmd->serial_number, scmd->cmnd[0]); | 986 | scmd->serial_number, scmd->cmnd[0], scmd->retries); |
986 | 987 | ||
987 | if (instance->hw_crit_error) { | 988 | if (instance->hw_crit_error) { |
988 | printk(KERN_ERR "megasas: cannot recover from previous reset " | 989 | printk(KERN_ERR "megasas: cannot recover from previous reset " |
@@ -1000,6 +1001,39 @@ static int megasas_generic_reset(struct scsi_cmnd *scmd) | |||
1000 | } | 1001 | } |
1001 | 1002 | ||
1002 | /** | 1003 | /** |
1004 | * megasas_reset_timer - quiesce the adapter if required | ||
1005 | * @scmd: scsi cmnd | ||
1006 | * | ||
1007 | * Sets the FW busy flag and reduces the host->can_queue if the | ||
1008 | * cmd has not been completed within the timeout period. | ||
1009 | */ | ||
1010 | static enum | ||
1011 | scsi_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) | ||
1012 | { | ||
1013 | struct megasas_cmd *cmd = (struct megasas_cmd *)scmd->SCp.ptr; | ||
1014 | struct megasas_instance *instance; | ||
1015 | unsigned long flags; | ||
1016 | |||
1017 | if (time_after(jiffies, scmd->jiffies_at_alloc + | ||
1018 | (MEGASAS_DEFAULT_CMD_TIMEOUT * 2) * HZ)) { | ||
1019 | return EH_NOT_HANDLED; | ||
1020 | } | ||
1021 | |||
1022 | instance = cmd->instance; | ||
1023 | if (!(instance->flag & MEGASAS_FW_BUSY)) { | ||
1024 | /* FW is busy, throttle IO */ | ||
1025 | spin_lock_irqsave(instance->host->host_lock, flags); | ||
1026 | |||
1027 | instance->host->can_queue = 16; | ||
1028 | instance->last_time = jiffies; | ||
1029 | instance->flag |= MEGASAS_FW_BUSY; | ||
1030 | |||
1031 | spin_unlock_irqrestore(instance->host->host_lock, flags); | ||
1032 | } | ||
1033 | return EH_RESET_TIMER; | ||
1034 | } | ||
1035 | |||
1036 | /** | ||
1003 | * megasas_reset_device - Device reset handler entry point | 1037 | * megasas_reset_device - Device reset handler entry point |
1004 | */ | 1038 | */ |
1005 | static int megasas_reset_device(struct scsi_cmnd *scmd) | 1039 | static int megasas_reset_device(struct scsi_cmnd *scmd) |
@@ -1112,6 +1146,7 @@ static struct scsi_host_template megasas_template = { | |||
1112 | .eh_device_reset_handler = megasas_reset_device, | 1146 | .eh_device_reset_handler = megasas_reset_device, |
1113 | .eh_bus_reset_handler = megasas_reset_bus_host, | 1147 | .eh_bus_reset_handler = megasas_reset_bus_host, |
1114 | .eh_host_reset_handler = megasas_reset_bus_host, | 1148 | .eh_host_reset_handler = megasas_reset_bus_host, |
1149 | .eh_timed_out = megasas_reset_timer, | ||
1115 | .bios_param = megasas_bios_param, | 1150 | .bios_param = megasas_bios_param, |
1116 | .use_clustering = ENABLE_CLUSTERING, | 1151 | .use_clustering = ENABLE_CLUSTERING, |
1117 | }; | 1152 | }; |
@@ -1215,9 +1250,8 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, | |||
1215 | int exception = 0; | 1250 | int exception = 0; |
1216 | struct megasas_header *hdr = &cmd->frame->hdr; | 1251 | struct megasas_header *hdr = &cmd->frame->hdr; |
1217 | 1252 | ||
1218 | if (cmd->scmd) { | 1253 | if (cmd->scmd) |
1219 | cmd->scmd->SCp.ptr = (char *)0; | 1254 | cmd->scmd->SCp.ptr = NULL; |
1220 | } | ||
1221 | 1255 | ||
1222 | switch (hdr->cmd) { | 1256 | switch (hdr->cmd) { |
1223 | 1257 | ||
@@ -1806,6 +1840,7 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr) | |||
1806 | u32 context; | 1840 | u32 context; |
1807 | struct megasas_cmd *cmd; | 1841 | struct megasas_cmd *cmd; |
1808 | struct megasas_instance *instance = (struct megasas_instance *)instance_addr; | 1842 | struct megasas_instance *instance = (struct megasas_instance *)instance_addr; |
1843 | unsigned long flags; | ||
1809 | 1844 | ||
1810 | /* If we have already declared adapter dead, donot complete cmds */ | 1845 | /* If we have already declared adapter dead, donot complete cmds */ |
1811 | if (instance->hw_crit_error) | 1846 | if (instance->hw_crit_error) |
@@ -1828,6 +1863,22 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr) | |||
1828 | } | 1863 | } |
1829 | 1864 | ||
1830 | *instance->consumer = producer; | 1865 | *instance->consumer = producer; |
1866 | |||
1867 | /* | ||
1868 | * Check if we can restore can_queue | ||
1869 | */ | ||
1870 | if (instance->flag & MEGASAS_FW_BUSY | ||
1871 | && time_after(jiffies, instance->last_time + 5 * HZ) | ||
1872 | && atomic_read(&instance->fw_outstanding) < 17) { | ||
1873 | |||
1874 | spin_lock_irqsave(instance->host->host_lock, flags); | ||
1875 | instance->flag &= ~MEGASAS_FW_BUSY; | ||
1876 | instance->host->can_queue = | ||
1877 | instance->max_fw_cmds - MEGASAS_INT_CMDS; | ||
1878 | |||
1879 | spin_unlock_irqrestore(instance->host->host_lock, flags); | ||
1880 | } | ||
1881 | |||
1831 | } | 1882 | } |
1832 | 1883 | ||
1833 | /** | 1884 | /** |
@@ -2398,6 +2449,8 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2398 | instance->init_id = MEGASAS_DEFAULT_INIT_ID; | 2449 | instance->init_id = MEGASAS_DEFAULT_INIT_ID; |
2399 | 2450 | ||
2400 | megasas_dbg_lvl = 0; | 2451 | megasas_dbg_lvl = 0; |
2452 | instance->flag = 0; | ||
2453 | instance->last_time = 0; | ||
2401 | 2454 | ||
2402 | /* | 2455 | /* |
2403 | * Initialize MFI Firmware | 2456 | * Initialize MFI Firmware |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index e862992ee377..4dffc918a414 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -18,9 +18,9 @@ | |||
18 | /* | 18 | /* |
19 | * MegaRAID SAS Driver meta data | 19 | * MegaRAID SAS Driver meta data |
20 | */ | 20 | */ |
21 | #define MEGASAS_VERSION "00.00.03.10-rc1" | 21 | #define MEGASAS_VERSION "00.00.03.10-rc5" |
22 | #define MEGASAS_RELDATE "Feb 14, 2007" | 22 | #define MEGASAS_RELDATE "May 17, 2007" |
23 | #define MEGASAS_EXT_VERSION "Wed Feb 14 10:14:25 PST 2007" | 23 | #define MEGASAS_EXT_VERSION "Thu May 17 10:09:32 PDT 2007" |
24 | 24 | ||
25 | /* | 25 | /* |
26 | * Device IDs | 26 | * Device IDs |
@@ -539,6 +539,8 @@ struct megasas_ctrl_info { | |||
539 | 539 | ||
540 | #define MEGASAS_DBG_LVL 1 | 540 | #define MEGASAS_DBG_LVL 1 |
541 | 541 | ||
542 | #define MEGASAS_FW_BUSY 1 | ||
543 | |||
542 | /* | 544 | /* |
543 | * When SCSI mid-layer calls driver's reset routine, driver waits for | 545 | * When SCSI mid-layer calls driver's reset routine, driver waits for |
544 | * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note | 546 | * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note |
@@ -549,8 +551,8 @@ struct megasas_ctrl_info { | |||
549 | #define MEGASAS_RESET_WAIT_TIME 180 | 551 | #define MEGASAS_RESET_WAIT_TIME 180 |
550 | #define MEGASAS_INTERNAL_CMD_WAIT_TIME 180 | 552 | #define MEGASAS_INTERNAL_CMD_WAIT_TIME 180 |
551 | #define MEGASAS_RESET_NOTICE_INTERVAL 5 | 553 | #define MEGASAS_RESET_NOTICE_INTERVAL 5 |
552 | |||
553 | #define MEGASAS_IOCTL_CMD 0 | 554 | #define MEGASAS_IOCTL_CMD 0 |
555 | #define MEGASAS_DEFAULT_CMD_TIMEOUT 90 | ||
554 | 556 | ||
555 | /* | 557 | /* |
556 | * FW reports the maximum of number of commands that it can accept (maximum | 558 | * FW reports the maximum of number of commands that it can accept (maximum |
@@ -1073,7 +1075,6 @@ struct megasas_instance { | |||
1073 | struct megasas_register_set __iomem *reg_set; | 1075 | struct megasas_register_set __iomem *reg_set; |
1074 | 1076 | ||
1075 | s8 init_id; | 1077 | s8 init_id; |
1076 | u8 reserved[3]; | ||
1077 | 1078 | ||
1078 | u16 max_num_sge; | 1079 | u16 max_num_sge; |
1079 | u16 max_fw_cmds; | 1080 | u16 max_fw_cmds; |
@@ -1104,6 +1105,9 @@ struct megasas_instance { | |||
1104 | 1105 | ||
1105 | struct megasas_instance_template *instancet; | 1106 | struct megasas_instance_template *instancet; |
1106 | struct tasklet_struct isr_tasklet; | 1107 | struct tasklet_struct isr_tasklet; |
1108 | |||
1109 | u8 flag; | ||
1110 | unsigned long last_time; | ||
1107 | }; | 1111 | }; |
1108 | 1112 | ||
1109 | #define MEGASAS_IS_LOGICAL(scp) \ | 1113 | #define MEGASAS_IS_LOGICAL(scp) \ |
diff --git a/drivers/scsi/pluto.c b/drivers/scsi/pluto.c index 3b2e1a53e6e2..d953d43fe2e6 100644 --- a/drivers/scsi/pluto.c +++ b/drivers/scsi/pluto.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/completion.h> | ||
7 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
8 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
9 | #include <linux/types.h> | 10 | #include <linux/types.h> |
@@ -50,16 +51,10 @@ static struct ctrl_inquiry { | |||
50 | } *fcs __initdata; | 51 | } *fcs __initdata; |
51 | static int fcscount __initdata = 0; | 52 | static int fcscount __initdata = 0; |
52 | static atomic_t fcss __initdata = ATOMIC_INIT(0); | 53 | static atomic_t fcss __initdata = ATOMIC_INIT(0); |
53 | DECLARE_MUTEX_LOCKED(fc_sem); | 54 | static DECLARE_COMPLETION(fc_detect_complete); |
54 | 55 | ||
55 | static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd); | 56 | static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd); |
56 | 57 | ||
57 | static void __init pluto_detect_timeout(unsigned long data) | ||
58 | { | ||
59 | PLND(("Timeout\n")) | ||
60 | up(&fc_sem); | ||
61 | } | ||
62 | |||
63 | static void __init pluto_detect_done(Scsi_Cmnd *SCpnt) | 58 | static void __init pluto_detect_done(Scsi_Cmnd *SCpnt) |
64 | { | 59 | { |
65 | /* Do nothing */ | 60 | /* Do nothing */ |
@@ -69,7 +64,7 @@ static void __init pluto_detect_scsi_done(Scsi_Cmnd *SCpnt) | |||
69 | { | 64 | { |
70 | PLND(("Detect done %08lx\n", (long)SCpnt)) | 65 | PLND(("Detect done %08lx\n", (long)SCpnt)) |
71 | if (atomic_dec_and_test (&fcss)) | 66 | if (atomic_dec_and_test (&fcss)) |
72 | up(&fc_sem); | 67 | complete(&fc_detect_complete); |
73 | } | 68 | } |
74 | 69 | ||
75 | int pluto_slave_configure(struct scsi_device *device) | 70 | int pluto_slave_configure(struct scsi_device *device) |
@@ -96,7 +91,6 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
96 | int i, retry, nplutos; | 91 | int i, retry, nplutos; |
97 | fc_channel *fc; | 92 | fc_channel *fc; |
98 | struct scsi_device dev; | 93 | struct scsi_device dev; |
99 | DEFINE_TIMER(fc_timer, pluto_detect_timeout, 0, 0); | ||
100 | 94 | ||
101 | tpnt->proc_name = "pluto"; | 95 | tpnt->proc_name = "pluto"; |
102 | fcscount = 0; | 96 | fcscount = 0; |
@@ -187,15 +181,11 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
187 | } | 181 | } |
188 | } | 182 | } |
189 | 183 | ||
190 | fc_timer.expires = jiffies + 10 * HZ; | 184 | wait_for_completion_timeout(&fc_detect_complete, 10 * HZ); |
191 | add_timer(&fc_timer); | ||
192 | |||
193 | down(&fc_sem); | ||
194 | PLND(("Woken up\n")) | 185 | PLND(("Woken up\n")) |
195 | if (!atomic_read(&fcss)) | 186 | if (!atomic_read(&fcss)) |
196 | break; /* All fc channels have answered us */ | 187 | break; /* All fc channels have answered us */ |
197 | } | 188 | } |
198 | del_timer_sync(&fc_timer); | ||
199 | 189 | ||
200 | PLND(("Finished search\n")) | 190 | PLND(("Finished search\n")) |
201 | for (i = 0, nplutos = 0; i < fcscount; i++) { | 191 | for (i = 0, nplutos = 0; i < fcscount; i++) { |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index ce63044b1ec8..18dd5cc4d7c6 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -209,6 +209,7 @@ static struct { | |||
209 | {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 209 | {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
210 | {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 210 | {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
211 | {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 211 | {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
212 | {"Promise", "", NULL, BLIST_SPARSELUN}, | ||
212 | {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, | 213 | {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, |
213 | {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, | 214 | {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, |
214 | {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ | 215 | {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 00e46662296f..3d8c9cb24f91 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1789,7 +1789,7 @@ static void sd_shutdown(struct device *dev) | |||
1789 | static int sd_suspend(struct device *dev, pm_message_t mesg) | 1789 | static int sd_suspend(struct device *dev, pm_message_t mesg) |
1790 | { | 1790 | { |
1791 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); | 1791 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); |
1792 | int ret; | 1792 | int ret = 0; |
1793 | 1793 | ||
1794 | if (!sdkp) | 1794 | if (!sdkp) |
1795 | return 0; /* this can happen */ | 1795 | return 0; /* this can happen */ |
@@ -1798,30 +1798,34 @@ static int sd_suspend(struct device *dev, pm_message_t mesg) | |||
1798 | sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); | 1798 | sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); |
1799 | ret = sd_sync_cache(sdkp); | 1799 | ret = sd_sync_cache(sdkp); |
1800 | if (ret) | 1800 | if (ret) |
1801 | return ret; | 1801 | goto done; |
1802 | } | 1802 | } |
1803 | 1803 | ||
1804 | if (mesg.event == PM_EVENT_SUSPEND && | 1804 | if (mesg.event == PM_EVENT_SUSPEND && |
1805 | sdkp->device->manage_start_stop) { | 1805 | sdkp->device->manage_start_stop) { |
1806 | sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); | 1806 | sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); |
1807 | ret = sd_start_stop_device(sdkp, 0); | 1807 | ret = sd_start_stop_device(sdkp, 0); |
1808 | if (ret) | ||
1809 | return ret; | ||
1810 | } | 1808 | } |
1811 | 1809 | ||
1812 | return 0; | 1810 | done: |
1811 | scsi_disk_put(sdkp); | ||
1812 | return ret; | ||
1813 | } | 1813 | } |
1814 | 1814 | ||
1815 | static int sd_resume(struct device *dev) | 1815 | static int sd_resume(struct device *dev) |
1816 | { | 1816 | { |
1817 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); | 1817 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); |
1818 | int ret = 0; | ||
1818 | 1819 | ||
1819 | if (!sdkp->device->manage_start_stop) | 1820 | if (!sdkp->device->manage_start_stop) |
1820 | return 0; | 1821 | goto done; |
1821 | 1822 | ||
1822 | sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); | 1823 | sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); |
1824 | ret = sd_start_stop_device(sdkp, 1); | ||
1823 | 1825 | ||
1824 | return sd_start_stop_device(sdkp, 1); | 1826 | done: |
1827 | scsi_disk_put(sdkp); | ||
1828 | return ret; | ||
1825 | } | 1829 | } |
1826 | 1830 | ||
1827 | /** | 1831 | /** |
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 69be1324b114..9ac83abc4028 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c | |||
@@ -32,11 +32,12 @@ | |||
32 | #include <scsi/scsi_cmnd.h> | 32 | #include <scsi/scsi_cmnd.h> |
33 | #include <scsi/scsi_host.h> | 33 | #include <scsi/scsi_host.h> |
34 | #include <scsi/scsi_tcq.h> | 34 | #include <scsi/scsi_tcq.h> |
35 | #include <scsi/scsi_dbg.h> | ||
35 | 36 | ||
36 | #define DRV_NAME "stex" | 37 | #define DRV_NAME "stex" |
37 | #define ST_DRIVER_VERSION "3.1.0.1" | 38 | #define ST_DRIVER_VERSION "3.6.0000.1" |
38 | #define ST_VER_MAJOR 3 | 39 | #define ST_VER_MAJOR 3 |
39 | #define ST_VER_MINOR 1 | 40 | #define ST_VER_MINOR 6 |
40 | #define ST_OEM 0 | 41 | #define ST_OEM 0 |
41 | #define ST_BUILD_VER 1 | 42 | #define ST_BUILD_VER 1 |
42 | 43 | ||
@@ -113,10 +114,6 @@ enum { | |||
113 | SG_CF_64B = 0x40, /* 64 bit item */ | 114 | SG_CF_64B = 0x40, /* 64 bit item */ |
114 | SG_CF_HOST = 0x20, /* sg in host memory */ | 115 | SG_CF_HOST = 0x20, /* sg in host memory */ |
115 | 116 | ||
116 | ST_MAX_ARRAY_SUPPORTED = 16, | ||
117 | ST_MAX_TARGET_NUM = (ST_MAX_ARRAY_SUPPORTED+1), | ||
118 | ST_MAX_LUN_PER_TARGET = 16, | ||
119 | |||
120 | st_shasta = 0, | 117 | st_shasta = 0, |
121 | st_vsc = 1, | 118 | st_vsc = 1, |
122 | st_vsc1 = 2, | 119 | st_vsc1 = 2, |
@@ -586,7 +583,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
586 | u16 tag; | 583 | u16 tag; |
587 | host = cmd->device->host; | 584 | host = cmd->device->host; |
588 | id = cmd->device->id; | 585 | id = cmd->device->id; |
589 | lun = cmd->device->channel; /* firmware lun issue work around */ | 586 | lun = cmd->device->lun; |
590 | hba = (struct st_hba *) &host->hostdata[0]; | 587 | hba = (struct st_hba *) &host->hostdata[0]; |
591 | 588 | ||
592 | switch (cmd->cmnd[0]) { | 589 | switch (cmd->cmnd[0]) { |
@@ -605,8 +602,26 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
605 | stex_invalid_field(cmd, done); | 602 | stex_invalid_field(cmd, done); |
606 | return 0; | 603 | return 0; |
607 | } | 604 | } |
605 | case REPORT_LUNS: | ||
606 | /* | ||
607 | * The shasta firmware does not report actual luns in the | ||
608 | * target, so fail the command to force sequential lun scan. | ||
609 | * Also, the console device does not support this command. | ||
610 | */ | ||
611 | if (hba->cardtype == st_shasta || id == host->max_id - 1) { | ||
612 | stex_invalid_field(cmd, done); | ||
613 | return 0; | ||
614 | } | ||
615 | break; | ||
616 | case TEST_UNIT_READY: | ||
617 | if (id == host->max_id - 1) { | ||
618 | cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; | ||
619 | done(cmd); | ||
620 | return 0; | ||
621 | } | ||
622 | break; | ||
608 | case INQUIRY: | 623 | case INQUIRY: |
609 | if (id != ST_MAX_ARRAY_SUPPORTED) | 624 | if (id != host->max_id - 1) |
610 | break; | 625 | break; |
611 | if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) { | 626 | if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) { |
612 | stex_direct_copy(cmd, console_inq_page, | 627 | stex_direct_copy(cmd, console_inq_page, |
@@ -624,7 +639,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
624 | ver.oem = ST_OEM; | 639 | ver.oem = ST_OEM; |
625 | ver.build = ST_BUILD_VER; | 640 | ver.build = ST_BUILD_VER; |
626 | ver.signature[0] = PASSTHRU_SIGNATURE; | 641 | ver.signature[0] = PASSTHRU_SIGNATURE; |
627 | ver.console_id = ST_MAX_ARRAY_SUPPORTED; | 642 | ver.console_id = host->max_id - 1; |
628 | ver.host_no = hba->host->host_no; | 643 | ver.host_no = hba->host->host_no; |
629 | cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ? | 644 | cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ? |
630 | DID_OK << 16 | COMMAND_COMPLETE << 8 : | 645 | DID_OK << 16 | COMMAND_COMPLETE << 8 : |
@@ -645,13 +660,8 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
645 | 660 | ||
646 | req = stex_alloc_req(hba); | 661 | req = stex_alloc_req(hba); |
647 | 662 | ||
648 | if (hba->cardtype == st_yosemite) { | 663 | req->lun = lun; |
649 | req->lun = lun * (ST_MAX_TARGET_NUM - 1) + id; | 664 | req->target = id; |
650 | req->target = 0; | ||
651 | } else { | ||
652 | req->lun = lun; | ||
653 | req->target = id; | ||
654 | } | ||
655 | 665 | ||
656 | /* cdb */ | 666 | /* cdb */ |
657 | memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH); | 667 | memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH); |
@@ -767,18 +777,6 @@ static void stex_ys_commands(struct st_hba *hba, | |||
767 | ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT; | 777 | ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT; |
768 | else | 778 | else |
769 | ccb->srb_status = SRB_STATUS_SUCCESS; | 779 | ccb->srb_status = SRB_STATUS_SUCCESS; |
770 | } else if (ccb->cmd->cmnd[0] == REPORT_LUNS) { | ||
771 | u8 *report_lun_data = (u8 *)hba->copy_buffer; | ||
772 | |||
773 | count = STEX_EXTRA_SIZE; | ||
774 | stex_internal_copy(ccb->cmd, report_lun_data, | ||
775 | &count, ccb->sg_count, ST_FROM_CMD); | ||
776 | if (report_lun_data[2] || report_lun_data[3]) { | ||
777 | report_lun_data[2] = 0x00; | ||
778 | report_lun_data[3] = 0x08; | ||
779 | stex_internal_copy(ccb->cmd, report_lun_data, | ||
780 | &count, ccb->sg_count, ST_TO_CMD); | ||
781 | } | ||
782 | } | 780 | } |
783 | } | 781 | } |
784 | 782 | ||
@@ -995,6 +993,11 @@ static int stex_abort(struct scsi_cmnd *cmd) | |||
995 | u32 data; | 993 | u32 data; |
996 | int result = SUCCESS; | 994 | int result = SUCCESS; |
997 | unsigned long flags; | 995 | unsigned long flags; |
996 | |||
997 | printk(KERN_INFO DRV_NAME | ||
998 | "(%s): aborting command\n", pci_name(hba->pdev)); | ||
999 | scsi_print_command(cmd); | ||
1000 | |||
998 | base = hba->mmio_base; | 1001 | base = hba->mmio_base; |
999 | spin_lock_irqsave(host->host_lock, flags); | 1002 | spin_lock_irqsave(host->host_lock, flags); |
1000 | if (tag < host->can_queue && hba->ccb[tag].cmd == cmd) | 1003 | if (tag < host->can_queue && hba->ccb[tag].cmd == cmd) |
@@ -1051,7 +1054,12 @@ static void stex_hard_reset(struct st_hba *hba) | |||
1051 | pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &pci_bctl); | 1054 | pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &pci_bctl); |
1052 | pci_bctl |= PCI_BRIDGE_CTL_BUS_RESET; | 1055 | pci_bctl |= PCI_BRIDGE_CTL_BUS_RESET; |
1053 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); | 1056 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); |
1054 | msleep(1); | 1057 | |
1058 | /* | ||
1059 | * 1 ms may be enough for 8-port controllers. But 16-port controllers | ||
1060 | * require more time to finish bus reset. Use 100 ms here for safety | ||
1061 | */ | ||
1062 | msleep(100); | ||
1055 | pci_bctl &= ~PCI_BRIDGE_CTL_BUS_RESET; | 1063 | pci_bctl &= ~PCI_BRIDGE_CTL_BUS_RESET; |
1056 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); | 1064 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); |
1057 | 1065 | ||
@@ -1075,6 +1083,10 @@ static int stex_reset(struct scsi_cmnd *cmd) | |||
1075 | unsigned long before; | 1083 | unsigned long before; |
1076 | hba = (struct st_hba *) &cmd->device->host->hostdata[0]; | 1084 | hba = (struct st_hba *) &cmd->device->host->hostdata[0]; |
1077 | 1085 | ||
1086 | printk(KERN_INFO DRV_NAME | ||
1087 | "(%s): resetting host\n", pci_name(hba->pdev)); | ||
1088 | scsi_print_command(cmd); | ||
1089 | |||
1078 | hba->mu_status = MU_STATE_RESETTING; | 1090 | hba->mu_status = MU_STATE_RESETTING; |
1079 | 1091 | ||
1080 | if (hba->cardtype == st_shasta) | 1092 | if (hba->cardtype == st_shasta) |
@@ -1194,7 +1206,7 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1194 | goto out_scsi_host_put; | 1206 | goto out_scsi_host_put; |
1195 | } | 1207 | } |
1196 | 1208 | ||
1197 | hba->mmio_base = ioremap(pci_resource_start(pdev, 0), | 1209 | hba->mmio_base = ioremap_nocache(pci_resource_start(pdev, 0), |
1198 | pci_resource_len(pdev, 0)); | 1210 | pci_resource_len(pdev, 0)); |
1199 | if ( !hba->mmio_base) { | 1211 | if ( !hba->mmio_base) { |
1200 | printk(KERN_ERR DRV_NAME "(%s): memory map failed\n", | 1212 | printk(KERN_ERR DRV_NAME "(%s): memory map failed\n", |
@@ -1229,12 +1241,18 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1229 | hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; | 1241 | hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; |
1230 | hba->mu_status = MU_STATE_STARTING; | 1242 | hba->mu_status = MU_STATE_STARTING; |
1231 | 1243 | ||
1232 | /* firmware uses id/lun pair for a logical drive, but lun would be | 1244 | if (hba->cardtype == st_shasta) { |
1233 | always 0 if CONFIG_SCSI_MULTI_LUN not configured, so we use | 1245 | host->max_lun = 8; |
1234 | channel to map lun here */ | 1246 | host->max_id = 16 + 1; |
1235 | host->max_channel = ST_MAX_LUN_PER_TARGET - 1; | 1247 | } else if (hba->cardtype == st_yosemite) { |
1236 | host->max_id = ST_MAX_TARGET_NUM; | 1248 | host->max_lun = 128; |
1237 | host->max_lun = 1; | 1249 | host->max_id = 1 + 1; |
1250 | } else { | ||
1251 | /* st_vsc and st_vsc1 */ | ||
1252 | host->max_lun = 1; | ||
1253 | host->max_id = 128 + 1; | ||
1254 | } | ||
1255 | host->max_channel = 0; | ||
1238 | host->unique_id = host->host_no; | 1256 | host->unique_id = host->host_no; |
1239 | host->max_cmd_len = STEX_CDB_LENGTH; | 1257 | host->max_cmd_len = STEX_CDB_LENGTH; |
1240 | 1258 | ||
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index 1a9a24b82636..00d1255e4c12 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c | |||
@@ -167,8 +167,9 @@ static void pl010_rx_chars(struct uart_amba_port *uap) | |||
167 | ignore_char: | 167 | ignore_char: |
168 | status = readb(uap->port.membase + UART01x_FR); | 168 | status = readb(uap->port.membase + UART01x_FR); |
169 | } | 169 | } |
170 | spin_unlock(&port->lock); | ||
170 | tty_flip_buffer_push(tty); | 171 | tty_flip_buffer_push(tty); |
171 | return; | 172 | spin_lock(&port->lock); |
172 | } | 173 | } |
173 | 174 | ||
174 | static void pl010_tx_chars(struct uart_amba_port *uap) | 175 | static void pl010_tx_chars(struct uart_amba_port *uap) |
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 44639e71372a..954073c6ce3a 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
@@ -153,8 +153,9 @@ static void pl011_rx_chars(struct uart_amba_port *uap) | |||
153 | ignore_char: | 153 | ignore_char: |
154 | status = readw(uap->port.membase + UART01x_FR); | 154 | status = readw(uap->port.membase + UART01x_FR); |
155 | } | 155 | } |
156 | spin_unlock(&uap->port.lock); | ||
156 | tty_flip_buffer_push(tty); | 157 | tty_flip_buffer_push(tty); |
157 | return; | 158 | spin_lock(&uap->port.lock); |
158 | } | 159 | } |
159 | 160 | ||
160 | static void pl011_tx_chars(struct uart_amba_port *uap) | 161 | static void pl011_tx_chars(struct uart_amba_port *uap) |
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c index 698763b28ddd..8721afe1ae4f 100644 --- a/drivers/serial/serial_ks8695.c +++ b/drivers/serial/serial_ks8695.c | |||
@@ -589,7 +589,7 @@ static int __init ks8695_console_setup(struct console *co, char *options) | |||
589 | return uart_set_options(port, co, baud, parity, bits, flow); | 589 | return uart_set_options(port, co, baud, parity, bits, flow); |
590 | } | 590 | } |
591 | 591 | ||
592 | extern struct uart_driver ks8695_reg; | 592 | static struct uart_driver ks8695_reg; |
593 | 593 | ||
594 | static struct console ks8695_console = { | 594 | static struct console ks8695_console = { |
595 | .name = SERIAL_KS8695_DEVNAME, | 595 | .name = SERIAL_KS8695_DEVNAME, |
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c index e35d9ab359f1..b45ba5392dd3 100644 --- a/drivers/serial/suncore.c +++ b/drivers/serial/suncore.c | |||
@@ -30,9 +30,9 @@ void | |||
30 | sunserial_console_termios(struct console *con) | 30 | sunserial_console_termios(struct console *con) |
31 | { | 31 | { |
32 | char mode[16], buf[16], *s; | 32 | char mode[16], buf[16], *s; |
33 | char *mode_prop = "ttyX-mode"; | 33 | char mode_prop[] = "ttyX-mode"; |
34 | char *cd_prop = "ttyX-ignore-cd"; | 34 | char cd_prop[] = "ttyX-ignore-cd"; |
35 | char *dtr_prop = "ttyX-rts-dtr-off"; | 35 | char dtr_prop[] = "ttyX-rts-dtr-off"; |
36 | char *ssp_console_modes_prop = "ssp-console-modes"; | 36 | char *ssp_console_modes_prop = "ssp-console-modes"; |
37 | int baud, bits, stop, cflag; | 37 | int baud, bits, stop, cflag; |
38 | char parity; | 38 | char parity; |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 0985193dc57d..15b6e1cb040b 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
@@ -1239,7 +1239,7 @@ static inline struct console *SUNZILOG_CONSOLE(void) | |||
1239 | #define SUNZILOG_CONSOLE() (NULL) | 1239 | #define SUNZILOG_CONSOLE() (NULL) |
1240 | #endif | 1240 | #endif |
1241 | 1241 | ||
1242 | static void __init sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channel) | 1242 | static void __devinit sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channel) |
1243 | { | 1243 | { |
1244 | int baud, brg; | 1244 | int baud, brg; |
1245 | 1245 | ||
@@ -1259,7 +1259,7 @@ static void __init sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channe | |||
1259 | } | 1259 | } |
1260 | 1260 | ||
1261 | #ifdef CONFIG_SERIO | 1261 | #ifdef CONFIG_SERIO |
1262 | static void __init sunzilog_register_serio(struct uart_sunzilog_port *up) | 1262 | static void __devinit sunzilog_register_serio(struct uart_sunzilog_port *up) |
1263 | { | 1263 | { |
1264 | struct serio *serio = &up->serio; | 1264 | struct serio *serio = &up->serio; |
1265 | 1265 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index e277258df382..8969e42434b9 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1681,7 +1681,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) | |||
1681 | spin_unlock_irq (&hcd_root_hub_lock); | 1681 | spin_unlock_irq (&hcd_root_hub_lock); |
1682 | 1682 | ||
1683 | #ifdef CONFIG_PM | 1683 | #ifdef CONFIG_PM |
1684 | flush_workqueue(ksuspend_usb_wq); | 1684 | cancel_work_sync(&hcd->wakeup_work); |
1685 | #endif | 1685 | #endif |
1686 | 1686 | ||
1687 | mutex_lock(&usb_bus_list_lock); | 1687 | mutex_lock(&usb_bus_list_lock); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index caaa46f2dec7..24f10a19dbdb 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1158,6 +1158,30 @@ static void release_address(struct usb_device *udev) | |||
1158 | } | 1158 | } |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | #ifdef CONFIG_USB_SUSPEND | ||
1162 | |||
1163 | static void usb_stop_pm(struct usb_device *udev) | ||
1164 | { | ||
1165 | /* Synchronize with the ksuspend thread to prevent any more | ||
1166 | * autosuspend requests from being submitted, and decrement | ||
1167 | * the parent's count of unsuspended children. | ||
1168 | */ | ||
1169 | usb_pm_lock(udev); | ||
1170 | if (udev->parent && !udev->discon_suspended) | ||
1171 | usb_autosuspend_device(udev->parent); | ||
1172 | usb_pm_unlock(udev); | ||
1173 | |||
1174 | /* Stop any autosuspend requests already submitted */ | ||
1175 | cancel_rearming_delayed_work(&udev->autosuspend); | ||
1176 | } | ||
1177 | |||
1178 | #else | ||
1179 | |||
1180 | static inline void usb_stop_pm(struct usb_device *udev) | ||
1181 | { } | ||
1182 | |||
1183 | #endif | ||
1184 | |||
1161 | /** | 1185 | /** |
1162 | * usb_disconnect - disconnect a device (usbcore-internal) | 1186 | * usb_disconnect - disconnect a device (usbcore-internal) |
1163 | * @pdev: pointer to device being disconnected | 1187 | * @pdev: pointer to device being disconnected |
@@ -1224,13 +1248,7 @@ void usb_disconnect(struct usb_device **pdev) | |||
1224 | *pdev = NULL; | 1248 | *pdev = NULL; |
1225 | spin_unlock_irq(&device_state_lock); | 1249 | spin_unlock_irq(&device_state_lock); |
1226 | 1250 | ||
1227 | /* Decrement the parent's count of unsuspended children */ | 1251 | usb_stop_pm(udev); |
1228 | if (udev->parent) { | ||
1229 | usb_pm_lock(udev); | ||
1230 | if (!udev->discon_suspended) | ||
1231 | usb_autosuspend_device(udev->parent); | ||
1232 | usb_pm_unlock(udev); | ||
1233 | } | ||
1234 | 1252 | ||
1235 | put_device(&udev->dev); | 1253 | put_device(&udev->dev); |
1236 | } | 1254 | } |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 80627b6a2bf9..4a6299bd0047 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -184,10 +184,6 @@ static void usb_release_dev(struct device *dev) | |||
184 | 184 | ||
185 | udev = to_usb_device(dev); | 185 | udev = to_usb_device(dev); |
186 | 186 | ||
187 | #ifdef CONFIG_USB_SUSPEND | ||
188 | cancel_delayed_work(&udev->autosuspend); | ||
189 | flush_workqueue(ksuspend_usb_wq); | ||
190 | #endif | ||
191 | usb_destroy_configuration(udev); | 187 | usb_destroy_configuration(udev); |
192 | usb_put_hcd(bus_to_hcd(udev->bus)); | 188 | usb_put_hcd(bus_to_hcd(udev->bus)); |
193 | kfree(udev->product); | 189 | kfree(udev->product); |
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index bd30aba242d0..731d7a5c5aa2 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c | |||
@@ -1286,34 +1286,36 @@ static int neofb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
1286 | if (regno >= fb->cmap.len || regno > 255) | 1286 | if (regno >= fb->cmap.len || regno > 255) |
1287 | return -EINVAL; | 1287 | return -EINVAL; |
1288 | 1288 | ||
1289 | switch (fb->var.bits_per_pixel) { | 1289 | if (fb->var.bits_per_pixel <= 8) { |
1290 | case 8: | ||
1291 | outb(regno, 0x3c8); | 1290 | outb(regno, 0x3c8); |
1292 | 1291 | ||
1293 | outb(red >> 10, 0x3c9); | 1292 | outb(red >> 10, 0x3c9); |
1294 | outb(green >> 10, 0x3c9); | 1293 | outb(green >> 10, 0x3c9); |
1295 | outb(blue >> 10, 0x3c9); | 1294 | outb(blue >> 10, 0x3c9); |
1296 | break; | 1295 | } else if (regno < 16) { |
1297 | case 16: | 1296 | switch (fb->var.bits_per_pixel) { |
1298 | ((u32 *) fb->pseudo_palette)[regno] = | 1297 | case 16: |
1298 | ((u32 *) fb->pseudo_palette)[regno] = | ||
1299 | ((red & 0xf800)) | ((green & 0xfc00) >> 5) | | 1299 | ((red & 0xf800)) | ((green & 0xfc00) >> 5) | |
1300 | ((blue & 0xf800) >> 11); | 1300 | ((blue & 0xf800) >> 11); |
1301 | break; | 1301 | break; |
1302 | case 24: | 1302 | case 24: |
1303 | ((u32 *) fb->pseudo_palette)[regno] = | 1303 | ((u32 *) fb->pseudo_palette)[regno] = |
1304 | ((red & 0xff00) << 8) | ((green & 0xff00)) | | 1304 | ((red & 0xff00) << 8) | ((green & 0xff00)) | |
1305 | ((blue & 0xff00) >> 8); | 1305 | ((blue & 0xff00) >> 8); |
1306 | break; | 1306 | break; |
1307 | #ifdef NO_32BIT_SUPPORT_YET | 1307 | #ifdef NO_32BIT_SUPPORT_YET |
1308 | case 32: | 1308 | case 32: |
1309 | ((u32 *) fb->pseudo_palette)[regno] = | 1309 | ((u32 *) fb->pseudo_palette)[regno] = |
1310 | ((transp & 0xff00) << 16) | ((red & 0xff00) << 8) | | 1310 | ((transp & 0xff00) << 16) | ((red & 0xff00) << 8) | |
1311 | ((green & 0xff00)) | ((blue & 0xff00) >> 8); | 1311 | ((green & 0xff00)) | ((blue & 0xff00) >> 8); |
1312 | break; | 1312 | break; |
1313 | #endif | 1313 | #endif |
1314 | default: | 1314 | default: |
1315 | return 1; | 1315 | return 1; |
1316 | } | ||
1316 | } | 1317 | } |
1318 | |||
1317 | return 0; | 1319 | return 0; |
1318 | } | 1320 | } |
1319 | 1321 | ||
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 2dac3ad2c44b..2c55dd94a1de 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/rxrpc.h> | 17 | #include <linux/rxrpc.h> |
18 | #include <linux/key.h> | 18 | #include <linux/key.h> |
19 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
20 | #include <linux/sched.h> | ||
21 | |||
20 | #include "afs.h" | 22 | #include "afs.h" |
21 | #include "afs_vl.h" | 23 | #include "afs_vl.h" |
22 | 24 | ||
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 0c542ec92d5b..00eee87510fe 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -168,7 +168,7 @@ static inline struct nfs_direct_req *nfs_direct_req_alloc(void) | |||
168 | return dreq; | 168 | return dreq; |
169 | } | 169 | } |
170 | 170 | ||
171 | static void nfs_direct_req_release(struct kref *kref) | 171 | static void nfs_direct_req_free(struct kref *kref) |
172 | { | 172 | { |
173 | struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); | 173 | struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); |
174 | 174 | ||
@@ -177,6 +177,11 @@ static void nfs_direct_req_release(struct kref *kref) | |||
177 | kmem_cache_free(nfs_direct_cachep, dreq); | 177 | kmem_cache_free(nfs_direct_cachep, dreq); |
178 | } | 178 | } |
179 | 179 | ||
180 | static void nfs_direct_req_release(struct nfs_direct_req *dreq) | ||
181 | { | ||
182 | kref_put(&dreq->kref, nfs_direct_req_free); | ||
183 | } | ||
184 | |||
180 | /* | 185 | /* |
181 | * Collects and returns the final error value/byte-count. | 186 | * Collects and returns the final error value/byte-count. |
182 | */ | 187 | */ |
@@ -196,7 +201,6 @@ static ssize_t nfs_direct_wait(struct nfs_direct_req *dreq) | |||
196 | result = dreq->count; | 201 | result = dreq->count; |
197 | 202 | ||
198 | out: | 203 | out: |
199 | kref_put(&dreq->kref, nfs_direct_req_release); | ||
200 | return (ssize_t) result; | 204 | return (ssize_t) result; |
201 | } | 205 | } |
202 | 206 | ||
@@ -214,7 +218,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq) | |||
214 | } | 218 | } |
215 | complete_all(&dreq->completion); | 219 | complete_all(&dreq->completion); |
216 | 220 | ||
217 | kref_put(&dreq->kref, nfs_direct_req_release); | 221 | nfs_direct_req_release(dreq); |
218 | } | 222 | } |
219 | 223 | ||
220 | /* | 224 | /* |
@@ -369,6 +373,7 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, unsigned long user_addr, size | |||
369 | if (!result) | 373 | if (!result) |
370 | result = nfs_direct_wait(dreq); | 374 | result = nfs_direct_wait(dreq); |
371 | rpc_clnt_sigunmask(clnt, &oldset); | 375 | rpc_clnt_sigunmask(clnt, &oldset); |
376 | nfs_direct_req_release(dreq); | ||
372 | 377 | ||
373 | return result; | 378 | return result; |
374 | } | 379 | } |
@@ -716,6 +721,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz | |||
716 | if (!result) | 721 | if (!result) |
717 | result = nfs_direct_wait(dreq); | 722 | result = nfs_direct_wait(dreq); |
718 | rpc_clnt_sigunmask(clnt, &oldset); | 723 | rpc_clnt_sigunmask(clnt, &oldset); |
724 | nfs_direct_req_release(dreq); | ||
719 | 725 | ||
720 | return result; | 726 | return result; |
721 | } | 727 | } |
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 074791ce4ab2..b532a730cec2 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c | |||
@@ -140,7 +140,7 @@ static int ntfs_init_locked_inode(struct inode *vi, ntfs_attr *na) | |||
140 | if (!ni->name) | 140 | if (!ni->name) |
141 | return -ENOMEM; | 141 | return -ENOMEM; |
142 | memcpy(ni->name, na->name, i); | 142 | memcpy(ni->name, na->name, i); |
143 | ni->name[i] = 0; | 143 | ni->name[na->name_len] = 0; |
144 | } | 144 | } |
145 | return 0; | 145 | return 0; |
146 | } | 146 | } |
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 3b481d557edb..9345a46ffb32 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
@@ -179,7 +179,7 @@ static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size) | |||
179 | return ret; | 179 | return ret; |
180 | } | 180 | } |
181 | 181 | ||
182 | ret = vmtruncate(inode, size); | 182 | ret = vmtruncate(inode, newsize); |
183 | 183 | ||
184 | return ret; | 184 | return ret; |
185 | } | 185 | } |
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 4475588e973a..7361861e3aac 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -701,7 +701,7 @@ xfs_is_delayed_page( | |||
701 | else if (buffer_delay(bh)) | 701 | else if (buffer_delay(bh)) |
702 | acceptable = (type == IOMAP_DELAY); | 702 | acceptable = (type == IOMAP_DELAY); |
703 | else if (buffer_dirty(bh) && buffer_mapped(bh)) | 703 | else if (buffer_dirty(bh) && buffer_mapped(bh)) |
704 | acceptable = (type == 0); | 704 | acceptable = (type == IOMAP_NEW); |
705 | else | 705 | else |
706 | break; | 706 | break; |
707 | } while ((bh = bh->b_this_page) != head); | 707 | } while ((bh = bh->b_this_page) != head); |
@@ -810,7 +810,7 @@ xfs_convert_page( | |||
810 | page_dirty--; | 810 | page_dirty--; |
811 | count++; | 811 | count++; |
812 | } else { | 812 | } else { |
813 | type = 0; | 813 | type = IOMAP_NEW; |
814 | if (buffer_mapped(bh) && all_bh && startio) { | 814 | if (buffer_mapped(bh) && all_bh && startio) { |
815 | lock_buffer(bh); | 815 | lock_buffer(bh); |
816 | xfs_add_to_ioend(inode, bh, offset, | 816 | xfs_add_to_ioend(inode, bh, offset, |
@@ -968,8 +968,8 @@ xfs_page_state_convert( | |||
968 | 968 | ||
969 | bh = head = page_buffers(page); | 969 | bh = head = page_buffers(page); |
970 | offset = page_offset(page); | 970 | offset = page_offset(page); |
971 | flags = -1; | 971 | flags = BMAPI_READ; |
972 | type = IOMAP_READ; | 972 | type = IOMAP_NEW; |
973 | 973 | ||
974 | /* TODO: cleanup count and page_dirty */ | 974 | /* TODO: cleanup count and page_dirty */ |
975 | 975 | ||
@@ -999,14 +999,14 @@ xfs_page_state_convert( | |||
999 | * | 999 | * |
1000 | * Third case, an unmapped buffer was found, and we are | 1000 | * Third case, an unmapped buffer was found, and we are |
1001 | * in a path where we need to write the whole page out. | 1001 | * in a path where we need to write the whole page out. |
1002 | */ | 1002 | */ |
1003 | if (buffer_unwritten(bh) || buffer_delay(bh) || | 1003 | if (buffer_unwritten(bh) || buffer_delay(bh) || |
1004 | ((buffer_uptodate(bh) || PageUptodate(page)) && | 1004 | ((buffer_uptodate(bh) || PageUptodate(page)) && |
1005 | !buffer_mapped(bh) && (unmapped || startio))) { | 1005 | !buffer_mapped(bh) && (unmapped || startio))) { |
1006 | /* | 1006 | /* |
1007 | * Make sure we don't use a read-only iomap | 1007 | * Make sure we don't use a read-only iomap |
1008 | */ | 1008 | */ |
1009 | if (flags == BMAPI_READ) | 1009 | if (flags == BMAPI_READ) |
1010 | iomap_valid = 0; | 1010 | iomap_valid = 0; |
1011 | 1011 | ||
1012 | if (buffer_unwritten(bh)) { | 1012 | if (buffer_unwritten(bh)) { |
@@ -1055,7 +1055,7 @@ xfs_page_state_convert( | |||
1055 | * That means it must already have extents allocated | 1055 | * That means it must already have extents allocated |
1056 | * underneath it. Map the extent by reading it. | 1056 | * underneath it. Map the extent by reading it. |
1057 | */ | 1057 | */ |
1058 | if (!iomap_valid || type != IOMAP_READ) { | 1058 | if (!iomap_valid || flags != BMAPI_READ) { |
1059 | flags = BMAPI_READ; | 1059 | flags = BMAPI_READ; |
1060 | size = xfs_probe_cluster(inode, page, bh, | 1060 | size = xfs_probe_cluster(inode, page, bh, |
1061 | head, 1); | 1061 | head, 1); |
@@ -1066,7 +1066,15 @@ xfs_page_state_convert( | |||
1066 | iomap_valid = xfs_iomap_valid(&iomap, offset); | 1066 | iomap_valid = xfs_iomap_valid(&iomap, offset); |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | type = IOMAP_READ; | 1069 | /* |
1070 | * We set the type to IOMAP_NEW in case we are doing a | ||
1071 | * small write at EOF that is extending the file but | ||
1072 | * without needing an allocation. We need to update the | ||
1073 | * file size on I/O completion in this case so it is | ||
1074 | * the same case as having just allocated a new extent | ||
1075 | * that we are writing into for the first time. | ||
1076 | */ | ||
1077 | type = IOMAP_NEW; | ||
1070 | if (!test_and_set_bit(BH_Lock, &bh->b_state)) { | 1078 | if (!test_and_set_bit(BH_Lock, &bh->b_state)) { |
1071 | ASSERT(buffer_mapped(bh)); | 1079 | ASSERT(buffer_mapped(bh)); |
1072 | if (iomap_valid) | 1080 | if (iomap_valid) |
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h index 4b6ef7f21b93..3a0cbeb03fa1 100644 --- a/include/asm-alpha/bitops.h +++ b/include/asm-alpha/bitops.h | |||
@@ -313,32 +313,29 @@ static inline int ffs(int word) | |||
313 | * fls: find last bit set. | 313 | * fls: find last bit set. |
314 | */ | 314 | */ |
315 | #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) | 315 | #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) |
316 | static inline int fls(int word) | 316 | static inline int fls64(unsigned long word) |
317 | { | 317 | { |
318 | return 64 - __kernel_ctlz(word & 0xffffffff); | 318 | return 64 - __kernel_ctlz(word); |
319 | } | 319 | } |
320 | #else | 320 | #else |
321 | #include <asm-generic/bitops/fls.h> | 321 | extern const unsigned char __flsm1_tab[256]; |
322 | #endif | ||
323 | #include <asm-generic/bitops/fls64.h> | ||
324 | 322 | ||
325 | /* Compute powers of two for the given integer. */ | 323 | static inline int fls64(unsigned long x) |
326 | static inline long floor_log2(unsigned long word) | ||
327 | { | 324 | { |
328 | #if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67) | 325 | unsigned long t, a, r; |
329 | return 63 - __kernel_ctlz(word); | 326 | |
330 | #else | 327 | t = __kernel_cmpbge (x, 0x0101010101010101); |
331 | long bit; | 328 | a = __flsm1_tab[t]; |
332 | for (bit = -1; word ; bit++) | 329 | t = __kernel_extbl (x, a); |
333 | word >>= 1; | 330 | r = a*8 + __flsm1_tab[t] + (x != 0); |
334 | return bit; | 331 | |
335 | #endif | 332 | return r; |
336 | } | 333 | } |
334 | #endif | ||
337 | 335 | ||
338 | static inline long ceil_log2(unsigned long word) | 336 | static inline int fls(int x) |
339 | { | 337 | { |
340 | long bit = floor_log2(word); | 338 | return fls64((unsigned int) x); |
341 | return bit + (word > (1UL << bit)); | ||
342 | } | 339 | } |
343 | 340 | ||
344 | /* | 341 | /* |
@@ -353,9 +350,20 @@ static inline unsigned long hweight64(unsigned long w) | |||
353 | return __kernel_ctpop(w); | 350 | return __kernel_ctpop(w); |
354 | } | 351 | } |
355 | 352 | ||
356 | #define hweight32(x) (unsigned int) hweight64((x) & 0xfffffffful) | 353 | static inline unsigned int hweight32(unsigned int w) |
357 | #define hweight16(x) (unsigned int) hweight64((x) & 0xfffful) | 354 | { |
358 | #define hweight8(x) (unsigned int) hweight64((x) & 0xfful) | 355 | return hweight64(w); |
356 | } | ||
357 | |||
358 | static inline unsigned int hweight16(unsigned int w) | ||
359 | { | ||
360 | return hweight64(w & 0xffff); | ||
361 | } | ||
362 | |||
363 | static inline unsigned int hweight8(unsigned int w) | ||
364 | { | ||
365 | return hweight64(w & 0xff); | ||
366 | } | ||
359 | #else | 367 | #else |
360 | #include <asm-generic/bitops/hweight.h> | 368 | #include <asm-generic/bitops/hweight.h> |
361 | #endif | 369 | #endif |
diff --git a/include/asm-alpha/thread_info.h b/include/asm-alpha/thread_info.h index f4defc2bd3fb..48a22e3e6f32 100644 --- a/include/asm-alpha/thread_info.h +++ b/include/asm-alpha/thread_info.h | |||
@@ -76,12 +76,14 @@ register struct thread_info *__current_thread_info __asm__("$8"); | |||
76 | #define TIF_UAC_NOFIX 7 | 76 | #define TIF_UAC_NOFIX 7 |
77 | #define TIF_UAC_SIGBUS 8 | 77 | #define TIF_UAC_SIGBUS 8 |
78 | #define TIF_MEMDIE 9 | 78 | #define TIF_MEMDIE 9 |
79 | #define TIF_RESTORE_SIGMASK 10 /* restore signal mask in do_signal */ | ||
79 | 80 | ||
80 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 81 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
81 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 82 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
82 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 83 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
83 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 84 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
84 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 85 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
86 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
85 | 87 | ||
86 | /* Work to do on interrupt/exception return. */ | 88 | /* Work to do on interrupt/exception return. */ |
87 | #define _TIF_WORK_MASK (_TIF_NOTIFY_RESUME \ | 89 | #define _TIF_WORK_MASK (_TIF_NOTIFY_RESUME \ |
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h index e58a427012dd..29bf2fdc91c0 100644 --- a/include/asm-alpha/unistd.h +++ b/include/asm-alpha/unistd.h | |||
@@ -233,6 +233,20 @@ | |||
233 | #define __NR_osf_memcntl 260 /* not implemented */ | 233 | #define __NR_osf_memcntl 260 /* not implemented */ |
234 | #define __NR_osf_fdatasync 261 /* not implemented */ | 234 | #define __NR_osf_fdatasync 261 /* not implemented */ |
235 | 235 | ||
236 | /* | ||
237 | * Ignore legacy syscalls that we don't use. | ||
238 | */ | ||
239 | #define __IGNORE_alarm | ||
240 | #define __IGNORE_creat | ||
241 | #define __IGNORE_getegid | ||
242 | #define __IGNORE_geteuid | ||
243 | #define __IGNORE_getgid | ||
244 | #define __IGNORE_getpid | ||
245 | #define __IGNORE_getppid | ||
246 | #define __IGNORE_getuid | ||
247 | #define __IGNORE_pause | ||
248 | #define __IGNORE_time | ||
249 | #define __IGNORE_utime | ||
236 | 250 | ||
237 | /* | 251 | /* |
238 | * Linux-specific system calls begin at 300 | 252 | * Linux-specific system calls begin at 300 |
@@ -387,10 +401,42 @@ | |||
387 | #define __NR_inotify_init 444 | 401 | #define __NR_inotify_init 444 |
388 | #define __NR_inotify_add_watch 445 | 402 | #define __NR_inotify_add_watch 445 |
389 | #define __NR_inotify_rm_watch 446 | 403 | #define __NR_inotify_rm_watch 446 |
404 | #define __NR_fdatasync 447 | ||
405 | #define __NR_kexec_load 448 | ||
406 | #define __NR_migrate_pages 449 | ||
407 | #define __NR_openat 450 | ||
408 | #define __NR_mkdirat 451 | ||
409 | #define __NR_mknodat 452 | ||
410 | #define __NR_fchownat 453 | ||
411 | #define __NR_futimesat 454 | ||
412 | #define __NR_fstatat64 455 | ||
413 | #define __NR_unlinkat 456 | ||
414 | #define __NR_renameat 457 | ||
415 | #define __NR_linkat 458 | ||
416 | #define __NR_symlinkat 459 | ||
417 | #define __NR_readlinkat 460 | ||
418 | #define __NR_fchmodat 461 | ||
419 | #define __NR_faccessat 462 | ||
420 | #define __NR_pselect6 463 | ||
421 | #define __NR_ppoll 464 | ||
422 | #define __NR_unshare 465 | ||
423 | #define __NR_set_robust_list 466 | ||
424 | #define __NR_get_robust_list 467 | ||
425 | #define __NR_splice 468 | ||
426 | #define __NR_sync_file_range 469 | ||
427 | #define __NR_tee 470 | ||
428 | #define __NR_vmsplice 471 | ||
429 | #define __NR_move_pages 472 | ||
430 | #define __NR_getcpu 473 | ||
431 | #define __NR_epoll_pwait 474 | ||
432 | #define __NR_utimensat 475 | ||
433 | #define __NR_signalfd 476 | ||
434 | #define __NR_timerfd 477 | ||
435 | #define __NR_eventfd 478 | ||
390 | 436 | ||
391 | #ifdef __KERNEL__ | 437 | #ifdef __KERNEL__ |
392 | 438 | ||
393 | #define NR_SYSCALLS 447 | 439 | #define NR_SYSCALLS 479 |
394 | 440 | ||
395 | #define __ARCH_WANT_IPC_PARSE_VERSION | 441 | #define __ARCH_WANT_IPC_PARSE_VERSION |
396 | #define __ARCH_WANT_OLD_READDIR | 442 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/include/asm-arm/arch-ixp4xx/nas100d.h b/include/asm-arm/arch-ixp4xx/nas100d.h index 84467a5190d0..131e0a1d0df3 100644 --- a/include/asm-arm/arch-ixp4xx/nas100d.h +++ b/include/asm-arm/arch-ixp4xx/nas100d.h | |||
@@ -10,7 +10,7 @@ | |||
10 | * based on ixdp425.h: | 10 | * based on ixdp425.h: |
11 | * Copyright 2004 (c) MontaVista, Software, Inc. | 11 | * Copyright 2004 (c) MontaVista, Software, Inc. |
12 | * | 12 | * |
13 | * This file is licensed under the terms of the GNU General Public | 13 | * This file is licensed under the terms of the GNU General Public |
14 | * License version 2. This program is licensed "as is" without any | 14 | * License version 2. This program is licensed "as is" without any |
15 | * warranty of any kind, whether express or implied. | 15 | * warranty of any kind, whether express or implied. |
16 | */ | 16 | */ |
@@ -36,31 +36,11 @@ | |||
36 | #define NAS100D_PCI_INTD_PIN 8 | 36 | #define NAS100D_PCI_INTD_PIN 8 |
37 | #define NAS100D_PCI_INTE_PIN 7 | 37 | #define NAS100D_PCI_INTE_PIN 7 |
38 | 38 | ||
39 | /* GPIO */ | ||
40 | |||
41 | #define NAS100D_GPIO0 0 | ||
42 | #define NAS100D_GPIO1 1 | ||
43 | #define NAS100D_GPIO2 2 | ||
44 | #define NAS100D_GPIO3 3 | ||
45 | #define NAS100D_GPIO4 4 | ||
46 | #define NAS100D_GPIO5 5 | ||
47 | #define NAS100D_GPIO6 6 | ||
48 | #define NAS100D_GPIO7 7 | ||
49 | #define NAS100D_GPIO8 8 | ||
50 | #define NAS100D_GPIO9 9 | ||
51 | #define NAS100D_GPIO10 10 | ||
52 | #define NAS100D_GPIO11 11 | ||
53 | #define NAS100D_GPIO12 12 | ||
54 | #define NAS100D_GPIO13 13 | ||
55 | #define NAS100D_GPIO14 14 | ||
56 | #define NAS100D_GPIO15 15 | ||
57 | |||
58 | |||
59 | /* Buttons */ | 39 | /* Buttons */ |
60 | 40 | ||
61 | #define NAS100D_PB_GPIO NAS100D_GPIO14 | 41 | #define NAS100D_PB_GPIO 14 |
62 | #define NAS100D_RB_GPIO NAS100D_GPIO4 | 42 | #define NAS100D_RB_GPIO 4 |
63 | #define NAS100D_PO_GPIO NAS100D_GPIO12 /* power off */ | 43 | #define NAS100D_PO_GPIO 12 /* power off */ |
64 | 44 | ||
65 | #define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO14 | 45 | #define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO14 |
66 | #define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO4 | 46 | #define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO4 |
diff --git a/include/asm-arm/arch-ixp4xx/nslu2.h b/include/asm-arm/arch-ixp4xx/nslu2.h index 6b437f7c9955..850fdc5b45da 100644 --- a/include/asm-arm/arch-ixp4xx/nslu2.h +++ b/include/asm-arm/arch-ixp4xx/nslu2.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * based on ixdp425.h: | 9 | * based on ixdp425.h: |
10 | * Copyright 2004 (c) MontaVista, Software, Inc. | 10 | * Copyright 2004 (c) MontaVista, Software, Inc. |
11 | * | 11 | * |
12 | * This file is licensed under the terms of the GNU General Public | 12 | * This file is licensed under the terms of the GNU General Public |
13 | * License version 2. This program is licensed "as is" without any | 13 | * License version 2. This program is licensed "as is" without any |
14 | * warranty of any kind, whether express or implied. | 14 | * warranty of any kind, whether express or implied. |
15 | */ | 15 | */ |
@@ -34,36 +34,14 @@ | |||
34 | #define NSLU2_PCI_INTC_PIN 9 | 34 | #define NSLU2_PCI_INTC_PIN 9 |
35 | #define NSLU2_PCI_INTD_PIN 8 | 35 | #define NSLU2_PCI_INTD_PIN 8 |
36 | 36 | ||
37 | |||
38 | /* NSLU2 Timer */ | 37 | /* NSLU2 Timer */ |
39 | #define NSLU2_FREQ 66000000 | 38 | #define NSLU2_FREQ 66000000 |
40 | #define NSLU2_CLOCK_TICK_RATE (((NSLU2_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ) | ||
41 | #define NSLU2_CLOCK_TICKS_PER_USEC ((NSLU2_CLOCK_TICK_RATE + USEC_PER_SEC/2) / USEC_PER_SEC) | ||
42 | |||
43 | /* GPIO */ | ||
44 | |||
45 | #define NSLU2_GPIO0 0 | ||
46 | #define NSLU2_GPIO1 1 | ||
47 | #define NSLU2_GPIO2 2 | ||
48 | #define NSLU2_GPIO3 3 | ||
49 | #define NSLU2_GPIO4 4 | ||
50 | #define NSLU2_GPIO5 5 | ||
51 | #define NSLU2_GPIO6 6 | ||
52 | #define NSLU2_GPIO7 7 | ||
53 | #define NSLU2_GPIO8 8 | ||
54 | #define NSLU2_GPIO9 9 | ||
55 | #define NSLU2_GPIO10 10 | ||
56 | #define NSLU2_GPIO11 11 | ||
57 | #define NSLU2_GPIO12 12 | ||
58 | #define NSLU2_GPIO13 13 | ||
59 | #define NSLU2_GPIO14 14 | ||
60 | #define NSLU2_GPIO15 15 | ||
61 | 39 | ||
62 | /* Buttons */ | 40 | /* Buttons */ |
63 | 41 | ||
64 | #define NSLU2_PB_GPIO NSLU2_GPIO5 | 42 | #define NSLU2_PB_GPIO 5 |
65 | #define NSLU2_PO_GPIO NSLU2_GPIO8 /* power off */ | 43 | #define NSLU2_PO_GPIO 8 /* power off */ |
66 | #define NSLU2_RB_GPIO NSLU2_GPIO12 | 44 | #define NSLU2_RB_GPIO 12 |
67 | 45 | ||
68 | #define NSLU2_PB_IRQ IRQ_IXP4XX_GPIO5 | 46 | #define NSLU2_PB_IRQ IRQ_IXP4XX_GPIO5 |
69 | #define NSLU2_RB_IRQ IRQ_IXP4XX_GPIO12 | 47 | #define NSLU2_RB_IRQ IRQ_IXP4XX_GPIO12 |
@@ -79,16 +57,16 @@ | |||
79 | 57 | ||
80 | /* LEDs */ | 58 | /* LEDs */ |
81 | 59 | ||
82 | #define NSLU2_LED_RED NSLU2_GPIO0 | 60 | #define NSLU2_LED_RED_GPIO 0 |
83 | #define NSLU2_LED_GRN NSLU2_GPIO1 | 61 | #define NSLU2_LED_GRN_GPIO 1 |
84 | 62 | ||
85 | #define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED) | 63 | #define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED_GPIO) |
86 | #define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN) | 64 | #define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN_GPIO) |
87 | 65 | ||
88 | #define NSLU2_LED_DISK1 NSLU2_GPIO3 | 66 | #define NSLU2_LED_DISK1_GPIO 3 |
89 | #define NSLU2_LED_DISK2 NSLU2_GPIO2 | 67 | #define NSLU2_LED_DISK2_GPIO 2 |
90 | 68 | ||
91 | #define NSLU2_LED_DISK1_BM (1L << NSLU2_GPIO2) | 69 | #define NSLU2_LED_DISK1_BM (1L << NSLU2_LED_DISK1_GPIO) |
92 | #define NSLU2_LED_DISK2_BM (1L << NSLU2_GPIO3) | 70 | #define NSLU2_LED_DISK2_BM (1L << NSLU2_LED_DISK2_GPIO) |
93 | 71 | ||
94 | 72 | ||
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h index ab194e5f6653..2a44d3d67980 100644 --- a/include/asm-arm/arch-ixp4xx/platform.h +++ b/include/asm-arm/arch-ixp4xx/platform.h | |||
@@ -113,6 +113,7 @@ extern unsigned long ixp4xx_timer_freq; | |||
113 | extern void ixp4xx_map_io(void); | 113 | extern void ixp4xx_map_io(void); |
114 | extern void ixp4xx_init_irq(void); | 114 | extern void ixp4xx_init_irq(void); |
115 | extern void ixp4xx_sys_init(void); | 115 | extern void ixp4xx_sys_init(void); |
116 | extern void ixp4xx_timer_init(void); | ||
116 | extern struct sys_timer ixp4xx_timer; | 117 | extern struct sys_timer ixp4xx_timer; |
117 | extern void ixp4xx_pci_preinit(void); | 118 | extern void ixp4xx_pci_preinit(void); |
118 | struct pci_sys_data; | 119 | struct pci_sys_data; |
diff --git a/include/asm-arm/arch-s3c2410/map.h b/include/asm-arm/arch-s3c2410/map.h index 4505aefbad17..19e77f038042 100644 --- a/include/asm-arm/arch-s3c2410/map.h +++ b/include/asm-arm/arch-s3c2410/map.h | |||
@@ -153,6 +153,10 @@ | |||
153 | #define S3C2440_PA_AC97 (0x5B000000) | 153 | #define S3C2440_PA_AC97 (0x5B000000) |
154 | #define S3C2440_SZ_AC97 SZ_1M | 154 | #define S3C2440_SZ_AC97 SZ_1M |
155 | 155 | ||
156 | /* S3C2443 High-speed SD/MMC */ | ||
157 | #define S3C2443_PA_HSMMC (0x4A800000) | ||
158 | #define S3C2443_SZ_HSMMC (256) | ||
159 | |||
156 | /* ISA style IO, for each machine to sort out mappings for, if it | 160 | /* ISA style IO, for each machine to sort out mappings for, if it |
157 | * implements it. We reserve two 16M regions for ISA. | 161 | * implements it. We reserve two 16M regions for ISA. |
158 | */ | 162 | */ |
diff --git a/include/asm-arm/arch-s3c2410/regs-gpioj.h b/include/asm-arm/arch-s3c2410/regs-gpioj.h index 02131a5a1d3a..0362332faaf0 100644 --- a/include/asm-arm/arch-s3c2410/regs-gpioj.h +++ b/include/asm-arm/arch-s3c2410/regs-gpioj.h | |||
@@ -98,5 +98,9 @@ | |||
98 | #define S3C2440_GPJ12_OUTP (0x01 << 24) | 98 | #define S3C2440_GPJ12_OUTP (0x01 << 24) |
99 | #define S3C2440_GPJ12_CAMRESET (0x02 << 24) | 99 | #define S3C2440_GPJ12_CAMRESET (0x02 << 24) |
100 | 100 | ||
101 | #define S3C2443_GPJ13 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 13) | ||
102 | #define S3C2443_GPJ14 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 14) | ||
103 | #define S3C2443_GPJ15 S3C2410_GPIONO(S3C2440_GPIO_BANKJ, 15) | ||
104 | |||
101 | #endif /* __ASM_ARCH_REGS_GPIOJ_H */ | 105 | #endif /* __ASM_ARCH_REGS_GPIOJ_H */ |
102 | 106 | ||
diff --git a/include/asm-arm/arch-s3c2410/regs-s3c2412.h b/include/asm-arm/arch-s3c2410/regs-s3c2412.h new file mode 100644 index 000000000000..8ca6a3bc8555 --- /dev/null +++ b/include/asm-arm/arch-s3c2410/regs-s3c2412.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* linux/include/asm-arm/arch-s3c2410/regs-s3c2412.h | ||
2 | * | ||
3 | * Copyright 2007 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * S3C2412 specific register definitions | ||
12 | */ | ||
13 | |||
14 | #ifndef __ASM_ARCH_REGS_S3C2412_H | ||
15 | #define __ASM_ARCH_REGS_S3C2412_H "s3c2412" | ||
16 | |||
17 | #define S3C2412_SWRST (S3C24XX_VA_CLKPWR + 0x30) | ||
18 | #define S3C2412_SWRST_RESET (0x533C2412) | ||
19 | |||
20 | #endif /* __ASM_ARCH_REGS_S3C2412_H */ | ||
21 | |||
diff --git a/include/asm-arm/ioctls.h b/include/asm-arm/ioctls.h index bb9a7aa10c12..a91d8a1523cf 100644 --- a/include/asm-arm/ioctls.h +++ b/include/asm-arm/ioctls.h | |||
@@ -46,6 +46,10 @@ | |||
46 | #define TIOCSBRK 0x5427 /* BSD compatibility */ | 46 | #define TIOCSBRK 0x5427 /* BSD compatibility */ |
47 | #define TIOCCBRK 0x5428 /* BSD compatibility */ | 47 | #define TIOCCBRK 0x5428 /* BSD compatibility */ |
48 | #define TIOCGSID 0x5429 /* Return the session ID of FD */ | 48 | #define TIOCGSID 0x5429 /* Return the session ID of FD */ |
49 | #define TCGETS2 _IOR('T',0x2A, struct termios2) | ||
50 | #define TCSETS2 _IOW('T',0x2B, struct termios2) | ||
51 | #define TCSETSW2 _IOW('T',0x2C, struct termios2) | ||
52 | #define TCSETSF2 _IOW('T',0x2D, struct termios2) | ||
49 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | 53 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
50 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | 54 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ |
51 | 55 | ||
diff --git a/include/asm-arm/mach/arch.h b/include/asm-arm/mach/arch.h index fd2f9bf4dcc6..c59fad18e73b 100644 --- a/include/asm-arm/mach/arch.h +++ b/include/asm-arm/mach/arch.h | |||
@@ -49,7 +49,7 @@ struct machine_desc { | |||
49 | */ | 49 | */ |
50 | #define MACHINE_START(_type,_name) \ | 50 | #define MACHINE_START(_type,_name) \ |
51 | static const struct machine_desc __mach_desc_##_type \ | 51 | static const struct machine_desc __mach_desc_##_type \ |
52 | __attribute_used__ \ | 52 | __used \ |
53 | __attribute__((__section__(".arch.info.init"))) = { \ | 53 | __attribute__((__section__(".arch.info.init"))) = { \ |
54 | .nr = MACH_TYPE_##_type, \ | 54 | .nr = MACH_TYPE_##_type, \ |
55 | .name = _name, | 55 | .name = _name, |
diff --git a/include/asm-arm/setup.h b/include/asm-arm/setup.h index e5407392afca..7bbf105463f1 100644 --- a/include/asm-arm/setup.h +++ b/include/asm-arm/setup.h | |||
@@ -185,7 +185,7 @@ struct tagtable { | |||
185 | 185 | ||
186 | #ifdef __KERNEL__ | 186 | #ifdef __KERNEL__ |
187 | 187 | ||
188 | #define __tag __attribute_used__ __attribute__((__section__(".taglist.init"))) | 188 | #define __tag __used __attribute__((__section__(".taglist.init"))) |
189 | #define __tagtable(tag, fn) \ | 189 | #define __tagtable(tag, fn) \ |
190 | static struct tagtable __tagtable_##fn __tag = { tag, fn } | 190 | static struct tagtable __tagtable_##fn __tag = { tag, fn } |
191 | 191 | ||
@@ -218,7 +218,7 @@ struct early_params { | |||
218 | }; | 218 | }; |
219 | 219 | ||
220 | #define __early_param(name,fn) \ | 220 | #define __early_param(name,fn) \ |
221 | static struct early_params __early_##fn __attribute_used__ \ | 221 | static struct early_params __early_##fn __used \ |
222 | __attribute__((__section__(".early_param.init"))) = { name, fn } | 222 | __attribute__((__section__(".early_param.init"))) = { name, fn } |
223 | 223 | ||
224 | #endif /* __KERNEL__ */ | 224 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-arm/termbits.h b/include/asm-arm/termbits.h index a3f4fe1742d0..f784d11f40b5 100644 --- a/include/asm-arm/termbits.h +++ b/include/asm-arm/termbits.h | |||
@@ -15,6 +15,17 @@ struct termios { | |||
15 | cc_t c_cc[NCCS]; /* control characters */ | 15 | cc_t c_cc[NCCS]; /* control characters */ |
16 | }; | 16 | }; |
17 | 17 | ||
18 | struct termios2 { | ||
19 | tcflag_t c_iflag; /* input mode flags */ | ||
20 | tcflag_t c_oflag; /* output mode flags */ | ||
21 | tcflag_t c_cflag; /* control mode flags */ | ||
22 | tcflag_t c_lflag; /* local mode flags */ | ||
23 | cc_t c_line; /* line discipline */ | ||
24 | cc_t c_cc[NCCS]; /* control characters */ | ||
25 | speed_t c_ispeed; /* input speed */ | ||
26 | speed_t c_ospeed; /* output speed */ | ||
27 | }; | ||
28 | |||
18 | struct ktermios { | 29 | struct ktermios { |
19 | tcflag_t c_iflag; /* input mode flags */ | 30 | tcflag_t c_iflag; /* input mode flags */ |
20 | tcflag_t c_oflag; /* output mode flags */ | 31 | tcflag_t c_oflag; /* output mode flags */ |
@@ -128,6 +139,7 @@ struct ktermios { | |||
128 | #define HUPCL 0002000 | 139 | #define HUPCL 0002000 |
129 | #define CLOCAL 0004000 | 140 | #define CLOCAL 0004000 |
130 | #define CBAUDEX 0010000 | 141 | #define CBAUDEX 0010000 |
142 | #define BOTHER 0010000 | ||
131 | #define B57600 0010001 | 143 | #define B57600 0010001 |
132 | #define B115200 0010002 | 144 | #define B115200 0010002 |
133 | #define B230400 0010003 | 145 | #define B230400 0010003 |
@@ -143,10 +155,12 @@ struct ktermios { | |||
143 | #define B3000000 0010015 | 155 | #define B3000000 0010015 |
144 | #define B3500000 0010016 | 156 | #define B3500000 0010016 |
145 | #define B4000000 0010017 | 157 | #define B4000000 0010017 |
146 | #define CIBAUD 002003600000 /* input baud rate (not used) */ | 158 | #define CIBAUD 002003600000 /* input baud rate */ |
147 | #define CMSPAR 010000000000 /* mark or space (stick) parity */ | 159 | #define CMSPAR 010000000000 /* mark or space (stick) parity */ |
148 | #define CRTSCTS 020000000000 /* flow control */ | 160 | #define CRTSCTS 020000000000 /* flow control */ |
149 | 161 | ||
162 | #define IBSHIFT 16 | ||
163 | |||
150 | /* c_lflag bits */ | 164 | /* c_lflag bits */ |
151 | #define ISIG 0000001 | 165 | #define ISIG 0000001 |
152 | #define ICANON 0000002 | 166 | #define ICANON 0000002 |
diff --git a/include/asm-arm/termios.h b/include/asm-arm/termios.h index 329c324c4040..293e3f1bc3f2 100644 --- a/include/asm-arm/termios.h +++ b/include/asm-arm/termios.h | |||
@@ -82,8 +82,10 @@ struct termio { | |||
82 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ | 82 | copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ |
83 | }) | 83 | }) |
84 | 84 | ||
85 | #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) | 85 | #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2)) |
86 | #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) | 86 | #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2)) |
87 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) | ||
88 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) | ||
87 | 89 | ||
88 | #endif /* __KERNEL__ */ | 90 | #endif /* __KERNEL__ */ |
89 | 91 | ||
diff --git a/include/asm-arm/tlbflush.h b/include/asm-arm/tlbflush.h index ccd0de010e81..71be4fded7e2 100644 --- a/include/asm-arm/tlbflush.h +++ b/include/asm-arm/tlbflush.h | |||
@@ -138,6 +138,19 @@ | |||
138 | # define v6wbi_always_flags (-1UL) | 138 | # define v6wbi_always_flags (-1UL) |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | #ifdef CONFIG_CPU_TLB_V7 | ||
142 | # define v7wbi_possible_flags v6wbi_tlb_flags | ||
143 | # define v7wbi_always_flags v6wbi_tlb_flags | ||
144 | # ifdef _TLB | ||
145 | # define MULTI_TLB 1 | ||
146 | # else | ||
147 | # define _TLB v7wbi | ||
148 | # endif | ||
149 | #else | ||
150 | # define v7wbi_possible_flags 0 | ||
151 | # define v7wbi_always_flags (-1UL) | ||
152 | #endif | ||
153 | |||
141 | #ifndef _TLB | 154 | #ifndef _TLB |
142 | #error Unknown TLB model | 155 | #error Unknown TLB model |
143 | #endif | 156 | #endif |
diff --git a/include/asm-arm26/setup.h b/include/asm-arm26/setup.h index 10fd07c76662..e82562306475 100644 --- a/include/asm-arm26/setup.h +++ b/include/asm-arm26/setup.h | |||
@@ -173,7 +173,7 @@ struct tagtable { | |||
173 | int (*parse)(const struct tag *); | 173 | int (*parse)(const struct tag *); |
174 | }; | 174 | }; |
175 | 175 | ||
176 | #define __tag __attribute_used__ __attribute__((__section__(".taglist"))) | 176 | #define __tag __used __attribute__((__section__(".taglist"))) |
177 | #define __tagtable(tag, fn) \ | 177 | #define __tagtable(tag, fn) \ |
178 | static struct tagtable __tagtable_##fn __tag = { tag, fn } | 178 | static struct tagtable __tagtable_##fn __tag = { tag, fn } |
179 | 179 | ||
diff --git a/include/asm-m68k/mmzone.h b/include/asm-m68k/mmzone.h new file mode 100644 index 000000000000..e1f1ec7b7006 --- /dev/null +++ b/include/asm-m68k/mmzone.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _ASM_M68K_MMZONE_H_ | ||
2 | #define _ASM_M68K_MMZONE_H_ | ||
3 | |||
4 | extern pg_data_t pg_data_map[]; | ||
5 | |||
6 | #define NODE_DATA(nid) (&pg_data_map[nid]) | ||
7 | #define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map) | ||
8 | |||
9 | #endif /* _ASM_M68K_MMZONE_H_ */ | ||
diff --git a/include/asm-m68k/module.h b/include/asm-m68k/module.h index c6d75af2d8d3..382d20a6fc18 100644 --- a/include/asm-m68k/module.h +++ b/include/asm-m68k/module.h | |||
@@ -1,7 +1,39 @@ | |||
1 | #ifndef _ASM_M68K_MODULE_H | 1 | #ifndef _ASM_M68K_MODULE_H |
2 | #define _ASM_M68K_MODULE_H | 2 | #define _ASM_M68K_MODULE_H |
3 | struct mod_arch_specific { }; | 3 | |
4 | struct mod_arch_specific { | ||
5 | struct m68k_fixup_info *fixup_start, *fixup_end; | ||
6 | }; | ||
7 | |||
8 | #define MODULE_ARCH_INIT { \ | ||
9 | .fixup_start = __start_fixup, \ | ||
10 | .fixup_end = __stop_fixup, \ | ||
11 | } | ||
12 | |||
4 | #define Elf_Shdr Elf32_Shdr | 13 | #define Elf_Shdr Elf32_Shdr |
5 | #define Elf_Sym Elf32_Sym | 14 | #define Elf_Sym Elf32_Sym |
6 | #define Elf_Ehdr Elf32_Ehdr | 15 | #define Elf_Ehdr Elf32_Ehdr |
16 | |||
17 | |||
18 | enum m68k_fixup_type { | ||
19 | m68k_fixup_memoffset, | ||
20 | m68k_fixup_vnode_shift, | ||
21 | }; | ||
22 | |||
23 | struct m68k_fixup_info { | ||
24 | enum m68k_fixup_type type; | ||
25 | void *addr; | ||
26 | }; | ||
27 | |||
28 | #define m68k_fixup(type, addr) \ | ||
29 | " .section \".m68k_fixup\",\"aw\"\n" \ | ||
30 | " .long " #type "," #addr "\n" \ | ||
31 | " .previous\n" | ||
32 | |||
33 | extern struct m68k_fixup_info __start_fixup[], __stop_fixup[]; | ||
34 | |||
35 | struct module; | ||
36 | extern void module_fixup(struct module *mod, struct m68k_fixup_info *start, | ||
37 | struct m68k_fixup_info *end); | ||
38 | |||
7 | #endif /* _ASM_M68K_MODULE_H */ | 39 | #endif /* _ASM_M68K_MODULE_H */ |
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h index 61e4406ed96a..b5b78c01eb6c 100644 --- a/include/asm-m68k/motorola_pgtable.h +++ b/include/asm-m68k/motorola_pgtable.h | |||
@@ -130,7 +130,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp) | |||
130 | #define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROTNONE)) | 130 | #define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROTNONE)) |
131 | #define pte_clear(mm,addr,ptep) ({ pte_val(*(ptep)) = 0; }) | 131 | #define pte_clear(mm,addr,ptep) ({ pte_val(*(ptep)) = 0; }) |
132 | 132 | ||
133 | #define pte_page(pte) (mem_map + ((unsigned long)(__va(pte_val(pte)) - PAGE_OFFSET) >> PAGE_SHIFT)) | 133 | #define pte_page(pte) virt_to_page(__va(pte_val(pte))) |
134 | #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) | 134 | #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) |
135 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | 135 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) |
136 | 136 | ||
@@ -143,7 +143,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp) | |||
143 | while (--__i >= 0) \ | 143 | while (--__i >= 0) \ |
144 | *__ptr++ = 0; \ | 144 | *__ptr++ = 0; \ |
145 | }) | 145 | }) |
146 | #define pmd_page(pmd) (mem_map + ((unsigned long)(__va(pmd_val(pmd)) - PAGE_OFFSET) >> PAGE_SHIFT)) | 146 | #define pmd_page(pmd) virt_to_page(__va(pmd_val(pmd))) |
147 | 147 | ||
148 | 148 | ||
149 | #define pgd_none(pgd) (!pgd_val(pgd)) | 149 | #define pgd_none(pgd) (!pgd_val(pgd)) |
@@ -223,10 +223,10 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmdp, unsigned long address) | |||
223 | return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); | 223 | return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); |
224 | } | 224 | } |
225 | 225 | ||
226 | #define pte_offset_map(pmdp,address) ((pte_t *)kmap(pmd_page(*pmdp)) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) | 226 | #define pte_offset_map(pmdp,address) ((pte_t *)__pmd_page(*pmdp) + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) |
227 | #define pte_offset_map_nested(pmdp, address) pte_offset_map(pmdp, address) | 227 | #define pte_offset_map_nested(pmdp, address) pte_offset_map(pmdp, address) |
228 | #define pte_unmap(pte) kunmap(pte) | 228 | #define pte_unmap(pte) ((void)0) |
229 | #define pte_unmap_nested(pte) kunmap(pte) | 229 | #define pte_unmap_nested(pte) ((void)0) |
230 | 230 | ||
231 | /* | 231 | /* |
232 | * Allocate and free page tables. The xxx_kernel() versions are | 232 | * Allocate and free page tables. The xxx_kernel() versions are |
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index fcc165ddd09e..9e6d0d6debdb 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | #ifndef __ASSEMBLY__ | 28 | #ifndef __ASSEMBLY__ |
29 | 29 | ||
30 | #include <asm/module.h> | ||
31 | |||
30 | #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) | 32 | #define get_user_page(vaddr) __get_free_page(GFP_KERNEL) |
31 | #define free_user_page(page, addr) free_page(addr) | 33 | #define free_user_page(page, addr) free_page(addr) |
32 | 34 | ||
@@ -114,18 +116,33 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
114 | 116 | ||
115 | #ifndef __ASSEMBLY__ | 117 | #ifndef __ASSEMBLY__ |
116 | 118 | ||
119 | extern unsigned long m68k_memoffset; | ||
120 | |||
117 | #ifndef CONFIG_SUN3 | 121 | #ifndef CONFIG_SUN3 |
118 | 122 | ||
119 | #define WANT_PAGE_VIRTUAL | 123 | #define WANT_PAGE_VIRTUAL |
120 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
121 | extern unsigned long m68k_memoffset; | ||
122 | 124 | ||
123 | #define __pa(vaddr) ((unsigned long)(vaddr)+m68k_memoffset) | 125 | static inline unsigned long ___pa(void *vaddr) |
124 | #define __va(paddr) ((void *)((unsigned long)(paddr)-m68k_memoffset)) | 126 | { |
125 | #else | 127 | unsigned long paddr; |
126 | #define __pa(vaddr) virt_to_phys((void *)(vaddr)) | 128 | asm ( |
127 | #define __va(paddr) phys_to_virt((unsigned long)(paddr)) | 129 | "1: addl #0,%0\n" |
128 | #endif | 130 | m68k_fixup(%c2, 1b+2) |
131 | : "=r" (paddr) | ||
132 | : "0" (vaddr), "i" (m68k_fixup_memoffset)); | ||
133 | return paddr; | ||
134 | } | ||
135 | #define __pa(vaddr) ___pa((void *)(vaddr)) | ||
136 | static inline void *__va(unsigned long paddr) | ||
137 | { | ||
138 | void *vaddr; | ||
139 | asm ( | ||
140 | "1: subl #0,%0\n" | ||
141 | m68k_fixup(%c2, 1b+2) | ||
142 | : "=r" (vaddr) | ||
143 | : "0" (paddr), "i" (m68k_fixup_memoffset)); | ||
144 | return vaddr; | ||
145 | } | ||
129 | 146 | ||
130 | #else /* !CONFIG_SUN3 */ | 147 | #else /* !CONFIG_SUN3 */ |
131 | /* This #define is a horrible hack to suppress lots of warnings. --m */ | 148 | /* This #define is a horrible hack to suppress lots of warnings. --m */ |
@@ -161,11 +178,47 @@ static inline void *__va(unsigned long x) | |||
161 | #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) | 178 | #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) |
162 | #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) | 179 | #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) |
163 | 180 | ||
164 | #define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr)-PAGE_OFFSET) >> PAGE_SHIFT)) | 181 | extern int m68k_virt_to_node_shift; |
165 | #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) | 182 | |
183 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
184 | #define __virt_to_node(addr) (&pg_data_map[0]) | ||
185 | #else | ||
186 | extern struct pglist_data *pg_data_table[]; | ||
187 | |||
188 | static inline __attribute_const__ int __virt_to_node_shift(void) | ||
189 | { | ||
190 | int shift; | ||
191 | |||
192 | asm ( | ||
193 | "1: moveq #0,%0\n" | ||
194 | m68k_fixup(%c1, 1b) | ||
195 | : "=d" (shift) | ||
196 | : "i" (m68k_fixup_vnode_shift)); | ||
197 | return shift; | ||
198 | } | ||
199 | |||
200 | #define __virt_to_node(addr) (pg_data_table[(unsigned long)(addr) >> __virt_to_node_shift()]) | ||
201 | #endif | ||
166 | 202 | ||
167 | #define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn)) | 203 | #define virt_to_page(addr) ({ \ |
168 | #define page_to_pfn(page) virt_to_pfn(page_to_virt(page)) | 204 | pfn_to_page(virt_to_pfn(addr)); \ |
205 | }) | ||
206 | #define page_to_virt(page) ({ \ | ||
207 | pfn_to_virt(page_to_pfn(page)); \ | ||
208 | }) | ||
209 | |||
210 | #define pfn_to_page(pfn) ({ \ | ||
211 | unsigned long __pfn = (pfn); \ | ||
212 | struct pglist_data *pgdat; \ | ||
213 | pgdat = __virt_to_node((unsigned long)pfn_to_virt(__pfn)); \ | ||
214 | pgdat->node_mem_map + (__pfn - pgdat->node_start_pfn); \ | ||
215 | }) | ||
216 | #define page_to_pfn(_page) ({ \ | ||
217 | struct page *__p = (_page); \ | ||
218 | struct pglist_data *pgdat; \ | ||
219 | pgdat = &pg_data_map[page_to_nid(__p)]; \ | ||
220 | ((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn; \ | ||
221 | }) | ||
169 | 222 | ||
170 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory) | 223 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory) |
171 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn)) | 224 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn)) |
diff --git a/include/asm-m68k/pgalloc.h b/include/asm-m68k/pgalloc.h index a9cfb4b99d88..4cb1a57ab763 100644 --- a/include/asm-m68k/pgalloc.h +++ b/include/asm-m68k/pgalloc.h | |||
@@ -8,11 +8,12 @@ | |||
8 | #include <asm/virtconvert.h> | 8 | #include <asm/virtconvert.h> |
9 | 9 | ||
10 | 10 | ||
11 | |||
12 | #ifdef CONFIG_SUN3 | 11 | #ifdef CONFIG_SUN3 |
13 | #include <asm/sun3_pgalloc.h> | 12 | #include <asm/sun3_pgalloc.h> |
14 | #else | 13 | #else |
15 | #include <asm/motorola_pgalloc.h> | 14 | #include <asm/motorola_pgalloc.h> |
16 | #endif | 15 | #endif |
17 | 16 | ||
17 | extern void m68k_setup_node(int node); | ||
18 | |||
18 | #endif /* M68K_PGALLOC_H */ | 19 | #endif /* M68K_PGALLOC_H */ |
diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h index 555b87a1f7e3..778a4c538eb2 100644 --- a/include/asm-m68k/pgtable.h +++ b/include/asm-m68k/pgtable.h | |||
@@ -107,22 +107,7 @@ extern void *empty_zero_page; | |||
107 | /* 64-bit machines, beware! SRB. */ | 107 | /* 64-bit machines, beware! SRB. */ |
108 | #define SIZEOF_PTR_LOG2 2 | 108 | #define SIZEOF_PTR_LOG2 2 |
109 | 109 | ||
110 | /* | 110 | #define mm_end_of_chunk(addr, len) 0 |
111 | * Check if the addr/len goes up to the end of a physical | ||
112 | * memory chunk. Used for DMA functions. | ||
113 | */ | ||
114 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
115 | /* | ||
116 | * It makes no sense to consider whether we cross a memory boundary if | ||
117 | * we support just one physical chunk of memory. | ||
118 | */ | ||
119 | static inline int mm_end_of_chunk(unsigned long addr, int len) | ||
120 | { | ||
121 | return 0; | ||
122 | } | ||
123 | #else | ||
124 | int mm_end_of_chunk (unsigned long addr, int len); | ||
125 | #endif | ||
126 | 111 | ||
127 | extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode); | 112 | extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode); |
128 | 113 | ||
diff --git a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h index 5156a28a18d8..b9e62c1e7ae3 100644 --- a/include/asm-m68k/sun3_pgtable.h +++ b/include/asm-m68k/sun3_pgtable.h | |||
@@ -132,8 +132,8 @@ static inline void pte_clear (struct mm_struct *mm, unsigned long addr, pte_t *p | |||
132 | #define pfn_pte(pfn, pgprot) \ | 132 | #define pfn_pte(pfn, pgprot) \ |
133 | ({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; }) | 133 | ({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; }) |
134 | 134 | ||
135 | #define pte_page(pte) (mem_map+((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT)) | 135 | #define pte_page(pte) virt_to_page(__pte_page(pte)) |
136 | #define pmd_page(pmd) (mem_map+((__pmd_page(pmd) - PAGE_OFFSET) >> PAGE_SHIFT)) | 136 | #define pmd_page(pmd) virt_to_page(__pmd_page(pmd)) |
137 | 137 | ||
138 | 138 | ||
139 | static inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); } | 139 | static inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); } |
diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h index 83a87c9b1a16..dea32fbc7e51 100644 --- a/include/asm-m68k/virtconvert.h +++ b/include/asm-m68k/virtconvert.h | |||
@@ -8,56 +8,35 @@ | |||
8 | #ifdef __KERNEL__ | 8 | #ifdef __KERNEL__ |
9 | 9 | ||
10 | #include <linux/compiler.h> | 10 | #include <linux/compiler.h> |
11 | #include <linux/mmzone.h> | ||
11 | #include <asm/setup.h> | 12 | #include <asm/setup.h> |
12 | #include <asm/page.h> | 13 | #include <asm/page.h> |
13 | 14 | ||
14 | #ifdef CONFIG_AMIGA | ||
15 | #include <asm/amigahw.h> | ||
16 | #endif | ||
17 | |||
18 | /* | 15 | /* |
19 | * Change virtual addresses to physical addresses and vv. | 16 | * Change virtual addresses to physical addresses and vv. |
20 | */ | 17 | */ |
21 | #ifndef CONFIG_SUN3 | ||
22 | extern unsigned long mm_vtop(unsigned long addr) __attribute_const__; | ||
23 | extern unsigned long mm_ptov(unsigned long addr) __attribute_const__; | ||
24 | #else | ||
25 | static inline unsigned long mm_vtop(unsigned long vaddr) | ||
26 | { | ||
27 | return __pa(vaddr); | ||
28 | } | ||
29 | |||
30 | static inline unsigned long mm_ptov(unsigned long paddr) | ||
31 | { | ||
32 | return (unsigned long)__va(paddr); | ||
33 | } | ||
34 | #endif | ||
35 | |||
36 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
37 | static inline unsigned long virt_to_phys(void *vaddr) | ||
38 | { | ||
39 | return (unsigned long)vaddr - PAGE_OFFSET + m68k_memory[0].addr; | ||
40 | } | ||
41 | |||
42 | static inline void * phys_to_virt(unsigned long paddr) | ||
43 | { | ||
44 | return (void *)(paddr - m68k_memory[0].addr + PAGE_OFFSET); | ||
45 | } | ||
46 | #else | ||
47 | static inline unsigned long virt_to_phys(void *address) | 18 | static inline unsigned long virt_to_phys(void *address) |
48 | { | 19 | { |
49 | return mm_vtop((unsigned long)address); | 20 | return __pa(address); |
50 | } | 21 | } |
51 | 22 | ||
52 | static inline void *phys_to_virt(unsigned long address) | 23 | static inline void *phys_to_virt(unsigned long address) |
53 | { | 24 | { |
54 | return (void *) mm_ptov(address); | 25 | return __va(address); |
55 | } | 26 | } |
56 | #endif | ||
57 | 27 | ||
58 | /* Permanent address of a page. */ | 28 | /* Permanent address of a page. */ |
59 | #define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) | 29 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK |
60 | #define page_to_phys(page) virt_to_phys((void *)__page_address(page)) | 30 | #define page_to_phys(page) \ |
31 | __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT)) | ||
32 | #else | ||
33 | #define page_to_phys(_page) ({ \ | ||
34 | struct page *__page = _page; \ | ||
35 | struct pglist_data *pgdat; \ | ||
36 | pgdat = pg_data_table[page_to_nid(__page)]; \ | ||
37 | page_to_pfn(__page) << PAGE_SHIFT; \ | ||
38 | }) | ||
39 | #endif | ||
61 | 40 | ||
62 | /* | 41 | /* |
63 | * IO bus memory addresses are 1:1 with the physical address, | 42 | * IO bus memory addresses are 1:1 with the physical address, |
diff --git a/include/asm-sh/cpu-sh4/freq.h b/include/asm-sh/cpu-sh4/freq.h index 86564e7a26ae..39f41fcd509d 100644 --- a/include/asm-sh/cpu-sh4/freq.h +++ b/include/asm-sh/cpu-sh4/freq.h | |||
@@ -24,6 +24,9 @@ | |||
24 | #define FRQMR1 0xffc80014 | 24 | #define FRQMR1 0xffc80014 |
25 | #else | 25 | #else |
26 | #define FRQCR 0xffc00000 | 26 | #define FRQCR 0xffc00000 |
27 | #define FRQCR_PSTBY 0x0200 | ||
28 | #define FRQCR_PLLEN 0x0400 | ||
29 | #define FRQCR_CKOEN 0x0800 | ||
27 | #endif | 30 | #endif |
28 | #define MIN_DIVISOR_NR 0 | 31 | #define MIN_DIVISOR_NR 0 |
29 | #define MAX_DIVISOR_NR 3 | 32 | #define MAX_DIVISOR_NR 3 |
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h index faf3051cd429..6034d4a29e73 100644 --- a/include/asm-sh/dma.h +++ b/include/asm-sh/dma.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | #include <linux/wait.h> | 15 | #include <linux/wait.h> |
16 | #include <linux/sched.h> | ||
16 | #include <linux/sysdev.h> | 17 | #include <linux/sysdev.h> |
17 | #include <asm/cpu/dma.h> | 18 | #include <asm/cpu/dma.h> |
18 | 19 | ||
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h index a0e55b09e4fd..aa80930ce8e4 100644 --- a/include/asm-sh/io.h +++ b/include/asm-sh/io.h | |||
@@ -116,13 +116,13 @@ void __raw_readsl(unsigned long addr, void *data, int longlen); | |||
116 | * redefined by userlevel programs. | 116 | * redefined by userlevel programs. |
117 | */ | 117 | */ |
118 | #ifdef __readb | 118 | #ifdef __readb |
119 | # define readb(a) ({ unsigned long r_ = __raw_readb(a); mb(); r_; }) | 119 | # define readb(a) ({ unsigned int r_ = __raw_readb(a); mb(); r_; }) |
120 | #endif | 120 | #endif |
121 | #ifdef __raw_readw | 121 | #ifdef __raw_readw |
122 | # define readw(a) ({ unsigned long r_ = __raw_readw(a); mb(); r_; }) | 122 | # define readw(a) ({ unsigned int r_ = __raw_readw(a); mb(); r_; }) |
123 | #endif | 123 | #endif |
124 | #ifdef __raw_readl | 124 | #ifdef __raw_readl |
125 | # define readl(a) ({ unsigned long r_ = __raw_readl(a); mb(); r_; }) | 125 | # define readl(a) ({ unsigned int r_ = __raw_readl(a); mb(); r_; }) |
126 | #endif | 126 | #endif |
127 | 127 | ||
128 | #ifdef __raw_writeb | 128 | #ifdef __raw_writeb |
diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h index 71ecddf70db3..caa7b93f1bce 100644 --- a/include/asm-sh/smp.h +++ b/include/asm-sh/smp.h | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #ifdef CONFIG_SMP | 16 | #ifdef CONFIG_SMP |
17 | 17 | ||
18 | #include <asm/spinlock.h> | 18 | #include <linux/spinlock.h> |
19 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
20 | #include <asm/current.h> | 20 | #include <asm/current.h> |
21 | 21 | ||
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h index 2586eef07d57..92f6e2008b2e 100644 --- a/include/asm-sh/spinlock.h +++ b/include/asm-sh/spinlock.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #define __ASM_SH_SPINLOCK_H | 11 | #define __ASM_SH_SPINLOCK_H |
12 | 12 | ||
13 | #include <asm/atomic.h> | 13 | #include <asm/atomic.h> |
14 | #include <asm/spinlock_types.h> | ||
14 | 15 | ||
15 | /* | 16 | /* |
16 | * Your basic SMP spinlocks, allowing only a single CPU anywhere | 17 | * Your basic SMP spinlocks, allowing only a single CPU anywhere |
@@ -42,7 +43,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock) | |||
42 | 43 | ||
43 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 44 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) |
44 | { | 45 | { |
45 | assert_spin_locked(lock); | 46 | //assert_spin_locked(lock); |
46 | 47 | ||
47 | lock->lock = 0; | 48 | lock->lock = 0; |
48 | } | 49 | } |
@@ -88,6 +89,11 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
88 | __raw_spin_unlock(&rw->lock); | 89 | __raw_spin_unlock(&rw->lock); |
89 | } | 90 | } |
90 | 91 | ||
92 | static inline int __raw_write_can_lock(raw_rwlock_t *rw) | ||
93 | { | ||
94 | return (atomic_read(&rw->counter) == RW_LOCK_BIAS); | ||
95 | } | ||
96 | |||
91 | static inline int __raw_read_trylock(raw_rwlock_t *lock) | 97 | static inline int __raw_read_trylock(raw_rwlock_t *lock) |
92 | { | 98 | { |
93 | atomic_t *count = (atomic_t*)lock; | 99 | atomic_t *count = (atomic_t*)lock; |
diff --git a/include/asm-sh/spinlock_types.h b/include/asm-sh/spinlock_types.h index 8c41b6c3aac8..5c58134f2c4e 100644 --- a/include/asm-sh/spinlock_types.h +++ b/include/asm-sh/spinlock_types.h | |||
@@ -9,7 +9,9 @@ typedef struct { | |||
9 | volatile unsigned long lock; | 9 | volatile unsigned long lock; |
10 | } raw_spinlock_t; | 10 | } raw_spinlock_t; |
11 | 11 | ||
12 | #define __SPIN_LOCK_UNLOCKED { 0 } | 12 | #define __RAW_SPIN_LOCK_UNLOCKED { 1 } |
13 | |||
14 | #include <asm/atomic.h> | ||
13 | 15 | ||
14 | typedef struct { | 16 | typedef struct { |
15 | raw_spinlock_t lock; | 17 | raw_spinlock_t lock; |
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h index 731fa56e0c37..bdca5416d8b0 100644 --- a/include/asm-sparc/atomic.h +++ b/include/asm-sparc/atomic.h | |||
@@ -2,6 +2,7 @@ | |||
2 | * | 2 | * |
3 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | 3 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) |
4 | * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com.au) | 4 | * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com.au) |
5 | * Copyright (C) 2007 Kyle McMartin (kyle@parisc-linux.org) | ||
5 | * | 6 | * |
6 | * Additions by Keith M Wesolowski (wesolows@foobazco.org) based | 7 | * Additions by Keith M Wesolowski (wesolows@foobazco.org) based |
7 | * on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>. | 8 | * on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>. |
@@ -10,11 +11,48 @@ | |||
10 | #ifndef __ARCH_SPARC_ATOMIC__ | 11 | #ifndef __ARCH_SPARC_ATOMIC__ |
11 | #define __ARCH_SPARC_ATOMIC__ | 12 | #define __ARCH_SPARC_ATOMIC__ |
12 | 13 | ||
14 | #include <linux/types.h> | ||
13 | 15 | ||
14 | typedef struct { volatile int counter; } atomic_t; | 16 | typedef struct { volatile int counter; } atomic_t; |
15 | 17 | ||
16 | #ifdef __KERNEL__ | 18 | #ifdef __KERNEL__ |
17 | 19 | ||
20 | /* Emulate cmpxchg() the same way we emulate atomics, | ||
21 | * by hashing the object address and indexing into an array | ||
22 | * of spinlocks to get a bit of performance... | ||
23 | * | ||
24 | * See arch/sparc/lib/atomic32.c for implementation. | ||
25 | * | ||
26 | * Cribbed from <asm-parisc/atomic.h> | ||
27 | */ | ||
28 | #define __HAVE_ARCH_CMPXCHG 1 | ||
29 | |||
30 | /* bug catcher for when unsupported size is used - won't link */ | ||
31 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
32 | /* we only need to support cmpxchg of a u32 on sparc */ | ||
33 | extern unsigned long __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); | ||
34 | |||
35 | /* don't worry...optimizer will get rid of most of this */ | ||
36 | static __inline__ unsigned long | ||
37 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) | ||
38 | { | ||
39 | switch(size) { | ||
40 | case 4: | ||
41 | return __cmpxchg_u32((u32 *)ptr, (u32)old, (u32)new_); | ||
42 | default: | ||
43 | __cmpxchg_called_with_bad_pointer(); | ||
44 | break; | ||
45 | } | ||
46 | return old; | ||
47 | } | ||
48 | |||
49 | #define cmpxchg(ptr,o,n) ({ \ | ||
50 | __typeof__(*(ptr)) _o_ = (o); \ | ||
51 | __typeof__(*(ptr)) _n_ = (n); \ | ||
52 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
53 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
54 | }) | ||
55 | |||
18 | #define ATOMIC_INIT(i) { (i) } | 56 | #define ATOMIC_INIT(i) { (i) } |
19 | 57 | ||
20 | extern int __atomic_add_return(int, atomic_t *); | 58 | extern int __atomic_add_return(int, atomic_t *); |
diff --git a/include/asm-sparc64/bugs.h b/include/asm-sparc64/bugs.h index 120422fdb02f..bf39d86c0c9e 100644 --- a/include/asm-sparc64/bugs.h +++ b/include/asm-sparc64/bugs.h | |||
@@ -1,9 +1,8 @@ | |||
1 | /* $Id: bugs.h,v 1.1 1996/12/26 13:25:20 davem Exp $ | 1 | /* bugs.h: Sparc64 probes for various bugs. |
2 | * include/asm-sparc64/bugs.h: Sparc probes for various bugs. | ||
3 | * | 2 | * |
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | 3 | * Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net) |
5 | */ | 4 | */ |
6 | 5 | #include <asm/sstate.h> | |
7 | 6 | ||
8 | extern unsigned long loops_per_jiffy; | 7 | extern unsigned long loops_per_jiffy; |
9 | 8 | ||
@@ -12,4 +11,5 @@ static void __init check_bugs(void) | |||
12 | #ifndef CONFIG_SMP | 11 | #ifndef CONFIG_SMP |
13 | cpu_data(0).udelay_val = loops_per_jiffy; | 12 | cpu_data(0).udelay_val = loops_per_jiffy; |
14 | #endif | 13 | #endif |
14 | sstate_running(); | ||
15 | } | 15 | } |
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h index e89922d6718c..03c385de7619 100644 --- a/include/asm-sparc64/cpudata.h +++ b/include/asm-sparc64/cpudata.h | |||
@@ -17,11 +17,11 @@ | |||
17 | typedef struct { | 17 | typedef struct { |
18 | /* Dcache line 1 */ | 18 | /* Dcache line 1 */ |
19 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ | 19 | unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ |
20 | unsigned int __pad0_1; | 20 | unsigned int __pad0; |
21 | unsigned int __pad0_2; | ||
22 | unsigned int __pad1; | ||
23 | unsigned long clock_tick; /* %tick's per second */ | 21 | unsigned long clock_tick; /* %tick's per second */ |
24 | unsigned long udelay_val; | 22 | unsigned long udelay_val; |
23 | unsigned int __pad1; | ||
24 | unsigned int __pad2; | ||
25 | 25 | ||
26 | /* Dcache line 2, rarely used */ | 26 | /* Dcache line 2, rarely used */ |
27 | unsigned int dcache_size; | 27 | unsigned int dcache_size; |
@@ -30,8 +30,8 @@ typedef struct { | |||
30 | unsigned int icache_line_size; | 30 | unsigned int icache_line_size; |
31 | unsigned int ecache_size; | 31 | unsigned int ecache_size; |
32 | unsigned int ecache_line_size; | 32 | unsigned int ecache_line_size; |
33 | int core_id; | ||
33 | unsigned int __pad3; | 34 | unsigned int __pad3; |
34 | unsigned int __pad4; | ||
35 | } cpuinfo_sparc; | 35 | } cpuinfo_sparc; |
36 | 36 | ||
37 | DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); | 37 | DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); |
@@ -76,12 +76,18 @@ struct trap_per_cpu { | |||
76 | 76 | ||
77 | /* Dcache line 8: IRQ work list, and keep trap_block a power-of-2 in size. */ | 77 | /* Dcache line 8: IRQ work list, and keep trap_block a power-of-2 in size. */ |
78 | unsigned int irq_worklist; | 78 | unsigned int irq_worklist; |
79 | unsigned int __pad1; | 79 | unsigned int cpu_mondo_qmask; |
80 | unsigned long __pad2[3]; | 80 | unsigned int dev_mondo_qmask; |
81 | unsigned int resum_qmask; | ||
82 | unsigned int nonresum_qmask; | ||
83 | unsigned int __pad2[3]; | ||
81 | } __attribute__((aligned(64))); | 84 | } __attribute__((aligned(64))); |
82 | extern struct trap_per_cpu trap_block[NR_CPUS]; | 85 | extern struct trap_per_cpu trap_block[NR_CPUS]; |
83 | extern void init_cur_cpu_trap(struct thread_info *); | 86 | extern void init_cur_cpu_trap(struct thread_info *); |
84 | extern void setup_tba(void); | 87 | extern void setup_tba(void); |
88 | extern int ncpus_probed; | ||
89 | |||
90 | extern unsigned long real_hard_smp_processor_id(void); | ||
85 | 91 | ||
86 | struct cpuid_patch_entry { | 92 | struct cpuid_patch_entry { |
87 | unsigned int addr; | 93 | unsigned int addr; |
@@ -122,6 +128,10 @@ extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch, | |||
122 | #define TRAP_PER_CPU_TSB_HUGE 0xd0 | 128 | #define TRAP_PER_CPU_TSB_HUGE 0xd0 |
123 | #define TRAP_PER_CPU_TSB_HUGE_TEMP 0xd8 | 129 | #define TRAP_PER_CPU_TSB_HUGE_TEMP 0xd8 |
124 | #define TRAP_PER_CPU_IRQ_WORKLIST 0xe0 | 130 | #define TRAP_PER_CPU_IRQ_WORKLIST 0xe0 |
131 | #define TRAP_PER_CPU_CPU_MONDO_QMASK 0xe4 | ||
132 | #define TRAP_PER_CPU_DEV_MONDO_QMASK 0xe8 | ||
133 | #define TRAP_PER_CPU_RESUM_QMASK 0xec | ||
134 | #define TRAP_PER_CPU_NONRESUM_QMASK 0xf0 | ||
125 | 135 | ||
126 | #define TRAP_BLOCK_SZ_SHIFT 8 | 136 | #define TRAP_BLOCK_SZ_SHIFT 8 |
127 | 137 | ||
@@ -192,7 +202,7 @@ extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch, | |||
192 | * the calculations done by the macro mid-stream. | 202 | * the calculations done by the macro mid-stream. |
193 | */ | 203 | */ |
194 | #define LOAD_PER_CPU_BASE(DEST, THR, REG1, REG2, REG3) \ | 204 | #define LOAD_PER_CPU_BASE(DEST, THR, REG1, REG2, REG3) \ |
195 | ldub [THR + TI_CPU], REG1; \ | 205 | lduh [THR + TI_CPU], REG1; \ |
196 | sethi %hi(__per_cpu_shift), REG3; \ | 206 | sethi %hi(__per_cpu_shift), REG3; \ |
197 | sethi %hi(__per_cpu_base), REG2; \ | 207 | sethi %hi(__per_cpu_base), REG2; \ |
198 | ldx [REG3 + %lo(__per_cpu_shift)], REG3; \ | 208 | ldx [REG3 + %lo(__per_cpu_shift)], REG3; \ |
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h index a5558c87556d..4a43075a0619 100644 --- a/include/asm-sparc64/hypervisor.h +++ b/include/asm-sparc64/hypervisor.h | |||
@@ -73,6 +73,8 @@ | |||
73 | #define HV_ENOTSUPPORTED 13 /* Function not supported */ | 73 | #define HV_ENOTSUPPORTED 13 /* Function not supported */ |
74 | #define HV_ENOMAP 14 /* No mapping found */ | 74 | #define HV_ENOMAP 14 /* No mapping found */ |
75 | #define HV_ETOOMANY 15 /* Too many items specified */ | 75 | #define HV_ETOOMANY 15 /* Too many items specified */ |
76 | #define HV_ECHANNEL 16 /* Invalid LDC channel */ | ||
77 | #define HV_EBUSY 17 /* Resource busy */ | ||
76 | 78 | ||
77 | /* mach_exit() | 79 | /* mach_exit() |
78 | * TRAP: HV_FAST_TRAP | 80 | * TRAP: HV_FAST_TRAP |
@@ -95,6 +97,10 @@ | |||
95 | */ | 97 | */ |
96 | #define HV_FAST_MACH_EXIT 0x00 | 98 | #define HV_FAST_MACH_EXIT 0x00 |
97 | 99 | ||
100 | #ifndef __ASSEMBLY__ | ||
101 | extern void sun4v_mach_exit(unsigned long exit_core); | ||
102 | #endif | ||
103 | |||
98 | /* Domain services. */ | 104 | /* Domain services. */ |
99 | 105 | ||
100 | /* mach_desc() | 106 | /* mach_desc() |
@@ -120,7 +126,13 @@ | |||
120 | */ | 126 | */ |
121 | #define HV_FAST_MACH_DESC 0x01 | 127 | #define HV_FAST_MACH_DESC 0x01 |
122 | 128 | ||
123 | /* mach_exit() | 129 | #ifndef __ASSEMBLY__ |
130 | extern unsigned long sun4v_mach_desc(unsigned long buffer_pa, | ||
131 | unsigned long buf_len, | ||
132 | unsigned long *real_buf_len); | ||
133 | #endif | ||
134 | |||
135 | /* mach_sir() | ||
124 | * TRAP: HV_FAST_TRAP | 136 | * TRAP: HV_FAST_TRAP |
125 | * FUNCTION: HV_FAST_MACH_SIR | 137 | * FUNCTION: HV_FAST_MACH_SIR |
126 | * ERRORS: This service does not return. | 138 | * ERRORS: This service does not return. |
@@ -135,53 +147,66 @@ | |||
135 | */ | 147 | */ |
136 | #define HV_FAST_MACH_SIR 0x02 | 148 | #define HV_FAST_MACH_SIR 0x02 |
137 | 149 | ||
138 | /* mach_set_soft_state() | 150 | #ifndef __ASSEMBLY__ |
151 | extern void sun4v_mach_sir(void); | ||
152 | #endif | ||
153 | |||
154 | /* mach_set_watchdog() | ||
139 | * TRAP: HV_FAST_TRAP | 155 | * TRAP: HV_FAST_TRAP |
140 | * FUNCTION: HV_FAST_MACH_SET_SOFT_STATE | 156 | * FUNCTION: HV_FAST_MACH_SET_WATCHDOG |
141 | * ARG0: software state | 157 | * ARG0: timeout in milliseconds |
142 | * ARG1: software state description pointer | ||
143 | * RET0: status | 158 | * RET0: status |
144 | * ERRORS: EINVAL software state not valid or software state | 159 | * RET1: time remaining in milliseconds |
145 | * description is not NULL terminated | ||
146 | * ENORADDR software state description pointer is not a | ||
147 | * valid real address | ||
148 | * EBADALIGNED software state description is not correctly | ||
149 | * aligned | ||
150 | * | 160 | * |
151 | * This allows the guest to report it's soft state to the hypervisor. There | 161 | * A guest uses this API to set a watchdog timer. Once the gues has set |
152 | * are two primary components to this state. The first part states whether | 162 | * the timer, it must call the timer service again either to disable or |
153 | * the guest software is running or not. The second containts optional | 163 | * postpone the expiration. If the timer expires before being reset or |
154 | * details specific to the software. | 164 | * disabled, then the hypervisor take a platform specific action leading |
165 | * to guest termination within a bounded time period. The platform action | ||
166 | * may include recovery actions such as reporting the expiration to a | ||
167 | * Service Processor, and/or automatically restarting the gues. | ||
155 | * | 168 | * |
156 | * The software state argument is defined below in HV_SOFT_STATE_*, and | 169 | * The 'timeout' parameter is specified in milliseconds, however the |
157 | * indicates whether the guest is operating normally or in a transitional | 170 | * implementated granularity is given by the 'watchdog-resolution' |
158 | * state. | 171 | * property in the 'platform' node of the guest's machine description. |
172 | * The largest allowed timeout value is specified by the | ||
173 | * 'watchdog-max-timeout' property of the 'platform' node. | ||
159 | * | 174 | * |
160 | * The software state description argument is a real address of a data buffer | 175 | * If the 'timeout' argument is not zero, the watchdog timer is set to |
161 | * of size 32-bytes aligned on a 32-byte boundary. It is treated as a NULL | 176 | * expire after a minimum of 'timeout' milliseconds. |
162 | * terminated 7-bit ASCII string of up to 31 characters not including the | ||
163 | * NULL termination. | ||
164 | */ | ||
165 | #define HV_FAST_MACH_SET_SOFT_STATE 0x03 | ||
166 | #define HV_SOFT_STATE_NORMAL 0x01 | ||
167 | #define HV_SOFT_STATE_TRANSITION 0x02 | ||
168 | |||
169 | /* mach_get_soft_state() | ||
170 | * TRAP: HV_FAST_TRAP | ||
171 | * FUNCTION: HV_FAST_MACH_GET_SOFT_STATE | ||
172 | * ARG0: software state description pointer | ||
173 | * RET0: status | ||
174 | * RET1: software state | ||
175 | * ERRORS: ENORADDR software state description pointer is not a | ||
176 | * valid real address | ||
177 | * EBADALIGNED software state description is not correctly | ||
178 | * aligned | ||
179 | * | 177 | * |
180 | * Retrieve the current value of the guest's software state. The rules | 178 | * If the 'timeout' argument is zero, the watchdog timer is disabled. |
181 | * for the software state pointer are the same as for mach_set_soft_state() | 179 | * |
182 | * above. | 180 | * If the 'timeout' value exceeds the value of the 'max-watchdog-timeout' |
181 | * property, the hypervisor leaves the watchdog timer state unchanged, | ||
182 | * and returns a status of EINVAL. | ||
183 | * | ||
184 | * The 'time remaining' return value is valid regardless of whether the | ||
185 | * return status is EOK or EINVAL. A non-zero return value indicates the | ||
186 | * number of milliseconds that were remaining until the timer was to expire. | ||
187 | * If less than one millisecond remains, the return value is '1'. If the | ||
188 | * watchdog timer was disabled at the time of the call, the return value is | ||
189 | * zero. | ||
190 | * | ||
191 | * If the hypervisor cannot support the exact timeout value requested, but | ||
192 | * can support a larger timeout value, the hypervisor may round the actual | ||
193 | * timeout to a value larger than the requested timeout, consequently the | ||
194 | * 'time remaining' return value may be larger than the previously requested | ||
195 | * timeout value. | ||
196 | * | ||
197 | * Any guest OS debugger should be aware that the watchdog service may be in | ||
198 | * use. Consequently, it is recommended that the watchdog service is | ||
199 | * disabled upon debugger entry (e.g. reaching a breakpoint), and then | ||
200 | * re-enabled upon returning to normal execution. The API has been designed | ||
201 | * with this in mind, and the 'time remaining' result of the disable call may | ||
202 | * be used directly as the timeout argument of the re-enable call. | ||
183 | */ | 203 | */ |
184 | #define HV_FAST_MACH_GET_SOFT_STATE 0x04 | 204 | #define HV_FAST_MACH_SET_WATCHDOG 0x05 |
205 | |||
206 | #ifndef __ASSEMBLY__ | ||
207 | extern unsigned long sun4v_mach_set_watchdog(unsigned long timeout, | ||
208 | unsigned long *orig_timeout); | ||
209 | #endif | ||
185 | 210 | ||
186 | /* CPU services. | 211 | /* CPU services. |
187 | * | 212 | * |
@@ -206,8 +231,8 @@ | |||
206 | * FUNCTION: HV_FAST_CPU_START | 231 | * FUNCTION: HV_FAST_CPU_START |
207 | * ARG0: CPU ID | 232 | * ARG0: CPU ID |
208 | * ARG1: PC | 233 | * ARG1: PC |
209 | * ARG1: RTBA | 234 | * ARG2: RTBA |
210 | * ARG1: target ARG0 | 235 | * ARG3: target ARG0 |
211 | * RET0: status | 236 | * RET0: status |
212 | * ERRORS: ENOCPU Invalid CPU ID | 237 | * ERRORS: ENOCPU Invalid CPU ID |
213 | * EINVAL Target CPU ID is not in the stopped state | 238 | * EINVAL Target CPU ID is not in the stopped state |
@@ -224,6 +249,13 @@ | |||
224 | */ | 249 | */ |
225 | #define HV_FAST_CPU_START 0x10 | 250 | #define HV_FAST_CPU_START 0x10 |
226 | 251 | ||
252 | #ifndef __ASSEMBLY__ | ||
253 | extern unsigned long sun4v_cpu_start(unsigned long cpuid, | ||
254 | unsigned long pc, | ||
255 | unsigned long rtba, | ||
256 | unsigned long arg0); | ||
257 | #endif | ||
258 | |||
227 | /* cpu_stop() | 259 | /* cpu_stop() |
228 | * TRAP: HV_FAST_TRAP | 260 | * TRAP: HV_FAST_TRAP |
229 | * FUNCTION: HV_FAST_CPU_STOP | 261 | * FUNCTION: HV_FAST_CPU_STOP |
@@ -245,6 +277,10 @@ | |||
245 | */ | 277 | */ |
246 | #define HV_FAST_CPU_STOP 0x11 | 278 | #define HV_FAST_CPU_STOP 0x11 |
247 | 279 | ||
280 | #ifndef __ASSEMBLY__ | ||
281 | extern unsigned long sun4v_cpu_stop(unsigned long cpuid); | ||
282 | #endif | ||
283 | |||
248 | /* cpu_yield() | 284 | /* cpu_yield() |
249 | * TRAP: HV_FAST_TRAP | 285 | * TRAP: HV_FAST_TRAP |
250 | * FUNCTION: HV_FAST_CPU_YIELD | 286 | * FUNCTION: HV_FAST_CPU_YIELD |
@@ -588,6 +624,11 @@ struct hv_fault_status { | |||
588 | */ | 624 | */ |
589 | #define HV_FAST_MMU_TSB_CTX0 0x20 | 625 | #define HV_FAST_MMU_TSB_CTX0 0x20 |
590 | 626 | ||
627 | #ifndef __ASSEMBLY__ | ||
628 | extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions, | ||
629 | unsigned long tsb_desc_ra); | ||
630 | #endif | ||
631 | |||
591 | /* mmu_tsb_ctxnon0() | 632 | /* mmu_tsb_ctxnon0() |
592 | * TRAP: HV_FAST_TRAP | 633 | * TRAP: HV_FAST_TRAP |
593 | * FUNCTION: HV_FAST_MMU_TSB_CTXNON0 | 634 | * FUNCTION: HV_FAST_MMU_TSB_CTXNON0 |
@@ -694,6 +735,13 @@ struct hv_fault_status { | |||
694 | */ | 735 | */ |
695 | #define HV_FAST_MMU_MAP_PERM_ADDR 0x25 | 736 | #define HV_FAST_MMU_MAP_PERM_ADDR 0x25 |
696 | 737 | ||
738 | #ifndef __ASSEMBLY__ | ||
739 | extern unsigned long sun4v_mmu_map_perm_addr(unsigned long vaddr, | ||
740 | unsigned long set_to_zero, | ||
741 | unsigned long tte, | ||
742 | unsigned long flags); | ||
743 | #endif | ||
744 | |||
697 | /* mmu_fault_area_conf() | 745 | /* mmu_fault_area_conf() |
698 | * TRAP: HV_FAST_TRAP | 746 | * TRAP: HV_FAST_TRAP |
699 | * FUNCTION: HV_FAST_MMU_FAULT_AREA_CONF | 747 | * FUNCTION: HV_FAST_MMU_FAULT_AREA_CONF |
@@ -892,6 +940,10 @@ struct hv_fault_status { | |||
892 | */ | 940 | */ |
893 | #define HV_FAST_TOD_GET 0x50 | 941 | #define HV_FAST_TOD_GET 0x50 |
894 | 942 | ||
943 | #ifndef __ASSEMBLY__ | ||
944 | extern unsigned long sun4v_tod_get(unsigned long *time); | ||
945 | #endif | ||
946 | |||
895 | /* tod_set() | 947 | /* tod_set() |
896 | * TRAP: HV_FAST_TRAP | 948 | * TRAP: HV_FAST_TRAP |
897 | * FUNCTION: HV_FAST_TOD_SET | 949 | * FUNCTION: HV_FAST_TOD_SET |
@@ -905,6 +957,10 @@ struct hv_fault_status { | |||
905 | */ | 957 | */ |
906 | #define HV_FAST_TOD_SET 0x51 | 958 | #define HV_FAST_TOD_SET 0x51 |
907 | 959 | ||
960 | #ifndef __ASSEMBLY__ | ||
961 | extern unsigned long sun4v_tod_set(unsigned long time); | ||
962 | #endif | ||
963 | |||
908 | /* Console services */ | 964 | /* Console services */ |
909 | 965 | ||
910 | /* con_getchar() | 966 | /* con_getchar() |
@@ -988,6 +1044,133 @@ extern unsigned long sun4v_con_write(unsigned long buffer, | |||
988 | unsigned long *bytes_written); | 1044 | unsigned long *bytes_written); |
989 | #endif | 1045 | #endif |
990 | 1046 | ||
1047 | /* mach_set_soft_state() | ||
1048 | * TRAP: HV_FAST_TRAP | ||
1049 | * FUNCTION: HV_FAST_MACH_SET_SOFT_STATE | ||
1050 | * ARG0: software state | ||
1051 | * ARG1: software state description pointer | ||
1052 | * RET0: status | ||
1053 | * ERRORS: EINVAL software state not valid or software state | ||
1054 | * description is not NULL terminated | ||
1055 | * ENORADDR software state description pointer is not a | ||
1056 | * valid real address | ||
1057 | * EBADALIGNED software state description is not correctly | ||
1058 | * aligned | ||
1059 | * | ||
1060 | * This allows the guest to report it's soft state to the hypervisor. There | ||
1061 | * are two primary components to this state. The first part states whether | ||
1062 | * the guest software is running or not. The second containts optional | ||
1063 | * details specific to the software. | ||
1064 | * | ||
1065 | * The software state argument is defined below in HV_SOFT_STATE_*, and | ||
1066 | * indicates whether the guest is operating normally or in a transitional | ||
1067 | * state. | ||
1068 | * | ||
1069 | * The software state description argument is a real address of a data buffer | ||
1070 | * of size 32-bytes aligned on a 32-byte boundary. It is treated as a NULL | ||
1071 | * terminated 7-bit ASCII string of up to 31 characters not including the | ||
1072 | * NULL termination. | ||
1073 | */ | ||
1074 | #define HV_FAST_MACH_SET_SOFT_STATE 0x70 | ||
1075 | #define HV_SOFT_STATE_NORMAL 0x01 | ||
1076 | #define HV_SOFT_STATE_TRANSITION 0x02 | ||
1077 | |||
1078 | #ifndef __ASSEMBLY__ | ||
1079 | extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state, | ||
1080 | unsigned long msg_string_ra); | ||
1081 | #endif | ||
1082 | |||
1083 | /* mach_get_soft_state() | ||
1084 | * TRAP: HV_FAST_TRAP | ||
1085 | * FUNCTION: HV_FAST_MACH_GET_SOFT_STATE | ||
1086 | * ARG0: software state description pointer | ||
1087 | * RET0: status | ||
1088 | * RET1: software state | ||
1089 | * ERRORS: ENORADDR software state description pointer is not a | ||
1090 | * valid real address | ||
1091 | * EBADALIGNED software state description is not correctly | ||
1092 | * aligned | ||
1093 | * | ||
1094 | * Retrieve the current value of the guest's software state. The rules | ||
1095 | * for the software state pointer are the same as for mach_set_soft_state() | ||
1096 | * above. | ||
1097 | */ | ||
1098 | #define HV_FAST_MACH_GET_SOFT_STATE 0x71 | ||
1099 | |||
1100 | /* svc_send() | ||
1101 | * TRAP: HV_FAST_TRAP | ||
1102 | * FUNCTION: HV_FAST_SVC_SEND | ||
1103 | * ARG0: service ID | ||
1104 | * ARG1: buffer real address | ||
1105 | * ARG2: buffer size | ||
1106 | * RET0: STATUS | ||
1107 | * RET1: sent_bytes | ||
1108 | * | ||
1109 | * Be careful, all output registers are clobbered by this operation, | ||
1110 | * so for example it is not possible to save away a value in %o4 | ||
1111 | * across the trap. | ||
1112 | */ | ||
1113 | #define HV_FAST_SVC_SEND 0x80 | ||
1114 | |||
1115 | /* svc_recv() | ||
1116 | * TRAP: HV_FAST_TRAP | ||
1117 | * FUNCTION: HV_FAST_SVC_RECV | ||
1118 | * ARG0: service ID | ||
1119 | * ARG1: buffer real address | ||
1120 | * ARG2: buffer size | ||
1121 | * RET0: STATUS | ||
1122 | * RET1: recv_bytes | ||
1123 | * | ||
1124 | * Be careful, all output registers are clobbered by this operation, | ||
1125 | * so for example it is not possible to save away a value in %o4 | ||
1126 | * across the trap. | ||
1127 | */ | ||
1128 | #define HV_FAST_SVC_RECV 0x81 | ||
1129 | |||
1130 | /* svc_getstatus() | ||
1131 | * TRAP: HV_FAST_TRAP | ||
1132 | * FUNCTION: HV_FAST_SVC_GETSTATUS | ||
1133 | * ARG0: service ID | ||
1134 | * RET0: STATUS | ||
1135 | * RET1: status bits | ||
1136 | */ | ||
1137 | #define HV_FAST_SVC_GETSTATUS 0x82 | ||
1138 | |||
1139 | /* svc_setstatus() | ||
1140 | * TRAP: HV_FAST_TRAP | ||
1141 | * FUNCTION: HV_FAST_SVC_SETSTATUS | ||
1142 | * ARG0: service ID | ||
1143 | * ARG1: bits to set | ||
1144 | * RET0: STATUS | ||
1145 | */ | ||
1146 | #define HV_FAST_SVC_SETSTATUS 0x83 | ||
1147 | |||
1148 | /* svc_clrstatus() | ||
1149 | * TRAP: HV_FAST_TRAP | ||
1150 | * FUNCTION: HV_FAST_SVC_CLRSTATUS | ||
1151 | * ARG0: service ID | ||
1152 | * ARG1: bits to clear | ||
1153 | * RET0: STATUS | ||
1154 | */ | ||
1155 | #define HV_FAST_SVC_CLRSTATUS 0x84 | ||
1156 | |||
1157 | #ifndef __ASSEMBLY__ | ||
1158 | extern unsigned long sun4v_svc_send(unsigned long svc_id, | ||
1159 | unsigned long buffer, | ||
1160 | unsigned long buffer_size, | ||
1161 | unsigned long *sent_bytes); | ||
1162 | extern unsigned long sun4v_svc_recv(unsigned long svc_id, | ||
1163 | unsigned long buffer, | ||
1164 | unsigned long buffer_size, | ||
1165 | unsigned long *recv_bytes); | ||
1166 | extern unsigned long sun4v_svc_getstatus(unsigned long svc_id, | ||
1167 | unsigned long *status_bits); | ||
1168 | extern unsigned long sun4v_svc_setstatus(unsigned long svc_id, | ||
1169 | unsigned long status_bits); | ||
1170 | extern unsigned long sun4v_svc_clrstatus(unsigned long svc_id, | ||
1171 | unsigned long status_bits); | ||
1172 | #endif | ||
1173 | |||
991 | /* Trap trace services. | 1174 | /* Trap trace services. |
992 | * | 1175 | * |
993 | * The hypervisor provides a trap tracing capability for privileged | 1176 | * The hypervisor provides a trap tracing capability for privileged |
@@ -1379,6 +1562,113 @@ extern unsigned long sun4v_intr_gettarget(unsigned long sysino); | |||
1379 | extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid); | 1562 | extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid); |
1380 | #endif | 1563 | #endif |
1381 | 1564 | ||
1565 | /* vintr_get_cookie() | ||
1566 | * TRAP: HV_FAST_TRAP | ||
1567 | * FUNCTION: HV_FAST_VINTR_GET_COOKIE | ||
1568 | * ARG0: device handle | ||
1569 | * ARG1: device ino | ||
1570 | * RET0: status | ||
1571 | * RET1: cookie | ||
1572 | */ | ||
1573 | #define HV_FAST_VINTR_GET_COOKIE 0xa7 | ||
1574 | |||
1575 | /* vintr_set_cookie() | ||
1576 | * TRAP: HV_FAST_TRAP | ||
1577 | * FUNCTION: HV_FAST_VINTR_SET_COOKIE | ||
1578 | * ARG0: device handle | ||
1579 | * ARG1: device ino | ||
1580 | * ARG2: cookie | ||
1581 | * RET0: status | ||
1582 | */ | ||
1583 | #define HV_FAST_VINTR_SET_COOKIE 0xa8 | ||
1584 | |||
1585 | /* vintr_get_valid() | ||
1586 | * TRAP: HV_FAST_TRAP | ||
1587 | * FUNCTION: HV_FAST_VINTR_GET_VALID | ||
1588 | * ARG0: device handle | ||
1589 | * ARG1: device ino | ||
1590 | * RET0: status | ||
1591 | * RET1: valid state | ||
1592 | */ | ||
1593 | #define HV_FAST_VINTR_GET_VALID 0xa9 | ||
1594 | |||
1595 | /* vintr_set_valid() | ||
1596 | * TRAP: HV_FAST_TRAP | ||
1597 | * FUNCTION: HV_FAST_VINTR_SET_VALID | ||
1598 | * ARG0: device handle | ||
1599 | * ARG1: device ino | ||
1600 | * ARG2: valid state | ||
1601 | * RET0: status | ||
1602 | */ | ||
1603 | #define HV_FAST_VINTR_SET_VALID 0xaa | ||
1604 | |||
1605 | /* vintr_get_state() | ||
1606 | * TRAP: HV_FAST_TRAP | ||
1607 | * FUNCTION: HV_FAST_VINTR_GET_STATE | ||
1608 | * ARG0: device handle | ||
1609 | * ARG1: device ino | ||
1610 | * RET0: status | ||
1611 | * RET1: state | ||
1612 | */ | ||
1613 | #define HV_FAST_VINTR_GET_STATE 0xab | ||
1614 | |||
1615 | /* vintr_set_state() | ||
1616 | * TRAP: HV_FAST_TRAP | ||
1617 | * FUNCTION: HV_FAST_VINTR_SET_STATE | ||
1618 | * ARG0: device handle | ||
1619 | * ARG1: device ino | ||
1620 | * ARG2: state | ||
1621 | * RET0: status | ||
1622 | */ | ||
1623 | #define HV_FAST_VINTR_SET_STATE 0xac | ||
1624 | |||
1625 | /* vintr_get_target() | ||
1626 | * TRAP: HV_FAST_TRAP | ||
1627 | * FUNCTION: HV_FAST_VINTR_GET_TARGET | ||
1628 | * ARG0: device handle | ||
1629 | * ARG1: device ino | ||
1630 | * RET0: status | ||
1631 | * RET1: cpuid | ||
1632 | */ | ||
1633 | #define HV_FAST_VINTR_GET_TARGET 0xad | ||
1634 | |||
1635 | /* vintr_set_target() | ||
1636 | * TRAP: HV_FAST_TRAP | ||
1637 | * FUNCTION: HV_FAST_VINTR_SET_TARGET | ||
1638 | * ARG0: device handle | ||
1639 | * ARG1: device ino | ||
1640 | * ARG2: cpuid | ||
1641 | * RET0: status | ||
1642 | */ | ||
1643 | #define HV_FAST_VINTR_SET_TARGET 0xae | ||
1644 | |||
1645 | #ifndef __ASSEMBLY__ | ||
1646 | extern unsigned long sun4v_vintr_get_cookie(unsigned long dev_handle, | ||
1647 | unsigned long dev_ino, | ||
1648 | unsigned long *cookie); | ||
1649 | extern unsigned long sun4v_vintr_set_cookie(unsigned long dev_handle, | ||
1650 | unsigned long dev_ino, | ||
1651 | unsigned long cookie); | ||
1652 | extern unsigned long sun4v_vintr_get_valid(unsigned long dev_handle, | ||
1653 | unsigned long dev_ino, | ||
1654 | unsigned long *valid); | ||
1655 | extern unsigned long sun4v_vintr_set_valid(unsigned long dev_handle, | ||
1656 | unsigned long dev_ino, | ||
1657 | unsigned long valid); | ||
1658 | extern unsigned long sun4v_vintr_get_state(unsigned long dev_handle, | ||
1659 | unsigned long dev_ino, | ||
1660 | unsigned long *state); | ||
1661 | extern unsigned long sun4v_vintr_set_state(unsigned long dev_handle, | ||
1662 | unsigned long dev_ino, | ||
1663 | unsigned long state); | ||
1664 | extern unsigned long sun4v_vintr_get_target(unsigned long dev_handle, | ||
1665 | unsigned long dev_ino, | ||
1666 | unsigned long *cpuid); | ||
1667 | extern unsigned long sun4v_vintr_set_target(unsigned long dev_handle, | ||
1668 | unsigned long dev_ino, | ||
1669 | unsigned long cpuid); | ||
1670 | #endif | ||
1671 | |||
1382 | /* PCI IO services. | 1672 | /* PCI IO services. |
1383 | * | 1673 | * |
1384 | * See the terminology descriptions in the device interrupt services | 1674 | * See the terminology descriptions in the device interrupt services |
@@ -2037,6 +2327,346 @@ extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cp | |||
2037 | */ | 2327 | */ |
2038 | #define HV_FAST_PCI_MSG_SETVALID 0xd3 | 2328 | #define HV_FAST_PCI_MSG_SETVALID 0xd3 |
2039 | 2329 | ||
2330 | /* Logical Domain Channel services. */ | ||
2331 | |||
2332 | #define LDC_CHANNEL_DOWN 0 | ||
2333 | #define LDC_CHANNEL_UP 1 | ||
2334 | #define LDC_CHANNEL_RESETTING 2 | ||
2335 | |||
2336 | /* ldc_tx_qconf() | ||
2337 | * TRAP: HV_FAST_TRAP | ||
2338 | * FUNCTION: HV_FAST_LDC_TX_QCONF | ||
2339 | * ARG0: channel ID | ||
2340 | * ARG1: real address base of queue | ||
2341 | * ARG2: num entries in queue | ||
2342 | * RET0: status | ||
2343 | * | ||
2344 | * Configure transmit queue for the LDC endpoint specified by the | ||
2345 | * given channel ID, to be placed at the given real address, and | ||
2346 | * be of the given num entries. Num entries must be a power of two. | ||
2347 | * The real address base of the queue must be aligned on the queue | ||
2348 | * size. Each queue entry is 64-bytes, so for example, a 32 entry | ||
2349 | * queue must be aligned on a 2048 byte real address boundary. | ||
2350 | * | ||
2351 | * Upon configuration of a valid transmit queue the head and tail | ||
2352 | * pointers are set to a hypervisor specific identical value indicating | ||
2353 | * that the queue initially is empty. | ||
2354 | * | ||
2355 | * The endpoint's transmit queue is un-configured if num entries is zero. | ||
2356 | * | ||
2357 | * The maximum number of entries for each queue for a specific cpu may be | ||
2358 | * determined from the machine description. A transmit queue may be | ||
2359 | * specified even in the event that the LDC is down (peer endpoint has no | ||
2360 | * receive queue specified). Transmission will begin as soon as the peer | ||
2361 | * endpoint defines a receive queue. | ||
2362 | * | ||
2363 | * It is recommended that a guest wait for a transmit queue to empty prior | ||
2364 | * to reconfiguring it, or un-configuring it. Re or un-configuring of a | ||
2365 | * non-empty transmit queue behaves exactly as defined above, however it | ||
2366 | * is undefined as to how many of the pending entries in the original queue | ||
2367 | * will be delivered prior to the re-configuration taking effect. | ||
2368 | * Furthermore, as the queue configuration causes a reset of the head and | ||
2369 | * tail pointers there is no way for a guest to determine how many entries | ||
2370 | * have been sent after the configuration operation. | ||
2371 | */ | ||
2372 | #define HV_FAST_LDC_TX_QCONF 0xe0 | ||
2373 | |||
2374 | /* ldc_tx_qinfo() | ||
2375 | * TRAP: HV_FAST_TRAP | ||
2376 | * FUNCTION: HV_FAST_LDC_TX_QINFO | ||
2377 | * ARG0: channel ID | ||
2378 | * RET0: status | ||
2379 | * RET1: real address base of queue | ||
2380 | * RET2: num entries in queue | ||
2381 | * | ||
2382 | * Return the configuration info for the transmit queue of LDC endpoint | ||
2383 | * defined by the given channel ID. The real address is the currently | ||
2384 | * defined real address base of the defined queue, and num entries is the | ||
2385 | * size of the queue in terms of number of entries. | ||
2386 | * | ||
2387 | * If the specified channel ID is a valid endpoint number, but no transmit | ||
2388 | * queue has been defined this service will return success, but with num | ||
2389 | * entries set to zero and the real address will have an undefined value. | ||
2390 | */ | ||
2391 | #define HV_FAST_LDC_TX_QINFO 0xe1 | ||
2392 | |||
2393 | /* ldc_tx_get_state() | ||
2394 | * TRAP: HV_FAST_TRAP | ||
2395 | * FUNCTION: HV_FAST_LDC_TX_GET_STATE | ||
2396 | * ARG0: channel ID | ||
2397 | * RET0: status | ||
2398 | * RET1: head offset | ||
2399 | * RET2: tail offset | ||
2400 | * RET3: channel state | ||
2401 | * | ||
2402 | * Return the transmit state, and the head and tail queue pointers, for | ||
2403 | * the transmit queue of the LDC endpoint defined by the given channel ID. | ||
2404 | * The head and tail values are the byte offset of the head and tail | ||
2405 | * positions of the transmit queue for the specified endpoint. | ||
2406 | */ | ||
2407 | #define HV_FAST_LDC_TX_GET_STATE 0xe2 | ||
2408 | |||
2409 | /* ldc_tx_set_qtail() | ||
2410 | * TRAP: HV_FAST_TRAP | ||
2411 | * FUNCTION: HV_FAST_LDC_TX_SET_QTAIL | ||
2412 | * ARG0: channel ID | ||
2413 | * ARG1: tail offset | ||
2414 | * RET0: status | ||
2415 | * | ||
2416 | * Update the tail pointer for the transmit queue associated with the LDC | ||
2417 | * endpoint defined by the given channel ID. The tail offset specified | ||
2418 | * must be aligned on a 64 byte boundary, and calculated so as to increase | ||
2419 | * the number of pending entries on the transmit queue. Any attempt to | ||
2420 | * decrease the number of pending transmit queue entires is considered | ||
2421 | * an invalid tail offset and will result in an EINVAL error. | ||
2422 | * | ||
2423 | * Since the tail of the transmit queue may not be moved backwards, the | ||
2424 | * transmit queue may be flushed by configuring a new transmit queue, | ||
2425 | * whereupon the hypervisor will configure the initial transmit head and | ||
2426 | * tail pointers to be equal. | ||
2427 | */ | ||
2428 | #define HV_FAST_LDC_TX_SET_QTAIL 0xe3 | ||
2429 | |||
2430 | /* ldc_rx_qconf() | ||
2431 | * TRAP: HV_FAST_TRAP | ||
2432 | * FUNCTION: HV_FAST_LDC_RX_QCONF | ||
2433 | * ARG0: channel ID | ||
2434 | * ARG1: real address base of queue | ||
2435 | * ARG2: num entries in queue | ||
2436 | * RET0: status | ||
2437 | * | ||
2438 | * Configure receive queue for the LDC endpoint specified by the | ||
2439 | * given channel ID, to be placed at the given real address, and | ||
2440 | * be of the given num entries. Num entries must be a power of two. | ||
2441 | * The real address base of the queue must be aligned on the queue | ||
2442 | * size. Each queue entry is 64-bytes, so for example, a 32 entry | ||
2443 | * queue must be aligned on a 2048 byte real address boundary. | ||
2444 | * | ||
2445 | * The endpoint's transmit queue is un-configured if num entries is zero. | ||
2446 | * | ||
2447 | * If a valid receive queue is specified for a local endpoint the LDC is | ||
2448 | * in the up state for the purpose of transmission to this endpoint. | ||
2449 | * | ||
2450 | * The maximum number of entries for each queue for a specific cpu may be | ||
2451 | * determined from the machine description. | ||
2452 | * | ||
2453 | * As receive queue configuration causes a reset of the queue's head and | ||
2454 | * tail pointers there is no way for a gues to determine how many entries | ||
2455 | * have been received between a preceeding ldc_get_rx_state() API call | ||
2456 | * and the completion of the configuration operation. It should be noted | ||
2457 | * that datagram delivery is not guarenteed via domain channels anyway, | ||
2458 | * and therefore any higher protocol should be resilient to datagram | ||
2459 | * loss if necessary. However, to overcome this specific race potential | ||
2460 | * it is recommended, for example, that a higher level protocol be employed | ||
2461 | * to ensure either retransmission, or ensure that no datagrams are pending | ||
2462 | * on the peer endpoint's transmit queue prior to the configuration process. | ||
2463 | */ | ||
2464 | #define HV_FAST_LDC_RX_QCONF 0xe4 | ||
2465 | |||
2466 | /* ldc_rx_qinfo() | ||
2467 | * TRAP: HV_FAST_TRAP | ||
2468 | * FUNCTION: HV_FAST_LDC_RX_QINFO | ||
2469 | * ARG0: channel ID | ||
2470 | * RET0: status | ||
2471 | * RET1: real address base of queue | ||
2472 | * RET2: num entries in queue | ||
2473 | * | ||
2474 | * Return the configuration info for the receive queue of LDC endpoint | ||
2475 | * defined by the given channel ID. The real address is the currently | ||
2476 | * defined real address base of the defined queue, and num entries is the | ||
2477 | * size of the queue in terms of number of entries. | ||
2478 | * | ||
2479 | * If the specified channel ID is a valid endpoint number, but no receive | ||
2480 | * queue has been defined this service will return success, but with num | ||
2481 | * entries set to zero and the real address will have an undefined value. | ||
2482 | */ | ||
2483 | #define HV_FAST_LDC_RX_QINFO 0xe5 | ||
2484 | |||
2485 | /* ldc_rx_get_state() | ||
2486 | * TRAP: HV_FAST_TRAP | ||
2487 | * FUNCTION: HV_FAST_LDC_RX_GET_STATE | ||
2488 | * ARG0: channel ID | ||
2489 | * RET0: status | ||
2490 | * RET1: head offset | ||
2491 | * RET2: tail offset | ||
2492 | * RET3: channel state | ||
2493 | * | ||
2494 | * Return the receive state, and the head and tail queue pointers, for | ||
2495 | * the receive queue of the LDC endpoint defined by the given channel ID. | ||
2496 | * The head and tail values are the byte offset of the head and tail | ||
2497 | * positions of the receive queue for the specified endpoint. | ||
2498 | */ | ||
2499 | #define HV_FAST_LDC_RX_GET_STATE 0xe6 | ||
2500 | |||
2501 | /* ldc_rx_set_qhead() | ||
2502 | * TRAP: HV_FAST_TRAP | ||
2503 | * FUNCTION: HV_FAST_LDC_RX_SET_QHEAD | ||
2504 | * ARG0: channel ID | ||
2505 | * ARG1: head offset | ||
2506 | * RET0: status | ||
2507 | * | ||
2508 | * Update the head pointer for the receive queue associated with the LDC | ||
2509 | * endpoint defined by the given channel ID. The head offset specified | ||
2510 | * must be aligned on a 64 byte boundary, and calculated so as to decrease | ||
2511 | * the number of pending entries on the receive queue. Any attempt to | ||
2512 | * increase the number of pending receive queue entires is considered | ||
2513 | * an invalid head offset and will result in an EINVAL error. | ||
2514 | * | ||
2515 | * The receive queue may be flushed by setting the head offset equal | ||
2516 | * to the current tail offset. | ||
2517 | */ | ||
2518 | #define HV_FAST_LDC_RX_SET_QHEAD 0xe7 | ||
2519 | |||
2520 | /* LDC Map Table Entry. Each slot is defined by a translation table | ||
2521 | * entry, as specified by the LDC_MTE_* bits below, and a 64-bit | ||
2522 | * hypervisor invalidation cookie. | ||
2523 | */ | ||
2524 | #define LDC_MTE_PADDR 0x0fffffffffffe000 /* pa[55:13] */ | ||
2525 | #define LDC_MTE_COPY_W 0x0000000000000400 /* copy write access */ | ||
2526 | #define LDC_MTE_COPY_R 0x0000000000000200 /* copy read access */ | ||
2527 | #define LDC_MTE_IOMMU_W 0x0000000000000100 /* IOMMU write access */ | ||
2528 | #define LDC_MTE_IOMMU_R 0x0000000000000080 /* IOMMU read access */ | ||
2529 | #define LDC_MTE_EXEC 0x0000000000000040 /* execute */ | ||
2530 | #define LDC_MTE_WRITE 0x0000000000000020 /* read */ | ||
2531 | #define LDC_MTE_READ 0x0000000000000010 /* write */ | ||
2532 | #define LDC_MTE_SZALL 0x000000000000000f /* page size bits */ | ||
2533 | #define LDC_MTE_SZ16GB 0x0000000000000007 /* 16GB page */ | ||
2534 | #define LDC_MTE_SZ2GB 0x0000000000000006 /* 2GB page */ | ||
2535 | #define LDC_MTE_SZ256MB 0x0000000000000005 /* 256MB page */ | ||
2536 | #define LDC_MTE_SZ32MB 0x0000000000000004 /* 32MB page */ | ||
2537 | #define LDC_MTE_SZ4MB 0x0000000000000003 /* 4MB page */ | ||
2538 | #define LDC_MTE_SZ512K 0x0000000000000002 /* 512K page */ | ||
2539 | #define LDC_MTE_SZ64K 0x0000000000000001 /* 64K page */ | ||
2540 | #define LDC_MTE_SZ8K 0x0000000000000000 /* 8K page */ | ||
2541 | |||
2542 | #ifndef __ASSEMBLY__ | ||
2543 | struct ldc_mtable_entry { | ||
2544 | unsigned long mte; | ||
2545 | unsigned long cookie; | ||
2546 | }; | ||
2547 | #endif | ||
2548 | |||
2549 | /* ldc_set_map_table() | ||
2550 | * TRAP: HV_FAST_TRAP | ||
2551 | * FUNCTION: HV_FAST_LDC_SET_MAP_TABLE | ||
2552 | * ARG0: channel ID | ||
2553 | * ARG1: table real address | ||
2554 | * ARG2: num entries | ||
2555 | * RET0: status | ||
2556 | * | ||
2557 | * Register the MTE table at the given table real address, with the | ||
2558 | * specified num entries, for the LDC indicated by the given channel | ||
2559 | * ID. | ||
2560 | */ | ||
2561 | #define HV_FAST_LDC_SET_MAP_TABLE 0xea | ||
2562 | |||
2563 | /* ldc_get_map_table() | ||
2564 | * TRAP: HV_FAST_TRAP | ||
2565 | * FUNCTION: HV_FAST_LDC_GET_MAP_TABLE | ||
2566 | * ARG0: channel ID | ||
2567 | * RET0: status | ||
2568 | * RET1: table real address | ||
2569 | * RET2: num entries | ||
2570 | * | ||
2571 | * Return the configuration of the current mapping table registered | ||
2572 | * for the given channel ID. | ||
2573 | */ | ||
2574 | #define HV_FAST_LDC_GET_MAP_TABLE 0xeb | ||
2575 | |||
2576 | #define LDC_COPY_IN 0 | ||
2577 | #define LDC_COPY_OUT 1 | ||
2578 | |||
2579 | /* ldc_copy() | ||
2580 | * TRAP: HV_FAST_TRAP | ||
2581 | * FUNCTION: HV_FAST_LDC_COPY | ||
2582 | * ARG0: channel ID | ||
2583 | * ARG1: LDC_COPY_* direction code | ||
2584 | * ARG2: target real address | ||
2585 | * ARG3: local real address | ||
2586 | * ARG4: length in bytes | ||
2587 | * RET0: status | ||
2588 | * RET1: actual length in bytes | ||
2589 | */ | ||
2590 | #define HV_FAST_LDC_COPY 0xec | ||
2591 | |||
2592 | #define LDC_MEM_READ 1 | ||
2593 | #define LDC_MEM_WRITE 2 | ||
2594 | #define LDC_MEM_EXEC 4 | ||
2595 | |||
2596 | /* ldc_mapin() | ||
2597 | * TRAP: HV_FAST_TRAP | ||
2598 | * FUNCTION: HV_FAST_LDC_MAPIN | ||
2599 | * ARG0: channel ID | ||
2600 | * ARG1: cookie | ||
2601 | * RET0: status | ||
2602 | * RET1: real address | ||
2603 | * RET2: LDC_MEM_* permissions | ||
2604 | */ | ||
2605 | #define HV_FAST_LDC_MAPIN 0xed | ||
2606 | |||
2607 | /* ldc_unmap() | ||
2608 | * TRAP: HV_FAST_TRAP | ||
2609 | * FUNCTION: HV_FAST_LDC_UNMAP | ||
2610 | * ARG0: real address | ||
2611 | * RET0: status | ||
2612 | */ | ||
2613 | #define HV_FAST_LDC_UNMAP 0xee | ||
2614 | |||
2615 | /* ldc_revoke() | ||
2616 | * TRAP: HV_FAST_TRAP | ||
2617 | * FUNCTION: HV_FAST_LDC_REVOKE | ||
2618 | * ARG0: cookie | ||
2619 | * ARG1: ldc_mtable_entry cookie | ||
2620 | * RET0: status | ||
2621 | */ | ||
2622 | #define HV_FAST_LDC_REVOKE 0xef | ||
2623 | |||
2624 | #ifndef __ASSEMBLY__ | ||
2625 | extern unsigned long sun4v_ldc_tx_qconf(unsigned long channel, | ||
2626 | unsigned long ra, | ||
2627 | unsigned long num_entries); | ||
2628 | extern unsigned long sun4v_ldc_tx_qinfo(unsigned long channel, | ||
2629 | unsigned long *ra, | ||
2630 | unsigned long *num_entries); | ||
2631 | extern unsigned long sun4v_ldc_tx_get_state(unsigned long channel, | ||
2632 | unsigned long *head_off, | ||
2633 | unsigned long *tail_off, | ||
2634 | unsigned long *chan_state); | ||
2635 | extern unsigned long sun4v_ldc_tx_set_qtail(unsigned long channel, | ||
2636 | unsigned long tail_off); | ||
2637 | extern unsigned long sun4v_ldc_rx_qconf(unsigned long channel, | ||
2638 | unsigned long ra, | ||
2639 | unsigned long num_entries); | ||
2640 | extern unsigned long sun4v_ldc_rx_qinfo(unsigned long channel, | ||
2641 | unsigned long *ra, | ||
2642 | unsigned long *num_entries); | ||
2643 | extern unsigned long sun4v_ldc_rx_get_state(unsigned long channel, | ||
2644 | unsigned long *head_off, | ||
2645 | unsigned long *tail_off, | ||
2646 | unsigned long *chan_state); | ||
2647 | extern unsigned long sun4v_ldc_rx_set_qhead(unsigned long channel, | ||
2648 | unsigned long head_off); | ||
2649 | extern unsigned long sun4v_ldc_set_map_table(unsigned long channel, | ||
2650 | unsigned long ra, | ||
2651 | unsigned long num_entries); | ||
2652 | extern unsigned long sun4v_ldc_get_map_table(unsigned long channel, | ||
2653 | unsigned long *ra, | ||
2654 | unsigned long *num_entries); | ||
2655 | extern unsigned long sun4v_ldc_copy(unsigned long channel, | ||
2656 | unsigned long dir_code, | ||
2657 | unsigned long tgt_raddr, | ||
2658 | unsigned long lcl_raddr, | ||
2659 | unsigned long len, | ||
2660 | unsigned long *actual_len); | ||
2661 | extern unsigned long sun4v_ldc_mapin(unsigned long channel, | ||
2662 | unsigned long cookie, | ||
2663 | unsigned long *ra, | ||
2664 | unsigned long *perm); | ||
2665 | extern unsigned long sun4v_ldc_unmap(unsigned long ra); | ||
2666 | extern unsigned long sun4v_ldc_revoke(unsigned long cookie, | ||
2667 | unsigned long mte_cookie); | ||
2668 | #endif | ||
2669 | |||
2040 | /* Performance counter services. */ | 2670 | /* Performance counter services. */ |
2041 | 2671 | ||
2042 | #define HV_PERF_JBUS_PERF_CTRL_REG 0x00 | 2672 | #define HV_PERF_JBUS_PERF_CTRL_REG 0x00 |
@@ -2168,6 +2798,100 @@ struct hv_mmu_statistics { | |||
2168 | */ | 2798 | */ |
2169 | #define HV_FAST_MMUSTAT_INFO 0x103 | 2799 | #define HV_FAST_MMUSTAT_INFO 0x103 |
2170 | 2800 | ||
2801 | /* NCS crypto services */ | ||
2802 | |||
2803 | /* ncs_request() sub-function numbers */ | ||
2804 | #define HV_NCS_QCONF 0x01 | ||
2805 | #define HV_NCS_QTAIL_UPDATE 0x02 | ||
2806 | |||
2807 | #ifndef __ASSEMBLY__ | ||
2808 | struct hv_ncs_queue_entry { | ||
2809 | /* MAU Control Register */ | ||
2810 | unsigned long mau_control; | ||
2811 | #define MAU_CONTROL_INV_PARITY 0x0000000000002000 | ||
2812 | #define MAU_CONTROL_STRAND 0x0000000000001800 | ||
2813 | #define MAU_CONTROL_BUSY 0x0000000000000400 | ||
2814 | #define MAU_CONTROL_INT 0x0000000000000200 | ||
2815 | #define MAU_CONTROL_OP 0x00000000000001c0 | ||
2816 | #define MAU_CONTROL_OP_SHIFT 6 | ||
2817 | #define MAU_OP_LOAD_MA_MEMORY 0x0 | ||
2818 | #define MAU_OP_STORE_MA_MEMORY 0x1 | ||
2819 | #define MAU_OP_MODULAR_MULT 0x2 | ||
2820 | #define MAU_OP_MODULAR_REDUCE 0x3 | ||
2821 | #define MAU_OP_MODULAR_EXP_LOOP 0x4 | ||
2822 | #define MAU_CONTROL_LEN 0x000000000000003f | ||
2823 | #define MAU_CONTROL_LEN_SHIFT 0 | ||
2824 | |||
2825 | /* Real address of bytes to load or store bytes | ||
2826 | * into/out-of the MAU. | ||
2827 | */ | ||
2828 | unsigned long mau_mpa; | ||
2829 | |||
2830 | /* Modular Arithmetic MA Offset Register. */ | ||
2831 | unsigned long mau_ma; | ||
2832 | |||
2833 | /* Modular Arithmetic N Prime Register. */ | ||
2834 | unsigned long mau_np; | ||
2835 | }; | ||
2836 | |||
2837 | struct hv_ncs_qconf_arg { | ||
2838 | unsigned long mid; /* MAU ID, 1 per core on Niagara */ | ||
2839 | unsigned long base; /* Real address base of queue */ | ||
2840 | unsigned long end; /* Real address end of queue */ | ||
2841 | unsigned long num_ents; /* Number of entries in queue */ | ||
2842 | }; | ||
2843 | |||
2844 | struct hv_ncs_qtail_update_arg { | ||
2845 | unsigned long mid; /* MAU ID, 1 per core on Niagara */ | ||
2846 | unsigned long tail; /* New tail index to use */ | ||
2847 | unsigned long syncflag; /* only SYNCFLAG_SYNC is implemented */ | ||
2848 | #define HV_NCS_SYNCFLAG_SYNC 0x00 | ||
2849 | #define HV_NCS_SYNCFLAG_ASYNC 0x01 | ||
2850 | }; | ||
2851 | #endif | ||
2852 | |||
2853 | /* ncs_request() | ||
2854 | * TRAP: HV_FAST_TRAP | ||
2855 | * FUNCTION: HV_FAST_NCS_REQUEST | ||
2856 | * ARG0: NCS sub-function | ||
2857 | * ARG1: sub-function argument real address | ||
2858 | * ARG2: size in bytes of sub-function argument | ||
2859 | * RET0: status | ||
2860 | * | ||
2861 | * The MAU chip of the Niagara processor is not directly accessible | ||
2862 | * to privileged code, instead it is programmed indirectly via this | ||
2863 | * hypervisor API. | ||
2864 | * | ||
2865 | * The interfaces defines a queue of MAU operations to perform. | ||
2866 | * Privileged code registers a queue with the hypervisor by invoking | ||
2867 | * this HVAPI with the HV_NCS_QCONF sub-function, which defines the | ||
2868 | * base, end, and number of entries of the queue. Each queue entry | ||
2869 | * contains a MAU register struct block. | ||
2870 | * | ||
2871 | * The privileged code then proceeds to add entries to the queue and | ||
2872 | * then invoke the HV_NCS_QTAIL_UPDATE sub-function. Since only | ||
2873 | * synchronous operations are supported by the current hypervisor, | ||
2874 | * HV_NCS_QTAIL_UPDATE will run all the pending queue entries to | ||
2875 | * completion and return HV_EOK, or return an error code. | ||
2876 | * | ||
2877 | * The real address of the sub-function argument must be aligned on at | ||
2878 | * least an 8-byte boundary. | ||
2879 | * | ||
2880 | * The tail argument of HV_NCS_QTAIL_UPDATE is an index, not a byte | ||
2881 | * offset, into the queue and must be less than or equal the 'num_ents' | ||
2882 | * argument given in the HV_NCS_QCONF call. | ||
2883 | */ | ||
2884 | #define HV_FAST_NCS_REQUEST 0x110 | ||
2885 | |||
2886 | #ifndef __ASSEMBLY__ | ||
2887 | extern unsigned long sun4v_ncs_request(unsigned long request, | ||
2888 | unsigned long arg_ra, | ||
2889 | unsigned long arg_size); | ||
2890 | #endif | ||
2891 | |||
2892 | #define HV_FAST_FIRE_GET_PERFREG 0x120 | ||
2893 | #define HV_FAST_FIRE_SET_PERFREG 0x121 | ||
2894 | |||
2171 | /* Function numbers for HV_CORE_TRAP. */ | 2895 | /* Function numbers for HV_CORE_TRAP. */ |
2172 | #define HV_CORE_SET_VER 0x00 | 2896 | #define HV_CORE_SET_VER 0x00 |
2173 | #define HV_CORE_PUTCHAR 0x01 | 2897 | #define HV_CORE_PUTCHAR 0x01 |
@@ -2204,6 +2928,7 @@ extern void sun4v_hvapi_unregister(unsigned long group); | |||
2204 | extern int sun4v_hvapi_get(unsigned long group, | 2928 | extern int sun4v_hvapi_get(unsigned long group, |
2205 | unsigned long *major, | 2929 | unsigned long *major, |
2206 | unsigned long *minor); | 2930 | unsigned long *minor); |
2931 | extern void sun4v_hvapi_init(void); | ||
2207 | #endif | 2932 | #endif |
2208 | 2933 | ||
2209 | #endif /* !(_SPARC64_HYPERVISOR_H) */ | 2934 | #endif /* !(_SPARC64_HYPERVISOR_H) */ |
diff --git a/include/asm-sparc64/kdebug.h b/include/asm-sparc64/kdebug.h index 627e3396a5f0..9974c7b0aebc 100644 --- a/include/asm-sparc64/kdebug.h +++ b/include/asm-sparc64/kdebug.h | |||
@@ -32,7 +32,6 @@ enum die_val { | |||
32 | DIE_TRAP, | 32 | DIE_TRAP, |
33 | DIE_TRAP_TL1, | 33 | DIE_TRAP_TL1, |
34 | DIE_CALL, | 34 | DIE_CALL, |
35 | DIE_PAGE_FAULT, | ||
36 | }; | 35 | }; |
37 | 36 | ||
38 | #endif | 37 | #endif |
diff --git a/include/asm-sparc64/mdesc.h b/include/asm-sparc64/mdesc.h new file mode 100644 index 000000000000..124eb8ca2378 --- /dev/null +++ b/include/asm-sparc64/mdesc.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef _SPARC64_MDESC_H | ||
2 | #define _SPARC64_MDESC_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <asm/prom.h> | ||
6 | |||
7 | struct mdesc_node; | ||
8 | struct mdesc_arc { | ||
9 | const char *name; | ||
10 | struct mdesc_node *arc; | ||
11 | }; | ||
12 | |||
13 | struct mdesc_node { | ||
14 | const char *name; | ||
15 | u64 node; | ||
16 | unsigned int unique_id; | ||
17 | unsigned int num_arcs; | ||
18 | struct property *properties; | ||
19 | struct mdesc_node *hash_next; | ||
20 | struct mdesc_node *allnodes_next; | ||
21 | struct mdesc_arc arcs[0]; | ||
22 | }; | ||
23 | |||
24 | extern struct mdesc_node *md_find_node_by_name(struct mdesc_node *from, | ||
25 | const char *name); | ||
26 | #define md_for_each_node_by_name(__mn, __name) \ | ||
27 | for (__mn = md_find_node_by_name(NULL, __name); __mn; \ | ||
28 | __mn = md_find_node_by_name(__mn, __name)) | ||
29 | |||
30 | extern struct property *md_find_property(const struct mdesc_node *mp, | ||
31 | const char *name, | ||
32 | int *lenp); | ||
33 | extern const void *md_get_property(const struct mdesc_node *mp, | ||
34 | const char *name, | ||
35 | int *lenp); | ||
36 | |||
37 | extern void sun4v_mdesc_init(void); | ||
38 | |||
39 | #endif | ||
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h index 6a0da3b1695c..992f9f7a476c 100644 --- a/include/asm-sparc64/oplib.h +++ b/include/asm-sparc64/oplib.h | |||
@@ -316,11 +316,8 @@ extern int prom_setprop(int node, const char *prop_name, char *prop_value, | |||
316 | 316 | ||
317 | extern int prom_pathtoinode(const char *path); | 317 | extern int prom_pathtoinode(const char *path); |
318 | extern int prom_inst2pkg(int); | 318 | extern int prom_inst2pkg(int); |
319 | 319 | extern int prom_service_exists(const char *service_name); | |
320 | /* CPU probing helpers. */ | 320 | extern void prom_sun4v_guest_soft_state(void); |
321 | struct device_node; | ||
322 | int cpu_find_by_instance(int instance, struct device_node **dev_node, int *mid); | ||
323 | int cpu_find_by_mid(int mid, struct device_node **prom_node); | ||
324 | 321 | ||
325 | /* Client interface level routines. */ | 322 | /* Client interface level routines. */ |
326 | extern void prom_set_trap_table(unsigned long tba); | 323 | extern void prom_set_trap_table(unsigned long tba); |
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h index ced8cbde046d..88db872ce2f8 100644 --- a/include/asm-sparc64/percpu.h +++ b/include/asm-sparc64/percpu.h | |||
@@ -5,7 +5,8 @@ | |||
5 | 5 | ||
6 | #ifdef CONFIG_SMP | 6 | #ifdef CONFIG_SMP |
7 | 7 | ||
8 | extern void setup_per_cpu_areas(void); | 8 | #define setup_per_cpu_areas() do { } while (0) |
9 | extern void real_setup_per_cpu_areas(void); | ||
9 | 10 | ||
10 | extern unsigned long __per_cpu_base; | 11 | extern unsigned long __per_cpu_base; |
11 | extern unsigned long __per_cpu_shift; | 12 | extern unsigned long __per_cpu_shift; |
@@ -34,6 +35,7 @@ do { \ | |||
34 | } while (0) | 35 | } while (0) |
35 | #else /* ! SMP */ | 36 | #else /* ! SMP */ |
36 | 37 | ||
38 | #define real_setup_per_cpu_areas() do { } while (0) | ||
37 | #define DEFINE_PER_CPU(type, name) \ | 39 | #define DEFINE_PER_CPU(type, name) \ |
38 | __typeof__(type) per_cpu__##name | 40 | __typeof__(type) per_cpu__##name |
39 | 41 | ||
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h index ddad5f99ac7f..b4df3042add0 100644 --- a/include/asm-sparc64/prom.h +++ b/include/asm-sparc64/prom.h | |||
@@ -90,6 +90,7 @@ extern struct device_node *of_find_compatible_node(struct device_node *from, | |||
90 | const char *type, const char *compat); | 90 | const char *type, const char *compat); |
91 | extern struct device_node *of_find_node_by_path(const char *path); | 91 | extern struct device_node *of_find_node_by_path(const char *path); |
92 | extern struct device_node *of_find_node_by_phandle(phandle handle); | 92 | extern struct device_node *of_find_node_by_phandle(phandle handle); |
93 | extern struct device_node *of_find_node_by_cpuid(int cpuid); | ||
93 | extern struct device_node *of_get_parent(const struct device_node *node); | 94 | extern struct device_node *of_get_parent(const struct device_node *node); |
94 | extern struct device_node *of_get_next_child(const struct device_node *node, | 95 | extern struct device_node *of_get_next_child(const struct device_node *node, |
95 | struct device_node *prev); | 96 | struct device_node *prev); |
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h index 869d16fb907b..f76e1492add5 100644 --- a/include/asm-sparc64/smp.h +++ b/include/asm-sparc64/smp.h | |||
@@ -41,7 +41,7 @@ extern cpumask_t cpu_sibling_map[NR_CPUS]; | |||
41 | extern int hard_smp_processor_id(void); | 41 | extern int hard_smp_processor_id(void); |
42 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 42 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
43 | 43 | ||
44 | extern void smp_setup_cpu_possible_map(void); | 44 | extern void smp_fill_in_sib_core_maps(void); |
45 | extern unsigned char boot_cpu_id; | 45 | extern unsigned char boot_cpu_id; |
46 | 46 | ||
47 | #endif /* !(__ASSEMBLY__) */ | 47 | #endif /* !(__ASSEMBLY__) */ |
@@ -49,7 +49,7 @@ extern unsigned char boot_cpu_id; | |||
49 | #else | 49 | #else |
50 | 50 | ||
51 | #define hard_smp_processor_id() 0 | 51 | #define hard_smp_processor_id() 0 |
52 | #define smp_setup_cpu_possible_map() do { } while (0) | 52 | #define smp_fill_in_sib_core_maps() do { } while (0) |
53 | #define boot_cpu_id (0) | 53 | #define boot_cpu_id (0) |
54 | 54 | ||
55 | #endif /* !(CONFIG_SMP) */ | 55 | #endif /* !(CONFIG_SMP) */ |
diff --git a/include/asm-sparc64/sstate.h b/include/asm-sparc64/sstate.h new file mode 100644 index 000000000000..a7c35dbcb281 --- /dev/null +++ b/include/asm-sparc64/sstate.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _SPARC64_SSTATE_H | ||
2 | #define _SPARC64_SSTATE_H | ||
3 | |||
4 | extern void sstate_booting(void); | ||
5 | extern void sstate_running(void); | ||
6 | extern void sstate_halt(void); | ||
7 | extern void sstate_poweroff(void); | ||
8 | extern void sstate_panic(void); | ||
9 | extern void sstate_reboot(void); | ||
10 | |||
11 | extern void sun4v_sstate_init(void); | ||
12 | |||
13 | #endif /* _SPARC64_SSTATE_H */ | ||
diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h index 2ebf7f27bf91..98252cd44dd6 100644 --- a/include/asm-sparc64/thread_info.h +++ b/include/asm-sparc64/thread_info.h | |||
@@ -38,8 +38,8 @@ struct thread_info { | |||
38 | /* D$ line 1 */ | 38 | /* D$ line 1 */ |
39 | struct task_struct *task; | 39 | struct task_struct *task; |
40 | unsigned long flags; | 40 | unsigned long flags; |
41 | __u8 cpu; | ||
42 | __u8 fpsaved[7]; | 41 | __u8 fpsaved[7]; |
42 | __u8 pad; | ||
43 | unsigned long ksp; | 43 | unsigned long ksp; |
44 | 44 | ||
45 | /* D$ line 2 */ | 45 | /* D$ line 2 */ |
@@ -49,7 +49,7 @@ struct thread_info { | |||
49 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | 49 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
50 | __u8 new_child; | 50 | __u8 new_child; |
51 | __u8 syscall_noerror; | 51 | __u8 syscall_noerror; |
52 | __u16 __pad; | 52 | __u16 cpu; |
53 | 53 | ||
54 | unsigned long *utraps; | 54 | unsigned long *utraps; |
55 | 55 | ||
@@ -83,8 +83,7 @@ struct thread_info { | |||
83 | #define TI_CURRENT_DS (TI_FLAGS + TI_FLAG_BYTE_CURRENT_DS) | 83 | #define TI_CURRENT_DS (TI_FLAGS + TI_FLAG_BYTE_CURRENT_DS) |
84 | #define TI_FPDEPTH (TI_FLAGS + TI_FLAG_BYTE_FPDEPTH) | 84 | #define TI_FPDEPTH (TI_FLAGS + TI_FLAG_BYTE_FPDEPTH) |
85 | #define TI_WSAVED (TI_FLAGS + TI_FLAG_BYTE_WSAVED) | 85 | #define TI_WSAVED (TI_FLAGS + TI_FLAG_BYTE_WSAVED) |
86 | #define TI_CPU 0x00000010 | 86 | #define TI_FPSAVED 0x00000010 |
87 | #define TI_FPSAVED 0x00000011 | ||
88 | #define TI_KSP 0x00000018 | 87 | #define TI_KSP 0x00000018 |
89 | #define TI_FAULT_ADDR 0x00000020 | 88 | #define TI_FAULT_ADDR 0x00000020 |
90 | #define TI_KREGS 0x00000028 | 89 | #define TI_KREGS 0x00000028 |
@@ -92,6 +91,7 @@ struct thread_info { | |||
92 | #define TI_PRE_COUNT 0x00000038 | 91 | #define TI_PRE_COUNT 0x00000038 |
93 | #define TI_NEW_CHILD 0x0000003c | 92 | #define TI_NEW_CHILD 0x0000003c |
94 | #define TI_SYS_NOERROR 0x0000003d | 93 | #define TI_SYS_NOERROR 0x0000003d |
94 | #define TI_CPU 0x0000003e | ||
95 | #define TI_UTRAPS 0x00000040 | 95 | #define TI_UTRAPS 0x00000040 |
96 | #define TI_REG_WINDOW 0x00000048 | 96 | #define TI_REG_WINDOW 0x00000048 |
97 | #define TI_RWIN_SPTRS 0x000003c8 | 97 | #define TI_RWIN_SPTRS 0x000003c8 |
diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h index 98a6c613589d..e0d450d600ec 100644 --- a/include/asm-sparc64/topology.h +++ b/include/asm-sparc64/topology.h | |||
@@ -6,4 +6,7 @@ | |||
6 | 6 | ||
7 | #include <asm-generic/topology.h> | 7 | #include <asm-generic/topology.h> |
8 | 8 | ||
9 | #define topology_core_id(cpu) (cpu_data(cpu).core_id) | ||
10 | #define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) | ||
11 | |||
9 | #endif /* _ASM_SPARC64_TOPOLOGY_H */ | 12 | #endif /* _ASM_SPARC64_TOPOLOGY_H */ |
diff --git a/include/asm-sparc64/tsb.h b/include/asm-sparc64/tsb.h index ab55ffcb7bf4..76e4299dd9bc 100644 --- a/include/asm-sparc64/tsb.h +++ b/include/asm-sparc64/tsb.h | |||
@@ -271,7 +271,7 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end; | |||
271 | #define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ | 271 | #define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \ |
272 | sethi %hi(swapper_4m_tsb), REG1; \ | 272 | sethi %hi(swapper_4m_tsb), REG1; \ |
273 | or REG1, %lo(swapper_4m_tsb), REG1; \ | 273 | or REG1, %lo(swapper_4m_tsb), REG1; \ |
274 | and TAG, (KERNEL_TSB_NENTRIES - 1), REG2; \ | 274 | and TAG, (KERNEL_TSB4M_NENTRIES - 1), REG2; \ |
275 | sllx REG2, 4, REG2; \ | 275 | sllx REG2, 4, REG2; \ |
276 | add REG1, REG2, REG2; \ | 276 | add REG1, REG2, REG2; \ |
277 | KTSB_LOAD_QUAD(REG2, REG3); \ | 277 | KTSB_LOAD_QUAD(REG2, REG3); \ |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 09ea01a8a99c..648bd1f0912d 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -209,9 +209,8 @@ enum { | |||
209 | DEVCONF_RTR_PROBE_INTERVAL, | 209 | DEVCONF_RTR_PROBE_INTERVAL, |
210 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, | 210 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, |
211 | DEVCONF_PROXY_NDP, | 211 | DEVCONF_PROXY_NDP, |
212 | __DEVCONF_OPTIMISTIC_DAD, | ||
213 | DEVCONF_ACCEPT_SOURCE_ROUTE, | ||
214 | DEVCONF_OPTIMISTIC_DAD, | 212 | DEVCONF_OPTIMISTIC_DAD, |
213 | DEVCONF_ACCEPT_SOURCE_ROUTE, | ||
215 | DEVCONF_MAX | 214 | DEVCONF_MAX |
216 | }; | 215 | }; |
217 | 216 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f671cd2f133f..3a70f553b28f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -910,6 +910,17 @@ static inline int netif_rx_reschedule(struct net_device *dev, int undo) | |||
910 | return 0; | 910 | return 0; |
911 | } | 911 | } |
912 | 912 | ||
913 | /* same as netif_rx_complete, except that local_irq_save(flags) | ||
914 | * has already been issued | ||
915 | */ | ||
916 | static inline void __netif_rx_complete(struct net_device *dev) | ||
917 | { | ||
918 | BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state)); | ||
919 | list_del(&dev->poll_list); | ||
920 | smp_mb__before_clear_bit(); | ||
921 | clear_bit(__LINK_STATE_RX_SCHED, &dev->state); | ||
922 | } | ||
923 | |||
913 | /* Remove interface from poll list: it must be in the poll list | 924 | /* Remove interface from poll list: it must be in the poll list |
914 | * on current cpu. This primitive is called by dev->poll(), when | 925 | * on current cpu. This primitive is called by dev->poll(), when |
915 | * it completes the work. The device cannot be out of poll list at this | 926 | * it completes the work. The device cannot be out of poll list at this |
@@ -920,10 +931,7 @@ static inline void netif_rx_complete(struct net_device *dev) | |||
920 | unsigned long flags; | 931 | unsigned long flags; |
921 | 932 | ||
922 | local_irq_save(flags); | 933 | local_irq_save(flags); |
923 | BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state)); | 934 | __netif_rx_complete(dev); |
924 | list_del(&dev->poll_list); | ||
925 | smp_mb__before_clear_bit(); | ||
926 | clear_bit(__LINK_STATE_RX_SCHED, &dev->state); | ||
927 | local_irq_restore(flags); | 935 | local_irq_restore(flags); |
928 | } | 936 | } |
929 | 937 | ||
@@ -940,17 +948,6 @@ static inline void netif_poll_enable(struct net_device *dev) | |||
940 | clear_bit(__LINK_STATE_RX_SCHED, &dev->state); | 948 | clear_bit(__LINK_STATE_RX_SCHED, &dev->state); |
941 | } | 949 | } |
942 | 950 | ||
943 | /* same as netif_rx_complete, except that local_irq_save(flags) | ||
944 | * has already been issued | ||
945 | */ | ||
946 | static inline void __netif_rx_complete(struct net_device *dev) | ||
947 | { | ||
948 | BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state)); | ||
949 | list_del(&dev->poll_list); | ||
950 | smp_mb__before_clear_bit(); | ||
951 | clear_bit(__LINK_STATE_RX_SCHED, &dev->state); | ||
952 | } | ||
953 | |||
954 | static inline void netif_tx_lock(struct net_device *dev) | 951 | static inline void netif_tx_lock(struct net_device *dev) |
955 | { | 952 | { |
956 | spin_lock(&dev->_xmit_lock); | 953 | spin_lock(&dev->_xmit_lock); |
diff --git a/include/linux/timer.h b/include/linux/timer.h index e0c5c16c992f..c661710d3627 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
@@ -69,6 +69,12 @@ extern int __mod_timer(struct timer_list *timer, unsigned long expires); | |||
69 | extern int mod_timer(struct timer_list *timer, unsigned long expires); | 69 | extern int mod_timer(struct timer_list *timer, unsigned long expires); |
70 | 70 | ||
71 | /* | 71 | /* |
72 | * The jiffies value which is added to now, when there is no timer | ||
73 | * in the timer wheel: | ||
74 | */ | ||
75 | #define NEXT_TIMER_MAX_DELTA ((1UL << 30) - 1) | ||
76 | |||
77 | /* | ||
72 | * Return when the next timer-wheel timeout occurs (in absolute jiffies), | 78 | * Return when the next timer-wheel timeout occurs (in absolute jiffies), |
73 | * locks the timer base: | 79 | * locks the timer base: |
74 | */ | 80 | */ |
diff --git a/include/net/sock.h b/include/net/sock.h index 689b886038da..dfeb8b13024f 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -218,13 +218,13 @@ struct sock { | |||
218 | atomic_t sk_rmem_alloc; | 218 | atomic_t sk_rmem_alloc; |
219 | atomic_t sk_wmem_alloc; | 219 | atomic_t sk_wmem_alloc; |
220 | atomic_t sk_omem_alloc; | 220 | atomic_t sk_omem_alloc; |
221 | int sk_sndbuf; | ||
221 | struct sk_buff_head sk_receive_queue; | 222 | struct sk_buff_head sk_receive_queue; |
222 | struct sk_buff_head sk_write_queue; | 223 | struct sk_buff_head sk_write_queue; |
223 | struct sk_buff_head sk_async_wait_queue; | 224 | struct sk_buff_head sk_async_wait_queue; |
224 | int sk_wmem_queued; | 225 | int sk_wmem_queued; |
225 | int sk_forward_alloc; | 226 | int sk_forward_alloc; |
226 | gfp_t sk_allocation; | 227 | gfp_t sk_allocation; |
227 | int sk_sndbuf; | ||
228 | int sk_route_caps; | 228 | int sk_route_caps; |
229 | int sk_gso_type; | 229 | int sk_gso_type; |
230 | int sk_rcvlowat; | 230 | int sk_rcvlowat; |
diff --git a/include/net/tcp.h b/include/net/tcp.h index e22b4f0305a3..a8af9ae00177 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -254,6 +254,12 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3) | |||
254 | return seq3 - seq2 >= seq1 - seq2; | 254 | return seq3 - seq2 >= seq1 - seq2; |
255 | } | 255 | } |
256 | 256 | ||
257 | static inline int tcp_too_many_orphans(struct sock *sk, int num) | ||
258 | { | ||
259 | return (num > sysctl_tcp_max_orphans) || | ||
260 | (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | ||
261 | atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); | ||
262 | } | ||
257 | 263 | ||
258 | extern struct proto tcp_prot; | 264 | extern struct proto tcp_prot; |
259 | 265 | ||
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 39ef925d39dd..90185e8b335e 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -237,7 +237,6 @@ extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); | |||
237 | extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); | 237 | extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); |
238 | extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c); | 238 | extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c); |
239 | extern void km_state_notify(struct xfrm_state *x, struct km_event *c); | 239 | extern void km_state_notify(struct xfrm_state *x, struct km_event *c); |
240 | #define XFRM_ACQ_EXPIRES 30 | ||
241 | 240 | ||
242 | struct xfrm_tmpl; | 241 | struct xfrm_tmpl; |
243 | extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); | 242 | extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); |
diff --git a/include/sound/version.h b/include/sound/version.h index 50ee4fd420fa..8e5b2f0f5946 100644 --- a/include/sound/version.h +++ b/include/sound/version.h | |||
@@ -1,3 +1,3 @@ | |||
1 | /* include/version.h. Generated by alsa/ksync script. */ | 1 | /* include/version.h. Generated by alsa/ksync script. */ |
2 | #define CONFIG_SND_VERSION "1.0.14rc4" | 2 | #define CONFIG_SND_VERSION "1.0.14" |
3 | #define CONFIG_SND_DATE " (Wed May 16 09:45:46 2007 UTC)" | 3 | #define CONFIG_SND_DATE " (Thu May 31 09:03:25 2007 UTC)" |
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index f1bda23140b2..fed54418626c 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c | |||
@@ -257,7 +257,8 @@ const char *kallsyms_lookup(unsigned long addr, | |||
257 | pos = get_symbol_pos(addr, symbolsize, offset); | 257 | pos = get_symbol_pos(addr, symbolsize, offset); |
258 | /* Grab name */ | 258 | /* Grab name */ |
259 | kallsyms_expand_symbol(get_symbol_offset(pos), namebuf); | 259 | kallsyms_expand_symbol(get_symbol_offset(pos), namebuf); |
260 | *modname = NULL; | 260 | if (modname) |
261 | *modname = NULL; | ||
261 | return namebuf; | 262 | return namebuf; |
262 | } | 263 | } |
263 | 264 | ||
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 3e7ebc4646b7..52db9e3c526e 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -247,6 +247,21 @@ void tick_nohz_stop_sched_tick(void) | |||
247 | if (cpu == tick_do_timer_cpu) | 247 | if (cpu == tick_do_timer_cpu) |
248 | tick_do_timer_cpu = -1; | 248 | tick_do_timer_cpu = -1; |
249 | 249 | ||
250 | ts->idle_sleeps++; | ||
251 | |||
252 | /* | ||
253 | * delta_jiffies >= NEXT_TIMER_MAX_DELTA signals that | ||
254 | * there is no timer pending or at least extremly far | ||
255 | * into the future (12 days for HZ=1000). In this case | ||
256 | * we simply stop the tick timer: | ||
257 | */ | ||
258 | if (unlikely(delta_jiffies >= NEXT_TIMER_MAX_DELTA)) { | ||
259 | ts->idle_expires.tv64 = KTIME_MAX; | ||
260 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) | ||
261 | hrtimer_cancel(&ts->sched_timer); | ||
262 | goto out; | ||
263 | } | ||
264 | |||
250 | /* | 265 | /* |
251 | * calculate the expiry time for the next timer wheel | 266 | * calculate the expiry time for the next timer wheel |
252 | * timer | 267 | * timer |
@@ -254,7 +269,6 @@ void tick_nohz_stop_sched_tick(void) | |||
254 | expires = ktime_add_ns(last_update, tick_period.tv64 * | 269 | expires = ktime_add_ns(last_update, tick_period.tv64 * |
255 | delta_jiffies); | 270 | delta_jiffies); |
256 | ts->idle_expires = expires; | 271 | ts->idle_expires = expires; |
257 | ts->idle_sleeps++; | ||
258 | 272 | ||
259 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { | 273 | if (ts->nohz_mode == NOHZ_MODE_HIGHRES) { |
260 | hrtimer_start(&ts->sched_timer, expires, | 274 | hrtimer_start(&ts->sched_timer, expires, |
diff --git a/kernel/timer.c b/kernel/timer.c index 5ec5490f8d85..1a69705c2fb9 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -666,7 +666,7 @@ static inline void __run_timers(tvec_base_t *base) | |||
666 | static unsigned long __next_timer_interrupt(tvec_base_t *base) | 666 | static unsigned long __next_timer_interrupt(tvec_base_t *base) |
667 | { | 667 | { |
668 | unsigned long timer_jiffies = base->timer_jiffies; | 668 | unsigned long timer_jiffies = base->timer_jiffies; |
669 | unsigned long expires = timer_jiffies + (LONG_MAX >> 1); | 669 | unsigned long expires = timer_jiffies + NEXT_TIMER_MAX_DELTA; |
670 | int index, slot, array, found = 0; | 670 | int index, slot, array, found = 0; |
671 | struct timer_list *nte; | 671 | struct timer_list *nte; |
672 | tvec_t *varray[4]; | 672 | tvec_t *varray[4]; |
@@ -752,6 +752,14 @@ static unsigned long cmp_next_hrtimer_event(unsigned long now, | |||
752 | 752 | ||
753 | tsdelta = ktime_to_timespec(hr_delta); | 753 | tsdelta = ktime_to_timespec(hr_delta); |
754 | delta = timespec_to_jiffies(&tsdelta); | 754 | delta = timespec_to_jiffies(&tsdelta); |
755 | |||
756 | /* | ||
757 | * Limit the delta to the max value, which is checked in | ||
758 | * tick_nohz_stop_sched_tick(): | ||
759 | */ | ||
760 | if (delta > NEXT_TIMER_MAX_DELTA) | ||
761 | delta = NEXT_TIMER_MAX_DELTA; | ||
762 | |||
755 | /* | 763 | /* |
756 | * Take rounding errors in to account and make sure, that it | 764 | * Take rounding errors in to account and make sure, that it |
757 | * expires in the next tick. Otherwise we go into an endless | 765 | * expires in the next tick. Otherwise we go into an endless |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d8970623c566..bd8e33582d25 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2689,7 +2689,7 @@ static void __init_refok alloc_node_mem_map(struct pglist_data *pgdat) | |||
2689 | map = alloc_bootmem_node(pgdat, size); | 2689 | map = alloc_bootmem_node(pgdat, size); |
2690 | pgdat->node_mem_map = map + (pgdat->node_start_pfn - start); | 2690 | pgdat->node_mem_map = map + (pgdat->node_start_pfn - start); |
2691 | } | 2691 | } |
2692 | #ifdef CONFIG_FLATMEM | 2692 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
2693 | /* | 2693 | /* |
2694 | * With no DISCONTIG, the global mem_map is just set as node 0's | 2694 | * With no DISCONTIG, the global mem_map is just set as node 0's |
2695 | */ | 2695 | */ |
@@ -2435,6 +2435,7 @@ void __init kmem_cache_init(void) | |||
2435 | */ | 2435 | */ |
2436 | create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node", | 2436 | create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node", |
2437 | sizeof(struct kmem_cache_node), GFP_KERNEL); | 2437 | sizeof(struct kmem_cache_node), GFP_KERNEL); |
2438 | kmalloc_caches[0].refcount = -1; | ||
2438 | #endif | 2439 | #endif |
2439 | 2440 | ||
2440 | /* Able to allocate the per node structures */ | 2441 | /* Able to allocate the per node structures */ |
@@ -2482,6 +2483,12 @@ static int slab_unmergeable(struct kmem_cache *s) | |||
2482 | if (s->ctor) | 2483 | if (s->ctor) |
2483 | return 1; | 2484 | return 1; |
2484 | 2485 | ||
2486 | /* | ||
2487 | * We may have set a slab to be unmergeable during bootstrap. | ||
2488 | */ | ||
2489 | if (s->refcount < 0) | ||
2490 | return 1; | ||
2491 | |||
2485 | return 0; | 2492 | return 0; |
2486 | } | 2493 | } |
2487 | 2494 | ||
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 91b017016d5b..3fc697293819 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c | |||
@@ -121,6 +121,7 @@ void br_fdb_cleanup(unsigned long _data) | |||
121 | { | 121 | { |
122 | struct net_bridge *br = (struct net_bridge *)_data; | 122 | struct net_bridge *br = (struct net_bridge *)_data; |
123 | unsigned long delay = hold_time(br); | 123 | unsigned long delay = hold_time(br); |
124 | unsigned long next_timer = jiffies + br->forward_delay; | ||
124 | int i; | 125 | int i; |
125 | 126 | ||
126 | spin_lock_bh(&br->hash_lock); | 127 | spin_lock_bh(&br->hash_lock); |
@@ -129,14 +130,21 @@ void br_fdb_cleanup(unsigned long _data) | |||
129 | struct hlist_node *h, *n; | 130 | struct hlist_node *h, *n; |
130 | 131 | ||
131 | hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) { | 132 | hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) { |
132 | if (!f->is_static && | 133 | unsigned long this_timer; |
133 | time_before_eq(f->ageing_timer + delay, jiffies)) | 134 | if (f->is_static) |
135 | continue; | ||
136 | this_timer = f->ageing_timer + delay; | ||
137 | if (time_before_eq(this_timer, jiffies)) | ||
134 | fdb_delete(f); | 138 | fdb_delete(f); |
139 | else if (this_timer < next_timer) | ||
140 | next_timer = this_timer; | ||
135 | } | 141 | } |
136 | } | 142 | } |
137 | spin_unlock_bh(&br->hash_lock); | 143 | spin_unlock_bh(&br->hash_lock); |
138 | 144 | ||
139 | mod_timer(&br->gc_timer, jiffies + HZ/10); | 145 | /* Add HZ/4 to ensure we round the jiffies upwards to be after the next |
146 | * timer, otherwise we might round down and will have no-op run. */ | ||
147 | mod_timer(&br->gc_timer, round_jiffies(next_timer + HZ/4)); | ||
140 | } | 148 | } |
141 | 149 | ||
142 | /* Completely flush all dynamic entries in forwarding database.*/ | 150 | /* Completely flush all dynamic entries in forwarding database.*/ |
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index 0e035d6162cc..e38034aa56f5 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c | |||
@@ -178,7 +178,8 @@ void br_transmit_config(struct net_bridge_port *p) | |||
178 | br_send_config_bpdu(p, &bpdu); | 178 | br_send_config_bpdu(p, &bpdu); |
179 | p->topology_change_ack = 0; | 179 | p->topology_change_ack = 0; |
180 | p->config_pending = 0; | 180 | p->config_pending = 0; |
181 | mod_timer(&p->hold_timer, jiffies + BR_HOLD_TIME); | 181 | mod_timer(&p->hold_timer, |
182 | round_jiffies(jiffies + BR_HOLD_TIME)); | ||
182 | } | 183 | } |
183 | } | 184 | } |
184 | 185 | ||
diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c index 24e0ca4a3131..77f5255e6915 100644 --- a/net/bridge/br_stp_timer.c +++ b/net/bridge/br_stp_timer.c | |||
@@ -42,7 +42,7 @@ static void br_hello_timer_expired(unsigned long arg) | |||
42 | if (br->dev->flags & IFF_UP) { | 42 | if (br->dev->flags & IFF_UP) { |
43 | br_config_bpdu_generation(br); | 43 | br_config_bpdu_generation(br); |
44 | 44 | ||
45 | mod_timer(&br->hello_timer, jiffies + br->hello_time); | 45 | mod_timer(&br->hello_timer, round_jiffies(jiffies + br->hello_time)); |
46 | } | 46 | } |
47 | spin_unlock(&br->lock); | 47 | spin_unlock(&br->lock); |
48 | } | 48 | } |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index f34aca041a25..6d5ea9762040 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
@@ -25,6 +25,7 @@ extern int sysctl_core_destroy_delay; | |||
25 | extern u32 sysctl_xfrm_aevent_etime; | 25 | extern u32 sysctl_xfrm_aevent_etime; |
26 | extern u32 sysctl_xfrm_aevent_rseqth; | 26 | extern u32 sysctl_xfrm_aevent_rseqth; |
27 | extern int sysctl_xfrm_larval_drop; | 27 | extern int sysctl_xfrm_larval_drop; |
28 | extern u32 sysctl_xfrm_acq_expires; | ||
28 | #endif | 29 | #endif |
29 | 30 | ||
30 | ctl_table core_table[] = { | 31 | ctl_table core_table[] = { |
@@ -127,6 +128,14 @@ ctl_table core_table[] = { | |||
127 | .mode = 0644, | 128 | .mode = 0644, |
128 | .proc_handler = &proc_dointvec | 129 | .proc_handler = &proc_dointvec |
129 | }, | 130 | }, |
131 | { | ||
132 | .ctl_name = CTL_UNNUMBERED, | ||
133 | .procname = "xfrm_acq_expires", | ||
134 | .data = &sysctl_xfrm_acq_expires, | ||
135 | .maxlen = sizeof(int), | ||
136 | .mode = 0644, | ||
137 | .proc_handler = &proc_dointvec | ||
138 | }, | ||
130 | #endif /* CONFIG_XFRM */ | 139 | #endif /* CONFIG_XFRM */ |
131 | #endif /* CONFIG_NET */ | 140 | #endif /* CONFIG_NET */ |
132 | { | 141 | { |
diff --git a/net/core/utils.c b/net/core/utils.c index adecfd281ae9..2030bb8c2d30 100644 --- a/net/core/utils.c +++ b/net/core/utils.c | |||
@@ -139,16 +139,16 @@ int in4_pton(const char *src, int srclen, | |||
139 | while(1) { | 139 | while(1) { |
140 | int c; | 140 | int c; |
141 | c = xdigit2bin(srclen > 0 ? *s : '\0', delim); | 141 | c = xdigit2bin(srclen > 0 ? *s : '\0', delim); |
142 | if (!(c & (IN6PTON_DIGIT | IN6PTON_DOT | IN6PTON_DELIM))) { | 142 | if (!(c & (IN6PTON_DIGIT | IN6PTON_DOT | IN6PTON_DELIM | IN6PTON_COLON_MASK))) { |
143 | goto out; | 143 | goto out; |
144 | } | 144 | } |
145 | if (c & (IN6PTON_DOT | IN6PTON_DELIM)) { | 145 | if (c & (IN6PTON_DOT | IN6PTON_DELIM | IN6PTON_COLON_MASK)) { |
146 | if (w == 0) | 146 | if (w == 0) |
147 | goto out; | 147 | goto out; |
148 | *d++ = w & 0xff; | 148 | *d++ = w & 0xff; |
149 | w = 0; | 149 | w = 0; |
150 | i++; | 150 | i++; |
151 | if (c & IN6PTON_DELIM) { | 151 | if (c & (IN6PTON_DELIM | IN6PTON_COLON_MASK)) { |
152 | if (i != 4) | 152 | if (i != 4) |
153 | goto out; | 153 | goto out; |
154 | break; | 154 | break; |
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c index 7ec6610841ba..17ad278696ed 100644 --- a/net/ieee80211/ieee80211_module.c +++ b/net/ieee80211/ieee80211_module.c | |||
@@ -140,7 +140,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
140 | 140 | ||
141 | dev = alloc_etherdev(sizeof(struct ieee80211_device) + sizeof_priv); | 141 | dev = alloc_etherdev(sizeof(struct ieee80211_device) + sizeof_priv); |
142 | if (!dev) { | 142 | if (!dev) { |
143 | IEEE80211_ERROR("Unable to network device.\n"); | 143 | IEEE80211_ERROR("Unable to allocate network device.\n"); |
144 | goto failed; | 144 | goto failed; |
145 | } | 145 | } |
146 | ieee = netdev_priv(dev); | 146 | ieee = netdev_priv(dev); |
diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c index e9cdc6615ddc..c308756c2f9d 100644 --- a/net/ieee80211/softmac/ieee80211softmac_module.c +++ b/net/ieee80211/softmac/ieee80211softmac_module.c | |||
@@ -33,7 +33,10 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv) | |||
33 | struct ieee80211softmac_device *softmac; | 33 | struct ieee80211softmac_device *softmac; |
34 | struct net_device *dev; | 34 | struct net_device *dev; |
35 | 35 | ||
36 | dev = alloc_ieee80211(sizeof(struct ieee80211softmac_device) + sizeof_priv); | 36 | dev = alloc_ieee80211(sizeof(*softmac) + sizeof_priv); |
37 | if (!dev) | ||
38 | return NULL; | ||
39 | |||
37 | softmac = ieee80211_priv(dev); | 40 | softmac = ieee80211_priv(dev); |
38 | softmac->dev = dev; | 41 | softmac->dev = dev; |
39 | softmac->ieee = netdev_priv(dev); | 42 | softmac->ieee = netdev_priv(dev); |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 837f2957fa83..9ad1f6252a97 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -250,8 +250,6 @@ e_inval: | |||
250 | return -EINVAL; | 250 | return -EINVAL; |
251 | } | 251 | } |
252 | 252 | ||
253 | #ifndef CONFIG_IP_NOSIOCRT | ||
254 | |||
255 | static inline __be32 sk_extract_addr(struct sockaddr *addr) | 253 | static inline __be32 sk_extract_addr(struct sockaddr *addr) |
256 | { | 254 | { |
257 | return ((struct sockaddr_in *) addr)->sin_addr.s_addr; | 255 | return ((struct sockaddr_in *) addr)->sin_addr.s_addr; |
@@ -443,15 +441,6 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg) | |||
443 | return -EINVAL; | 441 | return -EINVAL; |
444 | } | 442 | } |
445 | 443 | ||
446 | #else | ||
447 | |||
448 | int ip_rt_ioctl(unsigned int cmd, void *arg) | ||
449 | { | ||
450 | return -EINVAL; | ||
451 | } | ||
452 | |||
453 | #endif | ||
454 | |||
455 | struct nla_policy rtm_ipv4_policy[RTA_MAX+1] __read_mostly = { | 444 | struct nla_policy rtm_ipv4_policy[RTA_MAX+1] __read_mostly = { |
456 | [RTA_DST] = { .type = NLA_U32 }, | 445 | [RTA_DST] = { .type = NLA_U32 }, |
457 | [RTA_SRC] = { .type = NLA_U32 }, | 446 | [RTA_SRC] = { .type = NLA_U32 }, |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index bd4c295f5d79..766314505c09 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1674,9 +1674,8 @@ adjudge_to_death: | |||
1674 | } | 1674 | } |
1675 | if (sk->sk_state != TCP_CLOSE) { | 1675 | if (sk->sk_state != TCP_CLOSE) { |
1676 | sk_stream_mem_reclaim(sk); | 1676 | sk_stream_mem_reclaim(sk); |
1677 | if (atomic_read(sk->sk_prot->orphan_count) > sysctl_tcp_max_orphans || | 1677 | if (tcp_too_many_orphans(sk, |
1678 | (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | 1678 | atomic_read(sk->sk_prot->orphan_count))) { |
1679 | atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) { | ||
1680 | if (net_ratelimit()) | 1679 | if (net_ratelimit()) |
1681 | printk(KERN_INFO "TCP: too many of orphaned " | 1680 | printk(KERN_INFO "TCP: too many of orphaned " |
1682 | "sockets\n"); | 1681 | "sockets\n"); |
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index 3938d5dbdf20..760165a0800c 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c | |||
@@ -80,7 +80,8 @@ static void printl(const char *fmt, ...) | |||
80 | 80 | ||
81 | kfifo_put(tcpw.fifo, tbuf, len); | 81 | kfifo_put(tcpw.fifo, tbuf, len); |
82 | wake_up(&tcpw.wait); | 82 | wake_up(&tcpw.wait); |
83 | } | 83 | } __attribute__ ((format (printf, 1, 2))); |
84 | |||
84 | 85 | ||
85 | /* | 86 | /* |
86 | * Hook inserted to be called before each receive packet. | 87 | * Hook inserted to be called before each receive packet. |
@@ -95,7 +96,7 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
95 | /* Only update if port matches */ | 96 | /* Only update if port matches */ |
96 | if ((port == 0 || ntohs(inet->dport) == port || ntohs(inet->sport) == port) | 97 | if ((port == 0 || ntohs(inet->dport) == port || ntohs(inet->sport) == port) |
97 | && (full || tp->snd_cwnd != tcpw.lastcwnd)) { | 98 | && (full || tp->snd_cwnd != tcpw.lastcwnd)) { |
98 | printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d %#x %#x %u %u %u\n", | 99 | printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d %#x %#x %u %u %u %u\n", |
99 | NIPQUAD(inet->saddr), ntohs(inet->sport), | 100 | NIPQUAD(inet->saddr), ntohs(inet->sport), |
100 | NIPQUAD(inet->daddr), ntohs(inet->dport), | 101 | NIPQUAD(inet->daddr), ntohs(inet->dport), |
101 | skb->len, tp->snd_nxt, tp->snd_una, | 102 | skb->len, tp->snd_nxt, tp->snd_una, |
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 2ca97b20929d..e61340150ba6 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -78,9 +78,7 @@ static int tcp_out_of_resources(struct sock *sk, int do_reset) | |||
78 | if (sk->sk_err_soft) | 78 | if (sk->sk_err_soft) |
79 | orphans <<= 1; | 79 | orphans <<= 1; |
80 | 80 | ||
81 | if (orphans >= sysctl_tcp_max_orphans || | 81 | if (tcp_too_many_orphans(sk, orphans)) { |
82 | (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | ||
83 | atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) { | ||
84 | if (net_ratelimit()) | 82 | if (net_ratelimit()) |
85 | printk(KERN_INFO "Out of socket memory\n"); | 83 | printk(KERN_INFO "Out of socket memory\n"); |
86 | 84 | ||
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index 5ceca951d73f..fa1902dc81b8 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c | |||
@@ -139,10 +139,8 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) | |||
139 | nf_reset(skb); | 139 | nf_reset(skb); |
140 | 140 | ||
141 | if (decaps) { | 141 | if (decaps) { |
142 | if (!(skb->dev->flags&IFF_LOOPBACK)) { | 142 | dst_release(skb->dst); |
143 | dst_release(skb->dst); | 143 | skb->dst = NULL; |
144 | skb->dst = NULL; | ||
145 | } | ||
146 | netif_rx(skb); | 144 | netif_rx(skb); |
147 | return 0; | 145 | return 0; |
148 | } else { | 146 | } else { |
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c index a2f2e6a5ec5d..9963700e74c1 100644 --- a/net/ipv4/xfrm4_mode_tunnel.c +++ b/net/ipv4/xfrm4_mode_tunnel.c | |||
@@ -85,6 +85,8 @@ static int xfrm4_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
85 | top_iph->saddr = x->props.saddr.a4; | 85 | top_iph->saddr = x->props.saddr.a4; |
86 | top_iph->daddr = x->id.daddr.a4; | 86 | top_iph->daddr = x->id.daddr.a4; |
87 | 87 | ||
88 | skb->protocol = htons(ETH_P_IP); | ||
89 | |||
88 | memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); | 90 | memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); |
89 | return 0; | 91 | return 0; |
90 | } | 92 | } |
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index b696c8401200..128f94c79c64 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -247,7 +247,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
247 | memcpy(tmp_base, top_iph, sizeof(tmp_base)); | 247 | memcpy(tmp_base, top_iph, sizeof(tmp_base)); |
248 | 248 | ||
249 | tmp_ext = NULL; | 249 | tmp_ext = NULL; |
250 | extlen = skb_transport_offset(skb) + sizeof(struct ipv6hdr); | 250 | extlen = skb_transport_offset(skb) - sizeof(struct ipv6hdr); |
251 | if (extlen) { | 251 | if (extlen) { |
252 | extlen += sizeof(*tmp_ext); | 252 | extlen += sizeof(*tmp_ext); |
253 | tmp_ext = kmalloc(extlen, GFP_ATOMIC); | 253 | tmp_ext = kmalloc(extlen, GFP_ATOMIC); |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index ca08ee88d07f..662a7d9681fd 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -619,14 +619,6 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
619 | 619 | ||
620 | ins = &fn->leaf; | 620 | ins = &fn->leaf; |
621 | 621 | ||
622 | if (fn->fn_flags&RTN_TL_ROOT && | ||
623 | fn->leaf == &ip6_null_entry && | ||
624 | !(rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ){ | ||
625 | fn->leaf = rt; | ||
626 | rt->u.dst.rt6_next = NULL; | ||
627 | goto out; | ||
628 | } | ||
629 | |||
630 | for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) { | 622 | for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) { |
631 | /* | 623 | /* |
632 | * Search for duplicates | 624 | * Search for duplicates |
@@ -666,7 +658,6 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
666 | * insert node | 658 | * insert node |
667 | */ | 659 | */ |
668 | 660 | ||
669 | out: | ||
670 | rt->u.dst.rt6_next = iter; | 661 | rt->u.dst.rt6_next = iter; |
671 | *ins = rt; | 662 | *ins = rt; |
672 | rt->rt6i_node = fn; | 663 | rt->rt6i_node = fn; |
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index d7ed8aa56ec1..c858537cec4b 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c | |||
@@ -104,10 +104,8 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi) | |||
104 | nf_reset(skb); | 104 | nf_reset(skb); |
105 | 105 | ||
106 | if (decaps) { | 106 | if (decaps) { |
107 | if (!(skb->dev->flags&IFF_LOOPBACK)) { | 107 | dst_release(skb->dst); |
108 | dst_release(skb->dst); | 108 | skb->dst = NULL; |
109 | skb->dst = NULL; | ||
110 | } | ||
111 | netif_rx(skb); | 109 | netif_rx(skb); |
112 | return -1; | 110 | return -1; |
113 | } else { | 111 | } else { |
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c index a6c0cdf46ad6..9fc95bc6509f 100644 --- a/net/ipv6/xfrm6_mode_tunnel.c +++ b/net/ipv6/xfrm6_mode_tunnel.c | |||
@@ -80,6 +80,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
80 | top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT); | 80 | top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT); |
81 | ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); | 81 | ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); |
82 | ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); | 82 | ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); |
83 | skb->protocol = htons(ETH_P_IPV6); | ||
83 | return 0; | 84 | return 0; |
84 | } | 85 | } |
85 | 86 | ||
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 6e36df67f8d5..4e84f24fd439 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -2474,6 +2474,8 @@ static int ieee80211_open(struct net_device *dev) | |||
2474 | if (sdata->type == IEEE80211_IF_TYPE_STA && | 2474 | if (sdata->type == IEEE80211_IF_TYPE_STA && |
2475 | !local->user_space_mlme) | 2475 | !local->user_space_mlme) |
2476 | netif_carrier_off(dev); | 2476 | netif_carrier_off(dev); |
2477 | else | ||
2478 | netif_carrier_on(dev); | ||
2477 | 2479 | ||
2478 | netif_start_queue(dev); | 2480 | netif_start_queue(dev); |
2479 | return 0; | 2481 | return 0; |
@@ -3278,8 +3280,10 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx) | |||
3278 | return TXRX_DROP; | 3280 | return TXRX_DROP; |
3279 | } | 3281 | } |
3280 | } | 3282 | } |
3281 | while ((skb = __skb_dequeue(&entry->skb_list))) | 3283 | while ((skb = __skb_dequeue(&entry->skb_list))) { |
3282 | memcpy(skb_put(rx->skb, skb->len), skb->data, skb->len); | 3284 | memcpy(skb_put(rx->skb, skb->len), skb->data, skb->len); |
3285 | dev_kfree_skb(skb); | ||
3286 | } | ||
3283 | 3287 | ||
3284 | /* Complete frame has been reassembled - process it now */ | 3288 | /* Complete frame has been reassembled - process it now */ |
3285 | rx->fragmented = 1; | 3289 | rx->fragmented = 1; |
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c index 3e07e9d6fa42..9f30ae4c2ab3 100644 --- a/net/mac80211/ieee80211_sta.c +++ b/net/mac80211/ieee80211_sta.c | |||
@@ -1155,6 +1155,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev, | |||
1155 | if (status_code != WLAN_STATUS_SUCCESS) { | 1155 | if (status_code != WLAN_STATUS_SUCCESS) { |
1156 | printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", | 1156 | printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", |
1157 | dev->name, status_code); | 1157 | dev->name, status_code); |
1158 | if (status_code == WLAN_STATUS_REASSOC_NO_ASSOC) | ||
1159 | ifsta->prev_bssid_set = 0; | ||
1158 | return; | 1160 | return; |
1159 | } | 1161 | } |
1160 | 1162 | ||
@@ -2995,7 +2997,7 @@ struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev, | |||
2995 | { | 2997 | { |
2996 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2998 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
2997 | struct sta_info *sta; | 2999 | struct sta_info *sta; |
2998 | struct ieee80211_sub_if_data *sdata = NULL; | 3000 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2999 | 3001 | ||
3000 | /* TODO: Could consider removing the least recently used entry and | 3002 | /* TODO: Could consider removing the least recently used entry and |
3001 | * allow new one to be added. */ | 3003 | * allow new one to be added. */ |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 02e401cd683f..f8b83014ccca 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -83,22 +83,6 @@ | |||
83 | #include <net/inet_common.h> | 83 | #include <net/inet_common.h> |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | #define CONFIG_SOCK_PACKET 1 | ||
87 | |||
88 | /* | ||
89 | Proposed replacement for SIOC{ADD,DEL}MULTI and | ||
90 | IFF_PROMISC, IFF_ALLMULTI flags. | ||
91 | |||
92 | It is more expensive, but I believe, | ||
93 | it is really correct solution: reentereble, safe and fault tolerant. | ||
94 | |||
95 | IFF_PROMISC/IFF_ALLMULTI/SIOC{ADD/DEL}MULTI are faked by keeping | ||
96 | reference count and global flag, so that real status is | ||
97 | (gflag|(count != 0)), so that we can use obsolete faulty interface | ||
98 | not harming clever users. | ||
99 | */ | ||
100 | #define CONFIG_PACKET_MULTICAST 1 | ||
101 | |||
102 | /* | 86 | /* |
103 | Assumptions: | 87 | Assumptions: |
104 | - if device has no dev->hard_header routine, it adds and removes ll header | 88 | - if device has no dev->hard_header routine, it adds and removes ll header |
@@ -159,7 +143,6 @@ static atomic_t packet_socks_nr; | |||
159 | 143 | ||
160 | /* Private packet socket structures. */ | 144 | /* Private packet socket structures. */ |
161 | 145 | ||
162 | #ifdef CONFIG_PACKET_MULTICAST | ||
163 | struct packet_mclist | 146 | struct packet_mclist |
164 | { | 147 | { |
165 | struct packet_mclist *next; | 148 | struct packet_mclist *next; |
@@ -179,7 +162,7 @@ struct packet_mreq_max | |||
179 | unsigned short mr_alen; | 162 | unsigned short mr_alen; |
180 | unsigned char mr_address[MAX_ADDR_LEN]; | 163 | unsigned char mr_address[MAX_ADDR_LEN]; |
181 | }; | 164 | }; |
182 | #endif | 165 | |
183 | #ifdef CONFIG_PACKET_MMAP | 166 | #ifdef CONFIG_PACKET_MMAP |
184 | static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing); | 167 | static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing); |
185 | #endif | 168 | #endif |
@@ -205,9 +188,7 @@ struct packet_sock { | |||
205 | origdev:1; | 188 | origdev:1; |
206 | int ifindex; /* bound device */ | 189 | int ifindex; /* bound device */ |
207 | __be16 num; | 190 | __be16 num; |
208 | #ifdef CONFIG_PACKET_MULTICAST | ||
209 | struct packet_mclist *mclist; | 191 | struct packet_mclist *mclist; |
210 | #endif | ||
211 | #ifdef CONFIG_PACKET_MMAP | 192 | #ifdef CONFIG_PACKET_MMAP |
212 | atomic_t mapped; | 193 | atomic_t mapped; |
213 | unsigned int pg_vec_order; | 194 | unsigned int pg_vec_order; |
@@ -263,7 +244,6 @@ static void packet_sock_destruct(struct sock *sk) | |||
263 | 244 | ||
264 | static const struct proto_ops packet_ops; | 245 | static const struct proto_ops packet_ops; |
265 | 246 | ||
266 | #ifdef CONFIG_SOCK_PACKET | ||
267 | static const struct proto_ops packet_ops_spkt; | 247 | static const struct proto_ops packet_ops_spkt; |
268 | 248 | ||
269 | static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) | 249 | static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) |
@@ -435,7 +415,6 @@ out_unlock: | |||
435 | dev_put(dev); | 415 | dev_put(dev); |
436 | return err; | 416 | return err; |
437 | } | 417 | } |
438 | #endif | ||
439 | 418 | ||
440 | static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, | 419 | static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, |
441 | unsigned int res) | 420 | unsigned int res) |
@@ -851,9 +830,7 @@ static int packet_release(struct socket *sock) | |||
851 | __sock_put(sk); | 830 | __sock_put(sk); |
852 | } | 831 | } |
853 | 832 | ||
854 | #ifdef CONFIG_PACKET_MULTICAST | ||
855 | packet_flush_mclist(sk); | 833 | packet_flush_mclist(sk); |
856 | #endif | ||
857 | 834 | ||
858 | #ifdef CONFIG_PACKET_MMAP | 835 | #ifdef CONFIG_PACKET_MMAP |
859 | if (po->pg_vec) { | 836 | if (po->pg_vec) { |
@@ -936,8 +913,6 @@ out_unlock: | |||
936 | * Bind a packet socket to a device | 913 | * Bind a packet socket to a device |
937 | */ | 914 | */ |
938 | 915 | ||
939 | #ifdef CONFIG_SOCK_PACKET | ||
940 | |||
941 | static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) | 916 | static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
942 | { | 917 | { |
943 | struct sock *sk=sock->sk; | 918 | struct sock *sk=sock->sk; |
@@ -960,7 +935,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int add | |||
960 | } | 935 | } |
961 | return err; | 936 | return err; |
962 | } | 937 | } |
963 | #endif | ||
964 | 938 | ||
965 | static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | 939 | static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
966 | { | 940 | { |
@@ -1012,11 +986,8 @@ static int packet_create(struct socket *sock, int protocol) | |||
1012 | 986 | ||
1013 | if (!capable(CAP_NET_RAW)) | 987 | if (!capable(CAP_NET_RAW)) |
1014 | return -EPERM; | 988 | return -EPERM; |
1015 | if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW | 989 | if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW && |
1016 | #ifdef CONFIG_SOCK_PACKET | 990 | sock->type != SOCK_PACKET) |
1017 | && sock->type != SOCK_PACKET | ||
1018 | #endif | ||
1019 | ) | ||
1020 | return -ESOCKTNOSUPPORT; | 991 | return -ESOCKTNOSUPPORT; |
1021 | 992 | ||
1022 | sock->state = SS_UNCONNECTED; | 993 | sock->state = SS_UNCONNECTED; |
@@ -1027,10 +998,9 @@ static int packet_create(struct socket *sock, int protocol) | |||
1027 | goto out; | 998 | goto out; |
1028 | 999 | ||
1029 | sock->ops = &packet_ops; | 1000 | sock->ops = &packet_ops; |
1030 | #ifdef CONFIG_SOCK_PACKET | ||
1031 | if (sock->type == SOCK_PACKET) | 1001 | if (sock->type == SOCK_PACKET) |
1032 | sock->ops = &packet_ops_spkt; | 1002 | sock->ops = &packet_ops_spkt; |
1033 | #endif | 1003 | |
1034 | sock_init_data(sock, sk); | 1004 | sock_init_data(sock, sk); |
1035 | 1005 | ||
1036 | po = pkt_sk(sk); | 1006 | po = pkt_sk(sk); |
@@ -1046,10 +1016,10 @@ static int packet_create(struct socket *sock, int protocol) | |||
1046 | 1016 | ||
1047 | spin_lock_init(&po->bind_lock); | 1017 | spin_lock_init(&po->bind_lock); |
1048 | po->prot_hook.func = packet_rcv; | 1018 | po->prot_hook.func = packet_rcv; |
1049 | #ifdef CONFIG_SOCK_PACKET | 1019 | |
1050 | if (sock->type == SOCK_PACKET) | 1020 | if (sock->type == SOCK_PACKET) |
1051 | po->prot_hook.func = packet_rcv_spkt; | 1021 | po->prot_hook.func = packet_rcv_spkt; |
1052 | #endif | 1022 | |
1053 | po->prot_hook.af_packet_priv = sk; | 1023 | po->prot_hook.af_packet_priv = sk; |
1054 | 1024 | ||
1055 | if (proto) { | 1025 | if (proto) { |
@@ -1169,7 +1139,6 @@ out: | |||
1169 | return err; | 1139 | return err; |
1170 | } | 1140 | } |
1171 | 1141 | ||
1172 | #ifdef CONFIG_SOCK_PACKET | ||
1173 | static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, | 1142 | static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, |
1174 | int *uaddr_len, int peer) | 1143 | int *uaddr_len, int peer) |
1175 | { | 1144 | { |
@@ -1190,7 +1159,6 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, | |||
1190 | 1159 | ||
1191 | return 0; | 1160 | return 0; |
1192 | } | 1161 | } |
1193 | #endif | ||
1194 | 1162 | ||
1195 | static int packet_getname(struct socket *sock, struct sockaddr *uaddr, | 1163 | static int packet_getname(struct socket *sock, struct sockaddr *uaddr, |
1196 | int *uaddr_len, int peer) | 1164 | int *uaddr_len, int peer) |
@@ -1221,7 +1189,6 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr, | |||
1221 | return 0; | 1189 | return 0; |
1222 | } | 1190 | } |
1223 | 1191 | ||
1224 | #ifdef CONFIG_PACKET_MULTICAST | ||
1225 | static void packet_dev_mc(struct net_device *dev, struct packet_mclist *i, int what) | 1192 | static void packet_dev_mc(struct net_device *dev, struct packet_mclist *i, int what) |
1226 | { | 1193 | { |
1227 | switch (i->type) { | 1194 | switch (i->type) { |
@@ -1349,7 +1316,6 @@ static void packet_flush_mclist(struct sock *sk) | |||
1349 | } | 1316 | } |
1350 | rtnl_unlock(); | 1317 | rtnl_unlock(); |
1351 | } | 1318 | } |
1352 | #endif | ||
1353 | 1319 | ||
1354 | static int | 1320 | static int |
1355 | packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) | 1321 | packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) |
@@ -1362,7 +1328,6 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv | |||
1362 | return -ENOPROTOOPT; | 1328 | return -ENOPROTOOPT; |
1363 | 1329 | ||
1364 | switch(optname) { | 1330 | switch(optname) { |
1365 | #ifdef CONFIG_PACKET_MULTICAST | ||
1366 | case PACKET_ADD_MEMBERSHIP: | 1331 | case PACKET_ADD_MEMBERSHIP: |
1367 | case PACKET_DROP_MEMBERSHIP: | 1332 | case PACKET_DROP_MEMBERSHIP: |
1368 | { | 1333 | { |
@@ -1383,7 +1348,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv | |||
1383 | ret = packet_mc_drop(sk, &mreq); | 1348 | ret = packet_mc_drop(sk, &mreq); |
1384 | return ret; | 1349 | return ret; |
1385 | } | 1350 | } |
1386 | #endif | 1351 | |
1387 | #ifdef CONFIG_PACKET_MMAP | 1352 | #ifdef CONFIG_PACKET_MMAP |
1388 | case PACKET_RX_RING: | 1353 | case PACKET_RX_RING: |
1389 | { | 1354 | { |
@@ -1506,11 +1471,10 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void | |||
1506 | 1471 | ||
1507 | switch (msg) { | 1472 | switch (msg) { |
1508 | case NETDEV_UNREGISTER: | 1473 | case NETDEV_UNREGISTER: |
1509 | #ifdef CONFIG_PACKET_MULTICAST | ||
1510 | if (po->mclist) | 1474 | if (po->mclist) |
1511 | packet_dev_mclist(dev, po->mclist, -1); | 1475 | packet_dev_mclist(dev, po->mclist, -1); |
1512 | // fallthrough | 1476 | /* fallthrough */ |
1513 | #endif | 1477 | |
1514 | case NETDEV_DOWN: | 1478 | case NETDEV_DOWN: |
1515 | if (dev->ifindex == po->ifindex) { | 1479 | if (dev->ifindex == po->ifindex) { |
1516 | spin_lock(&po->bind_lock); | 1480 | spin_lock(&po->bind_lock); |
@@ -1856,7 +1820,6 @@ out: | |||
1856 | #endif | 1820 | #endif |
1857 | 1821 | ||
1858 | 1822 | ||
1859 | #ifdef CONFIG_SOCK_PACKET | ||
1860 | static const struct proto_ops packet_ops_spkt = { | 1823 | static const struct proto_ops packet_ops_spkt = { |
1861 | .family = PF_PACKET, | 1824 | .family = PF_PACKET, |
1862 | .owner = THIS_MODULE, | 1825 | .owner = THIS_MODULE, |
@@ -1877,7 +1840,6 @@ static const struct proto_ops packet_ops_spkt = { | |||
1877 | .mmap = sock_no_mmap, | 1840 | .mmap = sock_no_mmap, |
1878 | .sendpage = sock_no_sendpage, | 1841 | .sendpage = sock_no_sendpage, |
1879 | }; | 1842 | }; |
1880 | #endif | ||
1881 | 1843 | ||
1882 | static const struct proto_ops packet_ops = { | 1844 | static const struct proto_ops packet_ops = { |
1883 | .family = PF_PACKET, | 1845 | .family = PF_PACKET, |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index b8bab89616a0..64a375178c5f 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -26,10 +26,11 @@ | |||
26 | #include <net/xfrm.h> | 26 | #include <net/xfrm.h> |
27 | #include <net/ip.h> | 27 | #include <net/ip.h> |
28 | #include <linux/audit.h> | 28 | #include <linux/audit.h> |
29 | #include <linux/cache.h> | ||
29 | 30 | ||
30 | #include "xfrm_hash.h" | 31 | #include "xfrm_hash.h" |
31 | 32 | ||
32 | int sysctl_xfrm_larval_drop; | 33 | int sysctl_xfrm_larval_drop __read_mostly; |
33 | 34 | ||
34 | DEFINE_MUTEX(xfrm_cfg_mutex); | 35 | DEFINE_MUTEX(xfrm_cfg_mutex); |
35 | EXPORT_SYMBOL(xfrm_cfg_mutex); | 36 | EXPORT_SYMBOL(xfrm_cfg_mutex); |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 9955ff4da0a2..372f06eb8bb7 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -21,18 +21,21 @@ | |||
21 | #include <linux/cache.h> | 21 | #include <linux/cache.h> |
22 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
23 | #include <linux/audit.h> | 23 | #include <linux/audit.h> |
24 | #include <linux/cache.h> | ||
24 | 25 | ||
25 | #include "xfrm_hash.h" | 26 | #include "xfrm_hash.h" |
26 | 27 | ||
27 | struct sock *xfrm_nl; | 28 | struct sock *xfrm_nl; |
28 | EXPORT_SYMBOL(xfrm_nl); | 29 | EXPORT_SYMBOL(xfrm_nl); |
29 | 30 | ||
30 | u32 sysctl_xfrm_aevent_etime = XFRM_AE_ETIME; | 31 | u32 sysctl_xfrm_aevent_etime __read_mostly = XFRM_AE_ETIME; |
31 | EXPORT_SYMBOL(sysctl_xfrm_aevent_etime); | 32 | EXPORT_SYMBOL(sysctl_xfrm_aevent_etime); |
32 | 33 | ||
33 | u32 sysctl_xfrm_aevent_rseqth = XFRM_AE_SEQT_SIZE; | 34 | u32 sysctl_xfrm_aevent_rseqth __read_mostly = XFRM_AE_SEQT_SIZE; |
34 | EXPORT_SYMBOL(sysctl_xfrm_aevent_rseqth); | 35 | EXPORT_SYMBOL(sysctl_xfrm_aevent_rseqth); |
35 | 36 | ||
37 | u32 sysctl_xfrm_acq_expires __read_mostly = 30; | ||
38 | |||
36 | /* Each xfrm_state may be linked to two tables: | 39 | /* Each xfrm_state may be linked to two tables: |
37 | 40 | ||
38 | 1. Hash table by (spi,daddr,ah/esp) to find SA by SPI. (input,ctl) | 41 | 1. Hash table by (spi,daddr,ah/esp) to find SA by SPI. (input,ctl) |
@@ -622,8 +625,8 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
622 | h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, family); | 625 | h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, family); |
623 | hlist_add_head(&x->byspi, xfrm_state_byspi+h); | 626 | hlist_add_head(&x->byspi, xfrm_state_byspi+h); |
624 | } | 627 | } |
625 | x->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES; | 628 | x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires; |
626 | x->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ; | 629 | x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ; |
627 | add_timer(&x->timer); | 630 | add_timer(&x->timer); |
628 | xfrm_state_num++; | 631 | xfrm_state_num++; |
629 | xfrm_hash_grow_check(x->bydst.next != NULL); | 632 | xfrm_hash_grow_check(x->bydst.next != NULL); |
@@ -772,9 +775,9 @@ static struct xfrm_state *__find_acq_core(unsigned short family, u8 mode, u32 re | |||
772 | x->props.family = family; | 775 | x->props.family = family; |
773 | x->props.mode = mode; | 776 | x->props.mode = mode; |
774 | x->props.reqid = reqid; | 777 | x->props.reqid = reqid; |
775 | x->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES; | 778 | x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires; |
776 | xfrm_state_hold(x); | 779 | xfrm_state_hold(x); |
777 | x->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ; | 780 | x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ; |
778 | add_timer(&x->timer); | 781 | add_timer(&x->timer); |
779 | hlist_add_head(&x->bydst, xfrm_state_bydst+h); | 782 | hlist_add_head(&x->bydst, xfrm_state_bydst+h); |
780 | h = xfrm_src_hash(daddr, saddr, family); | 783 | h = xfrm_src_hash(daddr, saddr, family); |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index e1ed59549c50..cb59f994c68f 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -1250,7 +1250,7 @@ static int snd_ali_playback_hw_params(struct snd_pcm_substream *substream, | |||
1250 | evoice->substream = substream; | 1250 | evoice->substream = substream; |
1251 | } | 1251 | } |
1252 | } else { | 1252 | } else { |
1253 | if (!evoice) { | 1253 | if (evoice) { |
1254 | snd_ali_free_voice(codec, evoice); | 1254 | snd_ali_free_voice(codec, evoice); |
1255 | pvoice->extra = evoice = NULL; | 1255 | pvoice->extra = evoice = NULL; |
1256 | } | 1256 | } |
@@ -1267,7 +1267,7 @@ static int snd_ali_playback_hw_free(struct snd_pcm_substream *substream) | |||
1267 | struct snd_ali_voice *evoice = pvoice ? pvoice->extra : NULL; | 1267 | struct snd_ali_voice *evoice = pvoice ? pvoice->extra : NULL; |
1268 | 1268 | ||
1269 | snd_pcm_lib_free_pages(substream); | 1269 | snd_pcm_lib_free_pages(substream); |
1270 | if (!evoice) { | 1270 | if (evoice) { |
1271 | snd_ali_free_voice(codec, evoice); | 1271 | snd_ali_free_voice(codec, evoice); |
1272 | pvoice->extra = NULL; | 1272 | pvoice->extra = NULL; |
1273 | } | 1273 | } |
@@ -1356,7 +1356,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream) | |||
1356 | VOL, | 1356 | VOL, |
1357 | CTRL, | 1357 | CTRL, |
1358 | EC); | 1358 | EC); |
1359 | if (!evoice) { | 1359 | if (evoice) { |
1360 | evoice->count = pvoice->count; | 1360 | evoice->count = pvoice->count; |
1361 | evoice->eso = pvoice->count << 1; | 1361 | evoice->eso = pvoice->count << 1; |
1362 | ESO = evoice->eso - 1; | 1362 | ESO = evoice->eso - 1; |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 8e89d56b6400..f87f8f088956 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -713,6 +713,19 @@ static u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction) | |||
713 | return info->amp_caps; | 713 | return info->amp_caps; |
714 | } | 714 | } |
715 | 715 | ||
716 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | ||
717 | unsigned int caps) | ||
718 | { | ||
719 | struct hda_amp_info *info; | ||
720 | |||
721 | info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, dir, 0)); | ||
722 | if (!info) | ||
723 | return -EINVAL; | ||
724 | info->amp_caps = caps; | ||
725 | info->status |= INFO_AMP_CAPS; | ||
726 | return 0; | ||
727 | } | ||
728 | |||
716 | /* | 729 | /* |
717 | * read the current volume to info | 730 | * read the current volume to info |
718 | * if the cache exists, read the cache value. | 731 | * if the cache exists, read the cache value. |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index be12b8814c39..f91ea5ec9f6d 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -277,5 +277,7 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid) | |||
277 | return codec->wcaps[nid - codec->start_nid]; | 277 | return codec->wcaps[nid - codec->start_nid]; |
278 | } | 278 | } |
279 | 279 | ||
280 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | ||
281 | unsigned int caps); | ||
280 | 282 | ||
281 | #endif /* __SOUND_HDA_LOCAL_H */ | 283 | #endif /* __SOUND_HDA_LOCAL_H */ |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index a5a4b2bddf20..bef214bcdddf 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -705,6 +705,17 @@ static struct snd_kcontrol_new cxt5045_test_mixer[] = { | |||
705 | .get = conexant_mux_enum_get, | 705 | .get = conexant_mux_enum_get, |
706 | .put = conexant_mux_enum_put, | 706 | .put = conexant_mux_enum_put, |
707 | }, | 707 | }, |
708 | /* Audio input controls */ | ||
709 | HDA_CODEC_VOLUME("Input-1 Volume", 0x1a, 0x0, HDA_INPUT), | ||
710 | HDA_CODEC_MUTE("Input-1 Switch", 0x1a, 0x0, HDA_INPUT), | ||
711 | HDA_CODEC_VOLUME("Input-2 Volume", 0x1a, 0x1, HDA_INPUT), | ||
712 | HDA_CODEC_MUTE("Input-2 Switch", 0x1a, 0x1, HDA_INPUT), | ||
713 | HDA_CODEC_VOLUME("Input-3 Volume", 0x1a, 0x2, HDA_INPUT), | ||
714 | HDA_CODEC_MUTE("Input-3 Switch", 0x1a, 0x2, HDA_INPUT), | ||
715 | HDA_CODEC_VOLUME("Input-4 Volume", 0x1a, 0x3, HDA_INPUT), | ||
716 | HDA_CODEC_MUTE("Input-4 Switch", 0x1a, 0x3, HDA_INPUT), | ||
717 | HDA_CODEC_VOLUME("Input-5 Volume", 0x1a, 0x4, HDA_INPUT), | ||
718 | HDA_CODEC_MUTE("Input-5 Switch", 0x1a, 0x4, HDA_INPUT), | ||
708 | { } /* end */ | 719 | { } /* end */ |
709 | }; | 720 | }; |
710 | 721 | ||
@@ -947,6 +958,23 @@ static void cxt5047_hp_automute(struct hda_codec *codec) | |||
947 | snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); | 958 | snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); |
948 | } | 959 | } |
949 | 960 | ||
961 | /* mute internal speaker if HP is plugged */ | ||
962 | static void cxt5047_hp2_automute(struct hda_codec *codec) | ||
963 | { | ||
964 | struct conexant_spec *spec = codec->spec; | ||
965 | unsigned int bits; | ||
966 | |||
967 | spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, | ||
968 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
969 | |||
970 | bits = spec->hp_present ? 0x80 : 0; | ||
971 | snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits); | ||
972 | snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits); | ||
973 | /* Mute/Unmute PCM 2 for good measure - some systems need this */ | ||
974 | snd_hda_codec_amp_update(codec, 0x1c, 0, HDA_OUTPUT, 0, 0x80, bits); | ||
975 | snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); | ||
976 | } | ||
977 | |||
950 | /* toggle input of built-in and mic jack appropriately */ | 978 | /* toggle input of built-in and mic jack appropriately */ |
951 | static void cxt5047_hp_automic(struct hda_codec *codec) | 979 | static void cxt5047_hp_automic(struct hda_codec *codec) |
952 | { | 980 | { |
@@ -985,6 +1013,21 @@ static void cxt5047_hp_unsol_event(struct hda_codec *codec, | |||
985 | } | 1013 | } |
986 | } | 1014 | } |
987 | 1015 | ||
1016 | /* unsolicited event for HP jack sensing - non-EAPD systems */ | ||
1017 | static void cxt5047_hp2_unsol_event(struct hda_codec *codec, | ||
1018 | unsigned int res) | ||
1019 | { | ||
1020 | res >>= 26; | ||
1021 | switch (res) { | ||
1022 | case CONEXANT_HP_EVENT: | ||
1023 | cxt5047_hp2_automute(codec); | ||
1024 | break; | ||
1025 | case CONEXANT_MIC_EVENT: | ||
1026 | cxt5047_hp_automic(codec); | ||
1027 | break; | ||
1028 | } | ||
1029 | } | ||
1030 | |||
988 | static struct snd_kcontrol_new cxt5047_mixers[] = { | 1031 | static struct snd_kcontrol_new cxt5047_mixers[] = { |
989 | HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), | 1032 | HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), |
990 | HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), | 1033 | HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), |
@@ -1300,19 +1343,20 @@ static int patch_cxt5047(struct hda_codec *codec) | |||
1300 | spec->channel_mode = cxt5047_modes, | 1343 | spec->channel_mode = cxt5047_modes, |
1301 | 1344 | ||
1302 | codec->patch_ops = conexant_patch_ops; | 1345 | codec->patch_ops = conexant_patch_ops; |
1303 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | ||
1304 | 1346 | ||
1305 | board_config = snd_hda_check_board_config(codec, CXT5047_MODELS, | 1347 | board_config = snd_hda_check_board_config(codec, CXT5047_MODELS, |
1306 | cxt5047_models, | 1348 | cxt5047_models, |
1307 | cxt5047_cfg_tbl); | 1349 | cxt5047_cfg_tbl); |
1308 | switch (board_config) { | 1350 | switch (board_config) { |
1309 | case CXT5047_LAPTOP: | 1351 | case CXT5047_LAPTOP: |
1352 | codec->patch_ops.unsol_event = cxt5047_hp2_unsol_event; | ||
1310 | break; | 1353 | break; |
1311 | case CXT5047_LAPTOP_HP: | 1354 | case CXT5047_LAPTOP_HP: |
1312 | spec->input_mux = &cxt5047_hp_capture_source; | 1355 | spec->input_mux = &cxt5047_hp_capture_source; |
1313 | spec->num_init_verbs = 2; | 1356 | spec->num_init_verbs = 2; |
1314 | spec->init_verbs[1] = cxt5047_hp_init_verbs; | 1357 | spec->init_verbs[1] = cxt5047_hp_init_verbs; |
1315 | spec->mixers[0] = cxt5047_hp_mixers; | 1358 | spec->mixers[0] = cxt5047_hp_mixers; |
1359 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | ||
1316 | codec->patch_ops.init = cxt5047_hp_init; | 1360 | codec->patch_ops.init = cxt5047_hp_init; |
1317 | break; | 1361 | break; |
1318 | case CXT5047_LAPTOP_EAPD: | 1362 | case CXT5047_LAPTOP_EAPD: |
@@ -1320,12 +1364,14 @@ static int patch_cxt5047(struct hda_codec *codec) | |||
1320 | spec->num_init_verbs = 2; | 1364 | spec->num_init_verbs = 2; |
1321 | spec->init_verbs[1] = cxt5047_toshiba_init_verbs; | 1365 | spec->init_verbs[1] = cxt5047_toshiba_init_verbs; |
1322 | spec->mixers[0] = cxt5047_toshiba_mixers; | 1366 | spec->mixers[0] = cxt5047_toshiba_mixers; |
1367 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | ||
1323 | break; | 1368 | break; |
1324 | #ifdef CONFIG_SND_DEBUG | 1369 | #ifdef CONFIG_SND_DEBUG |
1325 | case CXT5047_TEST: | 1370 | case CXT5047_TEST: |
1326 | spec->input_mux = &cxt5047_test_capture_source; | 1371 | spec->input_mux = &cxt5047_test_capture_source; |
1327 | spec->mixers[0] = cxt5047_test_mixer; | 1372 | spec->mixers[0] = cxt5047_test_mixer; |
1328 | spec->init_verbs[0] = cxt5047_test_init_verbs; | 1373 | spec->init_verbs[0] = cxt5047_test_init_verbs; |
1374 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | ||
1329 | #endif | 1375 | #endif |
1330 | } | 1376 | } |
1331 | return 0; | 1377 | return 0; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 34ac63469532..4776de93928b 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -6379,8 +6379,10 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
6379 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), | 6379 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
6380 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), | 6380 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
6381 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | 6381 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
6382 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | ||
6382 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), | 6383 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
6383 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | 6384 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
6385 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | ||
6384 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), | 6386 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
6385 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), | 6387 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
6386 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), | 6388 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
@@ -6391,6 +6393,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
6391 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | 6393 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
6392 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | 6394 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
6393 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), | 6395 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), |
6396 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | ||
6394 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | 6397 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
6395 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | 6398 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
6396 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), | 6399 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
@@ -8765,7 +8768,6 @@ static struct snd_pci_quirk alc861_cfg_tbl[] = { | |||
8765 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | 8768 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
8766 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), | 8769 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
8767 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | 8770 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
8768 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660_3ST), | ||
8769 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), | 8771 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
8770 | SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), | 8772 | SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), |
8771 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), | 8773 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
@@ -9473,6 +9475,7 @@ static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { | |||
9473 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | 9475 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
9474 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), | 9476 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
9475 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), | 9477 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
9478 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST), | ||
9476 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), | 9479 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
9477 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), | 9480 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
9478 | 9481 | ||
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c index 6fcda9bcf0cf..43f537ef40bf 100644 --- a/sound/pci/hda/patch_si3054.c +++ b/sound/pci/hda/patch_si3054.c | |||
@@ -304,6 +304,8 @@ struct hda_codec_preset snd_hda_preset_si3054[] = { | |||
304 | { .id = 0x10573055, .name = "Si3054", .patch = patch_si3054 }, | 304 | { .id = 0x10573055, .name = "Si3054", .patch = patch_si3054 }, |
305 | { .id = 0x10573057, .name = "Si3054", .patch = patch_si3054 }, | 305 | { .id = 0x10573057, .name = "Si3054", .patch = patch_si3054 }, |
306 | { .id = 0x10573155, .name = "Si3054", .patch = patch_si3054 }, | 306 | { .id = 0x10573155, .name = "Si3054", .patch = patch_si3054 }, |
307 | /* Asus A8J Modem (SM56) */ | ||
308 | { .id = 0x15433155, .name = "Si3054", .patch = patch_si3054 }, | ||
307 | {} | 309 | {} |
308 | }; | 310 | }; |
309 | 311 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a6a0a80edc3b..e3964fc4c405 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -51,6 +51,7 @@ enum { | |||
51 | STAC_925x_REF, | 51 | STAC_925x_REF, |
52 | STAC_M2_2, | 52 | STAC_M2_2, |
53 | STAC_MA6, | 53 | STAC_MA6, |
54 | STAC_PA6, | ||
54 | STAC_925x_MODELS | 55 | STAC_925x_MODELS |
55 | }; | 56 | }; |
56 | 57 | ||
@@ -152,6 +153,10 @@ static hda_nid_t stac925x_dac_nids[1] = { | |||
152 | 0x02, | 153 | 0x02, |
153 | }; | 154 | }; |
154 | 155 | ||
156 | static hda_nid_t stac925x_dmic_nids[1] = { | ||
157 | 0x15, | ||
158 | }; | ||
159 | |||
155 | static hda_nid_t stac922x_adc_nids[2] = { | 160 | static hda_nid_t stac922x_adc_nids[2] = { |
156 | 0x06, 0x07, | 161 | 0x06, 0x07, |
157 | }; | 162 | }; |
@@ -469,6 +474,14 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = { | |||
469 | "Dell Precision M90", STAC_REF), | 474 | "Dell Precision M90", STAC_REF), |
470 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, | 475 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, |
471 | "unknown Dell", STAC_REF), | 476 | "unknown Dell", STAC_REF), |
477 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8, | ||
478 | "Dell Inspiron 640m", STAC_REF), | ||
479 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5, | ||
480 | "Dell Inspiron 1501", STAC_REF), | ||
481 | |||
482 | /* Panasonic */ | ||
483 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_REF), | ||
484 | |||
472 | {} /* terminator */ | 485 | {} /* terminator */ |
473 | }; | 486 | }; |
474 | 487 | ||
@@ -482,29 +495,38 @@ static unsigned int stac925x_MA6_pin_configs[8] = { | |||
482 | 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, | 495 | 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, |
483 | }; | 496 | }; |
484 | 497 | ||
498 | static unsigned int stac925x_PA6_pin_configs[8] = { | ||
499 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, | ||
500 | 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, | ||
501 | }; | ||
502 | |||
485 | static unsigned int stac925xM2_2_pin_configs[8] = { | 503 | static unsigned int stac925xM2_2_pin_configs[8] = { |
486 | 0x40c003f3, 0x424503f2, 0x041800f4, 0x02a19020, | 504 | 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, |
487 | 0x50a103F0, 0x90100210, 0x400003f1, 0x9033032e, | 505 | 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, |
488 | }; | 506 | }; |
489 | 507 | ||
490 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { | 508 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
491 | [STAC_REF] = ref925x_pin_configs, | 509 | [STAC_REF] = ref925x_pin_configs, |
492 | [STAC_M2_2] = stac925xM2_2_pin_configs, | 510 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
493 | [STAC_MA6] = stac925x_MA6_pin_configs, | 511 | [STAC_MA6] = stac925x_MA6_pin_configs, |
512 | [STAC_PA6] = stac925x_PA6_pin_configs, | ||
494 | }; | 513 | }; |
495 | 514 | ||
496 | static const char *stac925x_models[STAC_925x_MODELS] = { | 515 | static const char *stac925x_models[STAC_925x_MODELS] = { |
497 | [STAC_REF] = "ref", | 516 | [STAC_REF] = "ref", |
498 | [STAC_M2_2] = "m2-2", | 517 | [STAC_M2_2] = "m2-2", |
499 | [STAC_MA6] = "m6", | 518 | [STAC_MA6] = "m6", |
519 | [STAC_PA6] = "pa6", | ||
500 | }; | 520 | }; |
501 | 521 | ||
502 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { | 522 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { |
503 | /* SigmaTel reference board */ | 523 | /* SigmaTel reference board */ |
504 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), | 524 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
525 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), | ||
505 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), | 526 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), |
506 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), | 527 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), |
507 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), | 528 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), |
529 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), | ||
508 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), | 530 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), |
509 | {} /* terminator */ | 531 | {} /* terminator */ |
510 | }; | 532 | }; |
@@ -1742,6 +1764,21 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, | |||
1742 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, | 1764 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
1743 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); | 1765 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
1744 | 1766 | ||
1767 | if (pin_ctl & AC_PINCTL_IN_EN) { | ||
1768 | /* | ||
1769 | * we need to check the current set-up direction of | ||
1770 | * shared input pins since they can be switched via | ||
1771 | * "xxx as Output" mixer switch | ||
1772 | */ | ||
1773 | struct sigmatel_spec *spec = codec->spec; | ||
1774 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
1775 | if ((nid == cfg->input_pins[AUTO_PIN_LINE] && | ||
1776 | spec->line_switch) || | ||
1777 | (nid == cfg->input_pins[AUTO_PIN_MIC] && | ||
1778 | spec->mic_switch)) | ||
1779 | return; | ||
1780 | } | ||
1781 | |||
1745 | /* if setting pin direction bits, clear the current | 1782 | /* if setting pin direction bits, clear the current |
1746 | direction bits first */ | 1783 | direction bits first */ |
1747 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) | 1784 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
@@ -1911,7 +1948,8 @@ static int patch_stac925x(struct hda_codec *codec) | |||
1911 | stac925x_cfg_tbl); | 1948 | stac925x_cfg_tbl); |
1912 | again: | 1949 | again: |
1913 | if (spec->board_config < 0) { | 1950 | if (spec->board_config < 0) { |
1914 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x, using BIOS defaults\n"); | 1951 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," |
1952 | "using BIOS defaults\n"); | ||
1915 | err = stac92xx_save_bios_config_regs(codec); | 1953 | err = stac92xx_save_bios_config_regs(codec); |
1916 | if (err < 0) { | 1954 | if (err < 0) { |
1917 | stac92xx_free(codec); | 1955 | stac92xx_free(codec); |
@@ -1929,7 +1967,18 @@ static int patch_stac925x(struct hda_codec *codec) | |||
1929 | spec->adc_nids = stac925x_adc_nids; | 1967 | spec->adc_nids = stac925x_adc_nids; |
1930 | spec->mux_nids = stac925x_mux_nids; | 1968 | spec->mux_nids = stac925x_mux_nids; |
1931 | spec->num_muxes = 1; | 1969 | spec->num_muxes = 1; |
1932 | spec->num_dmics = 0; | 1970 | switch (codec->vendor_id) { |
1971 | case 0x83847632: /* STAC9202 */ | ||
1972 | case 0x83847633: /* STAC9202D */ | ||
1973 | case 0x83847636: /* STAC9251 */ | ||
1974 | case 0x83847637: /* STAC9251D */ | ||
1975 | spec->num_dmics = 1; | ||
1976 | spec->dmic_nids = stac925x_dmic_nids; | ||
1977 | break; | ||
1978 | default: | ||
1979 | spec->num_dmics = 0; | ||
1980 | break; | ||
1981 | } | ||
1933 | 1982 | ||
1934 | spec->init = stac925x_core_init; | 1983 | spec->init = stac925x_core_init; |
1935 | spec->mixer = stac925x_mixer; | 1984 | spec->mixer = stac925x_mixer; |
@@ -2110,6 +2159,13 @@ static int patch_stac927x(struct hda_codec *codec) | |||
2110 | 2159 | ||
2111 | codec->patch_ops = stac92xx_patch_ops; | 2160 | codec->patch_ops = stac92xx_patch_ops; |
2112 | 2161 | ||
2162 | /* Fix Mux capture level; max to 2 */ | ||
2163 | snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT, | ||
2164 | (0 << AC_AMPCAP_OFFSET_SHIFT) | | ||
2165 | (2 << AC_AMPCAP_NUM_STEPS_SHIFT) | | ||
2166 | (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | | ||
2167 | (0 << AC_AMPCAP_MUTE_SHIFT)); | ||
2168 | |||
2113 | return 0; | 2169 | return 0; |
2114 | } | 2170 | } |
2115 | 2171 | ||
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c index 21dc6974d6a3..bfbdc3cbd43b 100644 --- a/sound/soc/s3c24xx/s3c24xx-pcm.c +++ b/sound/soc/s3c24xx/s3c24xx-pcm.c | |||
@@ -337,6 +337,8 @@ static int s3c24xx_pcm_open(struct snd_pcm_substream *substream) | |||
337 | if (prtd == NULL) | 337 | if (prtd == NULL) |
338 | return -ENOMEM; | 338 | return -ENOMEM; |
339 | 339 | ||
340 | spin_lock_init(&prtd->lock); | ||
341 | |||
340 | runtime->private_data = prtd; | 342 | runtime->private_data = prtd; |
341 | return 0; | 343 | return 0; |
342 | } | 344 | } |