diff options
468 files changed, 8037 insertions, 5923 deletions
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl index 97618bed4d6..028a8444d95 100644 --- a/Documentation/DocBook/kgdb.tmpl +++ b/Documentation/DocBook/kgdb.tmpl | |||
@@ -72,7 +72,7 @@ | |||
72 | kgdb is a source level debugger for linux kernel. It is used along | 72 | kgdb is a source level debugger for linux kernel. It is used along |
73 | with gdb to debug a linux kernel. The expectation is that gdb can | 73 | with gdb to debug a linux kernel. The expectation is that gdb can |
74 | be used to "break in" to the kernel to inspect memory, variables | 74 | be used to "break in" to the kernel to inspect memory, variables |
75 | and look through a cal stack information similar to what an | 75 | and look through call stack information similar to what an |
76 | application developer would use gdb for. It is possible to place | 76 | application developer would use gdb for. It is possible to place |
77 | breakpoints in kernel code and perform some limited execution | 77 | breakpoints in kernel code and perform some limited execution |
78 | stepping. | 78 | stepping. |
@@ -93,8 +93,10 @@ | |||
93 | <chapter id="CompilingAKernel"> | 93 | <chapter id="CompilingAKernel"> |
94 | <title>Compiling a kernel</title> | 94 | <title>Compiling a kernel</title> |
95 | <para> | 95 | <para> |
96 | To enable <symbol>CONFIG_KGDB</symbol>, look under the "Kernel debugging" | 96 | To enable <symbol>CONFIG_KGDB</symbol> you should first turn on |
97 | and then select "KGDB: kernel debugging with remote gdb". | 97 | "Prompt for development and/or incomplete code/drivers" |
98 | (CONFIG_EXPERIMENTAL) in "General setup", then under the | ||
99 | "Kernel debugging" select "KGDB: kernel debugging with remote gdb". | ||
98 | </para> | 100 | </para> |
99 | <para> | 101 | <para> |
100 | Next you should choose one of more I/O drivers to interconnect debugging | 102 | Next you should choose one of more I/O drivers to interconnect debugging |
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index c2992bc54f2..8b22d7d8b99 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -92,7 +92,6 @@ prototypes: | |||
92 | void (*destroy_inode)(struct inode *); | 92 | void (*destroy_inode)(struct inode *); |
93 | void (*dirty_inode) (struct inode *); | 93 | void (*dirty_inode) (struct inode *); |
94 | int (*write_inode) (struct inode *, int); | 94 | int (*write_inode) (struct inode *, int); |
95 | void (*put_inode) (struct inode *); | ||
96 | void (*drop_inode) (struct inode *); | 95 | void (*drop_inode) (struct inode *); |
97 | void (*delete_inode) (struct inode *); | 96 | void (*delete_inode) (struct inode *); |
98 | void (*put_super) (struct super_block *); | 97 | void (*put_super) (struct super_block *); |
@@ -115,7 +114,6 @@ alloc_inode: no no no | |||
115 | destroy_inode: no | 114 | destroy_inode: no |
116 | dirty_inode: no (must not sleep) | 115 | dirty_inode: no (must not sleep) |
117 | write_inode: no | 116 | write_inode: no |
118 | put_inode: no | ||
119 | drop_inode: no !!!inode_lock!!! | 117 | drop_inode: no !!!inode_lock!!! |
120 | delete_inode: no | 118 | delete_inode: no |
121 | put_super: yes yes no | 119 | put_super: yes yes no |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 81e5be6e6e3..b7522c6cbae 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -205,7 +205,6 @@ struct super_operations { | |||
205 | 205 | ||
206 | void (*dirty_inode) (struct inode *); | 206 | void (*dirty_inode) (struct inode *); |
207 | int (*write_inode) (struct inode *, int); | 207 | int (*write_inode) (struct inode *, int); |
208 | void (*put_inode) (struct inode *); | ||
209 | void (*drop_inode) (struct inode *); | 208 | void (*drop_inode) (struct inode *); |
210 | void (*delete_inode) (struct inode *); | 209 | void (*delete_inode) (struct inode *); |
211 | void (*put_super) (struct super_block *); | 210 | void (*put_super) (struct super_block *); |
@@ -246,9 +245,6 @@ or bottom half). | |||
246 | inode to disc. The second parameter indicates whether the write | 245 | inode to disc. The second parameter indicates whether the write |
247 | should be synchronous or not, not all filesystems check this flag. | 246 | should be synchronous or not, not all filesystems check this flag. |
248 | 247 | ||
249 | put_inode: called when the VFS inode is removed from the inode | ||
250 | cache. | ||
251 | |||
252 | drop_inode: called when the last access to the inode is dropped, | 248 | drop_inode: called when the last access to the inode is dropped, |
253 | with the inode_lock spinlock held. | 249 | with the inode_lock spinlock held. |
254 | 250 | ||
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index 00b950d1c19..c412c245848 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt | |||
@@ -377,27 +377,3 @@ config FOO | |||
377 | 377 | ||
378 | limits FOO to module (=m) or disabled (=n). | 378 | limits FOO to module (=m) or disabled (=n). |
379 | 379 | ||
380 | |||
381 | Build limited by a third config symbol which may be =y or =m | ||
382 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
383 | A common idiom that we see (and sometimes have problems with) is this: | ||
384 | |||
385 | When option C in B (module or subsystem) uses interfaces from A (module | ||
386 | or subsystem), and both A and B are tristate (could be =y or =m if they | ||
387 | were independent of each other, but they aren't), then we need to limit | ||
388 | C such that it cannot be built statically if A is built as a loadable | ||
389 | module. (C already depends on B, so there is no dependency issue to | ||
390 | take care of here.) | ||
391 | |||
392 | If A is linked statically into the kernel image, C can be built | ||
393 | statically or as loadable module(s). However, if A is built as loadable | ||
394 | module(s), then C must be restricted to loadable module(s) also. This | ||
395 | can be expressed in kconfig language as: | ||
396 | |||
397 | config C | ||
398 | depends on A = y || A = B | ||
399 | |||
400 | or for real examples, use this command in a kernel tree: | ||
401 | |||
402 | $ find . -name Kconfig\* | xargs grep -ns "depends on.*=.*||.*=" | grep -v orig | ||
403 | |||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index a3c35446e75..cdd5b934f43 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1094,9 +1094,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1094 | mac5380= [HW,SCSI] Format: | 1094 | mac5380= [HW,SCSI] Format: |
1095 | <can_queue>,<cmd_per_lun>,<sg_tablesize>,<hostid>,<use_tags> | 1095 | <can_queue>,<cmd_per_lun>,<sg_tablesize>,<hostid>,<use_tags> |
1096 | 1096 | ||
1097 | mac53c9x= [HW,SCSI] Format: | ||
1098 | <num_esps>,<disconnect>,<nosync>,<can_queue>,<cmd_per_lun>,<sg_tablesize>,<hostid>,<use_tags> | ||
1099 | |||
1100 | machvec= [IA64] Force the use of a particular machine-vector | 1097 | machvec= [IA64] Force the use of a particular machine-vector |
1101 | (machvec) in a generic kernel. | 1098 | (machvec) in a generic kernel. |
1102 | Example: machvec=hpzx1_swiotlb | 1099 | Example: machvec=hpzx1_swiotlb |
@@ -1525,6 +1522,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1525 | This is normally done in pci_enable_device(), | 1522 | This is normally done in pci_enable_device(), |
1526 | so this option is a temporary workaround | 1523 | so this option is a temporary workaround |
1527 | for broken drivers that don't call it. | 1524 | for broken drivers that don't call it. |
1525 | skip_isa_align [X86] do not align io start addr, so can | ||
1526 | handle more pci cards | ||
1528 | firmware [ARM] Do not re-enumerate the bus but instead | 1527 | firmware [ARM] Do not re-enumerate the bus but instead |
1529 | just use the configuration from the | 1528 | just use the configuration from the |
1530 | bootloader. This is currently used on | 1529 | bootloader. This is currently used on |
diff --git a/Documentation/s390/CommonIO b/Documentation/s390/CommonIO index 8fbc0a85287..bf0baa19ec2 100644 --- a/Documentation/s390/CommonIO +++ b/Documentation/s390/CommonIO | |||
@@ -8,17 +8,6 @@ Command line parameters | |||
8 | 8 | ||
9 | Enable logging of debug information in case of ccw device timeouts. | 9 | Enable logging of debug information in case of ccw device timeouts. |
10 | 10 | ||
11 | |||
12 | * cio_msg = yes | no | ||
13 | |||
14 | Determines whether information on found devices and sensed device | ||
15 | characteristics should be shown during startup or when new devices are | ||
16 | found, i. e. messages of the types "Detected device 0.0.4711 on subchannel | ||
17 | 0.0.0042" and "SenseID: Device 0.0.4711 reports: ...". | ||
18 | |||
19 | Default is off. | ||
20 | |||
21 | |||
22 | * cio_ignore = {all} | | 11 | * cio_ignore = {all} | |
23 | {<device> | <range of devices>} | | 12 | {<device> | <range of devices>} | |
24 | {!<device> | !<range of devices>} | 13 | {!<device> | !<range of devices>} |
diff --git a/Documentation/scheduler/sched-design.txt b/Documentation/scheduler/sched-design.txt deleted file mode 100644 index 1605bf0cba8..00000000000 --- a/Documentation/scheduler/sched-design.txt +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | Goals, Design and Implementation of the | ||
2 | new ultra-scalable O(1) scheduler | ||
3 | |||
4 | |||
5 | This is an edited version of an email Ingo Molnar sent to | ||
6 | lkml on 4 Jan 2002. It describes the goals, design, and | ||
7 | implementation of Ingo's new ultra-scalable O(1) scheduler. | ||
8 | Last Updated: 18 April 2002. | ||
9 | |||
10 | |||
11 | Goal | ||
12 | ==== | ||
13 | |||
14 | The main goal of the new scheduler is to keep all the good things we know | ||
15 | and love about the current Linux scheduler: | ||
16 | |||
17 | - good interactive performance even during high load: if the user | ||
18 | types or clicks then the system must react instantly and must execute | ||
19 | the user tasks smoothly, even during considerable background load. | ||
20 | |||
21 | - good scheduling/wakeup performance with 1-2 runnable processes. | ||
22 | |||
23 | - fairness: no process should stay without any timeslice for any | ||
24 | unreasonable amount of time. No process should get an unjustly high | ||
25 | amount of CPU time. | ||
26 | |||
27 | - priorities: less important tasks can be started with lower priority, | ||
28 | more important tasks with higher priority. | ||
29 | |||
30 | - SMP efficiency: no CPU should stay idle if there is work to do. | ||
31 | |||
32 | - SMP affinity: processes which run on one CPU should stay affine to | ||
33 | that CPU. Processes should not bounce between CPUs too frequently. | ||
34 | |||
35 | - plus additional scheduler features: RT scheduling, CPU binding. | ||
36 | |||
37 | and the goal is also to add a few new things: | ||
38 | |||
39 | - fully O(1) scheduling. Are you tired of the recalculation loop | ||
40 | blowing the L1 cache away every now and then? Do you think the goodness | ||
41 | loop is taking a bit too long to finish if there are lots of runnable | ||
42 | processes? This new scheduler takes no prisoners: wakeup(), schedule(), | ||
43 | the timer interrupt are all O(1) algorithms. There is no recalculation | ||
44 | loop. There is no goodness loop either. | ||
45 | |||
46 | - 'perfect' SMP scalability. With the new scheduler there is no 'big' | ||
47 | runqueue_lock anymore - it's all per-CPU runqueues and locks - two | ||
48 | tasks on two separate CPUs can wake up, schedule and context-switch | ||
49 | completely in parallel, without any interlocking. All | ||
50 | scheduling-relevant data is structured for maximum scalability. | ||
51 | |||
52 | - better SMP affinity. The old scheduler has a particular weakness that | ||
53 | causes the random bouncing of tasks between CPUs if/when higher | ||
54 | priority/interactive tasks, this was observed and reported by many | ||
55 | people. The reason is that the timeslice recalculation loop first needs | ||
56 | every currently running task to consume its timeslice. But when this | ||
57 | happens on eg. an 8-way system, then this property starves an | ||
58 | increasing number of CPUs from executing any process. Once the last | ||
59 | task that has a timeslice left has finished using up that timeslice, | ||
60 | the recalculation loop is triggered and other CPUs can start executing | ||
61 | tasks again - after having idled around for a number of timer ticks. | ||
62 | The more CPUs, the worse this effect. | ||
63 | |||
64 | Furthermore, this same effect causes the bouncing effect as well: | ||
65 | whenever there is such a 'timeslice squeeze' of the global runqueue, | ||
66 | idle processors start executing tasks which are not affine to that CPU. | ||
67 | (because the affine tasks have finished off their timeslices already.) | ||
68 | |||
69 | The new scheduler solves this problem by distributing timeslices on a | ||
70 | per-CPU basis, without having any global synchronization or | ||
71 | recalculation. | ||
72 | |||
73 | - batch scheduling. A significant proportion of computing-intensive tasks | ||
74 | benefit from batch-scheduling, where timeslices are long and processes | ||
75 | are roundrobin scheduled. The new scheduler does such batch-scheduling | ||
76 | of the lowest priority tasks - so nice +19 jobs will get | ||
77 | 'batch-scheduled' automatically. With this scheduler, nice +19 jobs are | ||
78 | in essence SCHED_IDLE, from an interactiveness point of view. | ||
79 | |||
80 | - handle extreme loads more smoothly, without breakdown and scheduling | ||
81 | storms. | ||
82 | |||
83 | - O(1) RT scheduling. For those RT folks who are paranoid about the | ||
84 | O(nr_running) property of the goodness loop and the recalculation loop. | ||
85 | |||
86 | - run fork()ed children before the parent. Andrea has pointed out the | ||
87 | advantages of this a few months ago, but patches for this feature | ||
88 | do not work with the old scheduler as well as they should, | ||
89 | because idle processes often steal the new child before the fork()ing | ||
90 | CPU gets to execute it. | ||
91 | |||
92 | |||
93 | Design | ||
94 | ====== | ||
95 | |||
96 | The core of the new scheduler contains the following mechanisms: | ||
97 | |||
98 | - *two* priority-ordered 'priority arrays' per CPU. There is an 'active' | ||
99 | array and an 'expired' array. The active array contains all tasks that | ||
100 | are affine to this CPU and have timeslices left. The expired array | ||
101 | contains all tasks which have used up their timeslices - but this array | ||
102 | is kept sorted as well. The active and expired array is not accessed | ||
103 | directly, it's accessed through two pointers in the per-CPU runqueue | ||
104 | structure. If all active tasks are used up then we 'switch' the two | ||
105 | pointers and from now on the ready-to-go (former-) expired array is the | ||
106 | active array - and the empty active array serves as the new collector | ||
107 | for expired tasks. | ||
108 | |||
109 | - there is a 64-bit bitmap cache for array indices. Finding the highest | ||
110 | priority task is thus a matter of two x86 BSFL bit-search instructions. | ||
111 | |||
112 | the split-array solution enables us to have an arbitrary number of active | ||
113 | and expired tasks, and the recalculation of timeslices can be done | ||
114 | immediately when the timeslice expires. Because the arrays are always | ||
115 | access through the pointers in the runqueue, switching the two arrays can | ||
116 | be done very quickly. | ||
117 | |||
118 | this is a hybride priority-list approach coupled with roundrobin | ||
119 | scheduling and the array-switch method of distributing timeslices. | ||
120 | |||
121 | - there is a per-task 'load estimator'. | ||
122 | |||
123 | one of the toughest things to get right is good interactive feel during | ||
124 | heavy system load. While playing with various scheduler variants i found | ||
125 | that the best interactive feel is achieved not by 'boosting' interactive | ||
126 | tasks, but by 'punishing' tasks that want to use more CPU time than there | ||
127 | is available. This method is also much easier to do in an O(1) fashion. | ||
128 | |||
129 | to establish the actual 'load' the task contributes to the system, a | ||
130 | complex-looking but pretty accurate method is used: there is a 4-entry | ||
131 | 'history' ringbuffer of the task's activities during the last 4 seconds. | ||
132 | This ringbuffer is operated without much overhead. The entries tell the | ||
133 | scheduler a pretty accurate load-history of the task: has it used up more | ||
134 | CPU time or less during the past N seconds. [the size '4' and the interval | ||
135 | of 4x 1 seconds was found by lots of experimentation - this part is | ||
136 | flexible and can be changed in both directions.] | ||
137 | |||
138 | the penalty a task gets for generating more load than the CPU can handle | ||
139 | is a priority decrease - there is a maximum amount to this penalty | ||
140 | relative to their static priority, so even fully CPU-bound tasks will | ||
141 | observe each other's priorities, and will share the CPU accordingly. | ||
142 | |||
143 | the SMP load-balancer can be extended/switched with additional parallel | ||
144 | computing and cache hierarchy concepts: NUMA scheduling, multi-core CPUs | ||
145 | can be supported easily by changing the load-balancer. Right now it's | ||
146 | tuned for my SMP systems. | ||
147 | |||
148 | i skipped the prev->mm == next->mm advantage - no workload i know of shows | ||
149 | any sensitivity to this. It can be added back by sacrificing O(1) | ||
150 | schedule() [the current and one-lower priority list can be searched for a | ||
151 | that->mm == current->mm condition], but costs a fair number of cycles | ||
152 | during a number of important workloads, so i wanted to avoid this as much | ||
153 | as possible. | ||
154 | |||
155 | - the SMP idle-task startup code was still racy and the new scheduler | ||
156 | triggered this. So i streamlined the idle-setup code a bit. We do not call | ||
157 | into schedule() before all processors have started up fully and all idle | ||
158 | threads are in place. | ||
159 | |||
160 | - the patch also cleans up a number of aspects of sched.c - moves code | ||
161 | into other areas of the kernel where it's appropriate, and simplifies | ||
162 | certain code paths and data constructs. As a result, the new scheduler's | ||
163 | code is smaller than the old one. | ||
164 | |||
165 | Ingo | ||
diff --git a/MAINTAINERS b/MAINTAINERS index abe27871ad6..f5583dc7ea3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2112,12 +2112,10 @@ L: netdev@vger.kernel.org | |||
2112 | S: Maintained | 2112 | S: Maintained |
2113 | 2113 | ||
2114 | INTEL ETHERNET DRIVERS (e100/e1000/e1000e/igb/ixgb/ixgbe) | 2114 | INTEL ETHERNET DRIVERS (e100/e1000/e1000e/igb/ixgb/ixgbe) |
2115 | P: Auke Kok | ||
2116 | M: auke-jan.h.kok@intel.com | ||
2117 | P: Jesse Brandeburg | ||
2118 | M: jesse.brandeburg@intel.com | ||
2119 | P: Jeff Kirsher | 2115 | P: Jeff Kirsher |
2120 | M: jeffrey.t.kirsher@intel.com | 2116 | M: jeffrey.t.kirsher@intel.com |
2117 | P: Jesse Brandeburg | ||
2118 | M: jesse.brandeburg@intel.com | ||
2121 | P: Bruce Allan | 2119 | P: Bruce Allan |
2122 | M: bruce.w.allan@intel.com | 2120 | M: bruce.w.allan@intel.com |
2123 | P: John Ronciak | 2121 | P: John Ronciak |
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c index 8bc18724054..1d7bca6aa44 100644 --- a/arch/arm/mach-ep93xx/core.c +++ b/arch/arm/mach-ep93xx/core.c | |||
@@ -280,7 +280,7 @@ static int ep93xx_gpio_irq_type(unsigned int irq, unsigned int type) | |||
280 | const int port = gpio >> 3; | 280 | const int port = gpio >> 3; |
281 | const int port_mask = 1 << (gpio & 7); | 281 | const int port_mask = 1 << (gpio & 7); |
282 | 282 | ||
283 | gpio_direction_output(gpio, gpio_get_value(gpio)); | 283 | gpio_direction_input(gpio); |
284 | 284 | ||
285 | switch (type) { | 285 | switch (type) { |
286 | case IRQT_RISING: | 286 | case IRQT_RISING: |
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c index 36e5835e609..ca85d24cf39 100644 --- a/arch/arm/mach-ns9xxx/irq.c +++ b/arch/arm/mach-ns9xxx/irq.c | |||
@@ -62,7 +62,7 @@ static struct irq_chip ns9xxx_chip = { | |||
62 | #if 0 | 62 | #if 0 |
63 | #define handle_irq handle_level_irq | 63 | #define handle_irq handle_level_irq |
64 | #else | 64 | #else |
65 | void handle_prio_irq(unsigned int irq, struct irq_desc *desc) | 65 | static void handle_prio_irq(unsigned int irq, struct irq_desc *desc) |
66 | { | 66 | { |
67 | unsigned int cpu = smp_processor_id(); | 67 | unsigned int cpu = smp_processor_id(); |
68 | struct irqaction *action; | 68 | struct irqaction *action; |
@@ -70,27 +70,35 @@ void handle_prio_irq(unsigned int irq, struct irq_desc *desc) | |||
70 | 70 | ||
71 | spin_lock(&desc->lock); | 71 | spin_lock(&desc->lock); |
72 | 72 | ||
73 | if (unlikely(desc->status & IRQ_INPROGRESS)) | 73 | BUG_ON(desc->status & IRQ_INPROGRESS); |
74 | goto out_unlock; | ||
75 | 74 | ||
76 | desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); | 75 | desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); |
77 | kstat_cpu(cpu).irqs[irq]++; | 76 | kstat_cpu(cpu).irqs[irq]++; |
78 | 77 | ||
79 | action = desc->action; | 78 | action = desc->action; |
80 | if (unlikely(!action || (desc->status & IRQ_DISABLED))) | 79 | if (unlikely(!action || (desc->status & IRQ_DISABLED))) |
81 | goto out_unlock; | 80 | goto out_mask; |
82 | 81 | ||
83 | desc->status |= IRQ_INPROGRESS; | 82 | desc->status |= IRQ_INPROGRESS; |
84 | spin_unlock(&desc->lock); | 83 | spin_unlock(&desc->lock); |
85 | 84 | ||
86 | action_ret = handle_IRQ_event(irq, action); | 85 | action_ret = handle_IRQ_event(irq, action); |
87 | 86 | ||
87 | /* XXX: There is no direct way to access noirqdebug, so check | ||
88 | * unconditionally for spurious irqs... | ||
89 | * Maybe this function should go to kernel/irq/chip.c? */ | ||
90 | note_interrupt(irq, desc, action_ret); | ||
91 | |||
88 | spin_lock(&desc->lock); | 92 | spin_lock(&desc->lock); |
89 | desc->status &= ~IRQ_INPROGRESS; | 93 | desc->status &= ~IRQ_INPROGRESS; |
90 | if (!(desc->status & IRQ_DISABLED) && desc->chip->ack) | ||
91 | desc->chip->ack(irq); | ||
92 | 94 | ||
93 | out_unlock: | 95 | if (desc->status & IRQ_DISABLED) |
96 | out_mask: | ||
97 | desc->chip->mask(irq); | ||
98 | |||
99 | /* ack unconditionally to unmask lower prio irqs */ | ||
100 | desc->chip->ack(irq); | ||
101 | |||
94 | spin_unlock(&desc->lock); | 102 | spin_unlock(&desc->lock); |
95 | } | 103 | } |
96 | #define handle_irq handle_prio_irq | 104 | #define handle_irq handle_prio_irq |
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c index 9608503d67f..e63fb05dc89 100644 --- a/arch/arm/mach-orion5x/addr-map.c +++ b/arch/arm/mach-orion5x/addr-map.c | |||
@@ -34,11 +34,7 @@ | |||
34 | * Non-CPU Masters address decoding -- | 34 | * Non-CPU Masters address decoding -- |
35 | * Unlike the CPU, we setup the access from Orion's master interfaces to DDR | 35 | * Unlike the CPU, we setup the access from Orion's master interfaces to DDR |
36 | * banks only (the typical use case). | 36 | * banks only (the typical use case). |
37 | * Setup access for each master to DDR is issued by common.c. | 37 | * Setup access for each master to DDR is issued by platform device setup. |
38 | * | ||
39 | * Note: although orion_setbits() and orion_clrbits() are not atomic | ||
40 | * no locking is necessary here since code in this file is only called | ||
41 | * at boot time when there is no concurrency issues. | ||
42 | */ | 38 | */ |
43 | 39 | ||
44 | /* | 40 | /* |
@@ -48,10 +44,6 @@ | |||
48 | #define TARGET_DEV_BUS 1 | 44 | #define TARGET_DEV_BUS 1 |
49 | #define TARGET_PCI 3 | 45 | #define TARGET_PCI 3 |
50 | #define TARGET_PCIE 4 | 46 | #define TARGET_PCIE 4 |
51 | #define ATTR_DDR_CS(n) (((n) ==0) ? 0xe : \ | ||
52 | ((n) == 1) ? 0xd : \ | ||
53 | ((n) == 2) ? 0xb : \ | ||
54 | ((n) == 3) ? 0x7 : 0xf) | ||
55 | #define ATTR_PCIE_MEM 0x59 | 47 | #define ATTR_PCIE_MEM 0x59 |
56 | #define ATTR_PCIE_IO 0x51 | 48 | #define ATTR_PCIE_IO 0x51 |
57 | #define ATTR_PCIE_WA 0x79 | 49 | #define ATTR_PCIE_WA 0x79 |
@@ -61,17 +53,12 @@ | |||
61 | #define ATTR_DEV_CS1 0x1d | 53 | #define ATTR_DEV_CS1 0x1d |
62 | #define ATTR_DEV_CS2 0x1b | 54 | #define ATTR_DEV_CS2 0x1b |
63 | #define ATTR_DEV_BOOT 0xf | 55 | #define ATTR_DEV_BOOT 0xf |
64 | #define WIN_EN 1 | ||
65 | 56 | ||
66 | /* | 57 | /* |
67 | * Helpers to get DDR bank info | 58 | * Helpers to get DDR bank info |
68 | */ | 59 | */ |
69 | #define DDR_BASE_CS(n) ORION5X_DDR_REG(0x1500 + ((n) * 8)) | 60 | #define DDR_BASE_CS(n) ORION5X_DDR_REG(0x1500 + ((n) << 3)) |
70 | #define DDR_SIZE_CS(n) ORION5X_DDR_REG(0x1504 + ((n) * 8)) | 61 | #define DDR_SIZE_CS(n) ORION5X_DDR_REG(0x1504 + ((n) << 3)) |
71 | #define DDR_MAX_CS 4 | ||
72 | #define DDR_REG_TO_SIZE(reg) (((reg) | 0xffffff) + 1) | ||
73 | #define DDR_REG_TO_BASE(reg) ((reg) & 0xff000000) | ||
74 | #define DDR_BANK_EN 1 | ||
75 | 62 | ||
76 | /* | 63 | /* |
77 | * CPU Address Decode Windows registers | 64 | * CPU Address Decode Windows registers |
@@ -81,17 +68,6 @@ | |||
81 | #define CPU_WIN_REMAP_LO(n) ORION5X_BRIDGE_REG(0x008 | ((n) << 4)) | 68 | #define CPU_WIN_REMAP_LO(n) ORION5X_BRIDGE_REG(0x008 | ((n) << 4)) |
82 | #define CPU_WIN_REMAP_HI(n) ORION5X_BRIDGE_REG(0x00c | ((n) << 4)) | 69 | #define CPU_WIN_REMAP_HI(n) ORION5X_BRIDGE_REG(0x00c | ((n) << 4)) |
83 | 70 | ||
84 | /* | ||
85 | * Gigabit Ethernet Address Decode Windows registers | ||
86 | */ | ||
87 | #define ETH_WIN_BASE(win) ORION5X_ETH_REG(0x200 + ((win) * 8)) | ||
88 | #define ETH_WIN_SIZE(win) ORION5X_ETH_REG(0x204 + ((win) * 8)) | ||
89 | #define ETH_WIN_REMAP(win) ORION5X_ETH_REG(0x280 + ((win) * 4)) | ||
90 | #define ETH_WIN_EN ORION5X_ETH_REG(0x290) | ||
91 | #define ETH_WIN_PROT ORION5X_ETH_REG(0x294) | ||
92 | #define ETH_MAX_WIN 6 | ||
93 | #define ETH_MAX_REMAP_WIN 4 | ||
94 | |||
95 | 71 | ||
96 | struct mbus_dram_target_info orion5x_mbus_dram_info; | 72 | struct mbus_dram_target_info orion5x_mbus_dram_info; |
97 | 73 | ||
@@ -202,39 +178,3 @@ void __init orion5x_setup_pcie_wa_win(u32 base, u32 size) | |||
202 | { | 178 | { |
203 | setup_cpu_win(7, base, size, TARGET_PCIE, ATTR_PCIE_WA, -1); | 179 | setup_cpu_win(7, base, size, TARGET_PCIE, ATTR_PCIE_WA, -1); |
204 | } | 180 | } |
205 | |||
206 | void __init orion5x_setup_eth_wins(void) | ||
207 | { | ||
208 | int i; | ||
209 | |||
210 | /* | ||
211 | * First, disable and clear windows | ||
212 | */ | ||
213 | for (i = 0; i < ETH_MAX_WIN; i++) { | ||
214 | orion5x_write(ETH_WIN_BASE(i), 0); | ||
215 | orion5x_write(ETH_WIN_SIZE(i), 0); | ||
216 | orion5x_setbits(ETH_WIN_EN, 1 << i); | ||
217 | orion5x_clrbits(ETH_WIN_PROT, 0x3 << (i * 2)); | ||
218 | if (i < ETH_MAX_REMAP_WIN) | ||
219 | orion5x_write(ETH_WIN_REMAP(i), 0); | ||
220 | } | ||
221 | |||
222 | /* | ||
223 | * Setup windows for DDR banks. | ||
224 | */ | ||
225 | for (i = 0; i < DDR_MAX_CS; i++) { | ||
226 | u32 base, size; | ||
227 | size = orion5x_read(DDR_SIZE_CS(i)); | ||
228 | base = orion5x_read(DDR_BASE_CS(i)); | ||
229 | if (size & DDR_BANK_EN) { | ||
230 | base = DDR_REG_TO_BASE(base); | ||
231 | size = DDR_REG_TO_SIZE(size); | ||
232 | orion5x_write(ETH_WIN_SIZE(i), (size-1) & 0xffff0000); | ||
233 | orion5x_write(ETH_WIN_BASE(i), (base & 0xffff0000) | | ||
234 | (ATTR_DDR_CS(i) << 8) | | ||
235 | TARGET_DDR); | ||
236 | orion5x_clrbits(ETH_WIN_EN, 1 << i); | ||
237 | orion5x_setbits(ETH_WIN_PROT, 0x3 << (i * 2)); | ||
238 | } | ||
239 | } | ||
240 | } | ||
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 968deb58be0..4f13fd037f0 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -190,6 +190,11 @@ static struct platform_device orion5x_ehci1 = { | |||
190 | * (The Orion and Discovery (MV643xx) families use the same Ethernet driver) | 190 | * (The Orion and Discovery (MV643xx) families use the same Ethernet driver) |
191 | ****************************************************************************/ | 191 | ****************************************************************************/ |
192 | 192 | ||
193 | struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = { | ||
194 | .dram = &orion5x_mbus_dram_info, | ||
195 | .t_clk = ORION5X_TCLK, | ||
196 | }; | ||
197 | |||
193 | static struct resource orion5x_eth_shared_resources[] = { | 198 | static struct resource orion5x_eth_shared_resources[] = { |
194 | { | 199 | { |
195 | .start = ORION5X_ETH_PHYS_BASE + 0x2000, | 200 | .start = ORION5X_ETH_PHYS_BASE + 0x2000, |
@@ -201,6 +206,9 @@ static struct resource orion5x_eth_shared_resources[] = { | |||
201 | static struct platform_device orion5x_eth_shared = { | 206 | static struct platform_device orion5x_eth_shared = { |
202 | .name = MV643XX_ETH_SHARED_NAME, | 207 | .name = MV643XX_ETH_SHARED_NAME, |
203 | .id = 0, | 208 | .id = 0, |
209 | .dev = { | ||
210 | .platform_data = &orion5x_eth_shared_data, | ||
211 | }, | ||
204 | .num_resources = 1, | 212 | .num_resources = 1, |
205 | .resource = orion5x_eth_shared_resources, | 213 | .resource = orion5x_eth_shared_resources, |
206 | }; | 214 | }; |
@@ -223,7 +231,9 @@ static struct platform_device orion5x_eth = { | |||
223 | 231 | ||
224 | void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data) | 232 | void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data) |
225 | { | 233 | { |
234 | eth_data->shared = &orion5x_eth_shared; | ||
226 | orion5x_eth.dev.platform_data = eth_data; | 235 | orion5x_eth.dev.platform_data = eth_data; |
236 | |||
227 | platform_device_register(&orion5x_eth_shared); | 237 | platform_device_register(&orion5x_eth_shared); |
228 | platform_device_register(&orion5x_eth); | 238 | platform_device_register(&orion5x_eth); |
229 | } | 239 | } |
@@ -360,7 +370,6 @@ void __init orion5x_init(void) | |||
360 | * Setup Orion address map | 370 | * Setup Orion address map |
361 | */ | 371 | */ |
362 | orion5x_setup_cpu_mbus_bridge(); | 372 | orion5x_setup_cpu_mbus_bridge(); |
363 | orion5x_setup_eth_wins(); | ||
364 | 373 | ||
365 | /* | 374 | /* |
366 | * Register devices. | 375 | * Register devices. |
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h index 14adf8d1a54..bd0f05de6e1 100644 --- a/arch/arm/mach-orion5x/common.h +++ b/arch/arm/mach-orion5x/common.h | |||
@@ -22,7 +22,6 @@ void orion5x_setup_dev0_win(u32 base, u32 size); | |||
22 | void orion5x_setup_dev1_win(u32 base, u32 size); | 22 | void orion5x_setup_dev1_win(u32 base, u32 size); |
23 | void orion5x_setup_dev2_win(u32 base, u32 size); | 23 | void orion5x_setup_dev2_win(u32 base, u32 size); |
24 | void orion5x_setup_pcie_wa_win(u32 base, u32 size); | 24 | void orion5x_setup_pcie_wa_win(u32 base, u32 size); |
25 | void orion5x_setup_eth_wins(void); | ||
26 | 25 | ||
27 | /* | 26 | /* |
28 | * Shared code used internally by other Orion core functions. | 27 | * Shared code used internally by other Orion core functions. |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 6a830853aa6..0e6d05bb81a 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -5,6 +5,13 @@ | |||
5 | # Common support (must be linked before board specific support) | 5 | # Common support (must be linked before board specific support) |
6 | obj-y += clock.o devices.o generic.o irq.o dma.o \ | 6 | obj-y += clock.o devices.o generic.o irq.o dma.o \ |
7 | time.o gpio.o | 7 | time.o gpio.o |
8 | obj-$(CONFIG_PM) += pm.o sleep.o standby.o | ||
9 | obj-$(CONFIG_CPU_FREQ) += cpu-pxa.o | ||
10 | |||
11 | # Generic drivers that other drivers may depend upon | ||
12 | obj-$(CONFIG_PXA_SSP) += ssp.o | ||
13 | |||
14 | # SoC-specific code | ||
8 | obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa25x.o | 15 | obj-$(CONFIG_PXA25x) += mfp-pxa2xx.o pxa25x.o |
9 | obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa27x.o | 16 | obj-$(CONFIG_PXA27x) += mfp-pxa2xx.o pxa27x.o |
10 | obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o pxa3xx.o smemc.o | 17 | obj-$(CONFIG_PXA3xx) += mfp-pxa3xx.o pxa3xx.o smemc.o |
@@ -48,11 +55,6 @@ led-$(CONFIG_MACH_TRIZEPS4) += leds-trizeps4.o | |||
48 | 55 | ||
49 | obj-$(CONFIG_LEDS) += $(led-y) | 56 | obj-$(CONFIG_LEDS) += $(led-y) |
50 | 57 | ||
51 | # Misc features | ||
52 | obj-$(CONFIG_PM) += pm.o sleep.o standby.o | ||
53 | obj-$(CONFIG_CPU_FREQ) += cpu-pxa.o | ||
54 | obj-$(CONFIG_PXA_SSP) += ssp.o | ||
55 | |||
56 | ifeq ($(CONFIG_PCI),y) | 58 | ifeq ($(CONFIG_PCI),y) |
57 | obj-$(CONFIG_MACH_ARMCORE) += cm-x270-pci.o | 59 | obj-$(CONFIG_MACH_ARMCORE) += cm-x270-pci.o |
58 | endif | 60 | endif |
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 259ca821e46..b757dd75665 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -493,8 +493,6 @@ static struct platform_device *devices[] __initdata = { | |||
493 | 493 | ||
494 | static void corgi_poweroff(void) | 494 | static void corgi_poweroff(void) |
495 | { | 495 | { |
496 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
497 | |||
498 | if (!machine_is_corgi()) | 496 | if (!machine_is_corgi()) |
499 | /* Green LED off tells the bootloader to halt */ | 497 | /* Green LED off tells the bootloader to halt */ |
500 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); | 498 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); |
@@ -503,8 +501,6 @@ static void corgi_poweroff(void) | |||
503 | 501 | ||
504 | static void corgi_restart(char mode) | 502 | static void corgi_restart(char mode) |
505 | { | 503 | { |
506 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
507 | |||
508 | if (!machine_is_corgi()) | 504 | if (!machine_is_corgi()) |
509 | /* Green LED on tells the bootloader to reboot */ | 505 | /* Green LED on tells the bootloader to reboot */ |
510 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); | 506 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); |
diff --git a/arch/arm/mach-pxa/cpu-pxa.c b/arch/arm/mach-pxa/cpu-pxa.c index 4b21479332a..fb9ba1ab282 100644 --- a/arch/arm/mach-pxa/cpu-pxa.c +++ b/arch/arm/mach-pxa/cpu-pxa.c | |||
@@ -49,125 +49,216 @@ MODULE_PARM_DESC(freq_debug, "Set the debug messages to on=1/off=0"); | |||
49 | #define freq_debug 0 | 49 | #define freq_debug 0 |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | static unsigned int pxa27x_maxfreq; | ||
53 | module_param(pxa27x_maxfreq, uint, 0); | ||
54 | MODULE_PARM_DESC(pxa27x_maxfreq, "Set the pxa27x maxfreq in MHz" | ||
55 | "(typically 624=>pxa270, 416=>pxa271, 520=>pxa272)"); | ||
56 | |||
52 | typedef struct { | 57 | typedef struct { |
53 | unsigned int khz; | 58 | unsigned int khz; |
54 | unsigned int membus; | 59 | unsigned int membus; |
55 | unsigned int cccr; | 60 | unsigned int cccr; |
56 | unsigned int div2; | 61 | unsigned int div2; |
62 | unsigned int cclkcfg; | ||
57 | } pxa_freqs_t; | 63 | } pxa_freqs_t; |
58 | 64 | ||
59 | /* Define the refresh period in mSec for the SDRAM and the number of rows */ | 65 | /* Define the refresh period in mSec for the SDRAM and the number of rows */ |
60 | #define SDRAM_TREF 64 /* standard 64ms SDRAM */ | 66 | #define SDRAM_TREF 64 /* standard 64ms SDRAM */ |
61 | #define SDRAM_ROWS 4096 /* 64MB=8192 32MB=4096 */ | 67 | #define SDRAM_ROWS 4096 /* 64MB=8192 32MB=4096 */ |
62 | #define MDREFR_DRI(x) (((x) * SDRAM_TREF) / (SDRAM_ROWS * 32)) | ||
63 | |||
64 | #define CCLKCFG_TURBO 0x1 | ||
65 | #define CCLKCFG_FCS 0x2 | ||
66 | #define PXA25x_MIN_FREQ 99500 | ||
67 | #define PXA25x_MAX_FREQ 398100 | ||
68 | #define MDREFR_DB2_MASK (MDREFR_K2DB2 | MDREFR_K1DB2) | ||
69 | #define MDREFR_DRI_MASK 0xFFF | ||
70 | 68 | ||
69 | #define CCLKCFG_TURBO 0x1 | ||
70 | #define CCLKCFG_FCS 0x2 | ||
71 | #define CCLKCFG_HALFTURBO 0x4 | ||
72 | #define CCLKCFG_FASTBUS 0x8 | ||
73 | #define MDREFR_DB2_MASK (MDREFR_K2DB2 | MDREFR_K1DB2) | ||
74 | #define MDREFR_DRI_MASK 0xFFF | ||
71 | 75 | ||
76 | /* | ||
77 | * PXA255 definitions | ||
78 | */ | ||
72 | /* Use the run mode frequencies for the CPUFREQ_POLICY_PERFORMANCE policy */ | 79 | /* Use the run mode frequencies for the CPUFREQ_POLICY_PERFORMANCE policy */ |
80 | #define CCLKCFG CCLKCFG_TURBO | CCLKCFG_FCS | ||
81 | |||
73 | static pxa_freqs_t pxa255_run_freqs[] = | 82 | static pxa_freqs_t pxa255_run_freqs[] = |
74 | { | 83 | { |
75 | /* CPU MEMBUS CCCR DIV2*/ | 84 | /* CPU MEMBUS CCCR DIV2 CCLKCFG run turbo PXbus SDRAM */ |
76 | { 99500, 99500, 0x121, 1}, /* run= 99, turbo= 99, PXbus=50, SDRAM=50 */ | 85 | { 99500, 99500, 0x121, 1, CCLKCFG}, /* 99, 99, 50, 50 */ |
77 | {132700, 132700, 0x123, 1}, /* run=133, turbo=133, PXbus=66, SDRAM=66 */ | 86 | {132700, 132700, 0x123, 1, CCLKCFG}, /* 133, 133, 66, 66 */ |
78 | {199100, 99500, 0x141, 0}, /* run=199, turbo=199, PXbus=99, SDRAM=99 */ | 87 | {199100, 99500, 0x141, 0, CCLKCFG}, /* 199, 199, 99, 99 */ |
79 | {265400, 132700, 0x143, 1}, /* run=265, turbo=265, PXbus=133, SDRAM=66 */ | 88 | {265400, 132700, 0x143, 1, CCLKCFG}, /* 265, 265, 133, 66 */ |
80 | {331800, 165900, 0x145, 1}, /* run=331, turbo=331, PXbus=166, SDRAM=83 */ | 89 | {331800, 165900, 0x145, 1, CCLKCFG}, /* 331, 331, 166, 83 */ |
81 | {398100, 99500, 0x161, 0}, /* run=398, turbo=398, PXbus=196, SDRAM=99 */ | 90 | {398100, 99500, 0x161, 0, CCLKCFG}, /* 398, 398, 196, 99 */ |
82 | {0,} | ||
83 | }; | 91 | }; |
84 | #define NUM_RUN_FREQS ARRAY_SIZE(pxa255_run_freqs) | ||
85 | |||
86 | static struct cpufreq_frequency_table pxa255_run_freq_table[NUM_RUN_FREQS+1]; | ||
87 | 92 | ||
88 | /* Use the turbo mode frequencies for the CPUFREQ_POLICY_POWERSAVE policy */ | 93 | /* Use the turbo mode frequencies for the CPUFREQ_POLICY_POWERSAVE policy */ |
89 | static pxa_freqs_t pxa255_turbo_freqs[] = | 94 | static pxa_freqs_t pxa255_turbo_freqs[] = |
90 | { | 95 | { |
91 | /* CPU MEMBUS CCCR DIV2*/ | 96 | /* CPU MEMBUS CCCR DIV2 CCLKCFG run turbo PXbus SDRAM */ |
92 | { 99500, 99500, 0x121, 1}, /* run=99, turbo= 99, PXbus=50, SDRAM=50 */ | 97 | { 99500, 99500, 0x121, 1, CCLKCFG}, /* 99, 99, 50, 50 */ |
93 | {199100, 99500, 0x221, 0}, /* run=99, turbo=199, PXbus=50, SDRAM=99 */ | 98 | {199100, 99500, 0x221, 0, CCLKCFG}, /* 99, 199, 50, 99 */ |
94 | {298500, 99500, 0x321, 0}, /* run=99, turbo=287, PXbus=50, SDRAM=99 */ | 99 | {298500, 99500, 0x321, 0, CCLKCFG}, /* 99, 287, 50, 99 */ |
95 | {298600, 99500, 0x1c1, 0}, /* run=199, turbo=287, PXbus=99, SDRAM=99 */ | 100 | {298600, 99500, 0x1c1, 0, CCLKCFG}, /* 199, 287, 99, 99 */ |
96 | {398100, 99500, 0x241, 0}, /* run=199, turbo=398, PXbus=99, SDRAM=99 */ | 101 | {398100, 99500, 0x241, 0, CCLKCFG}, /* 199, 398, 99, 99 */ |
97 | {0,} | 102 | }; |
103 | |||
104 | #define NUM_PXA25x_RUN_FREQS ARRAY_SIZE(pxa255_run_freqs) | ||
105 | #define NUM_PXA25x_TURBO_FREQS ARRAY_SIZE(pxa255_turbo_freqs) | ||
106 | |||
107 | static struct cpufreq_frequency_table | ||
108 | pxa255_run_freq_table[NUM_PXA25x_RUN_FREQS+1]; | ||
109 | static struct cpufreq_frequency_table | ||
110 | pxa255_turbo_freq_table[NUM_PXA25x_TURBO_FREQS+1]; | ||
111 | |||
112 | /* | ||
113 | * PXA270 definitions | ||
114 | * | ||
115 | * For the PXA27x: | ||
116 | * Control variables are A, L, 2N for CCCR; B, HT, T for CLKCFG. | ||
117 | * | ||
118 | * A = 0 => memory controller clock from table 3-7, | ||
119 | * A = 1 => memory controller clock = system bus clock | ||
120 | * Run mode frequency = 13 MHz * L | ||
121 | * Turbo mode frequency = 13 MHz * L * N | ||
122 | * System bus frequency = 13 MHz * L / (B + 1) | ||
123 | * | ||
124 | * In CCCR: | ||
125 | * A = 1 | ||
126 | * L = 16 oscillator to run mode ratio | ||
127 | * 2N = 6 2 * (turbo mode to run mode ratio) | ||
128 | * | ||
129 | * In CCLKCFG: | ||
130 | * B = 1 Fast bus mode | ||
131 | * HT = 0 Half-Turbo mode | ||
132 | * T = 1 Turbo mode | ||
133 | * | ||
134 | * For now, just support some of the combinations in table 3-7 of | ||
135 | * PXA27x Processor Family Developer's Manual to simplify frequency | ||
136 | * change sequences. | ||
137 | */ | ||
138 | #define PXA27x_CCCR(A, L, N2) (A << 25 | N2 << 7 | L) | ||
139 | #define CCLKCFG2(B, HT, T) \ | ||
140 | (CCLKCFG_FCS | \ | ||
141 | ((B) ? CCLKCFG_FASTBUS : 0) | \ | ||
142 | ((HT) ? CCLKCFG_HALFTURBO : 0) | \ | ||
143 | ((T) ? CCLKCFG_TURBO : 0)) | ||
144 | |||
145 | static pxa_freqs_t pxa27x_freqs[] = { | ||
146 | {104000, 104000, PXA27x_CCCR(1, 8, 2), 0, CCLKCFG2(1, 0, 1)}, | ||
147 | {156000, 104000, PXA27x_CCCR(1, 8, 6), 0, CCLKCFG2(1, 1, 1)}, | ||
148 | {208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1)}, | ||
149 | {312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1)}, | ||
150 | {416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1)}, | ||
151 | {520000, 208000, PXA27x_CCCR(1, 16, 5), 1, CCLKCFG2(1, 0, 1)}, | ||
152 | {624000, 208000, PXA27x_CCCR(1, 16, 6), 1, CCLKCFG2(1, 0, 1)} | ||
98 | }; | 153 | }; |
99 | #define NUM_TURBO_FREQS ARRAY_SIZE(pxa255_turbo_freqs) | ||
100 | 154 | ||
101 | static struct cpufreq_frequency_table pxa255_turbo_freq_table[NUM_TURBO_FREQS+1]; | 155 | #define NUM_PXA27x_FREQS ARRAY_SIZE(pxa27x_freqs) |
156 | static struct cpufreq_frequency_table | ||
157 | pxa27x_freq_table[NUM_PXA27x_FREQS+1]; | ||
102 | 158 | ||
103 | extern unsigned get_clk_frequency_khz(int info); | 159 | extern unsigned get_clk_frequency_khz(int info); |
104 | 160 | ||
161 | static void find_freq_tables(struct cpufreq_policy *policy, | ||
162 | struct cpufreq_frequency_table **freq_table, | ||
163 | pxa_freqs_t **pxa_freqs) | ||
164 | { | ||
165 | if (cpu_is_pxa25x()) { | ||
166 | if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) { | ||
167 | *pxa_freqs = pxa255_run_freqs; | ||
168 | *freq_table = pxa255_run_freq_table; | ||
169 | } else if (policy->policy == CPUFREQ_POLICY_POWERSAVE) { | ||
170 | *pxa_freqs = pxa255_turbo_freqs; | ||
171 | *freq_table = pxa255_turbo_freq_table; | ||
172 | } else { | ||
173 | printk("CPU PXA: Unknown policy found. " | ||
174 | "Using CPUFREQ_POLICY_PERFORMANCE\n"); | ||
175 | *pxa_freqs = pxa255_run_freqs; | ||
176 | *freq_table = pxa255_run_freq_table; | ||
177 | } | ||
178 | } | ||
179 | if (cpu_is_pxa27x()) { | ||
180 | *pxa_freqs = pxa27x_freqs; | ||
181 | *freq_table = pxa27x_freq_table; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | static void pxa27x_guess_max_freq(void) | ||
186 | { | ||
187 | if (!pxa27x_maxfreq) { | ||
188 | pxa27x_maxfreq = 416000; | ||
189 | printk(KERN_INFO "PXA CPU 27x max frequency not defined " | ||
190 | "(pxa27x_maxfreq), assuming pxa271 with %dkHz maxfreq\n", | ||
191 | pxa27x_maxfreq); | ||
192 | } else { | ||
193 | pxa27x_maxfreq *= 1000; | ||
194 | } | ||
195 | } | ||
196 | |||
197 | static u32 mdrefr_dri(unsigned int freq) | ||
198 | { | ||
199 | u32 dri = 0; | ||
200 | |||
201 | if (cpu_is_pxa25x()) | ||
202 | dri = ((freq * SDRAM_TREF) / (SDRAM_ROWS * 32)); | ||
203 | if (cpu_is_pxa27x()) | ||
204 | dri = ((freq * SDRAM_TREF) / (SDRAM_ROWS - 31)) / 32; | ||
205 | return dri; | ||
206 | } | ||
207 | |||
105 | /* find a valid frequency point */ | 208 | /* find a valid frequency point */ |
106 | static int pxa_verify_policy(struct cpufreq_policy *policy) | 209 | static int pxa_verify_policy(struct cpufreq_policy *policy) |
107 | { | 210 | { |
108 | struct cpufreq_frequency_table *pxa_freqs_table; | 211 | struct cpufreq_frequency_table *pxa_freqs_table; |
212 | pxa_freqs_t *pxa_freqs; | ||
109 | int ret; | 213 | int ret; |
110 | 214 | ||
111 | if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) { | 215 | find_freq_tables(policy, &pxa_freqs_table, &pxa_freqs); |
112 | pxa_freqs_table = pxa255_run_freq_table; | ||
113 | } else if (policy->policy == CPUFREQ_POLICY_POWERSAVE) { | ||
114 | pxa_freqs_table = pxa255_turbo_freq_table; | ||
115 | } else { | ||
116 | printk("CPU PXA: Unknown policy found. " | ||
117 | "Using CPUFREQ_POLICY_PERFORMANCE\n"); | ||
118 | pxa_freqs_table = pxa255_run_freq_table; | ||
119 | } | ||
120 | |||
121 | ret = cpufreq_frequency_table_verify(policy, pxa_freqs_table); | 216 | ret = cpufreq_frequency_table_verify(policy, pxa_freqs_table); |
122 | 217 | ||
123 | if (freq_debug) | 218 | if (freq_debug) |
124 | pr_debug("Verified CPU policy: %dKhz min to %dKhz max\n", | 219 | pr_debug("Verified CPU policy: %dKhz min to %dKhz max\n", |
125 | policy->min, policy->max); | 220 | policy->min, policy->max); |
126 | 221 | ||
127 | return ret; | 222 | return ret; |
128 | } | 223 | } |
129 | 224 | ||
225 | static unsigned int pxa_cpufreq_get(unsigned int cpu) | ||
226 | { | ||
227 | return get_clk_frequency_khz(0); | ||
228 | } | ||
229 | |||
130 | static int pxa_set_target(struct cpufreq_policy *policy, | 230 | static int pxa_set_target(struct cpufreq_policy *policy, |
131 | unsigned int target_freq, | 231 | unsigned int target_freq, |
132 | unsigned int relation) | 232 | unsigned int relation) |
133 | { | 233 | { |
134 | struct cpufreq_frequency_table *pxa_freqs_table; | 234 | struct cpufreq_frequency_table *pxa_freqs_table; |
135 | pxa_freqs_t *pxa_freq_settings; | 235 | pxa_freqs_t *pxa_freq_settings; |
136 | struct cpufreq_freqs freqs; | 236 | struct cpufreq_freqs freqs; |
137 | unsigned int idx; | 237 | unsigned int idx; |
138 | unsigned long flags; | 238 | unsigned long flags; |
139 | unsigned int unused, preset_mdrefr, postset_mdrefr; | 239 | unsigned int new_freq_cpu, new_freq_mem; |
140 | void *ramstart = phys_to_virt(0xa0000000); | 240 | unsigned int unused, preset_mdrefr, postset_mdrefr, cclkcfg; |
141 | 241 | ||
142 | /* Get the current policy */ | 242 | /* Get the current policy */ |
143 | if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) { | 243 | find_freq_tables(policy, &pxa_freqs_table, &pxa_freq_settings); |
144 | pxa_freq_settings = pxa255_run_freqs; | ||
145 | pxa_freqs_table = pxa255_run_freq_table; | ||
146 | } else if (policy->policy == CPUFREQ_POLICY_POWERSAVE) { | ||
147 | pxa_freq_settings = pxa255_turbo_freqs; | ||
148 | pxa_freqs_table = pxa255_turbo_freq_table; | ||
149 | } else { | ||
150 | printk("CPU PXA: Unknown policy found. " | ||
151 | "Using CPUFREQ_POLICY_PERFORMANCE\n"); | ||
152 | pxa_freq_settings = pxa255_run_freqs; | ||
153 | pxa_freqs_table = pxa255_run_freq_table; | ||
154 | } | ||
155 | 244 | ||
156 | /* Lookup the next frequency */ | 245 | /* Lookup the next frequency */ |
157 | if (cpufreq_frequency_table_target(policy, pxa_freqs_table, | 246 | if (cpufreq_frequency_table_target(policy, pxa_freqs_table, |
158 | target_freq, relation, &idx)) { | 247 | target_freq, relation, &idx)) { |
159 | return -EINVAL; | 248 | return -EINVAL; |
160 | } | 249 | } |
161 | 250 | ||
251 | new_freq_cpu = pxa_freq_settings[idx].khz; | ||
252 | new_freq_mem = pxa_freq_settings[idx].membus; | ||
162 | freqs.old = policy->cur; | 253 | freqs.old = policy->cur; |
163 | freqs.new = pxa_freq_settings[idx].khz; | 254 | freqs.new = new_freq_cpu; |
164 | freqs.cpu = policy->cpu; | 255 | freqs.cpu = policy->cpu; |
165 | 256 | ||
166 | if (freq_debug) | 257 | if (freq_debug) |
167 | pr_debug(KERN_INFO "Changing CPU frequency to %d Mhz, (SDRAM %d Mhz)\n", | 258 | pr_debug(KERN_INFO "Changing CPU frequency to %d Mhz, " |
168 | freqs.new / 1000, (pxa_freq_settings[idx].div2) ? | 259 | "(SDRAM %d Mhz)\n", |
169 | (pxa_freq_settings[idx].membus / 2000) : | 260 | freqs.new / 1000, (pxa_freq_settings[idx].div2) ? |
170 | (pxa_freq_settings[idx].membus / 1000)); | 261 | (new_freq_mem / 2000) : (new_freq_mem / 1000)); |
171 | 262 | ||
172 | /* | 263 | /* |
173 | * Tell everyone what we're about to do... | 264 | * Tell everyone what we're about to do... |
@@ -177,16 +268,16 @@ static int pxa_set_target(struct cpufreq_policy *policy, | |||
177 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 268 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
178 | 269 | ||
179 | /* Calculate the next MDREFR. If we're slowing down the SDRAM clock | 270 | /* Calculate the next MDREFR. If we're slowing down the SDRAM clock |
180 | * we need to preset the smaller DRI before the change. If we're speeding | 271 | * we need to preset the smaller DRI before the change. If we're |
181 | * up we need to set the larger DRI value after the change. | 272 | * speeding up we need to set the larger DRI value after the change. |
182 | */ | 273 | */ |
183 | preset_mdrefr = postset_mdrefr = MDREFR; | 274 | preset_mdrefr = postset_mdrefr = MDREFR; |
184 | if ((MDREFR & MDREFR_DRI_MASK) > MDREFR_DRI(pxa_freq_settings[idx].membus)) { | 275 | if ((MDREFR & MDREFR_DRI_MASK) > mdrefr_dri(new_freq_mem)) { |
185 | preset_mdrefr = (preset_mdrefr & ~MDREFR_DRI_MASK) | | 276 | preset_mdrefr = (preset_mdrefr & ~MDREFR_DRI_MASK); |
186 | MDREFR_DRI(pxa_freq_settings[idx].membus); | 277 | preset_mdrefr |= mdrefr_dri(new_freq_mem); |
187 | } | 278 | } |
188 | postset_mdrefr = (postset_mdrefr & ~MDREFR_DRI_MASK) | | 279 | postset_mdrefr = |
189 | MDREFR_DRI(pxa_freq_settings[idx].membus); | 280 | (postset_mdrefr & ~MDREFR_DRI_MASK) | mdrefr_dri(new_freq_mem); |
190 | 281 | ||
191 | /* If we're dividing the memory clock by two for the SDRAM clock, this | 282 | /* If we're dividing the memory clock by two for the SDRAM clock, this |
192 | * must be set prior to the change. Clearing the divide must be done | 283 | * must be set prior to the change. Clearing the divide must be done |
@@ -201,26 +292,27 @@ static int pxa_set_target(struct cpufreq_policy *policy, | |||
201 | 292 | ||
202 | local_irq_save(flags); | 293 | local_irq_save(flags); |
203 | 294 | ||
204 | /* Set new the CCCR */ | 295 | /* Set new the CCCR and prepare CCLKCFG */ |
205 | CCCR = pxa_freq_settings[idx].cccr; | 296 | CCCR = pxa_freq_settings[idx].cccr; |
297 | cclkcfg = pxa_freq_settings[idx].cclkcfg; | ||
206 | 298 | ||
207 | asm volatile(" \n\ | 299 | asm volatile(" \n\ |
208 | ldr r4, [%1] /* load MDREFR */ \n\ | 300 | ldr r4, [%1] /* load MDREFR */ \n\ |
209 | b 2f \n\ | 301 | b 2f \n\ |
210 | .align 5 \n\ | 302 | .align 5 \n\ |
211 | 1: \n\ | 303 | 1: \n\ |
212 | str %4, [%1] /* preset the MDREFR */ \n\ | 304 | str %3, [%1] /* preset the MDREFR */ \n\ |
213 | mcr p14, 0, %2, c6, c0, 0 /* set CCLKCFG[FCS] */ \n\ | 305 | mcr p14, 0, %2, c6, c0, 0 /* set CCLKCFG[FCS] */ \n\ |
214 | str %5, [%1] /* postset the MDREFR */ \n\ | 306 | str %4, [%1] /* postset the MDREFR */ \n\ |
215 | \n\ | 307 | \n\ |
216 | b 3f \n\ | 308 | b 3f \n\ |
217 | 2: b 1b \n\ | 309 | 2: b 1b \n\ |
218 | 3: nop \n\ | 310 | 3: nop \n\ |
219 | " | 311 | " |
220 | : "=&r" (unused) | 312 | : "=&r" (unused) |
221 | : "r" (&MDREFR), "r" (CCLKCFG_TURBO|CCLKCFG_FCS), "r" (ramstart), | 313 | : "r" (&MDREFR), "r" (cclkcfg), |
222 | "r" (preset_mdrefr), "r" (postset_mdrefr) | 314 | "r" (preset_mdrefr), "r" (postset_mdrefr) |
223 | : "r4", "r5"); | 315 | : "r4", "r5"); |
224 | local_irq_restore(flags); | 316 | local_irq_restore(flags); |
225 | 317 | ||
226 | /* | 318 | /* |
@@ -233,38 +325,57 @@ static int pxa_set_target(struct cpufreq_policy *policy, | |||
233 | return 0; | 325 | return 0; |
234 | } | 326 | } |
235 | 327 | ||
236 | static unsigned int pxa_cpufreq_get(unsigned int cpu) | 328 | static __init int pxa_cpufreq_init(struct cpufreq_policy *policy) |
237 | { | ||
238 | return get_clk_frequency_khz(0); | ||
239 | } | ||
240 | |||
241 | static int pxa_cpufreq_init(struct cpufreq_policy *policy) | ||
242 | { | 329 | { |
243 | int i; | 330 | int i; |
331 | unsigned int freq; | ||
332 | |||
333 | /* try to guess pxa27x cpu */ | ||
334 | if (cpu_is_pxa27x()) | ||
335 | pxa27x_guess_max_freq(); | ||
244 | 336 | ||
245 | /* set default policy and cpuinfo */ | 337 | /* set default policy and cpuinfo */ |
246 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 338 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
247 | policy->policy = CPUFREQ_POLICY_PERFORMANCE; | 339 | if (cpu_is_pxa25x()) |
248 | policy->cpuinfo.max_freq = PXA25x_MAX_FREQ; | 340 | policy->policy = CPUFREQ_POLICY_PERFORMANCE; |
249 | policy->cpuinfo.min_freq = PXA25x_MIN_FREQ; | ||
250 | policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */ | 341 | policy->cpuinfo.transition_latency = 1000; /* FIXME: 1 ms, assumed */ |
251 | policy->cur = get_clk_frequency_khz(0); /* current freq */ | 342 | policy->cur = get_clk_frequency_khz(0); /* current freq */ |
252 | policy->min = policy->max = policy->cur; | 343 | policy->min = policy->max = policy->cur; |
253 | 344 | ||
254 | /* Generate the run cpufreq_frequency_table struct */ | 345 | /* Generate pxa25x the run cpufreq_frequency_table struct */ |
255 | for (i = 0; i < NUM_RUN_FREQS; i++) { | 346 | for (i = 0; i < NUM_PXA25x_RUN_FREQS; i++) { |
256 | pxa255_run_freq_table[i].frequency = pxa255_run_freqs[i].khz; | 347 | pxa255_run_freq_table[i].frequency = pxa255_run_freqs[i].khz; |
257 | pxa255_run_freq_table[i].index = i; | 348 | pxa255_run_freq_table[i].index = i; |
258 | } | 349 | } |
259 | |||
260 | pxa255_run_freq_table[i].frequency = CPUFREQ_TABLE_END; | 350 | pxa255_run_freq_table[i].frequency = CPUFREQ_TABLE_END; |
261 | /* Generate the turbo cpufreq_frequency_table struct */ | 351 | |
262 | for (i = 0; i < NUM_TURBO_FREQS; i++) { | 352 | /* Generate pxa25x the turbo cpufreq_frequency_table struct */ |
263 | pxa255_turbo_freq_table[i].frequency = pxa255_turbo_freqs[i].khz; | 353 | for (i = 0; i < NUM_PXA25x_TURBO_FREQS; i++) { |
354 | pxa255_turbo_freq_table[i].frequency = | ||
355 | pxa255_turbo_freqs[i].khz; | ||
264 | pxa255_turbo_freq_table[i].index = i; | 356 | pxa255_turbo_freq_table[i].index = i; |
265 | } | 357 | } |
266 | pxa255_turbo_freq_table[i].frequency = CPUFREQ_TABLE_END; | 358 | pxa255_turbo_freq_table[i].frequency = CPUFREQ_TABLE_END; |
267 | 359 | ||
360 | /* Generate the pxa27x cpufreq_frequency_table struct */ | ||
361 | for (i = 0; i < NUM_PXA27x_FREQS; i++) { | ||
362 | freq = pxa27x_freqs[i].khz; | ||
363 | if (freq > pxa27x_maxfreq) | ||
364 | break; | ||
365 | pxa27x_freq_table[i].frequency = freq; | ||
366 | pxa27x_freq_table[i].index = i; | ||
367 | } | ||
368 | pxa27x_freq_table[i].frequency = CPUFREQ_TABLE_END; | ||
369 | |||
370 | /* | ||
371 | * Set the policy's minimum and maximum frequencies from the tables | ||
372 | * just constructed. This sets cpuinfo.mxx_freq, min and max. | ||
373 | */ | ||
374 | if (cpu_is_pxa25x()) | ||
375 | cpufreq_frequency_table_cpuinfo(policy, pxa255_run_freq_table); | ||
376 | else if (cpu_is_pxa27x()) | ||
377 | cpufreq_frequency_table_cpuinfo(policy, pxa27x_freq_table); | ||
378 | |||
268 | printk(KERN_INFO "PXA CPU frequency change support initialized\n"); | 379 | printk(KERN_INFO "PXA CPU frequency change support initialized\n"); |
269 | 380 | ||
270 | return 0; | 381 | return 0; |
@@ -275,26 +386,25 @@ static struct cpufreq_driver pxa_cpufreq_driver = { | |||
275 | .target = pxa_set_target, | 386 | .target = pxa_set_target, |
276 | .init = pxa_cpufreq_init, | 387 | .init = pxa_cpufreq_init, |
277 | .get = pxa_cpufreq_get, | 388 | .get = pxa_cpufreq_get, |
278 | .name = "PXA25x", | 389 | .name = "PXA2xx", |
279 | }; | 390 | }; |
280 | 391 | ||
281 | static int __init pxa_cpu_init(void) | 392 | static int __init pxa_cpu_init(void) |
282 | { | 393 | { |
283 | int ret = -ENODEV; | 394 | int ret = -ENODEV; |
284 | if (cpu_is_pxa25x()) | 395 | if (cpu_is_pxa25x() || cpu_is_pxa27x()) |
285 | ret = cpufreq_register_driver(&pxa_cpufreq_driver); | 396 | ret = cpufreq_register_driver(&pxa_cpufreq_driver); |
286 | return ret; | 397 | return ret; |
287 | } | 398 | } |
288 | 399 | ||
289 | static void __exit pxa_cpu_exit(void) | 400 | static void __exit pxa_cpu_exit(void) |
290 | { | 401 | { |
291 | if (cpu_is_pxa25x()) | 402 | cpufreq_unregister_driver(&pxa_cpufreq_driver); |
292 | cpufreq_unregister_driver(&pxa_cpufreq_driver); | ||
293 | } | 403 | } |
294 | 404 | ||
295 | 405 | ||
296 | MODULE_AUTHOR ("Intrinsyc Software Inc."); | 406 | MODULE_AUTHOR("Intrinsyc Software Inc."); |
297 | MODULE_DESCRIPTION ("CPU frequency changing driver for the PXA architecture"); | 407 | MODULE_DESCRIPTION("CPU frequency changing driver for the PXA architecture"); |
298 | MODULE_LICENSE("GPL"); | 408 | MODULE_LICENSE("GPL"); |
299 | module_init(pxa_cpu_init); | 409 | module_init(pxa_cpu_init); |
300 | module_exit(pxa_cpu_exit); | 410 | module_exit(pxa_cpu_exit); |
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index 0993f4d1a0b..7b9bdd0c666 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -396,7 +396,7 @@ static struct pxafb_mach_info sharp_lm8v31 = { | |||
396 | .cmap_inverse = 0, | 396 | .cmap_inverse = 0, |
397 | .cmap_static = 0, | 397 | .cmap_static = 0, |
398 | .lcd_conn = LCD_COLOR_DSTN_16BPP | LCD_PCLK_EDGE_FALL | | 398 | .lcd_conn = LCD_COLOR_DSTN_16BPP | LCD_PCLK_EDGE_FALL | |
399 | LCD_AC_BIAS_FREQ(255); | 399 | LCD_AC_BIAS_FREQ(255), |
400 | }; | 400 | }; |
401 | 401 | ||
402 | #define MMC_POLL_RATE msecs_to_jiffies(1000) | 402 | #define MMC_POLL_RATE msecs_to_jiffies(1000) |
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c index ec1bbf333a3..7d4debbdcca 100644 --- a/arch/arm/mach-pxa/pm.c +++ b/arch/arm/mach-pxa/pm.c | |||
@@ -42,20 +42,17 @@ int pxa_pm_enter(suspend_state_t state) | |||
42 | if (state != PM_SUSPEND_STANDBY) { | 42 | if (state != PM_SUSPEND_STANDBY) { |
43 | pxa_cpu_pm_fns->save(sleep_save); | 43 | pxa_cpu_pm_fns->save(sleep_save); |
44 | /* before sleeping, calculate and save a checksum */ | 44 | /* before sleeping, calculate and save a checksum */ |
45 | for (i = 0; i < pxa_cpu_pm_fns->save_size - 1; i++) | 45 | for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++) |
46 | sleep_save_checksum += sleep_save[i]; | 46 | sleep_save_checksum += sleep_save[i]; |
47 | } | 47 | } |
48 | 48 | ||
49 | /* Clear reset status */ | ||
50 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
51 | |||
52 | /* *** go zzz *** */ | 49 | /* *** go zzz *** */ |
53 | pxa_cpu_pm_fns->enter(state); | 50 | pxa_cpu_pm_fns->enter(state); |
54 | cpu_init(); | 51 | cpu_init(); |
55 | 52 | ||
56 | if (state != PM_SUSPEND_STANDBY) { | 53 | if (state != PM_SUSPEND_STANDBY) { |
57 | /* after sleeping, validate the checksum */ | 54 | /* after sleeping, validate the checksum */ |
58 | for (i = 0; i < pxa_cpu_pm_fns->save_size - 1; i++) | 55 | for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++) |
59 | checksum += sleep_save[i]; | 56 | checksum += sleep_save[i]; |
60 | 57 | ||
61 | /* if invalid, display message and wait for a hardware reset */ | 58 | /* if invalid, display message and wait for a hardware reset */ |
@@ -101,7 +98,8 @@ static int __init pxa_pm_init(void) | |||
101 | return -EINVAL; | 98 | return -EINVAL; |
102 | } | 99 | } |
103 | 100 | ||
104 | sleep_save = kmalloc(pxa_cpu_pm_fns->save_size, GFP_KERNEL); | 101 | sleep_save = kmalloc(pxa_cpu_pm_fns->save_count * sizeof(unsigned long), |
102 | GFP_KERNEL); | ||
105 | if (!sleep_save) { | 103 | if (!sleep_save) { |
106 | printk(KERN_ERR "failed to alloc memory for pm save\n"); | 104 | printk(KERN_ERR "failed to alloc memory for pm save\n"); |
107 | return -ENOMEM; | 105 | return -ENOMEM; |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index ca5ac196b47..0b30f25cff3 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -326,13 +326,11 @@ static struct platform_device *devices[] __initdata = { | |||
326 | 326 | ||
327 | static void poodle_poweroff(void) | 327 | static void poodle_poweroff(void) |
328 | { | 328 | { |
329 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
330 | arm_machine_restart('h'); | 329 | arm_machine_restart('h'); |
331 | } | 330 | } |
332 | 331 | ||
333 | static void poodle_restart(char mode) | 332 | static void poodle_restart(char mode) |
334 | { | 333 | { |
335 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
336 | arm_machine_restart('h'); | 334 | arm_machine_restart('h'); |
337 | } | 335 | } |
338 | 336 | ||
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index d9b5450aee5..e5b417d14bb 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c | |||
@@ -150,9 +150,7 @@ static struct clk pxa25x_clks[] = { | |||
150 | * More ones like CP and general purpose register values are preserved | 150 | * More ones like CP and general purpose register values are preserved |
151 | * with the stack pointer in sleep.S. | 151 | * with the stack pointer in sleep.S. |
152 | */ | 152 | */ |
153 | enum { SLEEP_SAVE_START = 0, | 153 | enum { SLEEP_SAVE_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2, |
154 | |||
155 | SLEEP_SAVE_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2, | ||
156 | 154 | ||
157 | SLEEP_SAVE_GAFR0_L, SLEEP_SAVE_GAFR0_U, | 155 | SLEEP_SAVE_GAFR0_L, SLEEP_SAVE_GAFR0_U, |
158 | SLEEP_SAVE_GAFR1_L, SLEEP_SAVE_GAFR1_U, | 156 | SLEEP_SAVE_GAFR1_L, SLEEP_SAVE_GAFR1_U, |
@@ -162,7 +160,7 @@ enum { SLEEP_SAVE_START = 0, | |||
162 | 160 | ||
163 | SLEEP_SAVE_CKEN, | 161 | SLEEP_SAVE_CKEN, |
164 | 162 | ||
165 | SLEEP_SAVE_SIZE | 163 | SLEEP_SAVE_COUNT |
166 | }; | 164 | }; |
167 | 165 | ||
168 | 166 | ||
@@ -200,6 +198,9 @@ static void pxa25x_cpu_pm_restore(unsigned long *sleep_save) | |||
200 | 198 | ||
201 | static void pxa25x_cpu_pm_enter(suspend_state_t state) | 199 | static void pxa25x_cpu_pm_enter(suspend_state_t state) |
202 | { | 200 | { |
201 | /* Clear reset status */ | ||
202 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
203 | |||
203 | switch (state) { | 204 | switch (state) { |
204 | case PM_SUSPEND_MEM: | 205 | case PM_SUSPEND_MEM: |
205 | /* set resume return address */ | 206 | /* set resume return address */ |
@@ -210,7 +211,7 @@ static void pxa25x_cpu_pm_enter(suspend_state_t state) | |||
210 | } | 211 | } |
211 | 212 | ||
212 | static struct pxa_cpu_pm_fns pxa25x_cpu_pm_fns = { | 213 | static struct pxa_cpu_pm_fns pxa25x_cpu_pm_fns = { |
213 | .save_size = SLEEP_SAVE_SIZE, | 214 | .save_count = SLEEP_SAVE_COUNT, |
214 | .valid = suspend_valid_only_mem, | 215 | .valid = suspend_valid_only_mem, |
215 | .save = pxa25x_cpu_pm_save, | 216 | .save = pxa25x_cpu_pm_save, |
216 | .restore = pxa25x_cpu_pm_restore, | 217 | .restore = pxa25x_cpu_pm_restore, |
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 7a2449dd0fd..7e945836e12 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -181,9 +181,7 @@ static struct clk pxa27x_clks[] = { | |||
181 | * More ones like CP and general purpose register values are preserved | 181 | * More ones like CP and general purpose register values are preserved |
182 | * with the stack pointer in sleep.S. | 182 | * with the stack pointer in sleep.S. |
183 | */ | 183 | */ |
184 | enum { SLEEP_SAVE_START = 0, | 184 | enum { SLEEP_SAVE_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2, SLEEP_SAVE_PGSR3, |
185 | |||
186 | SLEEP_SAVE_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2, SLEEP_SAVE_PGSR3, | ||
187 | 185 | ||
188 | SLEEP_SAVE_GAFR0_L, SLEEP_SAVE_GAFR0_U, | 186 | SLEEP_SAVE_GAFR0_L, SLEEP_SAVE_GAFR0_U, |
189 | SLEEP_SAVE_GAFR1_L, SLEEP_SAVE_GAFR1_U, | 187 | SLEEP_SAVE_GAFR1_L, SLEEP_SAVE_GAFR1_U, |
@@ -198,7 +196,7 @@ enum { SLEEP_SAVE_START = 0, | |||
198 | SLEEP_SAVE_PWER, SLEEP_SAVE_PCFR, SLEEP_SAVE_PRER, | 196 | SLEEP_SAVE_PWER, SLEEP_SAVE_PCFR, SLEEP_SAVE_PRER, |
199 | SLEEP_SAVE_PFER, SLEEP_SAVE_PKWR, | 197 | SLEEP_SAVE_PFER, SLEEP_SAVE_PKWR, |
200 | 198 | ||
201 | SLEEP_SAVE_SIZE | 199 | SLEEP_SAVE_COUNT |
202 | }; | 200 | }; |
203 | 201 | ||
204 | void pxa27x_cpu_pm_save(unsigned long *sleep_save) | 202 | void pxa27x_cpu_pm_save(unsigned long *sleep_save) |
@@ -251,6 +249,9 @@ void pxa27x_cpu_pm_enter(suspend_state_t state) | |||
251 | /* Clear edge-detect status register. */ | 249 | /* Clear edge-detect status register. */ |
252 | PEDR = 0xDF12FE1B; | 250 | PEDR = 0xDF12FE1B; |
253 | 251 | ||
252 | /* Clear reset status */ | ||
253 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
254 | |||
254 | switch (state) { | 255 | switch (state) { |
255 | case PM_SUSPEND_STANDBY: | 256 | case PM_SUSPEND_STANDBY: |
256 | pxa_cpu_standby(); | 257 | pxa_cpu_standby(); |
@@ -269,7 +270,7 @@ static int pxa27x_cpu_pm_valid(suspend_state_t state) | |||
269 | } | 270 | } |
270 | 271 | ||
271 | static struct pxa_cpu_pm_fns pxa27x_cpu_pm_fns = { | 272 | static struct pxa_cpu_pm_fns pxa27x_cpu_pm_fns = { |
272 | .save_size = SLEEP_SAVE_SIZE, | 273 | .save_count = SLEEP_SAVE_COUNT, |
273 | .save = pxa27x_cpu_pm_save, | 274 | .save = pxa27x_cpu_pm_save, |
274 | .restore = pxa27x_cpu_pm_restore, | 275 | .restore = pxa27x_cpu_pm_restore, |
275 | .valid = pxa27x_cpu_pm_valid, | 276 | .valid = pxa27x_cpu_pm_valid, |
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index b6a6f5fcc77..644550bfa33 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
@@ -256,12 +256,11 @@ static unsigned long wakeup_src; | |||
256 | #define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x | 256 | #define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x |
257 | #define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x] | 257 | #define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x] |
258 | 258 | ||
259 | enum { SLEEP_SAVE_START = 0, | 259 | enum { SLEEP_SAVE_CKENA, |
260 | SLEEP_SAVE_CKENA, | ||
261 | SLEEP_SAVE_CKENB, | 260 | SLEEP_SAVE_CKENB, |
262 | SLEEP_SAVE_ACCR, | 261 | SLEEP_SAVE_ACCR, |
263 | 262 | ||
264 | SLEEP_SAVE_SIZE, | 263 | SLEEP_SAVE_COUNT, |
265 | }; | 264 | }; |
266 | 265 | ||
267 | static void pxa3xx_cpu_pm_save(unsigned long *sleep_save) | 266 | static void pxa3xx_cpu_pm_save(unsigned long *sleep_save) |
@@ -376,7 +375,7 @@ static int pxa3xx_cpu_pm_valid(suspend_state_t state) | |||
376 | } | 375 | } |
377 | 376 | ||
378 | static struct pxa_cpu_pm_fns pxa3xx_cpu_pm_fns = { | 377 | static struct pxa_cpu_pm_fns pxa3xx_cpu_pm_fns = { |
379 | .save_size = SLEEP_SAVE_SIZE, | 378 | .save_count = SLEEP_SAVE_COUNT, |
380 | .save = pxa3xx_cpu_pm_save, | 379 | .save = pxa3xx_cpu_pm_save, |
381 | .restore = pxa3xx_cpu_pm_restore, | 380 | .restore = pxa3xx_cpu_pm_restore, |
382 | .valid = pxa3xx_cpu_pm_valid, | 381 | .valid = pxa3xx_cpu_pm_valid, |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 62a02c3927c..e7d0fcd9b43 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -529,8 +529,6 @@ static struct platform_device *devices[] __initdata = { | |||
529 | 529 | ||
530 | static void spitz_poweroff(void) | 530 | static void spitz_poweroff(void) |
531 | { | 531 | { |
532 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
533 | |||
534 | pxa_gpio_mode(SPITZ_GPIO_ON_RESET | GPIO_OUT); | 532 | pxa_gpio_mode(SPITZ_GPIO_ON_RESET | GPIO_OUT); |
535 | GPSR(SPITZ_GPIO_ON_RESET) = GPIO_bit(SPITZ_GPIO_ON_RESET); | 533 | GPSR(SPITZ_GPIO_ON_RESET) = GPIO_bit(SPITZ_GPIO_ON_RESET); |
536 | 534 | ||
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c index 7a7f5f947cc..23f050feb20 100644 --- a/arch/arm/mach-pxa/spitz_pm.c +++ b/arch/arm/mach-pxa/spitz_pm.c | |||
@@ -119,9 +119,6 @@ static void spitz_presuspend(void) | |||
119 | /* nRESET_OUT Disable */ | 119 | /* nRESET_OUT Disable */ |
120 | PSLR |= PSLR_SL_ROD; | 120 | PSLR |= PSLR_SL_ROD; |
121 | 121 | ||
122 | /* Clear reset status */ | ||
123 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
124 | |||
125 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ | 122 | /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ |
126 | PCFR = PCFR_GPR_EN | PCFR_OPDE; | 123 | PCFR = PCFR_GPR_EN | PCFR_OPDE; |
127 | } | 124 | } |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 6458f6d371d..c2cbd66db81 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -467,8 +467,6 @@ static struct platform_device *devices[] __initdata = { | |||
467 | 467 | ||
468 | static void tosa_poweroff(void) | 468 | static void tosa_poweroff(void) |
469 | { | 469 | { |
470 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
471 | |||
472 | pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_OUT); | 470 | pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_OUT); |
473 | GPSR(TOSA_GPIO_ON_RESET) = GPIO_bit(TOSA_GPIO_ON_RESET); | 471 | GPSR(TOSA_GPIO_ON_RESET) = GPIO_bit(TOSA_GPIO_ON_RESET); |
474 | 472 | ||
diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c index 246c573e725..1693d447a22 100644 --- a/arch/arm/mach-sa1100/pm.c +++ b/arch/arm/mach-sa1100/pm.c | |||
@@ -43,20 +43,18 @@ extern void sa1100_cpu_resume(void); | |||
43 | * More ones like CP and general purpose register values are preserved | 43 | * More ones like CP and general purpose register values are preserved |
44 | * on the stack and then the stack pointer is stored last in sleep.S. | 44 | * on the stack and then the stack pointer is stored last in sleep.S. |
45 | */ | 45 | */ |
46 | enum { SLEEP_SAVE_SP = 0, | 46 | enum { SLEEP_SAVE_GPDR, SLEEP_SAVE_GAFR, |
47 | |||
48 | SLEEP_SAVE_GPDR, SLEEP_SAVE_GAFR, | ||
49 | SLEEP_SAVE_PPDR, SLEEP_SAVE_PPSR, SLEEP_SAVE_PPAR, SLEEP_SAVE_PSDR, | 47 | SLEEP_SAVE_PPDR, SLEEP_SAVE_PPSR, SLEEP_SAVE_PPAR, SLEEP_SAVE_PSDR, |
50 | 48 | ||
51 | SLEEP_SAVE_Ser1SDCR0, | 49 | SLEEP_SAVE_Ser1SDCR0, |
52 | 50 | ||
53 | SLEEP_SAVE_SIZE | 51 | SLEEP_SAVE_COUNT |
54 | }; | 52 | }; |
55 | 53 | ||
56 | 54 | ||
57 | static int sa11x0_pm_enter(suspend_state_t state) | 55 | static int sa11x0_pm_enter(suspend_state_t state) |
58 | { | 56 | { |
59 | unsigned long gpio, sleep_save[SLEEP_SAVE_SIZE]; | 57 | unsigned long gpio, sleep_save[SLEEP_SAVE_COUNT]; |
60 | 58 | ||
61 | gpio = GPLR; | 59 | gpio = GPLR; |
62 | 60 | ||
diff --git a/arch/arm/plat-s3c24xx/clock.c b/arch/arm/plat-s3c24xx/clock.c index d84167fb33b..3ac8d8d781b 100644 --- a/arch/arm/plat-s3c24xx/clock.c +++ b/arch/arm/plat-s3c24xx/clock.c | |||
@@ -411,7 +411,7 @@ static int s3c24xx_clkout_setparent(struct clk *clk, struct clk *parent) | |||
411 | 411 | ||
412 | clk->parent = parent; | 412 | clk->parent = parent; |
413 | 413 | ||
414 | if (clk == &s3c24xx_dclk0) | 414 | if (clk == &s3c24xx_clkout0) |
415 | mask = S3C2410_MISCCR_CLK0_MASK; | 415 | mask = S3C2410_MISCCR_CLK0_MASK; |
416 | else { | 416 | else { |
417 | source <<= 4; | 417 | source <<= 4; |
@@ -437,7 +437,7 @@ struct clk s3c24xx_dclk0 = { | |||
437 | struct clk s3c24xx_dclk1 = { | 437 | struct clk s3c24xx_dclk1 = { |
438 | .name = "dclk1", | 438 | .name = "dclk1", |
439 | .id = -1, | 439 | .id = -1, |
440 | .ctrlbit = S3C2410_DCLKCON_DCLK0EN, | 440 | .ctrlbit = S3C2410_DCLKCON_DCLK1EN, |
441 | .enable = s3c24xx_dclk_enable, | 441 | .enable = s3c24xx_dclk_enable, |
442 | .set_parent = s3c24xx_dclk_setparent, | 442 | .set_parent = s3c24xx_dclk_setparent, |
443 | .set_rate = s3c24xx_set_dclk_rate, | 443 | .set_rate = s3c24xx_set_dclk_rate, |
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 795d0ac67c2..fd5708523f2 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -832,6 +832,7 @@ config BANK_0 | |||
832 | config BANK_1 | 832 | config BANK_1 |
833 | hex "Bank 1" | 833 | hex "Bank 1" |
834 | default 0x7BB0 | 834 | default 0x7BB0 |
835 | default 0x5558 if BF54x | ||
835 | 836 | ||
836 | config BANK_2 | 837 | config BANK_2 |
837 | hex "Bank 2" | 838 | hex "Bank 2" |
@@ -963,21 +964,22 @@ endchoice | |||
963 | 964 | ||
964 | endmenu | 965 | endmenu |
965 | 966 | ||
966 | if (BF537 || BF533 || BF54x) | ||
967 | |||
968 | menu "CPU Frequency scaling" | 967 | menu "CPU Frequency scaling" |
969 | 968 | ||
970 | source "drivers/cpufreq/Kconfig" | 969 | source "drivers/cpufreq/Kconfig" |
971 | 970 | ||
972 | config CPU_FREQ | 971 | config CPU_VOLTAGE |
973 | bool | 972 | bool "CPU Voltage scaling" |
973 | depends on EXPERIMENTAL | ||
974 | depends on CPU_FREQ | ||
974 | default n | 975 | default n |
975 | help | 976 | help |
976 | If you want to enable this option, you should select the | 977 | Say Y here if you want CPU voltage scaling according to the CPU frequency. |
977 | DPMC driver from Character Devices. | 978 | This option violates the PLL BYPASS recommendation in the Blackfin Processor |
978 | endmenu | 979 | manuals. There is a theoretical risk that during VDDINT transitions |
980 | the PLL may unlock. | ||
979 | 981 | ||
980 | endif | 982 | endmenu |
981 | 983 | ||
982 | source "net/Kconfig" | 984 | source "net/Kconfig" |
983 | 985 | ||
diff --git a/arch/blackfin/kernel/asm-offsets.c b/arch/blackfin/kernel/asm-offsets.c index 721f15f3ceb..881afe9082c 100644 --- a/arch/blackfin/kernel/asm-offsets.c +++ b/arch/blackfin/kernel/asm-offsets.c | |||
@@ -56,9 +56,6 @@ int main(void) | |||
56 | /* offsets into the thread struct */ | 56 | /* offsets into the thread struct */ |
57 | DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); | 57 | DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); |
58 | DEFINE(THREAD_USP, offsetof(struct thread_struct, usp)); | 58 | DEFINE(THREAD_USP, offsetof(struct thread_struct, usp)); |
59 | DEFINE(THREAD_SR, offsetof(struct thread_struct, seqstat)); | ||
60 | DEFINE(PT_SR, offsetof(struct thread_struct, seqstat)); | ||
61 | DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0)); | ||
62 | DEFINE(THREAD_PC, offsetof(struct thread_struct, pc)); | 59 | DEFINE(THREAD_PC, offsetof(struct thread_struct, pc)); |
63 | DEFINE(KERNEL_STACK_SIZE, THREAD_SIZE); | 60 | DEFINE(KERNEL_STACK_SIZE, THREAD_SIZE); |
64 | 61 | ||
diff --git a/arch/blackfin/kernel/fixed_code.S b/arch/blackfin/kernel/fixed_code.S index 5ed47228a39..4b03ba02548 100644 --- a/arch/blackfin/kernel/fixed_code.S +++ b/arch/blackfin/kernel/fixed_code.S | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * This file contains sequences of code that will be copied to a | 2 | * This file contains sequences of code that will be copied to a |
3 | * fixed location, defined in <asm/atomic_seq.h>. The interrupt | 3 | * fixed location, defined in <asm/fixed_code.h>. The interrupt |
4 | * handlers ensure that these sequences appear to be atomic when | 4 | * handlers ensure that these sequences appear to be atomic when |
5 | * executed from userspace. | 5 | * executed from userspace. |
6 | * These are aligned to 16 bytes, so that we have some space to replace | 6 | * These are aligned to 16 bytes, so that we have some space to replace |
diff --git a/arch/blackfin/kernel/module.c b/arch/blackfin/kernel/module.c index 8b9fe29d03f..14a42848f37 100644 --- a/arch/blackfin/kernel/module.c +++ b/arch/blackfin/kernel/module.c | |||
@@ -160,6 +160,13 @@ int | |||
160 | module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, | 160 | module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, |
161 | char *secstrings, struct module *mod) | 161 | char *secstrings, struct module *mod) |
162 | { | 162 | { |
163 | /* | ||
164 | * XXX: sechdrs are vmalloced in kernel/module.c | ||
165 | * and would be vfreed just after module is loaded, | ||
166 | * so we hack to keep the only information we needed | ||
167 | * in mod->arch to correctly free L1 I/D sram later. | ||
168 | * NOTE: this breaks the semantic of mod->arch structure. | ||
169 | */ | ||
163 | Elf_Shdr *s, *sechdrs_end = sechdrs + hdr->e_shnum; | 170 | Elf_Shdr *s, *sechdrs_end = sechdrs + hdr->e_shnum; |
164 | void *dest = NULL; | 171 | void *dest = NULL; |
165 | 172 | ||
@@ -167,8 +174,8 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, | |||
167 | if ((strcmp(".l1.text", secstrings + s->sh_name) == 0) || | 174 | if ((strcmp(".l1.text", secstrings + s->sh_name) == 0) || |
168 | ((strcmp(".text", secstrings + s->sh_name) == 0) && | 175 | ((strcmp(".text", secstrings + s->sh_name) == 0) && |
169 | (hdr->e_flags & FLG_CODE_IN_L1) && (s->sh_size > 0))) { | 176 | (hdr->e_flags & FLG_CODE_IN_L1) && (s->sh_size > 0))) { |
170 | mod->arch.text_l1 = s; | ||
171 | dest = l1_inst_sram_alloc(s->sh_size); | 177 | dest = l1_inst_sram_alloc(s->sh_size); |
178 | mod->arch.text_l1 = dest; | ||
172 | if (dest == NULL) { | 179 | if (dest == NULL) { |
173 | printk(KERN_ERR | 180 | printk(KERN_ERR |
174 | "module %s: L1 instruction memory allocation failed\n", | 181 | "module %s: L1 instruction memory allocation failed\n", |
@@ -182,8 +189,8 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, | |||
182 | if ((strcmp(".l1.data", secstrings + s->sh_name) == 0) || | 189 | if ((strcmp(".l1.data", secstrings + s->sh_name) == 0) || |
183 | ((strcmp(".data", secstrings + s->sh_name) == 0) && | 190 | ((strcmp(".data", secstrings + s->sh_name) == 0) && |
184 | (hdr->e_flags & FLG_DATA_IN_L1) && (s->sh_size > 0))) { | 191 | (hdr->e_flags & FLG_DATA_IN_L1) && (s->sh_size > 0))) { |
185 | mod->arch.data_a_l1 = s; | ||
186 | dest = l1_data_sram_alloc(s->sh_size); | 192 | dest = l1_data_sram_alloc(s->sh_size); |
193 | mod->arch.data_a_l1 = dest; | ||
187 | if (dest == NULL) { | 194 | if (dest == NULL) { |
188 | printk(KERN_ERR | 195 | printk(KERN_ERR |
189 | "module %s: L1 data memory allocation failed\n", | 196 | "module %s: L1 data memory allocation failed\n", |
@@ -197,8 +204,8 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, | |||
197 | if (strcmp(".l1.bss", secstrings + s->sh_name) == 0 || | 204 | if (strcmp(".l1.bss", secstrings + s->sh_name) == 0 || |
198 | ((strcmp(".bss", secstrings + s->sh_name) == 0) && | 205 | ((strcmp(".bss", secstrings + s->sh_name) == 0) && |
199 | (hdr->e_flags & FLG_DATA_IN_L1) && (s->sh_size > 0))) { | 206 | (hdr->e_flags & FLG_DATA_IN_L1) && (s->sh_size > 0))) { |
200 | mod->arch.bss_a_l1 = s; | ||
201 | dest = l1_data_sram_alloc(s->sh_size); | 207 | dest = l1_data_sram_alloc(s->sh_size); |
208 | mod->arch.bss_a_l1 = dest; | ||
202 | if (dest == NULL) { | 209 | if (dest == NULL) { |
203 | printk(KERN_ERR | 210 | printk(KERN_ERR |
204 | "module %s: L1 data memory allocation failed\n", | 211 | "module %s: L1 data memory allocation failed\n", |
@@ -210,8 +217,8 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, | |||
210 | s->sh_addr = (unsigned long)dest; | 217 | s->sh_addr = (unsigned long)dest; |
211 | } | 218 | } |
212 | if (strcmp(".l1.data.B", secstrings + s->sh_name) == 0) { | 219 | if (strcmp(".l1.data.B", secstrings + s->sh_name) == 0) { |
213 | mod->arch.data_b_l1 = s; | ||
214 | dest = l1_data_B_sram_alloc(s->sh_size); | 220 | dest = l1_data_B_sram_alloc(s->sh_size); |
221 | mod->arch.data_b_l1 = dest; | ||
215 | if (dest == NULL) { | 222 | if (dest == NULL) { |
216 | printk(KERN_ERR | 223 | printk(KERN_ERR |
217 | "module %s: L1 data memory allocation failed\n", | 224 | "module %s: L1 data memory allocation failed\n", |
@@ -223,8 +230,8 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, | |||
223 | s->sh_addr = (unsigned long)dest; | 230 | s->sh_addr = (unsigned long)dest; |
224 | } | 231 | } |
225 | if (strcmp(".l1.bss.B", secstrings + s->sh_name) == 0) { | 232 | if (strcmp(".l1.bss.B", secstrings + s->sh_name) == 0) { |
226 | mod->arch.bss_b_l1 = s; | ||
227 | dest = l1_data_B_sram_alloc(s->sh_size); | 233 | dest = l1_data_B_sram_alloc(s->sh_size); |
234 | mod->arch.bss_b_l1 = dest; | ||
228 | if (dest == NULL) { | 235 | if (dest == NULL) { |
229 | printk(KERN_ERR | 236 | printk(KERN_ERR |
230 | "module %s: L1 data memory allocation failed\n", | 237 | "module %s: L1 data memory allocation failed\n", |
@@ -416,14 +423,14 @@ module_finalize(const Elf_Ehdr * hdr, | |||
416 | 423 | ||
417 | void module_arch_cleanup(struct module *mod) | 424 | void module_arch_cleanup(struct module *mod) |
418 | { | 425 | { |
419 | if ((mod->arch.text_l1) && (mod->arch.text_l1->sh_addr)) | 426 | if (mod->arch.text_l1) |
420 | l1_inst_sram_free((void *)mod->arch.text_l1->sh_addr); | 427 | l1_inst_sram_free((void *)mod->arch.text_l1); |
421 | if ((mod->arch.data_a_l1) && (mod->arch.data_a_l1->sh_addr)) | 428 | if (mod->arch.data_a_l1) |
422 | l1_data_sram_free((void *)mod->arch.data_a_l1->sh_addr); | 429 | l1_data_sram_free((void *)mod->arch.data_a_l1); |
423 | if ((mod->arch.bss_a_l1) && (mod->arch.bss_a_l1->sh_addr)) | 430 | if (mod->arch.bss_a_l1) |
424 | l1_data_sram_free((void *)mod->arch.bss_a_l1->sh_addr); | 431 | l1_data_sram_free((void *)mod->arch.bss_a_l1); |
425 | if ((mod->arch.data_b_l1) && (mod->arch.data_b_l1->sh_addr)) | 432 | if (mod->arch.data_b_l1) |
426 | l1_data_B_sram_free((void *)mod->arch.data_b_l1->sh_addr); | 433 | l1_data_B_sram_free((void *)mod->arch.data_b_l1); |
427 | if ((mod->arch.bss_b_l1) && (mod->arch.bss_b_l1->sh_addr)) | 434 | if (mod->arch.bss_b_l1) |
428 | l1_data_B_sram_free((void *)mod->arch.bss_b_l1->sh_addr); | 435 | l1_data_B_sram_free((void *)mod->arch.bss_b_l1); |
429 | } | 436 | } |
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c index be9fdd00d7c..53c2cd25544 100644 --- a/arch/blackfin/kernel/process.c +++ b/arch/blackfin/kernel/process.c | |||
@@ -245,7 +245,7 @@ unsigned long get_wchan(struct task_struct *p) | |||
245 | 245 | ||
246 | void finish_atomic_sections (struct pt_regs *regs) | 246 | void finish_atomic_sections (struct pt_regs *regs) |
247 | { | 247 | { |
248 | int __user *up0 = (int __user *)®s->p0; | 248 | int __user *up0 = (int __user *)regs->p0; |
249 | 249 | ||
250 | if (regs->pc < ATOMIC_SEQS_START || regs->pc >= ATOMIC_SEQS_END) | 250 | if (regs->pc < ATOMIC_SEQS_START || regs->pc >= ATOMIC_SEQS_END) |
251 | return; | 251 | return; |
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c index b4f062c172c..f51ab088098 100644 --- a/arch/blackfin/kernel/ptrace.c +++ b/arch/blackfin/kernel/ptrace.c | |||
@@ -185,8 +185,8 @@ void ptrace_disable(struct task_struct *child) | |||
185 | { | 185 | { |
186 | unsigned long tmp; | 186 | unsigned long tmp; |
187 | /* make sure the single step bit is not set. */ | 187 | /* make sure the single step bit is not set. */ |
188 | tmp = get_reg(child, PT_SR) & ~(TRACE_BITS << 16); | 188 | tmp = get_reg(child, PT_SYSCFG) & ~TRACE_BITS; |
189 | put_reg(child, PT_SR, tmp); | 189 | put_reg(child, PT_SYSCFG, tmp); |
190 | } | 190 | } |
191 | 191 | ||
192 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | 192 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
diff --git a/arch/blackfin/kernel/signal.c b/arch/blackfin/kernel/signal.c index cb9d883d493..dbc3bbf846b 100644 --- a/arch/blackfin/kernel/signal.c +++ b/arch/blackfin/kernel/signal.c | |||
@@ -42,6 +42,9 @@ | |||
42 | 42 | ||
43 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 43 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
44 | 44 | ||
45 | /* Location of the trace bit in SYSCFG. */ | ||
46 | #define TRACE_BITS 0x0001 | ||
47 | |||
45 | struct fdpic_func_descriptor { | 48 | struct fdpic_func_descriptor { |
46 | unsigned long text; | 49 | unsigned long text; |
47 | unsigned long GOT; | 50 | unsigned long GOT; |
@@ -225,6 +228,16 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t * info, | |||
225 | regs->r1 = (unsigned long)(&frame->info); | 228 | regs->r1 = (unsigned long)(&frame->info); |
226 | regs->r2 = (unsigned long)(&frame->uc); | 229 | regs->r2 = (unsigned long)(&frame->uc); |
227 | 230 | ||
231 | /* | ||
232 | * Clear the trace flag when entering the signal handler, but | ||
233 | * notify any tracer that was single-stepping it. The tracer | ||
234 | * may want to single-step inside the handler too. | ||
235 | */ | ||
236 | if (regs->syscfg & TRACE_BITS) { | ||
237 | regs->syscfg &= ~TRACE_BITS; | ||
238 | ptrace_notify(SIGTRAP); | ||
239 | } | ||
240 | |||
228 | return 0; | 241 | return 0; |
229 | 242 | ||
230 | give_sigsegv: | 243 | give_sigsegv: |
diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c index 4482c47c09e..e887efc86c2 100644 --- a/arch/blackfin/kernel/time-ts.c +++ b/arch/blackfin/kernel/time-ts.c | |||
@@ -60,7 +60,7 @@ static inline unsigned long long cycles_2_ns(cycle_t cyc) | |||
60 | 60 | ||
61 | static cycle_t read_cycles(void) | 61 | static cycle_t read_cycles(void) |
62 | { | 62 | { |
63 | return get_cycles(); | 63 | return __bfin_cycles_off + (get_cycles() << __bfin_cycles_mod); |
64 | } | 64 | } |
65 | 65 | ||
66 | unsigned long long sched_clock(void) | 66 | unsigned long long sched_clock(void) |
@@ -117,7 +117,7 @@ static void bfin_timer_set_mode(enum clock_event_mode mode, | |||
117 | break; | 117 | break; |
118 | } | 118 | } |
119 | case CLOCK_EVT_MODE_ONESHOT: | 119 | case CLOCK_EVT_MODE_ONESHOT: |
120 | bfin_write_TSCALE(0); | 120 | bfin_write_TSCALE(TIME_SCALE - 1); |
121 | bfin_write_TCOUNT(0); | 121 | bfin_write_TCOUNT(0); |
122 | bfin_write_TCNTL(TMPWR | TMREN); | 122 | bfin_write_TCNTL(TMPWR | TMREN); |
123 | CSYNC(); | 123 | CSYNC(); |
@@ -183,10 +183,14 @@ irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
183 | 183 | ||
184 | static int __init bfin_clockevent_init(void) | 184 | static int __init bfin_clockevent_init(void) |
185 | { | 185 | { |
186 | unsigned long timer_clk; | ||
187 | |||
188 | timer_clk = get_cclk() / TIME_SCALE; | ||
189 | |||
186 | setup_irq(IRQ_CORETMR, &bfin_timer_irq); | 190 | setup_irq(IRQ_CORETMR, &bfin_timer_irq); |
187 | bfin_timer_init(); | 191 | bfin_timer_init(); |
188 | 192 | ||
189 | clockevent_bfin.mult = div_sc(get_cclk(), NSEC_PER_SEC, clockevent_bfin.shift); | 193 | clockevent_bfin.mult = div_sc(timer_clk, NSEC_PER_SEC, clockevent_bfin.shift); |
190 | clockevent_bfin.max_delta_ns = clockevent_delta2ns(-1, &clockevent_bfin); | 194 | clockevent_bfin.max_delta_ns = clockevent_delta2ns(-1, &clockevent_bfin); |
191 | clockevent_bfin.min_delta_ns = clockevent_delta2ns(100, &clockevent_bfin); | 195 | clockevent_bfin.min_delta_ns = clockevent_delta2ns(100, &clockevent_bfin); |
192 | clockevents_register_device(&clockevent_bfin); | 196 | clockevents_register_device(&clockevent_bfin); |
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c index 583d53811f0..8aa49f80422 100644 --- a/arch/blackfin/mach-bf527/boards/ezkit.c +++ b/arch/blackfin/mach-bf527/boards/ezkit.c | |||
@@ -32,12 +32,14 @@ | |||
32 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
33 | #include <linux/mtd/mtd.h> | 33 | #include <linux/mtd/mtd.h> |
34 | #include <linux/mtd/partitions.h> | 34 | #include <linux/mtd/partitions.h> |
35 | #include <linux/mtd/physmap.h> | ||
35 | #include <linux/spi/spi.h> | 36 | #include <linux/spi/spi.h> |
36 | #include <linux/spi/flash.h> | 37 | #include <linux/spi/flash.h> |
37 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) | 38 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
38 | #include <linux/usb/isp1362.h> | 39 | #include <linux/usb/isp1362.h> |
39 | #endif | 40 | #endif |
40 | #include <linux/ata_platform.h> | 41 | #include <linux/ata_platform.h> |
42 | #include <linux/i2c.h> | ||
41 | #include <linux/irq.h> | 43 | #include <linux/irq.h> |
42 | #include <linux/interrupt.h> | 44 | #include <linux/interrupt.h> |
43 | #include <linux/usb/sl811.h> | 45 | #include <linux/usb/sl811.h> |
@@ -50,6 +52,7 @@ | |||
50 | #include <asm/reboot.h> | 52 | #include <asm/reboot.h> |
51 | #include <asm/nand.h> | 53 | #include <asm/nand.h> |
52 | #include <asm/portmux.h> | 54 | #include <asm/portmux.h> |
55 | #include <asm/dpmc.h> | ||
53 | #include <linux/spi/ad7877.h> | 56 | #include <linux/spi/ad7877.h> |
54 | 57 | ||
55 | /* | 58 | /* |
@@ -171,6 +174,46 @@ static struct platform_device bf52x_t350mcqb_device = { | |||
171 | }; | 174 | }; |
172 | #endif | 175 | #endif |
173 | 176 | ||
177 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | ||
178 | static struct mtd_partition ezkit_partitions[] = { | ||
179 | { | ||
180 | .name = "Bootloader", | ||
181 | .size = 0x40000, | ||
182 | .offset = 0, | ||
183 | }, { | ||
184 | .name = "Kernel", | ||
185 | .size = 0x1C0000, | ||
186 | .offset = MTDPART_OFS_APPEND, | ||
187 | }, { | ||
188 | .name = "RootFS", | ||
189 | .size = MTDPART_SIZ_FULL, | ||
190 | .offset = MTDPART_OFS_APPEND, | ||
191 | } | ||
192 | }; | ||
193 | |||
194 | static struct physmap_flash_data ezkit_flash_data = { | ||
195 | .width = 2, | ||
196 | .parts = ezkit_partitions, | ||
197 | .nr_parts = ARRAY_SIZE(ezkit_partitions), | ||
198 | }; | ||
199 | |||
200 | static struct resource ezkit_flash_resource = { | ||
201 | .start = 0x20000000, | ||
202 | .end = 0x203fffff, | ||
203 | .flags = IORESOURCE_MEM, | ||
204 | }; | ||
205 | |||
206 | static struct platform_device ezkit_flash_device = { | ||
207 | .name = "physmap-flash", | ||
208 | .id = 0, | ||
209 | .dev = { | ||
210 | .platform_data = &ezkit_flash_data, | ||
211 | }, | ||
212 | .num_resources = 1, | ||
213 | .resource = &ezkit_flash_resource, | ||
214 | }; | ||
215 | #endif | ||
216 | |||
174 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) | 217 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
175 | static struct mtd_partition partition_info[] = { | 218 | static struct mtd_partition partition_info[] = { |
176 | { | 219 | { |
@@ -420,11 +463,7 @@ static struct mtd_partition bfin_spi_flash_partitions[] = { | |||
420 | .offset = 0, | 463 | .offset = 0, |
421 | .mask_flags = MTD_CAP_ROM | 464 | .mask_flags = MTD_CAP_ROM |
422 | }, { | 465 | }, { |
423 | .name = "kernel", | 466 | .name = "linux kernel", |
424 | .size = 0xe0000, | ||
425 | .offset = MTDPART_OFS_APPEND, | ||
426 | }, { | ||
427 | .name = "file system", | ||
428 | .size = MTDPART_SIZ_FULL, | 467 | .size = MTDPART_SIZ_FULL, |
429 | .offset = MTDPART_OFS_APPEND, | 468 | .offset = MTDPART_OFS_APPEND, |
430 | } | 469 | } |
@@ -434,7 +473,7 @@ static struct flash_platform_data bfin_spi_flash_data = { | |||
434 | .name = "m25p80", | 473 | .name = "m25p80", |
435 | .parts = bfin_spi_flash_partitions, | 474 | .parts = bfin_spi_flash_partitions, |
436 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), | 475 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
437 | .type = "m25p64", | 476 | .type = "m25p16", |
438 | }; | 477 | }; |
439 | 478 | ||
440 | /* SPI flash chip (m25p64) */ | 479 | /* SPI flash chip (m25p64) */ |
@@ -755,6 +794,24 @@ static struct platform_device i2c_bfin_twi_device = { | |||
755 | }; | 794 | }; |
756 | #endif | 795 | #endif |
757 | 796 | ||
797 | #ifdef CONFIG_I2C_BOARDINFO | ||
798 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | ||
799 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | ||
800 | { | ||
801 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), | ||
802 | .type = "pcf8574_lcd", | ||
803 | }, | ||
804 | #endif | ||
805 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) | ||
806 | { | ||
807 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), | ||
808 | .type = "pcf8574_keypad", | ||
809 | .irq = IRQ_PF8, | ||
810 | }, | ||
811 | #endif | ||
812 | }; | ||
813 | #endif | ||
814 | |||
758 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | 815 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
759 | static struct platform_device bfin_sport0_uart_device = { | 816 | static struct platform_device bfin_sport0_uart_device = { |
760 | .name = "bfin-sport-uart", | 817 | .name = "bfin-sport-uart", |
@@ -839,7 +896,32 @@ static struct platform_device bfin_gpios_device = { | |||
839 | .resource = &bfin_gpios_resources, | 896 | .resource = &bfin_gpios_resources, |
840 | }; | 897 | }; |
841 | 898 | ||
899 | static const unsigned int cclk_vlev_datasheet[] = | ||
900 | { | ||
901 | VRPAIR(VLEV_100, 400000000), | ||
902 | VRPAIR(VLEV_105, 426000000), | ||
903 | VRPAIR(VLEV_110, 500000000), | ||
904 | VRPAIR(VLEV_115, 533000000), | ||
905 | VRPAIR(VLEV_120, 600000000), | ||
906 | }; | ||
907 | |||
908 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | ||
909 | .tuple_tab = cclk_vlev_datasheet, | ||
910 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | ||
911 | .vr_settling_time = 25 /* us */, | ||
912 | }; | ||
913 | |||
914 | static struct platform_device bfin_dpmc = { | ||
915 | .name = "bfin dpmc", | ||
916 | .dev = { | ||
917 | .platform_data = &bfin_dmpc_vreg_data, | ||
918 | }, | ||
919 | }; | ||
920 | |||
842 | static struct platform_device *stamp_devices[] __initdata = { | 921 | static struct platform_device *stamp_devices[] __initdata = { |
922 | |||
923 | &bfin_dpmc, | ||
924 | |||
843 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) | 925 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
844 | &bf5xx_nand_device, | 926 | &bf5xx_nand_device, |
845 | #endif | 927 | #endif |
@@ -921,12 +1003,22 @@ static struct platform_device *stamp_devices[] __initdata = { | |||
921 | &bfin_device_gpiokeys, | 1003 | &bfin_device_gpiokeys, |
922 | #endif | 1004 | #endif |
923 | 1005 | ||
1006 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | ||
1007 | &ezkit_flash_device, | ||
1008 | #endif | ||
1009 | |||
924 | &bfin_gpios_device, | 1010 | &bfin_gpios_device, |
925 | }; | 1011 | }; |
926 | 1012 | ||
927 | static int __init stamp_init(void) | 1013 | static int __init stamp_init(void) |
928 | { | 1014 | { |
929 | printk(KERN_INFO "%s(): registering device resources\n", __func__); | 1015 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
1016 | |||
1017 | #ifdef CONFIG_I2C_BOARDINFO | ||
1018 | i2c_register_board_info(0, bfin_i2c_board_info, | ||
1019 | ARRAY_SIZE(bfin_i2c_board_info)); | ||
1020 | #endif | ||
1021 | |||
930 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 1022 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
931 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | 1023 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
932 | spi_register_board_info(bfin_spi_board_info, | 1024 | spi_register_board_info(bfin_spi_board_info, |
diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c index a03149c7268..ed2b0b8f5dc 100644 --- a/arch/blackfin/mach-bf533/boards/cm_bf533.c +++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c | |||
@@ -33,12 +33,15 @@ | |||
33 | #include <linux/mtd/partitions.h> | 33 | #include <linux/mtd/partitions.h> |
34 | #include <linux/spi/spi.h> | 34 | #include <linux/spi/spi.h> |
35 | #include <linux/spi/flash.h> | 35 | #include <linux/spi/flash.h> |
36 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) | ||
36 | #include <linux/usb/isp1362.h> | 37 | #include <linux/usb/isp1362.h> |
38 | #endif | ||
37 | #include <linux/ata_platform.h> | 39 | #include <linux/ata_platform.h> |
38 | #include <linux/irq.h> | 40 | #include <linux/irq.h> |
39 | #include <asm/dma.h> | 41 | #include <asm/dma.h> |
40 | #include <asm/bfin5xx_spi.h> | 42 | #include <asm/bfin5xx_spi.h> |
41 | #include <asm/portmux.h> | 43 | #include <asm/portmux.h> |
44 | #include <asm/dpmc.h> | ||
42 | 45 | ||
43 | /* | 46 | /* |
44 | * Name the Board for the /proc/cpuinfo | 47 | * Name the Board for the /proc/cpuinfo |
@@ -341,7 +344,37 @@ static struct platform_device bfin_pata_device = { | |||
341 | }; | 344 | }; |
342 | #endif | 345 | #endif |
343 | 346 | ||
347 | static const unsigned int cclk_vlev_datasheet[] = | ||
348 | { | ||
349 | VRPAIR(VLEV_085, 250000000), | ||
350 | VRPAIR(VLEV_090, 376000000), | ||
351 | VRPAIR(VLEV_095, 426000000), | ||
352 | VRPAIR(VLEV_100, 426000000), | ||
353 | VRPAIR(VLEV_105, 476000000), | ||
354 | VRPAIR(VLEV_110, 476000000), | ||
355 | VRPAIR(VLEV_115, 476000000), | ||
356 | VRPAIR(VLEV_120, 600000000), | ||
357 | VRPAIR(VLEV_125, 600000000), | ||
358 | VRPAIR(VLEV_130, 600000000), | ||
359 | }; | ||
360 | |||
361 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | ||
362 | .tuple_tab = cclk_vlev_datasheet, | ||
363 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | ||
364 | .vr_settling_time = 25 /* us */, | ||
365 | }; | ||
366 | |||
367 | static struct platform_device bfin_dpmc = { | ||
368 | .name = "bfin dpmc", | ||
369 | .dev = { | ||
370 | .platform_data = &bfin_dmpc_vreg_data, | ||
371 | }, | ||
372 | }; | ||
373 | |||
344 | static struct platform_device *cm_bf533_devices[] __initdata = { | 374 | static struct platform_device *cm_bf533_devices[] __initdata = { |
375 | |||
376 | &bfin_dpmc, | ||
377 | |||
345 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) | 378 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
346 | &bfin_uart_device, | 379 | &bfin_uart_device, |
347 | #endif | 380 | #endif |
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c index 08a7943949a..9d28415163e 100644 --- a/arch/blackfin/mach-bf533/boards/ezkit.c +++ b/arch/blackfin/mach-bf533/boards/ezkit.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <asm/dma.h> | 42 | #include <asm/dma.h> |
43 | #include <asm/bfin5xx_spi.h> | 43 | #include <asm/bfin5xx_spi.h> |
44 | #include <asm/portmux.h> | 44 | #include <asm/portmux.h> |
45 | #include <asm/dpmc.h> | ||
45 | 46 | ||
46 | /* | 47 | /* |
47 | * Name the Board for the /proc/cpuinfo | 48 | * Name the Board for the /proc/cpuinfo |
@@ -350,7 +351,37 @@ static struct platform_device i2c_gpio_device = { | |||
350 | }; | 351 | }; |
351 | #endif | 352 | #endif |
352 | 353 | ||
354 | static const unsigned int cclk_vlev_datasheet[] = | ||
355 | { | ||
356 | VRPAIR(VLEV_085, 250000000), | ||
357 | VRPAIR(VLEV_090, 376000000), | ||
358 | VRPAIR(VLEV_095, 426000000), | ||
359 | VRPAIR(VLEV_100, 426000000), | ||
360 | VRPAIR(VLEV_105, 476000000), | ||
361 | VRPAIR(VLEV_110, 476000000), | ||
362 | VRPAIR(VLEV_115, 476000000), | ||
363 | VRPAIR(VLEV_120, 600000000), | ||
364 | VRPAIR(VLEV_125, 600000000), | ||
365 | VRPAIR(VLEV_130, 600000000), | ||
366 | }; | ||
367 | |||
368 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | ||
369 | .tuple_tab = cclk_vlev_datasheet, | ||
370 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | ||
371 | .vr_settling_time = 25 /* us */, | ||
372 | }; | ||
373 | |||
374 | static struct platform_device bfin_dpmc = { | ||
375 | .name = "bfin dpmc", | ||
376 | .dev = { | ||
377 | .platform_data = &bfin_dmpc_vreg_data, | ||
378 | }, | ||
379 | }; | ||
380 | |||
353 | static struct platform_device *ezkit_devices[] __initdata = { | 381 | static struct platform_device *ezkit_devices[] __initdata = { |
382 | |||
383 | &bfin_dpmc, | ||
384 | |||
354 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) | 385 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
355 | &smc91x_device, | 386 | &smc91x_device, |
356 | #endif | 387 | #endif |
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c index 024f418ae54..7fd35fb32fd 100644 --- a/arch/blackfin/mach-bf533/boards/stamp.c +++ b/arch/blackfin/mach-bf533/boards/stamp.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <asm/bfin5xx_spi.h> | 45 | #include <asm/bfin5xx_spi.h> |
46 | #include <asm/reboot.h> | 46 | #include <asm/reboot.h> |
47 | #include <asm/portmux.h> | 47 | #include <asm/portmux.h> |
48 | #include <asm/dpmc.h> | ||
48 | 49 | ||
49 | /* | 50 | /* |
50 | * Name the Board for the /proc/cpuinfo | 51 | * Name the Board for the /proc/cpuinfo |
@@ -516,7 +517,37 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |||
516 | }; | 517 | }; |
517 | #endif | 518 | #endif |
518 | 519 | ||
520 | static const unsigned int cclk_vlev_datasheet[] = | ||
521 | { | ||
522 | VRPAIR(VLEV_085, 250000000), | ||
523 | VRPAIR(VLEV_090, 376000000), | ||
524 | VRPAIR(VLEV_095, 426000000), | ||
525 | VRPAIR(VLEV_100, 426000000), | ||
526 | VRPAIR(VLEV_105, 476000000), | ||
527 | VRPAIR(VLEV_110, 476000000), | ||
528 | VRPAIR(VLEV_115, 476000000), | ||
529 | VRPAIR(VLEV_120, 600000000), | ||
530 | VRPAIR(VLEV_125, 600000000), | ||
531 | VRPAIR(VLEV_130, 600000000), | ||
532 | }; | ||
533 | |||
534 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | ||
535 | .tuple_tab = cclk_vlev_datasheet, | ||
536 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | ||
537 | .vr_settling_time = 25 /* us */, | ||
538 | }; | ||
539 | |||
540 | static struct platform_device bfin_dpmc = { | ||
541 | .name = "bfin dpmc", | ||
542 | .dev = { | ||
543 | .platform_data = &bfin_dmpc_vreg_data, | ||
544 | }, | ||
545 | }; | ||
546 | |||
519 | static struct platform_device *stamp_devices[] __initdata = { | 547 | static struct platform_device *stamp_devices[] __initdata = { |
548 | |||
549 | &bfin_dpmc, | ||
550 | |||
520 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) | 551 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
521 | &rtc_device, | 552 | &rtc_device, |
522 | #endif | 553 | #endif |
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c index d8a23cd9b9e..73f2142875e 100644 --- a/arch/blackfin/mach-bf537/boards/cm_bf537.c +++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c | |||
@@ -35,12 +35,15 @@ | |||
35 | #include <linux/mtd/partitions.h> | 35 | #include <linux/mtd/partitions.h> |
36 | #include <linux/spi/spi.h> | 36 | #include <linux/spi/spi.h> |
37 | #include <linux/spi/flash.h> | 37 | #include <linux/spi/flash.h> |
38 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) | ||
38 | #include <linux/usb/isp1362.h> | 39 | #include <linux/usb/isp1362.h> |
40 | #endif | ||
39 | #include <linux/ata_platform.h> | 41 | #include <linux/ata_platform.h> |
40 | #include <linux/irq.h> | 42 | #include <linux/irq.h> |
41 | #include <asm/dma.h> | 43 | #include <asm/dma.h> |
42 | #include <asm/bfin5xx_spi.h> | 44 | #include <asm/bfin5xx_spi.h> |
43 | #include <asm/portmux.h> | 45 | #include <asm/portmux.h> |
46 | #include <asm/dpmc.h> | ||
44 | 47 | ||
45 | /* | 48 | /* |
46 | * Name the Board for the /proc/cpuinfo | 49 | * Name the Board for the /proc/cpuinfo |
@@ -428,7 +431,37 @@ static struct platform_device bfin_pata_device = { | |||
428 | }; | 431 | }; |
429 | #endif | 432 | #endif |
430 | 433 | ||
434 | static const unsigned int cclk_vlev_datasheet[] = | ||
435 | { | ||
436 | VRPAIR(VLEV_085, 250000000), | ||
437 | VRPAIR(VLEV_090, 376000000), | ||
438 | VRPAIR(VLEV_095, 426000000), | ||
439 | VRPAIR(VLEV_100, 426000000), | ||
440 | VRPAIR(VLEV_105, 476000000), | ||
441 | VRPAIR(VLEV_110, 476000000), | ||
442 | VRPAIR(VLEV_115, 476000000), | ||
443 | VRPAIR(VLEV_120, 500000000), | ||
444 | VRPAIR(VLEV_125, 533000000), | ||
445 | VRPAIR(VLEV_130, 600000000), | ||
446 | }; | ||
447 | |||
448 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | ||
449 | .tuple_tab = cclk_vlev_datasheet, | ||
450 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | ||
451 | .vr_settling_time = 25 /* us */, | ||
452 | }; | ||
453 | |||
454 | static struct platform_device bfin_dpmc = { | ||
455 | .name = "bfin dpmc", | ||
456 | .dev = { | ||
457 | .platform_data = &bfin_dmpc_vreg_data, | ||
458 | }, | ||
459 | }; | ||
460 | |||
431 | static struct platform_device *cm_bf537_devices[] __initdata = { | 461 | static struct platform_device *cm_bf537_devices[] __initdata = { |
462 | |||
463 | &bfin_dpmc, | ||
464 | |||
432 | #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE) | 465 | #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE) |
433 | &hitachi_fb_device, | 466 | &hitachi_fb_device, |
434 | #endif | 467 | #endif |
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c index d3727b7c2d7..9a756d1f3d7 100644 --- a/arch/blackfin/mach-bf537/boards/stamp.c +++ b/arch/blackfin/mach-bf537/boards/stamp.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <asm/bfin5xx_spi.h> | 47 | #include <asm/bfin5xx_spi.h> |
48 | #include <asm/reboot.h> | 48 | #include <asm/reboot.h> |
49 | #include <asm/portmux.h> | 49 | #include <asm/portmux.h> |
50 | #include <asm/dpmc.h> | ||
50 | #include <linux/spi/ad7877.h> | 51 | #include <linux/spi/ad7877.h> |
51 | 52 | ||
52 | /* | 53 | /* |
@@ -817,7 +818,37 @@ static struct platform_device bfin_pata_device = { | |||
817 | }; | 818 | }; |
818 | #endif | 819 | #endif |
819 | 820 | ||
821 | static const unsigned int cclk_vlev_datasheet[] = | ||
822 | { | ||
823 | VRPAIR(VLEV_085, 250000000), | ||
824 | VRPAIR(VLEV_090, 376000000), | ||
825 | VRPAIR(VLEV_095, 426000000), | ||
826 | VRPAIR(VLEV_100, 426000000), | ||
827 | VRPAIR(VLEV_105, 476000000), | ||
828 | VRPAIR(VLEV_110, 476000000), | ||
829 | VRPAIR(VLEV_115, 476000000), | ||
830 | VRPAIR(VLEV_120, 500000000), | ||
831 | VRPAIR(VLEV_125, 533000000), | ||
832 | VRPAIR(VLEV_130, 600000000), | ||
833 | }; | ||
834 | |||
835 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | ||
836 | .tuple_tab = cclk_vlev_datasheet, | ||
837 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | ||
838 | .vr_settling_time = 25 /* us */, | ||
839 | }; | ||
840 | |||
841 | static struct platform_device bfin_dpmc = { | ||
842 | .name = "bfin dpmc", | ||
843 | .dev = { | ||
844 | .platform_data = &bfin_dmpc_vreg_data, | ||
845 | }, | ||
846 | }; | ||
847 | |||
820 | static struct platform_device *stamp_devices[] __initdata = { | 848 | static struct platform_device *stamp_devices[] __initdata = { |
849 | |||
850 | &bfin_dpmc, | ||
851 | |||
821 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) | 852 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
822 | &bfin_pcmcia_cf_device, | 853 | &bfin_pcmcia_cf_device, |
823 | #endif | 854 | #endif |
diff --git a/arch/blackfin/mach-bf548/boards/cm_bf548.c b/arch/blackfin/mach-bf548/boards/cm_bf548.c index e3e8479fffb..3b74f96d359 100644 --- a/arch/blackfin/mach-bf548/boards/cm_bf548.c +++ b/arch/blackfin/mach-bf548/boards/cm_bf548.c | |||
@@ -36,7 +36,9 @@ | |||
36 | #include <linux/spi/flash.h> | 36 | #include <linux/spi/flash.h> |
37 | #include <linux/irq.h> | 37 | #include <linux/irq.h> |
38 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
39 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) | ||
39 | #include <linux/usb/musb.h> | 40 | #include <linux/usb/musb.h> |
41 | #endif | ||
40 | #include <asm/bfin5xx_spi.h> | 42 | #include <asm/bfin5xx_spi.h> |
41 | #include <asm/cplb.h> | 43 | #include <asm/cplb.h> |
42 | #include <asm/dma.h> | 44 | #include <asm/dma.h> |
@@ -44,6 +46,7 @@ | |||
44 | #include <asm/nand.h> | 46 | #include <asm/nand.h> |
45 | #include <asm/portmux.h> | 47 | #include <asm/portmux.h> |
46 | #include <asm/mach/bf54x_keys.h> | 48 | #include <asm/mach/bf54x_keys.h> |
49 | #include <asm/dpmc.h> | ||
47 | #include <linux/input.h> | 50 | #include <linux/input.h> |
48 | #include <linux/spi/ad7877.h> | 51 | #include <linux/spi/ad7877.h> |
49 | 52 | ||
@@ -590,7 +593,38 @@ static struct platform_device bfin_device_gpiokeys = { | |||
590 | }; | 593 | }; |
591 | #endif | 594 | #endif |
592 | 595 | ||
596 | static const unsigned int cclk_vlev_datasheet[] = | ||
597 | { | ||
598 | /* | ||
599 | * Internal VLEV BF54XSBBC1533 | ||
600 | ****temporarily using these values until data sheet is updated | ||
601 | */ | ||
602 | VRPAIR(VLEV_085, 150000000), | ||
603 | VRPAIR(VLEV_090, 250000000), | ||
604 | VRPAIR(VLEV_110, 276000000), | ||
605 | VRPAIR(VLEV_115, 301000000), | ||
606 | VRPAIR(VLEV_120, 525000000), | ||
607 | VRPAIR(VLEV_125, 550000000), | ||
608 | VRPAIR(VLEV_130, 600000000), | ||
609 | }; | ||
610 | |||
611 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | ||
612 | .tuple_tab = cclk_vlev_datasheet, | ||
613 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | ||
614 | .vr_settling_time = 25 /* us */, | ||
615 | }; | ||
616 | |||
617 | static struct platform_device bfin_dpmc = { | ||
618 | .name = "bfin dpmc", | ||
619 | .dev = { | ||
620 | .platform_data = &bfin_dmpc_vreg_data, | ||
621 | }, | ||
622 | }; | ||
623 | |||
593 | static struct platform_device *cm_bf548_devices[] __initdata = { | 624 | static struct platform_device *cm_bf548_devices[] __initdata = { |
625 | |||
626 | &bfin_dpmc, | ||
627 | |||
594 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) | 628 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
595 | &rtc_device, | 629 | &rtc_device, |
596 | #endif | 630 | #endif |
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c index b00f68ac6bc..d1682bb3750 100644 --- a/arch/blackfin/mach-bf548/boards/ezkit.c +++ b/arch/blackfin/mach-bf548/boards/ezkit.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/dma.h> | 46 | #include <asm/dma.h> |
47 | #include <asm/gpio.h> | 47 | #include <asm/gpio.h> |
48 | #include <asm/nand.h> | 48 | #include <asm/nand.h> |
49 | #include <asm/dpmc.h> | ||
49 | #include <asm/portmux.h> | 50 | #include <asm/portmux.h> |
50 | #include <asm/mach/bf54x_keys.h> | 51 | #include <asm/mach/bf54x_keys.h> |
51 | #include <linux/input.h> | 52 | #include <linux/input.h> |
@@ -689,7 +690,38 @@ static struct platform_device bfin_gpios_device = { | |||
689 | .resource = &bfin_gpios_resources, | 690 | .resource = &bfin_gpios_resources, |
690 | }; | 691 | }; |
691 | 692 | ||
693 | static const unsigned int cclk_vlev_datasheet[] = | ||
694 | { | ||
695 | /* | ||
696 | * Internal VLEV BF54XSBBC1533 | ||
697 | ****temporarily using these values until data sheet is updated | ||
698 | */ | ||
699 | VRPAIR(VLEV_085, 150000000), | ||
700 | VRPAIR(VLEV_090, 250000000), | ||
701 | VRPAIR(VLEV_110, 276000000), | ||
702 | VRPAIR(VLEV_115, 301000000), | ||
703 | VRPAIR(VLEV_120, 525000000), | ||
704 | VRPAIR(VLEV_125, 550000000), | ||
705 | VRPAIR(VLEV_130, 600000000), | ||
706 | }; | ||
707 | |||
708 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | ||
709 | .tuple_tab = cclk_vlev_datasheet, | ||
710 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | ||
711 | .vr_settling_time = 25 /* us */, | ||
712 | }; | ||
713 | |||
714 | static struct platform_device bfin_dpmc = { | ||
715 | .name = "bfin dpmc", | ||
716 | .dev = { | ||
717 | .platform_data = &bfin_dmpc_vreg_data, | ||
718 | }, | ||
719 | }; | ||
720 | |||
692 | static struct platform_device *ezkit_devices[] __initdata = { | 721 | static struct platform_device *ezkit_devices[] __initdata = { |
722 | |||
723 | &bfin_dpmc, | ||
724 | |||
693 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) | 725 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
694 | &rtc_device, | 726 | &rtc_device, |
695 | #endif | 727 | #endif |
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c index 9fd580952fd..466ef5929a2 100644 --- a/arch/blackfin/mach-bf561/boards/cm_bf561.c +++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c | |||
@@ -33,12 +33,15 @@ | |||
33 | #include <linux/mtd/partitions.h> | 33 | #include <linux/mtd/partitions.h> |
34 | #include <linux/spi/spi.h> | 34 | #include <linux/spi/spi.h> |
35 | #include <linux/spi/flash.h> | 35 | #include <linux/spi/flash.h> |
36 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) | ||
36 | #include <linux/usb/isp1362.h> | 37 | #include <linux/usb/isp1362.h> |
38 | #endif | ||
37 | #include <linux/ata_platform.h> | 39 | #include <linux/ata_platform.h> |
38 | #include <linux/irq.h> | 40 | #include <linux/irq.h> |
39 | #include <asm/dma.h> | 41 | #include <asm/dma.h> |
40 | #include <asm/bfin5xx_spi.h> | 42 | #include <asm/bfin5xx_spi.h> |
41 | #include <asm/portmux.h> | 43 | #include <asm/portmux.h> |
44 | #include <asm/dpmc.h> | ||
42 | 45 | ||
43 | /* | 46 | /* |
44 | * Name the Board for the /proc/cpuinfo | 47 | * Name the Board for the /proc/cpuinfo |
@@ -339,8 +342,37 @@ static struct platform_device bfin_pata_device = { | |||
339 | }; | 342 | }; |
340 | #endif | 343 | #endif |
341 | 344 | ||
345 | static const unsigned int cclk_vlev_datasheet[] = | ||
346 | { | ||
347 | VRPAIR(VLEV_085, 250000000), | ||
348 | VRPAIR(VLEV_090, 300000000), | ||
349 | VRPAIR(VLEV_095, 313000000), | ||
350 | VRPAIR(VLEV_100, 350000000), | ||
351 | VRPAIR(VLEV_105, 400000000), | ||
352 | VRPAIR(VLEV_110, 444000000), | ||
353 | VRPAIR(VLEV_115, 450000000), | ||
354 | VRPAIR(VLEV_120, 475000000), | ||
355 | VRPAIR(VLEV_125, 500000000), | ||
356 | VRPAIR(VLEV_130, 600000000), | ||
357 | }; | ||
358 | |||
359 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | ||
360 | .tuple_tab = cclk_vlev_datasheet, | ||
361 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | ||
362 | .vr_settling_time = 25 /* us */, | ||
363 | }; | ||
364 | |||
365 | static struct platform_device bfin_dpmc = { | ||
366 | .name = "bfin dpmc", | ||
367 | .dev = { | ||
368 | .platform_data = &bfin_dmpc_vreg_data, | ||
369 | }, | ||
370 | }; | ||
371 | |||
342 | static struct platform_device *cm_bf561_devices[] __initdata = { | 372 | static struct platform_device *cm_bf561_devices[] __initdata = { |
343 | 373 | ||
374 | &bfin_dpmc, | ||
375 | |||
344 | #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE) | 376 | #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE) |
345 | &hitachi_fb_device, | 377 | &hitachi_fb_device, |
346 | #endif | 378 | #endif |
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c index 0d74b7d9920..61d8f7648b2 100644 --- a/arch/blackfin/mach-bf561/boards/ezkit.c +++ b/arch/blackfin/mach-bf561/boards/ezkit.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <asm/dma.h> | 39 | #include <asm/dma.h> |
40 | #include <asm/bfin5xx_spi.h> | 40 | #include <asm/bfin5xx_spi.h> |
41 | #include <asm/portmux.h> | 41 | #include <asm/portmux.h> |
42 | #include <asm/dpmc.h> | ||
42 | 43 | ||
43 | /* | 44 | /* |
44 | * Name the Board for the /proc/cpuinfo | 45 | * Name the Board for the /proc/cpuinfo |
@@ -443,7 +444,37 @@ static struct platform_device i2c_gpio_device = { | |||
443 | }; | 444 | }; |
444 | #endif | 445 | #endif |
445 | 446 | ||
447 | static const unsigned int cclk_vlev_datasheet[] = | ||
448 | { | ||
449 | VRPAIR(VLEV_085, 250000000), | ||
450 | VRPAIR(VLEV_090, 300000000), | ||
451 | VRPAIR(VLEV_095, 313000000), | ||
452 | VRPAIR(VLEV_100, 350000000), | ||
453 | VRPAIR(VLEV_105, 400000000), | ||
454 | VRPAIR(VLEV_110, 444000000), | ||
455 | VRPAIR(VLEV_115, 450000000), | ||
456 | VRPAIR(VLEV_120, 475000000), | ||
457 | VRPAIR(VLEV_125, 500000000), | ||
458 | VRPAIR(VLEV_130, 600000000), | ||
459 | }; | ||
460 | |||
461 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | ||
462 | .tuple_tab = cclk_vlev_datasheet, | ||
463 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | ||
464 | .vr_settling_time = 25 /* us */, | ||
465 | }; | ||
466 | |||
467 | static struct platform_device bfin_dpmc = { | ||
468 | .name = "bfin dpmc", | ||
469 | .dev = { | ||
470 | .platform_data = &bfin_dmpc_vreg_data, | ||
471 | }, | ||
472 | }; | ||
473 | |||
446 | static struct platform_device *ezkit_devices[] __initdata = { | 474 | static struct platform_device *ezkit_devices[] __initdata = { |
475 | |||
476 | &bfin_dpmc, | ||
477 | |||
447 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) | 478 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
448 | &smc91x_device, | 479 | &smc91x_device, |
449 | #endif | 480 | #endif |
diff --git a/arch/blackfin/mach-common/Makefile b/arch/blackfin/mach-common/Makefile index 393081e9b68..422bfee34ad 100644 --- a/arch/blackfin/mach-common/Makefile +++ b/arch/blackfin/mach-common/Makefile | |||
@@ -6,5 +6,6 @@ obj-y := \ | |||
6 | cache.o cacheinit.o entry.o \ | 6 | cache.o cacheinit.o entry.o \ |
7 | interrupt.o lock.o irqpanic.o arch_checks.o ints-priority.o | 7 | interrupt.o lock.o irqpanic.o arch_checks.o ints-priority.o |
8 | 8 | ||
9 | obj-$(CONFIG_PM) += pm.o dpmc.o | 9 | obj-$(CONFIG_PM) += pm.o dpmc_modes.o |
10 | obj-$(CONFIG_CPU_FREQ) += cpufreq.o | 10 | obj-$(CONFIG_CPU_FREQ) += cpufreq.o |
11 | obj-$(CONFIG_CPU_VOLTAGE) += dpmc.o | ||
diff --git a/arch/blackfin/mach-common/cpufreq.c b/arch/blackfin/mach-common/cpufreq.c index ed81e00d20e..75cdad291e8 100644 --- a/arch/blackfin/mach-common/cpufreq.c +++ b/arch/blackfin/mach-common/cpufreq.c | |||
@@ -62,6 +62,14 @@ static struct bfin_dpm_state { | |||
62 | unsigned int tscale; /* change the divider on the core timer interrupt */ | 62 | unsigned int tscale; /* change the divider on the core timer interrupt */ |
63 | } dpm_state_table[3]; | 63 | } dpm_state_table[3]; |
64 | 64 | ||
65 | /* | ||
66 | normalized to maximum frequncy offset for CYCLES, | ||
67 | used in time-ts cycles clock source, but could be used | ||
68 | somewhere also. | ||
69 | */ | ||
70 | unsigned long long __bfin_cycles_off; | ||
71 | unsigned int __bfin_cycles_mod; | ||
72 | |||
65 | /**************************************************************************/ | 73 | /**************************************************************************/ |
66 | 74 | ||
67 | static unsigned int bfin_getfreq(unsigned int cpu) | 75 | static unsigned int bfin_getfreq(unsigned int cpu) |
@@ -80,6 +88,7 @@ static int bfin_target(struct cpufreq_policy *policy, | |||
80 | unsigned int index, plldiv, tscale; | 88 | unsigned int index, plldiv, tscale; |
81 | unsigned long flags, cclk_hz; | 89 | unsigned long flags, cclk_hz; |
82 | struct cpufreq_freqs freqs; | 90 | struct cpufreq_freqs freqs; |
91 | cycles_t cycles; | ||
83 | 92 | ||
84 | if (cpufreq_frequency_table_target(policy, bfin_freq_table, | 93 | if (cpufreq_frequency_table_target(policy, bfin_freq_table, |
85 | target_freq, relation, &index)) | 94 | target_freq, relation, &index)) |
@@ -101,8 +110,14 @@ static int bfin_target(struct cpufreq_policy *policy, | |||
101 | bfin_write_PLL_DIV(plldiv); | 110 | bfin_write_PLL_DIV(plldiv); |
102 | /* we have to adjust the core timer, because it is using cclk */ | 111 | /* we have to adjust the core timer, because it is using cclk */ |
103 | bfin_write_TSCALE(tscale); | 112 | bfin_write_TSCALE(tscale); |
113 | cycles = get_cycles(); | ||
104 | SSYNC(); | 114 | SSYNC(); |
115 | cycles += 10; /* ~10 cycles we loose after get_cycles() */ | ||
116 | __bfin_cycles_off += (cycles << __bfin_cycles_mod) - (cycles << index); | ||
117 | __bfin_cycles_mod = index; | ||
105 | local_irq_restore(flags); | 118 | local_irq_restore(flags); |
119 | /* TODO: just test case for cycles clock source, remove later */ | ||
120 | pr_debug("cpufreq: done\n"); | ||
106 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 121 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
107 | 122 | ||
108 | return 0; | 123 | return 0; |
@@ -119,22 +134,13 @@ static int __init __bfin_cpu_init(struct cpufreq_policy *policy) | |||
119 | unsigned long cclk, sclk, csel, min_cclk; | 134 | unsigned long cclk, sclk, csel, min_cclk; |
120 | int index; | 135 | int index; |
121 | 136 | ||
122 | #ifdef CONFIG_CYCLES_CLOCKSOURCE | ||
123 | /* | ||
124 | * Clocksource CYCLES is still CONTINUOUS but not longer MONOTONIC in case we enable | ||
125 | * CPU frequency scaling, since CYCLES runs off Core Clock. | ||
126 | */ | ||
127 | printk(KERN_WARNING "CPU frequency scaling not supported: Clocksource not suitable\n" | ||
128 | return -ENODEV; | ||
129 | #endif | ||
130 | |||
131 | if (policy->cpu != 0) | 137 | if (policy->cpu != 0) |
132 | return -EINVAL; | 138 | return -EINVAL; |
133 | 139 | ||
134 | cclk = get_cclk(); | 140 | cclk = get_cclk(); |
135 | sclk = get_sclk(); | 141 | sclk = get_sclk(); |
136 | 142 | ||
137 | #if ANOMALY_05000273 | 143 | #if ANOMALY_05000273 || (!defined(CONFIG_BF54x) && defined(CONFIG_BFIN_DCACHE)) |
138 | min_cclk = sclk * 2; | 144 | min_cclk = sclk * 2; |
139 | #else | 145 | #else |
140 | min_cclk = sclk; | 146 | min_cclk = sclk; |
diff --git a/arch/blackfin/mach-common/dpmc.c b/arch/blackfin/mach-common/dpmc.c new file mode 100644 index 00000000000..02c7efd1bcf --- /dev/null +++ b/arch/blackfin/mach-common/dpmc.c | |||
@@ -0,0 +1,137 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the GPL-2 or later. | ||
5 | */ | ||
6 | |||
7 | #include <linux/cdev.h> | ||
8 | #include <linux/device.h> | ||
9 | #include <linux/errno.h> | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/cpufreq.h> | ||
16 | |||
17 | #include <asm/delay.h> | ||
18 | #include <asm/dpmc.h> | ||
19 | |||
20 | #define DRIVER_NAME "bfin dpmc" | ||
21 | |||
22 | #define dprintk(msg...) \ | ||
23 | cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, DRIVER_NAME, msg) | ||
24 | |||
25 | struct bfin_dpmc_platform_data *pdata; | ||
26 | |||
27 | /** | ||
28 | * bfin_set_vlev - Update VLEV field in VR_CTL Reg. | ||
29 | * Avoid BYPASS sequence | ||
30 | */ | ||
31 | static void bfin_set_vlev(unsigned int vlev) | ||
32 | { | ||
33 | unsigned pll_lcnt; | ||
34 | |||
35 | pll_lcnt = bfin_read_PLL_LOCKCNT(); | ||
36 | |||
37 | bfin_write_PLL_LOCKCNT(1); | ||
38 | bfin_write_VR_CTL((bfin_read_VR_CTL() & ~VLEV) | vlev); | ||
39 | bfin_write_PLL_LOCKCNT(pll_lcnt); | ||
40 | } | ||
41 | |||
42 | /** | ||
43 | * bfin_get_vlev - Get CPU specific VLEV from platform device data | ||
44 | */ | ||
45 | static unsigned int bfin_get_vlev(unsigned int freq) | ||
46 | { | ||
47 | int i; | ||
48 | |||
49 | if (!pdata) | ||
50 | goto err_out; | ||
51 | |||
52 | freq >>= 16; | ||
53 | |||
54 | for (i = 0; i < pdata->tabsize; i++) | ||
55 | if (freq <= (pdata->tuple_tab[i] & 0xFFFF)) | ||
56 | return pdata->tuple_tab[i] >> 16; | ||
57 | |||
58 | err_out: | ||
59 | printk(KERN_WARNING "DPMC: No suitable CCLK VDDINT voltage pair found\n"); | ||
60 | return VLEV_120; | ||
61 | } | ||
62 | |||
63 | #ifdef CONFIG_CPU_FREQ | ||
64 | static int | ||
65 | vreg_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data) | ||
66 | { | ||
67 | struct cpufreq_freqs *freq = data; | ||
68 | |||
69 | if (val == CPUFREQ_PRECHANGE && freq->old < freq->new) { | ||
70 | bfin_set_vlev(bfin_get_vlev(freq->new)); | ||
71 | udelay(pdata->vr_settling_time); /* Wait until Volatge settled */ | ||
72 | |||
73 | } else if (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) | ||
74 | bfin_set_vlev(bfin_get_vlev(freq->new)); | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | static struct notifier_block vreg_cpufreq_notifier_block = { | ||
80 | .notifier_call = vreg_cpufreq_notifier | ||
81 | }; | ||
82 | #endif /* CONFIG_CPU_FREQ */ | ||
83 | |||
84 | /** | ||
85 | * bfin_dpmc_probe - | ||
86 | * | ||
87 | */ | ||
88 | static int __devinit bfin_dpmc_probe(struct platform_device *pdev) | ||
89 | { | ||
90 | if (pdev->dev.platform_data) | ||
91 | pdata = pdev->dev.platform_data; | ||
92 | else | ||
93 | return -EINVAL; | ||
94 | |||
95 | return cpufreq_register_notifier(&vreg_cpufreq_notifier_block, | ||
96 | CPUFREQ_TRANSITION_NOTIFIER); | ||
97 | } | ||
98 | |||
99 | /** | ||
100 | * bfin_dpmc_remove - | ||
101 | */ | ||
102 | static int __devexit bfin_dpmc_remove(struct platform_device *pdev) | ||
103 | { | ||
104 | pdata = NULL; | ||
105 | return cpufreq_unregister_notifier(&vreg_cpufreq_notifier_block, | ||
106 | CPUFREQ_TRANSITION_NOTIFIER); | ||
107 | } | ||
108 | |||
109 | struct platform_driver bfin_dpmc_device_driver = { | ||
110 | .probe = bfin_dpmc_probe, | ||
111 | .remove = __devexit_p(bfin_dpmc_remove), | ||
112 | .driver = { | ||
113 | .name = DRIVER_NAME, | ||
114 | } | ||
115 | }; | ||
116 | |||
117 | /** | ||
118 | * bfin_dpmc_init - Init driver | ||
119 | */ | ||
120 | static int __init bfin_dpmc_init(void) | ||
121 | { | ||
122 | return platform_driver_register(&bfin_dpmc_device_driver); | ||
123 | } | ||
124 | module_init(bfin_dpmc_init); | ||
125 | |||
126 | /** | ||
127 | * bfin_dpmc_exit - break down driver | ||
128 | */ | ||
129 | static void __exit bfin_dpmc_exit(void) | ||
130 | { | ||
131 | platform_driver_unregister(&bfin_dpmc_device_driver); | ||
132 | } | ||
133 | module_exit(bfin_dpmc_exit); | ||
134 | |||
135 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | ||
136 | MODULE_DESCRIPTION("cpu power management driver for Blackfin"); | ||
137 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/blackfin/mach-common/dpmc.S b/arch/blackfin/mach-common/dpmc_modes.S index 9d45aa3265b..b7981d31c39 100644 --- a/arch/blackfin/mach-common/dpmc.S +++ b/arch/blackfin/mach-common/dpmc_modes.S | |||
@@ -1,30 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * File: arch/blackfin/mach-common/dpmc.S | 2 | * Copyright 2004-2008 Analog Devices Inc. |
3 | * Based on: | ||
4 | * Author: LG Soft India | ||
5 | * | 3 | * |
6 | * Created: ? | 4 | * Licensed under the GPL-2 or later. |
7 | * Description: Watchdog Timer APIs | ||
8 | * | ||
9 | * Modified: | ||
10 | * Copyright 2004-2006 Analog Devices Inc. | ||
11 | * | ||
12 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License as published by | ||
16 | * the Free Software Foundation; either version 2 of the License, or | ||
17 | * (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, see the file COPYING, or write | ||
26 | * to the Free Software Foundation, Inc., | ||
27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
28 | */ | 5 | */ |
29 | 6 | ||
30 | #include <linux/linkage.h> | 7 | #include <linux/linkage.h> |
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S index f2fb87e9a46..038f70e0be6 100644 --- a/arch/blackfin/mach-common/entry.S +++ b/arch/blackfin/mach-common/entry.S | |||
@@ -151,26 +151,62 @@ ENTRY(_ex_soft_bp) | |||
151 | ENDPROC(_ex_soft_bp) | 151 | ENDPROC(_ex_soft_bp) |
152 | 152 | ||
153 | ENTRY(_ex_single_step) | 153 | ENTRY(_ex_single_step) |
154 | /* If we just returned from an interrupt, the single step event is | ||
155 | for the RTI instruction. */ | ||
154 | r7 = retx; | 156 | r7 = retx; |
155 | r6 = reti; | 157 | r6 = reti; |
156 | cc = r7 == r6; | 158 | cc = r7 == r6; |
157 | if cc jump _bfin_return_from_exception | 159 | if cc jump _bfin_return_from_exception; |
158 | r7 = syscfg; | ||
159 | bitclr (r7, 0); | ||
160 | syscfg = R7; | ||
161 | 160 | ||
161 | /* If we were in user mode, do the single step normally. */ | ||
162 | p5.l = lo(IPEND); | 162 | p5.l = lo(IPEND); |
163 | p5.h = hi(IPEND); | 163 | p5.h = hi(IPEND); |
164 | r6 = [p5]; | 164 | r6 = [p5]; |
165 | cc = bittst(r6, 5); | 165 | r7 = 0xffe0 (z); |
166 | if !cc jump _ex_trap_c; | 166 | r7 = r7 & r6; |
167 | p4.l = lo(EVT5); | 167 | cc = r7 == 0; |
168 | p4.h = hi(EVT5); | 168 | if !cc jump 1f; |
169 | r6.h = _exception_to_level5; | 169 | |
170 | r6.l = _exception_to_level5; | 170 | /* Single stepping only a single instruction, so clear the trace |
171 | r7 = [p4]; | 171 | * bit here. */ |
172 | cc = r6 == r7; | 172 | r7 = syscfg; |
173 | if !cc jump _ex_trap_c; | 173 | bitclr (r7, 0); |
174 | syscfg = R7; | ||
175 | jump _ex_trap_c; | ||
176 | |||
177 | 1: | ||
178 | /* | ||
179 | * We were in an interrupt handler. By convention, all of them save | ||
180 | * SYSCFG with their first instruction, so by checking whether our | ||
181 | * RETX points at the entry point, we can determine whether to allow | ||
182 | * a single step, or whether to clear SYSCFG. | ||
183 | * | ||
184 | * First, find out the interrupt level and the event vector for it. | ||
185 | */ | ||
186 | p5.l = lo(EVT0); | ||
187 | p5.h = hi(EVT0); | ||
188 | p5 += -4; | ||
189 | 2: | ||
190 | r7 = rot r7 by -1; | ||
191 | p5 += 4; | ||
192 | if !cc jump 2b; | ||
193 | |||
194 | /* What we actually do is test for the _second_ instruction in the | ||
195 | * IRQ handler. That way, if there are insns following the restore | ||
196 | * of SYSCFG after leaving the handler, we will not turn off SYSCFG | ||
197 | * for them. */ | ||
198 | |||
199 | r7 = [p5]; | ||
200 | r7 += 2; | ||
201 | r6 = RETX; | ||
202 | cc = R7 == R6; | ||
203 | if !cc jump _bfin_return_from_exception; | ||
204 | |||
205 | r7 = syscfg; | ||
206 | bitclr (r7, 0); | ||
207 | syscfg = R7; | ||
208 | |||
209 | /* Fall through to _bfin_return_from_exception. */ | ||
174 | ENDPROC(_ex_single_step) | 210 | ENDPROC(_ex_single_step) |
175 | 211 | ||
176 | ENTRY(_bfin_return_from_exception) | 212 | ENTRY(_bfin_return_from_exception) |
@@ -234,20 +270,26 @@ ENTRY(_ex_trap_c) | |||
234 | p5.l = _saved_icplb_fault_addr; | 270 | p5.l = _saved_icplb_fault_addr; |
235 | [p5] = r7; | 271 | [p5] = r7; |
236 | 272 | ||
237 | p4.l = __retx; | 273 | p4.l = _excpt_saved_stuff; |
238 | p4.h = __retx; | 274 | p4.h = _excpt_saved_stuff; |
275 | |||
239 | r6 = retx; | 276 | r6 = retx; |
240 | [p4] = r6; | 277 | [p4] = r6; |
241 | p4.l = lo(SAFE_USER_INSTRUCTION); | 278 | |
242 | p4.h = hi(SAFE_USER_INSTRUCTION); | 279 | r6 = SYSCFG; |
243 | retx = p4; | 280 | [p4 + 4] = r6; |
281 | BITCLR(r6, 0); | ||
282 | SYSCFG = r6; | ||
244 | 283 | ||
245 | /* Disable all interrupts, but make sure level 5 is enabled so | 284 | /* Disable all interrupts, but make sure level 5 is enabled so |
246 | * we can switch to that level. Save the old mask. */ | 285 | * we can switch to that level. Save the old mask. */ |
247 | cli r6; | 286 | cli r6; |
248 | p4.l = _excpt_saved_imask; | 287 | [p4 + 8] = r6; |
249 | p4.h = _excpt_saved_imask; | 288 | |
250 | [p4] = r6; | 289 | p4.l = lo(SAFE_USER_INSTRUCTION); |
290 | p4.h = hi(SAFE_USER_INSTRUCTION); | ||
291 | retx = p4; | ||
292 | |||
251 | r6 = 0x3f; | 293 | r6 = 0x3f; |
252 | sti r6; | 294 | sti r6; |
253 | 295 | ||
@@ -295,6 +337,11 @@ ENTRY(_double_fault) | |||
295 | */ | 337 | */ |
296 | SAVE_ALL_SYS | 338 | SAVE_ALL_SYS |
297 | 339 | ||
340 | /* The dumping functions expect the return address in the RETI | ||
341 | * slot. */ | ||
342 | r6 = retx; | ||
343 | [sp + PT_PC] = r6; | ||
344 | |||
298 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ | 345 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ |
299 | SP += -12; | 346 | SP += -12; |
300 | call _double_fault_c; | 347 | call _double_fault_c; |
@@ -307,16 +354,17 @@ ENDPROC(_double_fault) | |||
307 | ENTRY(_exception_to_level5) | 354 | ENTRY(_exception_to_level5) |
308 | SAVE_ALL_SYS | 355 | SAVE_ALL_SYS |
309 | 356 | ||
310 | p4.l = __retx; | 357 | p4.l = _excpt_saved_stuff; |
311 | p4.h = __retx; | 358 | p4.h = _excpt_saved_stuff; |
312 | r6 = [p4]; | 359 | r6 = [p4]; |
313 | [sp + PT_PC] = r6; | 360 | [sp + PT_PC] = r6; |
314 | 361 | ||
362 | r6 = [p4 + 4]; | ||
363 | [sp + PT_SYSCFG] = r6; | ||
364 | |||
315 | /* Restore interrupt mask. We haven't pushed RETI, so this | 365 | /* Restore interrupt mask. We haven't pushed RETI, so this |
316 | * doesn't enable interrupts until we return from this handler. */ | 366 | * doesn't enable interrupts until we return from this handler. */ |
317 | p4.l = _excpt_saved_imask; | 367 | r6 = [p4 + 8]; |
318 | p4.h = _excpt_saved_imask; | ||
319 | r6 = [p4]; | ||
320 | sti r6; | 368 | sti r6; |
321 | 369 | ||
322 | /* Restore the hardware error vector. */ | 370 | /* Restore the hardware error vector. */ |
@@ -1344,7 +1392,14 @@ ENTRY(_sys_call_table) | |||
1344 | .rept NR_syscalls-(.-_sys_call_table)/4 | 1392 | .rept NR_syscalls-(.-_sys_call_table)/4 |
1345 | .long _sys_ni_syscall | 1393 | .long _sys_ni_syscall |
1346 | .endr | 1394 | .endr |
1347 | _excpt_saved_imask: | 1395 | |
1396 | /* | ||
1397 | * Used to save the real RETX, IMASK and SYSCFG when temporarily | ||
1398 | * storing safe values across the transition from exception to IRQ5. | ||
1399 | */ | ||
1400 | _excpt_saved_stuff: | ||
1401 | .long 0; | ||
1402 | .long 0; | ||
1348 | .long 0; | 1403 | .long 0; |
1349 | 1404 | ||
1350 | _exception_stack: | 1405 | _exception_stack: |
@@ -1358,7 +1413,3 @@ _exception_stack_top: | |||
1358 | _last_cplb_fault_retx: | 1413 | _last_cplb_fault_retx: |
1359 | .long 0; | 1414 | .long 0; |
1360 | #endif | 1415 | #endif |
1361 | /* Used to save the real RETX when temporarily storing a safe | ||
1362 | * return address. */ | ||
1363 | __retx: | ||
1364 | .long 0; | ||
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c index 8b9984197ed..a79fbd87021 100644 --- a/arch/cris/kernel/sys_cris.c +++ b/arch/cris/kernel/sys_cris.c | |||
@@ -27,25 +27,6 @@ | |||
27 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
28 | #include <asm/segment.h> | 28 | #include <asm/segment.h> |
29 | 29 | ||
30 | /* | ||
31 | * sys_pipe() is the normal C calling standard for creating | ||
32 | * a pipe. It's not the way Unix traditionally does this, though. | ||
33 | */ | ||
34 | asmlinkage int sys_pipe(unsigned long __user * fildes) | ||
35 | { | ||
36 | int fd[2]; | ||
37 | int error; | ||
38 | |||
39 | lock_kernel(); | ||
40 | error = do_pipe(fd); | ||
41 | unlock_kernel(); | ||
42 | if (!error) { | ||
43 | if (copy_to_user(fildes, fd, 2*sizeof(int))) | ||
44 | error = -EFAULT; | ||
45 | } | ||
46 | return error; | ||
47 | } | ||
48 | |||
49 | /* common code for old and new mmaps */ | 30 | /* common code for old and new mmaps */ |
50 | static inline long | 31 | static inline long |
51 | do_mmap2(unsigned long addr, unsigned long len, unsigned long prot, | 32 | do_mmap2(unsigned long addr, unsigned long len, unsigned long prot, |
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c index 6d7a80fdad4..305ac852bbe 100644 --- a/arch/m32r/kernel/sys_m32r.c +++ b/arch/m32r/kernel/sys_m32r.c | |||
@@ -76,26 +76,6 @@ asmlinkage int sys_tas(int __user *addr) | |||
76 | return oldval; | 76 | return oldval; |
77 | } | 77 | } |
78 | 78 | ||
79 | /* | ||
80 | * sys_pipe() is the normal C calling standard for creating | ||
81 | * a pipe. It's not the way Unix traditionally does this, though. | ||
82 | */ | ||
83 | asmlinkage int | ||
84 | sys_pipe(unsigned long r0, unsigned long r1, unsigned long r2, | ||
85 | unsigned long r3, unsigned long r4, unsigned long r5, | ||
86 | unsigned long r6, struct pt_regs regs) | ||
87 | { | ||
88 | int fd[2]; | ||
89 | int error; | ||
90 | |||
91 | error = do_pipe(fd); | ||
92 | if (!error) { | ||
93 | if (copy_to_user((void __user *)r0, fd, 2*sizeof(int))) | ||
94 | error = -EFAULT; | ||
95 | } | ||
96 | return error; | ||
97 | } | ||
98 | |||
99 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | 79 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, |
100 | unsigned long prot, unsigned long flags, | 80 | unsigned long prot, unsigned long flags, |
101 | unsigned long fd, unsigned long pgoff) | 81 | unsigned long fd, unsigned long pgoff) |
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c index fd4858e2dd6..75b8340b254 100644 --- a/arch/m68k/kernel/traps.c +++ b/arch/m68k/kernel/traps.c | |||
@@ -468,15 +468,26 @@ static inline void access_error040(struct frame *fp) | |||
468 | * (if do_page_fault didn't fix the mapping, | 468 | * (if do_page_fault didn't fix the mapping, |
469 | * the writeback won't do good) | 469 | * the writeback won't do good) |
470 | */ | 470 | */ |
471 | disable_wb: | ||
471 | #ifdef DEBUG | 472 | #ifdef DEBUG |
472 | printk(".. disabling wb2\n"); | 473 | printk(".. disabling wb2\n"); |
473 | #endif | 474 | #endif |
474 | if (fp->un.fmt7.wb2a == fp->un.fmt7.faddr) | 475 | if (fp->un.fmt7.wb2a == fp->un.fmt7.faddr) |
475 | fp->un.fmt7.wb2s &= ~WBV_040; | 476 | fp->un.fmt7.wb2s &= ~WBV_040; |
477 | if (fp->un.fmt7.wb3a == fp->un.fmt7.faddr) | ||
478 | fp->un.fmt7.wb3s &= ~WBV_040; | ||
476 | } | 479 | } |
477 | } else if (send_fault_sig(&fp->ptregs) > 0) { | 480 | } else { |
478 | printk("68040 access error, ssw=%x\n", ssw); | 481 | /* In case of a bus error we either kill the process or expect |
479 | trap_c(fp); | 482 | * the kernel to catch the fault, which then is also responsible |
483 | * for cleaning up the mess. | ||
484 | */ | ||
485 | current->thread.signo = SIGBUS; | ||
486 | current->thread.faddr = fp->un.fmt7.faddr; | ||
487 | if (send_fault_sig(&fp->ptregs) >= 0) | ||
488 | printk("68040 bus error (ssw=%x, faddr=%lx)\n", ssw, | ||
489 | fp->un.fmt7.faddr); | ||
490 | goto disable_wb; | ||
480 | } | 491 | } |
481 | 492 | ||
482 | do_040writebacks(fp); | 493 | do_040writebacks(fp); |
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 735a49b4b93..ad3e3bacae3 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -48,9 +48,6 @@ | |||
48 | struct mac_booter_data mac_bi_data; | 48 | struct mac_booter_data mac_bi_data; |
49 | int mac_bisize = sizeof mac_bi_data; | 49 | int mac_bisize = sizeof mac_bi_data; |
50 | 50 | ||
51 | struct mac_hw_present mac_hw_present; | ||
52 | EXPORT_SYMBOL(mac_hw_present); | ||
53 | |||
54 | /* New m68k bootinfo stuff and videobase */ | 51 | /* New m68k bootinfo stuff and videobase */ |
55 | 52 | ||
56 | extern int m68k_num_memory; | 53 | extern int m68k_num_memory; |
@@ -817,27 +814,6 @@ void __init mac_identify(void) | |||
817 | m68k_ramdisk.addr, m68k_ramdisk.size); | 814 | m68k_ramdisk.addr, m68k_ramdisk.size); |
818 | #endif | 815 | #endif |
819 | 816 | ||
820 | /* | ||
821 | * TODO: set the various fields in macintosh_config->hw_present here! | ||
822 | */ | ||
823 | switch (macintosh_config->scsi_type) { | ||
824 | case MAC_SCSI_OLD: | ||
825 | MACHW_SET(MAC_SCSI_80); | ||
826 | break; | ||
827 | case MAC_SCSI_QUADRA: | ||
828 | case MAC_SCSI_QUADRA2: | ||
829 | case MAC_SCSI_QUADRA3: | ||
830 | MACHW_SET(MAC_SCSI_96); | ||
831 | if ((macintosh_config->ident == MAC_MODEL_Q900) || | ||
832 | (macintosh_config->ident == MAC_MODEL_Q950)) | ||
833 | MACHW_SET(MAC_SCSI_96_2); | ||
834 | break; | ||
835 | default: | ||
836 | printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n"); | ||
837 | MACHW_SET(MAC_SCSI_80); | ||
838 | break; | ||
839 | } | ||
840 | |||
841 | iop_init(); | 817 | iop_init(); |
842 | via_init(); | 818 | via_init(); |
843 | oss_init(); | 819 | oss_init(); |
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index 6a6409adc56..e856218da90 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig | |||
@@ -186,17 +186,6 @@ config PREEMPT | |||
186 | Say Y here if you are building a kernel for a desktop, embedded | 186 | Say Y here if you are building a kernel for a desktop, embedded |
187 | or real-time system. Say N if you are unsure. | 187 | or real-time system. Say N if you are unsure. |
188 | 188 | ||
189 | config PREEMPT_BKL | ||
190 | bool "Preempt The Big Kernel Lock" | ||
191 | depends on PREEMPT | ||
192 | default y | ||
193 | help | ||
194 | This option reduces the latency of the kernel by making the | ||
195 | big kernel lock preemptible. | ||
196 | |||
197 | Say Y here if you are building a kernel for a desktop system. | ||
198 | Say N if you are unsure. | ||
199 | |||
200 | config MN10300_CURRENT_IN_E2 | 189 | config MN10300_CURRENT_IN_E2 |
201 | bool "Hold current task address in E2 register" | 190 | bool "Hold current task address in E2 register" |
202 | default y | 191 | default y |
diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts index a1ae4d6ec99..72d67564bdf 100644 --- a/arch/powerpc/boot/dts/sequoia.dts +++ b/arch/powerpc/boot/dts/sequoia.dts | |||
@@ -342,9 +342,14 @@ | |||
342 | /* Outbound ranges, one memory and one IO, | 342 | /* Outbound ranges, one memory and one IO, |
343 | * later cannot be changed. Chip supports a second | 343 | * later cannot be changed. Chip supports a second |
344 | * IO range but we don't use it for now | 344 | * IO range but we don't use it for now |
345 | * From the 440EPx user manual: | ||
346 | * PCI 1 Memory 1 8000 0000 1 BFFF FFFF 1GB | ||
347 | * I/O 1 E800 0000 1 E800 FFFF 64KB | ||
348 | * I/O 1 E880 0000 1 EBFF FFFF 56MB | ||
345 | */ | 349 | */ |
346 | ranges = <02000000 0 80000000 1 80000000 0 10000000 | 350 | ranges = <02000000 0 80000000 1 80000000 0 40000000 |
347 | 01000000 0 00000000 1 e8000000 0 00100000>; | 351 | 01000000 0 00000000 1 e8000000 0 00010000 |
352 | 01000000 0 00000000 1 e8800000 0 03800000>; | ||
348 | 353 | ||
349 | /* Inbound 2GB range starting at 0 */ | 354 | /* Inbound 2GB range starting at 0 */ |
350 | dma-ranges = <42000000 0 0 0 0 0 80000000>; | 355 | dma-ranges = <42000000 0 0 0 0 0 80000000>; |
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 9f937774549..d8f0329b134 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <asm/mmu.h> | 16 | #include <asm/mmu.h> |
17 | #include <asm/pgtable.h> | 17 | #include <asm/pgtable.h> |
18 | #include <asm/io.h> | 18 | #include <asm/io.h> |
19 | #include <asm/prom.h> | ||
20 | #include <asm/processor.h> | 19 | #include <asm/processor.h> |
21 | #include <asm/udbg.h> | 20 | #include <asm/udbg.h> |
22 | 21 | ||
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 36080d4d192..81738a4b3c3 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -1208,6 +1208,18 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
1208 | .machine_check = machine_check_4xx, | 1208 | .machine_check = machine_check_4xx, |
1209 | .platform = "ppc405", | 1209 | .platform = "ppc405", |
1210 | }, | 1210 | }, |
1211 | { /* default match */ | ||
1212 | .pvr_mask = 0x00000000, | ||
1213 | .pvr_value = 0x00000000, | ||
1214 | .cpu_name = "(generic 40x PPC)", | ||
1215 | .cpu_features = CPU_FTRS_40X, | ||
1216 | .cpu_user_features = PPC_FEATURE_32 | | ||
1217 | PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, | ||
1218 | .icache_bsize = 32, | ||
1219 | .dcache_bsize = 32, | ||
1220 | .machine_check = machine_check_4xx, | ||
1221 | .platform = "ppc405", | ||
1222 | } | ||
1211 | 1223 | ||
1212 | #endif /* CONFIG_40x */ | 1224 | #endif /* CONFIG_40x */ |
1213 | #ifdef CONFIG_44x | 1225 | #ifdef CONFIG_44x |
@@ -1421,8 +1433,18 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
1421 | .machine_check = machine_check_440A, | 1433 | .machine_check = machine_check_440A, |
1422 | .platform = "ppc440", | 1434 | .platform = "ppc440", |
1423 | }, | 1435 | }, |
1436 | { /* default match */ | ||
1437 | .pvr_mask = 0x00000000, | ||
1438 | .pvr_value = 0x00000000, | ||
1439 | .cpu_name = "(generic 44x PPC)", | ||
1440 | .cpu_features = CPU_FTRS_44X, | ||
1441 | .cpu_user_features = COMMON_USER_BOOKE, | ||
1442 | .icache_bsize = 32, | ||
1443 | .dcache_bsize = 32, | ||
1444 | .machine_check = machine_check_4xx, | ||
1445 | .platform = "ppc440", | ||
1446 | } | ||
1424 | #endif /* CONFIG_44x */ | 1447 | #endif /* CONFIG_44x */ |
1425 | #ifdef CONFIG_FSL_BOOKE | ||
1426 | #ifdef CONFIG_E200 | 1448 | #ifdef CONFIG_E200 |
1427 | { /* e200z5 */ | 1449 | { /* e200z5 */ |
1428 | .pvr_mask = 0xfff00000, | 1450 | .pvr_mask = 0xfff00000, |
@@ -1451,7 +1473,19 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
1451 | .machine_check = machine_check_e200, | 1473 | .machine_check = machine_check_e200, |
1452 | .platform = "ppc5554", | 1474 | .platform = "ppc5554", |
1453 | }, | 1475 | }, |
1454 | #elif defined(CONFIG_E500) | 1476 | { /* default match */ |
1477 | .pvr_mask = 0x00000000, | ||
1478 | .pvr_value = 0x00000000, | ||
1479 | .cpu_name = "(generic E200 PPC)", | ||
1480 | .cpu_features = CPU_FTRS_E200, | ||
1481 | .cpu_user_features = COMMON_USER_BOOKE | | ||
1482 | PPC_FEATURE_HAS_EFP_SINGLE | | ||
1483 | PPC_FEATURE_UNIFIED_CACHE, | ||
1484 | .dcache_bsize = 32, | ||
1485 | .machine_check = machine_check_e200, | ||
1486 | .platform = "ppc5554", | ||
1487 | #endif /* CONFIG_E200 */ | ||
1488 | #ifdef CONFIG_E500 | ||
1455 | { /* e500 */ | 1489 | { /* e500 */ |
1456 | .pvr_mask = 0xffff0000, | 1490 | .pvr_mask = 0xffff0000, |
1457 | .pvr_value = 0x80200000, | 1491 | .pvr_value = 0x80200000, |
@@ -1487,20 +1521,19 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
1487 | .machine_check = machine_check_e500, | 1521 | .machine_check = machine_check_e500, |
1488 | .platform = "ppc8548", | 1522 | .platform = "ppc8548", |
1489 | }, | 1523 | }, |
1490 | #endif | ||
1491 | #endif | ||
1492 | #if !CLASSIC_PPC | ||
1493 | { /* default match */ | 1524 | { /* default match */ |
1494 | .pvr_mask = 0x00000000, | 1525 | .pvr_mask = 0x00000000, |
1495 | .pvr_value = 0x00000000, | 1526 | .pvr_value = 0x00000000, |
1496 | .cpu_name = "(generic PPC)", | 1527 | .cpu_name = "(generic E500 PPC)", |
1497 | .cpu_features = CPU_FTRS_GENERIC_32, | 1528 | .cpu_features = CPU_FTRS_E500, |
1498 | .cpu_user_features = PPC_FEATURE_32, | 1529 | .cpu_user_features = COMMON_USER_BOOKE | |
1530 | PPC_FEATURE_HAS_SPE_COMP | | ||
1531 | PPC_FEATURE_HAS_EFP_SINGLE_COMP, | ||
1499 | .icache_bsize = 32, | 1532 | .icache_bsize = 32, |
1500 | .dcache_bsize = 32, | 1533 | .dcache_bsize = 32, |
1534 | .machine_check = machine_check_e500, | ||
1501 | .platform = "powerpc", | 1535 | .platform = "powerpc", |
1502 | } | 1536 | #endif /* CONFIG_E500 */ |
1503 | #endif /* !CLASSIC_PPC */ | ||
1504 | #endif /* CONFIG_PPC32 */ | 1537 | #endif /* CONFIG_PPC32 */ |
1505 | }; | 1538 | }; |
1506 | 1539 | ||
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S index b84ec6a2fc9..c2b9dc4fce5 100644 --- a/arch/powerpc/kernel/head_44x.S +++ b/arch/powerpc/kernel/head_44x.S | |||
@@ -653,7 +653,14 @@ finish_tlb_load: | |||
653 | rlwimi r10, r11, 0, 26, 26 /* UX = HWEXEC & USER */ | 653 | rlwimi r10, r11, 0, 26, 26 /* UX = HWEXEC & USER */ |
654 | 654 | ||
655 | rlwimi r12, r10, 0, 26, 31 /* Insert static perms */ | 655 | rlwimi r12, r10, 0, 26, 31 /* Insert static perms */ |
656 | rlwinm r12, r12, 0, 20, 15 /* Clear U0-U3 */ | 656 | |
657 | /* | ||
658 | * Clear U0-U3 and WL1 IL1I IL1D IL2I IL2D bits which are added | ||
659 | * on newer 440 cores like the 440x6 used on AMCC 460EX/460GT (see | ||
660 | * include/asm-powerpc/pgtable-ppc32.h for details). | ||
661 | */ | ||
662 | rlwinm r12, r12, 0, 20, 10 | ||
663 | |||
657 | tlbwe r12, r13, PPC44x_TLB_ATTRIB /* Write ATTRIB */ | 664 | tlbwe r12, r13, PPC44x_TLB_ATTRIB /* Write ATTRIB */ |
658 | 665 | ||
659 | /* Done...restore registers and get out of here. | 666 | /* Done...restore registers and get out of here. |
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 024805e1747..25e84c0e116 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -1517,10 +1517,6 @@ _INIT_STATIC(start_here_multiplatform) | |||
1517 | addi r2,r2,0x4000 | 1517 | addi r2,r2,0x4000 |
1518 | add r2,r2,r26 | 1518 | add r2,r2,r26 |
1519 | 1519 | ||
1520 | /* Set initial ptr to current */ | ||
1521 | LOAD_REG_IMMEDIATE(r4, init_task) | ||
1522 | std r4,PACACURRENT(r13) | ||
1523 | |||
1524 | /* Do very early kernel initializations, including initial hash table, | 1520 | /* Do very early kernel initializations, including initial hash table, |
1525 | * stab and slb setup before we turn on relocation. */ | 1521 | * stab and slb setup before we turn on relocation. */ |
1526 | 1522 | ||
diff --git a/arch/powerpc/kernel/isa-bridge.c b/arch/powerpc/kernel/isa-bridge.c index 289af348978..4d5731b2429 100644 --- a/arch/powerpc/kernel/isa-bridge.c +++ b/arch/powerpc/kernel/isa-bridge.c | |||
@@ -108,9 +108,6 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, | |||
108 | if (size > 0x10000) | 108 | if (size > 0x10000) |
109 | size = 0x10000; | 109 | size = 0x10000; |
110 | 110 | ||
111 | printk(KERN_ERR "no ISA IO ranges or unexpected isa range, " | ||
112 | "mapping 64k\n"); | ||
113 | |||
114 | __ioremap_at(phb_io_base_phys, (void *)ISA_IO_BASE, | 111 | __ioremap_at(phb_io_base_phys, (void *)ISA_IO_BASE, |
115 | size, _PAGE_NO_CACHE|_PAGE_GUARDED); | 112 | size, _PAGE_NO_CACHE|_PAGE_GUARDED); |
116 | return; | 113 | return; |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 25e3fd8606a..098fd96a394 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -170,6 +170,8 @@ void __init setup_paca(int cpu) | |||
170 | 170 | ||
171 | void __init early_setup(unsigned long dt_ptr) | 171 | void __init early_setup(unsigned long dt_ptr) |
172 | { | 172 | { |
173 | /* -------- printk is _NOT_ safe to use here ! ------- */ | ||
174 | |||
173 | /* Fill in any unititialised pacas */ | 175 | /* Fill in any unititialised pacas */ |
174 | initialise_pacas(); | 176 | initialise_pacas(); |
175 | 177 | ||
@@ -179,12 +181,14 @@ void __init early_setup(unsigned long dt_ptr) | |||
179 | /* Assume we're on cpu 0 for now. Don't write to the paca yet! */ | 181 | /* Assume we're on cpu 0 for now. Don't write to the paca yet! */ |
180 | setup_paca(0); | 182 | setup_paca(0); |
181 | 183 | ||
182 | /* Enable early debugging if any specified (see udbg.h) */ | ||
183 | udbg_early_init(); | ||
184 | |||
185 | /* Initialize lockdep early or else spinlocks will blow */ | 184 | /* Initialize lockdep early or else spinlocks will blow */ |
186 | lockdep_init(); | 185 | lockdep_init(); |
187 | 186 | ||
187 | /* -------- printk is now safe to use ------- */ | ||
188 | |||
189 | /* Enable early debugging if any specified (see udbg.h) */ | ||
190 | udbg_early_init(); | ||
191 | |||
188 | DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr); | 192 | DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr); |
189 | 193 | ||
190 | /* | 194 | /* |
diff --git a/arch/powerpc/kvm/booke_guest.c b/arch/powerpc/kvm/booke_guest.c index 6d9884a6884..712d89a28c4 100644 --- a/arch/powerpc/kvm/booke_guest.c +++ b/arch/powerpc/kvm/booke_guest.c | |||
@@ -49,6 +49,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { | |||
49 | { "inst_emu", VCPU_STAT(emulated_inst_exits) }, | 49 | { "inst_emu", VCPU_STAT(emulated_inst_exits) }, |
50 | { "dec", VCPU_STAT(dec_exits) }, | 50 | { "dec", VCPU_STAT(dec_exits) }, |
51 | { "ext_intr", VCPU_STAT(ext_intr_exits) }, | 51 | { "ext_intr", VCPU_STAT(ext_intr_exits) }, |
52 | { "halt_wakeup", VCPU_STAT(halt_wakeup) }, | ||
52 | { NULL } | 53 | { NULL } |
53 | }; | 54 | }; |
54 | 55 | ||
@@ -338,6 +339,11 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
338 | } | 339 | } |
339 | break; | 340 | break; |
340 | 341 | ||
342 | case BOOKE_INTERRUPT_FP_UNAVAIL: | ||
343 | kvmppc_queue_exception(vcpu, exit_nr); | ||
344 | r = RESUME_GUEST; | ||
345 | break; | ||
346 | |||
341 | case BOOKE_INTERRUPT_DATA_STORAGE: | 347 | case BOOKE_INTERRUPT_DATA_STORAGE: |
342 | vcpu->arch.dear = vcpu->arch.fault_dear; | 348 | vcpu->arch.dear = vcpu->arch.fault_dear; |
343 | vcpu->arch.esr = vcpu->arch.fault_esr; | 349 | vcpu->arch.esr = vcpu->arch.fault_esr; |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index bad40bd2d3a..777e0f34e0e 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -36,13 +36,12 @@ gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn) | |||
36 | 36 | ||
37 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v) | 37 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v) |
38 | { | 38 | { |
39 | /* XXX implement me */ | 39 | return !!(v->arch.pending_exceptions); |
40 | return 0; | ||
41 | } | 40 | } |
42 | 41 | ||
43 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) | 42 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) |
44 | { | 43 | { |
45 | return 1; | 44 | return !(v->arch.msr & MSR_WE); |
46 | } | 45 | } |
47 | 46 | ||
48 | 47 | ||
@@ -214,6 +213,11 @@ static void kvmppc_decrementer_func(unsigned long data) | |||
214 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; | 213 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; |
215 | 214 | ||
216 | kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_DECREMENTER); | 215 | kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_DECREMENTER); |
216 | |||
217 | if (waitqueue_active(&vcpu->wq)) { | ||
218 | wake_up_interruptible(&vcpu->wq); | ||
219 | vcpu->stat.halt_wakeup++; | ||
220 | } | ||
217 | } | 221 | } |
218 | 222 | ||
219 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | 223 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) |
@@ -339,6 +343,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
339 | int r; | 343 | int r; |
340 | sigset_t sigsaved; | 344 | sigset_t sigsaved; |
341 | 345 | ||
346 | vcpu_load(vcpu); | ||
347 | |||
342 | if (vcpu->sigset_active) | 348 | if (vcpu->sigset_active) |
343 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); | 349 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); |
344 | 350 | ||
@@ -363,12 +369,20 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
363 | if (vcpu->sigset_active) | 369 | if (vcpu->sigset_active) |
364 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); | 370 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); |
365 | 371 | ||
372 | vcpu_put(vcpu); | ||
373 | |||
366 | return r; | 374 | return r; |
367 | } | 375 | } |
368 | 376 | ||
369 | int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq) | 377 | int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq) |
370 | { | 378 | { |
371 | kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_EXTERNAL); | 379 | kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_EXTERNAL); |
380 | |||
381 | if (waitqueue_active(&vcpu->wq)) { | ||
382 | wake_up_interruptible(&vcpu->wq); | ||
383 | vcpu->stat.halt_wakeup++; | ||
384 | } | ||
385 | |||
372 | return 0; | 386 | return 0; |
373 | } | 387 | } |
374 | 388 | ||
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 4bb023f4c86..f1d2cdc5331 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile | |||
@@ -23,3 +23,4 @@ obj-$(CONFIG_SMP) += locks.o | |||
23 | endif | 23 | endif |
24 | 24 | ||
25 | obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o | 25 | obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o |
26 | obj-$(CONFIG_HAS_IOMEM) += devres.o | ||
diff --git a/arch/powerpc/lib/devres.c b/arch/powerpc/lib/devres.c new file mode 100644 index 00000000000..292115d98ea --- /dev/null +++ b/arch/powerpc/lib/devres.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/device.h> /* devres_*(), devm_ioremap_release() */ | ||
11 | #include <linux/io.h> /* ioremap_flags() */ | ||
12 | #include <linux/module.h> /* EXPORT_SYMBOL() */ | ||
13 | |||
14 | /** | ||
15 | * devm_ioremap_prot - Managed ioremap_flags() | ||
16 | * @dev: Generic device to remap IO address for | ||
17 | * @offset: BUS offset to map | ||
18 | * @size: Size of map | ||
19 | * @flags: Page flags | ||
20 | * | ||
21 | * Managed ioremap_prot(). Map is automatically unmapped on driver | ||
22 | * detach. | ||
23 | */ | ||
24 | void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset, | ||
25 | size_t size, unsigned long flags) | ||
26 | { | ||
27 | void __iomem **ptr, *addr; | ||
28 | |||
29 | ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL); | ||
30 | if (!ptr) | ||
31 | return NULL; | ||
32 | |||
33 | addr = ioremap_flags(offset, size, flags); | ||
34 | if (addr) { | ||
35 | *ptr = addr; | ||
36 | devres_add(dev, ptr); | ||
37 | } else | ||
38 | devres_free(ptr); | ||
39 | |||
40 | return addr; | ||
41 | } | ||
42 | EXPORT_SYMBOL(devm_ioremap_prot); | ||
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c index 04f74f9f9ab..5bf7df14602 100644 --- a/arch/powerpc/platforms/cell/interrupt.c +++ b/arch/powerpc/platforms/cell/interrupt.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/percpu.h> | 35 | #include <linux/percpu.h> |
36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
37 | #include <linux/ioport.h> | 37 | #include <linux/ioport.h> |
38 | #include <linux/kernel_stat.h> | ||
38 | 39 | ||
39 | #include <asm/io.h> | 40 | #include <asm/io.h> |
40 | #include <asm/pgtable.h> | 41 | #include <asm/pgtable.h> |
@@ -231,6 +232,54 @@ static int iic_host_match(struct irq_host *h, struct device_node *node) | |||
231 | "IBM,CBEA-Internal-Interrupt-Controller"); | 232 | "IBM,CBEA-Internal-Interrupt-Controller"); |
232 | } | 233 | } |
233 | 234 | ||
235 | extern int noirqdebug; | ||
236 | |||
237 | static void handle_iic_irq(unsigned int irq, struct irq_desc *desc) | ||
238 | { | ||
239 | const unsigned int cpu = smp_processor_id(); | ||
240 | |||
241 | spin_lock(&desc->lock); | ||
242 | |||
243 | desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); | ||
244 | |||
245 | /* | ||
246 | * If we're currently running this IRQ, or its disabled, | ||
247 | * we shouldn't process the IRQ. Mark it pending, handle | ||
248 | * the necessary masking and go out | ||
249 | */ | ||
250 | if (unlikely((desc->status & (IRQ_INPROGRESS | IRQ_DISABLED)) || | ||
251 | !desc->action)) { | ||
252 | desc->status |= IRQ_PENDING; | ||
253 | goto out_eoi; | ||
254 | } | ||
255 | |||
256 | kstat_cpu(cpu).irqs[irq]++; | ||
257 | |||
258 | /* Mark the IRQ currently in progress.*/ | ||
259 | desc->status |= IRQ_INPROGRESS; | ||
260 | |||
261 | do { | ||
262 | struct irqaction *action = desc->action; | ||
263 | irqreturn_t action_ret; | ||
264 | |||
265 | if (unlikely(!action)) | ||
266 | goto out_eoi; | ||
267 | |||
268 | desc->status &= ~IRQ_PENDING; | ||
269 | spin_unlock(&desc->lock); | ||
270 | action_ret = handle_IRQ_event(irq, action); | ||
271 | if (!noirqdebug) | ||
272 | note_interrupt(irq, desc, action_ret); | ||
273 | spin_lock(&desc->lock); | ||
274 | |||
275 | } while ((desc->status & (IRQ_PENDING | IRQ_DISABLED)) == IRQ_PENDING); | ||
276 | |||
277 | desc->status &= ~IRQ_INPROGRESS; | ||
278 | out_eoi: | ||
279 | desc->chip->eoi(irq); | ||
280 | spin_unlock(&desc->lock); | ||
281 | } | ||
282 | |||
234 | static int iic_host_map(struct irq_host *h, unsigned int virq, | 283 | static int iic_host_map(struct irq_host *h, unsigned int virq, |
235 | irq_hw_number_t hw) | 284 | irq_hw_number_t hw) |
236 | { | 285 | { |
@@ -240,10 +289,10 @@ static int iic_host_map(struct irq_host *h, unsigned int virq, | |||
240 | break; | 289 | break; |
241 | case IIC_IRQ_TYPE_IOEXC: | 290 | case IIC_IRQ_TYPE_IOEXC: |
242 | set_irq_chip_and_handler(virq, &iic_ioexc_chip, | 291 | set_irq_chip_and_handler(virq, &iic_ioexc_chip, |
243 | handle_fasteoi_irq); | 292 | handle_iic_irq); |
244 | break; | 293 | break; |
245 | default: | 294 | default: |
246 | set_irq_chip_and_handler(virq, &iic_chip, handle_fasteoi_irq); | 295 | set_irq_chip_and_handler(virq, &iic_chip, handle_iic_irq); |
247 | } | 296 | } |
248 | return 0; | 297 | return 0; |
249 | } | 298 | } |
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index 6bab44b7716..70c660121ec 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
@@ -141,6 +141,10 @@ static void spu_restart_dma(struct spu *spu) | |||
141 | 141 | ||
142 | if (!test_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags)) | 142 | if (!test_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags)) |
143 | out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND); | 143 | out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND); |
144 | else { | ||
145 | set_bit(SPU_CONTEXT_FAULT_PENDING, &spu->flags); | ||
146 | mb(); | ||
147 | } | ||
144 | } | 148 | } |
145 | 149 | ||
146 | static inline void spu_load_slb(struct spu *spu, int slbe, struct spu_slb *slb) | 150 | static inline void spu_load_slb(struct spu *spu, int slbe, struct spu_slb *slb) |
@@ -226,11 +230,13 @@ static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr) | |||
226 | return 0; | 230 | return 0; |
227 | } | 231 | } |
228 | 232 | ||
229 | spu->class_0_pending = 0; | 233 | spu->class_1_dar = ea; |
230 | spu->dar = ea; | 234 | spu->class_1_dsisr = dsisr; |
231 | spu->dsisr = dsisr; | 235 | |
236 | spu->stop_callback(spu, 1); | ||
232 | 237 | ||
233 | spu->stop_callback(spu); | 238 | spu->class_1_dar = 0; |
239 | spu->class_1_dsisr = 0; | ||
234 | 240 | ||
235 | return 0; | 241 | return 0; |
236 | } | 242 | } |
@@ -318,11 +324,15 @@ spu_irq_class_0(int irq, void *data) | |||
318 | stat = spu_int_stat_get(spu, 0) & mask; | 324 | stat = spu_int_stat_get(spu, 0) & mask; |
319 | 325 | ||
320 | spu->class_0_pending |= stat; | 326 | spu->class_0_pending |= stat; |
321 | spu->dsisr = spu_mfc_dsisr_get(spu); | 327 | spu->class_0_dsisr = spu_mfc_dsisr_get(spu); |
322 | spu->dar = spu_mfc_dar_get(spu); | 328 | spu->class_0_dar = spu_mfc_dar_get(spu); |
323 | spin_unlock(&spu->register_lock); | 329 | spin_unlock(&spu->register_lock); |
324 | 330 | ||
325 | spu->stop_callback(spu); | 331 | spu->stop_callback(spu, 0); |
332 | |||
333 | spu->class_0_pending = 0; | ||
334 | spu->class_0_dsisr = 0; | ||
335 | spu->class_0_dar = 0; | ||
326 | 336 | ||
327 | spu_int_stat_clear(spu, 0, stat); | 337 | spu_int_stat_clear(spu, 0, stat); |
328 | 338 | ||
@@ -363,6 +373,9 @@ spu_irq_class_1(int irq, void *data) | |||
363 | if (stat & CLASS1_LS_COMPARE_SUSPEND_ON_PUT_INTR) | 373 | if (stat & CLASS1_LS_COMPARE_SUSPEND_ON_PUT_INTR) |
364 | ; | 374 | ; |
365 | 375 | ||
376 | spu->class_1_dsisr = 0; | ||
377 | spu->class_1_dar = 0; | ||
378 | |||
366 | return stat ? IRQ_HANDLED : IRQ_NONE; | 379 | return stat ? IRQ_HANDLED : IRQ_NONE; |
367 | } | 380 | } |
368 | 381 | ||
@@ -396,10 +409,10 @@ spu_irq_class_2(int irq, void *data) | |||
396 | spu->ibox_callback(spu); | 409 | spu->ibox_callback(spu); |
397 | 410 | ||
398 | if (stat & CLASS2_SPU_STOP_INTR) | 411 | if (stat & CLASS2_SPU_STOP_INTR) |
399 | spu->stop_callback(spu); | 412 | spu->stop_callback(spu, 2); |
400 | 413 | ||
401 | if (stat & CLASS2_SPU_HALT_INTR) | 414 | if (stat & CLASS2_SPU_HALT_INTR) |
402 | spu->stop_callback(spu); | 415 | spu->stop_callback(spu, 2); |
403 | 416 | ||
404 | if (stat & CLASS2_SPU_DMA_TAG_GROUP_COMPLETE_INTR) | 417 | if (stat & CLASS2_SPU_DMA_TAG_GROUP_COMPLETE_INTR) |
405 | spu->mfc_callback(spu); | 418 | spu->mfc_callback(spu); |
diff --git a/arch/powerpc/platforms/cell/spu_priv1_mmio.c b/arch/powerpc/platforms/cell/spu_priv1_mmio.c index 67fa7247b80..906a0a2a9fe 100644 --- a/arch/powerpc/platforms/cell/spu_priv1_mmio.c +++ b/arch/powerpc/platforms/cell/spu_priv1_mmio.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
31 | #include <linux/sched.h> | ||
31 | 32 | ||
32 | #include <asm/spu.h> | 33 | #include <asm/spu.h> |
33 | #include <asm/spu_priv1.h> | 34 | #include <asm/spu_priv1.h> |
@@ -75,8 +76,19 @@ static u64 int_stat_get(struct spu *spu, int class) | |||
75 | 76 | ||
76 | static void cpu_affinity_set(struct spu *spu, int cpu) | 77 | static void cpu_affinity_set(struct spu *spu, int cpu) |
77 | { | 78 | { |
78 | u64 target = iic_get_target_id(cpu); | 79 | u64 target; |
79 | u64 route = target << 48 | target << 32 | target << 16; | 80 | u64 route; |
81 | |||
82 | if (nr_cpus_node(spu->node)) { | ||
83 | cpumask_t spumask = node_to_cpumask(spu->node); | ||
84 | cpumask_t cpumask = node_to_cpumask(cpu_to_node(cpu)); | ||
85 | |||
86 | if (!cpus_intersects(spumask, cpumask)) | ||
87 | return; | ||
88 | } | ||
89 | |||
90 | target = iic_get_target_id(cpu); | ||
91 | route = target << 48 | target << 32 | target << 16; | ||
80 | out_be64(&spu->priv1->int_route_RW, route); | 92 | out_be64(&spu->priv1->int_route_RW, route); |
81 | } | 93 | } |
82 | 94 | ||
diff --git a/arch/powerpc/platforms/cell/spufs/fault.c b/arch/powerpc/platforms/cell/spufs/fault.c index e46d300e21a..f093a581ac7 100644 --- a/arch/powerpc/platforms/cell/spufs/fault.c +++ b/arch/powerpc/platforms/cell/spufs/fault.c | |||
@@ -83,13 +83,18 @@ int spufs_handle_class0(struct spu_context *ctx) | |||
83 | return 0; | 83 | return 0; |
84 | 84 | ||
85 | if (stat & CLASS0_DMA_ALIGNMENT_INTR) | 85 | if (stat & CLASS0_DMA_ALIGNMENT_INTR) |
86 | spufs_handle_event(ctx, ctx->csa.dar, SPE_EVENT_DMA_ALIGNMENT); | 86 | spufs_handle_event(ctx, ctx->csa.class_0_dar, |
87 | SPE_EVENT_DMA_ALIGNMENT); | ||
87 | 88 | ||
88 | if (stat & CLASS0_INVALID_DMA_COMMAND_INTR) | 89 | if (stat & CLASS0_INVALID_DMA_COMMAND_INTR) |
89 | spufs_handle_event(ctx, ctx->csa.dar, SPE_EVENT_INVALID_DMA); | 90 | spufs_handle_event(ctx, ctx->csa.class_0_dar, |
91 | SPE_EVENT_INVALID_DMA); | ||
90 | 92 | ||
91 | if (stat & CLASS0_SPU_ERROR_INTR) | 93 | if (stat & CLASS0_SPU_ERROR_INTR) |
92 | spufs_handle_event(ctx, ctx->csa.dar, SPE_EVENT_SPE_ERROR); | 94 | spufs_handle_event(ctx, ctx->csa.class_0_dar, |
95 | SPE_EVENT_SPE_ERROR); | ||
96 | |||
97 | ctx->csa.class_0_pending = 0; | ||
93 | 98 | ||
94 | return -EIO; | 99 | return -EIO; |
95 | } | 100 | } |
@@ -119,8 +124,8 @@ int spufs_handle_class1(struct spu_context *ctx) | |||
119 | * in time, we can still expect to get the same fault | 124 | * in time, we can still expect to get the same fault |
120 | * the immediately after the context restore. | 125 | * the immediately after the context restore. |
121 | */ | 126 | */ |
122 | ea = ctx->csa.dar; | 127 | ea = ctx->csa.class_1_dar; |
123 | dsisr = ctx->csa.dsisr; | 128 | dsisr = ctx->csa.class_1_dsisr; |
124 | 129 | ||
125 | if (!(dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED))) | 130 | if (!(dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED))) |
126 | return 0; | 131 | return 0; |
@@ -158,7 +163,7 @@ int spufs_handle_class1(struct spu_context *ctx) | |||
158 | * time slicing will not preempt the context while the page fault | 163 | * time slicing will not preempt the context while the page fault |
159 | * handler is running. Context switch code removes mappings. | 164 | * handler is running. Context switch code removes mappings. |
160 | */ | 165 | */ |
161 | ctx->csa.dar = ctx->csa.dsisr = 0; | 166 | ctx->csa.class_1_dar = ctx->csa.class_1_dsisr = 0; |
162 | 167 | ||
163 | /* | 168 | /* |
164 | * If we handled the fault successfully and are in runnable | 169 | * If we handled the fault successfully and are in runnable |
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 0c32a05ab06..f407b247185 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/file.h> | 24 | #include <linux/file.h> |
25 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
26 | #include <linux/fsnotify.h> | ||
26 | #include <linux/backing-dev.h> | 27 | #include <linux/backing-dev.h> |
27 | #include <linux/init.h> | 28 | #include <linux/init.h> |
28 | #include <linux/ioctl.h> | 29 | #include <linux/ioctl.h> |
@@ -223,7 +224,7 @@ static int spufs_dir_close(struct inode *inode, struct file *file) | |||
223 | parent = dir->d_parent->d_inode; | 224 | parent = dir->d_parent->d_inode; |
224 | ctx = SPUFS_I(dir->d_inode)->i_ctx; | 225 | ctx = SPUFS_I(dir->d_inode)->i_ctx; |
225 | 226 | ||
226 | mutex_lock(&parent->i_mutex); | 227 | mutex_lock_nested(&parent->i_mutex, I_MUTEX_PARENT); |
227 | ret = spufs_rmdir(parent, dir); | 228 | ret = spufs_rmdir(parent, dir); |
228 | mutex_unlock(&parent->i_mutex); | 229 | mutex_unlock(&parent->i_mutex); |
229 | WARN_ON(ret); | 230 | WARN_ON(ret); |
@@ -618,12 +619,15 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode, | |||
618 | mode &= ~current->fs->umask; | 619 | mode &= ~current->fs->umask; |
619 | 620 | ||
620 | if (flags & SPU_CREATE_GANG) | 621 | if (flags & SPU_CREATE_GANG) |
621 | return spufs_create_gang(nd->path.dentry->d_inode, | 622 | ret = spufs_create_gang(nd->path.dentry->d_inode, |
622 | dentry, nd->path.mnt, mode); | 623 | dentry, nd->path.mnt, mode); |
623 | else | 624 | else |
624 | return spufs_create_context(nd->path.dentry->d_inode, | 625 | ret = spufs_create_context(nd->path.dentry->d_inode, |
625 | dentry, nd->path.mnt, flags, mode, | 626 | dentry, nd->path.mnt, flags, mode, |
626 | filp); | 627 | filp); |
628 | if (ret >= 0) | ||
629 | fsnotify_mkdir(nd->path.dentry->d_inode, dentry); | ||
630 | return ret; | ||
627 | 631 | ||
628 | out_dput: | 632 | out_dput: |
629 | dput(dentry); | 633 | dput(dentry); |
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c index a9c35b7b719..b7493b86581 100644 --- a/arch/powerpc/platforms/cell/spufs/run.c +++ b/arch/powerpc/platforms/cell/spufs/run.c | |||
@@ -11,7 +11,7 @@ | |||
11 | #include "spufs.h" | 11 | #include "spufs.h" |
12 | 12 | ||
13 | /* interrupt-level stop callback function. */ | 13 | /* interrupt-level stop callback function. */ |
14 | void spufs_stop_callback(struct spu *spu) | 14 | void spufs_stop_callback(struct spu *spu, int irq) |
15 | { | 15 | { |
16 | struct spu_context *ctx = spu->ctx; | 16 | struct spu_context *ctx = spu->ctx; |
17 | 17 | ||
@@ -24,9 +24,19 @@ void spufs_stop_callback(struct spu *spu) | |||
24 | */ | 24 | */ |
25 | if (ctx) { | 25 | if (ctx) { |
26 | /* Copy exception arguments into module specific structure */ | 26 | /* Copy exception arguments into module specific structure */ |
27 | ctx->csa.class_0_pending = spu->class_0_pending; | 27 | switch(irq) { |
28 | ctx->csa.dsisr = spu->dsisr; | 28 | case 0 : |
29 | ctx->csa.dar = spu->dar; | 29 | ctx->csa.class_0_pending = spu->class_0_pending; |
30 | ctx->csa.class_0_dsisr = spu->class_0_dsisr; | ||
31 | ctx->csa.class_0_dar = spu->class_0_dar; | ||
32 | break; | ||
33 | case 1 : | ||
34 | ctx->csa.class_1_dsisr = spu->class_1_dsisr; | ||
35 | ctx->csa.class_1_dar = spu->class_1_dar; | ||
36 | break; | ||
37 | case 2 : | ||
38 | break; | ||
39 | } | ||
30 | 40 | ||
31 | /* ensure that the exception status has hit memory before a | 41 | /* ensure that the exception status has hit memory before a |
32 | * thread waiting on the context's stop queue is woken */ | 42 | * thread waiting on the context's stop queue is woken */ |
@@ -34,11 +44,6 @@ void spufs_stop_callback(struct spu *spu) | |||
34 | 44 | ||
35 | wake_up_all(&ctx->stop_wq); | 45 | wake_up_all(&ctx->stop_wq); |
36 | } | 46 | } |
37 | |||
38 | /* Clear callback arguments from spu structure */ | ||
39 | spu->class_0_pending = 0; | ||
40 | spu->dsisr = 0; | ||
41 | spu->dar = 0; | ||
42 | } | 47 | } |
43 | 48 | ||
44 | int spu_stopped(struct spu_context *ctx, u32 *stat) | 49 | int spu_stopped(struct spu_context *ctx, u32 *stat) |
@@ -56,7 +61,11 @@ int spu_stopped(struct spu_context *ctx, u32 *stat) | |||
56 | if (!(*stat & SPU_STATUS_RUNNING) && (*stat & stopped)) | 61 | if (!(*stat & SPU_STATUS_RUNNING) && (*stat & stopped)) |
57 | return 1; | 62 | return 1; |
58 | 63 | ||
59 | dsisr = ctx->csa.dsisr; | 64 | dsisr = ctx->csa.class_0_dsisr; |
65 | if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) | ||
66 | return 1; | ||
67 | |||
68 | dsisr = ctx->csa.class_1_dsisr; | ||
60 | if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) | 69 | if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) |
61 | return 1; | 70 | return 1; |
62 | 71 | ||
@@ -294,7 +303,7 @@ static int spu_process_callback(struct spu_context *ctx) | |||
294 | u32 ls_pointer, npc; | 303 | u32 ls_pointer, npc; |
295 | void __iomem *ls; | 304 | void __iomem *ls; |
296 | long spu_ret; | 305 | long spu_ret; |
297 | int ret, ret2; | 306 | int ret; |
298 | 307 | ||
299 | /* get syscall block from local store */ | 308 | /* get syscall block from local store */ |
300 | npc = ctx->ops->npc_read(ctx) & ~3; | 309 | npc = ctx->ops->npc_read(ctx) & ~3; |
@@ -316,11 +325,9 @@ static int spu_process_callback(struct spu_context *ctx) | |||
316 | if (spu_ret <= -ERESTARTSYS) { | 325 | if (spu_ret <= -ERESTARTSYS) { |
317 | ret = spu_handle_restartsys(ctx, &spu_ret, &npc); | 326 | ret = spu_handle_restartsys(ctx, &spu_ret, &npc); |
318 | } | 327 | } |
319 | ret2 = spu_acquire(ctx); | 328 | mutex_lock(&ctx->state_mutex); |
320 | if (ret == -ERESTARTSYS) | 329 | if (ret == -ERESTARTSYS) |
321 | return ret; | 330 | return ret; |
322 | if (ret2) | ||
323 | return -EINTR; | ||
324 | } | 331 | } |
325 | 332 | ||
326 | /* need to re-get the ls, as it may have changed when we released the | 333 | /* need to re-get the ls, as it may have changed when we released the |
@@ -343,13 +350,14 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event) | |||
343 | if (mutex_lock_interruptible(&ctx->run_mutex)) | 350 | if (mutex_lock_interruptible(&ctx->run_mutex)) |
344 | return -ERESTARTSYS; | 351 | return -ERESTARTSYS; |
345 | 352 | ||
346 | spu_enable_spu(ctx); | ||
347 | ctx->event_return = 0; | 353 | ctx->event_return = 0; |
348 | 354 | ||
349 | ret = spu_acquire(ctx); | 355 | ret = spu_acquire(ctx); |
350 | if (ret) | 356 | if (ret) |
351 | goto out_unlock; | 357 | goto out_unlock; |
352 | 358 | ||
359 | spu_enable_spu(ctx); | ||
360 | |||
353 | spu_update_sched_info(ctx); | 361 | spu_update_sched_info(ctx); |
354 | 362 | ||
355 | ret = spu_run_init(ctx, npc); | 363 | ret = spu_run_init(ctx, npc); |
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 7298e7db2c8..2e411f23462 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
@@ -140,6 +140,9 @@ void __spu_update_sched_info(struct spu_context *ctx) | |||
140 | * if it is timesliced or preempted. | 140 | * if it is timesliced or preempted. |
141 | */ | 141 | */ |
142 | ctx->cpus_allowed = current->cpus_allowed; | 142 | ctx->cpus_allowed = current->cpus_allowed; |
143 | |||
144 | /* Save the current cpu id for spu interrupt routing. */ | ||
145 | ctx->last_ran = raw_smp_processor_id(); | ||
143 | } | 146 | } |
144 | 147 | ||
145 | void spu_update_sched_info(struct spu_context *ctx) | 148 | void spu_update_sched_info(struct spu_context *ctx) |
@@ -243,7 +246,6 @@ static void spu_bind_context(struct spu *spu, struct spu_context *ctx) | |||
243 | spu_switch_log_notify(spu, ctx, SWITCH_LOG_START, 0); | 246 | spu_switch_log_notify(spu, ctx, SWITCH_LOG_START, 0); |
244 | spu_restore(&ctx->csa, spu); | 247 | spu_restore(&ctx->csa, spu); |
245 | spu->timestamp = jiffies; | 248 | spu->timestamp = jiffies; |
246 | spu_cpu_affinity_set(spu, raw_smp_processor_id()); | ||
247 | spu_switch_notify(spu, ctx); | 249 | spu_switch_notify(spu, ctx); |
248 | ctx->state = SPU_STATE_RUNNABLE; | 250 | ctx->state = SPU_STATE_RUNNABLE; |
249 | 251 | ||
@@ -657,7 +659,8 @@ static struct spu *find_victim(struct spu_context *ctx) | |||
657 | 659 | ||
658 | victim->stats.invol_ctx_switch++; | 660 | victim->stats.invol_ctx_switch++; |
659 | spu->stats.invol_ctx_switch++; | 661 | spu->stats.invol_ctx_switch++; |
660 | spu_add_to_rq(victim); | 662 | if (test_bit(SPU_SCHED_SPU_RUN, &ctx->sched_flags)) |
663 | spu_add_to_rq(victim); | ||
661 | 664 | ||
662 | mutex_unlock(&victim->state_mutex); | 665 | mutex_unlock(&victim->state_mutex); |
663 | 666 | ||
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h index 7312745b754..454c277c145 100644 --- a/arch/powerpc/platforms/cell/spufs/spufs.h +++ b/arch/powerpc/platforms/cell/spufs/spufs.h | |||
@@ -121,6 +121,7 @@ struct spu_context { | |||
121 | cpumask_t cpus_allowed; | 121 | cpumask_t cpus_allowed; |
122 | int policy; | 122 | int policy; |
123 | int prio; | 123 | int prio; |
124 | int last_ran; | ||
124 | 125 | ||
125 | /* statistics */ | 126 | /* statistics */ |
126 | struct { | 127 | struct { |
@@ -331,7 +332,7 @@ size_t spu_ibox_read(struct spu_context *ctx, u32 *data); | |||
331 | /* irq callback funcs. */ | 332 | /* irq callback funcs. */ |
332 | void spufs_ibox_callback(struct spu *spu); | 333 | void spufs_ibox_callback(struct spu *spu); |
333 | void spufs_wbox_callback(struct spu *spu); | 334 | void spufs_wbox_callback(struct spu *spu); |
334 | void spufs_stop_callback(struct spu *spu); | 335 | void spufs_stop_callback(struct spu *spu, int irq); |
335 | void spufs_mfc_callback(struct spu *spu); | 336 | void spufs_mfc_callback(struct spu *spu); |
336 | void spufs_dma_callback(struct spu *spu, int type); | 337 | void spufs_dma_callback(struct spu *spu, int type); |
337 | 338 | ||
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c index d2a1249d36d..3df9a36eb2f 100644 --- a/arch/powerpc/platforms/cell/spufs/switch.c +++ b/arch/powerpc/platforms/cell/spufs/switch.c | |||
@@ -132,6 +132,14 @@ static inline void disable_interrupts(struct spu_state *csa, struct spu *spu) | |||
132 | spu_int_mask_set(spu, 2, 0ul); | 132 | spu_int_mask_set(spu, 2, 0ul); |
133 | eieio(); | 133 | eieio(); |
134 | spin_unlock_irq(&spu->register_lock); | 134 | spin_unlock_irq(&spu->register_lock); |
135 | |||
136 | /* | ||
137 | * This flag needs to be set before calling synchronize_irq so | ||
138 | * that the update will be visible to the relevant handlers | ||
139 | * via a simple load. | ||
140 | */ | ||
141 | set_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags); | ||
142 | clear_bit(SPU_CONTEXT_FAULT_PENDING, &spu->flags); | ||
135 | synchronize_irq(spu->irqs[0]); | 143 | synchronize_irq(spu->irqs[0]); |
136 | synchronize_irq(spu->irqs[1]); | 144 | synchronize_irq(spu->irqs[1]); |
137 | synchronize_irq(spu->irqs[2]); | 145 | synchronize_irq(spu->irqs[2]); |
@@ -166,9 +174,8 @@ static inline void set_switch_pending(struct spu_state *csa, struct spu *spu) | |||
166 | /* Save, Step 7: | 174 | /* Save, Step 7: |
167 | * Restore, Step 5: | 175 | * Restore, Step 5: |
168 | * Set a software context switch pending flag. | 176 | * Set a software context switch pending flag. |
177 | * Done above in Step 3 - disable_interrupts(). | ||
169 | */ | 178 | */ |
170 | set_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags); | ||
171 | mb(); | ||
172 | } | 179 | } |
173 | 180 | ||
174 | static inline void save_mfc_cntl(struct spu_state *csa, struct spu *spu) | 181 | static inline void save_mfc_cntl(struct spu_state *csa, struct spu *spu) |
@@ -186,20 +193,21 @@ static inline void save_mfc_cntl(struct spu_state *csa, struct spu *spu) | |||
186 | MFC_CNTL_SUSPEND_COMPLETE); | 193 | MFC_CNTL_SUSPEND_COMPLETE); |
187 | /* fall through */ | 194 | /* fall through */ |
188 | case MFC_CNTL_SUSPEND_COMPLETE: | 195 | case MFC_CNTL_SUSPEND_COMPLETE: |
189 | if (csa) { | 196 | if (csa) |
190 | csa->priv2.mfc_control_RW = | 197 | csa->priv2.mfc_control_RW = |
191 | MFC_CNTL_SUSPEND_MASK | | 198 | in_be64(&priv2->mfc_control_RW) | |
192 | MFC_CNTL_SUSPEND_DMA_QUEUE; | 199 | MFC_CNTL_SUSPEND_DMA_QUEUE; |
193 | } | ||
194 | break; | 200 | break; |
195 | case MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION: | 201 | case MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION: |
196 | out_be64(&priv2->mfc_control_RW, MFC_CNTL_SUSPEND_DMA_QUEUE); | 202 | out_be64(&priv2->mfc_control_RW, MFC_CNTL_SUSPEND_DMA_QUEUE); |
197 | POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) & | 203 | POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) & |
198 | MFC_CNTL_SUSPEND_DMA_STATUS_MASK) == | 204 | MFC_CNTL_SUSPEND_DMA_STATUS_MASK) == |
199 | MFC_CNTL_SUSPEND_COMPLETE); | 205 | MFC_CNTL_SUSPEND_COMPLETE); |
200 | if (csa) { | 206 | if (csa) |
201 | csa->priv2.mfc_control_RW = 0; | 207 | csa->priv2.mfc_control_RW = |
202 | } | 208 | in_be64(&priv2->mfc_control_RW) & |
209 | ~MFC_CNTL_SUSPEND_DMA_QUEUE & | ||
210 | ~MFC_CNTL_SUSPEND_MASK; | ||
203 | break; | 211 | break; |
204 | } | 212 | } |
205 | } | 213 | } |
@@ -249,16 +257,21 @@ static inline void save_spu_status(struct spu_state *csa, struct spu *spu) | |||
249 | } | 257 | } |
250 | } | 258 | } |
251 | 259 | ||
252 | static inline void save_mfc_decr(struct spu_state *csa, struct spu *spu) | 260 | static inline void save_mfc_stopped_status(struct spu_state *csa, |
261 | struct spu *spu) | ||
253 | { | 262 | { |
254 | struct spu_priv2 __iomem *priv2 = spu->priv2; | 263 | struct spu_priv2 __iomem *priv2 = spu->priv2; |
264 | const u64 mask = MFC_CNTL_DECREMENTER_RUNNING | | ||
265 | MFC_CNTL_DMA_QUEUES_EMPTY; | ||
255 | 266 | ||
256 | /* Save, Step 12: | 267 | /* Save, Step 12: |
257 | * Read MFC_CNTL[Ds]. Update saved copy of | 268 | * Read MFC_CNTL[Ds]. Update saved copy of |
258 | * CSA.MFC_CNTL[Ds]. | 269 | * CSA.MFC_CNTL[Ds]. |
270 | * | ||
271 | * update: do the same with MFC_CNTL[Q]. | ||
259 | */ | 272 | */ |
260 | csa->priv2.mfc_control_RW |= | 273 | csa->priv2.mfc_control_RW &= ~mask; |
261 | in_be64(&priv2->mfc_control_RW) & MFC_CNTL_DECREMENTER_RUNNING; | 274 | csa->priv2.mfc_control_RW |= in_be64(&priv2->mfc_control_RW) & mask; |
262 | } | 275 | } |
263 | 276 | ||
264 | static inline void halt_mfc_decr(struct spu_state *csa, struct spu *spu) | 277 | static inline void halt_mfc_decr(struct spu_state *csa, struct spu *spu) |
@@ -462,7 +475,9 @@ static inline void purge_mfc_queue(struct spu_state *csa, struct spu *spu) | |||
462 | * Restore, Step 14. | 475 | * Restore, Step 14. |
463 | * Write MFC_CNTL[Pc]=1 (purge queue). | 476 | * Write MFC_CNTL[Pc]=1 (purge queue). |
464 | */ | 477 | */ |
465 | out_be64(&priv2->mfc_control_RW, MFC_CNTL_PURGE_DMA_REQUEST); | 478 | out_be64(&priv2->mfc_control_RW, |
479 | MFC_CNTL_PURGE_DMA_REQUEST | | ||
480 | MFC_CNTL_SUSPEND_MASK); | ||
466 | eieio(); | 481 | eieio(); |
467 | } | 482 | } |
468 | 483 | ||
@@ -725,10 +740,14 @@ static inline void set_switch_active(struct spu_state *csa, struct spu *spu) | |||
725 | /* Save, Step 48: | 740 | /* Save, Step 48: |
726 | * Restore, Step 23. | 741 | * Restore, Step 23. |
727 | * Change the software context switch pending flag | 742 | * Change the software context switch pending flag |
728 | * to context switch active. | 743 | * to context switch active. This implementation does |
744 | * not uses a switch active flag. | ||
729 | * | 745 | * |
730 | * This implementation does not uses a switch active flag. | 746 | * Now that we have saved the mfc in the csa, we can add in the |
747 | * restart command if an exception occurred. | ||
731 | */ | 748 | */ |
749 | if (test_bit(SPU_CONTEXT_FAULT_PENDING, &spu->flags)) | ||
750 | csa->priv2.mfc_control_RW |= MFC_CNTL_RESTART_DMA_COMMAND; | ||
732 | clear_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags); | 751 | clear_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags); |
733 | mb(); | 752 | mb(); |
734 | } | 753 | } |
@@ -1690,6 +1709,13 @@ static inline void restore_mfc_sr1(struct spu_state *csa, struct spu *spu) | |||
1690 | eieio(); | 1709 | eieio(); |
1691 | } | 1710 | } |
1692 | 1711 | ||
1712 | static inline void set_int_route(struct spu_state *csa, struct spu *spu) | ||
1713 | { | ||
1714 | struct spu_context *ctx = spu->ctx; | ||
1715 | |||
1716 | spu_cpu_affinity_set(spu, ctx->last_ran); | ||
1717 | } | ||
1718 | |||
1693 | static inline void restore_other_spu_access(struct spu_state *csa, | 1719 | static inline void restore_other_spu_access(struct spu_state *csa, |
1694 | struct spu *spu) | 1720 | struct spu *spu) |
1695 | { | 1721 | { |
@@ -1721,15 +1747,15 @@ static inline void restore_mfc_cntl(struct spu_state *csa, struct spu *spu) | |||
1721 | */ | 1747 | */ |
1722 | out_be64(&priv2->mfc_control_RW, csa->priv2.mfc_control_RW); | 1748 | out_be64(&priv2->mfc_control_RW, csa->priv2.mfc_control_RW); |
1723 | eieio(); | 1749 | eieio(); |
1750 | |||
1724 | /* | 1751 | /* |
1725 | * FIXME: this is to restart a DMA that we were processing | 1752 | * The queue is put back into the same state that was evident prior to |
1726 | * before the save. better remember the fault information | 1753 | * the context switch. The suspend flag is added to the saved state in |
1727 | * in the csa instead. | 1754 | * the csa, if the operational state was suspending or suspended. In |
1755 | * this case, the code that suspended the mfc is responsible for | ||
1756 | * continuing it. Note that SPE faults do not change the operational | ||
1757 | * state of the spu. | ||
1728 | */ | 1758 | */ |
1729 | if ((csa->priv2.mfc_control_RW & MFC_CNTL_SUSPEND_DMA_QUEUE_MASK)) { | ||
1730 | out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND); | ||
1731 | eieio(); | ||
1732 | } | ||
1733 | } | 1759 | } |
1734 | 1760 | ||
1735 | static inline void enable_user_access(struct spu_state *csa, struct spu *spu) | 1761 | static inline void enable_user_access(struct spu_state *csa, struct spu *spu) |
@@ -1788,7 +1814,7 @@ static int quiece_spu(struct spu_state *prev, struct spu *spu) | |||
1788 | save_spu_runcntl(prev, spu); /* Step 9. */ | 1814 | save_spu_runcntl(prev, spu); /* Step 9. */ |
1789 | save_mfc_sr1(prev, spu); /* Step 10. */ | 1815 | save_mfc_sr1(prev, spu); /* Step 10. */ |
1790 | save_spu_status(prev, spu); /* Step 11. */ | 1816 | save_spu_status(prev, spu); /* Step 11. */ |
1791 | save_mfc_decr(prev, spu); /* Step 12. */ | 1817 | save_mfc_stopped_status(prev, spu); /* Step 12. */ |
1792 | halt_mfc_decr(prev, spu); /* Step 13. */ | 1818 | halt_mfc_decr(prev, spu); /* Step 13. */ |
1793 | save_timebase(prev, spu); /* Step 14. */ | 1819 | save_timebase(prev, spu); /* Step 14. */ |
1794 | remove_other_spu_access(prev, spu); /* Step 15. */ | 1820 | remove_other_spu_access(prev, spu); /* Step 15. */ |
@@ -2000,6 +2026,7 @@ static void restore_csa(struct spu_state *next, struct spu *spu) | |||
2000 | check_ppuint_mb_stat(next, spu); /* Step 67. */ | 2026 | check_ppuint_mb_stat(next, spu); /* Step 67. */ |
2001 | spu_invalidate_slbs(spu); /* Modified Step 68. */ | 2027 | spu_invalidate_slbs(spu); /* Modified Step 68. */ |
2002 | restore_mfc_sr1(next, spu); /* Step 69. */ | 2028 | restore_mfc_sr1(next, spu); /* Step 69. */ |
2029 | set_int_route(next, spu); /* NEW */ | ||
2003 | restore_other_spu_access(next, spu); /* Step 70. */ | 2030 | restore_other_spu_access(next, spu); /* Step 70. */ |
2004 | restore_spu_runcntl(next, spu); /* Step 71. */ | 2031 | restore_spu_runcntl(next, spu); /* Step 71. */ |
2005 | restore_mfc_cntl(next, spu); /* Step 72. */ | 2032 | restore_mfc_cntl(next, spu); /* Step 72. */ |
diff --git a/arch/powerpc/platforms/chrp/pegasos_eth.c b/arch/powerpc/platforms/chrp/pegasos_eth.c index 5bcc58d9a4d..130ff72d99d 100644 --- a/arch/powerpc/platforms/chrp/pegasos_eth.c +++ b/arch/powerpc/platforms/chrp/pegasos_eth.c | |||
@@ -58,7 +58,9 @@ static struct resource mv643xx_eth0_resources[] = { | |||
58 | 58 | ||
59 | 59 | ||
60 | static struct mv643xx_eth_platform_data eth0_pd = { | 60 | static struct mv643xx_eth_platform_data eth0_pd = { |
61 | .shared = &mv643xx_eth_shared_device, | ||
61 | .port_number = 0, | 62 | .port_number = 0, |
63 | |||
62 | .tx_sram_addr = PEGASOS2_SRAM_BASE_ETH0, | 64 | .tx_sram_addr = PEGASOS2_SRAM_BASE_ETH0, |
63 | .tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE, | 65 | .tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE, |
64 | .tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16, | 66 | .tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16, |
@@ -88,7 +90,9 @@ static struct resource mv643xx_eth1_resources[] = { | |||
88 | }; | 90 | }; |
89 | 91 | ||
90 | static struct mv643xx_eth_platform_data eth1_pd = { | 92 | static struct mv643xx_eth_platform_data eth1_pd = { |
93 | .shared = &mv643xx_eth_shared_device, | ||
91 | .port_number = 1, | 94 | .port_number = 1, |
95 | |||
92 | .tx_sram_addr = PEGASOS2_SRAM_BASE_ETH1, | 96 | .tx_sram_addr = PEGASOS2_SRAM_BASE_ETH1, |
93 | .tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE, | 97 | .tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE, |
94 | .tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16, | 98 | .tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16, |
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c index bec3803f061..417eca79df6 100644 --- a/arch/powerpc/platforms/pseries/scanlog.c +++ b/arch/powerpc/platforms/pseries/scanlog.c | |||
@@ -55,11 +55,6 @@ static ssize_t scanlog_read(struct file *file, char __user *buf, | |||
55 | dp = PDE(inode); | 55 | dp = PDE(inode); |
56 | data = (unsigned int *)dp->data; | 56 | data = (unsigned int *)dp->data; |
57 | 57 | ||
58 | if (!data) { | ||
59 | printk(KERN_ERR "scanlog: read failed no data\n"); | ||
60 | return -EIO; | ||
61 | } | ||
62 | |||
63 | if (count > RTAS_DATA_BUF_SIZE) | 58 | if (count > RTAS_DATA_BUF_SIZE) |
64 | count = RTAS_DATA_BUF_SIZE; | 59 | count = RTAS_DATA_BUF_SIZE; |
65 | 60 | ||
@@ -146,11 +141,6 @@ static int scanlog_open(struct inode * inode, struct file * file) | |||
146 | struct proc_dir_entry *dp = PDE(inode); | 141 | struct proc_dir_entry *dp = PDE(inode); |
147 | unsigned int *data = (unsigned int *)dp->data; | 142 | unsigned int *data = (unsigned int *)dp->data; |
148 | 143 | ||
149 | if (!data) { | ||
150 | printk(KERN_ERR "scanlog: open failed no data\n"); | ||
151 | return -EIO; | ||
152 | } | ||
153 | |||
154 | if (data[0] != 0) { | 144 | if (data[0] != 0) { |
155 | /* This imperfect test stops a second copy of the | 145 | /* This imperfect test stops a second copy of the |
156 | * data (or a reset while data is being copied) | 146 | * data (or a reset while data is being copied) |
@@ -168,10 +158,6 @@ static int scanlog_release(struct inode * inode, struct file * file) | |||
168 | struct proc_dir_entry *dp = PDE(inode); | 158 | struct proc_dir_entry *dp = PDE(inode); |
169 | unsigned int *data = (unsigned int *)dp->data; | 159 | unsigned int *data = (unsigned int *)dp->data; |
170 | 160 | ||
171 | if (!data) { | ||
172 | printk(KERN_ERR "scanlog: release failed no data\n"); | ||
173 | return -EIO; | ||
174 | } | ||
175 | data[0] = 0; | 161 | data[0] = 0; |
176 | 162 | ||
177 | return 0; | 163 | return 0; |
@@ -200,12 +186,11 @@ static int __init scanlog_init(void) | |||
200 | if (!data) | 186 | if (!data) |
201 | goto err; | 187 | goto err; |
202 | 188 | ||
203 | ent = proc_create("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, | 189 | ent = proc_create_data("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, |
204 | &scanlog_fops); | 190 | &scanlog_fops, data); |
205 | if (!ent) | 191 | if (!ent) |
206 | goto err; | 192 | goto err; |
207 | 193 | ||
208 | ent->data = data; | ||
209 | proc_ppc64_scan_log_dump = ent; | 194 | proc_ppc64_scan_log_dump = ent; |
210 | 195 | ||
211 | return 0; | 196 | return 0; |
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c index 41af1223e2a..a132e0de8ca 100644 --- a/arch/powerpc/sysdev/mv64x60_dev.c +++ b/arch/powerpc/sysdev/mv64x60_dev.c | |||
@@ -239,6 +239,8 @@ static int __init mv64x60_eth_device_setup(struct device_node *np, int id, | |||
239 | 239 | ||
240 | memset(&pdata, 0, sizeof(pdata)); | 240 | memset(&pdata, 0, sizeof(pdata)); |
241 | 241 | ||
242 | pdata.shared = shared_pdev; | ||
243 | |||
242 | prop = of_get_property(np, "reg", NULL); | 244 | prop = of_get_property(np, "reg", NULL); |
243 | if (!prop) | 245 | if (!prop) |
244 | return -ENODEV; | 246 | return -ENODEV; |
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c index 1814adbd223..b4a54c52e88 100644 --- a/arch/powerpc/sysdev/ppc4xx_pci.c +++ b/arch/powerpc/sysdev/ppc4xx_pci.c | |||
@@ -1387,28 +1387,59 @@ static void __init ppc4xx_configure_pciex_PIMs(struct ppc4xx_pciex_port *port, | |||
1387 | resource_size_t size = res->end - res->start + 1; | 1387 | resource_size_t size = res->end - res->start + 1; |
1388 | u64 sa; | 1388 | u64 sa; |
1389 | 1389 | ||
1390 | /* Calculate window size */ | 1390 | if (port->endpoint) { |
1391 | sa = (0xffffffffffffffffull << ilog2(size));; | 1391 | resource_size_t ep_addr = 0; |
1392 | if (res->flags & IORESOURCE_PREFETCH) | 1392 | resource_size_t ep_size = 32 << 20; |
1393 | sa |= 0x8; | 1393 | |
1394 | /* Currently we map a fixed 64MByte window to PLB address | ||
1395 | * 0 (SDRAM). This should probably be configurable via a dts | ||
1396 | * property. | ||
1397 | */ | ||
1398 | |||
1399 | /* Calculate window size */ | ||
1400 | sa = (0xffffffffffffffffull << ilog2(ep_size));; | ||
1401 | |||
1402 | /* Setup BAR0 */ | ||
1403 | out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa)); | ||
1404 | out_le32(mbase + PECFG_BAR0LMPA, RES_TO_U32_LOW(sa) | | ||
1405 | PCI_BASE_ADDRESS_MEM_TYPE_64); | ||
1394 | 1406 | ||
1395 | out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa)); | 1407 | /* Disable BAR1 & BAR2 */ |
1396 | out_le32(mbase + PECFG_BAR0LMPA, RES_TO_U32_LOW(sa)); | 1408 | out_le32(mbase + PECFG_BAR1MPA, 0); |
1409 | out_le32(mbase + PECFG_BAR2HMPA, 0); | ||
1410 | out_le32(mbase + PECFG_BAR2LMPA, 0); | ||
1397 | 1411 | ||
1398 | /* The setup of the split looks weird to me ... let's see if it works */ | 1412 | out_le32(mbase + PECFG_PIM01SAH, RES_TO_U32_HIGH(sa)); |
1399 | out_le32(mbase + PECFG_PIM0LAL, 0x00000000); | 1413 | out_le32(mbase + PECFG_PIM01SAL, RES_TO_U32_LOW(sa)); |
1400 | out_le32(mbase + PECFG_PIM0LAH, 0x00000000); | 1414 | |
1401 | out_le32(mbase + PECFG_PIM1LAL, 0x00000000); | 1415 | out_le32(mbase + PCI_BASE_ADDRESS_0, RES_TO_U32_LOW(ep_addr)); |
1402 | out_le32(mbase + PECFG_PIM1LAH, 0x00000000); | 1416 | out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(ep_addr)); |
1403 | out_le32(mbase + PECFG_PIM01SAH, 0xffff0000); | 1417 | } else { |
1404 | out_le32(mbase + PECFG_PIM01SAL, 0x00000000); | 1418 | /* Calculate window size */ |
1419 | sa = (0xffffffffffffffffull << ilog2(size));; | ||
1420 | if (res->flags & IORESOURCE_PREFETCH) | ||
1421 | sa |= 0x8; | ||
1422 | |||
1423 | out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa)); | ||
1424 | out_le32(mbase + PECFG_BAR0LMPA, RES_TO_U32_LOW(sa)); | ||
1425 | |||
1426 | /* The setup of the split looks weird to me ... let's see | ||
1427 | * if it works | ||
1428 | */ | ||
1429 | out_le32(mbase + PECFG_PIM0LAL, 0x00000000); | ||
1430 | out_le32(mbase + PECFG_PIM0LAH, 0x00000000); | ||
1431 | out_le32(mbase + PECFG_PIM1LAL, 0x00000000); | ||
1432 | out_le32(mbase + PECFG_PIM1LAH, 0x00000000); | ||
1433 | out_le32(mbase + PECFG_PIM01SAH, 0xffff0000); | ||
1434 | out_le32(mbase + PECFG_PIM01SAL, 0x00000000); | ||
1435 | |||
1436 | out_le32(mbase + PCI_BASE_ADDRESS_0, RES_TO_U32_LOW(res->start)); | ||
1437 | out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(res->start)); | ||
1438 | } | ||
1405 | 1439 | ||
1406 | /* Enable inbound mapping */ | 1440 | /* Enable inbound mapping */ |
1407 | out_le32(mbase + PECFG_PIMEN, 0x1); | 1441 | out_le32(mbase + PECFG_PIMEN, 0x1); |
1408 | 1442 | ||
1409 | out_le32(mbase + PCI_BASE_ADDRESS_0, RES_TO_U32_LOW(res->start)); | ||
1410 | out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(res->start)); | ||
1411 | |||
1412 | /* Enable I/O, Mem, and Busmaster cycles */ | 1443 | /* Enable I/O, Mem, and Busmaster cycles */ |
1413 | out_le16(mbase + PCI_COMMAND, | 1444 | out_le16(mbase + PCI_COMMAND, |
1414 | in_le16(mbase + PCI_COMMAND) | | 1445 | in_le16(mbase + PCI_COMMAND) | |
@@ -1422,13 +1453,8 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port) | |||
1422 | const int *bus_range; | 1453 | const int *bus_range; |
1423 | int primary = 0, busses; | 1454 | int primary = 0, busses; |
1424 | void __iomem *mbase = NULL, *cfg_data = NULL; | 1455 | void __iomem *mbase = NULL, *cfg_data = NULL; |
1425 | 1456 | const u32 *pval; | |
1426 | /* XXX FIXME: Handle endpoint mode properly */ | 1457 | u32 val; |
1427 | if (port->endpoint) { | ||
1428 | printk(KERN_WARNING "PCIE%d: Port in endpoint mode !\n", | ||
1429 | port->index); | ||
1430 | return; | ||
1431 | } | ||
1432 | 1458 | ||
1433 | /* Check if primary bridge */ | 1459 | /* Check if primary bridge */ |
1434 | if (of_get_property(port->node, "primary", NULL)) | 1460 | if (of_get_property(port->node, "primary", NULL)) |
@@ -1462,21 +1488,30 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port) | |||
1462 | hose->last_busno = hose->first_busno + busses; | 1488 | hose->last_busno = hose->first_busno + busses; |
1463 | } | 1489 | } |
1464 | 1490 | ||
1465 | /* We map the external config space in cfg_data and the host config | 1491 | if (!port->endpoint) { |
1466 | * space in cfg_addr. External space is 1M per bus, internal space | 1492 | /* Only map the external config space in cfg_data for |
1467 | * is 4K | 1493 | * PCIe root-complexes. External space is 1M per bus |
1494 | */ | ||
1495 | cfg_data = ioremap(port->cfg_space.start + | ||
1496 | (hose->first_busno + 1) * 0x100000, | ||
1497 | busses * 0x100000); | ||
1498 | if (cfg_data == NULL) { | ||
1499 | printk(KERN_ERR "%s: Can't map external config space !", | ||
1500 | port->node->full_name); | ||
1501 | goto fail; | ||
1502 | } | ||
1503 | hose->cfg_data = cfg_data; | ||
1504 | } | ||
1505 | |||
1506 | /* Always map the host config space in cfg_addr. | ||
1507 | * Internal space is 4K | ||
1468 | */ | 1508 | */ |
1469 | cfg_data = ioremap(port->cfg_space.start + | ||
1470 | (hose->first_busno + 1) * 0x100000, | ||
1471 | busses * 0x100000); | ||
1472 | mbase = ioremap(port->cfg_space.start + 0x10000000, 0x1000); | 1509 | mbase = ioremap(port->cfg_space.start + 0x10000000, 0x1000); |
1473 | if (cfg_data == NULL || mbase == NULL) { | 1510 | if (mbase == NULL) { |
1474 | printk(KERN_ERR "%s: Can't map config space !", | 1511 | printk(KERN_ERR "%s: Can't map internal config space !", |
1475 | port->node->full_name); | 1512 | port->node->full_name); |
1476 | goto fail; | 1513 | goto fail; |
1477 | } | 1514 | } |
1478 | |||
1479 | hose->cfg_data = cfg_data; | ||
1480 | hose->cfg_addr = mbase; | 1515 | hose->cfg_addr = mbase; |
1481 | 1516 | ||
1482 | pr_debug("PCIE %s, bus %d..%d\n", port->node->full_name, | 1517 | pr_debug("PCIE %s, bus %d..%d\n", port->node->full_name, |
@@ -1489,12 +1524,14 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port) | |||
1489 | port->hose = hose; | 1524 | port->hose = hose; |
1490 | mbase = (void __iomem *)hose->cfg_addr; | 1525 | mbase = (void __iomem *)hose->cfg_addr; |
1491 | 1526 | ||
1492 | /* | 1527 | if (!port->endpoint) { |
1493 | * Set bus numbers on our root port | 1528 | /* |
1494 | */ | 1529 | * Set bus numbers on our root port |
1495 | out_8(mbase + PCI_PRIMARY_BUS, hose->first_busno); | 1530 | */ |
1496 | out_8(mbase + PCI_SECONDARY_BUS, hose->first_busno + 1); | 1531 | out_8(mbase + PCI_PRIMARY_BUS, hose->first_busno); |
1497 | out_8(mbase + PCI_SUBORDINATE_BUS, hose->last_busno); | 1532 | out_8(mbase + PCI_SECONDARY_BUS, hose->first_busno + 1); |
1533 | out_8(mbase + PCI_SUBORDINATE_BUS, hose->last_busno); | ||
1534 | } | ||
1498 | 1535 | ||
1499 | /* | 1536 | /* |
1500 | * OMRs are already reset, also disable PIMs | 1537 | * OMRs are already reset, also disable PIMs |
@@ -1515,17 +1552,49 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port) | |||
1515 | ppc4xx_configure_pciex_PIMs(port, hose, mbase, &dma_window); | 1552 | ppc4xx_configure_pciex_PIMs(port, hose, mbase, &dma_window); |
1516 | 1553 | ||
1517 | /* The root complex doesn't show up if we don't set some vendor | 1554 | /* The root complex doesn't show up if we don't set some vendor |
1518 | * and device IDs into it. Those are the same bogus one that the | 1555 | * and device IDs into it. The defaults below are the same bogus |
1519 | * initial code in arch/ppc add. We might want to change that. | 1556 | * one that the initial code in arch/ppc had. This can be |
1557 | * overwritten by setting the "vendor-id/device-id" properties | ||
1558 | * in the pciex node. | ||
1520 | */ | 1559 | */ |
1521 | out_le16(mbase + 0x200, 0xaaa0 + port->index); | ||
1522 | out_le16(mbase + 0x202, 0xbed0 + port->index); | ||
1523 | 1560 | ||
1524 | /* Set Class Code to PCI-PCI bridge and Revision Id to 1 */ | 1561 | /* Get the (optional) vendor-/device-id from the device-tree */ |
1525 | out_le32(mbase + 0x208, 0x06040001); | 1562 | pval = of_get_property(port->node, "vendor-id", NULL); |
1563 | if (pval) { | ||
1564 | val = *pval; | ||
1565 | } else { | ||
1566 | if (!port->endpoint) | ||
1567 | val = 0xaaa0 + port->index; | ||
1568 | else | ||
1569 | val = 0xeee0 + port->index; | ||
1570 | } | ||
1571 | out_le16(mbase + 0x200, val); | ||
1572 | |||
1573 | pval = of_get_property(port->node, "device-id", NULL); | ||
1574 | if (pval) { | ||
1575 | val = *pval; | ||
1576 | } else { | ||
1577 | if (!port->endpoint) | ||
1578 | val = 0xbed0 + port->index; | ||
1579 | else | ||
1580 | val = 0xfed0 + port->index; | ||
1581 | } | ||
1582 | out_le16(mbase + 0x202, val); | ||
1583 | |||
1584 | if (!port->endpoint) { | ||
1585 | /* Set Class Code to PCI-PCI bridge and Revision Id to 1 */ | ||
1586 | out_le32(mbase + 0x208, 0x06040001); | ||
1587 | |||
1588 | printk(KERN_INFO "PCIE%d: successfully set as root-complex\n", | ||
1589 | port->index); | ||
1590 | } else { | ||
1591 | /* Set Class Code to Processor/PPC */ | ||
1592 | out_le32(mbase + 0x208, 0x0b200001); | ||
1593 | |||
1594 | printk(KERN_INFO "PCIE%d: successfully set as endpoint\n", | ||
1595 | port->index); | ||
1596 | } | ||
1526 | 1597 | ||
1527 | printk(KERN_INFO "PCIE%d: successfully set as root-complex\n", | ||
1528 | port->index); | ||
1529 | return; | 1598 | return; |
1530 | fail: | 1599 | fail: |
1531 | if (hose) | 1600 | if (hose) |
@@ -1542,6 +1611,7 @@ static void __init ppc4xx_probe_pciex_bridge(struct device_node *np) | |||
1542 | const u32 *pval; | 1611 | const u32 *pval; |
1543 | int portno; | 1612 | int portno; |
1544 | unsigned int dcrs; | 1613 | unsigned int dcrs; |
1614 | const char *val; | ||
1545 | 1615 | ||
1546 | /* First, proceed to core initialization as we assume there's | 1616 | /* First, proceed to core initialization as we assume there's |
1547 | * only one PCIe core in the system | 1617 | * only one PCIe core in the system |
@@ -1573,8 +1643,20 @@ static void __init ppc4xx_probe_pciex_bridge(struct device_node *np) | |||
1573 | } | 1643 | } |
1574 | port->sdr_base = *pval; | 1644 | port->sdr_base = *pval; |
1575 | 1645 | ||
1576 | /* XXX Currently, we only support root complex mode */ | 1646 | /* Check if device_type property is set to "pci" or "pci-endpoint". |
1577 | port->endpoint = 0; | 1647 | * Resulting from this setup this PCIe port will be configured |
1648 | * as root-complex or as endpoint. | ||
1649 | */ | ||
1650 | val = of_get_property(port->node, "device_type", NULL); | ||
1651 | if (!strcmp(val, "pci-endpoint")) { | ||
1652 | port->endpoint = 1; | ||
1653 | } else if (!strcmp(val, "pci")) { | ||
1654 | port->endpoint = 0; | ||
1655 | } else { | ||
1656 | printk(KERN_ERR "PCIE: missing or incorrect device_type for %s\n", | ||
1657 | np->full_name); | ||
1658 | return; | ||
1659 | } | ||
1578 | 1660 | ||
1579 | /* Fetch config space registers address */ | 1661 | /* Fetch config space registers address */ |
1580 | if (of_address_to_resource(np, 0, &port->cfg_space)) { | 1662 | if (of_address_to_resource(np, 0, &port->cfg_space)) { |
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 52c74780f40..1702de9395e 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -2842,9 +2842,11 @@ static void dump_spu_fields(struct spu *spu) | |||
2842 | DUMP_FIELD(spu, "0x%lx", ls_size); | 2842 | DUMP_FIELD(spu, "0x%lx", ls_size); |
2843 | DUMP_FIELD(spu, "0x%x", node); | 2843 | DUMP_FIELD(spu, "0x%x", node); |
2844 | DUMP_FIELD(spu, "0x%lx", flags); | 2844 | DUMP_FIELD(spu, "0x%lx", flags); |
2845 | DUMP_FIELD(spu, "0x%lx", dar); | ||
2846 | DUMP_FIELD(spu, "0x%lx", dsisr); | ||
2847 | DUMP_FIELD(spu, "%d", class_0_pending); | 2845 | DUMP_FIELD(spu, "%d", class_0_pending); |
2846 | DUMP_FIELD(spu, "0x%lx", class_0_dar); | ||
2847 | DUMP_FIELD(spu, "0x%lx", class_0_dsisr); | ||
2848 | DUMP_FIELD(spu, "0x%lx", class_1_dar); | ||
2849 | DUMP_FIELD(spu, "0x%lx", class_1_dsisr); | ||
2848 | DUMP_FIELD(spu, "0x%lx", irqs[0]); | 2850 | DUMP_FIELD(spu, "0x%lx", irqs[0]); |
2849 | DUMP_FIELD(spu, "0x%lx", irqs[1]); | 2851 | DUMP_FIELD(spu, "0x%lx", irqs[1]); |
2850 | DUMP_FIELD(spu, "0x%lx", irqs[2]); | 2852 | DUMP_FIELD(spu, "0x%lx", irqs[2]); |
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c index 90fe904d361..418f3053de5 100644 --- a/arch/ppc/syslib/mv64x60.c +++ b/arch/ppc/syslib/mv64x60.c | |||
@@ -341,6 +341,7 @@ static struct resource mv64x60_eth0_resources[] = { | |||
341 | }; | 341 | }; |
342 | 342 | ||
343 | static struct mv643xx_eth_platform_data eth0_pd = { | 343 | static struct mv643xx_eth_platform_data eth0_pd = { |
344 | .shared = &mv64x60_eth_shared_device; | ||
344 | .port_number = 0, | 345 | .port_number = 0, |
345 | }; | 346 | }; |
346 | 347 | ||
@@ -366,6 +367,7 @@ static struct resource mv64x60_eth1_resources[] = { | |||
366 | }; | 367 | }; |
367 | 368 | ||
368 | static struct mv643xx_eth_platform_data eth1_pd = { | 369 | static struct mv643xx_eth_platform_data eth1_pd = { |
370 | .shared = &mv64x60_eth_shared_device; | ||
369 | .port_number = 1, | 371 | .port_number = 1, |
370 | }; | 372 | }; |
371 | 373 | ||
@@ -391,6 +393,7 @@ static struct resource mv64x60_eth2_resources[] = { | |||
391 | }; | 393 | }; |
392 | 394 | ||
393 | static struct mv643xx_eth_platform_data eth2_pd = { | 395 | static struct mv643xx_eth_platform_data eth2_pd = { |
396 | .shared = &mv64x60_eth_shared_device; | ||
394 | .port_number = 2, | 397 | .port_number = 2, |
395 | }; | 398 | }; |
396 | 399 | ||
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 29a7940f284..1d035082e78 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -430,6 +430,13 @@ config CMM_IUCV | |||
430 | Select this option to enable the special message interface to | 430 | Select this option to enable the special message interface to |
431 | the cooperative memory management. | 431 | the cooperative memory management. |
432 | 432 | ||
433 | config PAGE_STATES | ||
434 | bool "Unused page notification" | ||
435 | help | ||
436 | This enables the notification of unused pages to the | ||
437 | hypervisor. The ESSA instruction is used to do the states | ||
438 | changes between a page that has content and the unused state. | ||
439 | |||
433 | config VIRT_TIMER | 440 | config VIRT_TIMER |
434 | bool "Virtual CPU timer support" | 441 | bool "Virtual CPU timer support" |
435 | help | 442 | help |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 743d54f0b8d..d003a6e16af 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -121,7 +121,7 @@ sys32_ptrace_wrapper: | |||
121 | lgfr %r3,%r3 # long | 121 | lgfr %r3,%r3 # long |
122 | llgtr %r4,%r4 # long | 122 | llgtr %r4,%r4 # long |
123 | llgfr %r5,%r5 # long | 123 | llgfr %r5,%r5 # long |
124 | jg sys_ptrace # branch to system call | 124 | jg compat_sys_ptrace # branch to system call |
125 | 125 | ||
126 | .globl sys32_alarm_wrapper | 126 | .globl sys32_alarm_wrapper |
127 | sys32_alarm_wrapper: | 127 | sys32_alarm_wrapper: |
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index bdbb3bcd78a..708cf9cf9a3 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -279,8 +279,6 @@ sysc_do_restart: | |||
279 | st %r2,SP_R2(%r15) # store return value (change R2 on stack) | 279 | st %r2,SP_R2(%r15) # store return value (change R2 on stack) |
280 | 280 | ||
281 | sysc_return: | 281 | sysc_return: |
282 | tm SP_PSW+1(%r15),0x01 # returning to user ? | ||
283 | bno BASED(sysc_restore) | ||
284 | tm __TI_flags+3(%r9),_TIF_WORK_SVC | 282 | tm __TI_flags+3(%r9),_TIF_WORK_SVC |
285 | bnz BASED(sysc_work) # there is work to do (signals etc.) | 283 | bnz BASED(sysc_work) # there is work to do (signals etc.) |
286 | sysc_restore: | 284 | sysc_restore: |
@@ -312,6 +310,8 @@ sysc_work_loop: | |||
312 | # One of the work bits is on. Find out which one. | 310 | # One of the work bits is on. Find out which one. |
313 | # | 311 | # |
314 | sysc_work: | 312 | sysc_work: |
313 | tm SP_PSW+1(%r15),0x01 # returning to user ? | ||
314 | bno BASED(sysc_restore) | ||
315 | tm __TI_flags+3(%r9),_TIF_MCCK_PENDING | 315 | tm __TI_flags+3(%r9),_TIF_MCCK_PENDING |
316 | bo BASED(sysc_mcck_pending) | 316 | bo BASED(sysc_mcck_pending) |
317 | tm __TI_flags+3(%r9),_TIF_NEED_RESCHED | 317 | tm __TI_flags+3(%r9),_TIF_NEED_RESCHED |
@@ -602,12 +602,6 @@ io_no_vtime: | |||
602 | la %r2,SP_PTREGS(%r15) # address of register-save area | 602 | la %r2,SP_PTREGS(%r15) # address of register-save area |
603 | basr %r14,%r1 # branch to standard irq handler | 603 | basr %r14,%r1 # branch to standard irq handler |
604 | io_return: | 604 | io_return: |
605 | tm SP_PSW+1(%r15),0x01 # returning to user ? | ||
606 | #ifdef CONFIG_PREEMPT | ||
607 | bno BASED(io_preempt) # no -> check for preemptive scheduling | ||
608 | #else | ||
609 | bno BASED(io_restore) # no-> skip resched & signal | ||
610 | #endif | ||
611 | tm __TI_flags+3(%r9),_TIF_WORK_INT | 605 | tm __TI_flags+3(%r9),_TIF_WORK_INT |
612 | bnz BASED(io_work) # there is work to do (signals etc.) | 606 | bnz BASED(io_work) # there is work to do (signals etc.) |
613 | io_restore: | 607 | io_restore: |
@@ -629,10 +623,18 @@ io_restore_trace_psw: | |||
629 | .long 0, io_restore_trace + 0x80000000 | 623 | .long 0, io_restore_trace + 0x80000000 |
630 | #endif | 624 | #endif |
631 | 625 | ||
632 | #ifdef CONFIG_PREEMPT | 626 | # |
633 | io_preempt: | 627 | # switch to kernel stack, then check the TIF bits |
628 | # | ||
629 | io_work: | ||
630 | tm SP_PSW+1(%r15),0x01 # returning to user ? | ||
631 | #ifndef CONFIG_PREEMPT | ||
632 | bno BASED(io_restore) # no-> skip resched & signal | ||
633 | #else | ||
634 | bnz BASED(io_work_user) # no -> check for preemptive scheduling | ||
635 | # check for preemptive scheduling | ||
634 | icm %r0,15,__TI_precount(%r9) | 636 | icm %r0,15,__TI_precount(%r9) |
635 | bnz BASED(io_restore) | 637 | bnz BASED(io_restore) # preemption disabled |
636 | l %r1,SP_R15(%r15) | 638 | l %r1,SP_R15(%r15) |
637 | s %r1,BASED(.Lc_spsize) | 639 | s %r1,BASED(.Lc_spsize) |
638 | mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) | 640 | mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) |
@@ -646,10 +648,7 @@ io_resume_loop: | |||
646 | br %r1 # call schedule | 648 | br %r1 # call schedule |
647 | #endif | 649 | #endif |
648 | 650 | ||
649 | # | 651 | io_work_user: |
650 | # switch to kernel stack, then check the TIF bits | ||
651 | # | ||
652 | io_work: | ||
653 | l %r1,__LC_KERNEL_STACK | 652 | l %r1,__LC_KERNEL_STACK |
654 | s %r1,BASED(.Lc_spsize) | 653 | s %r1,BASED(.Lc_spsize) |
655 | mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) | 654 | mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) |
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index 5a4a7bcd2bb..fee10177dbf 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S | |||
@@ -271,8 +271,6 @@ sysc_noemu: | |||
271 | stg %r2,SP_R2(%r15) # store return value (change R2 on stack) | 271 | stg %r2,SP_R2(%r15) # store return value (change R2 on stack) |
272 | 272 | ||
273 | sysc_return: | 273 | sysc_return: |
274 | tm SP_PSW+1(%r15),0x01 # returning to user ? | ||
275 | jno sysc_restore | ||
276 | tm __TI_flags+7(%r9),_TIF_WORK_SVC | 274 | tm __TI_flags+7(%r9),_TIF_WORK_SVC |
277 | jnz sysc_work # there is work to do (signals etc.) | 275 | jnz sysc_work # there is work to do (signals etc.) |
278 | sysc_restore: | 276 | sysc_restore: |
@@ -304,6 +302,8 @@ sysc_work_loop: | |||
304 | # One of the work bits is on. Find out which one. | 302 | # One of the work bits is on. Find out which one. |
305 | # | 303 | # |
306 | sysc_work: | 304 | sysc_work: |
305 | tm SP_PSW+1(%r15),0x01 # returning to user ? | ||
306 | jno sysc_restore | ||
307 | tm __TI_flags+7(%r9),_TIF_MCCK_PENDING | 307 | tm __TI_flags+7(%r9),_TIF_MCCK_PENDING |
308 | jo sysc_mcck_pending | 308 | jo sysc_mcck_pending |
309 | tm __TI_flags+7(%r9),_TIF_NEED_RESCHED | 309 | tm __TI_flags+7(%r9),_TIF_NEED_RESCHED |
@@ -585,12 +585,6 @@ io_no_vtime: | |||
585 | la %r2,SP_PTREGS(%r15) # address of register-save area | 585 | la %r2,SP_PTREGS(%r15) # address of register-save area |
586 | brasl %r14,do_IRQ # call standard irq handler | 586 | brasl %r14,do_IRQ # call standard irq handler |
587 | io_return: | 587 | io_return: |
588 | tm SP_PSW+1(%r15),0x01 # returning to user ? | ||
589 | #ifdef CONFIG_PREEMPT | ||
590 | jno io_preempt # no -> check for preemptive scheduling | ||
591 | #else | ||
592 | jno io_restore # no-> skip resched & signal | ||
593 | #endif | ||
594 | tm __TI_flags+7(%r9),_TIF_WORK_INT | 588 | tm __TI_flags+7(%r9),_TIF_WORK_INT |
595 | jnz io_work # there is work to do (signals etc.) | 589 | jnz io_work # there is work to do (signals etc.) |
596 | io_restore: | 590 | io_restore: |
@@ -612,10 +606,41 @@ io_restore_trace_psw: | |||
612 | .quad 0, io_restore_trace | 606 | .quad 0, io_restore_trace |
613 | #endif | 607 | #endif |
614 | 608 | ||
615 | #ifdef CONFIG_PREEMPT | 609 | # |
616 | io_preempt: | 610 | # There is work todo, we need to check if we return to userspace, then |
611 | # check, if we are in SIE, if yes leave it | ||
612 | # | ||
613 | io_work: | ||
614 | tm SP_PSW+1(%r15),0x01 # returning to user ? | ||
615 | #ifndef CONFIG_PREEMPT | ||
616 | #if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) | ||
617 | jnz io_work_user # yes -> no need to check for SIE | ||
618 | la %r1, BASED(sie_opcode) # we return to kernel here | ||
619 | lg %r2, SP_PSW+8(%r15) | ||
620 | clc 0(2,%r1), 0(%r2) # is current instruction = SIE? | ||
621 | jne io_restore # no-> return to kernel | ||
622 | lg %r1, SP_PSW+8(%r15) # yes-> add 4 bytes to leave SIE | ||
623 | aghi %r1, 4 | ||
624 | stg %r1, SP_PSW+8(%r15) | ||
625 | j io_restore # return to kernel | ||
626 | #else | ||
627 | jno io_restore # no-> skip resched & signal | ||
628 | #endif | ||
629 | #else | ||
630 | jnz io_work_user # yes -> do resched & signal | ||
631 | #if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) | ||
632 | la %r1, BASED(sie_opcode) | ||
633 | lg %r2, SP_PSW+8(%r15) | ||
634 | clc 0(2,%r1), 0(%r2) # is current instruction = SIE? | ||
635 | jne 0f # no -> leave PSW alone | ||
636 | lg %r1, SP_PSW+8(%r15) # yes-> add 4 bytes to leave SIE | ||
637 | aghi %r1, 4 | ||
638 | stg %r1, SP_PSW+8(%r15) | ||
639 | 0: | ||
640 | #endif | ||
641 | # check for preemptive scheduling | ||
617 | icm %r0,15,__TI_precount(%r9) | 642 | icm %r0,15,__TI_precount(%r9) |
618 | jnz io_restore | 643 | jnz io_restore # preemption is disabled |
619 | # switch to kernel stack | 644 | # switch to kernel stack |
620 | lg %r1,SP_R15(%r15) | 645 | lg %r1,SP_R15(%r15) |
621 | aghi %r1,-SP_SIZE | 646 | aghi %r1,-SP_SIZE |
@@ -629,10 +654,7 @@ io_resume_loop: | |||
629 | jg preempt_schedule_irq | 654 | jg preempt_schedule_irq |
630 | #endif | 655 | #endif |
631 | 656 | ||
632 | # | 657 | io_work_user: |
633 | # switch to kernel stack, then check TIF bits | ||
634 | # | ||
635 | io_work: | ||
636 | lg %r1,__LC_KERNEL_STACK | 658 | lg %r1,__LC_KERNEL_STACK |
637 | aghi %r1,-SP_SIZE | 659 | aghi %r1,-SP_SIZE |
638 | mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) | 660 | mvc SP_PTREGS(__PT_SIZE,%r1),SP_PTREGS(%r15) |
@@ -653,6 +675,11 @@ io_work_loop: | |||
653 | j io_restore | 675 | j io_restore |
654 | io_work_done: | 676 | io_work_done: |
655 | 677 | ||
678 | #if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) | ||
679 | sie_opcode: | ||
680 | .long 0xb2140000 | ||
681 | #endif | ||
682 | |||
656 | # | 683 | # |
657 | # _TIF_MCCK_PENDING is set, call handler | 684 | # _TIF_MCCK_PENDING is set, call handler |
658 | # | 685 | # |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 7f427016374..35827b9bd4d 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -292,8 +292,7 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data) | |||
292 | return 0; | 292 | return 0; |
293 | } | 293 | } |
294 | 294 | ||
295 | static int | 295 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
296 | do_ptrace_normal(struct task_struct *child, long request, long addr, long data) | ||
297 | { | 296 | { |
298 | ptrace_area parea; | 297 | ptrace_area parea; |
299 | int copied, ret; | 298 | int copied, ret; |
@@ -529,35 +528,19 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data) | |||
529 | return 0; | 528 | return 0; |
530 | } | 529 | } |
531 | 530 | ||
532 | static int | 531 | long compat_arch_ptrace(struct task_struct *child, compat_long_t request, |
533 | do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) | 532 | compat_ulong_t caddr, compat_ulong_t cdata) |
534 | { | 533 | { |
535 | unsigned int tmp; /* 4 bytes !! */ | 534 | unsigned long addr = caddr; |
535 | unsigned long data = cdata; | ||
536 | ptrace_area_emu31 parea; | 536 | ptrace_area_emu31 parea; |
537 | int copied, ret; | 537 | int copied, ret; |
538 | 538 | ||
539 | switch (request) { | 539 | switch (request) { |
540 | case PTRACE_PEEKTEXT: | ||
541 | case PTRACE_PEEKDATA: | ||
542 | /* read word at location addr. */ | ||
543 | copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); | ||
544 | if (copied != sizeof(tmp)) | ||
545 | return -EIO; | ||
546 | return put_user(tmp, (unsigned int __force __user *) data); | ||
547 | |||
548 | case PTRACE_PEEKUSR: | 540 | case PTRACE_PEEKUSR: |
549 | /* read the word at location addr in the USER area. */ | 541 | /* read the word at location addr in the USER area. */ |
550 | return peek_user_emu31(child, addr, data); | 542 | return peek_user_emu31(child, addr, data); |
551 | 543 | ||
552 | case PTRACE_POKETEXT: | ||
553 | case PTRACE_POKEDATA: | ||
554 | /* write the word at location addr. */ | ||
555 | tmp = data; | ||
556 | copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 1); | ||
557 | if (copied != sizeof(tmp)) | ||
558 | return -EIO; | ||
559 | return 0; | ||
560 | |||
561 | case PTRACE_POKEUSR: | 544 | case PTRACE_POKEUSR: |
562 | /* write the word at location addr in the USER area */ | 545 | /* write the word at location addr in the USER area */ |
563 | return poke_user_emu31(child, addr, data); | 546 | return poke_user_emu31(child, addr, data); |
@@ -587,82 +570,11 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) | |||
587 | copied += sizeof(unsigned int); | 570 | copied += sizeof(unsigned int); |
588 | } | 571 | } |
589 | return 0; | 572 | return 0; |
590 | case PTRACE_GETEVENTMSG: | ||
591 | return put_user((__u32) child->ptrace_message, | ||
592 | (unsigned int __force __user *) data); | ||
593 | case PTRACE_GETSIGINFO: | ||
594 | if (child->last_siginfo == NULL) | ||
595 | return -EINVAL; | ||
596 | return copy_siginfo_to_user32((compat_siginfo_t | ||
597 | __force __user *) data, | ||
598 | child->last_siginfo); | ||
599 | case PTRACE_SETSIGINFO: | ||
600 | if (child->last_siginfo == NULL) | ||
601 | return -EINVAL; | ||
602 | return copy_siginfo_from_user32(child->last_siginfo, | ||
603 | (compat_siginfo_t | ||
604 | __force __user *) data); | ||
605 | } | 573 | } |
606 | return ptrace_request(child, request, addr, data); | 574 | return compat_ptrace_request(child, request, addr, data); |
607 | } | 575 | } |
608 | #endif | 576 | #endif |
609 | 577 | ||
610 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | ||
611 | { | ||
612 | switch (request) { | ||
613 | case PTRACE_SYSCALL: | ||
614 | /* continue and stop at next (return from) syscall */ | ||
615 | case PTRACE_CONT: | ||
616 | /* restart after signal. */ | ||
617 | if (!valid_signal(data)) | ||
618 | return -EIO; | ||
619 | if (request == PTRACE_SYSCALL) | ||
620 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
621 | else | ||
622 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
623 | child->exit_code = data; | ||
624 | /* make sure the single step bit is not set. */ | ||
625 | user_disable_single_step(child); | ||
626 | wake_up_process(child); | ||
627 | return 0; | ||
628 | |||
629 | case PTRACE_KILL: | ||
630 | /* | ||
631 | * make the child exit. Best I can do is send it a sigkill. | ||
632 | * perhaps it should be put in the status that it wants to | ||
633 | * exit. | ||
634 | */ | ||
635 | if (child->exit_state == EXIT_ZOMBIE) /* already dead */ | ||
636 | return 0; | ||
637 | child->exit_code = SIGKILL; | ||
638 | /* make sure the single step bit is not set. */ | ||
639 | user_disable_single_step(child); | ||
640 | wake_up_process(child); | ||
641 | return 0; | ||
642 | |||
643 | case PTRACE_SINGLESTEP: | ||
644 | /* set the trap flag. */ | ||
645 | if (!valid_signal(data)) | ||
646 | return -EIO; | ||
647 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
648 | child->exit_code = data; | ||
649 | user_enable_single_step(child); | ||
650 | /* give it a chance to run. */ | ||
651 | wake_up_process(child); | ||
652 | return 0; | ||
653 | |||
654 | /* Do requests that differ for 31/64 bit */ | ||
655 | default: | ||
656 | #ifdef CONFIG_COMPAT | ||
657 | if (test_thread_flag(TIF_31BIT)) | ||
658 | return do_ptrace_emu31(child, request, addr, data); | ||
659 | #endif | ||
660 | return do_ptrace_normal(child, request, addr, data); | ||
661 | } | ||
662 | /* Not reached. */ | ||
663 | return -EIO; | ||
664 | } | ||
665 | |||
666 | asmlinkage void | 578 | asmlinkage void |
667 | syscall_trace(struct pt_regs *regs, int entryexit) | 579 | syscall_trace(struct pt_regs *regs, int entryexit) |
668 | { | 580 | { |
diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig index 1761b74d639..e051cad1f1e 100644 --- a/arch/s390/kvm/Kconfig +++ b/arch/s390/kvm/Kconfig | |||
@@ -22,7 +22,6 @@ config KVM | |||
22 | select PREEMPT_NOTIFIERS | 22 | select PREEMPT_NOTIFIERS |
23 | select ANON_INODES | 23 | select ANON_INODES |
24 | select S390_SWITCH_AMODE | 24 | select S390_SWITCH_AMODE |
25 | select PREEMPT | ||
26 | ---help--- | 25 | ---help--- |
27 | Support hosting paravirtualized guest machines using the SIE | 26 | Support hosting paravirtualized guest machines using the SIE |
28 | virtualization capability on the mainframe. This should work | 27 | virtualization capability on the mainframe. This should work |
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c index 349581a2610..47a0b642174 100644 --- a/arch/s390/kvm/intercept.c +++ b/arch/s390/kvm/intercept.c | |||
@@ -105,6 +105,9 @@ static intercept_handler_t instruction_handlers[256] = { | |||
105 | static int handle_noop(struct kvm_vcpu *vcpu) | 105 | static int handle_noop(struct kvm_vcpu *vcpu) |
106 | { | 106 | { |
107 | switch (vcpu->arch.sie_block->icptcode) { | 107 | switch (vcpu->arch.sie_block->icptcode) { |
108 | case 0x0: | ||
109 | vcpu->stat.exit_null++; | ||
110 | break; | ||
108 | case 0x10: | 111 | case 0x10: |
109 | vcpu->stat.exit_external_request++; | 112 | vcpu->stat.exit_external_request++; |
110 | break; | 113 | break; |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 98d1e73e01f..0ac36a649eb 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | struct kvm_stats_debugfs_item debugfs_entries[] = { | 32 | struct kvm_stats_debugfs_item debugfs_entries[] = { |
33 | { "userspace_handled", VCPU_STAT(exit_userspace) }, | 33 | { "userspace_handled", VCPU_STAT(exit_userspace) }, |
34 | { "exit_null", VCPU_STAT(exit_null) }, | ||
34 | { "exit_validity", VCPU_STAT(exit_validity) }, | 35 | { "exit_validity", VCPU_STAT(exit_validity) }, |
35 | { "exit_stop_request", VCPU_STAT(exit_stop_request) }, | 36 | { "exit_stop_request", VCPU_STAT(exit_stop_request) }, |
36 | { "exit_external_request", VCPU_STAT(exit_external_request) }, | 37 | { "exit_external_request", VCPU_STAT(exit_external_request) }, |
@@ -221,10 +222,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
221 | vcpu->arch.guest_fpregs.fpc &= FPC_VALID_MASK; | 222 | vcpu->arch.guest_fpregs.fpc &= FPC_VALID_MASK; |
222 | restore_fp_regs(&vcpu->arch.guest_fpregs); | 223 | restore_fp_regs(&vcpu->arch.guest_fpregs); |
223 | restore_access_regs(vcpu->arch.guest_acrs); | 224 | restore_access_regs(vcpu->arch.guest_acrs); |
224 | |||
225 | if (signal_pending(current)) | ||
226 | atomic_set_mask(CPUSTAT_STOP_INT, | ||
227 | &vcpu->arch.sie_block->cpuflags); | ||
228 | } | 225 | } |
229 | 226 | ||
230 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) | 227 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) |
diff --git a/arch/s390/mm/Makefile b/arch/s390/mm/Makefile index fb988a48a75..2a745813454 100644 --- a/arch/s390/mm/Makefile +++ b/arch/s390/mm/Makefile | |||
@@ -5,3 +5,4 @@ | |||
5 | obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o | 5 | obj-y := init.o fault.o extmem.o mmap.o vmem.o pgtable.o |
6 | obj-$(CONFIG_CMM) += cmm.o | 6 | obj-$(CONFIG_CMM) += cmm.o |
7 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o | 7 | obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o |
8 | obj-$(CONFIG_PAGE_STATES) += page-states.o | ||
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index fa31de6ae97..29f3a63806b 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -126,6 +126,9 @@ void __init mem_init(void) | |||
126 | /* clear the zero-page */ | 126 | /* clear the zero-page */ |
127 | memset(empty_zero_page, 0, PAGE_SIZE); | 127 | memset(empty_zero_page, 0, PAGE_SIZE); |
128 | 128 | ||
129 | /* Setup guest page hinting */ | ||
130 | cmma_init(); | ||
131 | |||
129 | /* this will put all low memory onto the freelists */ | 132 | /* this will put all low memory onto the freelists */ |
130 | totalram_pages += free_all_bootmem(); | 133 | totalram_pages += free_all_bootmem(); |
131 | 134 | ||
diff --git a/arch/s390/mm/page-states.c b/arch/s390/mm/page-states.c new file mode 100644 index 00000000000..fc0ad73ffd9 --- /dev/null +++ b/arch/s390/mm/page-states.c | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * arch/s390/mm/page-states.c | ||
3 | * | ||
4 | * Copyright IBM Corp. 2008 | ||
5 | * | ||
6 | * Guest page hinting for unused pages. | ||
7 | * | ||
8 | * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/errno.h> | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/mm.h> | ||
15 | #include <linux/init.h> | ||
16 | |||
17 | #define ESSA_SET_STABLE 1 | ||
18 | #define ESSA_SET_UNUSED 2 | ||
19 | |||
20 | static int cmma_flag; | ||
21 | |||
22 | static int __init cmma(char *str) | ||
23 | { | ||
24 | char *parm; | ||
25 | parm = strstrip(str); | ||
26 | if (strcmp(parm, "yes") == 0 || strcmp(parm, "on") == 0) { | ||
27 | cmma_flag = 1; | ||
28 | return 1; | ||
29 | } | ||
30 | cmma_flag = 0; | ||
31 | if (strcmp(parm, "no") == 0 || strcmp(parm, "off") == 0) | ||
32 | return 1; | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | __setup("cmma=", cmma); | ||
37 | |||
38 | void __init cmma_init(void) | ||
39 | { | ||
40 | register unsigned long tmp asm("0") = 0; | ||
41 | register int rc asm("1") = -EOPNOTSUPP; | ||
42 | |||
43 | if (!cmma_flag) | ||
44 | return; | ||
45 | asm volatile( | ||
46 | " .insn rrf,0xb9ab0000,%1,%1,0,0\n" | ||
47 | "0: la %0,0\n" | ||
48 | "1:\n" | ||
49 | EX_TABLE(0b,1b) | ||
50 | : "+&d" (rc), "+&d" (tmp)); | ||
51 | if (rc) | ||
52 | cmma_flag = 0; | ||
53 | } | ||
54 | |||
55 | void arch_free_page(struct page *page, int order) | ||
56 | { | ||
57 | int i, rc; | ||
58 | |||
59 | if (!cmma_flag) | ||
60 | return; | ||
61 | for (i = 0; i < (1 << order); i++) | ||
62 | asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0" | ||
63 | : "=&d" (rc) | ||
64 | : "a" ((page_to_pfn(page) + i) << PAGE_SHIFT), | ||
65 | "i" (ESSA_SET_UNUSED)); | ||
66 | } | ||
67 | |||
68 | void arch_alloc_page(struct page *page, int order) | ||
69 | { | ||
70 | int i, rc; | ||
71 | |||
72 | if (!cmma_flag) | ||
73 | return; | ||
74 | for (i = 0; i < (1 << order); i++) | ||
75 | asm volatile(".insn rrf,0xb9ab0000,%0,%1,%2,0" | ||
76 | : "=&d" (rc) | ||
77 | : "a" ((page_to_pfn(page) + i) << PAGE_SHIFT), | ||
78 | "i" (ESSA_SET_STABLE)); | ||
79 | } | ||
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 6a679c3e15e..8a68160079a 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -448,14 +448,6 @@ config SH_DREAMCAST | |||
448 | Select Dreamcast if configuring for a SEGA Dreamcast. | 448 | Select Dreamcast if configuring for a SEGA Dreamcast. |
449 | More information at <http://www.linux-sh.org> | 449 | More information at <http://www.linux-sh.org> |
450 | 450 | ||
451 | config SH_MPC1211 | ||
452 | bool "Interface MPC1211" | ||
453 | depends on CPU_SUBTYPE_SH7751 && BROKEN | ||
454 | help | ||
455 | CTP/PCI-SH02 is a CPU module computer that is produced | ||
456 | by Interface Corporation. | ||
457 | More information at <http://www.interface.co.jp> | ||
458 | |||
459 | config SH_SH03 | 451 | config SH_SH03 |
460 | bool "Interface CTP/PCI-SH03" | 452 | bool "Interface CTP/PCI-SH03" |
461 | depends on CPU_SUBTYPE_SH7751 | 453 | depends on CPU_SUBTYPE_SH7751 |
@@ -657,8 +649,7 @@ source "arch/sh/drivers/Kconfig" | |||
657 | endmenu | 649 | endmenu |
658 | 650 | ||
659 | config ISA_DMA_API | 651 | config ISA_DMA_API |
660 | def_bool y | 652 | bool |
661 | depends on SH_MPC1211 | ||
662 | 653 | ||
663 | menu "Kernel features" | 654 | menu "Kernel features" |
664 | 655 | ||
@@ -666,7 +657,7 @@ source kernel/Kconfig.hz | |||
666 | 657 | ||
667 | config KEXEC | 658 | config KEXEC |
668 | bool "kexec system call (EXPERIMENTAL)" | 659 | bool "kexec system call (EXPERIMENTAL)" |
669 | depends on EXPERIMENTAL | 660 | depends on SUPERH32 && EXPERIMENTAL |
670 | help | 661 | help |
671 | kexec is a system call that implements the ability to shutdown your | 662 | kexec is a system call that implements the ability to shutdown your |
672 | current kernel, and to start another kernel. It is like a reboot | 663 | current kernel, and to start another kernel. It is like a reboot |
@@ -683,7 +674,7 @@ config KEXEC | |||
683 | 674 | ||
684 | config CRASH_DUMP | 675 | config CRASH_DUMP |
685 | bool "kernel crash dumps (EXPERIMENTAL)" | 676 | bool "kernel crash dumps (EXPERIMENTAL)" |
686 | depends on EXPERIMENTAL | 677 | depends on SUPERH32 && EXPERIMENTAL |
687 | help | 678 | help |
688 | Generate crash dump after being started by kexec. | 679 | Generate crash dump after being started by kexec. |
689 | This should be normally only set in special crash dump kernels | 680 | This should be normally only set in special crash dump kernels |
@@ -763,7 +754,7 @@ menu "Boot options" | |||
763 | 754 | ||
764 | config ZERO_PAGE_OFFSET | 755 | config ZERO_PAGE_OFFSET |
765 | hex "Zero page offset" | 756 | hex "Zero page offset" |
766 | default "0x00004000" if SH_MPC1211 || SH_SH03 | 757 | default "0x00004000" if SH_SH03 |
767 | default "0x00010000" if PAGE_SIZE_64KB | 758 | default "0x00010000" if PAGE_SIZE_64KB |
768 | default "0x00002000" if PAGE_SIZE_8KB | 759 | default "0x00002000" if PAGE_SIZE_8KB |
769 | default "0x00001000" | 760 | default "0x00001000" |
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug index d9d28f9dd0d..0d2ef1e9a6f 100644 --- a/arch/sh/Kconfig.debug +++ b/arch/sh/Kconfig.debug | |||
@@ -7,6 +7,7 @@ source "lib/Kconfig.debug" | |||
7 | 7 | ||
8 | config SH_STANDARD_BIOS | 8 | config SH_STANDARD_BIOS |
9 | bool "Use LinuxSH standard BIOS" | 9 | bool "Use LinuxSH standard BIOS" |
10 | depends on SUPERH32 | ||
10 | help | 11 | help |
11 | Say Y here if your target has the gdb-sh-stub | 12 | Say Y here if your target has the gdb-sh-stub |
12 | package from www.m17n.org (or any conforming standard LinuxSH BIOS) | 13 | package from www.m17n.org (or any conforming standard LinuxSH BIOS) |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index bb06f83e623..8050b03d51f 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
@@ -110,7 +110,6 @@ machdir-$(CONFIG_SH_7343_SOLUTION_ENGINE) += se/7343 | |||
110 | machdir-$(CONFIG_SH_7721_SOLUTION_ENGINE) += se/7721 | 110 | machdir-$(CONFIG_SH_7721_SOLUTION_ENGINE) += se/7721 |
111 | machdir-$(CONFIG_SH_HP6XX) += hp6xx | 111 | machdir-$(CONFIG_SH_HP6XX) += hp6xx |
112 | machdir-$(CONFIG_SH_DREAMCAST) += dreamcast | 112 | machdir-$(CONFIG_SH_DREAMCAST) += dreamcast |
113 | machdir-$(CONFIG_SH_MPC1211) += mpc1211 | ||
114 | machdir-$(CONFIG_SH_SH03) += sh03 | 113 | machdir-$(CONFIG_SH_SH03) += sh03 |
115 | machdir-$(CONFIG_SH_SECUREEDGE5410) += snapgear | 114 | machdir-$(CONFIG_SH_SECUREEDGE5410) += snapgear |
116 | machdir-$(CONFIG_SH_RTS7751R2D) += renesas/rts7751r2d | 115 | machdir-$(CONFIG_SH_RTS7751R2D) += renesas/rts7751r2d |
diff --git a/arch/sh/boards/mpc1211/Makefile b/arch/sh/boards/mpc1211/Makefile deleted file mode 100644 index 8cd31b5d200..00000000000 --- a/arch/sh/boards/mpc1211/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the Interface (CTP/PCI/MPC-SH02) specific parts of the kernel | ||
3 | # | ||
4 | |||
5 | obj-y := setup.o rtc.o | ||
6 | |||
7 | obj-$(CONFIG_PCI) += pci.o | ||
8 | |||
diff --git a/arch/sh/boards/mpc1211/pci.c b/arch/sh/boards/mpc1211/pci.c deleted file mode 100644 index 23849f70f13..00000000000 --- a/arch/sh/boards/mpc1211/pci.c +++ /dev/null | |||
@@ -1,295 +0,0 @@ | |||
1 | /* | ||
2 | * Low-Level PCI Support for the MPC-1211(CTP/PCI/MPC-SH02) | ||
3 | * | ||
4 | * (c) 2002-2003 Saito.K & Jeanne | ||
5 | * | ||
6 | * Dustin McIntire (dustin@sensoria.com) | ||
7 | * Derived from arch/i386/kernel/pci-*.c which bore the message: | ||
8 | * (c) 1999--2000 Martin Mares <mj@ucw.cz> | ||
9 | * | ||
10 | * May be copied or modified under the terms of the GNU General Public | ||
11 | * License. See linux/COPYING for more information. | ||
12 | * | ||
13 | */ | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/pci.h> | ||
19 | #include <linux/sched.h> | ||
20 | #include <linux/ioport.h> | ||
21 | #include <linux/errno.h> | ||
22 | #include <linux/irq.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | |||
25 | #include <asm/machvec.h> | ||
26 | #include <asm/io.h> | ||
27 | #include <asm/mpc1211/pci.h> | ||
28 | |||
29 | static struct resource mpcpci_io_resource = { | ||
30 | "MPCPCI IO", | ||
31 | 0x00000000, | ||
32 | 0xffffffff, | ||
33 | IORESOURCE_IO | ||
34 | }; | ||
35 | |||
36 | static struct resource mpcpci_mem_resource = { | ||
37 | "MPCPCI mem", | ||
38 | 0x00000000, | ||
39 | 0xffffffff, | ||
40 | IORESOURCE_MEM | ||
41 | }; | ||
42 | |||
43 | static struct pci_ops pci_direct_conf1; | ||
44 | struct pci_channel board_pci_channels[] = { | ||
45 | {&pci_direct_conf1, &mpcpci_io_resource, &mpcpci_mem_resource, 0, 256}, | ||
46 | {NULL, NULL, NULL, 0, 0}, | ||
47 | }; | ||
48 | |||
49 | /* | ||
50 | * Direct access to PCI hardware... | ||
51 | */ | ||
52 | |||
53 | |||
54 | #define CONFIG_CMD(bus, devfn, where) (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) | ||
55 | |||
56 | /* | ||
57 | * Functions for accessing PCI configuration space with type 1 accesses | ||
58 | */ | ||
59 | static int pci_conf1_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) | ||
60 | { | ||
61 | u32 word; | ||
62 | unsigned long flags; | ||
63 | |||
64 | /* | ||
65 | * PCIPDR may only be accessed as 32 bit words, | ||
66 | * so we must do byte alignment by hand | ||
67 | */ | ||
68 | local_irq_save(flags); | ||
69 | writel(CONFIG_CMD(bus,devfn,where), PCIPAR); | ||
70 | word = readl(PCIPDR); | ||
71 | local_irq_restore(flags); | ||
72 | |||
73 | switch (size) { | ||
74 | case 1: | ||
75 | switch (where & 0x3) { | ||
76 | case 3: | ||
77 | *value = (u8)(word >> 24); | ||
78 | break; | ||
79 | case 2: | ||
80 | *value = (u8)(word >> 16); | ||
81 | break; | ||
82 | case 1: | ||
83 | *value = (u8)(word >> 8); | ||
84 | break; | ||
85 | default: | ||
86 | *value = (u8)word; | ||
87 | break; | ||
88 | } | ||
89 | break; | ||
90 | case 2: | ||
91 | switch (where & 0x3) { | ||
92 | case 3: | ||
93 | *value = (u16)(word >> 24); | ||
94 | local_irq_save(flags); | ||
95 | writel(CONFIG_CMD(bus,devfn,(where+1)), PCIPAR); | ||
96 | word = readl(PCIPDR); | ||
97 | local_irq_restore(flags); | ||
98 | *value |= ((word & 0xff) << 8); | ||
99 | break; | ||
100 | case 2: | ||
101 | *value = (u16)(word >> 16); | ||
102 | break; | ||
103 | case 1: | ||
104 | *value = (u16)(word >> 8); | ||
105 | break; | ||
106 | default: | ||
107 | *value = (u16)word; | ||
108 | break; | ||
109 | } | ||
110 | break; | ||
111 | case 4: | ||
112 | *value = word; | ||
113 | break; | ||
114 | } | ||
115 | PCIDBG(4,"pci_conf1_read@0x%08x=0x%x\n", CONFIG_CMD(bus,devfn,where),*value); | ||
116 | return PCIBIOS_SUCCESSFUL; | ||
117 | } | ||
118 | |||
119 | /* | ||
120 | * Since MPC-1211 only does 32bit access we'll have to do a read,mask,write operation. | ||
121 | * We'll allow an odd byte offset, though it should be illegal. | ||
122 | */ | ||
123 | static int pci_conf1_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) | ||
124 | { | ||
125 | u32 word,mask = 0; | ||
126 | unsigned long flags; | ||
127 | u32 shift = (where & 3) * 8; | ||
128 | |||
129 | if(size == 1) { | ||
130 | mask = ((1 << 8) - 1) << shift; // create the byte mask | ||
131 | } else if(size == 2){ | ||
132 | if(shift == 24) | ||
133 | return PCIBIOS_BAD_REGISTER_NUMBER; | ||
134 | mask = ((1 << 16) - 1) << shift; // create the word mask | ||
135 | } | ||
136 | local_irq_save(flags); | ||
137 | writel(CONFIG_CMD(bus,devfn,where), PCIPAR); | ||
138 | if(size == 4){ | ||
139 | writel(value, PCIPDR); | ||
140 | local_irq_restore(flags); | ||
141 | PCIDBG(4,"pci_conf1_write@0x%08x=0x%x\n", CONFIG_CMD(bus,devfn,where),value); | ||
142 | return PCIBIOS_SUCCESSFUL; | ||
143 | } | ||
144 | word = readl(PCIPDR); | ||
145 | word &= ~mask; | ||
146 | word |= ((value << shift) & mask); | ||
147 | writel(word, PCIPDR); | ||
148 | local_irq_restore(flags); | ||
149 | PCIDBG(4,"pci_conf1_write@0x%08x=0x%x\n", CONFIG_CMD(bus,devfn,where),word); | ||
150 | return PCIBIOS_SUCCESSFUL; | ||
151 | } | ||
152 | |||
153 | #undef CONFIG_CMD | ||
154 | |||
155 | static struct pci_ops pci_direct_conf1 = { | ||
156 | .read = pci_conf1_read, | ||
157 | .write = pci_conf1_write, | ||
158 | }; | ||
159 | |||
160 | static void __devinit quirk_ali_ide_ports(struct pci_dev *dev) | ||
161 | { | ||
162 | dev->resource[0].start = 0x1f0; | ||
163 | dev->resource[0].end = 0x1f7; | ||
164 | dev->resource[0].flags = IORESOURCE_IO; | ||
165 | dev->resource[1].start = 0x3f6; | ||
166 | dev->resource[1].end = 0x3f6; | ||
167 | dev->resource[1].flags = IORESOURCE_IO; | ||
168 | dev->resource[2].start = 0x170; | ||
169 | dev->resource[2].end = 0x177; | ||
170 | dev->resource[2].flags = IORESOURCE_IO; | ||
171 | dev->resource[3].start = 0x376; | ||
172 | dev->resource[3].end = 0x376; | ||
173 | dev->resource[3].flags = IORESOURCE_IO; | ||
174 | dev->resource[4].start = 0xf000; | ||
175 | dev->resource[4].end = 0xf00f; | ||
176 | dev->resource[4].flags = IORESOURCE_IO; | ||
177 | } | ||
178 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M5229, quirk_ali_ide_ports); | ||
179 | |||
180 | char * __devinit pcibios_setup(char *str) | ||
181 | { | ||
182 | return str; | ||
183 | } | ||
184 | |||
185 | /* | ||
186 | * Called after each bus is probed, but before its children | ||
187 | * are examined. | ||
188 | */ | ||
189 | |||
190 | void __devinit pcibios_fixup_bus(struct pci_bus *b) | ||
191 | { | ||
192 | pci_read_bridge_bases(b); | ||
193 | } | ||
194 | |||
195 | /* | ||
196 | * IRQ functions | ||
197 | */ | ||
198 | static inline u8 bridge_swizzle(u8 pin, u8 slot) | ||
199 | { | ||
200 | return (((pin-1) + slot) % 4) + 1; | ||
201 | } | ||
202 | |||
203 | static inline u8 bridge_swizzle_pci_1(u8 pin, u8 slot) | ||
204 | { | ||
205 | return (((pin-1) - slot) & 3) + 1; | ||
206 | } | ||
207 | |||
208 | static u8 __init mpc1211_swizzle(struct pci_dev *dev, u8 *pinp) | ||
209 | { | ||
210 | unsigned long flags; | ||
211 | u8 pin = *pinp; | ||
212 | u32 word; | ||
213 | |||
214 | for ( ; dev->bus->self; dev = dev->bus->self) { | ||
215 | if (!pin) | ||
216 | continue; | ||
217 | |||
218 | if (dev->bus->number == 1) { | ||
219 | local_irq_save(flags); | ||
220 | writel(0x80000000 | 0x2c, PCIPAR); | ||
221 | word = readl(PCIPDR); | ||
222 | local_irq_restore(flags); | ||
223 | word >>= 16; | ||
224 | |||
225 | if (word == 0x0001) | ||
226 | pin = bridge_swizzle_pci_1(pin, PCI_SLOT(dev->devfn)); | ||
227 | else | ||
228 | pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); | ||
229 | } else | ||
230 | pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); | ||
231 | } | ||
232 | |||
233 | *pinp = pin; | ||
234 | |||
235 | return PCI_SLOT(dev->devfn); | ||
236 | } | ||
237 | |||
238 | static int __init map_mpc1211_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
239 | { | ||
240 | int irq = -1; | ||
241 | |||
242 | /* now lookup the actual IRQ on a platform specific basis (pci-'platform'.c) */ | ||
243 | if (dev->bus->number == 0) { | ||
244 | switch (slot) { | ||
245 | case 13: irq = 9; break; /* USB */ | ||
246 | case 22: irq = 10; break; /* LAN */ | ||
247 | default: irq = 0; break; | ||
248 | } | ||
249 | } else { | ||
250 | switch (pin) { | ||
251 | case 0: irq = 0; break; | ||
252 | case 1: irq = 7; break; | ||
253 | case 2: irq = 9; break; | ||
254 | case 3: irq = 10; break; | ||
255 | case 4: irq = 11; break; | ||
256 | } | ||
257 | } | ||
258 | |||
259 | if( irq < 0 ) { | ||
260 | PCIDBG(3, "PCI: Error mapping IRQ on device %s\n", pci_name(dev)); | ||
261 | return irq; | ||
262 | } | ||
263 | |||
264 | PCIDBG(2, "Setting IRQ for slot %s to %d\n", pci_name(dev), irq); | ||
265 | |||
266 | return irq; | ||
267 | } | ||
268 | |||
269 | void __init pcibios_fixup_irqs(void) | ||
270 | { | ||
271 | pci_fixup_irqs(mpc1211_swizzle, map_mpc1211_irq); | ||
272 | } | ||
273 | |||
274 | void pcibios_align_resource(void *data, struct resource *res, | ||
275 | resource_size_t size, resource_size_t align) | ||
276 | { | ||
277 | resource_size_t start = res->start; | ||
278 | |||
279 | if (res->flags & IORESOURCE_IO) { | ||
280 | if (start >= 0x10000UL) { | ||
281 | if ((start & 0xffffUL) < 0x4000UL) { | ||
282 | start = (start & 0xffff0000UL) + 0x4000UL; | ||
283 | } else if ((start & 0xffffUL) >= 0xf000UL) { | ||
284 | start = (start & 0xffff0000UL) + 0x10000UL; | ||
285 | } | ||
286 | res->start = start; | ||
287 | } else { | ||
288 | if (start & 0x300) { | ||
289 | start = (start + 0x3ff) & ~0x3ff; | ||
290 | res->start = start; | ||
291 | } | ||
292 | } | ||
293 | } | ||
294 | } | ||
295 | |||
diff --git a/arch/sh/boards/mpc1211/rtc.c b/arch/sh/boards/mpc1211/rtc.c deleted file mode 100644 index 03b123a4bba..00000000000 --- a/arch/sh/boards/mpc1211/rtc.c +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/kernel/rtc-mpc1211.c -- MPC-1211 on-chip RTC support | ||
3 | * | ||
4 | * Copyright (C) 2002 Saito.K & Jeanne | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <linux/init.h> | ||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/time.h> | ||
12 | #include <linux/bcd.h> | ||
13 | #include <linux/mc146818rtc.h> | ||
14 | |||
15 | unsigned long get_cmos_time(void) | ||
16 | { | ||
17 | unsigned int year, mon, day, hour, min, sec; | ||
18 | |||
19 | spin_lock(&rtc_lock); | ||
20 | |||
21 | do { | ||
22 | sec = CMOS_READ(RTC_SECONDS); | ||
23 | min = CMOS_READ(RTC_MINUTES); | ||
24 | hour = CMOS_READ(RTC_HOURS); | ||
25 | day = CMOS_READ(RTC_DAY_OF_MONTH); | ||
26 | mon = CMOS_READ(RTC_MONTH); | ||
27 | year = CMOS_READ(RTC_YEAR); | ||
28 | } while (sec != CMOS_READ(RTC_SECONDS)); | ||
29 | |||
30 | if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | ||
31 | BCD_TO_BIN(sec); | ||
32 | BCD_TO_BIN(min); | ||
33 | BCD_TO_BIN(hour); | ||
34 | BCD_TO_BIN(day); | ||
35 | BCD_TO_BIN(mon); | ||
36 | BCD_TO_BIN(year); | ||
37 | } | ||
38 | |||
39 | spin_unlock(&rtc_lock); | ||
40 | |||
41 | year += 1900; | ||
42 | if (year < 1970) | ||
43 | year += 100; | ||
44 | |||
45 | return mktime(year, mon, day, hour, min, sec); | ||
46 | } | ||
47 | |||
48 | void mpc1211_rtc_gettimeofday(struct timeval *tv) | ||
49 | { | ||
50 | |||
51 | tv->tv_sec = get_cmos_time(); | ||
52 | tv->tv_usec = 0; | ||
53 | } | ||
54 | |||
55 | /* arc/i386/kernel/time.c */ | ||
56 | /* | ||
57 | * In order to set the CMOS clock precisely, set_rtc_mmss has to be | ||
58 | * called 500 ms after the second nowtime has started, because when | ||
59 | * nowtime is written into the registers of the CMOS clock, it will | ||
60 | * jump to the next second precisely 500 ms later. Check the Motorola | ||
61 | * MC146818A or Dallas DS12887 data sheet for details. | ||
62 | * | ||
63 | * BUG: This routine does not handle hour overflow properly; it just | ||
64 | * sets the minutes. Usually you'll only notice that after reboot! | ||
65 | */ | ||
66 | static int set_rtc_mmss(unsigned long nowtime) | ||
67 | { | ||
68 | int retval = 0; | ||
69 | int real_seconds, real_minutes, cmos_minutes; | ||
70 | unsigned char save_control, save_freq_select; | ||
71 | |||
72 | /* gets recalled with irq locally disabled */ | ||
73 | spin_lock(&rtc_lock); | ||
74 | save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */ | ||
75 | CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); | ||
76 | |||
77 | save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */ | ||
78 | CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT); | ||
79 | |||
80 | cmos_minutes = CMOS_READ(RTC_MINUTES); | ||
81 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) | ||
82 | BCD_TO_BIN(cmos_minutes); | ||
83 | |||
84 | /* | ||
85 | * since we're only adjusting minutes and seconds, | ||
86 | * don't interfere with hour overflow. This avoids | ||
87 | * messing with unknown time zones but requires your | ||
88 | * RTC not to be off by more than 15 minutes | ||
89 | */ | ||
90 | real_seconds = nowtime % 60; | ||
91 | real_minutes = nowtime / 60; | ||
92 | if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1) | ||
93 | real_minutes += 30; /* correct for half hour time zone */ | ||
94 | real_minutes %= 60; | ||
95 | |||
96 | if (abs(real_minutes - cmos_minutes) < 30) { | ||
97 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | ||
98 | BIN_TO_BCD(real_seconds); | ||
99 | BIN_TO_BCD(real_minutes); | ||
100 | } | ||
101 | CMOS_WRITE(real_seconds,RTC_SECONDS); | ||
102 | CMOS_WRITE(real_minutes,RTC_MINUTES); | ||
103 | } else { | ||
104 | printk(KERN_WARNING | ||
105 | "set_rtc_mmss: can't update from %d to %d\n", | ||
106 | cmos_minutes, real_minutes); | ||
107 | retval = -1; | ||
108 | } | ||
109 | |||
110 | /* The following flags have to be released exactly in this order, | ||
111 | * otherwise the DS12887 (popular MC146818A clone with integrated | ||
112 | * battery and quartz) will not reset the oscillator and will not | ||
113 | * update precisely 500 ms later. You won't find this mentioned in | ||
114 | * the Dallas Semiconductor data sheets, but who believes data | ||
115 | * sheets anyway ... -- Markus Kuhn | ||
116 | */ | ||
117 | CMOS_WRITE(save_control, RTC_CONTROL); | ||
118 | CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); | ||
119 | spin_unlock(&rtc_lock); | ||
120 | |||
121 | return retval; | ||
122 | } | ||
123 | |||
124 | int mpc1211_rtc_settimeofday(const struct timeval *tv) | ||
125 | { | ||
126 | unsigned long nowtime = tv->tv_sec; | ||
127 | |||
128 | return set_rtc_mmss(nowtime); | ||
129 | } | ||
130 | |||
131 | void mpc1211_time_init(void) | ||
132 | { | ||
133 | rtc_sh_get_time = mpc1211_rtc_gettimeofday; | ||
134 | rtc_sh_set_time = mpc1211_rtc_settimeofday; | ||
135 | } | ||
136 | |||
diff --git a/arch/sh/boards/mpc1211/setup.c b/arch/sh/boards/mpc1211/setup.c deleted file mode 100644 index fede36361dc..00000000000 --- a/arch/sh/boards/mpc1211/setup.c +++ /dev/null | |||
@@ -1,347 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/mpc1211/setup.c | ||
3 | * | ||
4 | * Copyright (C) 2002 Saito.K & Jeanne, Fujii.Y | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <linux/init.h> | ||
9 | #include <linux/irq.h> | ||
10 | #include <linux/hdreg.h> | ||
11 | #include <linux/ide.h> | ||
12 | #include <linux/interrupt.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <asm/io.h> | ||
15 | #include <asm/machvec.h> | ||
16 | #include <asm/mpc1211/mpc1211.h> | ||
17 | #include <asm/mpc1211/pci.h> | ||
18 | #include <asm/mpc1211/m1543c.h> | ||
19 | |||
20 | /* ALI15X3 SMBus address offsets */ | ||
21 | #define SMBHSTSTS (0 + 0x3100) | ||
22 | #define SMBHSTCNT (1 + 0x3100) | ||
23 | #define SMBHSTSTART (2 + 0x3100) | ||
24 | #define SMBHSTCMD (7 + 0x3100) | ||
25 | #define SMBHSTADD (3 + 0x3100) | ||
26 | #define SMBHSTDAT0 (4 + 0x3100) | ||
27 | #define SMBHSTDAT1 (5 + 0x3100) | ||
28 | #define SMBBLKDAT (6 + 0x3100) | ||
29 | |||
30 | /* Other settings */ | ||
31 | #define MAX_TIMEOUT 500 /* times 1/100 sec */ | ||
32 | |||
33 | /* ALI15X3 command constants */ | ||
34 | #define ALI15X3_ABORT 0x04 | ||
35 | #define ALI15X3_T_OUT 0x08 | ||
36 | #define ALI15X3_QUICK 0x00 | ||
37 | #define ALI15X3_BYTE 0x10 | ||
38 | #define ALI15X3_BYTE_DATA 0x20 | ||
39 | #define ALI15X3_WORD_DATA 0x30 | ||
40 | #define ALI15X3_BLOCK_DATA 0x40 | ||
41 | #define ALI15X3_BLOCK_CLR 0x80 | ||
42 | |||
43 | /* ALI15X3 status register bits */ | ||
44 | #define ALI15X3_STS_IDLE 0x04 | ||
45 | #define ALI15X3_STS_BUSY 0x08 | ||
46 | #define ALI15X3_STS_DONE 0x10 | ||
47 | #define ALI15X3_STS_DEV 0x20 /* device error */ | ||
48 | #define ALI15X3_STS_COLL 0x40 /* collision or no response */ | ||
49 | #define ALI15X3_STS_TERM 0x80 /* terminated by abort */ | ||
50 | #define ALI15X3_STS_ERR 0xE0 /* all the bad error bits */ | ||
51 | |||
52 | static void __init pci_write_config(unsigned long busNo, | ||
53 | unsigned long devNo, | ||
54 | unsigned long fncNo, | ||
55 | unsigned long cnfAdd, | ||
56 | unsigned long cnfData) | ||
57 | { | ||
58 | ctrl_outl((0x80000000 | ||
59 | + ((busNo & 0xff) << 16) | ||
60 | + ((devNo & 0x1f) << 11) | ||
61 | + ((fncNo & 0x07) << 8) | ||
62 | + (cnfAdd & 0xfc)), PCIPAR); | ||
63 | |||
64 | ctrl_outl(cnfData, PCIPDR); | ||
65 | } | ||
66 | |||
67 | /* | ||
68 | Initialize IRQ setting | ||
69 | */ | ||
70 | |||
71 | static unsigned char m_irq_mask = 0xfb; | ||
72 | static unsigned char s_irq_mask = 0xff; | ||
73 | |||
74 | static void disable_mpc1211_irq(unsigned int irq) | ||
75 | { | ||
76 | if( irq < 8) { | ||
77 | m_irq_mask |= (1 << irq); | ||
78 | outb(m_irq_mask,I8259_M_MR); | ||
79 | } else { | ||
80 | s_irq_mask |= (1 << (irq - 8)); | ||
81 | outb(s_irq_mask,I8259_S_MR); | ||
82 | } | ||
83 | |||
84 | } | ||
85 | |||
86 | static void enable_mpc1211_irq(unsigned int irq) | ||
87 | { | ||
88 | if( irq < 8) { | ||
89 | m_irq_mask &= ~(1 << irq); | ||
90 | outb(m_irq_mask,I8259_M_MR); | ||
91 | } else { | ||
92 | s_irq_mask &= ~(1 << (irq - 8)); | ||
93 | outb(s_irq_mask,I8259_S_MR); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | static inline int mpc1211_irq_real(unsigned int irq) | ||
98 | { | ||
99 | int value; | ||
100 | int irqmask; | ||
101 | |||
102 | if ( irq < 8) { | ||
103 | irqmask = 1<<irq; | ||
104 | outb(0x0b,I8259_M_CR); /* ISR register */ | ||
105 | value = inb(I8259_M_CR) & irqmask; | ||
106 | outb(0x0a,I8259_M_CR); /* back ro the IPR reg */ | ||
107 | return value; | ||
108 | } | ||
109 | irqmask = 1<<(irq - 8); | ||
110 | outb(0x0b,I8259_S_CR); /* ISR register */ | ||
111 | value = inb(I8259_S_CR) & irqmask; | ||
112 | outb(0x0a,I8259_S_CR); /* back ro the IPR reg */ | ||
113 | return value; | ||
114 | } | ||
115 | |||
116 | static void mask_and_ack_mpc1211(unsigned int irq) | ||
117 | { | ||
118 | if(irq < 8) { | ||
119 | if(m_irq_mask & (1<<irq)){ | ||
120 | if(!mpc1211_irq_real(irq)){ | ||
121 | atomic_inc(&irq_err_count) | ||
122 | printk("spurious 8259A interrupt: IRQ %x\n",irq); | ||
123 | } | ||
124 | } else { | ||
125 | m_irq_mask |= (1<<irq); | ||
126 | } | ||
127 | inb(I8259_M_MR); /* DUMMY */ | ||
128 | outb(m_irq_mask,I8259_M_MR); /* disable */ | ||
129 | outb(0x60+irq,I8259_M_CR); /* EOI */ | ||
130 | |||
131 | } else { | ||
132 | if(s_irq_mask & (1<<(irq - 8))){ | ||
133 | if(!mpc1211_irq_real(irq)){ | ||
134 | atomic_inc(&irq_err_count); | ||
135 | printk("spurious 8259A interrupt: IRQ %x\n",irq); | ||
136 | } | ||
137 | } else { | ||
138 | s_irq_mask |= (1<<(irq - 8)); | ||
139 | } | ||
140 | inb(I8259_S_MR); /* DUMMY */ | ||
141 | outb(s_irq_mask,I8259_S_MR); /* disable */ | ||
142 | outb(0x60+(irq-8),I8259_S_CR); /* EOI */ | ||
143 | outb(0x60+2,I8259_M_CR); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | static void end_mpc1211_irq(unsigned int irq) | ||
148 | { | ||
149 | enable_mpc1211_irq(irq); | ||
150 | } | ||
151 | |||
152 | static unsigned int startup_mpc1211_irq(unsigned int irq) | ||
153 | { | ||
154 | enable_mpc1211_irq(irq); | ||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | static void shutdown_mpc1211_irq(unsigned int irq) | ||
159 | { | ||
160 | disable_mpc1211_irq(irq); | ||
161 | } | ||
162 | |||
163 | static struct hw_interrupt_type mpc1211_irq_type = { | ||
164 | .typename = "MPC1211-IRQ", | ||
165 | .startup = startup_mpc1211_irq, | ||
166 | .shutdown = shutdown_mpc1211_irq, | ||
167 | .enable = enable_mpc1211_irq, | ||
168 | .disable = disable_mpc1211_irq, | ||
169 | .ack = mask_and_ack_mpc1211, | ||
170 | .end = end_mpc1211_irq | ||
171 | }; | ||
172 | |||
173 | static void make_mpc1211_irq(unsigned int irq) | ||
174 | { | ||
175 | irq_desc[irq].chip = &mpc1211_irq_type; | ||
176 | irq_desc[irq].status = IRQ_DISABLED; | ||
177 | irq_desc[irq].action = 0; | ||
178 | irq_desc[irq].depth = 1; | ||
179 | disable_mpc1211_irq(irq); | ||
180 | } | ||
181 | |||
182 | int mpc1211_irq_demux(int irq) | ||
183 | { | ||
184 | unsigned int poll; | ||
185 | |||
186 | if( irq == 2 ) { | ||
187 | outb(0x0c,I8259_M_CR); | ||
188 | poll = inb(I8259_M_CR); | ||
189 | if(poll & 0x80) { | ||
190 | irq = (poll & 0x07); | ||
191 | } | ||
192 | if( irq == 2) { | ||
193 | outb(0x0c,I8259_S_CR); | ||
194 | poll = inb(I8259_S_CR); | ||
195 | irq = (poll & 0x07) + 8; | ||
196 | } | ||
197 | } | ||
198 | return irq; | ||
199 | } | ||
200 | |||
201 | static void __init init_mpc1211_IRQ(void) | ||
202 | { | ||
203 | int i; | ||
204 | /* | ||
205 | * Super I/O (Just mimic PC): | ||
206 | * 1: keyboard | ||
207 | * 3: serial 1 | ||
208 | * 4: serial 0 | ||
209 | * 5: printer | ||
210 | * 6: floppy | ||
211 | * 8: rtc | ||
212 | * 10: lan | ||
213 | * 12: mouse | ||
214 | * 14: ide0 | ||
215 | * 15: ide1 | ||
216 | */ | ||
217 | |||
218 | pci_write_config(0,0,0,0x54, 0xb0b0002d); | ||
219 | outb(0x11, I8259_M_CR); /* mater icw1 edge trigger */ | ||
220 | outb(0x11, I8259_S_CR); /* slave icw1 edge trigger */ | ||
221 | outb(0x20, I8259_M_MR); /* m icw2 base vec 0x08 */ | ||
222 | outb(0x28, I8259_S_MR); /* s icw2 base vec 0x70 */ | ||
223 | outb(0x04, I8259_M_MR); /* m icw3 slave irq2 */ | ||
224 | outb(0x02, I8259_S_MR); /* s icw3 slave id */ | ||
225 | outb(0x01, I8259_M_MR); /* m icw4 non buf normal eoi*/ | ||
226 | outb(0x01, I8259_S_MR); /* s icw4 non buf normal eo1*/ | ||
227 | outb(0xfb, I8259_M_MR); /* disable irq0--irq7 */ | ||
228 | outb(0xff, I8259_S_MR); /* disable irq8--irq15 */ | ||
229 | |||
230 | for ( i=0; i < 16; i++) { | ||
231 | if(i != 2) { | ||
232 | make_mpc1211_irq(i); | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | |||
237 | static void delay1000(void) | ||
238 | { | ||
239 | int i; | ||
240 | |||
241 | for (i=0; i<1000; i++) | ||
242 | ctrl_delay(); | ||
243 | } | ||
244 | |||
245 | static int put_smb_blk(unsigned char *p, int address, int command, int no) | ||
246 | { | ||
247 | int temp; | ||
248 | int timeout; | ||
249 | int i; | ||
250 | |||
251 | outb(0xff, SMBHSTSTS); | ||
252 | temp = inb(SMBHSTSTS); | ||
253 | for (timeout = 0; (timeout < MAX_TIMEOUT) && !(temp & ALI15X3_STS_IDLE); timeout++) { | ||
254 | delay1000(); | ||
255 | temp = inb(SMBHSTSTS); | ||
256 | } | ||
257 | if (timeout >= MAX_TIMEOUT){ | ||
258 | return -1; | ||
259 | } | ||
260 | |||
261 | outb(((address & 0x7f) << 1), SMBHSTADD); | ||
262 | outb(0xc0, SMBHSTCNT); | ||
263 | outb(command & 0xff, SMBHSTCMD); | ||
264 | outb(no & 0x1f, SMBHSTDAT0); | ||
265 | |||
266 | for(i = 1; i <= no; i++) { | ||
267 | outb(*p++, SMBBLKDAT); | ||
268 | } | ||
269 | outb(0xff, SMBHSTSTART); | ||
270 | |||
271 | temp = inb(SMBHSTSTS); | ||
272 | for (timeout = 0; (timeout < MAX_TIMEOUT) && !(temp & (ALI15X3_STS_ERR | ALI15X3_STS_DONE)); timeout++) { | ||
273 | delay1000(); | ||
274 | temp = inb(SMBHSTSTS); | ||
275 | } | ||
276 | if (timeout >= MAX_TIMEOUT) { | ||
277 | return -2; | ||
278 | } | ||
279 | if ( temp & ALI15X3_STS_ERR ){ | ||
280 | return -3; | ||
281 | } | ||
282 | return 0; | ||
283 | } | ||
284 | |||
285 | static struct resource heartbeat_resources[] = { | ||
286 | [0] = { | ||
287 | .start = 0xa2000000, | ||
288 | .end = 0xa2000000, | ||
289 | .flags = IORESOURCE_MEM, | ||
290 | }, | ||
291 | }; | ||
292 | |||
293 | static struct platform_device heartbeat_device = { | ||
294 | .name = "heartbeat", | ||
295 | .id = -1, | ||
296 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
297 | .resource = heartbeat_resources, | ||
298 | }; | ||
299 | |||
300 | static struct platform_device *mpc1211_devices[] __initdata = { | ||
301 | &heartbeat_device, | ||
302 | }; | ||
303 | |||
304 | static int __init mpc1211_devices_setup(void) | ||
305 | { | ||
306 | return platform_add_devices(mpc1211_devices, | ||
307 | ARRAY_SIZE(mpc1211_devices)); | ||
308 | } | ||
309 | __initcall(mpc1211_devices_setup); | ||
310 | |||
311 | /* arch/sh/boards/mpc1211/rtc.c */ | ||
312 | void mpc1211_time_init(void); | ||
313 | |||
314 | static void __init mpc1211_setup(char **cmdline_p) | ||
315 | { | ||
316 | unsigned char spd_buf[128]; | ||
317 | |||
318 | __set_io_port_base(PA_PCI_IO); | ||
319 | |||
320 | pci_write_config(0,0,0,0x54, 0xb0b00000); | ||
321 | |||
322 | do { | ||
323 | outb(ALI15X3_ABORT, SMBHSTCNT); | ||
324 | spd_buf[0] = 0x0c; | ||
325 | spd_buf[1] = 0x43; | ||
326 | spd_buf[2] = 0x7f; | ||
327 | spd_buf[3] = 0x03; | ||
328 | spd_buf[4] = 0x00; | ||
329 | spd_buf[5] = 0x03; | ||
330 | spd_buf[6] = 0x00; | ||
331 | } while (put_smb_blk(spd_buf, 0x69, 0, 7) < 0); | ||
332 | |||
333 | board_time_init = mpc1211_time_init; | ||
334 | |||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | /* | ||
339 | * The Machine Vector | ||
340 | */ | ||
341 | static struct sh_machine_vector mv_mpc1211 __initmv = { | ||
342 | .mv_name = "Interface MPC-1211(CTP/PCI/MPC-SH02)", | ||
343 | .mv_setup = mpc1211_setup, | ||
344 | .mv_nr_irqs = 48, | ||
345 | .mv_irq_demux = mpc1211_irq_demux, | ||
346 | .mv_init_irq = init_mpc1211_IRQ, | ||
347 | }; | ||
diff --git a/arch/sh/boards/renesas/migor/setup.c b/arch/sh/boards/renesas/migor/setup.c index e7c150d4970..01af44245b5 100644 --- a/arch/sh/boards/renesas/migor/setup.c +++ b/arch/sh/boards/renesas/migor/setup.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/mtd/physmap.h> | 14 | #include <linux/mtd/physmap.h> |
15 | #include <linux/mtd/nand.h> | 15 | #include <linux/mtd/nand.h> |
16 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
17 | #include <linux/smc91x.h> | ||
17 | #include <asm/machvec.h> | 18 | #include <asm/machvec.h> |
18 | #include <asm/io.h> | 19 | #include <asm/io.h> |
19 | #include <asm/sh_keysc.h> | 20 | #include <asm/sh_keysc.h> |
@@ -27,6 +28,11 @@ | |||
27 | * 0x18000000 8GB 8 NAND Flash (K9K8G08U0A) | 28 | * 0x18000000 8GB 8 NAND Flash (K9K8G08U0A) |
28 | */ | 29 | */ |
29 | 30 | ||
31 | static struct smc91x_platdata smc91x_info = { | ||
32 | .flags = SMC91X_USE_16BIT, | ||
33 | .irq_flags = IRQF_TRIGGER_HIGH, | ||
34 | }; | ||
35 | |||
30 | static struct resource smc91x_eth_resources[] = { | 36 | static struct resource smc91x_eth_resources[] = { |
31 | [0] = { | 37 | [0] = { |
32 | .name = "SMC91C111" , | 38 | .name = "SMC91C111" , |
@@ -36,7 +42,7 @@ static struct resource smc91x_eth_resources[] = { | |||
36 | }, | 42 | }, |
37 | [1] = { | 43 | [1] = { |
38 | .start = 32, /* IRQ0 */ | 44 | .start = 32, /* IRQ0 */ |
39 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, | 45 | .flags = IORESOURCE_IRQ, |
40 | }, | 46 | }, |
41 | }; | 47 | }; |
42 | 48 | ||
@@ -44,6 +50,9 @@ static struct platform_device smc91x_eth_device = { | |||
44 | .name = "smc91x", | 50 | .name = "smc91x", |
45 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), | 51 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), |
46 | .resource = smc91x_eth_resources, | 52 | .resource = smc91x_eth_resources, |
53 | .dev = { | ||
54 | .platform_data = &smc91x_info, | ||
55 | }, | ||
47 | }; | 56 | }; |
48 | 57 | ||
49 | static struct sh_keysc_info sh_keysc_info = { | 58 | static struct sh_keysc_info sh_keysc_info = { |
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c b/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c index 68f0ad1b637..ae1cfcb2970 100644 --- a/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c +++ b/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c | |||
@@ -62,7 +62,7 @@ static unsigned char irl2irq[HL_NR_IRL] __initdata = { | |||
62 | static DECLARE_INTC_DESC(intc_desc, "r7780mp", vectors, | 62 | static DECLARE_INTC_DESC(intc_desc, "r7780mp", vectors, |
63 | NULL, mask_registers, NULL, NULL); | 63 | NULL, mask_registers, NULL, NULL); |
64 | 64 | ||
65 | unsigned char * __init highlander_init_irq_r7780mp(void) | 65 | unsigned char * __init highlander_plat_irq_setup(void) |
66 | { | 66 | { |
67 | if ((ctrl_inw(0xa4000700) & 0xf000) == 0x2000) { | 67 | if ((ctrl_inw(0xa4000700) & 0xf000) == 0x2000) { |
68 | printk(KERN_INFO "Using r7780mp interrupt controller.\n"); | 68 | printk(KERN_INFO "Using r7780mp interrupt controller.\n"); |
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c b/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c index bd34048ed0e..9d3921fe27c 100644 --- a/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c +++ b/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c | |||
@@ -55,7 +55,7 @@ static unsigned char irl2irq[HL_NR_IRL] __initdata = { | |||
55 | static DECLARE_INTC_DESC(intc_desc, "r7780rp", vectors, | 55 | static DECLARE_INTC_DESC(intc_desc, "r7780rp", vectors, |
56 | NULL, mask_registers, NULL, NULL); | 56 | NULL, mask_registers, NULL, NULL); |
57 | 57 | ||
58 | unsigned char * __init highlander_init_irq_r7780rp(void) | 58 | unsigned char * __init highlander_plat_irq_setup(void) |
59 | { | 59 | { |
60 | if (ctrl_inw(0xa5000600)) { | 60 | if (ctrl_inw(0xa5000600)) { |
61 | printk(KERN_INFO "Using r7780rp interrupt controller.\n"); | 61 | printk(KERN_INFO "Using r7780rp interrupt controller.\n"); |
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c b/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c index bf7ec107fbc..896c045aa39 100644 --- a/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c +++ b/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c | |||
@@ -64,7 +64,7 @@ static unsigned char irl2irq[HL_NR_IRL] __initdata = { | |||
64 | static DECLARE_INTC_DESC(intc_desc, "r7785rp", vectors, | 64 | static DECLARE_INTC_DESC(intc_desc, "r7785rp", vectors, |
65 | NULL, mask_registers, NULL, NULL); | 65 | NULL, mask_registers, NULL, NULL); |
66 | 66 | ||
67 | unsigned char * __init highlander_init_irq_r7785rp(void) | 67 | unsigned char * __init highlander_plat_irq_setup(void) |
68 | { | 68 | { |
69 | if ((ctrl_inw(0xa4000158) & 0xf000) != 0x1000) | 69 | if ((ctrl_inw(0xa4000158) & 0xf000) != 0x1000) |
70 | return NULL; | 70 | return NULL; |
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c index ac0a96522e4..bc79afb6fc4 100644 --- a/arch/sh/boards/renesas/r7780rp/setup.c +++ b/arch/sh/boards/renesas/r7780rp/setup.c | |||
@@ -316,7 +316,7 @@ static void __init highlander_setup(char **cmdline_p) | |||
316 | 316 | ||
317 | static unsigned char irl2irq[HL_NR_IRL]; | 317 | static unsigned char irl2irq[HL_NR_IRL]; |
318 | 318 | ||
319 | int highlander_irq_demux(int irq) | 319 | static int highlander_irq_demux(int irq) |
320 | { | 320 | { |
321 | if (irq >= HL_NR_IRL || !irl2irq[irq]) | 321 | if (irq >= HL_NR_IRL || !irl2irq[irq]) |
322 | return irq; | 322 | return irq; |
@@ -324,27 +324,9 @@ int highlander_irq_demux(int irq) | |||
324 | return irl2irq[irq]; | 324 | return irl2irq[irq]; |
325 | } | 325 | } |
326 | 326 | ||
327 | void __init highlander_init_irq(void) | 327 | static void __init highlander_init_irq(void) |
328 | { | 328 | { |
329 | unsigned char *ucp = NULL; | 329 | unsigned char *ucp = highlander_plat_irq_setup(); |
330 | |||
331 | do { | ||
332 | #ifdef CONFIG_SH_R7780MP | ||
333 | ucp = highlander_init_irq_r7780mp(); | ||
334 | if (ucp) | ||
335 | break; | ||
336 | #endif | ||
337 | #ifdef CONFIG_SH_R7785RP | ||
338 | ucp = highlander_init_irq_r7785rp(); | ||
339 | if (ucp) | ||
340 | break; | ||
341 | #endif | ||
342 | #ifdef CONFIG_SH_R7780RP | ||
343 | ucp = highlander_init_irq_r7780rp(); | ||
344 | if (ucp) | ||
345 | break; | ||
346 | #endif | ||
347 | } while (0); | ||
348 | 330 | ||
349 | if (ucp) { | 331 | if (ucp) { |
350 | plat_irq_setup_pins(IRQ_MODE_IRL3210); | 332 | plat_irq_setup_pins(IRQ_MODE_IRL3210); |
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c index f21ee49ef3a..452d0d6459a 100644 --- a/arch/sh/boards/renesas/rts7751r2d/setup.c +++ b/arch/sh/boards/renesas/rts7751r2d/setup.c | |||
@@ -109,7 +109,6 @@ static struct platform_device heartbeat_device = { | |||
109 | .resource = heartbeat_resources, | 109 | .resource = heartbeat_resources, |
110 | }; | 110 | }; |
111 | 111 | ||
112 | #ifdef CONFIG_MFD_SM501 | ||
113 | static struct plat_serial8250_port uart_platform_data[] = { | 112 | static struct plat_serial8250_port uart_platform_data[] = { |
114 | { | 113 | { |
115 | .membase = (void __iomem *)0xb3e30000, | 114 | .membase = (void __iomem *)0xb3e30000, |
@@ -208,13 +207,9 @@ static struct platform_device sm501_device = { | |||
208 | .resource = sm501_resources, | 207 | .resource = sm501_resources, |
209 | }; | 208 | }; |
210 | 209 | ||
211 | #endif /* CONFIG_MFD_SM501 */ | ||
212 | |||
213 | static struct platform_device *rts7751r2d_devices[] __initdata = { | 210 | static struct platform_device *rts7751r2d_devices[] __initdata = { |
214 | #ifdef CONFIG_MFD_SM501 | ||
215 | &uart_device, | 211 | &uart_device, |
216 | &sm501_device, | 212 | &sm501_device, |
217 | #endif | ||
218 | &heartbeat_device, | 213 | &heartbeat_device, |
219 | &spi_sh_sci_device, | 214 | &spi_sh_sci_device, |
220 | }; | 215 | }; |
@@ -234,7 +229,9 @@ static int __init rts7751r2d_devices_setup(void) | |||
234 | { | 229 | { |
235 | if (register_trapped_io(&cf_trapped_io) == 0) | 230 | if (register_trapped_io(&cf_trapped_io) == 0) |
236 | platform_device_register(&cf_ide_device); | 231 | platform_device_register(&cf_ide_device); |
232 | |||
237 | spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); | 233 | spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); |
234 | |||
238 | return platform_add_devices(rts7751r2d_devices, | 235 | return platform_add_devices(rts7751r2d_devices, |
239 | ARRAY_SIZE(rts7751r2d_devices)); | 236 | ARRAY_SIZE(rts7751r2d_devices)); |
240 | } | 237 | } |
diff --git a/arch/sh/boards/se/7206/setup.c b/arch/sh/boards/se/7206/setup.c index 5b3ee089d91..4fe84cc0840 100644 --- a/arch/sh/boards/se/7206/setup.c +++ b/arch/sh/boards/se/7206/setup.c | |||
@@ -3,12 +3,13 @@ | |||
3 | * linux/arch/sh/boards/se/7206/setup.c | 3 | * linux/arch/sh/boards/se/7206/setup.c |
4 | * | 4 | * |
5 | * Copyright (C) 2006 Yoshinori Sato | 5 | * Copyright (C) 2006 Yoshinori Sato |
6 | * Copyright (C) 2007 Paul Mundt | 6 | * Copyright (C) 2007 - 2008 Paul Mundt |
7 | * | 7 | * |
8 | * Hitachi 7206 SolutionEngine Support. | 8 | * Hitachi 7206 SolutionEngine Support. |
9 | */ | 9 | */ |
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/platform_device.h> | 11 | #include <linux/platform_device.h> |
12 | #include <linux/smc91x.h> | ||
12 | #include <asm/se7206.h> | 13 | #include <asm/se7206.h> |
13 | #include <asm/io.h> | 14 | #include <asm/io.h> |
14 | #include <asm/machvec.h> | 15 | #include <asm/machvec.h> |
@@ -16,8 +17,9 @@ | |||
16 | 17 | ||
17 | static struct resource smc91x_resources[] = { | 18 | static struct resource smc91x_resources[] = { |
18 | [0] = { | 19 | [0] = { |
19 | .start = 0x300, | 20 | .name = "smc91x-regs", |
20 | .end = 0x300 + 0x020 - 1, | 21 | .start = PA_SMSC + 0x300, |
22 | .end = PA_SMSC + 0x300 + 0x020 - 1, | ||
21 | .flags = IORESOURCE_MEM, | 23 | .flags = IORESOURCE_MEM, |
22 | }, | 24 | }, |
23 | [1] = { | 25 | [1] = { |
@@ -27,9 +29,18 @@ static struct resource smc91x_resources[] = { | |||
27 | }, | 29 | }, |
28 | }; | 30 | }; |
29 | 31 | ||
32 | static struct smc91x_platdata smc91x_info = { | ||
33 | .flags = SMC91X_USE_16BIT, | ||
34 | }; | ||
35 | |||
30 | static struct platform_device smc91x_device = { | 36 | static struct platform_device smc91x_device = { |
31 | .name = "smc91x", | 37 | .name = "smc91x", |
32 | .id = -1, | 38 | .id = -1, |
39 | .dev = { | ||
40 | .dma_mask = NULL, | ||
41 | .coherent_dma_mask = 0xffffffff, | ||
42 | .platform_data = &smc91x_info, | ||
43 | }, | ||
33 | .num_resources = ARRAY_SIZE(smc91x_resources), | 44 | .num_resources = ARRAY_SIZE(smc91x_resources), |
34 | .resource = smc91x_resources, | 45 | .resource = smc91x_resources, |
35 | }; | 46 | }; |
diff --git a/arch/sh/boards/se/7722/setup.c b/arch/sh/boards/se/7722/setup.c index 33f6ee71f84..ede3957fc14 100644 --- a/arch/sh/boards/se/7722/setup.c +++ b/arch/sh/boards/se/7722/setup.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/ata_platform.h> | 15 | #include <linux/ata_platform.h> |
16 | #include <linux/input.h> | 16 | #include <linux/input.h> |
17 | #include <linux/smc91x.h> | ||
17 | #include <asm/machvec.h> | 18 | #include <asm/machvec.h> |
18 | #include <asm/se7722.h> | 19 | #include <asm/se7722.h> |
19 | #include <asm/io.h> | 20 | #include <asm/io.h> |
@@ -44,6 +45,10 @@ static struct platform_device heartbeat_device = { | |||
44 | }; | 45 | }; |
45 | 46 | ||
46 | /* SMC91x */ | 47 | /* SMC91x */ |
48 | static struct smc91x_platdata smc91x_info = { | ||
49 | .flags = SMC91X_USE_16BIT, | ||
50 | }; | ||
51 | |||
47 | static struct resource smc91x_eth_resources[] = { | 52 | static struct resource smc91x_eth_resources[] = { |
48 | [0] = { | 53 | [0] = { |
49 | .name = "smc91x-regs" , | 54 | .name = "smc91x-regs" , |
@@ -64,6 +69,7 @@ static struct platform_device smc91x_eth_device = { | |||
64 | .dev = { | 69 | .dev = { |
65 | .dma_mask = NULL, /* don't use dma */ | 70 | .dma_mask = NULL, /* don't use dma */ |
66 | .coherent_dma_mask = 0xffffffff, | 71 | .coherent_dma_mask = 0xffffffff, |
72 | .platform_data = &smc91x_info, | ||
67 | }, | 73 | }, |
68 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), | 74 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), |
69 | .resource = smc91x_eth_resources, | 75 | .resource = smc91x_eth_resources, |
diff --git a/arch/sh/boot/compressed/Makefile_32 b/arch/sh/boot/compressed/Makefile_32 index 6ac8d4a4ed1..c0d25fb1aa6 100644 --- a/arch/sh/boot/compressed/Makefile_32 +++ b/arch/sh/boot/compressed/Makefile_32 | |||
@@ -6,7 +6,6 @@ | |||
6 | 6 | ||
7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz \ | 7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz \ |
8 | head_32.o misc_32.o piggy.o | 8 | head_32.o misc_32.o piggy.o |
9 | EXTRA_AFLAGS := -traditional | ||
10 | 9 | ||
11 | OBJECTS = $(obj)/head_32.o $(obj)/misc_32.o | 10 | OBJECTS = $(obj)/head_32.o $(obj)/misc_32.o |
12 | 11 | ||
diff --git a/arch/sh/boot/compressed/Makefile_64 b/arch/sh/boot/compressed/Makefile_64 index 4334f2b86d8..912f3e205a0 100644 --- a/arch/sh/boot/compressed/Makefile_64 +++ b/arch/sh/boot/compressed/Makefile_64 | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | targets := vmlinux vmlinux.bin vmlinux.bin.gz \ | 14 | targets := vmlinux vmlinux.bin vmlinux.bin.gz \ |
15 | head_64.o misc_64.o cache.o piggy.o | 15 | head_64.o misc_64.o cache.o piggy.o |
16 | EXTRA_AFLAGS := -traditional | ||
17 | 16 | ||
18 | OBJECTS := $(obj)/vmlinux_64.lds $(obj)/head_64.o $(obj)/misc_64.o \ | 17 | OBJECTS := $(obj)/vmlinux_64.lds $(obj)/head_64.o $(obj)/misc_64.o \ |
19 | $(obj)/cache.o | 18 | $(obj)/cache.o |
diff --git a/arch/sh/kernel/cpu/irq/intc-sh5.c b/arch/sh/kernel/cpu/irq/intc-sh5.c index d6e0e2bdaad..de45c6a3e33 100644 --- a/arch/sh/kernel/cpu/irq/intc-sh5.c +++ b/arch/sh/kernel/cpu/irq/intc-sh5.c | |||
@@ -184,9 +184,8 @@ int intc_irq_describe(char* p, int irq) | |||
184 | 184 | ||
185 | void __init plat_irq_setup(void) | 185 | void __init plat_irq_setup(void) |
186 | { | 186 | { |
187 | unsigned long long __dummy0, __dummy1=~0x00000000100000f0; | 187 | unsigned long long __dummy0, __dummy1=~0x00000000100000f0; |
188 | unsigned long reg; | 188 | unsigned long reg; |
189 | unsigned long data; | ||
190 | int i; | 189 | int i; |
191 | 190 | ||
192 | intc_virt = onchip_remap(INTC_BASE, 1024, "INTC"); | 191 | intc_virt = onchip_remap(INTC_BASE, 1024, "INTC"); |
@@ -196,11 +195,8 @@ void __init plat_irq_setup(void) | |||
196 | 195 | ||
197 | 196 | ||
198 | /* Set default: per-line enable/disable, priority driven ack/eoi */ | 197 | /* Set default: per-line enable/disable, priority driven ack/eoi */ |
199 | for (i = 0; i < NR_INTC_IRQS; i++) { | 198 | for (i = 0; i < NR_INTC_IRQS; i++) |
200 | if (platform_int_priority[i] != NO_PRIORITY) { | 199 | irq_desc[i].chip = &intc_irq_type; |
201 | irq_desc[i].chip = &intc_irq_type; | ||
202 | } | ||
203 | } | ||
204 | 200 | ||
205 | 201 | ||
206 | /* Disable all interrupts and set all priorities to 0 to avoid trouble */ | 202 | /* Disable all interrupts and set all priorities to 0 to avoid trouble */ |
@@ -211,35 +207,42 @@ void __init plat_irq_setup(void) | |||
211 | ctrl_outl( NO_PRIORITY, reg); | 207 | ctrl_outl( NO_PRIORITY, reg); |
212 | 208 | ||
213 | 209 | ||
214 | /* Set IRLM */ | 210 | #ifdef CONFIG_SH_CAYMAN |
215 | /* If all the priorities are set to 'no priority', then | 211 | { |
216 | * assume we are using encoded mode. | 212 | unsigned long data; |
217 | */ | 213 | |
218 | irlm = platform_int_priority[IRQ_IRL0] + platform_int_priority[IRQ_IRL1] + \ | 214 | /* Set IRLM */ |
219 | platform_int_priority[IRQ_IRL2] + platform_int_priority[IRQ_IRL3]; | 215 | /* If all the priorities are set to 'no priority', then |
220 | 216 | * assume we are using encoded mode. | |
221 | if (irlm == NO_PRIORITY) { | 217 | */ |
222 | /* IRLM = 0 */ | 218 | irlm = platform_int_priority[IRQ_IRL0] + |
223 | reg = INTC_ICR_CLEAR; | 219 | platform_int_priority[IRQ_IRL1] + |
224 | i = IRQ_INTA; | 220 | platform_int_priority[IRQ_IRL2] + |
225 | printk("Trying to use encoded IRL0-3. IRLs unsupported.\n"); | 221 | platform_int_priority[IRQ_IRL3]; |
226 | } else { | 222 | if (irlm == NO_PRIORITY) { |
227 | /* IRLM = 1 */ | 223 | /* IRLM = 0 */ |
228 | reg = INTC_ICR_SET; | 224 | reg = INTC_ICR_CLEAR; |
229 | i = IRQ_IRL0; | 225 | i = IRQ_INTA; |
230 | } | 226 | printk("Trying to use encoded IRL0-3. IRLs unsupported.\n"); |
231 | ctrl_outl(INTC_ICR_IRLM, reg); | 227 | } else { |
232 | 228 | /* IRLM = 1 */ | |
233 | /* Set interrupt priorities according to platform description */ | 229 | reg = INTC_ICR_SET; |
234 | for (data = 0, reg = INTC_INTPRI_0; i < NR_INTC_IRQS; i++) { | 230 | i = IRQ_IRL0; |
235 | data |= platform_int_priority[i] << ((i % INTC_INTPRI_PPREG) * 4); | ||
236 | if ((i % INTC_INTPRI_PPREG) == (INTC_INTPRI_PPREG - 1)) { | ||
237 | /* Upon the 7th, set Priority Register */ | ||
238 | ctrl_outl(data, reg); | ||
239 | data = 0; | ||
240 | reg += 8; | ||
241 | } | 231 | } |
242 | } | 232 | ctrl_outl(INTC_ICR_IRLM, reg); |
233 | |||
234 | /* Set interrupt priorities according to platform description */ | ||
235 | for (data = 0, reg = INTC_INTPRI_0; i < NR_INTC_IRQS; i++) { | ||
236 | data |= platform_int_priority[i] << | ||
237 | ((i % INTC_INTPRI_PPREG) * 4); | ||
238 | if ((i % INTC_INTPRI_PPREG) == (INTC_INTPRI_PPREG - 1)) { | ||
239 | /* Upon the 7th, set Priority Register */ | ||
240 | ctrl_outl(data, reg); | ||
241 | data = 0; | ||
242 | reg += 8; | ||
243 | } | ||
244 | } | ||
245 | #endif | ||
243 | 246 | ||
244 | /* | 247 | /* |
245 | * And now let interrupts come in. | 248 | * And now let interrupts come in. |
diff --git a/arch/sh/kernel/cpu/irq/intc.c b/arch/sh/kernel/cpu/irq/intc.c index 84806b2027f..da5dae78788 100644 --- a/arch/sh/kernel/cpu/irq/intc.c +++ b/arch/sh/kernel/cpu/irq/intc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Shared interrupt handling code for IPR and INTC2 types of IRQs. | 2 | * Shared interrupt handling code for IPR and INTC2 types of IRQs. |
3 | * | 3 | * |
4 | * Copyright (C) 2007 Magnus Damm | 4 | * Copyright (C) 2007, 2008 Magnus Damm |
5 | * | 5 | * |
6 | * Based on intc2.c and ipr.c | 6 | * Based on intc2.c and ipr.c |
7 | * | 7 | * |
@@ -62,6 +62,9 @@ struct intc_desc_int { | |||
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | static unsigned int intc_prio_level[NR_IRQS]; /* for now */ | 64 | static unsigned int intc_prio_level[NR_IRQS]; /* for now */ |
65 | #ifdef CONFIG_CPU_SH3 | ||
66 | static unsigned long ack_handle[NR_IRQS]; | ||
67 | #endif | ||
65 | 68 | ||
66 | static inline struct intc_desc_int *get_intc_desc(unsigned int irq) | 69 | static inline struct intc_desc_int *get_intc_desc(unsigned int irq) |
67 | { | 70 | { |
@@ -98,17 +101,26 @@ static void write_32(unsigned long addr, unsigned long h, unsigned long data) | |||
98 | 101 | ||
99 | static void modify_8(unsigned long addr, unsigned long h, unsigned long data) | 102 | static void modify_8(unsigned long addr, unsigned long h, unsigned long data) |
100 | { | 103 | { |
104 | unsigned long flags; | ||
105 | local_irq_save(flags); | ||
101 | ctrl_outb(set_field(ctrl_inb(addr), data, h), addr); | 106 | ctrl_outb(set_field(ctrl_inb(addr), data, h), addr); |
107 | local_irq_restore(flags); | ||
102 | } | 108 | } |
103 | 109 | ||
104 | static void modify_16(unsigned long addr, unsigned long h, unsigned long data) | 110 | static void modify_16(unsigned long addr, unsigned long h, unsigned long data) |
105 | { | 111 | { |
112 | unsigned long flags; | ||
113 | local_irq_save(flags); | ||
106 | ctrl_outw(set_field(ctrl_inw(addr), data, h), addr); | 114 | ctrl_outw(set_field(ctrl_inw(addr), data, h), addr); |
115 | local_irq_restore(flags); | ||
107 | } | 116 | } |
108 | 117 | ||
109 | static void modify_32(unsigned long addr, unsigned long h, unsigned long data) | 118 | static void modify_32(unsigned long addr, unsigned long h, unsigned long data) |
110 | { | 119 | { |
120 | unsigned long flags; | ||
121 | local_irq_save(flags); | ||
111 | ctrl_outl(set_field(ctrl_inl(addr), data, h), addr); | 122 | ctrl_outl(set_field(ctrl_inl(addr), data, h), addr); |
123 | local_irq_restore(flags); | ||
112 | } | 124 | } |
113 | 125 | ||
114 | enum { REG_FN_ERR = 0, REG_FN_WRITE_BASE = 1, REG_FN_MODIFY_BASE = 5 }; | 126 | enum { REG_FN_ERR = 0, REG_FN_WRITE_BASE = 1, REG_FN_MODIFY_BASE = 5 }; |
@@ -219,6 +231,25 @@ static void intc_disable(unsigned int irq) | |||
219 | } | 231 | } |
220 | } | 232 | } |
221 | 233 | ||
234 | #ifdef CONFIG_CPU_SH3 | ||
235 | static void intc_mask_ack(unsigned int irq) | ||
236 | { | ||
237 | struct intc_desc_int *d = get_intc_desc(irq); | ||
238 | unsigned long handle = ack_handle[irq]; | ||
239 | unsigned long addr; | ||
240 | |||
241 | intc_disable(irq); | ||
242 | |||
243 | /* read register and write zero only to the assocaited bit */ | ||
244 | |||
245 | if (handle) { | ||
246 | addr = INTC_REG(d, _INTC_ADDR_D(handle), 0); | ||
247 | ctrl_inb(addr); | ||
248 | ctrl_outb(0x3f ^ set_field(0, 1, handle), addr); | ||
249 | } | ||
250 | } | ||
251 | #endif | ||
252 | |||
222 | static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp, | 253 | static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp, |
223 | unsigned int nr_hp, | 254 | unsigned int nr_hp, |
224 | unsigned int irq) | 255 | unsigned int irq) |
@@ -280,7 +311,12 @@ static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = { | |||
280 | [IRQ_TYPE_EDGE_FALLING] = VALID(0), | 311 | [IRQ_TYPE_EDGE_FALLING] = VALID(0), |
281 | [IRQ_TYPE_EDGE_RISING] = VALID(1), | 312 | [IRQ_TYPE_EDGE_RISING] = VALID(1), |
282 | [IRQ_TYPE_LEVEL_LOW] = VALID(2), | 313 | [IRQ_TYPE_LEVEL_LOW] = VALID(2), |
314 | /* SH7706, SH7707 and SH7709 do not support high level triggered */ | ||
315 | #if !defined(CONFIG_CPU_SUBTYPE_SH7706) && \ | ||
316 | !defined(CONFIG_CPU_SUBTYPE_SH7707) && \ | ||
317 | !defined(CONFIG_CPU_SUBTYPE_SH7709) | ||
283 | [IRQ_TYPE_LEVEL_HIGH] = VALID(3), | 318 | [IRQ_TYPE_LEVEL_HIGH] = VALID(3), |
319 | #endif | ||
284 | }; | 320 | }; |
285 | 321 | ||
286 | static int intc_set_sense(unsigned int irq, unsigned int type) | 322 | static int intc_set_sense(unsigned int irq, unsigned int type) |
@@ -430,6 +466,40 @@ static unsigned int __init intc_prio_data(struct intc_desc *desc, | |||
430 | return 0; | 466 | return 0; |
431 | } | 467 | } |
432 | 468 | ||
469 | #ifdef CONFIG_CPU_SH3 | ||
470 | static unsigned int __init intc_ack_data(struct intc_desc *desc, | ||
471 | struct intc_desc_int *d, | ||
472 | intc_enum enum_id) | ||
473 | { | ||
474 | struct intc_mask_reg *mr = desc->ack_regs; | ||
475 | unsigned int i, j, fn, mode; | ||
476 | unsigned long reg_e, reg_d; | ||
477 | |||
478 | for (i = 0; mr && enum_id && i < desc->nr_ack_regs; i++) { | ||
479 | mr = desc->ack_regs + i; | ||
480 | |||
481 | for (j = 0; j < ARRAY_SIZE(mr->enum_ids); j++) { | ||
482 | if (mr->enum_ids[j] != enum_id) | ||
483 | continue; | ||
484 | |||
485 | fn = REG_FN_MODIFY_BASE; | ||
486 | mode = MODE_ENABLE_REG; | ||
487 | reg_e = mr->set_reg; | ||
488 | reg_d = mr->set_reg; | ||
489 | |||
490 | fn += (mr->reg_width >> 3) - 1; | ||
491 | return _INTC_MK(fn, mode, | ||
492 | intc_get_reg(d, reg_e), | ||
493 | intc_get_reg(d, reg_d), | ||
494 | 1, | ||
495 | (mr->reg_width - 1) - j); | ||
496 | } | ||
497 | } | ||
498 | |||
499 | return 0; | ||
500 | } | ||
501 | #endif | ||
502 | |||
433 | static unsigned int __init intc_sense_data(struct intc_desc *desc, | 503 | static unsigned int __init intc_sense_data(struct intc_desc *desc, |
434 | struct intc_desc_int *d, | 504 | struct intc_desc_int *d, |
435 | intc_enum enum_id) | 505 | intc_enum enum_id) |
@@ -530,6 +600,11 @@ static void __init intc_register_irq(struct intc_desc *desc, | |||
530 | 600 | ||
531 | /* irq should be disabled by default */ | 601 | /* irq should be disabled by default */ |
532 | d->chip.mask(irq); | 602 | d->chip.mask(irq); |
603 | |||
604 | #ifdef CONFIG_CPU_SH3 | ||
605 | if (desc->ack_regs) | ||
606 | ack_handle[irq] = intc_ack_data(desc, d, enum_id); | ||
607 | #endif | ||
533 | } | 608 | } |
534 | 609 | ||
535 | static unsigned int __init save_reg(struct intc_desc_int *d, | 610 | static unsigned int __init save_reg(struct intc_desc_int *d, |
@@ -560,6 +635,9 @@ void __init register_intc_controller(struct intc_desc *desc) | |||
560 | d->nr_reg += desc->prio_regs ? desc->nr_prio_regs * 2 : 0; | 635 | d->nr_reg += desc->prio_regs ? desc->nr_prio_regs * 2 : 0; |
561 | d->nr_reg += desc->sense_regs ? desc->nr_sense_regs : 0; | 636 | d->nr_reg += desc->sense_regs ? desc->nr_sense_regs : 0; |
562 | 637 | ||
638 | #ifdef CONFIG_CPU_SH3 | ||
639 | d->nr_reg += desc->ack_regs ? desc->nr_ack_regs : 0; | ||
640 | #endif | ||
563 | d->reg = alloc_bootmem(d->nr_reg * sizeof(*d->reg)); | 641 | d->reg = alloc_bootmem(d->nr_reg * sizeof(*d->reg)); |
564 | #ifdef CONFIG_SMP | 642 | #ifdef CONFIG_SMP |
565 | d->smp = alloc_bootmem(d->nr_reg * sizeof(*d->smp)); | 643 | d->smp = alloc_bootmem(d->nr_reg * sizeof(*d->smp)); |
@@ -592,14 +670,23 @@ void __init register_intc_controller(struct intc_desc *desc) | |||
592 | } | 670 | } |
593 | } | 671 | } |
594 | 672 | ||
595 | BUG_ON(k > 256); /* _INTC_ADDR_E() and _INTC_ADDR_D() are 8 bits */ | ||
596 | |||
597 | d->chip.name = desc->name; | 673 | d->chip.name = desc->name; |
598 | d->chip.mask = intc_disable; | 674 | d->chip.mask = intc_disable; |
599 | d->chip.unmask = intc_enable; | 675 | d->chip.unmask = intc_enable; |
600 | d->chip.mask_ack = intc_disable; | 676 | d->chip.mask_ack = intc_disable; |
601 | d->chip.set_type = intc_set_sense; | 677 | d->chip.set_type = intc_set_sense; |
602 | 678 | ||
679 | #ifdef CONFIG_CPU_SH3 | ||
680 | if (desc->ack_regs) { | ||
681 | for (i = 0; i < desc->nr_ack_regs; i++) | ||
682 | k += save_reg(d, k, desc->ack_regs[i].set_reg, 0); | ||
683 | |||
684 | d->chip.mask_ack = intc_mask_ack; | ||
685 | } | ||
686 | #endif | ||
687 | |||
688 | BUG_ON(k > 256); /* _INTC_ADDR_E() and _INTC_ADDR_D() are 8 bits */ | ||
689 | |||
603 | for (i = 0; i < desc->nr_vectors; i++) { | 690 | for (i = 0; i < desc->nr_vectors; i++) { |
604 | struct intc_vect *vect = desc->vectors + i; | 691 | struct intc_vect *vect = desc->vectors + i; |
605 | 692 | ||
diff --git a/arch/sh/kernel/cpu/sh2a/fpu.c b/arch/sh/kernel/cpu/sh2a/fpu.c index 5627c0b3ffa..6df2fb98eb3 100644 --- a/arch/sh/kernel/cpu/sh2a/fpu.c +++ b/arch/sh/kernel/cpu/sh2a/fpu.c | |||
@@ -300,7 +300,7 @@ static int denormal_addf(int hx, int hy) | |||
300 | iy = hy & 0x7fffffff; | 300 | iy = hy & 0x7fffffff; |
301 | if (iy < 0x00800000) { | 301 | if (iy < 0x00800000) { |
302 | ix = denormal_subf1(ix, iy); | 302 | ix = denormal_subf1(ix, iy); |
303 | if (ix < 0) { | 303 | if ((int) ix < 0) { |
304 | ix = -ix; | 304 | ix = -ix; |
305 | sign ^= 0x80000000; | 305 | sign ^= 0x80000000; |
306 | } | 306 | } |
@@ -385,7 +385,7 @@ static long long denormal_addd(long long hx, long long hy) | |||
385 | iy = hy & 0x7fffffffffffffffLL; | 385 | iy = hy & 0x7fffffffffffffffLL; |
386 | if (iy < 0x0010000000000000LL) { | 386 | if (iy < 0x0010000000000000LL) { |
387 | ix = denormal_subd1(ix, iy); | 387 | ix = denormal_subd1(ix, iy); |
388 | if (ix < 0) { | 388 | if ((int) ix < 0) { |
389 | ix = -ix; | 389 | ix = -ix; |
390 | sign ^= 0x8000000000000000LL; | 390 | sign ^= 0x8000000000000000LL; |
391 | } | 391 | } |
diff --git a/arch/sh/kernel/cpu/sh3/Makefile b/arch/sh/kernel/cpu/sh3/Makefile index 3ae4d9111f1..511de55af83 100644 --- a/arch/sh/kernel/cpu/sh3/Makefile +++ b/arch/sh/kernel/cpu/sh3/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the Linux/SuperH SH-3 backends. | 2 | # Makefile for the Linux/SuperH SH-3 backends. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := ex.o probe.o entry.o | 5 | obj-y := ex.o probe.o entry.o setup-sh3.o |
6 | 6 | ||
7 | # CPU subtype setup | 7 | # CPU subtype setup |
8 | obj-$(CONFIG_CPU_SUBTYPE_SH7705) += setup-sh7705.o | 8 | obj-$(CONFIG_CPU_SUBTYPE_SH7705) += setup-sh7705.o |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh3.c b/arch/sh/kernel/cpu/sh3/setup-sh3.c new file mode 100644 index 00000000000..c9884685785 --- /dev/null +++ b/arch/sh/kernel/cpu/sh3/setup-sh3.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Shared SH3 Setup code | ||
3 | * | ||
4 | * Copyright (C) 2008 Magnus Damm | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/init.h> | ||
12 | #include <linux/irq.h> | ||
13 | #include <linux/io.h> | ||
14 | |||
15 | /* All SH3 devices are equipped with IRQ0->5 (except sh7708) */ | ||
16 | |||
17 | enum { | ||
18 | UNUSED = 0, | ||
19 | |||
20 | /* interrupt sources */ | ||
21 | IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, | ||
22 | }; | ||
23 | |||
24 | static struct intc_vect vectors_irq0123[] __initdata = { | ||
25 | INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620), | ||
26 | INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660), | ||
27 | }; | ||
28 | |||
29 | static struct intc_vect vectors_irq45[] __initdata = { | ||
30 | INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0), | ||
31 | }; | ||
32 | |||
33 | static struct intc_prio_reg prio_registers[] __initdata = { | ||
34 | { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } }, | ||
35 | { 0xa4000018, 0, 16, 4, /* IPRD */ { 0, 0, IRQ5, IRQ4 } }, | ||
36 | }; | ||
37 | |||
38 | static struct intc_mask_reg ack_registers[] __initdata = { | ||
39 | { 0xa4000004, 0, 8, /* IRR0 */ | ||
40 | { 0, 0, IRQ5, IRQ4, IRQ3, IRQ2, IRQ1, IRQ0 } }, | ||
41 | }; | ||
42 | |||
43 | static struct intc_sense_reg sense_registers[] __initdata = { | ||
44 | { 0xa4000010, 16, 2, { 0, 0, IRQ5, IRQ4, IRQ3, IRQ2, IRQ1, IRQ0 } }, | ||
45 | }; | ||
46 | |||
47 | static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh3-irq0123", | ||
48 | vectors_irq0123, NULL, NULL, | ||
49 | prio_registers, sense_registers, ack_registers); | ||
50 | |||
51 | static DECLARE_INTC_DESC_ACK(intc_desc_irq45, "sh3-irq45", | ||
52 | vectors_irq45, NULL, NULL, | ||
53 | prio_registers, sense_registers, ack_registers); | ||
54 | |||
55 | #define INTC_ICR1 0xa4000010UL | ||
56 | #define INTC_ICR1_IRQLVL (1<<14) | ||
57 | |||
58 | void __init plat_irq_setup_pins(int mode) | ||
59 | { | ||
60 | if (mode == IRQ_MODE_IRQ) { | ||
61 | ctrl_outw(ctrl_inw(INTC_ICR1) & ~INTC_ICR1_IRQLVL, INTC_ICR1); | ||
62 | register_intc_controller(&intc_desc_irq0123); | ||
63 | return; | ||
64 | } | ||
65 | BUG(); | ||
66 | } | ||
67 | |||
68 | void __init plat_irq_setup_sh3(void) | ||
69 | { | ||
70 | register_intc_controller(&intc_desc_irq45); | ||
71 | } | ||
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c index f581534cb73..6468ae86b94 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c | |||
@@ -37,7 +37,7 @@ enum { | |||
37 | }; | 37 | }; |
38 | 38 | ||
39 | static struct intc_vect vectors[] __initdata = { | 39 | static struct intc_vect vectors[] __initdata = { |
40 | INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0), | 40 | /* IRQ0->5 are handled in setup-sh3.c */ |
41 | INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720), | 41 | INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720), |
42 | INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820), | 42 | INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820), |
43 | INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860), | 43 | INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860), |
@@ -48,7 +48,7 @@ static struct intc_vect vectors[] __initdata = { | |||
48 | INTC_VECT(ADC_ADI, 0x980), | 48 | INTC_VECT(ADC_ADI, 0x980), |
49 | INTC_VECT(USB_USI0, 0xa20), INTC_VECT(USB_USI1, 0xa40), | 49 | INTC_VECT(USB_USI0, 0xa20), INTC_VECT(USB_USI1, 0xa40), |
50 | INTC_VECT(TPU0, 0xc00), INTC_VECT(TPU1, 0xc20), | 50 | INTC_VECT(TPU0, 0xc00), INTC_VECT(TPU1, 0xc20), |
51 | INTC_VECT(TPU3, 0xc80), INTC_VECT(TPU1, 0xca0), | 51 | INTC_VECT(TPU2, 0xc80), INTC_VECT(TPU3, 0xca0), |
52 | INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420), | 52 | INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420), |
53 | INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460), | 53 | INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460), |
54 | INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0), | 54 | INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0), |
@@ -81,14 +81,6 @@ static struct intc_prio_reg prio_registers[] __initdata = { | |||
81 | static DECLARE_INTC_DESC(intc_desc, "sh7705", vectors, groups, | 81 | static DECLARE_INTC_DESC(intc_desc, "sh7705", vectors, groups, |
82 | NULL, prio_registers, NULL); | 82 | NULL, prio_registers, NULL); |
83 | 83 | ||
84 | static struct intc_vect vectors_irq[] __initdata = { | ||
85 | INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620), | ||
86 | INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660), | ||
87 | }; | ||
88 | |||
89 | static DECLARE_INTC_DESC(intc_desc_irq, "sh7705-irq", vectors_irq, NULL, | ||
90 | NULL, prio_registers, NULL); | ||
91 | |||
92 | static struct plat_sci_port sci_platform_data[] = { | 84 | static struct plat_sci_port sci_platform_data[] = { |
93 | { | 85 | { |
94 | .mapbase = 0xa4410000, | 86 | .mapbase = 0xa4410000, |
@@ -159,16 +151,8 @@ static int __init sh7705_devices_setup(void) | |||
159 | } | 151 | } |
160 | __initcall(sh7705_devices_setup); | 152 | __initcall(sh7705_devices_setup); |
161 | 153 | ||
162 | void __init plat_irq_setup_pins(int mode) | ||
163 | { | ||
164 | if (mode == IRQ_MODE_IRQ) { | ||
165 | register_intc_controller(&intc_desc_irq); | ||
166 | return; | ||
167 | } | ||
168 | BUG(); | ||
169 | } | ||
170 | |||
171 | void __init plat_irq_setup(void) | 154 | void __init plat_irq_setup(void) |
172 | { | 155 | { |
173 | register_intc_controller(&intc_desc); | 156 | register_intc_controller(&intc_desc); |
157 | plat_irq_setup_sh3(); | ||
174 | } | 158 | } |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c index d3733b13ea5..93c55e2ed95 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c | |||
@@ -52,7 +52,7 @@ static struct intc_vect vectors[] __initdata = { | |||
52 | #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \ | 52 | #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \ |
53 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ | 53 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ |
54 | defined(CONFIG_CPU_SUBTYPE_SH7709) | 54 | defined(CONFIG_CPU_SUBTYPE_SH7709) |
55 | INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0), | 55 | /* IRQ0->5 are handled in setup-sh3.c */ |
56 | INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820), | 56 | INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820), |
57 | INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860), | 57 | INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860), |
58 | INTC_VECT(ADC_ADI, 0x980), | 58 | INTC_VECT(ADC_ADI, 0x980), |
@@ -104,18 +104,6 @@ static struct intc_prio_reg prio_registers[] __initdata = { | |||
104 | static DECLARE_INTC_DESC(intc_desc, "sh770x", vectors, groups, | 104 | static DECLARE_INTC_DESC(intc_desc, "sh770x", vectors, groups, |
105 | NULL, prio_registers, NULL); | 105 | NULL, prio_registers, NULL); |
106 | 106 | ||
107 | #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \ | ||
108 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ | ||
109 | defined(CONFIG_CPU_SUBTYPE_SH7709) | ||
110 | static struct intc_vect vectors_irq[] __initdata = { | ||
111 | INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620), | ||
112 | INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660), | ||
113 | }; | ||
114 | |||
115 | static DECLARE_INTC_DESC(intc_desc_irq, "sh770x-irq", vectors_irq, NULL, | ||
116 | NULL, prio_registers, NULL); | ||
117 | #endif | ||
118 | |||
119 | static struct resource rtc_resources[] = { | 107 | static struct resource rtc_resources[] = { |
120 | [0] = { | 108 | [0] = { |
121 | .start = 0xfffffec0, | 109 | .start = 0xfffffec0, |
@@ -194,24 +182,12 @@ static int __init sh770x_devices_setup(void) | |||
194 | } | 182 | } |
195 | __initcall(sh770x_devices_setup); | 183 | __initcall(sh770x_devices_setup); |
196 | 184 | ||
197 | #define INTC_ICR1 0xa4000010UL | 185 | void __init plat_irq_setup(void) |
198 | #define INTC_ICR1_IRQLVL (1<<14) | ||
199 | |||
200 | void __init plat_irq_setup_pins(int mode) | ||
201 | { | 186 | { |
202 | if (mode == IRQ_MODE_IRQ) { | 187 | register_intc_controller(&intc_desc); |
203 | #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \ | 188 | #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \ |
204 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ | 189 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ |
205 | defined(CONFIG_CPU_SUBTYPE_SH7709) | 190 | defined(CONFIG_CPU_SUBTYPE_SH7709) |
206 | ctrl_outw(ctrl_inw(INTC_ICR1) & ~INTC_ICR1_IRQLVL, INTC_ICR1); | 191 | plat_irq_setup_sh3(); |
207 | register_intc_controller(&intc_desc_irq); | ||
208 | return; | ||
209 | #endif | 192 | #endif |
210 | } | ||
211 | BUG(); | ||
212 | } | ||
213 | |||
214 | void __init plat_irq_setup(void) | ||
215 | { | ||
216 | register_intc_controller(&intc_desc); | ||
217 | } | 193 | } |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7710.c b/arch/sh/kernel/cpu/sh3/setup-sh7710.c index 7406c9ad925..77eee481de4 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7710.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7710.c | |||
@@ -38,7 +38,7 @@ enum { | |||
38 | }; | 38 | }; |
39 | 39 | ||
40 | static struct intc_vect vectors[] __initdata = { | 40 | static struct intc_vect vectors[] __initdata = { |
41 | INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0), | 41 | /* IRQ0->5 are handled in setup-sh3.c */ |
42 | INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820), | 42 | INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820), |
43 | INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860), | 43 | INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860), |
44 | INTC_VECT(SCIF0_ERI, 0x880), INTC_VECT(SCIF0_RXI, 0x8a0), | 44 | INTC_VECT(SCIF0_ERI, 0x880), INTC_VECT(SCIF0_RXI, 0x8a0), |
@@ -79,10 +79,7 @@ static struct intc_prio_reg prio_registers[] __initdata = { | |||
79 | { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } }, | 79 | { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } }, |
80 | { 0xa4000018, 0, 16, 4, /* IPRD */ { 0, 0, IRQ5, IRQ4 } }, | 80 | { 0xa4000018, 0, 16, 4, /* IPRD */ { 0, 0, IRQ5, IRQ4 } }, |
81 | { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC1, SCIF0, SCIF1 } }, | 81 | { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC1, SCIF0, SCIF1 } }, |
82 | { 0xa4080000, 0, 16, 4, /* IPRF */ { 0, DMAC2 } }, | 82 | { 0xa4080000, 0, 16, 4, /* IPRF */ { IPSEC, DMAC2 } }, |
83 | #ifdef CONFIG_CPU_SUBTYPE_SH7710 | ||
84 | { 0xa4080000, 0, 16, 4, /* IPRF */ { IPSEC } }, | ||
85 | #endif | ||
86 | { 0xa4080002, 0, 16, 4, /* IPRG */ { EDMAC0, EDMAC1, EDMAC2 } }, | 83 | { 0xa4080002, 0, 16, 4, /* IPRG */ { EDMAC0, EDMAC1, EDMAC2 } }, |
87 | { 0xa4080004, 0, 16, 4, /* IPRH */ { 0, 0, 0, SIOF0 } }, | 84 | { 0xa4080004, 0, 16, 4, /* IPRH */ { 0, 0, 0, SIOF0 } }, |
88 | { 0xa4080006, 0, 16, 4, /* IPRI */ { 0, 0, SIOF1 } }, | 85 | { 0xa4080006, 0, 16, 4, /* IPRI */ { 0, 0, SIOF1 } }, |
@@ -91,14 +88,6 @@ static struct intc_prio_reg prio_registers[] __initdata = { | |||
91 | static DECLARE_INTC_DESC(intc_desc, "sh7710", vectors, groups, | 88 | static DECLARE_INTC_DESC(intc_desc, "sh7710", vectors, groups, |
92 | NULL, prio_registers, NULL); | 89 | NULL, prio_registers, NULL); |
93 | 90 | ||
94 | static struct intc_vect vectors_irq[] __initdata = { | ||
95 | INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620), | ||
96 | INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660), | ||
97 | }; | ||
98 | |||
99 | static DECLARE_INTC_DESC(intc_desc_irq, "sh7710-irq", vectors_irq, NULL, | ||
100 | NULL, prio_registers, NULL); | ||
101 | |||
102 | static struct resource rtc_resources[] = { | 91 | static struct resource rtc_resources[] = { |
103 | [0] = { | 92 | [0] = { |
104 | .start = 0xa413fec0, | 93 | .start = 0xa413fec0, |
@@ -170,16 +159,8 @@ static int __init sh7710_devices_setup(void) | |||
170 | } | 159 | } |
171 | __initcall(sh7710_devices_setup); | 160 | __initcall(sh7710_devices_setup); |
172 | 161 | ||
173 | void __init plat_irq_setup_pins(int mode) | ||
174 | { | ||
175 | if (mode == IRQ_MODE_IRQ) { | ||
176 | register_intc_controller(&intc_desc_irq); | ||
177 | return; | ||
178 | } | ||
179 | BUG(); | ||
180 | } | ||
181 | |||
182 | void __init plat_irq_setup(void) | 162 | void __init plat_irq_setup(void) |
183 | { | 163 | { |
184 | register_intc_controller(&intc_desc); | 164 | register_intc_controller(&intc_desc); |
165 | plat_irq_setup_sh3(); | ||
185 | } | 166 | } |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c index 8028082527c..f807a21b066 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c | |||
@@ -19,10 +19,6 @@ | |||
19 | #include <linux/serial_sci.h> | 19 | #include <linux/serial_sci.h> |
20 | #include <asm/rtc.h> | 20 | #include <asm/rtc.h> |
21 | 21 | ||
22 | #define INTC_ICR1 0xA4140010UL | ||
23 | #define INTC_ICR_IRLM 0x4000 | ||
24 | #define INTC_ICR_IRQ (~INTC_ICR_IRLM) | ||
25 | |||
26 | static struct resource rtc_resources[] = { | 22 | static struct resource rtc_resources[] = { |
27 | [0] = { | 23 | [0] = { |
28 | .start = 0xa413fec0, | 24 | .start = 0xa413fec0, |
@@ -170,6 +166,7 @@ enum { | |||
170 | }; | 166 | }; |
171 | 167 | ||
172 | static struct intc_vect vectors[] __initdata = { | 168 | static struct intc_vect vectors[] __initdata = { |
169 | /* IRQ0->5 are handled in setup-sh3.c */ | ||
173 | INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420), | 170 | INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420), |
174 | INTC_VECT(TMU2, 0x440), INTC_VECT(RTC_ATI, 0x480), | 171 | INTC_VECT(TMU2, 0x440), INTC_VECT(RTC_ATI, 0x480), |
175 | INTC_VECT(RTC_PRI, 0x4a0), INTC_VECT(RTC_CUI, 0x4c0), | 172 | INTC_VECT(RTC_PRI, 0x4a0), INTC_VECT(RTC_CUI, 0x4c0), |
@@ -214,11 +211,7 @@ static struct intc_prio_reg prio_registers[] __initdata = { | |||
214 | { 0xA414FEE4UL, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, SIM, 0 } }, | 211 | { 0xA414FEE4UL, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, SIM, 0 } }, |
215 | { 0xA4140016UL, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } }, | 212 | { 0xA4140016UL, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } }, |
216 | { 0xA4140018UL, 0, 16, 4, /* IPRD */ { USBF_SPD, TMU_SUNI, IRQ5, IRQ4 } }, | 213 | { 0xA4140018UL, 0, 16, 4, /* IPRD */ { USBF_SPD, TMU_SUNI, IRQ5, IRQ4 } }, |
217 | #if defined(CONFIG_CPU_SUBTYPE_SH7720) | ||
218 | { 0xA414001AUL, 0, 16, 4, /* IPRE */ { DMAC1, 0, LCDC, SSL } }, | 214 | { 0xA414001AUL, 0, 16, 4, /* IPRE */ { DMAC1, 0, LCDC, SSL } }, |
219 | #else | ||
220 | { 0xA414001AUL, 0, 16, 4, /* IPRE */ { DMAC1, 0, LCDC, 0 } }, | ||
221 | #endif | ||
222 | { 0xA4080000UL, 0, 16, 4, /* IPRF */ { ADC, DMAC2, USBFI, CMT } }, | 215 | { 0xA4080000UL, 0, 16, 4, /* IPRF */ { ADC, DMAC2, USBFI, CMT } }, |
223 | { 0xA4080002UL, 0, 16, 4, /* IPRG */ { SCIF0, SCIF1, 0, 0 } }, | 216 | { 0xA4080002UL, 0, 16, 4, /* IPRG */ { SCIF0, SCIF1, 0, 0 } }, |
224 | { 0xA4080004UL, 0, 16, 4, /* IPRH */ { PINT07, PINT815, TPU, IIC } }, | 217 | { 0xA4080004UL, 0, 16, 4, /* IPRH */ { PINT07, PINT815, TPU, IIC } }, |
@@ -229,32 +222,8 @@ static struct intc_prio_reg prio_registers[] __initdata = { | |||
229 | static DECLARE_INTC_DESC(intc_desc, "sh7720", vectors, groups, | 222 | static DECLARE_INTC_DESC(intc_desc, "sh7720", vectors, groups, |
230 | NULL, prio_registers, NULL); | 223 | NULL, prio_registers, NULL); |
231 | 224 | ||
232 | static struct intc_sense_reg sense_registers[] __initdata = { | ||
233 | { INTC_ICR1, 16, 2, { 0, 0, IRQ5, IRQ4, IRQ3, IRQ2, IRQ1, IRQ0 } }, | ||
234 | }; | ||
235 | |||
236 | static struct intc_vect vectors_irq[] __initdata = { | ||
237 | INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620), | ||
238 | INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660), | ||
239 | INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0), | ||
240 | }; | ||
241 | |||
242 | static DECLARE_INTC_DESC(intc_irq_desc, "sh7720-irq", vectors_irq, | ||
243 | NULL, NULL, prio_registers, sense_registers); | ||
244 | |||
245 | void __init plat_irq_setup_pins(int mode) | ||
246 | { | ||
247 | switch (mode) { | ||
248 | case IRQ_MODE_IRQ: | ||
249 | ctrl_outw(ctrl_inw(INTC_ICR1) & INTC_ICR_IRQ, INTC_ICR1); | ||
250 | register_intc_controller(&intc_irq_desc); | ||
251 | break; | ||
252 | default: | ||
253 | BUG(); | ||
254 | } | ||
255 | } | ||
256 | |||
257 | void __init plat_irq_setup(void) | 225 | void __init plat_irq_setup(void) |
258 | { | 226 | { |
259 | register_intc_controller(&intc_desc); | 227 | register_intc_controller(&intc_desc); |
228 | plat_irq_setup_sh3(); | ||
260 | } | 229 | } |
diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S index ba8750176d9..05372ed6c56 100644 --- a/arch/sh/kernel/cpu/sh5/entry.S +++ b/arch/sh/kernel/cpu/sh5/entry.S | |||
@@ -143,12 +143,22 @@ resvec_save_area: | |||
143 | trap_jtable: | 143 | trap_jtable: |
144 | .long do_exception_error /* 0x000 */ | 144 | .long do_exception_error /* 0x000 */ |
145 | .long do_exception_error /* 0x020 */ | 145 | .long do_exception_error /* 0x020 */ |
146 | #ifdef CONFIG_MMU | ||
146 | .long tlb_miss_load /* 0x040 */ | 147 | .long tlb_miss_load /* 0x040 */ |
147 | .long tlb_miss_store /* 0x060 */ | 148 | .long tlb_miss_store /* 0x060 */ |
149 | #else | ||
150 | .long do_exception_error | ||
151 | .long do_exception_error | ||
152 | #endif | ||
148 | ! ARTIFICIAL pseudo-EXPEVT setting | 153 | ! ARTIFICIAL pseudo-EXPEVT setting |
149 | .long do_debug_interrupt /* 0x080 */ | 154 | .long do_debug_interrupt /* 0x080 */ |
155 | #ifdef CONFIG_MMU | ||
150 | .long tlb_miss_load /* 0x0A0 */ | 156 | .long tlb_miss_load /* 0x0A0 */ |
151 | .long tlb_miss_store /* 0x0C0 */ | 157 | .long tlb_miss_store /* 0x0C0 */ |
158 | #else | ||
159 | .long do_exception_error | ||
160 | .long do_exception_error | ||
161 | #endif | ||
152 | .long do_address_error_load /* 0x0E0 */ | 162 | .long do_address_error_load /* 0x0E0 */ |
153 | .long do_address_error_store /* 0x100 */ | 163 | .long do_address_error_store /* 0x100 */ |
154 | #ifdef CONFIG_SH_FPU | 164 | #ifdef CONFIG_SH_FPU |
@@ -185,10 +195,18 @@ trap_jtable: | |||
185 | .endr | 195 | .endr |
186 | .long do_IRQ /* 0xA00 */ | 196 | .long do_IRQ /* 0xA00 */ |
187 | .long do_IRQ /* 0xA20 */ | 197 | .long do_IRQ /* 0xA20 */ |
198 | #ifdef CONFIG_MMU | ||
188 | .long itlb_miss_or_IRQ /* 0xA40 */ | 199 | .long itlb_miss_or_IRQ /* 0xA40 */ |
200 | #else | ||
201 | .long do_IRQ | ||
202 | #endif | ||
189 | .long do_IRQ /* 0xA60 */ | 203 | .long do_IRQ /* 0xA60 */ |
190 | .long do_IRQ /* 0xA80 */ | 204 | .long do_IRQ /* 0xA80 */ |
205 | #ifdef CONFIG_MMU | ||
191 | .long itlb_miss_or_IRQ /* 0xAA0 */ | 206 | .long itlb_miss_or_IRQ /* 0xAA0 */ |
207 | #else | ||
208 | .long do_IRQ | ||
209 | #endif | ||
192 | .long do_exception_error /* 0xAC0 */ | 210 | .long do_exception_error /* 0xAC0 */ |
193 | .long do_address_error_exec /* 0xAE0 */ | 211 | .long do_address_error_exec /* 0xAE0 */ |
194 | .rept 8 | 212 | .rept 8 |
@@ -274,6 +292,7 @@ not_a_tlb_miss: | |||
274 | * Instead of '.space 1024-TEXT_SIZE' place the RESVEC | 292 | * Instead of '.space 1024-TEXT_SIZE' place the RESVEC |
275 | * block making sure the final alignment is correct. | 293 | * block making sure the final alignment is correct. |
276 | */ | 294 | */ |
295 | #ifdef CONFIG_MMU | ||
277 | tlb_miss: | 296 | tlb_miss: |
278 | synco /* TAKum03020 (but probably a good idea anyway.) */ | 297 | synco /* TAKum03020 (but probably a good idea anyway.) */ |
279 | putcon SP, KCR1 | 298 | putcon SP, KCR1 |
@@ -377,6 +396,9 @@ fixup_to_invoke_general_handler: | |||
377 | getcon KCR1, SP | 396 | getcon KCR1, SP |
378 | pta handle_exception, tr0 | 397 | pta handle_exception, tr0 |
379 | blink tr0, ZERO | 398 | blink tr0, ZERO |
399 | #else /* CONFIG_MMU */ | ||
400 | .balign 256 | ||
401 | #endif | ||
380 | 402 | ||
381 | /* NB TAKE GREAT CARE HERE TO ENSURE THAT THE INTERRUPT CODE | 403 | /* NB TAKE GREAT CARE HERE TO ENSURE THAT THE INTERRUPT CODE |
382 | DOES END UP AT VBR+0x600 */ | 404 | DOES END UP AT VBR+0x600 */ |
@@ -1103,6 +1125,7 @@ restore_all: | |||
1103 | * fpu_error_or_IRQ? is a helper to deflect to the right cause. | 1125 | * fpu_error_or_IRQ? is a helper to deflect to the right cause. |
1104 | * | 1126 | * |
1105 | */ | 1127 | */ |
1128 | #ifdef CONFIG_MMU | ||
1106 | tlb_miss_load: | 1129 | tlb_miss_load: |
1107 | or SP, ZERO, r2 | 1130 | or SP, ZERO, r2 |
1108 | or ZERO, ZERO, r3 /* Read */ | 1131 | or ZERO, ZERO, r3 /* Read */ |
@@ -1132,6 +1155,7 @@ call_do_page_fault: | |||
1132 | movi do_page_fault, r6 | 1155 | movi do_page_fault, r6 |
1133 | ptabs r6, tr0 | 1156 | ptabs r6, tr0 |
1134 | blink tr0, ZERO | 1157 | blink tr0, ZERO |
1158 | #endif /* CONFIG_MMU */ | ||
1135 | 1159 | ||
1136 | fpu_error_or_IRQA: | 1160 | fpu_error_or_IRQA: |
1137 | pta its_IRQ, tr0 | 1161 | pta its_IRQ, tr0 |
@@ -1481,6 +1505,7 @@ poke_real_address_q: | |||
1481 | ptabs LINK, tr0 | 1505 | ptabs LINK, tr0 |
1482 | blink tr0, r63 | 1506 | blink tr0, r63 |
1483 | 1507 | ||
1508 | #ifdef CONFIG_MMU | ||
1484 | /* | 1509 | /* |
1485 | * --- User Access Handling Section | 1510 | * --- User Access Handling Section |
1486 | */ | 1511 | */ |
@@ -1604,6 +1629,7 @@ ___clear_user_exit: | |||
1604 | ptabs LINK, tr0 | 1629 | ptabs LINK, tr0 |
1605 | blink tr0, ZERO | 1630 | blink tr0, ZERO |
1606 | 1631 | ||
1632 | #endif /* CONFIG_MMU */ | ||
1607 | 1633 | ||
1608 | /* | 1634 | /* |
1609 | * int __strncpy_from_user(unsigned long __dest, unsigned long __src, | 1635 | * int __strncpy_from_user(unsigned long __dest, unsigned long __src, |
@@ -2014,9 +2040,11 @@ sa_default_restorer: | |||
2014 | .global asm_uaccess_start /* Just a marker */ | 2040 | .global asm_uaccess_start /* Just a marker */ |
2015 | asm_uaccess_start: | 2041 | asm_uaccess_start: |
2016 | 2042 | ||
2043 | #ifdef CONFIG_MMU | ||
2017 | .long ___copy_user1, ___copy_user_exit | 2044 | .long ___copy_user1, ___copy_user_exit |
2018 | .long ___copy_user2, ___copy_user_exit | 2045 | .long ___copy_user2, ___copy_user_exit |
2019 | .long ___clear_user1, ___clear_user_exit | 2046 | .long ___clear_user1, ___clear_user_exit |
2047 | #endif | ||
2020 | .long ___strncpy_from_user1, ___strncpy_from_user_exit | 2048 | .long ___strncpy_from_user1, ___strncpy_from_user_exit |
2021 | .long ___strnlen_user1, ___strnlen_user_exit | 2049 | .long ___strnlen_user1, ___strnlen_user_exit |
2022 | .long ___get_user_asm_b1, ___get_user_asm_b_exit | 2050 | .long ___get_user_asm_b1, ___get_user_asm_b_exit |
diff --git a/arch/sh/kernel/cpu/sh5/probe.c b/arch/sh/kernel/cpu/sh5/probe.c index 31f8cb0f637..92ad844b5c1 100644 --- a/arch/sh/kernel/cpu/sh5/probe.c +++ b/arch/sh/kernel/cpu/sh5/probe.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/string.h> | 15 | #include <linux/string.h> |
16 | #include <asm/processor.h> | 16 | #include <asm/processor.h> |
17 | #include <asm/cache.h> | 17 | #include <asm/cache.h> |
18 | #include <asm/tlb.h> | ||
18 | 19 | ||
19 | int __init detect_cpu_and_cache_system(void) | 20 | int __init detect_cpu_and_cache_system(void) |
20 | { | 21 | { |
@@ -67,5 +68,8 @@ int __init detect_cpu_and_cache_system(void) | |||
67 | set_bit(SH_CACHE_MODE_WB, &(boot_cpu_data.dcache.flags)); | 68 | set_bit(SH_CACHE_MODE_WB, &(boot_cpu_data.dcache.flags)); |
68 | #endif | 69 | #endif |
69 | 70 | ||
71 | /* Setup some I/D TLB defaults */ | ||
72 | sh64_tlb_init(); | ||
73 | |||
70 | return 0; | 74 | return 0; |
71 | } | 75 | } |
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c index 957f2561154..6b7d166694e 100644 --- a/arch/sh/kernel/early_printk.c +++ b/arch/sh/kernel/early_printk.c | |||
@@ -141,7 +141,9 @@ static void scif_sercon_init(char *s) | |||
141 | */ | 141 | */ |
142 | static void scif_sercon_init(char *s) | 142 | static void scif_sercon_init(char *s) |
143 | { | 143 | { |
144 | struct uart_port *port = &scif_port; | ||
144 | unsigned baud = DEFAULT_BAUD; | 145 | unsigned baud = DEFAULT_BAUD; |
146 | unsigned int status; | ||
145 | char *e; | 147 | char *e; |
146 | 148 | ||
147 | if (*s == ',') | 149 | if (*s == ',') |
@@ -160,19 +162,25 @@ static void scif_sercon_init(char *s) | |||
160 | baud = DEFAULT_BAUD; | 162 | baud = DEFAULT_BAUD; |
161 | } | 163 | } |
162 | 164 | ||
163 | ctrl_outw(0, scif_port.mapbase + 8); | 165 | do { |
164 | ctrl_outw(0, scif_port.mapbase); | 166 | status = sci_in(port, SCxSR); |
167 | } while (!(status & SCxSR_TEND(port))); | ||
168 | |||
169 | sci_out(port, SCSCR, 0); /* TE=0, RE=0 */ | ||
170 | sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); | ||
171 | sci_out(port, SCSMR, 0); | ||
165 | 172 | ||
166 | /* Set baud rate */ | 173 | /* Set baud rate */ |
167 | ctrl_outb((CONFIG_SH_PCLK_FREQ + 16 * baud) / | 174 | sci_out(port, SCBRR, (CONFIG_SH_PCLK_FREQ + 16 * baud) / |
168 | (32 * baud) - 1, scif_port.mapbase + 4); | 175 | (32 * baud) - 1); |
169 | 176 | udelay((1000000+(baud-1)) / baud); /* Wait one bit interval */ | |
170 | ctrl_outw(12, scif_port.mapbase + 24); | 177 | |
171 | ctrl_outw(8, scif_port.mapbase + 24); | 178 | sci_out(port, SCSPTR, 0); |
172 | ctrl_outw(0, scif_port.mapbase + 32); | 179 | sci_out(port, SCxSR, 0x60); |
173 | ctrl_outw(0x60, scif_port.mapbase + 16); | 180 | sci_out(port, SCLSR, 0); |
174 | ctrl_outw(0, scif_port.mapbase + 36); | 181 | |
175 | ctrl_outw(0x30, scif_port.mapbase + 8); | 182 | sci_out(port, SCFCR, 0); |
183 | sci_out(port, SCSCR, 0x30); /* TE=1, RE=1 */ | ||
176 | } | 184 | } |
177 | #endif /* defined(CONFIG_CPU_SUBTYPE_SH7720) */ | 185 | #endif /* defined(CONFIG_CPU_SUBTYPE_SH7720) */ |
178 | #endif /* !defined(CONFIG_SH_STANDARD_BIOS) */ | 186 | #endif /* !defined(CONFIG_SH_STANDARD_BIOS) */ |
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index 284f66f1ebb..516bde9c50f 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
@@ -53,6 +53,7 @@ EXPORT_SYMBOL(cpu_data); | |||
53 | * sh_mv= on the command line, prior to .machvec.init teardown. | 53 | * sh_mv= on the command line, prior to .machvec.init teardown. |
54 | */ | 54 | */ |
55 | struct sh_machine_vector sh_mv = { .mv_name = "generic", }; | 55 | struct sh_machine_vector sh_mv = { .mv_name = "generic", }; |
56 | EXPORT_SYMBOL(sh_mv); | ||
56 | 57 | ||
57 | #ifdef CONFIG_VT | 58 | #ifdef CONFIG_VT |
58 | struct screen_info screen_info; | 59 | struct screen_info screen_info; |
@@ -76,11 +77,18 @@ static struct resource data_resource = { | |||
76 | .flags = IORESOURCE_BUSY | IORESOURCE_MEM, | 77 | .flags = IORESOURCE_BUSY | IORESOURCE_MEM, |
77 | }; | 78 | }; |
78 | 79 | ||
80 | static struct resource bss_resource = { | ||
81 | .name = "Kernel bss", | ||
82 | .flags = IORESOURCE_BUSY | IORESOURCE_MEM, | ||
83 | }; | ||
84 | |||
79 | unsigned long memory_start; | 85 | unsigned long memory_start; |
80 | EXPORT_SYMBOL(memory_start); | 86 | EXPORT_SYMBOL(memory_start); |
81 | unsigned long memory_end = 0; | 87 | unsigned long memory_end = 0; |
82 | EXPORT_SYMBOL(memory_end); | 88 | EXPORT_SYMBOL(memory_end); |
83 | 89 | ||
90 | static struct resource mem_resources[MAX_NUMNODES]; | ||
91 | |||
84 | int l1i_cache_shape, l1d_cache_shape, l2_cache_shape; | 92 | int l1i_cache_shape, l1d_cache_shape, l2_cache_shape; |
85 | 93 | ||
86 | static int __init early_parse_mem(char *p) | 94 | static int __init early_parse_mem(char *p) |
@@ -169,6 +177,40 @@ static inline void __init reserve_crashkernel(void) | |||
169 | {} | 177 | {} |
170 | #endif | 178 | #endif |
171 | 179 | ||
180 | void __init __add_active_range(unsigned int nid, unsigned long start_pfn, | ||
181 | unsigned long end_pfn) | ||
182 | { | ||
183 | struct resource *res = &mem_resources[nid]; | ||
184 | |||
185 | WARN_ON(res->name); /* max one active range per node for now */ | ||
186 | |||
187 | res->name = "System RAM"; | ||
188 | res->start = start_pfn << PAGE_SHIFT; | ||
189 | res->end = (end_pfn << PAGE_SHIFT) - 1; | ||
190 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
191 | if (request_resource(&iomem_resource, res)) { | ||
192 | pr_err("unable to request memory_resource 0x%lx 0x%lx\n", | ||
193 | start_pfn, end_pfn); | ||
194 | return; | ||
195 | } | ||
196 | |||
197 | /* | ||
198 | * We don't know which RAM region contains kernel data, | ||
199 | * so we try it repeatedly and let the resource manager | ||
200 | * test it. | ||
201 | */ | ||
202 | request_resource(res, &code_resource); | ||
203 | request_resource(res, &data_resource); | ||
204 | request_resource(res, &bss_resource); | ||
205 | |||
206 | #ifdef CONFIG_KEXEC | ||
207 | if (crashk_res.start != crashk_res.end) | ||
208 | request_resource(res, &crashk_res); | ||
209 | #endif | ||
210 | |||
211 | add_active_range(nid, start_pfn, end_pfn); | ||
212 | } | ||
213 | |||
172 | void __init setup_bootmem_allocator(unsigned long free_pfn) | 214 | void __init setup_bootmem_allocator(unsigned long free_pfn) |
173 | { | 215 | { |
174 | unsigned long bootmap_size; | 216 | unsigned long bootmap_size; |
@@ -181,7 +223,7 @@ void __init setup_bootmem_allocator(unsigned long free_pfn) | |||
181 | bootmap_size = init_bootmem_node(NODE_DATA(0), free_pfn, | 223 | bootmap_size = init_bootmem_node(NODE_DATA(0), free_pfn, |
182 | min_low_pfn, max_low_pfn); | 224 | min_low_pfn, max_low_pfn); |
183 | 225 | ||
184 | add_active_range(0, min_low_pfn, max_low_pfn); | 226 | __add_active_range(0, min_low_pfn, max_low_pfn); |
185 | register_bootmem_low_pages(); | 227 | register_bootmem_low_pages(); |
186 | 228 | ||
187 | node_set_online(0); | 229 | node_set_online(0); |
@@ -267,6 +309,8 @@ void __init setup_arch(char **cmdline_p) | |||
267 | code_resource.end = virt_to_phys(_etext)-1; | 309 | code_resource.end = virt_to_phys(_etext)-1; |
268 | data_resource.start = virt_to_phys(_etext); | 310 | data_resource.start = virt_to_phys(_etext); |
269 | data_resource.end = virt_to_phys(_edata)-1; | 311 | data_resource.end = virt_to_phys(_edata)-1; |
312 | bss_resource.start = virt_to_phys(__bss_start); | ||
313 | bss_resource.end = virt_to_phys(_ebss)-1; | ||
270 | 314 | ||
271 | memory_start = (unsigned long)__va(__MEMORY_START); | 315 | memory_start = (unsigned long)__va(__MEMORY_START); |
272 | if (!memory_end) | 316 | if (!memory_end) |
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c index 6d405462cee..8f916536719 100644 --- a/arch/sh/kernel/sh_ksyms_32.c +++ b/arch/sh/kernel/sh_ksyms_32.c | |||
@@ -20,8 +20,6 @@ | |||
20 | extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); | 20 | extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); |
21 | extern struct hw_interrupt_type no_irq_type; | 21 | extern struct hw_interrupt_type no_irq_type; |
22 | 22 | ||
23 | EXPORT_SYMBOL(sh_mv); | ||
24 | |||
25 | /* platform dependent support */ | 23 | /* platform dependent support */ |
26 | EXPORT_SYMBOL(dump_fpu); | 24 | EXPORT_SYMBOL(dump_fpu); |
27 | EXPORT_SYMBOL(kernel_thread); | 25 | EXPORT_SYMBOL(kernel_thread); |
diff --git a/arch/sh/kernel/sh_ksyms_64.c b/arch/sh/kernel/sh_ksyms_64.c index a310c9707f0..9324d32adac 100644 --- a/arch/sh/kernel/sh_ksyms_64.c +++ b/arch/sh/kernel/sh_ksyms_64.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/in6.h> | 16 | #include <linux/in6.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/screen_info.h> | 18 | #include <linux/screen_info.h> |
19 | #include <asm/cacheflush.h> | ||
19 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | #include <asm/checksum.h> | 22 | #include <asm/checksum.h> |
@@ -29,25 +30,50 @@ extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); | |||
29 | EXPORT_SYMBOL(dump_fpu); | 30 | EXPORT_SYMBOL(dump_fpu); |
30 | EXPORT_SYMBOL(kernel_thread); | 31 | EXPORT_SYMBOL(kernel_thread); |
31 | 32 | ||
33 | #if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) | ||
34 | EXPORT_SYMBOL(clear_user_page); | ||
35 | #endif | ||
36 | |||
37 | #ifndef CONFIG_CACHE_OFF | ||
38 | EXPORT_SYMBOL(flush_dcache_page); | ||
39 | #endif | ||
40 | |||
32 | /* Networking helper routines. */ | 41 | /* Networking helper routines. */ |
42 | EXPORT_SYMBOL(csum_partial); | ||
33 | EXPORT_SYMBOL(csum_partial_copy_nocheck); | 43 | EXPORT_SYMBOL(csum_partial_copy_nocheck); |
44 | #ifdef CONFIG_IPV6 | ||
45 | EXPORT_SYMBOL(csum_ipv6_magic); | ||
46 | #endif | ||
34 | 47 | ||
35 | #ifdef CONFIG_VT | 48 | #ifdef CONFIG_VT |
36 | EXPORT_SYMBOL(screen_info); | 49 | EXPORT_SYMBOL(screen_info); |
37 | #endif | 50 | #endif |
38 | 51 | ||
52 | EXPORT_SYMBOL(__put_user_asm_b); | ||
53 | EXPORT_SYMBOL(__put_user_asm_w); | ||
39 | EXPORT_SYMBOL(__put_user_asm_l); | 54 | EXPORT_SYMBOL(__put_user_asm_l); |
55 | EXPORT_SYMBOL(__put_user_asm_q); | ||
56 | EXPORT_SYMBOL(__get_user_asm_b); | ||
57 | EXPORT_SYMBOL(__get_user_asm_w); | ||
40 | EXPORT_SYMBOL(__get_user_asm_l); | 58 | EXPORT_SYMBOL(__get_user_asm_l); |
59 | EXPORT_SYMBOL(__get_user_asm_q); | ||
60 | EXPORT_SYMBOL(__strnlen_user); | ||
61 | EXPORT_SYMBOL(__strncpy_from_user); | ||
62 | EXPORT_SYMBOL(clear_page); | ||
63 | EXPORT_SYMBOL(__clear_user); | ||
41 | EXPORT_SYMBOL(copy_page); | 64 | EXPORT_SYMBOL(copy_page); |
42 | EXPORT_SYMBOL(__copy_user); | 65 | EXPORT_SYMBOL(__copy_user); |
43 | EXPORT_SYMBOL(empty_zero_page); | 66 | EXPORT_SYMBOL(empty_zero_page); |
44 | EXPORT_SYMBOL(memcpy); | 67 | EXPORT_SYMBOL(memcpy); |
45 | EXPORT_SYMBOL(__udelay); | 68 | EXPORT_SYMBOL(__udelay); |
46 | EXPORT_SYMBOL(__ndelay); | 69 | EXPORT_SYMBOL(__ndelay); |
70 | EXPORT_SYMBOL(__const_udelay); | ||
47 | 71 | ||
48 | /* Ugh. These come in from libgcc.a at link time. */ | 72 | /* Ugh. These come in from libgcc.a at link time. */ |
49 | #define DECLARE_EXPORT(name) extern void name(void);EXPORT_SYMBOL(name) | 73 | #define DECLARE_EXPORT(name) extern void name(void);EXPORT_SYMBOL(name) |
50 | 74 | ||
51 | DECLARE_EXPORT(__sdivsi3); | 75 | DECLARE_EXPORT(__sdivsi3); |
76 | DECLARE_EXPORT(__sdivsi3_2); | ||
52 | DECLARE_EXPORT(__muldi3); | 77 | DECLARE_EXPORT(__muldi3); |
53 | DECLARE_EXPORT(__udivsi3); | 78 | DECLARE_EXPORT(__udivsi3); |
79 | DECLARE_EXPORT(__div_table); | ||
diff --git a/arch/sh/kernel/time_64.c b/arch/sh/kernel/time_64.c index 898977ee203..022a55f1c1d 100644 --- a/arch/sh/kernel/time_64.c +++ b/arch/sh/kernel/time_64.c | |||
@@ -172,6 +172,7 @@ void do_gettimeofday(struct timeval *tv) | |||
172 | tv->tv_sec = sec; | 172 | tv->tv_sec = sec; |
173 | tv->tv_usec = usec; | 173 | tv->tv_usec = usec; |
174 | } | 174 | } |
175 | EXPORT_SYMBOL(do_gettimeofday); | ||
175 | 176 | ||
176 | int do_settimeofday(struct timespec *tv) | 177 | int do_settimeofday(struct timespec *tv) |
177 | { | 178 | { |
@@ -240,7 +241,7 @@ static inline void do_timer_interrupt(void) | |||
240 | * the irq version of write_lock because as just said we have irq | 241 | * the irq version of write_lock because as just said we have irq |
241 | * locally disabled. -arca | 242 | * locally disabled. -arca |
242 | */ | 243 | */ |
243 | write_lock(&xtime_lock); | 244 | write_seqlock(&xtime_lock); |
244 | asm ("getcon cr62, %0" : "=r" (current_ctc)); | 245 | asm ("getcon cr62, %0" : "=r" (current_ctc)); |
245 | ctc_last_interrupt = (unsigned long) current_ctc; | 246 | ctc_last_interrupt = (unsigned long) current_ctc; |
246 | 247 | ||
@@ -266,7 +267,7 @@ static inline void do_timer_interrupt(void) | |||
266 | /* do it again in 60 s */ | 267 | /* do it again in 60 s */ |
267 | last_rtc_update = xtime.tv_sec - 600; | 268 | last_rtc_update = xtime.tv_sec - 600; |
268 | } | 269 | } |
269 | write_unlock(&xtime_lock); | 270 | write_sequnlock(&xtime_lock); |
270 | 271 | ||
271 | #ifndef CONFIG_SMP | 272 | #ifndef CONFIG_SMP |
272 | update_process_times(user_mode(get_irq_regs())); | 273 | update_process_times(user_mode(get_irq_regs())); |
diff --git a/arch/sh/lib64/dbg.c b/arch/sh/lib64/dbg.c index 75825ef6e08..2fb8eaf6de6 100644 --- a/arch/sh/lib64/dbg.c +++ b/arch/sh/lib64/dbg.c | |||
@@ -186,8 +186,8 @@ void evt_debug(int evt, int ret_addr, int event, int tra, struct pt_regs *regs) | |||
186 | rr->pc = regs->pc; | 186 | rr->pc = regs->pc; |
187 | 187 | ||
188 | if (sp < stack_bottom + 3092) { | 188 | if (sp < stack_bottom + 3092) { |
189 | printk("evt_debug : stack underflow report\n"); | ||
190 | int i, j; | 189 | int i, j; |
190 | printk("evt_debug : stack underflow report\n"); | ||
191 | for (j=0, i = event_ptr; j<16; j++) { | 191 | for (j=0, i = event_ptr; j<16; j++) { |
192 | rr = event_ring + i; | 192 | rr = event_ring + i; |
193 | printk("evt=%08x event=%08x tra=%08x pid=%5d sp=%08lx pc=%08lx\n", | 193 | printk("evt=%08x event=%08x tra=%08x pid=%5d sp=%08lx pc=%08lx\n", |
diff --git a/arch/sh/mm/Makefile_64 b/arch/sh/mm/Makefile_64 index cbd6aa33c5a..0d92a8a3ac9 100644 --- a/arch/sh/mm/Makefile_64 +++ b/arch/sh/mm/Makefile_64 | |||
@@ -2,10 +2,11 @@ | |||
2 | # Makefile for the Linux SuperH-specific parts of the memory manager. | 2 | # Makefile for the Linux SuperH-specific parts of the memory manager. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := init.o extable_64.o consistent.o | 5 | obj-y := init.o consistent.o |
6 | 6 | ||
7 | mmu-y := tlb-nommu.o pg-nommu.o | 7 | mmu-y := tlb-nommu.o pg-nommu.o extable_32.o |
8 | mmu-$(CONFIG_MMU) := fault_64.o ioremap_64.o tlbflush_64.o tlb-sh5.o | 8 | mmu-$(CONFIG_MMU) := fault_64.o ioremap_64.o tlbflush_64.o tlb-sh5.o \ |
9 | extable_64.o | ||
9 | 10 | ||
10 | ifndef CONFIG_CACHE_OFF | 11 | ifndef CONFIG_CACHE_OFF |
11 | obj-y += cache-sh5.o | 12 | obj-y += cache-sh5.o |
diff --git a/arch/sh/mm/cache-sh5.c b/arch/sh/mm/cache-sh5.c index 3877321fced..9e277ec7d53 100644 --- a/arch/sh/mm/cache-sh5.c +++ b/arch/sh/mm/cache-sh5.c | |||
@@ -714,6 +714,7 @@ void flush_cache_sigtramp(unsigned long vaddr) | |||
714 | sh64_icache_inv_current_user_range(vaddr, end); | 714 | sh64_icache_inv_current_user_range(vaddr, end); |
715 | } | 715 | } |
716 | 716 | ||
717 | #ifdef CONFIG_MMU | ||
717 | /* | 718 | /* |
718 | * These *MUST* lie in an area of virtual address space that's otherwise | 719 | * These *MUST* lie in an area of virtual address space that's otherwise |
719 | * unused. | 720 | * unused. |
@@ -830,3 +831,4 @@ void clear_user_page(void *to, unsigned long address, struct page *page) | |||
830 | else | 831 | else |
831 | sh64_clear_user_page_coloured(to, address); | 832 | sh64_clear_user_page_coloured(to, address); |
832 | } | 833 | } |
834 | #endif | ||
diff --git a/arch/sh/mm/ioremap_64.c b/arch/sh/mm/ioremap_64.c index cea224c3e49..6e0be24d26e 100644 --- a/arch/sh/mm/ioremap_64.c +++ b/arch/sh/mm/ioremap_64.c | |||
@@ -343,6 +343,7 @@ unsigned long onchip_remap(unsigned long phys, unsigned long size, const char *n | |||
343 | 343 | ||
344 | return shmedia_alloc_io(phys, size, name); | 344 | return shmedia_alloc_io(phys, size, name); |
345 | } | 345 | } |
346 | EXPORT_SYMBOL(onchip_remap); | ||
346 | 347 | ||
347 | void onchip_unmap(unsigned long vaddr) | 348 | void onchip_unmap(unsigned long vaddr) |
348 | { | 349 | { |
@@ -370,6 +371,7 @@ void onchip_unmap(unsigned long vaddr) | |||
370 | kfree(res); | 371 | kfree(res); |
371 | } | 372 | } |
372 | } | 373 | } |
374 | EXPORT_SYMBOL(onchip_unmap); | ||
373 | 375 | ||
374 | #ifdef CONFIG_PROC_FS | 376 | #ifdef CONFIG_PROC_FS |
375 | static int | 377 | static int |
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c index 2de7302724f..1663199ce88 100644 --- a/arch/sh/mm/numa.c +++ b/arch/sh/mm/numa.c | |||
@@ -59,7 +59,7 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) | |||
59 | free_pfn = start_pfn = start >> PAGE_SHIFT; | 59 | free_pfn = start_pfn = start >> PAGE_SHIFT; |
60 | end_pfn = end >> PAGE_SHIFT; | 60 | end_pfn = end >> PAGE_SHIFT; |
61 | 61 | ||
62 | add_active_range(nid, start_pfn, end_pfn); | 62 | __add_active_range(nid, start_pfn, end_pfn); |
63 | 63 | ||
64 | /* Node-local pgdat */ | 64 | /* Node-local pgdat */ |
65 | NODE_DATA(nid) = pfn_to_kaddr(free_pfn); | 65 | NODE_DATA(nid) = pfn_to_kaddr(free_pfn); |
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types index 987c6682bf9..1bba7d36be9 100644 --- a/arch/sh/tools/mach-types +++ b/arch/sh/tools/mach-types | |||
@@ -28,7 +28,6 @@ HD64465 HD64465 | |||
28 | 7751SYSTEMH SH_7751_SYSTEMH | 28 | 7751SYSTEMH SH_7751_SYSTEMH |
29 | HP6XX SH_HP6XX | 29 | HP6XX SH_HP6XX |
30 | DREAMCAST SH_DREAMCAST | 30 | DREAMCAST SH_DREAMCAST |
31 | MPC1211 SH_MPC1211 | ||
32 | SNAPGEAR SH_SECUREEDGE5410 | 31 | SNAPGEAR SH_SECUREEDGE5410 |
33 | EDOSK7705 SH_EDOSK7705 | 32 | EDOSK7705 SH_EDOSK7705 |
34 | SH4202_MICRODEV SH_SH4202_MICRODEV | 33 | SH4202_MICRODEV SH_SH4202_MICRODEV |
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 10b86e1cc65..5047490fc29 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c | |||
@@ -191,9 +191,9 @@ void line_flush_chars(struct tty_struct *tty) | |||
191 | line_flush_buffer(tty); | 191 | line_flush_buffer(tty); |
192 | } | 192 | } |
193 | 193 | ||
194 | void line_put_char(struct tty_struct *tty, unsigned char ch) | 194 | int line_put_char(struct tty_struct *tty, unsigned char ch) |
195 | { | 195 | { |
196 | line_write(tty, &ch, sizeof(ch)); | 196 | return line_write(tty, &ch, sizeof(ch)); |
197 | } | 197 | } |
198 | 198 | ||
199 | int line_write(struct tty_struct *tty, const unsigned char *buf, int len) | 199 | int line_write(struct tty_struct *tty, const unsigned char *buf, int len) |
diff --git a/arch/um/include/line.h b/arch/um/include/line.h index 1223f2c844b..979b73e6352 100644 --- a/arch/um/include/line.h +++ b/arch/um/include/line.h | |||
@@ -71,7 +71,7 @@ extern int line_setup(struct line *lines, unsigned int sizeof_lines, | |||
71 | char *init, char **error_out); | 71 | char *init, char **error_out); |
72 | extern int line_write(struct tty_struct *tty, const unsigned char *buf, | 72 | extern int line_write(struct tty_struct *tty, const unsigned char *buf, |
73 | int len); | 73 | int len); |
74 | extern void line_put_char(struct tty_struct *tty, unsigned char ch); | 74 | extern int line_put_char(struct tty_struct *tty, unsigned char ch); |
75 | extern void line_set_termios(struct tty_struct *tty, struct ktermios * old); | 75 | extern void line_set_termios(struct tty_struct *tty, struct ktermios * old); |
76 | extern int line_chars_in_buffer(struct tty_struct *tty); | 76 | extern int line_chars_in_buffer(struct tty_struct *tty); |
77 | extern void line_flush_buffer(struct tty_struct *tty); | 77 | extern void line_flush_buffer(struct tty_struct *tty); |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c3f880902d6..fe361ae7ef2 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -18,6 +18,7 @@ config X86_64 | |||
18 | ### Arch settings | 18 | ### Arch settings |
19 | config X86 | 19 | config X86 |
20 | def_bool y | 20 | def_bool y |
21 | select HAVE_UNSTABLE_SCHED_CLOCK | ||
21 | select HAVE_IDE | 22 | select HAVE_IDE |
22 | select HAVE_OPROFILE | 23 | select HAVE_OPROFILE |
23 | select HAVE_KPROBES | 24 | select HAVE_KPROBES |
@@ -334,6 +335,7 @@ config X86_RDC321X | |||
334 | select GENERIC_GPIO | 335 | select GENERIC_GPIO |
335 | select LEDS_CLASS | 336 | select LEDS_CLASS |
336 | select LEDS_GPIO | 337 | select LEDS_GPIO |
338 | select NEW_LEDS | ||
337 | help | 339 | help |
338 | This option is needed for RDC R-321x system-on-chip, also known | 340 | This option is needed for RDC R-321x system-on-chip, also known |
339 | as R-8610-(G). | 341 | as R-8610-(G). |
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c index d01ea42187e..edaadea90aa 100644 --- a/arch/x86/boot/compressed/relocs.c +++ b/arch/x86/boot/compressed/relocs.c | |||
@@ -191,7 +191,7 @@ static void read_ehdr(FILE *fp) | |||
191 | die("Cannot read ELF header: %s\n", | 191 | die("Cannot read ELF header: %s\n", |
192 | strerror(errno)); | 192 | strerror(errno)); |
193 | } | 193 | } |
194 | if (memcmp(ehdr.e_ident, ELFMAG, 4) != 0) { | 194 | if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) { |
195 | die("No ELF magic\n"); | 195 | die("No ELF magic\n"); |
196 | } | 196 | } |
197 | if (ehdr.e_ident[EI_CLASS] != ELFCLASS32) { | 197 | if (ehdr.e_ident[EI_CLASS] != ELFCLASS32) { |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index bbdacb398d4..5e618c3b472 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -83,9 +83,7 @@ obj-$(CONFIG_KVM_GUEST) += kvm.o | |||
83 | obj-$(CONFIG_KVM_CLOCK) += kvmclock.o | 83 | obj-$(CONFIG_KVM_CLOCK) += kvmclock.o |
84 | obj-$(CONFIG_PARAVIRT) += paravirt.o paravirt_patch_$(BITS).o | 84 | obj-$(CONFIG_PARAVIRT) += paravirt.o paravirt_patch_$(BITS).o |
85 | 85 | ||
86 | ifdef CONFIG_INPUT_PCSPKR | 86 | obj-$(CONFIG_PCSPKR_PLATFORM) += pcspeaker.o |
87 | obj-y += pcspeaker.o | ||
88 | endif | ||
89 | 87 | ||
90 | obj-$(CONFIG_SCx200) += scx200.o | 88 | obj-$(CONFIG_SCx200) += scx200.o |
91 | scx200-y += scx200_32.o | 89 | scx200-y += scx200_32.o |
diff --git a/arch/x86/kernel/acpi/Makefile b/arch/x86/kernel/acpi/Makefile index 7335959b6af..fd5ca97a2ad 100644 --- a/arch/x86/kernel/acpi/Makefile +++ b/arch/x86/kernel/acpi/Makefile | |||
@@ -10,5 +10,5 @@ endif | |||
10 | $(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin | 10 | $(obj)/wakeup_rm.o: $(obj)/realmode/wakeup.bin |
11 | 11 | ||
12 | $(obj)/realmode/wakeup.bin: FORCE | 12 | $(obj)/realmode/wakeup.bin: FORCE |
13 | $(Q)$(MAKE) $(build)=$(obj)/realmode $@ | 13 | $(Q)$(MAKE) $(build)=$(obj)/realmode |
14 | 14 | ||
diff --git a/arch/x86/kernel/acpi/realmode/Makefile b/arch/x86/kernel/acpi/realmode/Makefile index 092900854ac..1c31cc0e9de 100644 --- a/arch/x86/kernel/acpi/realmode/Makefile +++ b/arch/x86/kernel/acpi/realmode/Makefile | |||
@@ -6,7 +6,8 @@ | |||
6 | # for more details. | 6 | # for more details. |
7 | # | 7 | # |
8 | 8 | ||
9 | targets := wakeup.bin wakeup.elf | 9 | always := wakeup.bin |
10 | targets := wakeup.elf wakeup.lds | ||
10 | 11 | ||
11 | wakeup-y += wakeup.o wakemain.o video-mode.o copy.o | 12 | wakeup-y += wakeup.o wakemain.o video-mode.o copy.o |
12 | 13 | ||
@@ -48,7 +49,7 @@ LDFLAGS_wakeup.elf := -T | |||
48 | 49 | ||
49 | CPPFLAGS_wakeup.lds += -P -C | 50 | CPPFLAGS_wakeup.lds += -P -C |
50 | 51 | ||
51 | $(obj)/wakeup.elf: $(src)/wakeup.lds $(WAKEUP_OBJS) FORCE | 52 | $(obj)/wakeup.elf: $(obj)/wakeup.lds $(WAKEUP_OBJS) FORCE |
52 | $(call if_changed,ld) | 53 | $(call if_changed,ld) |
53 | 54 | ||
54 | OBJCOPYFLAGS_wakeup.bin := -O binary | 55 | OBJCOPYFLAGS_wakeup.bin := -O binary |
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index 238468ae199..c2e1ce33c7c 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/cpu.h> | 7 | #include <linux/cpu.h> |
8 | 8 | ||
9 | #include <asm/pat.h> | ||
9 | #include <asm/processor.h> | 10 | #include <asm/processor.h> |
10 | 11 | ||
11 | struct cpuid_bit { | 12 | struct cpuid_bit { |
@@ -48,3 +49,23 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | |||
48 | set_cpu_cap(c, cb->feature); | 49 | set_cpu_cap(c, cb->feature); |
49 | } | 50 | } |
50 | } | 51 | } |
52 | |||
53 | #ifdef CONFIG_X86_PAT | ||
54 | void __cpuinit validate_pat_support(struct cpuinfo_x86 *c) | ||
55 | { | ||
56 | switch (c->x86_vendor) { | ||
57 | case X86_VENDOR_AMD: | ||
58 | if (c->x86 >= 0xf && c->x86 <= 0x11) | ||
59 | return; | ||
60 | break; | ||
61 | case X86_VENDOR_INTEL: | ||
62 | if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15)) | ||
63 | return; | ||
64 | break; | ||
65 | } | ||
66 | |||
67 | pat_disable(cpu_has_pat ? | ||
68 | "PAT disabled. Not yet verified on this CPU type." : | ||
69 | "PAT not supported by CPU."); | ||
70 | } | ||
71 | #endif | ||
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 35b4f6a9c8e..d0463a94624 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <asm/mmu_context.h> | 12 | #include <asm/mmu_context.h> |
13 | #include <asm/mtrr.h> | 13 | #include <asm/mtrr.h> |
14 | #include <asm/mce.h> | 14 | #include <asm/mce.h> |
15 | #include <asm/pat.h> | ||
15 | #ifdef CONFIG_X86_LOCAL_APIC | 16 | #ifdef CONFIG_X86_LOCAL_APIC |
16 | #include <asm/mpspec.h> | 17 | #include <asm/mpspec.h> |
17 | #include <asm/apic.h> | 18 | #include <asm/apic.h> |
@@ -308,19 +309,6 @@ static void __cpuinit early_get_cap(struct cpuinfo_x86 *c) | |||
308 | 309 | ||
309 | } | 310 | } |
310 | 311 | ||
311 | clear_cpu_cap(c, X86_FEATURE_PAT); | ||
312 | |||
313 | switch (c->x86_vendor) { | ||
314 | case X86_VENDOR_AMD: | ||
315 | if (c->x86 >= 0xf && c->x86 <= 0x11) | ||
316 | set_cpu_cap(c, X86_FEATURE_PAT); | ||
317 | break; | ||
318 | case X86_VENDOR_INTEL: | ||
319 | if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15)) | ||
320 | set_cpu_cap(c, X86_FEATURE_PAT); | ||
321 | break; | ||
322 | } | ||
323 | |||
324 | } | 312 | } |
325 | 313 | ||
326 | /* | 314 | /* |
@@ -409,18 +397,6 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c) | |||
409 | init_scattered_cpuid_features(c); | 397 | init_scattered_cpuid_features(c); |
410 | } | 398 | } |
411 | 399 | ||
412 | clear_cpu_cap(c, X86_FEATURE_PAT); | ||
413 | |||
414 | switch (c->x86_vendor) { | ||
415 | case X86_VENDOR_AMD: | ||
416 | if (c->x86 >= 0xf && c->x86 <= 0x11) | ||
417 | set_cpu_cap(c, X86_FEATURE_PAT); | ||
418 | break; | ||
419 | case X86_VENDOR_INTEL: | ||
420 | if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15)) | ||
421 | set_cpu_cap(c, X86_FEATURE_PAT); | ||
422 | break; | ||
423 | } | ||
424 | } | 400 | } |
425 | 401 | ||
426 | static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) | 402 | static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) |
@@ -651,6 +627,7 @@ void __init early_cpu_init(void) | |||
651 | cpu_devs[cvdev->vendor] = cvdev->cpu_dev; | 627 | cpu_devs[cvdev->vendor] = cvdev->cpu_dev; |
652 | 628 | ||
653 | early_cpu_detect(); | 629 | early_cpu_detect(); |
630 | validate_pat_support(&boot_cpu_data); | ||
654 | } | 631 | } |
655 | 632 | ||
656 | /* Make sure %fs is initialized properly in idle threads */ | 633 | /* Make sure %fs is initialized properly in idle threads */ |
diff --git a/arch/x86/kernel/geode_32.c b/arch/x86/kernel/geode_32.c index 9dad6ca6cd7..e8edd63ab00 100644 --- a/arch/x86/kernel/geode_32.c +++ b/arch/x86/kernel/geode_32.c | |||
@@ -161,6 +161,25 @@ void geode_gpio_setup_event(unsigned int gpio, int pair, int pme) | |||
161 | } | 161 | } |
162 | EXPORT_SYMBOL_GPL(geode_gpio_setup_event); | 162 | EXPORT_SYMBOL_GPL(geode_gpio_setup_event); |
163 | 163 | ||
164 | int geode_has_vsa2(void) | ||
165 | { | ||
166 | static int has_vsa2 = -1; | ||
167 | |||
168 | if (has_vsa2 == -1) { | ||
169 | /* | ||
170 | * The VSA has virtual registers that we can query for a | ||
171 | * signature. | ||
172 | */ | ||
173 | outw(VSA_VR_UNLOCK, VSA_VRC_INDEX); | ||
174 | outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX); | ||
175 | |||
176 | has_vsa2 = (inw(VSA_VRC_DATA) == VSA_SIG); | ||
177 | } | ||
178 | |||
179 | return has_vsa2; | ||
180 | } | ||
181 | EXPORT_SYMBOL_GPL(geode_has_vsa2); | ||
182 | |||
164 | static int __init geode_southbridge_init(void) | 183 | static int __init geode_southbridge_init(void) |
165 | { | 184 | { |
166 | if (!is_geode()) | 185 | if (!is_geode()) |
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index db6839b5319..e03cc952f23 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c | |||
@@ -450,7 +450,6 @@ static inline int restore_i387_fsave(struct _fpstate_ia32 __user *buf) | |||
450 | { | 450 | { |
451 | struct task_struct *tsk = current; | 451 | struct task_struct *tsk = current; |
452 | 452 | ||
453 | clear_fpu(tsk); | ||
454 | return __copy_from_user(&tsk->thread.xstate->fsave, buf, | 453 | return __copy_from_user(&tsk->thread.xstate->fsave, buf, |
455 | sizeof(struct i387_fsave_struct)); | 454 | sizeof(struct i387_fsave_struct)); |
456 | } | 455 | } |
@@ -461,7 +460,6 @@ static int restore_i387_fxsave(struct _fpstate_ia32 __user *buf) | |||
461 | struct user_i387_ia32_struct env; | 460 | struct user_i387_ia32_struct env; |
462 | int err; | 461 | int err; |
463 | 462 | ||
464 | clear_fpu(tsk); | ||
465 | err = __copy_from_user(&tsk->thread.xstate->fxsave, &buf->_fxsr_env[0], | 463 | err = __copy_from_user(&tsk->thread.xstate->fxsave, &buf->_fxsr_env[0], |
466 | sizeof(struct i387_fxsave_struct)); | 464 | sizeof(struct i387_fxsave_struct)); |
467 | /* mxcsr reserved bits must be masked to zero for security reasons */ | 465 | /* mxcsr reserved bits must be masked to zero for security reasons */ |
@@ -478,6 +476,16 @@ int restore_i387_ia32(struct _fpstate_ia32 __user *buf) | |||
478 | int err; | 476 | int err; |
479 | 477 | ||
480 | if (HAVE_HWFP) { | 478 | if (HAVE_HWFP) { |
479 | struct task_struct *tsk = current; | ||
480 | |||
481 | clear_fpu(tsk); | ||
482 | |||
483 | if (!used_math()) { | ||
484 | err = init_fpu(tsk); | ||
485 | if (err) | ||
486 | return err; | ||
487 | } | ||
488 | |||
481 | if (cpu_has_fxsr) | 489 | if (cpu_has_fxsr) |
482 | err = restore_i387_fxsave(buf); | 490 | err = restore_i387_fxsave(buf); |
483 | else | 491 | else |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index ddee04043ae..4bc1be5d547 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -133,6 +133,7 @@ static int kvm_register_clock(void) | |||
133 | return native_write_msr_safe(MSR_KVM_SYSTEM_TIME, low, high); | 133 | return native_write_msr_safe(MSR_KVM_SYSTEM_TIME, low, high); |
134 | } | 134 | } |
135 | 135 | ||
136 | #ifdef CONFIG_X86_LOCAL_APIC | ||
136 | static void kvm_setup_secondary_clock(void) | 137 | static void kvm_setup_secondary_clock(void) |
137 | { | 138 | { |
138 | /* | 139 | /* |
@@ -143,6 +144,7 @@ static void kvm_setup_secondary_clock(void) | |||
143 | /* ok, done with our trickery, call native */ | 144 | /* ok, done with our trickery, call native */ |
144 | setup_secondary_APIC_clock(); | 145 | setup_secondary_APIC_clock(); |
145 | } | 146 | } |
147 | #endif | ||
146 | 148 | ||
147 | /* | 149 | /* |
148 | * After the clock is registered, the host will keep writing to the | 150 | * After the clock is registered, the host will keep writing to the |
@@ -177,7 +179,9 @@ void __init kvmclock_init(void) | |||
177 | pv_time_ops.get_wallclock = kvm_get_wallclock; | 179 | pv_time_ops.get_wallclock = kvm_get_wallclock; |
178 | pv_time_ops.set_wallclock = kvm_set_wallclock; | 180 | pv_time_ops.set_wallclock = kvm_set_wallclock; |
179 | pv_time_ops.sched_clock = kvm_clock_read; | 181 | pv_time_ops.sched_clock = kvm_clock_read; |
182 | #ifdef CONFIG_X86_LOCAL_APIC | ||
180 | pv_apic_ops.setup_secondary_clock = kvm_setup_secondary_clock; | 183 | pv_apic_ops.setup_secondary_clock = kvm_setup_secondary_clock; |
184 | #endif | ||
181 | machine_ops.shutdown = kvm_shutdown; | 185 | machine_ops.shutdown = kvm_shutdown; |
182 | #ifdef CONFIG_KEXEC | 186 | #ifdef CONFIG_KEXEC |
183 | machine_ops.crash_shutdown = kvm_crash_shutdown; | 187 | machine_ops.crash_shutdown = kvm_crash_shutdown; |
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 3e2c54dc8b2..404683b94e7 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -794,6 +794,11 @@ void __init find_smp_config(void) | |||
794 | ACPI-based MP Configuration | 794 | ACPI-based MP Configuration |
795 | -------------------------------------------------------------------------- */ | 795 | -------------------------------------------------------------------------- */ |
796 | 796 | ||
797 | /* | ||
798 | * Keep this outside and initialized to 0, for !CONFIG_ACPI builds: | ||
799 | */ | ||
800 | int es7000_plat; | ||
801 | |||
797 | #ifdef CONFIG_ACPI | 802 | #ifdef CONFIG_ACPI |
798 | 803 | ||
799 | #ifdef CONFIG_X86_IO_APIC | 804 | #ifdef CONFIG_X86_IO_APIC |
@@ -909,8 +914,6 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
909 | MP_intsrc_info(&intsrc); | 914 | MP_intsrc_info(&intsrc); |
910 | } | 915 | } |
911 | 916 | ||
912 | int es7000_plat; | ||
913 | |||
914 | void __init mp_config_acpi_legacy_irqs(void) | 917 | void __init mp_config_acpi_legacy_irqs(void) |
915 | { | 918 | { |
916 | struct mpc_config_intsrc intsrc; | 919 | struct mpc_config_intsrc intsrc; |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 07c6d42ab5f..f6be7d5f82f 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -149,7 +149,6 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
149 | .matches = { | 149 | .matches = { |
150 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | 150 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
151 | DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"), | 151 | DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"), |
152 | DMI_MATCH(DMI_BOARD_NAME, "0WF810"), | ||
153 | }, | 152 | }, |
154 | }, | 153 | }, |
155 | { /* Handle problems with rebooting on Dell Optiplex 745's DFF*/ | 154 | { /* Handle problems with rebooting on Dell Optiplex 745's DFF*/ |
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index 2283422af79..2c5f8b213e8 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c | |||
@@ -127,7 +127,12 @@ static struct resource standard_io_resources[] = { { | |||
127 | }, { | 127 | }, { |
128 | .name = "keyboard", | 128 | .name = "keyboard", |
129 | .start = 0x0060, | 129 | .start = 0x0060, |
130 | .end = 0x006f, | 130 | .end = 0x0060, |
131 | .flags = IORESOURCE_BUSY | IORESOURCE_IO | ||
132 | }, { | ||
133 | .name = "keyboard", | ||
134 | .start = 0x0064, | ||
135 | .end = 0x0064, | ||
131 | .flags = IORESOURCE_BUSY | IORESOURCE_IO | 136 | .flags = IORESOURCE_BUSY | IORESOURCE_IO |
132 | }, { | 137 | }, { |
133 | .name = "dma page reg", | 138 | .name = "dma page reg", |
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 22c14e21c97..f2fc8feb727 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
@@ -70,6 +70,7 @@ | |||
70 | #include <asm/ds.h> | 70 | #include <asm/ds.h> |
71 | #include <asm/topology.h> | 71 | #include <asm/topology.h> |
72 | #include <asm/trampoline.h> | 72 | #include <asm/trampoline.h> |
73 | #include <asm/pat.h> | ||
73 | 74 | ||
74 | #include <mach_apic.h> | 75 | #include <mach_apic.h> |
75 | #ifdef CONFIG_PARAVIRT | 76 | #ifdef CONFIG_PARAVIRT |
@@ -128,7 +129,9 @@ static struct resource standard_io_resources[] = { | |||
128 | .flags = IORESOURCE_BUSY | IORESOURCE_IO }, | 129 | .flags = IORESOURCE_BUSY | IORESOURCE_IO }, |
129 | { .name = "timer1", .start = 0x50, .end = 0x53, | 130 | { .name = "timer1", .start = 0x50, .end = 0x53, |
130 | .flags = IORESOURCE_BUSY | IORESOURCE_IO }, | 131 | .flags = IORESOURCE_BUSY | IORESOURCE_IO }, |
131 | { .name = "keyboard", .start = 0x60, .end = 0x6f, | 132 | { .name = "keyboard", .start = 0x60, .end = 0x60, |
133 | .flags = IORESOURCE_BUSY | IORESOURCE_IO }, | ||
134 | { .name = "keyboard", .start = 0x64, .end = 0x64, | ||
132 | .flags = IORESOURCE_BUSY | IORESOURCE_IO }, | 135 | .flags = IORESOURCE_BUSY | IORESOURCE_IO }, |
133 | { .name = "dma page reg", .start = 0x80, .end = 0x8f, | 136 | { .name = "dma page reg", .start = 0x80, .end = 0x8f, |
134 | .flags = IORESOURCE_BUSY | IORESOURCE_IO }, | 137 | .flags = IORESOURCE_BUSY | IORESOURCE_IO }, |
@@ -1063,25 +1066,19 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) | |||
1063 | if (c->extended_cpuid_level >= 0x80000007) | 1066 | if (c->extended_cpuid_level >= 0x80000007) |
1064 | c->x86_power = cpuid_edx(0x80000007); | 1067 | c->x86_power = cpuid_edx(0x80000007); |
1065 | 1068 | ||
1066 | |||
1067 | clear_cpu_cap(c, X86_FEATURE_PAT); | ||
1068 | |||
1069 | switch (c->x86_vendor) { | 1069 | switch (c->x86_vendor) { |
1070 | case X86_VENDOR_AMD: | 1070 | case X86_VENDOR_AMD: |
1071 | early_init_amd(c); | 1071 | early_init_amd(c); |
1072 | if (c->x86 >= 0xf && c->x86 <= 0x11) | ||
1073 | set_cpu_cap(c, X86_FEATURE_PAT); | ||
1074 | break; | 1072 | break; |
1075 | case X86_VENDOR_INTEL: | 1073 | case X86_VENDOR_INTEL: |
1076 | early_init_intel(c); | 1074 | early_init_intel(c); |
1077 | if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15)) | ||
1078 | set_cpu_cap(c, X86_FEATURE_PAT); | ||
1079 | break; | 1075 | break; |
1080 | case X86_VENDOR_CENTAUR: | 1076 | case X86_VENDOR_CENTAUR: |
1081 | early_init_centaur(c); | 1077 | early_init_centaur(c); |
1082 | break; | 1078 | break; |
1083 | } | 1079 | } |
1084 | 1080 | ||
1081 | validate_pat_support(c); | ||
1085 | } | 1082 | } |
1086 | 1083 | ||
1087 | /* | 1084 | /* |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 84241a256dc..6b087ab6cd8 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -299,7 +299,7 @@ static void __cpuinit smp_callin(void) | |||
299 | /* | 299 | /* |
300 | * Activate a secondary processor. | 300 | * Activate a secondary processor. |
301 | */ | 301 | */ |
302 | void __cpuinit start_secondary(void *unused) | 302 | static void __cpuinit start_secondary(void *unused) |
303 | { | 303 | { |
304 | /* | 304 | /* |
305 | * Don't put *anything* before cpu_init(), SMP booting is too | 305 | * Don't put *anything* before cpu_init(), SMP booting is too |
@@ -1306,7 +1306,7 @@ static void remove_siblinginfo(int cpu) | |||
1306 | cpu_clear(cpu, cpu_sibling_setup_map); | 1306 | cpu_clear(cpu, cpu_sibling_setup_map); |
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | int additional_cpus __initdata = -1; | 1309 | static int additional_cpus __initdata = -1; |
1310 | 1310 | ||
1311 | static __init int setup_additional_cpus(char *s) | 1311 | static __init int setup_additional_cpus(char *s) |
1312 | { | 1312 | { |
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 4c943eabacc..3324d90038e 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -288,6 +288,8 @@ static void pit_load_count(struct kvm *kvm, int channel, u32 val) | |||
288 | * mode 1 is one shot, mode 2 is period, otherwise del timer */ | 288 | * mode 1 is one shot, mode 2 is period, otherwise del timer */ |
289 | switch (ps->channels[0].mode) { | 289 | switch (ps->channels[0].mode) { |
290 | case 1: | 290 | case 1: |
291 | /* FIXME: enhance mode 4 precision */ | ||
292 | case 4: | ||
291 | create_pit_timer(&ps->pit_timer, val, 0); | 293 | create_pit_timer(&ps->pit_timer, val, 0); |
292 | break; | 294 | break; |
293 | case 2: | 295 | case 2: |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 2ad6f548167..36c5406b181 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -79,36 +79,6 @@ static int dbg = 1; | |||
79 | } | 79 | } |
80 | #endif | 80 | #endif |
81 | 81 | ||
82 | #define PT64_PT_BITS 9 | ||
83 | #define PT64_ENT_PER_PAGE (1 << PT64_PT_BITS) | ||
84 | #define PT32_PT_BITS 10 | ||
85 | #define PT32_ENT_PER_PAGE (1 << PT32_PT_BITS) | ||
86 | |||
87 | #define PT_WRITABLE_SHIFT 1 | ||
88 | |||
89 | #define PT_PRESENT_MASK (1ULL << 0) | ||
90 | #define PT_WRITABLE_MASK (1ULL << PT_WRITABLE_SHIFT) | ||
91 | #define PT_USER_MASK (1ULL << 2) | ||
92 | #define PT_PWT_MASK (1ULL << 3) | ||
93 | #define PT_PCD_MASK (1ULL << 4) | ||
94 | #define PT_ACCESSED_MASK (1ULL << 5) | ||
95 | #define PT_DIRTY_MASK (1ULL << 6) | ||
96 | #define PT_PAGE_SIZE_MASK (1ULL << 7) | ||
97 | #define PT_PAT_MASK (1ULL << 7) | ||
98 | #define PT_GLOBAL_MASK (1ULL << 8) | ||
99 | #define PT64_NX_SHIFT 63 | ||
100 | #define PT64_NX_MASK (1ULL << PT64_NX_SHIFT) | ||
101 | |||
102 | #define PT_PAT_SHIFT 7 | ||
103 | #define PT_DIR_PAT_SHIFT 12 | ||
104 | #define PT_DIR_PAT_MASK (1ULL << PT_DIR_PAT_SHIFT) | ||
105 | |||
106 | #define PT32_DIR_PSE36_SIZE 4 | ||
107 | #define PT32_DIR_PSE36_SHIFT 13 | ||
108 | #define PT32_DIR_PSE36_MASK \ | ||
109 | (((1ULL << PT32_DIR_PSE36_SIZE) - 1) << PT32_DIR_PSE36_SHIFT) | ||
110 | |||
111 | |||
112 | #define PT_FIRST_AVAIL_BITS_SHIFT 9 | 82 | #define PT_FIRST_AVAIL_BITS_SHIFT 9 |
113 | #define PT64_SECOND_AVAIL_BITS_SHIFT 52 | 83 | #define PT64_SECOND_AVAIL_BITS_SHIFT 52 |
114 | 84 | ||
@@ -154,10 +124,6 @@ static int dbg = 1; | |||
154 | #define PFERR_USER_MASK (1U << 2) | 124 | #define PFERR_USER_MASK (1U << 2) |
155 | #define PFERR_FETCH_MASK (1U << 4) | 125 | #define PFERR_FETCH_MASK (1U << 4) |
156 | 126 | ||
157 | #define PT64_ROOT_LEVEL 4 | ||
158 | #define PT32_ROOT_LEVEL 2 | ||
159 | #define PT32E_ROOT_LEVEL 3 | ||
160 | |||
161 | #define PT_DIRECTORY_LEVEL 2 | 127 | #define PT_DIRECTORY_LEVEL 2 |
162 | #define PT_PAGE_TABLE_LEVEL 1 | 128 | #define PT_PAGE_TABLE_LEVEL 1 |
163 | 129 | ||
@@ -186,6 +152,12 @@ static struct kmem_cache *mmu_page_header_cache; | |||
186 | 152 | ||
187 | static u64 __read_mostly shadow_trap_nonpresent_pte; | 153 | static u64 __read_mostly shadow_trap_nonpresent_pte; |
188 | static u64 __read_mostly shadow_notrap_nonpresent_pte; | 154 | static u64 __read_mostly shadow_notrap_nonpresent_pte; |
155 | static u64 __read_mostly shadow_base_present_pte; | ||
156 | static u64 __read_mostly shadow_nx_mask; | ||
157 | static u64 __read_mostly shadow_x_mask; /* mutual exclusive with nx_mask */ | ||
158 | static u64 __read_mostly shadow_user_mask; | ||
159 | static u64 __read_mostly shadow_accessed_mask; | ||
160 | static u64 __read_mostly shadow_dirty_mask; | ||
189 | 161 | ||
190 | void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte) | 162 | void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte) |
191 | { | 163 | { |
@@ -194,6 +166,23 @@ void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte) | |||
194 | } | 166 | } |
195 | EXPORT_SYMBOL_GPL(kvm_mmu_set_nonpresent_ptes); | 167 | EXPORT_SYMBOL_GPL(kvm_mmu_set_nonpresent_ptes); |
196 | 168 | ||
169 | void kvm_mmu_set_base_ptes(u64 base_pte) | ||
170 | { | ||
171 | shadow_base_present_pte = base_pte; | ||
172 | } | ||
173 | EXPORT_SYMBOL_GPL(kvm_mmu_set_base_ptes); | ||
174 | |||
175 | void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, | ||
176 | u64 dirty_mask, u64 nx_mask, u64 x_mask) | ||
177 | { | ||
178 | shadow_user_mask = user_mask; | ||
179 | shadow_accessed_mask = accessed_mask; | ||
180 | shadow_dirty_mask = dirty_mask; | ||
181 | shadow_nx_mask = nx_mask; | ||
182 | shadow_x_mask = x_mask; | ||
183 | } | ||
184 | EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes); | ||
185 | |||
197 | static int is_write_protection(struct kvm_vcpu *vcpu) | 186 | static int is_write_protection(struct kvm_vcpu *vcpu) |
198 | { | 187 | { |
199 | return vcpu->arch.cr0 & X86_CR0_WP; | 188 | return vcpu->arch.cr0 & X86_CR0_WP; |
@@ -232,7 +221,7 @@ static int is_writeble_pte(unsigned long pte) | |||
232 | 221 | ||
233 | static int is_dirty_pte(unsigned long pte) | 222 | static int is_dirty_pte(unsigned long pte) |
234 | { | 223 | { |
235 | return pte & PT_DIRTY_MASK; | 224 | return pte & shadow_dirty_mask; |
236 | } | 225 | } |
237 | 226 | ||
238 | static int is_rmap_pte(u64 pte) | 227 | static int is_rmap_pte(u64 pte) |
@@ -387,7 +376,6 @@ static void account_shadowed(struct kvm *kvm, gfn_t gfn) | |||
387 | 376 | ||
388 | write_count = slot_largepage_idx(gfn, gfn_to_memslot(kvm, gfn)); | 377 | write_count = slot_largepage_idx(gfn, gfn_to_memslot(kvm, gfn)); |
389 | *write_count += 1; | 378 | *write_count += 1; |
390 | WARN_ON(*write_count > KVM_PAGES_PER_HPAGE); | ||
391 | } | 379 | } |
392 | 380 | ||
393 | static void unaccount_shadowed(struct kvm *kvm, gfn_t gfn) | 381 | static void unaccount_shadowed(struct kvm *kvm, gfn_t gfn) |
@@ -547,7 +535,7 @@ static void rmap_remove(struct kvm *kvm, u64 *spte) | |||
547 | return; | 535 | return; |
548 | sp = page_header(__pa(spte)); | 536 | sp = page_header(__pa(spte)); |
549 | pfn = spte_to_pfn(*spte); | 537 | pfn = spte_to_pfn(*spte); |
550 | if (*spte & PT_ACCESSED_MASK) | 538 | if (*spte & shadow_accessed_mask) |
551 | kvm_set_pfn_accessed(pfn); | 539 | kvm_set_pfn_accessed(pfn); |
552 | if (is_writeble_pte(*spte)) | 540 | if (is_writeble_pte(*spte)) |
553 | kvm_release_pfn_dirty(pfn); | 541 | kvm_release_pfn_dirty(pfn); |
@@ -1073,17 +1061,17 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, | |||
1073 | * whether the guest actually used the pte (in order to detect | 1061 | * whether the guest actually used the pte (in order to detect |
1074 | * demand paging). | 1062 | * demand paging). |
1075 | */ | 1063 | */ |
1076 | spte = PT_PRESENT_MASK | PT_DIRTY_MASK; | 1064 | spte = shadow_base_present_pte | shadow_dirty_mask; |
1077 | if (!speculative) | 1065 | if (!speculative) |
1078 | pte_access |= PT_ACCESSED_MASK; | 1066 | pte_access |= PT_ACCESSED_MASK; |
1079 | if (!dirty) | 1067 | if (!dirty) |
1080 | pte_access &= ~ACC_WRITE_MASK; | 1068 | pte_access &= ~ACC_WRITE_MASK; |
1081 | if (!(pte_access & ACC_EXEC_MASK)) | 1069 | if (pte_access & ACC_EXEC_MASK) |
1082 | spte |= PT64_NX_MASK; | 1070 | spte |= shadow_x_mask; |
1083 | 1071 | else | |
1084 | spte |= PT_PRESENT_MASK; | 1072 | spte |= shadow_nx_mask; |
1085 | if (pte_access & ACC_USER_MASK) | 1073 | if (pte_access & ACC_USER_MASK) |
1086 | spte |= PT_USER_MASK; | 1074 | spte |= shadow_user_mask; |
1087 | if (largepage) | 1075 | if (largepage) |
1088 | spte |= PT_PAGE_SIZE_MASK; | 1076 | spte |= PT_PAGE_SIZE_MASK; |
1089 | 1077 | ||
@@ -1188,8 +1176,9 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write, | |||
1188 | return -ENOMEM; | 1176 | return -ENOMEM; |
1189 | } | 1177 | } |
1190 | 1178 | ||
1191 | table[index] = __pa(new_table->spt) | PT_PRESENT_MASK | 1179 | table[index] = __pa(new_table->spt) |
1192 | | PT_WRITABLE_MASK | PT_USER_MASK; | 1180 | | PT_PRESENT_MASK | PT_WRITABLE_MASK |
1181 | | shadow_user_mask | shadow_x_mask; | ||
1193 | } | 1182 | } |
1194 | table_addr = table[index] & PT64_BASE_ADDR_MASK; | 1183 | table_addr = table[index] & PT64_BASE_ADDR_MASK; |
1195 | } | 1184 | } |
@@ -1244,7 +1233,6 @@ static void mmu_free_roots(struct kvm_vcpu *vcpu) | |||
1244 | if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) | 1233 | if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) |
1245 | return; | 1234 | return; |
1246 | spin_lock(&vcpu->kvm->mmu_lock); | 1235 | spin_lock(&vcpu->kvm->mmu_lock); |
1247 | #ifdef CONFIG_X86_64 | ||
1248 | if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL) { | 1236 | if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL) { |
1249 | hpa_t root = vcpu->arch.mmu.root_hpa; | 1237 | hpa_t root = vcpu->arch.mmu.root_hpa; |
1250 | 1238 | ||
@@ -1256,7 +1244,6 @@ static void mmu_free_roots(struct kvm_vcpu *vcpu) | |||
1256 | spin_unlock(&vcpu->kvm->mmu_lock); | 1244 | spin_unlock(&vcpu->kvm->mmu_lock); |
1257 | return; | 1245 | return; |
1258 | } | 1246 | } |
1259 | #endif | ||
1260 | for (i = 0; i < 4; ++i) { | 1247 | for (i = 0; i < 4; ++i) { |
1261 | hpa_t root = vcpu->arch.mmu.pae_root[i]; | 1248 | hpa_t root = vcpu->arch.mmu.pae_root[i]; |
1262 | 1249 | ||
@@ -1282,7 +1269,6 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu) | |||
1282 | 1269 | ||
1283 | root_gfn = vcpu->arch.cr3 >> PAGE_SHIFT; | 1270 | root_gfn = vcpu->arch.cr3 >> PAGE_SHIFT; |
1284 | 1271 | ||
1285 | #ifdef CONFIG_X86_64 | ||
1286 | if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL) { | 1272 | if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL) { |
1287 | hpa_t root = vcpu->arch.mmu.root_hpa; | 1273 | hpa_t root = vcpu->arch.mmu.root_hpa; |
1288 | 1274 | ||
@@ -1297,7 +1283,6 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu) | |||
1297 | vcpu->arch.mmu.root_hpa = root; | 1283 | vcpu->arch.mmu.root_hpa = root; |
1298 | return; | 1284 | return; |
1299 | } | 1285 | } |
1300 | #endif | ||
1301 | metaphysical = !is_paging(vcpu); | 1286 | metaphysical = !is_paging(vcpu); |
1302 | if (tdp_enabled) | 1287 | if (tdp_enabled) |
1303 | metaphysical = 1; | 1288 | metaphysical = 1; |
@@ -1377,7 +1362,7 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa, | |||
1377 | spin_lock(&vcpu->kvm->mmu_lock); | 1362 | spin_lock(&vcpu->kvm->mmu_lock); |
1378 | kvm_mmu_free_some_pages(vcpu); | 1363 | kvm_mmu_free_some_pages(vcpu); |
1379 | r = __direct_map(vcpu, gpa, error_code & PFERR_WRITE_MASK, | 1364 | r = __direct_map(vcpu, gpa, error_code & PFERR_WRITE_MASK, |
1380 | largepage, gfn, pfn, TDP_ROOT_LEVEL); | 1365 | largepage, gfn, pfn, kvm_x86_ops->get_tdp_level()); |
1381 | spin_unlock(&vcpu->kvm->mmu_lock); | 1366 | spin_unlock(&vcpu->kvm->mmu_lock); |
1382 | 1367 | ||
1383 | return r; | 1368 | return r; |
@@ -1484,7 +1469,7 @@ static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) | |||
1484 | context->page_fault = tdp_page_fault; | 1469 | context->page_fault = tdp_page_fault; |
1485 | context->free = nonpaging_free; | 1470 | context->free = nonpaging_free; |
1486 | context->prefetch_page = nonpaging_prefetch_page; | 1471 | context->prefetch_page = nonpaging_prefetch_page; |
1487 | context->shadow_root_level = TDP_ROOT_LEVEL; | 1472 | context->shadow_root_level = kvm_x86_ops->get_tdp_level(); |
1488 | context->root_hpa = INVALID_PAGE; | 1473 | context->root_hpa = INVALID_PAGE; |
1489 | 1474 | ||
1490 | if (!is_paging(vcpu)) { | 1475 | if (!is_paging(vcpu)) { |
@@ -1633,7 +1618,7 @@ static bool last_updated_pte_accessed(struct kvm_vcpu *vcpu) | |||
1633 | { | 1618 | { |
1634 | u64 *spte = vcpu->arch.last_pte_updated; | 1619 | u64 *spte = vcpu->arch.last_pte_updated; |
1635 | 1620 | ||
1636 | return !!(spte && (*spte & PT_ACCESSED_MASK)); | 1621 | return !!(spte && (*spte & shadow_accessed_mask)); |
1637 | } | 1622 | } |
1638 | 1623 | ||
1639 | static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, | 1624 | static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, |
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index e64e9f56a65..1730757bbc7 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h | |||
@@ -3,11 +3,38 @@ | |||
3 | 3 | ||
4 | #include <linux/kvm_host.h> | 4 | #include <linux/kvm_host.h> |
5 | 5 | ||
6 | #ifdef CONFIG_X86_64 | 6 | #define PT64_PT_BITS 9 |
7 | #define TDP_ROOT_LEVEL PT64_ROOT_LEVEL | 7 | #define PT64_ENT_PER_PAGE (1 << PT64_PT_BITS) |
8 | #else | 8 | #define PT32_PT_BITS 10 |
9 | #define TDP_ROOT_LEVEL PT32E_ROOT_LEVEL | 9 | #define PT32_ENT_PER_PAGE (1 << PT32_PT_BITS) |
10 | #endif | 10 | |
11 | #define PT_WRITABLE_SHIFT 1 | ||
12 | |||
13 | #define PT_PRESENT_MASK (1ULL << 0) | ||
14 | #define PT_WRITABLE_MASK (1ULL << PT_WRITABLE_SHIFT) | ||
15 | #define PT_USER_MASK (1ULL << 2) | ||
16 | #define PT_PWT_MASK (1ULL << 3) | ||
17 | #define PT_PCD_MASK (1ULL << 4) | ||
18 | #define PT_ACCESSED_MASK (1ULL << 5) | ||
19 | #define PT_DIRTY_MASK (1ULL << 6) | ||
20 | #define PT_PAGE_SIZE_MASK (1ULL << 7) | ||
21 | #define PT_PAT_MASK (1ULL << 7) | ||
22 | #define PT_GLOBAL_MASK (1ULL << 8) | ||
23 | #define PT64_NX_SHIFT 63 | ||
24 | #define PT64_NX_MASK (1ULL << PT64_NX_SHIFT) | ||
25 | |||
26 | #define PT_PAT_SHIFT 7 | ||
27 | #define PT_DIR_PAT_SHIFT 12 | ||
28 | #define PT_DIR_PAT_MASK (1ULL << PT_DIR_PAT_SHIFT) | ||
29 | |||
30 | #define PT32_DIR_PSE36_SIZE 4 | ||
31 | #define PT32_DIR_PSE36_SHIFT 13 | ||
32 | #define PT32_DIR_PSE36_MASK \ | ||
33 | (((1ULL << PT32_DIR_PSE36_SIZE) - 1) << PT32_DIR_PSE36_SHIFT) | ||
34 | |||
35 | #define PT64_ROOT_LEVEL 4 | ||
36 | #define PT32_ROOT_LEVEL 2 | ||
37 | #define PT32E_ROOT_LEVEL 3 | ||
11 | 38 | ||
12 | static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) | 39 | static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) |
13 | { | 40 | { |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 89e0be2c10d..ab22615eee8 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -1863,6 +1863,15 @@ static bool svm_cpu_has_accelerated_tpr(void) | |||
1863 | return false; | 1863 | return false; |
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | static int get_npt_level(void) | ||
1867 | { | ||
1868 | #ifdef CONFIG_X86_64 | ||
1869 | return PT64_ROOT_LEVEL; | ||
1870 | #else | ||
1871 | return PT32E_ROOT_LEVEL; | ||
1872 | #endif | ||
1873 | } | ||
1874 | |||
1866 | static struct kvm_x86_ops svm_x86_ops = { | 1875 | static struct kvm_x86_ops svm_x86_ops = { |
1867 | .cpu_has_kvm_support = has_svm, | 1876 | .cpu_has_kvm_support = has_svm, |
1868 | .disabled_by_bios = is_disabled, | 1877 | .disabled_by_bios = is_disabled, |
@@ -1920,6 +1929,7 @@ static struct kvm_x86_ops svm_x86_ops = { | |||
1920 | .inject_pending_vectors = do_interrupt_requests, | 1929 | .inject_pending_vectors = do_interrupt_requests, |
1921 | 1930 | ||
1922 | .set_tss_addr = svm_set_tss_addr, | 1931 | .set_tss_addr = svm_set_tss_addr, |
1932 | .get_tdp_level = get_npt_level, | ||
1923 | }; | 1933 | }; |
1924 | 1934 | ||
1925 | static int __init svm_init(void) | 1935 | static int __init svm_init(void) |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 8e5d6645b90..bfe4db11989 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -42,6 +42,9 @@ module_param(enable_vpid, bool, 0); | |||
42 | static int flexpriority_enabled = 1; | 42 | static int flexpriority_enabled = 1; |
43 | module_param(flexpriority_enabled, bool, 0); | 43 | module_param(flexpriority_enabled, bool, 0); |
44 | 44 | ||
45 | static int enable_ept = 1; | ||
46 | module_param(enable_ept, bool, 0); | ||
47 | |||
45 | struct vmcs { | 48 | struct vmcs { |
46 | u32 revision_id; | 49 | u32 revision_id; |
47 | u32 abort; | 50 | u32 abort; |
@@ -84,7 +87,7 @@ static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu) | |||
84 | return container_of(vcpu, struct vcpu_vmx, vcpu); | 87 | return container_of(vcpu, struct vcpu_vmx, vcpu); |
85 | } | 88 | } |
86 | 89 | ||
87 | static int init_rmode_tss(struct kvm *kvm); | 90 | static int init_rmode(struct kvm *kvm); |
88 | 91 | ||
89 | static DEFINE_PER_CPU(struct vmcs *, vmxarea); | 92 | static DEFINE_PER_CPU(struct vmcs *, vmxarea); |
90 | static DEFINE_PER_CPU(struct vmcs *, current_vmcs); | 93 | static DEFINE_PER_CPU(struct vmcs *, current_vmcs); |
@@ -107,6 +110,11 @@ static struct vmcs_config { | |||
107 | u32 vmentry_ctrl; | 110 | u32 vmentry_ctrl; |
108 | } vmcs_config; | 111 | } vmcs_config; |
109 | 112 | ||
113 | struct vmx_capability { | ||
114 | u32 ept; | ||
115 | u32 vpid; | ||
116 | } vmx_capability; | ||
117 | |||
110 | #define VMX_SEGMENT_FIELD(seg) \ | 118 | #define VMX_SEGMENT_FIELD(seg) \ |
111 | [VCPU_SREG_##seg] = { \ | 119 | [VCPU_SREG_##seg] = { \ |
112 | .selector = GUEST_##seg##_SELECTOR, \ | 120 | .selector = GUEST_##seg##_SELECTOR, \ |
@@ -214,6 +222,32 @@ static inline bool cpu_has_vmx_virtualize_apic_accesses(void) | |||
214 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES); | 222 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES); |
215 | } | 223 | } |
216 | 224 | ||
225 | static inline int cpu_has_vmx_invept_individual_addr(void) | ||
226 | { | ||
227 | return (!!(vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT)); | ||
228 | } | ||
229 | |||
230 | static inline int cpu_has_vmx_invept_context(void) | ||
231 | { | ||
232 | return (!!(vmx_capability.ept & VMX_EPT_EXTENT_CONTEXT_BIT)); | ||
233 | } | ||
234 | |||
235 | static inline int cpu_has_vmx_invept_global(void) | ||
236 | { | ||
237 | return (!!(vmx_capability.ept & VMX_EPT_EXTENT_GLOBAL_BIT)); | ||
238 | } | ||
239 | |||
240 | static inline int cpu_has_vmx_ept(void) | ||
241 | { | ||
242 | return (vmcs_config.cpu_based_2nd_exec_ctrl & | ||
243 | SECONDARY_EXEC_ENABLE_EPT); | ||
244 | } | ||
245 | |||
246 | static inline int vm_need_ept(void) | ||
247 | { | ||
248 | return (cpu_has_vmx_ept() && enable_ept); | ||
249 | } | ||
250 | |||
217 | static inline int vm_need_virtualize_apic_accesses(struct kvm *kvm) | 251 | static inline int vm_need_virtualize_apic_accesses(struct kvm *kvm) |
218 | { | 252 | { |
219 | return ((cpu_has_vmx_virtualize_apic_accesses()) && | 253 | return ((cpu_has_vmx_virtualize_apic_accesses()) && |
@@ -250,6 +284,18 @@ static inline void __invvpid(int ext, u16 vpid, gva_t gva) | |||
250 | : : "a"(&operand), "c"(ext) : "cc", "memory"); | 284 | : : "a"(&operand), "c"(ext) : "cc", "memory"); |
251 | } | 285 | } |
252 | 286 | ||
287 | static inline void __invept(int ext, u64 eptp, gpa_t gpa) | ||
288 | { | ||
289 | struct { | ||
290 | u64 eptp, gpa; | ||
291 | } operand = {eptp, gpa}; | ||
292 | |||
293 | asm volatile (ASM_VMX_INVEPT | ||
294 | /* CF==1 or ZF==1 --> rc = -1 */ | ||
295 | "; ja 1f ; ud2 ; 1:\n" | ||
296 | : : "a" (&operand), "c" (ext) : "cc", "memory"); | ||
297 | } | ||
298 | |||
253 | static struct kvm_msr_entry *find_msr_entry(struct vcpu_vmx *vmx, u32 msr) | 299 | static struct kvm_msr_entry *find_msr_entry(struct vcpu_vmx *vmx, u32 msr) |
254 | { | 300 | { |
255 | int i; | 301 | int i; |
@@ -301,6 +347,33 @@ static inline void vpid_sync_vcpu_all(struct vcpu_vmx *vmx) | |||
301 | __invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0); | 347 | __invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0); |
302 | } | 348 | } |
303 | 349 | ||
350 | static inline void ept_sync_global(void) | ||
351 | { | ||
352 | if (cpu_has_vmx_invept_global()) | ||
353 | __invept(VMX_EPT_EXTENT_GLOBAL, 0, 0); | ||
354 | } | ||
355 | |||
356 | static inline void ept_sync_context(u64 eptp) | ||
357 | { | ||
358 | if (vm_need_ept()) { | ||
359 | if (cpu_has_vmx_invept_context()) | ||
360 | __invept(VMX_EPT_EXTENT_CONTEXT, eptp, 0); | ||
361 | else | ||
362 | ept_sync_global(); | ||
363 | } | ||
364 | } | ||
365 | |||
366 | static inline void ept_sync_individual_addr(u64 eptp, gpa_t gpa) | ||
367 | { | ||
368 | if (vm_need_ept()) { | ||
369 | if (cpu_has_vmx_invept_individual_addr()) | ||
370 | __invept(VMX_EPT_EXTENT_INDIVIDUAL_ADDR, | ||
371 | eptp, gpa); | ||
372 | else | ||
373 | ept_sync_context(eptp); | ||
374 | } | ||
375 | } | ||
376 | |||
304 | static unsigned long vmcs_readl(unsigned long field) | 377 | static unsigned long vmcs_readl(unsigned long field) |
305 | { | 378 | { |
306 | unsigned long value; | 379 | unsigned long value; |
@@ -388,6 +461,8 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu) | |||
388 | eb |= 1u << 1; | 461 | eb |= 1u << 1; |
389 | if (vcpu->arch.rmode.active) | 462 | if (vcpu->arch.rmode.active) |
390 | eb = ~0; | 463 | eb = ~0; |
464 | if (vm_need_ept()) | ||
465 | eb &= ~(1u << PF_VECTOR); /* bypass_guest_pf = 0 */ | ||
391 | vmcs_write32(EXCEPTION_BITMAP, eb); | 466 | vmcs_write32(EXCEPTION_BITMAP, eb); |
392 | } | 467 | } |
393 | 468 | ||
@@ -985,7 +1060,7 @@ static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt, | |||
985 | static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) | 1060 | static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) |
986 | { | 1061 | { |
987 | u32 vmx_msr_low, vmx_msr_high; | 1062 | u32 vmx_msr_low, vmx_msr_high; |
988 | u32 min, opt; | 1063 | u32 min, opt, min2, opt2; |
989 | u32 _pin_based_exec_control = 0; | 1064 | u32 _pin_based_exec_control = 0; |
990 | u32 _cpu_based_exec_control = 0; | 1065 | u32 _cpu_based_exec_control = 0; |
991 | u32 _cpu_based_2nd_exec_control = 0; | 1066 | u32 _cpu_based_2nd_exec_control = 0; |
@@ -1003,6 +1078,8 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) | |||
1003 | CPU_BASED_CR8_LOAD_EXITING | | 1078 | CPU_BASED_CR8_LOAD_EXITING | |
1004 | CPU_BASED_CR8_STORE_EXITING | | 1079 | CPU_BASED_CR8_STORE_EXITING | |
1005 | #endif | 1080 | #endif |
1081 | CPU_BASED_CR3_LOAD_EXITING | | ||
1082 | CPU_BASED_CR3_STORE_EXITING | | ||
1006 | CPU_BASED_USE_IO_BITMAPS | | 1083 | CPU_BASED_USE_IO_BITMAPS | |
1007 | CPU_BASED_MOV_DR_EXITING | | 1084 | CPU_BASED_MOV_DR_EXITING | |
1008 | CPU_BASED_USE_TSC_OFFSETING; | 1085 | CPU_BASED_USE_TSC_OFFSETING; |
@@ -1018,11 +1095,13 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) | |||
1018 | ~CPU_BASED_CR8_STORE_EXITING; | 1095 | ~CPU_BASED_CR8_STORE_EXITING; |
1019 | #endif | 1096 | #endif |
1020 | if (_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) { | 1097 | if (_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) { |
1021 | min = 0; | 1098 | min2 = 0; |
1022 | opt = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | | 1099 | opt2 = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | |
1023 | SECONDARY_EXEC_WBINVD_EXITING | | 1100 | SECONDARY_EXEC_WBINVD_EXITING | |
1024 | SECONDARY_EXEC_ENABLE_VPID; | 1101 | SECONDARY_EXEC_ENABLE_VPID | |
1025 | if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS2, | 1102 | SECONDARY_EXEC_ENABLE_EPT; |
1103 | if (adjust_vmx_controls(min2, opt2, | ||
1104 | MSR_IA32_VMX_PROCBASED_CTLS2, | ||
1026 | &_cpu_based_2nd_exec_control) < 0) | 1105 | &_cpu_based_2nd_exec_control) < 0) |
1027 | return -EIO; | 1106 | return -EIO; |
1028 | } | 1107 | } |
@@ -1031,6 +1110,16 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) | |||
1031 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) | 1110 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) |
1032 | _cpu_based_exec_control &= ~CPU_BASED_TPR_SHADOW; | 1111 | _cpu_based_exec_control &= ~CPU_BASED_TPR_SHADOW; |
1033 | #endif | 1112 | #endif |
1113 | if (_cpu_based_2nd_exec_control & SECONDARY_EXEC_ENABLE_EPT) { | ||
1114 | /* CR3 accesses don't need to cause VM Exits when EPT enabled */ | ||
1115 | min &= ~(CPU_BASED_CR3_LOAD_EXITING | | ||
1116 | CPU_BASED_CR3_STORE_EXITING); | ||
1117 | if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS, | ||
1118 | &_cpu_based_exec_control) < 0) | ||
1119 | return -EIO; | ||
1120 | rdmsr(MSR_IA32_VMX_EPT_VPID_CAP, | ||
1121 | vmx_capability.ept, vmx_capability.vpid); | ||
1122 | } | ||
1034 | 1123 | ||
1035 | min = 0; | 1124 | min = 0; |
1036 | #ifdef CONFIG_X86_64 | 1125 | #ifdef CONFIG_X86_64 |
@@ -1256,7 +1345,7 @@ static void enter_rmode(struct kvm_vcpu *vcpu) | |||
1256 | fix_rmode_seg(VCPU_SREG_FS, &vcpu->arch.rmode.fs); | 1345 | fix_rmode_seg(VCPU_SREG_FS, &vcpu->arch.rmode.fs); |
1257 | 1346 | ||
1258 | kvm_mmu_reset_context(vcpu); | 1347 | kvm_mmu_reset_context(vcpu); |
1259 | init_rmode_tss(vcpu->kvm); | 1348 | init_rmode(vcpu->kvm); |
1260 | } | 1349 | } |
1261 | 1350 | ||
1262 | #ifdef CONFIG_X86_64 | 1351 | #ifdef CONFIG_X86_64 |
@@ -1304,8 +1393,64 @@ static void vmx_decache_cr4_guest_bits(struct kvm_vcpu *vcpu) | |||
1304 | vcpu->arch.cr4 |= vmcs_readl(GUEST_CR4) & ~KVM_GUEST_CR4_MASK; | 1393 | vcpu->arch.cr4 |= vmcs_readl(GUEST_CR4) & ~KVM_GUEST_CR4_MASK; |
1305 | } | 1394 | } |
1306 | 1395 | ||
1396 | static void ept_load_pdptrs(struct kvm_vcpu *vcpu) | ||
1397 | { | ||
1398 | if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) { | ||
1399 | if (!load_pdptrs(vcpu, vcpu->arch.cr3)) { | ||
1400 | printk(KERN_ERR "EPT: Fail to load pdptrs!\n"); | ||
1401 | return; | ||
1402 | } | ||
1403 | vmcs_write64(GUEST_PDPTR0, vcpu->arch.pdptrs[0]); | ||
1404 | vmcs_write64(GUEST_PDPTR1, vcpu->arch.pdptrs[1]); | ||
1405 | vmcs_write64(GUEST_PDPTR2, vcpu->arch.pdptrs[2]); | ||
1406 | vmcs_write64(GUEST_PDPTR3, vcpu->arch.pdptrs[3]); | ||
1407 | } | ||
1408 | } | ||
1409 | |||
1410 | static void vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4); | ||
1411 | |||
1412 | static void ept_update_paging_mode_cr0(unsigned long *hw_cr0, | ||
1413 | unsigned long cr0, | ||
1414 | struct kvm_vcpu *vcpu) | ||
1415 | { | ||
1416 | if (!(cr0 & X86_CR0_PG)) { | ||
1417 | /* From paging/starting to nonpaging */ | ||
1418 | vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, | ||
1419 | vmcs_config.cpu_based_exec_ctrl | | ||
1420 | (CPU_BASED_CR3_LOAD_EXITING | | ||
1421 | CPU_BASED_CR3_STORE_EXITING)); | ||
1422 | vcpu->arch.cr0 = cr0; | ||
1423 | vmx_set_cr4(vcpu, vcpu->arch.cr4); | ||
1424 | *hw_cr0 |= X86_CR0_PE | X86_CR0_PG; | ||
1425 | *hw_cr0 &= ~X86_CR0_WP; | ||
1426 | } else if (!is_paging(vcpu)) { | ||
1427 | /* From nonpaging to paging */ | ||
1428 | vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, | ||
1429 | vmcs_config.cpu_based_exec_ctrl & | ||
1430 | ~(CPU_BASED_CR3_LOAD_EXITING | | ||
1431 | CPU_BASED_CR3_STORE_EXITING)); | ||
1432 | vcpu->arch.cr0 = cr0; | ||
1433 | vmx_set_cr4(vcpu, vcpu->arch.cr4); | ||
1434 | if (!(vcpu->arch.cr0 & X86_CR0_WP)) | ||
1435 | *hw_cr0 &= ~X86_CR0_WP; | ||
1436 | } | ||
1437 | } | ||
1438 | |||
1439 | static void ept_update_paging_mode_cr4(unsigned long *hw_cr4, | ||
1440 | struct kvm_vcpu *vcpu) | ||
1441 | { | ||
1442 | if (!is_paging(vcpu)) { | ||
1443 | *hw_cr4 &= ~X86_CR4_PAE; | ||
1444 | *hw_cr4 |= X86_CR4_PSE; | ||
1445 | } else if (!(vcpu->arch.cr4 & X86_CR4_PAE)) | ||
1446 | *hw_cr4 &= ~X86_CR4_PAE; | ||
1447 | } | ||
1448 | |||
1307 | static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) | 1449 | static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) |
1308 | { | 1450 | { |
1451 | unsigned long hw_cr0 = (cr0 & ~KVM_GUEST_CR0_MASK) | | ||
1452 | KVM_VM_CR0_ALWAYS_ON; | ||
1453 | |||
1309 | vmx_fpu_deactivate(vcpu); | 1454 | vmx_fpu_deactivate(vcpu); |
1310 | 1455 | ||
1311 | if (vcpu->arch.rmode.active && (cr0 & X86_CR0_PE)) | 1456 | if (vcpu->arch.rmode.active && (cr0 & X86_CR0_PE)) |
@@ -1323,29 +1468,61 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) | |||
1323 | } | 1468 | } |
1324 | #endif | 1469 | #endif |
1325 | 1470 | ||
1471 | if (vm_need_ept()) | ||
1472 | ept_update_paging_mode_cr0(&hw_cr0, cr0, vcpu); | ||
1473 | |||
1326 | vmcs_writel(CR0_READ_SHADOW, cr0); | 1474 | vmcs_writel(CR0_READ_SHADOW, cr0); |
1327 | vmcs_writel(GUEST_CR0, | 1475 | vmcs_writel(GUEST_CR0, hw_cr0); |
1328 | (cr0 & ~KVM_GUEST_CR0_MASK) | KVM_VM_CR0_ALWAYS_ON); | ||
1329 | vcpu->arch.cr0 = cr0; | 1476 | vcpu->arch.cr0 = cr0; |
1330 | 1477 | ||
1331 | if (!(cr0 & X86_CR0_TS) || !(cr0 & X86_CR0_PE)) | 1478 | if (!(cr0 & X86_CR0_TS) || !(cr0 & X86_CR0_PE)) |
1332 | vmx_fpu_activate(vcpu); | 1479 | vmx_fpu_activate(vcpu); |
1333 | } | 1480 | } |
1334 | 1481 | ||
1482 | static u64 construct_eptp(unsigned long root_hpa) | ||
1483 | { | ||
1484 | u64 eptp; | ||
1485 | |||
1486 | /* TODO write the value reading from MSR */ | ||
1487 | eptp = VMX_EPT_DEFAULT_MT | | ||
1488 | VMX_EPT_DEFAULT_GAW << VMX_EPT_GAW_EPTP_SHIFT; | ||
1489 | eptp |= (root_hpa & PAGE_MASK); | ||
1490 | |||
1491 | return eptp; | ||
1492 | } | ||
1493 | |||
1335 | static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) | 1494 | static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) |
1336 | { | 1495 | { |
1496 | unsigned long guest_cr3; | ||
1497 | u64 eptp; | ||
1498 | |||
1499 | guest_cr3 = cr3; | ||
1500 | if (vm_need_ept()) { | ||
1501 | eptp = construct_eptp(cr3); | ||
1502 | vmcs_write64(EPT_POINTER, eptp); | ||
1503 | ept_sync_context(eptp); | ||
1504 | ept_load_pdptrs(vcpu); | ||
1505 | guest_cr3 = is_paging(vcpu) ? vcpu->arch.cr3 : | ||
1506 | VMX_EPT_IDENTITY_PAGETABLE_ADDR; | ||
1507 | } | ||
1508 | |||
1337 | vmx_flush_tlb(vcpu); | 1509 | vmx_flush_tlb(vcpu); |
1338 | vmcs_writel(GUEST_CR3, cr3); | 1510 | vmcs_writel(GUEST_CR3, guest_cr3); |
1339 | if (vcpu->arch.cr0 & X86_CR0_PE) | 1511 | if (vcpu->arch.cr0 & X86_CR0_PE) |
1340 | vmx_fpu_deactivate(vcpu); | 1512 | vmx_fpu_deactivate(vcpu); |
1341 | } | 1513 | } |
1342 | 1514 | ||
1343 | static void vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | 1515 | static void vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) |
1344 | { | 1516 | { |
1345 | vmcs_writel(CR4_READ_SHADOW, cr4); | 1517 | unsigned long hw_cr4 = cr4 | (vcpu->arch.rmode.active ? |
1346 | vmcs_writel(GUEST_CR4, cr4 | (vcpu->arch.rmode.active ? | 1518 | KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON); |
1347 | KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON)); | 1519 | |
1348 | vcpu->arch.cr4 = cr4; | 1520 | vcpu->arch.cr4 = cr4; |
1521 | if (vm_need_ept()) | ||
1522 | ept_update_paging_mode_cr4(&hw_cr4, vcpu); | ||
1523 | |||
1524 | vmcs_writel(CR4_READ_SHADOW, cr4); | ||
1525 | vmcs_writel(GUEST_CR4, hw_cr4); | ||
1349 | } | 1526 | } |
1350 | 1527 | ||
1351 | static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer) | 1528 | static void vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer) |
@@ -1530,6 +1707,41 @@ out: | |||
1530 | return ret; | 1707 | return ret; |
1531 | } | 1708 | } |
1532 | 1709 | ||
1710 | static int init_rmode_identity_map(struct kvm *kvm) | ||
1711 | { | ||
1712 | int i, r, ret; | ||
1713 | pfn_t identity_map_pfn; | ||
1714 | u32 tmp; | ||
1715 | |||
1716 | if (!vm_need_ept()) | ||
1717 | return 1; | ||
1718 | if (unlikely(!kvm->arch.ept_identity_pagetable)) { | ||
1719 | printk(KERN_ERR "EPT: identity-mapping pagetable " | ||
1720 | "haven't been allocated!\n"); | ||
1721 | return 0; | ||
1722 | } | ||
1723 | if (likely(kvm->arch.ept_identity_pagetable_done)) | ||
1724 | return 1; | ||
1725 | ret = 0; | ||
1726 | identity_map_pfn = VMX_EPT_IDENTITY_PAGETABLE_ADDR >> PAGE_SHIFT; | ||
1727 | r = kvm_clear_guest_page(kvm, identity_map_pfn, 0, PAGE_SIZE); | ||
1728 | if (r < 0) | ||
1729 | goto out; | ||
1730 | /* Set up identity-mapping pagetable for EPT in real mode */ | ||
1731 | for (i = 0; i < PT32_ENT_PER_PAGE; i++) { | ||
1732 | tmp = (i << 22) + (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | | ||
1733 | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE); | ||
1734 | r = kvm_write_guest_page(kvm, identity_map_pfn, | ||
1735 | &tmp, i * sizeof(tmp), sizeof(tmp)); | ||
1736 | if (r < 0) | ||
1737 | goto out; | ||
1738 | } | ||
1739 | kvm->arch.ept_identity_pagetable_done = true; | ||
1740 | ret = 1; | ||
1741 | out: | ||
1742 | return ret; | ||
1743 | } | ||
1744 | |||
1533 | static void seg_setup(int seg) | 1745 | static void seg_setup(int seg) |
1534 | { | 1746 | { |
1535 | struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; | 1747 | struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; |
@@ -1564,6 +1776,31 @@ out: | |||
1564 | return r; | 1776 | return r; |
1565 | } | 1777 | } |
1566 | 1778 | ||
1779 | static int alloc_identity_pagetable(struct kvm *kvm) | ||
1780 | { | ||
1781 | struct kvm_userspace_memory_region kvm_userspace_mem; | ||
1782 | int r = 0; | ||
1783 | |||
1784 | down_write(&kvm->slots_lock); | ||
1785 | if (kvm->arch.ept_identity_pagetable) | ||
1786 | goto out; | ||
1787 | kvm_userspace_mem.slot = IDENTITY_PAGETABLE_PRIVATE_MEMSLOT; | ||
1788 | kvm_userspace_mem.flags = 0; | ||
1789 | kvm_userspace_mem.guest_phys_addr = VMX_EPT_IDENTITY_PAGETABLE_ADDR; | ||
1790 | kvm_userspace_mem.memory_size = PAGE_SIZE; | ||
1791 | r = __kvm_set_memory_region(kvm, &kvm_userspace_mem, 0); | ||
1792 | if (r) | ||
1793 | goto out; | ||
1794 | |||
1795 | down_read(¤t->mm->mmap_sem); | ||
1796 | kvm->arch.ept_identity_pagetable = gfn_to_page(kvm, | ||
1797 | VMX_EPT_IDENTITY_PAGETABLE_ADDR >> PAGE_SHIFT); | ||
1798 | up_read(¤t->mm->mmap_sem); | ||
1799 | out: | ||
1800 | up_write(&kvm->slots_lock); | ||
1801 | return r; | ||
1802 | } | ||
1803 | |||
1567 | static void allocate_vpid(struct vcpu_vmx *vmx) | 1804 | static void allocate_vpid(struct vcpu_vmx *vmx) |
1568 | { | 1805 | { |
1569 | int vpid; | 1806 | int vpid; |
@@ -1638,6 +1875,9 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx) | |||
1638 | CPU_BASED_CR8_LOAD_EXITING; | 1875 | CPU_BASED_CR8_LOAD_EXITING; |
1639 | #endif | 1876 | #endif |
1640 | } | 1877 | } |
1878 | if (!vm_need_ept()) | ||
1879 | exec_control |= CPU_BASED_CR3_STORE_EXITING | | ||
1880 | CPU_BASED_CR3_LOAD_EXITING; | ||
1641 | vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, exec_control); | 1881 | vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, exec_control); |
1642 | 1882 | ||
1643 | if (cpu_has_secondary_exec_ctrls()) { | 1883 | if (cpu_has_secondary_exec_ctrls()) { |
@@ -1647,6 +1887,8 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx) | |||
1647 | ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; | 1887 | ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; |
1648 | if (vmx->vpid == 0) | 1888 | if (vmx->vpid == 0) |
1649 | exec_control &= ~SECONDARY_EXEC_ENABLE_VPID; | 1889 | exec_control &= ~SECONDARY_EXEC_ENABLE_VPID; |
1890 | if (!vm_need_ept()) | ||
1891 | exec_control &= ~SECONDARY_EXEC_ENABLE_EPT; | ||
1650 | vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control); | 1892 | vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control); |
1651 | } | 1893 | } |
1652 | 1894 | ||
@@ -1722,6 +1964,15 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx) | |||
1722 | return 0; | 1964 | return 0; |
1723 | } | 1965 | } |
1724 | 1966 | ||
1967 | static int init_rmode(struct kvm *kvm) | ||
1968 | { | ||
1969 | if (!init_rmode_tss(kvm)) | ||
1970 | return 0; | ||
1971 | if (!init_rmode_identity_map(kvm)) | ||
1972 | return 0; | ||
1973 | return 1; | ||
1974 | } | ||
1975 | |||
1725 | static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) | 1976 | static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) |
1726 | { | 1977 | { |
1727 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 1978 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
@@ -1729,7 +1980,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
1729 | int ret; | 1980 | int ret; |
1730 | 1981 | ||
1731 | down_read(&vcpu->kvm->slots_lock); | 1982 | down_read(&vcpu->kvm->slots_lock); |
1732 | if (!init_rmode_tss(vmx->vcpu.kvm)) { | 1983 | if (!init_rmode(vmx->vcpu.kvm)) { |
1733 | ret = -ENOMEM; | 1984 | ret = -ENOMEM; |
1734 | goto out; | 1985 | goto out; |
1735 | } | 1986 | } |
@@ -1994,6 +2245,9 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1994 | if (intr_info & INTR_INFO_DELIVER_CODE_MASK) | 2245 | if (intr_info & INTR_INFO_DELIVER_CODE_MASK) |
1995 | error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE); | 2246 | error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE); |
1996 | if (is_page_fault(intr_info)) { | 2247 | if (is_page_fault(intr_info)) { |
2248 | /* EPT won't cause page fault directly */ | ||
2249 | if (vm_need_ept()) | ||
2250 | BUG(); | ||
1997 | cr2 = vmcs_readl(EXIT_QUALIFICATION); | 2251 | cr2 = vmcs_readl(EXIT_QUALIFICATION); |
1998 | KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2, | 2252 | KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2, |
1999 | (u32)((u64)cr2 >> 32), handler); | 2253 | (u32)((u64)cr2 >> 32), handler); |
@@ -2323,6 +2577,64 @@ static int handle_task_switch(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
2323 | return kvm_task_switch(vcpu, tss_selector, reason); | 2577 | return kvm_task_switch(vcpu, tss_selector, reason); |
2324 | } | 2578 | } |
2325 | 2579 | ||
2580 | static int handle_ept_violation(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | ||
2581 | { | ||
2582 | u64 exit_qualification; | ||
2583 | enum emulation_result er; | ||
2584 | gpa_t gpa; | ||
2585 | unsigned long hva; | ||
2586 | int gla_validity; | ||
2587 | int r; | ||
2588 | |||
2589 | exit_qualification = vmcs_read64(EXIT_QUALIFICATION); | ||
2590 | |||
2591 | if (exit_qualification & (1 << 6)) { | ||
2592 | printk(KERN_ERR "EPT: GPA exceeds GAW!\n"); | ||
2593 | return -ENOTSUPP; | ||
2594 | } | ||
2595 | |||
2596 | gla_validity = (exit_qualification >> 7) & 0x3; | ||
2597 | if (gla_validity != 0x3 && gla_validity != 0x1 && gla_validity != 0) { | ||
2598 | printk(KERN_ERR "EPT: Handling EPT violation failed!\n"); | ||
2599 | printk(KERN_ERR "EPT: GPA: 0x%lx, GVA: 0x%lx\n", | ||
2600 | (long unsigned int)vmcs_read64(GUEST_PHYSICAL_ADDRESS), | ||
2601 | (long unsigned int)vmcs_read64(GUEST_LINEAR_ADDRESS)); | ||
2602 | printk(KERN_ERR "EPT: Exit qualification is 0x%lx\n", | ||
2603 | (long unsigned int)exit_qualification); | ||
2604 | kvm_run->exit_reason = KVM_EXIT_UNKNOWN; | ||
2605 | kvm_run->hw.hardware_exit_reason = 0; | ||
2606 | return -ENOTSUPP; | ||
2607 | } | ||
2608 | |||
2609 | gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS); | ||
2610 | hva = gfn_to_hva(vcpu->kvm, gpa >> PAGE_SHIFT); | ||
2611 | if (!kvm_is_error_hva(hva)) { | ||
2612 | r = kvm_mmu_page_fault(vcpu, gpa & PAGE_MASK, 0); | ||
2613 | if (r < 0) { | ||
2614 | printk(KERN_ERR "EPT: Not enough memory!\n"); | ||
2615 | return -ENOMEM; | ||
2616 | } | ||
2617 | return 1; | ||
2618 | } else { | ||
2619 | /* must be MMIO */ | ||
2620 | er = emulate_instruction(vcpu, kvm_run, 0, 0, 0); | ||
2621 | |||
2622 | if (er == EMULATE_FAIL) { | ||
2623 | printk(KERN_ERR | ||
2624 | "EPT: Fail to handle EPT violation vmexit!er is %d\n", | ||
2625 | er); | ||
2626 | printk(KERN_ERR "EPT: GPA: 0x%lx, GVA: 0x%lx\n", | ||
2627 | (long unsigned int)vmcs_read64(GUEST_PHYSICAL_ADDRESS), | ||
2628 | (long unsigned int)vmcs_read64(GUEST_LINEAR_ADDRESS)); | ||
2629 | printk(KERN_ERR "EPT: Exit qualification is 0x%lx\n", | ||
2630 | (long unsigned int)exit_qualification); | ||
2631 | return -ENOTSUPP; | ||
2632 | } else if (er == EMULATE_DO_MMIO) | ||
2633 | return 0; | ||
2634 | } | ||
2635 | return 1; | ||
2636 | } | ||
2637 | |||
2326 | /* | 2638 | /* |
2327 | * The exit handlers return 1 if the exit was handled fully and guest execution | 2639 | * The exit handlers return 1 if the exit was handled fully and guest execution |
2328 | * may resume. Otherwise they set the kvm_run parameter to indicate what needs | 2640 | * may resume. Otherwise they set the kvm_run parameter to indicate what needs |
@@ -2346,6 +2658,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu, | |||
2346 | [EXIT_REASON_APIC_ACCESS] = handle_apic_access, | 2658 | [EXIT_REASON_APIC_ACCESS] = handle_apic_access, |
2347 | [EXIT_REASON_WBINVD] = handle_wbinvd, | 2659 | [EXIT_REASON_WBINVD] = handle_wbinvd, |
2348 | [EXIT_REASON_TASK_SWITCH] = handle_task_switch, | 2660 | [EXIT_REASON_TASK_SWITCH] = handle_task_switch, |
2661 | [EXIT_REASON_EPT_VIOLATION] = handle_ept_violation, | ||
2349 | }; | 2662 | }; |
2350 | 2663 | ||
2351 | static const int kvm_vmx_max_exit_handlers = | 2664 | static const int kvm_vmx_max_exit_handlers = |
@@ -2364,6 +2677,13 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) | |||
2364 | KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)vmcs_readl(GUEST_RIP), | 2677 | KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)vmcs_readl(GUEST_RIP), |
2365 | (u32)((u64)vmcs_readl(GUEST_RIP) >> 32), entryexit); | 2678 | (u32)((u64)vmcs_readl(GUEST_RIP) >> 32), entryexit); |
2366 | 2679 | ||
2680 | /* Access CR3 don't cause VMExit in paging mode, so we need | ||
2681 | * to sync with guest real CR3. */ | ||
2682 | if (vm_need_ept() && is_paging(vcpu)) { | ||
2683 | vcpu->arch.cr3 = vmcs_readl(GUEST_CR3); | ||
2684 | ept_load_pdptrs(vcpu); | ||
2685 | } | ||
2686 | |||
2367 | if (unlikely(vmx->fail)) { | 2687 | if (unlikely(vmx->fail)) { |
2368 | kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; | 2688 | kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; |
2369 | kvm_run->fail_entry.hardware_entry_failure_reason | 2689 | kvm_run->fail_entry.hardware_entry_failure_reason |
@@ -2372,7 +2692,8 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) | |||
2372 | } | 2692 | } |
2373 | 2693 | ||
2374 | if ((vectoring_info & VECTORING_INFO_VALID_MASK) && | 2694 | if ((vectoring_info & VECTORING_INFO_VALID_MASK) && |
2375 | exit_reason != EXIT_REASON_EXCEPTION_NMI) | 2695 | (exit_reason != EXIT_REASON_EXCEPTION_NMI && |
2696 | exit_reason != EXIT_REASON_EPT_VIOLATION)) | ||
2376 | printk(KERN_WARNING "%s: unexpected, valid vectoring info and " | 2697 | printk(KERN_WARNING "%s: unexpected, valid vectoring info and " |
2377 | "exit reason is 0x%x\n", __func__, exit_reason); | 2698 | "exit reason is 0x%x\n", __func__, exit_reason); |
2378 | if (exit_reason < kvm_vmx_max_exit_handlers | 2699 | if (exit_reason < kvm_vmx_max_exit_handlers |
@@ -2674,6 +2995,15 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) | |||
2674 | return ERR_PTR(-ENOMEM); | 2995 | return ERR_PTR(-ENOMEM); |
2675 | 2996 | ||
2676 | allocate_vpid(vmx); | 2997 | allocate_vpid(vmx); |
2998 | if (id == 0 && vm_need_ept()) { | ||
2999 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | ||
3000 | VMX_EPT_WRITABLE_MASK | | ||
3001 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | ||
3002 | kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK, | ||
3003 | VMX_EPT_FAKE_DIRTY_MASK, 0ull, | ||
3004 | VMX_EPT_EXECUTABLE_MASK); | ||
3005 | kvm_enable_tdp(); | ||
3006 | } | ||
2677 | 3007 | ||
2678 | err = kvm_vcpu_init(&vmx->vcpu, kvm, id); | 3008 | err = kvm_vcpu_init(&vmx->vcpu, kvm, id); |
2679 | if (err) | 3009 | if (err) |
@@ -2706,6 +3036,10 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) | |||
2706 | if (alloc_apic_access_page(kvm) != 0) | 3036 | if (alloc_apic_access_page(kvm) != 0) |
2707 | goto free_vmcs; | 3037 | goto free_vmcs; |
2708 | 3038 | ||
3039 | if (vm_need_ept()) | ||
3040 | if (alloc_identity_pagetable(kvm) != 0) | ||
3041 | goto free_vmcs; | ||
3042 | |||
2709 | return &vmx->vcpu; | 3043 | return &vmx->vcpu; |
2710 | 3044 | ||
2711 | free_vmcs: | 3045 | free_vmcs: |
@@ -2735,6 +3069,11 @@ static void __init vmx_check_processor_compat(void *rtn) | |||
2735 | } | 3069 | } |
2736 | } | 3070 | } |
2737 | 3071 | ||
3072 | static int get_ept_level(void) | ||
3073 | { | ||
3074 | return VMX_EPT_DEFAULT_GAW + 1; | ||
3075 | } | ||
3076 | |||
2738 | static struct kvm_x86_ops vmx_x86_ops = { | 3077 | static struct kvm_x86_ops vmx_x86_ops = { |
2739 | .cpu_has_kvm_support = cpu_has_kvm_support, | 3078 | .cpu_has_kvm_support = cpu_has_kvm_support, |
2740 | .disabled_by_bios = vmx_disabled_by_bios, | 3079 | .disabled_by_bios = vmx_disabled_by_bios, |
@@ -2791,6 +3130,7 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
2791 | .inject_pending_vectors = do_interrupt_requests, | 3130 | .inject_pending_vectors = do_interrupt_requests, |
2792 | 3131 | ||
2793 | .set_tss_addr = vmx_set_tss_addr, | 3132 | .set_tss_addr = vmx_set_tss_addr, |
3133 | .get_tdp_level = get_ept_level, | ||
2794 | }; | 3134 | }; |
2795 | 3135 | ||
2796 | static int __init vmx_init(void) | 3136 | static int __init vmx_init(void) |
@@ -2843,9 +3183,14 @@ static int __init vmx_init(void) | |||
2843 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_ESP); | 3183 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_ESP); |
2844 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_EIP); | 3184 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_EIP); |
2845 | 3185 | ||
3186 | if (cpu_has_vmx_ept()) | ||
3187 | bypass_guest_pf = 0; | ||
3188 | |||
2846 | if (bypass_guest_pf) | 3189 | if (bypass_guest_pf) |
2847 | kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull); | 3190 | kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull); |
2848 | 3191 | ||
3192 | ept_sync_global(); | ||
3193 | |||
2849 | return 0; | 3194 | return 0; |
2850 | 3195 | ||
2851 | out2: | 3196 | out2: |
diff --git a/arch/x86/kvm/vmx.h b/arch/x86/kvm/vmx.h index 5dff4606b98..79d94c610df 100644 --- a/arch/x86/kvm/vmx.h +++ b/arch/x86/kvm/vmx.h | |||
@@ -35,6 +35,8 @@ | |||
35 | #define CPU_BASED_MWAIT_EXITING 0x00000400 | 35 | #define CPU_BASED_MWAIT_EXITING 0x00000400 |
36 | #define CPU_BASED_RDPMC_EXITING 0x00000800 | 36 | #define CPU_BASED_RDPMC_EXITING 0x00000800 |
37 | #define CPU_BASED_RDTSC_EXITING 0x00001000 | 37 | #define CPU_BASED_RDTSC_EXITING 0x00001000 |
38 | #define CPU_BASED_CR3_LOAD_EXITING 0x00008000 | ||
39 | #define CPU_BASED_CR3_STORE_EXITING 0x00010000 | ||
38 | #define CPU_BASED_CR8_LOAD_EXITING 0x00080000 | 40 | #define CPU_BASED_CR8_LOAD_EXITING 0x00080000 |
39 | #define CPU_BASED_CR8_STORE_EXITING 0x00100000 | 41 | #define CPU_BASED_CR8_STORE_EXITING 0x00100000 |
40 | #define CPU_BASED_TPR_SHADOW 0x00200000 | 42 | #define CPU_BASED_TPR_SHADOW 0x00200000 |
@@ -49,6 +51,7 @@ | |||
49 | * Definitions of Secondary Processor-Based VM-Execution Controls. | 51 | * Definitions of Secondary Processor-Based VM-Execution Controls. |
50 | */ | 52 | */ |
51 | #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001 | 53 | #define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001 |
54 | #define SECONDARY_EXEC_ENABLE_EPT 0x00000002 | ||
52 | #define SECONDARY_EXEC_ENABLE_VPID 0x00000020 | 55 | #define SECONDARY_EXEC_ENABLE_VPID 0x00000020 |
53 | #define SECONDARY_EXEC_WBINVD_EXITING 0x00000040 | 56 | #define SECONDARY_EXEC_WBINVD_EXITING 0x00000040 |
54 | 57 | ||
@@ -100,10 +103,22 @@ enum vmcs_field { | |||
100 | VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013, | 103 | VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013, |
101 | APIC_ACCESS_ADDR = 0x00002014, | 104 | APIC_ACCESS_ADDR = 0x00002014, |
102 | APIC_ACCESS_ADDR_HIGH = 0x00002015, | 105 | APIC_ACCESS_ADDR_HIGH = 0x00002015, |
106 | EPT_POINTER = 0x0000201a, | ||
107 | EPT_POINTER_HIGH = 0x0000201b, | ||
108 | GUEST_PHYSICAL_ADDRESS = 0x00002400, | ||
109 | GUEST_PHYSICAL_ADDRESS_HIGH = 0x00002401, | ||
103 | VMCS_LINK_POINTER = 0x00002800, | 110 | VMCS_LINK_POINTER = 0x00002800, |
104 | VMCS_LINK_POINTER_HIGH = 0x00002801, | 111 | VMCS_LINK_POINTER_HIGH = 0x00002801, |
105 | GUEST_IA32_DEBUGCTL = 0x00002802, | 112 | GUEST_IA32_DEBUGCTL = 0x00002802, |
106 | GUEST_IA32_DEBUGCTL_HIGH = 0x00002803, | 113 | GUEST_IA32_DEBUGCTL_HIGH = 0x00002803, |
114 | GUEST_PDPTR0 = 0x0000280a, | ||
115 | GUEST_PDPTR0_HIGH = 0x0000280b, | ||
116 | GUEST_PDPTR1 = 0x0000280c, | ||
117 | GUEST_PDPTR1_HIGH = 0x0000280d, | ||
118 | GUEST_PDPTR2 = 0x0000280e, | ||
119 | GUEST_PDPTR2_HIGH = 0x0000280f, | ||
120 | GUEST_PDPTR3 = 0x00002810, | ||
121 | GUEST_PDPTR3_HIGH = 0x00002811, | ||
107 | PIN_BASED_VM_EXEC_CONTROL = 0x00004000, | 122 | PIN_BASED_VM_EXEC_CONTROL = 0x00004000, |
108 | CPU_BASED_VM_EXEC_CONTROL = 0x00004002, | 123 | CPU_BASED_VM_EXEC_CONTROL = 0x00004002, |
109 | EXCEPTION_BITMAP = 0x00004004, | 124 | EXCEPTION_BITMAP = 0x00004004, |
@@ -226,6 +241,8 @@ enum vmcs_field { | |||
226 | #define EXIT_REASON_MWAIT_INSTRUCTION 36 | 241 | #define EXIT_REASON_MWAIT_INSTRUCTION 36 |
227 | #define EXIT_REASON_TPR_BELOW_THRESHOLD 43 | 242 | #define EXIT_REASON_TPR_BELOW_THRESHOLD 43 |
228 | #define EXIT_REASON_APIC_ACCESS 44 | 243 | #define EXIT_REASON_APIC_ACCESS 44 |
244 | #define EXIT_REASON_EPT_VIOLATION 48 | ||
245 | #define EXIT_REASON_EPT_MISCONFIG 49 | ||
229 | #define EXIT_REASON_WBINVD 54 | 246 | #define EXIT_REASON_WBINVD 54 |
230 | 247 | ||
231 | /* | 248 | /* |
@@ -316,15 +333,36 @@ enum vmcs_field { | |||
316 | #define MSR_IA32_VMX_CR4_FIXED1 0x489 | 333 | #define MSR_IA32_VMX_CR4_FIXED1 0x489 |
317 | #define MSR_IA32_VMX_VMCS_ENUM 0x48a | 334 | #define MSR_IA32_VMX_VMCS_ENUM 0x48a |
318 | #define MSR_IA32_VMX_PROCBASED_CTLS2 0x48b | 335 | #define MSR_IA32_VMX_PROCBASED_CTLS2 0x48b |
336 | #define MSR_IA32_VMX_EPT_VPID_CAP 0x48c | ||
319 | 337 | ||
320 | #define MSR_IA32_FEATURE_CONTROL 0x3a | 338 | #define MSR_IA32_FEATURE_CONTROL 0x3a |
321 | #define MSR_IA32_FEATURE_CONTROL_LOCKED 0x1 | 339 | #define MSR_IA32_FEATURE_CONTROL_LOCKED 0x1 |
322 | #define MSR_IA32_FEATURE_CONTROL_VMXON_ENABLED 0x4 | 340 | #define MSR_IA32_FEATURE_CONTROL_VMXON_ENABLED 0x4 |
323 | 341 | ||
324 | #define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT 9 | 342 | #define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT 9 |
343 | #define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT 10 | ||
325 | 344 | ||
326 | #define VMX_NR_VPIDS (1 << 16) | 345 | #define VMX_NR_VPIDS (1 << 16) |
327 | #define VMX_VPID_EXTENT_SINGLE_CONTEXT 1 | 346 | #define VMX_VPID_EXTENT_SINGLE_CONTEXT 1 |
328 | #define VMX_VPID_EXTENT_ALL_CONTEXT 2 | 347 | #define VMX_VPID_EXTENT_ALL_CONTEXT 2 |
329 | 348 | ||
349 | #define VMX_EPT_EXTENT_INDIVIDUAL_ADDR 0 | ||
350 | #define VMX_EPT_EXTENT_CONTEXT 1 | ||
351 | #define VMX_EPT_EXTENT_GLOBAL 2 | ||
352 | #define VMX_EPT_EXTENT_INDIVIDUAL_BIT (1ull << 24) | ||
353 | #define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25) | ||
354 | #define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26) | ||
355 | #define VMX_EPT_DEFAULT_GAW 3 | ||
356 | #define VMX_EPT_MAX_GAW 0x4 | ||
357 | #define VMX_EPT_MT_EPTE_SHIFT 3 | ||
358 | #define VMX_EPT_GAW_EPTP_SHIFT 3 | ||
359 | #define VMX_EPT_DEFAULT_MT 0x6ull | ||
360 | #define VMX_EPT_READABLE_MASK 0x1ull | ||
361 | #define VMX_EPT_WRITABLE_MASK 0x2ull | ||
362 | #define VMX_EPT_EXECUTABLE_MASK 0x4ull | ||
363 | #define VMX_EPT_FAKE_ACCESSED_MASK (1ull << 62) | ||
364 | #define VMX_EPT_FAKE_DIRTY_MASK (1ull << 63) | ||
365 | |||
366 | #define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul | ||
367 | |||
330 | #endif | 368 | #endif |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0ce556372a4..21338bdb28f 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -2417,6 +2417,9 @@ int kvm_arch_init(void *opaque) | |||
2417 | 2417 | ||
2418 | kvm_x86_ops = ops; | 2418 | kvm_x86_ops = ops; |
2419 | kvm_mmu_set_nonpresent_ptes(0ull, 0ull); | 2419 | kvm_mmu_set_nonpresent_ptes(0ull, 0ull); |
2420 | kvm_mmu_set_base_ptes(PT_PRESENT_MASK); | ||
2421 | kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK, | ||
2422 | PT_DIRTY_MASK, PT64_NX_MASK, 0); | ||
2420 | return 0; | 2423 | return 0; |
2421 | 2424 | ||
2422 | out: | 2425 | out: |
@@ -3019,6 +3022,8 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) | |||
3019 | 3022 | ||
3020 | kvm_x86_ops->decache_regs(vcpu); | 3023 | kvm_x86_ops->decache_regs(vcpu); |
3021 | 3024 | ||
3025 | vcpu->arch.exception.pending = false; | ||
3026 | |||
3022 | vcpu_put(vcpu); | 3027 | vcpu_put(vcpu); |
3023 | 3028 | ||
3024 | return 0; | 3029 | return 0; |
@@ -3481,7 +3486,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason) | |||
3481 | } | 3486 | } |
3482 | 3487 | ||
3483 | if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) { | 3488 | if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) { |
3484 | cseg_desc.type &= ~(1 << 8); //clear the B flag | 3489 | cseg_desc.type &= ~(1 << 1); //clear the B flag |
3485 | save_guest_segment_descriptor(vcpu, tr_seg.selector, | 3490 | save_guest_segment_descriptor(vcpu, tr_seg.selector, |
3486 | &cseg_desc); | 3491 | &cseg_desc); |
3487 | } | 3492 | } |
@@ -3507,7 +3512,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason) | |||
3507 | } | 3512 | } |
3508 | 3513 | ||
3509 | if (reason != TASK_SWITCH_IRET) { | 3514 | if (reason != TASK_SWITCH_IRET) { |
3510 | nseg_desc.type |= (1 << 8); | 3515 | nseg_desc.type |= (1 << 1); |
3511 | save_guest_segment_descriptor(vcpu, tss_selector, | 3516 | save_guest_segment_descriptor(vcpu, tss_selector, |
3512 | &nseg_desc); | 3517 | &nseg_desc); |
3513 | } | 3518 | } |
@@ -3698,10 +3703,19 @@ void fx_init(struct kvm_vcpu *vcpu) | |||
3698 | { | 3703 | { |
3699 | unsigned after_mxcsr_mask; | 3704 | unsigned after_mxcsr_mask; |
3700 | 3705 | ||
3706 | /* | ||
3707 | * Touch the fpu the first time in non atomic context as if | ||
3708 | * this is the first fpu instruction the exception handler | ||
3709 | * will fire before the instruction returns and it'll have to | ||
3710 | * allocate ram with GFP_KERNEL. | ||
3711 | */ | ||
3712 | if (!used_math()) | ||
3713 | fx_save(&vcpu->arch.host_fx_image); | ||
3714 | |||
3701 | /* Initialize guest FPU by resetting ours and saving into guest's */ | 3715 | /* Initialize guest FPU by resetting ours and saving into guest's */ |
3702 | preempt_disable(); | 3716 | preempt_disable(); |
3703 | fx_save(&vcpu->arch.host_fx_image); | 3717 | fx_save(&vcpu->arch.host_fx_image); |
3704 | fpu_init(); | 3718 | fx_finit(); |
3705 | fx_save(&vcpu->arch.guest_fx_image); | 3719 | fx_save(&vcpu->arch.guest_fx_image); |
3706 | fx_restore(&vcpu->arch.host_fx_image); | 3720 | fx_restore(&vcpu->arch.host_fx_image); |
3707 | preempt_enable(); | 3721 | preempt_enable(); |
@@ -3906,6 +3920,8 @@ void kvm_arch_destroy_vm(struct kvm *kvm) | |||
3906 | kvm_free_physmem(kvm); | 3920 | kvm_free_physmem(kvm); |
3907 | if (kvm->arch.apic_access_page) | 3921 | if (kvm->arch.apic_access_page) |
3908 | put_page(kvm->arch.apic_access_page); | 3922 | put_page(kvm->arch.apic_access_page); |
3923 | if (kvm->arch.ept_identity_pagetable) | ||
3924 | put_page(kvm->arch.ept_identity_pagetable); | ||
3909 | kfree(kvm); | 3925 | kfree(kvm); |
3910 | } | 3926 | } |
3911 | 3927 | ||
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 2ca08386f99..f2a696d6a24 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c | |||
@@ -1761,6 +1761,7 @@ twobyte_insn: | |||
1761 | case 6: /* lmsw */ | 1761 | case 6: /* lmsw */ |
1762 | realmode_lmsw(ctxt->vcpu, (u16)c->src.val, | 1762 | realmode_lmsw(ctxt->vcpu, (u16)c->src.val, |
1763 | &ctxt->eflags); | 1763 | &ctxt->eflags); |
1764 | c->dst.type = OP_NONE; | ||
1764 | break; | 1765 | break; |
1765 | case 7: /* invlpg*/ | 1766 | case 7: /* invlpg*/ |
1766 | emulate_invlpg(ctxt->vcpu, memop); | 1767 | emulate_invlpg(ctxt->vcpu, memop); |
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c index 18378850e25..914ccf98368 100644 --- a/arch/x86/mm/discontig_32.c +++ b/arch/x86/mm/discontig_32.c | |||
@@ -476,29 +476,3 @@ int memory_add_physaddr_to_nid(u64 addr) | |||
476 | 476 | ||
477 | EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); | 477 | EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); |
478 | #endif | 478 | #endif |
479 | |||
480 | #ifndef CONFIG_HAVE_ARCH_PARSE_SRAT | ||
481 | /* | ||
482 | * XXX FIXME: Make SLIT table parsing available to 32-bit NUMA | ||
483 | * | ||
484 | * These stub functions are needed to compile 32-bit NUMA when SRAT is | ||
485 | * not set. There are functions in srat_64.c for parsing this table | ||
486 | * and it may be possible to make them common functions. | ||
487 | */ | ||
488 | void acpi_numa_slit_init (struct acpi_table_slit *slit) | ||
489 | { | ||
490 | printk(KERN_INFO "ACPI: No support for parsing SLIT table\n"); | ||
491 | } | ||
492 | |||
493 | void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa) | ||
494 | { | ||
495 | } | ||
496 | |||
497 | void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma) | ||
498 | { | ||
499 | } | ||
500 | |||
501 | void acpi_numa_arch_fixup(void) | ||
502 | { | ||
503 | } | ||
504 | #endif /* CONFIG_HAVE_ARCH_PARSE_SRAT */ | ||
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 277446cd30b..60adbe22efa 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -25,31 +25,24 @@ | |||
25 | #include <asm/mtrr.h> | 25 | #include <asm/mtrr.h> |
26 | #include <asm/io.h> | 26 | #include <asm/io.h> |
27 | 27 | ||
28 | int pat_wc_enabled = 1; | 28 | #ifdef CONFIG_X86_PAT |
29 | int __read_mostly pat_wc_enabled = 1; | ||
29 | 30 | ||
30 | static u64 __read_mostly boot_pat_state; | 31 | void __init pat_disable(char *reason) |
31 | |||
32 | static int nopat(char *str) | ||
33 | { | 32 | { |
34 | pat_wc_enabled = 0; | 33 | pat_wc_enabled = 0; |
35 | printk(KERN_INFO "x86: PAT support disabled.\n"); | 34 | printk(KERN_INFO "%s\n", reason); |
36 | |||
37 | return 0; | ||
38 | } | 35 | } |
39 | early_param("nopat", nopat); | ||
40 | 36 | ||
41 | static int pat_known_cpu(void) | 37 | static int nopat(char *str) |
42 | { | 38 | { |
43 | if (!pat_wc_enabled) | 39 | pat_disable("PAT support disabled."); |
44 | return 0; | ||
45 | |||
46 | if (cpu_has_pat) | ||
47 | return 1; | ||
48 | |||
49 | pat_wc_enabled = 0; | ||
50 | printk(KERN_INFO "CPU and/or kernel does not support PAT.\n"); | ||
51 | return 0; | 40 | return 0; |
52 | } | 41 | } |
42 | early_param("nopat", nopat); | ||
43 | #endif | ||
44 | |||
45 | static u64 __read_mostly boot_pat_state; | ||
53 | 46 | ||
54 | enum { | 47 | enum { |
55 | PAT_UC = 0, /* uncached */ | 48 | PAT_UC = 0, /* uncached */ |
@@ -66,17 +59,19 @@ void pat_init(void) | |||
66 | { | 59 | { |
67 | u64 pat; | 60 | u64 pat; |
68 | 61 | ||
69 | #ifndef CONFIG_X86_PAT | 62 | if (!pat_wc_enabled) |
70 | nopat(NULL); | ||
71 | #endif | ||
72 | |||
73 | /* Boot CPU enables PAT based on CPU feature */ | ||
74 | if (!smp_processor_id() && !pat_known_cpu()) | ||
75 | return; | 63 | return; |
76 | 64 | ||
77 | /* APs enable PAT iff boot CPU has enabled it before */ | 65 | /* Paranoia check. */ |
78 | if (smp_processor_id() && !pat_wc_enabled) | 66 | if (!cpu_has_pat) { |
79 | return; | 67 | printk(KERN_ERR "PAT enabled, but CPU feature cleared\n"); |
68 | /* | ||
69 | * Panic if this happens on the secondary CPU, and we | ||
70 | * switched to PAT on the boot CPU. We have no way to | ||
71 | * undo PAT. | ||
72 | */ | ||
73 | BUG_ON(boot_pat_state); | ||
74 | } | ||
80 | 75 | ||
81 | /* Set PWT to Write-Combining. All other bits stay the same */ | 76 | /* Set PWT to Write-Combining. All other bits stay the same */ |
82 | /* | 77 | /* |
@@ -95,9 +90,8 @@ void pat_init(void) | |||
95 | PAT(4,WB) | PAT(5,WC) | PAT(6,UC_MINUS) | PAT(7,UC); | 90 | PAT(4,WB) | PAT(5,WC) | PAT(6,UC_MINUS) | PAT(7,UC); |
96 | 91 | ||
97 | /* Boot CPU check */ | 92 | /* Boot CPU check */ |
98 | if (!smp_processor_id()) { | 93 | if (!boot_pat_state) |
99 | rdmsrl(MSR_IA32_CR_PAT, boot_pat_state); | 94 | rdmsrl(MSR_IA32_CR_PAT, boot_pat_state); |
100 | } | ||
101 | 95 | ||
102 | wrmsrl(MSR_IA32_CR_PAT, pat); | 96 | wrmsrl(MSR_IA32_CR_PAT, pat); |
103 | printk(KERN_INFO "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n", | 97 | printk(KERN_INFO "x86 PAT enabled: cpu %d, old 0x%Lx, new 0x%Lx\n", |
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c index 9ee007be914..369cf065b6a 100644 --- a/arch/x86/mm/pgtable_32.c +++ b/arch/x86/mm/pgtable_32.c | |||
@@ -172,10 +172,3 @@ void reserve_top_address(unsigned long reserve) | |||
172 | __FIXADDR_TOP = -reserve - PAGE_SIZE; | 172 | __FIXADDR_TOP = -reserve - PAGE_SIZE; |
173 | __VMALLOC_RESERVE += reserve; | 173 | __VMALLOC_RESERVE += reserve; |
174 | } | 174 | } |
175 | |||
176 | int pmd_bad(pmd_t pmd) | ||
177 | { | ||
178 | WARN_ON_ONCE(pmd_bad_v1(pmd) != pmd_bad_v2(pmd)); | ||
179 | |||
180 | return pmd_bad_v1(pmd); | ||
181 | } | ||
diff --git a/arch/x86/pci/Makefile_32 b/arch/x86/pci/Makefile_32 index 7fa519868d7..89ec35d00ef 100644 --- a/arch/x86/pci/Makefile_32 +++ b/arch/x86/pci/Makefile_32 | |||
@@ -6,11 +6,19 @@ obj-$(CONFIG_PCI_DIRECT) += direct.o | |||
6 | obj-$(CONFIG_PCI_OLPC) += olpc.o | 6 | obj-$(CONFIG_PCI_OLPC) += olpc.o |
7 | 7 | ||
8 | pci-y := fixup.o | 8 | pci-y := fixup.o |
9 | |||
10 | # Do not change the ordering here. There is a nasty init function | ||
11 | # ordering dependency which breaks when you move acpi.o below | ||
12 | # legacy/irq.o | ||
9 | pci-$(CONFIG_ACPI) += acpi.o | 13 | pci-$(CONFIG_ACPI) += acpi.o |
10 | pci-y += legacy.o irq.o | 14 | pci-y += legacy.o irq.o |
11 | 15 | ||
12 | pci-$(CONFIG_X86_VISWS) += visws.o fixup.o | 16 | # Careful: VISWS and NUMAQ overrule the pci-y above. The colons are |
13 | pci-$(CONFIG_X86_NUMAQ) += numa.o irq.o | 17 | # therefor correct. This needs a proper fix by distangling the code. |
18 | pci-$(CONFIG_X86_VISWS) := visws.o fixup.o | ||
19 | pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o | ||
20 | |||
21 | # Necessary for NUMAQ as well | ||
14 | pci-$(CONFIG_NUMA) += mp_bus_to_node.o | 22 | pci-$(CONFIG_NUMA) += mp_bus_to_node.o |
15 | 23 | ||
16 | obj-y += $(pci-y) common.o early.o | 24 | obj-y += $(pci-y) common.o early.o |
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 1a9c0c6a1a1..d95de2f199c 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -6,45 +6,6 @@ | |||
6 | #include <asm/numa.h> | 6 | #include <asm/numa.h> |
7 | #include "pci.h" | 7 | #include "pci.h" |
8 | 8 | ||
9 | static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d) | ||
10 | { | ||
11 | pci_probe |= PCI_CAN_SKIP_ISA_ALIGN; | ||
12 | printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident); | ||
13 | return 0; | ||
14 | } | ||
15 | |||
16 | static struct dmi_system_id acpi_pciprobe_dmi_table[] __devinitdata = { | ||
17 | /* | ||
18 | * Systems where PCI IO resource ISA alignment can be skipped | ||
19 | * when the ISA enable bit in the bridge control is not set | ||
20 | */ | ||
21 | { | ||
22 | .callback = can_skip_ioresource_align, | ||
23 | .ident = "IBM System x3800", | ||
24 | .matches = { | ||
25 | DMI_MATCH(DMI_SYS_VENDOR, "IBM"), | ||
26 | DMI_MATCH(DMI_PRODUCT_NAME, "x3800"), | ||
27 | }, | ||
28 | }, | ||
29 | { | ||
30 | .callback = can_skip_ioresource_align, | ||
31 | .ident = "IBM System x3850", | ||
32 | .matches = { | ||
33 | DMI_MATCH(DMI_SYS_VENDOR, "IBM"), | ||
34 | DMI_MATCH(DMI_PRODUCT_NAME, "x3850"), | ||
35 | }, | ||
36 | }, | ||
37 | { | ||
38 | .callback = can_skip_ioresource_align, | ||
39 | .ident = "IBM System x3950", | ||
40 | .matches = { | ||
41 | DMI_MATCH(DMI_SYS_VENDOR, "IBM"), | ||
42 | DMI_MATCH(DMI_PRODUCT_NAME, "x3950"), | ||
43 | }, | ||
44 | }, | ||
45 | {} | ||
46 | }; | ||
47 | |||
48 | struct pci_root_info { | 9 | struct pci_root_info { |
49 | char *name; | 10 | char *name; |
50 | unsigned int res_num; | 11 | unsigned int res_num; |
@@ -196,8 +157,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do | |||
196 | int pxm; | 157 | int pxm; |
197 | #endif | 158 | #endif |
198 | 159 | ||
199 | dmi_check_system(acpi_pciprobe_dmi_table); | ||
200 | |||
201 | if (domain && !pci_domains_supported) { | 160 | if (domain && !pci_domains_supported) { |
202 | printk(KERN_WARNING "PCI: Multiple domains not supported " | 161 | printk(KERN_WARNING "PCI: Multiple domains not supported " |
203 | "(dom %d, bus %d)\n", domain, busnum); | 162 | "(dom %d, bus %d)\n", domain, busnum); |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 2a4d751818b..8545c8a9d10 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -77,17 +77,48 @@ int pcibios_scanned; | |||
77 | */ | 77 | */ |
78 | DEFINE_SPINLOCK(pci_config_lock); | 78 | DEFINE_SPINLOCK(pci_config_lock); |
79 | 79 | ||
80 | static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) | 80 | static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d) |
81 | { | 81 | { |
82 | struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE]; | 82 | pci_probe |= PCI_CAN_SKIP_ISA_ALIGN; |
83 | 83 | printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident); | |
84 | if (rom_r->parent) | 84 | return 0; |
85 | return; | 85 | } |
86 | if (rom_r->start) | 86 | |
87 | /* we deal with BIOS assigned ROM later */ | 87 | static struct dmi_system_id can_skip_pciprobe_dmi_table[] __devinitdata = { |
88 | return; | 88 | /* |
89 | if (!(pci_probe & PCI_ASSIGN_ROMS)) | 89 | * Systems where PCI IO resource ISA alignment can be skipped |
90 | rom_r->start = rom_r->end = rom_r->flags = 0; | 90 | * when the ISA enable bit in the bridge control is not set |
91 | */ | ||
92 | { | ||
93 | .callback = can_skip_ioresource_align, | ||
94 | .ident = "IBM System x3800", | ||
95 | .matches = { | ||
96 | DMI_MATCH(DMI_SYS_VENDOR, "IBM"), | ||
97 | DMI_MATCH(DMI_PRODUCT_NAME, "x3800"), | ||
98 | }, | ||
99 | }, | ||
100 | { | ||
101 | .callback = can_skip_ioresource_align, | ||
102 | .ident = "IBM System x3850", | ||
103 | .matches = { | ||
104 | DMI_MATCH(DMI_SYS_VENDOR, "IBM"), | ||
105 | DMI_MATCH(DMI_PRODUCT_NAME, "x3850"), | ||
106 | }, | ||
107 | }, | ||
108 | { | ||
109 | .callback = can_skip_ioresource_align, | ||
110 | .ident = "IBM System x3950", | ||
111 | .matches = { | ||
112 | DMI_MATCH(DMI_SYS_VENDOR, "IBM"), | ||
113 | DMI_MATCH(DMI_PRODUCT_NAME, "x3950"), | ||
114 | }, | ||
115 | }, | ||
116 | {} | ||
117 | }; | ||
118 | |||
119 | void __init dmi_check_skip_isa_align(void) | ||
120 | { | ||
121 | dmi_check_system(can_skip_pciprobe_dmi_table); | ||
91 | } | 122 | } |
92 | 123 | ||
93 | /* | 124 | /* |
@@ -97,11 +128,7 @@ static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) | |||
97 | 128 | ||
98 | void __devinit pcibios_fixup_bus(struct pci_bus *b) | 129 | void __devinit pcibios_fixup_bus(struct pci_bus *b) |
99 | { | 130 | { |
100 | struct pci_dev *dev; | ||
101 | |||
102 | pci_read_bridge_bases(b); | 131 | pci_read_bridge_bases(b); |
103 | list_for_each_entry(dev, &b->devices, bus_list) | ||
104 | pcibios_fixup_device_resources(dev); | ||
105 | } | 132 | } |
106 | 133 | ||
107 | /* | 134 | /* |
@@ -318,13 +345,16 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = { | |||
318 | {} | 345 | {} |
319 | }; | 346 | }; |
320 | 347 | ||
348 | void __init dmi_check_pciprobe(void) | ||
349 | { | ||
350 | dmi_check_system(pciprobe_dmi_table); | ||
351 | } | ||
352 | |||
321 | struct pci_bus * __devinit pcibios_scan_root(int busnum) | 353 | struct pci_bus * __devinit pcibios_scan_root(int busnum) |
322 | { | 354 | { |
323 | struct pci_bus *bus = NULL; | 355 | struct pci_bus *bus = NULL; |
324 | struct pci_sysdata *sd; | 356 | struct pci_sysdata *sd; |
325 | 357 | ||
326 | dmi_check_system(pciprobe_dmi_table); | ||
327 | |||
328 | while ((bus = pci_find_next_bus(bus)) != NULL) { | 358 | while ((bus = pci_find_next_bus(bus)) != NULL) { |
329 | if (bus->number == busnum) { | 359 | if (bus->number == busnum) { |
330 | /* Already scanned */ | 360 | /* Already scanned */ |
@@ -462,6 +492,9 @@ char * __devinit pcibios_setup(char *str) | |||
462 | } else if (!strcmp(str, "routeirq")) { | 492 | } else if (!strcmp(str, "routeirq")) { |
463 | pci_routeirq = 1; | 493 | pci_routeirq = 1; |
464 | return NULL; | 494 | return NULL; |
495 | } else if (!strcmp(str, "skip_isa_align")) { | ||
496 | pci_probe |= PCI_CAN_SKIP_ISA_ALIGN; | ||
497 | return NULL; | ||
465 | } | 498 | } |
466 | return str; | 499 | return str; |
467 | } | 500 | } |
@@ -489,7 +522,7 @@ void pcibios_disable_device (struct pci_dev *dev) | |||
489 | pcibios_disable_irq(dev); | 522 | pcibios_disable_irq(dev); |
490 | } | 523 | } |
491 | 524 | ||
492 | struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node) | 525 | struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node) |
493 | { | 526 | { |
494 | struct pci_bus *bus = NULL; | 527 | struct pci_bus *bus = NULL; |
495 | struct pci_sysdata *sd; | 528 | struct pci_sysdata *sd; |
@@ -512,7 +545,7 @@ struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node) | |||
512 | return bus; | 545 | return bus; |
513 | } | 546 | } |
514 | 547 | ||
515 | struct pci_bus *pci_scan_bus_with_sysdata(int busno) | 548 | struct pci_bus * __devinit pci_scan_bus_with_sysdata(int busno) |
516 | { | 549 | { |
517 | return pci_scan_bus_on_node(busno, &pci_root_ops, -1); | 550 | return pci_scan_bus_on_node(busno, &pci_root_ops, -1); |
518 | } | 551 | } |
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index b60b2abd480..ff3a6a33634 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -502,7 +502,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015, | |||
502 | */ | 502 | */ |
503 | static void fam10h_pci_cfg_space_size(struct pci_dev *dev) | 503 | static void fam10h_pci_cfg_space_size(struct pci_dev *dev) |
504 | { | 504 | { |
505 | dev->cfg_size = pci_cfg_space_size_ext(dev, 0); | 505 | dev->cfg_size = pci_cfg_space_size_ext(dev); |
506 | } | 506 | } |
507 | 507 | ||
508 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1200, fam10h_pci_cfg_space_size); | 508 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1200, fam10h_pci_cfg_space_size); |
diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c index dd30c6076b5..e70b9c57b88 100644 --- a/arch/x86/pci/init.c +++ b/arch/x86/pci/init.c | |||
@@ -33,6 +33,10 @@ static __init int pci_access_init(void) | |||
33 | printk(KERN_ERR | 33 | printk(KERN_ERR |
34 | "PCI: Fatal: No config space access function found\n"); | 34 | "PCI: Fatal: No config space access function found\n"); |
35 | 35 | ||
36 | dmi_check_pciprobe(); | ||
37 | |||
38 | dmi_check_skip_isa_align(); | ||
39 | |||
36 | return 0; | 40 | return 0; |
37 | } | 41 | } |
38 | arch_initcall(pci_access_init); | 42 | arch_initcall(pci_access_init); |
diff --git a/arch/x86/pci/k8-bus_64.c b/arch/x86/pci/k8-bus_64.c index ab6d4b18a88..5c2799c20e4 100644 --- a/arch/x86/pci/k8-bus_64.c +++ b/arch/x86/pci/k8-bus_64.c | |||
@@ -504,14 +504,6 @@ static int __init early_fill_mp_bus_info(void) | |||
504 | } | 504 | } |
505 | } | 505 | } |
506 | 506 | ||
507 | #ifdef CONFIG_NUMA | ||
508 | for (i = 0; i < BUS_NR; i++) { | ||
509 | node = mp_bus_to_node[i]; | ||
510 | if (node >= 0) | ||
511 | printk(KERN_DEBUG "bus: %02x to node: %02x\n", i, node); | ||
512 | } | ||
513 | #endif | ||
514 | |||
515 | for (i = 0; i < pci_root_num; i++) { | 507 | for (i = 0; i < pci_root_num; i++) { |
516 | int res_num; | 508 | int res_num; |
517 | int busnum; | 509 | int busnum; |
diff --git a/arch/x86/pci/pci.h b/arch/x86/pci/pci.h index c58805a92db..f3972b12c60 100644 --- a/arch/x86/pci/pci.h +++ b/arch/x86/pci/pci.h | |||
@@ -38,6 +38,9 @@ enum pci_bf_sort_state { | |||
38 | pci_dmi_bf, | 38 | pci_dmi_bf, |
39 | }; | 39 | }; |
40 | 40 | ||
41 | extern void __init dmi_check_pciprobe(void); | ||
42 | extern void __init dmi_check_skip_isa_align(void); | ||
43 | |||
41 | /* pci-i386.c */ | 44 | /* pci-i386.c */ |
42 | 45 | ||
43 | extern unsigned int pcibios_max_latency; | 46 | extern unsigned int pcibios_max_latency; |
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c index 4dceeb1fc5e..cf058fecfce 100644 --- a/arch/x86/vdso/vdso32-setup.c +++ b/arch/x86/vdso/vdso32-setup.c | |||
@@ -162,7 +162,7 @@ static __init void relocate_vdso(Elf32_Ehdr *ehdr) | |||
162 | Elf32_Shdr *shdr; | 162 | Elf32_Shdr *shdr; |
163 | int i; | 163 | int i; |
164 | 164 | ||
165 | BUG_ON(memcmp(ehdr->e_ident, ELFMAG, 4) != 0 || | 165 | BUG_ON(memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0 || |
166 | !elf_check_arch_ia32(ehdr) || | 166 | !elf_check_arch_ia32(ehdr) || |
167 | ehdr->e_type != ET_DYN); | 167 | ehdr->e_type != ET_DYN); |
168 | 168 | ||
diff --git a/arch/x86/video/fbdev.c b/arch/x86/video/fbdev.c index 4db42bff8c6..69527688f79 100644 --- a/arch/x86/video/fbdev.c +++ b/arch/x86/video/fbdev.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * | ||
3 | * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com> | 2 | * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com> |
4 | * | 3 | * |
5 | * This file is subject to the terms and conditions of the GNU General Public | 4 | * This file is subject to the terms and conditions of the GNU General Public |
@@ -29,3 +28,4 @@ int fb_is_primary_device(struct fb_info *info) | |||
29 | return retval; | 28 | return retval; |
30 | } | 29 | } |
31 | EXPORT_SYMBOL(fb_is_primary_device); | 30 | EXPORT_SYMBOL(fb_is_primary_device); |
31 | MODULE_LICENSE("GPL"); | ||
diff --git a/block/blk-core.c b/block/blk-core.c index b754a4a2f9b..2987fe47b5e 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -54,15 +54,16 @@ static DEFINE_PER_CPU(struct list_head, blk_cpu_done); | |||
54 | 54 | ||
55 | static void drive_stat_acct(struct request *rq, int new_io) | 55 | static void drive_stat_acct(struct request *rq, int new_io) |
56 | { | 56 | { |
57 | struct hd_struct *part; | ||
57 | int rw = rq_data_dir(rq); | 58 | int rw = rq_data_dir(rq); |
58 | 59 | ||
59 | if (!blk_fs_request(rq) || !rq->rq_disk) | 60 | if (!blk_fs_request(rq) || !rq->rq_disk) |
60 | return; | 61 | return; |
61 | 62 | ||
62 | if (!new_io) { | 63 | part = get_part(rq->rq_disk, rq->sector); |
63 | __all_stat_inc(rq->rq_disk, merges[rw], rq->sector); | 64 | if (!new_io) |
64 | } else { | 65 | __all_stat_inc(rq->rq_disk, part, merges[rw], rq->sector); |
65 | struct hd_struct *part = get_part(rq->rq_disk, rq->sector); | 66 | else { |
66 | disk_round_stats(rq->rq_disk); | 67 | disk_round_stats(rq->rq_disk); |
67 | rq->rq_disk->in_flight++; | 68 | rq->rq_disk->in_flight++; |
68 | if (part) { | 69 | if (part) { |
@@ -253,9 +254,11 @@ EXPORT_SYMBOL(__generic_unplug_device); | |||
253 | **/ | 254 | **/ |
254 | void generic_unplug_device(struct request_queue *q) | 255 | void generic_unplug_device(struct request_queue *q) |
255 | { | 256 | { |
256 | spin_lock_irq(q->queue_lock); | 257 | if (blk_queue_plugged(q)) { |
257 | __generic_unplug_device(q); | 258 | spin_lock_irq(q->queue_lock); |
258 | spin_unlock_irq(q->queue_lock); | 259 | __generic_unplug_device(q); |
260 | spin_unlock_irq(q->queue_lock); | ||
261 | } | ||
259 | } | 262 | } |
260 | EXPORT_SYMBOL(generic_unplug_device); | 263 | EXPORT_SYMBOL(generic_unplug_device); |
261 | 264 | ||
@@ -1536,10 +1539,11 @@ static int __end_that_request_first(struct request *req, int error, | |||
1536 | } | 1539 | } |
1537 | 1540 | ||
1538 | if (blk_fs_request(req) && req->rq_disk) { | 1541 | if (blk_fs_request(req) && req->rq_disk) { |
1542 | struct hd_struct *part = get_part(req->rq_disk, req->sector); | ||
1539 | const int rw = rq_data_dir(req); | 1543 | const int rw = rq_data_dir(req); |
1540 | 1544 | ||
1541 | all_stat_add(req->rq_disk, sectors[rw], | 1545 | all_stat_add(req->rq_disk, part, sectors[rw], |
1542 | nr_bytes >> 9, req->sector); | 1546 | nr_bytes >> 9, req->sector); |
1543 | } | 1547 | } |
1544 | 1548 | ||
1545 | total_bytes = bio_nbytes = 0; | 1549 | total_bytes = bio_nbytes = 0; |
@@ -1725,8 +1729,8 @@ static void end_that_request_last(struct request *req, int error) | |||
1725 | const int rw = rq_data_dir(req); | 1729 | const int rw = rq_data_dir(req); |
1726 | struct hd_struct *part = get_part(disk, req->sector); | 1730 | struct hd_struct *part = get_part(disk, req->sector); |
1727 | 1731 | ||
1728 | __all_stat_inc(disk, ios[rw], req->sector); | 1732 | __all_stat_inc(disk, part, ios[rw], req->sector); |
1729 | __all_stat_add(disk, ticks[rw], duration, req->sector); | 1733 | __all_stat_add(disk, part, ticks[rw], duration, req->sector); |
1730 | disk_round_stats(disk); | 1734 | disk_round_stats(disk); |
1731 | disk->in_flight--; | 1735 | disk->in_flight--; |
1732 | if (part) { | 1736 | if (part) { |
diff --git a/block/blk-ioc.c b/block/blk-ioc.c index e34df7c9fc3..012f065ac8e 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c | |||
@@ -41,8 +41,8 @@ int put_io_context(struct io_context *ioc) | |||
41 | rcu_read_lock(); | 41 | rcu_read_lock(); |
42 | if (ioc->aic && ioc->aic->dtor) | 42 | if (ioc->aic && ioc->aic->dtor) |
43 | ioc->aic->dtor(ioc->aic); | 43 | ioc->aic->dtor(ioc->aic); |
44 | rcu_read_unlock(); | ||
45 | cfq_dtor(ioc); | 44 | cfq_dtor(ioc); |
45 | rcu_read_unlock(); | ||
46 | 46 | ||
47 | kmem_cache_free(iocontext_cachep, ioc); | 47 | kmem_cache_free(iocontext_cachep, ioc); |
48 | return 1; | 48 | return 1; |
diff --git a/block/blk-merge.c b/block/blk-merge.c index 73b23562af2..651136aae76 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -149,9 +149,9 @@ static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio, | |||
149 | static int blk_hw_contig_segment(struct request_queue *q, struct bio *bio, | 149 | static int blk_hw_contig_segment(struct request_queue *q, struct bio *bio, |
150 | struct bio *nxt) | 150 | struct bio *nxt) |
151 | { | 151 | { |
152 | if (unlikely(!bio_flagged(bio, BIO_SEG_VALID))) | 152 | if (!bio_flagged(bio, BIO_SEG_VALID)) |
153 | blk_recount_segments(q, bio); | 153 | blk_recount_segments(q, bio); |
154 | if (unlikely(!bio_flagged(nxt, BIO_SEG_VALID))) | 154 | if (!bio_flagged(nxt, BIO_SEG_VALID)) |
155 | blk_recount_segments(q, nxt); | 155 | blk_recount_segments(q, nxt); |
156 | if (!BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt)) || | 156 | if (!BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt)) || |
157 | BIOVEC_VIRT_OVERSIZE(bio->bi_hw_back_size + nxt->bi_hw_front_size)) | 157 | BIOVEC_VIRT_OVERSIZE(bio->bi_hw_back_size + nxt->bi_hw_front_size)) |
@@ -312,9 +312,9 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req, | |||
312 | q->last_merge = NULL; | 312 | q->last_merge = NULL; |
313 | return 0; | 313 | return 0; |
314 | } | 314 | } |
315 | if (unlikely(!bio_flagged(req->biotail, BIO_SEG_VALID))) | 315 | if (!bio_flagged(req->biotail, BIO_SEG_VALID)) |
316 | blk_recount_segments(q, req->biotail); | 316 | blk_recount_segments(q, req->biotail); |
317 | if (unlikely(!bio_flagged(bio, BIO_SEG_VALID))) | 317 | if (!bio_flagged(bio, BIO_SEG_VALID)) |
318 | blk_recount_segments(q, bio); | 318 | blk_recount_segments(q, bio); |
319 | len = req->biotail->bi_hw_back_size + bio->bi_hw_front_size; | 319 | len = req->biotail->bi_hw_back_size + bio->bi_hw_front_size; |
320 | if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(req->biotail), __BVEC_START(bio)) | 320 | if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(req->biotail), __BVEC_START(bio)) |
@@ -352,9 +352,9 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req, | |||
352 | return 0; | 352 | return 0; |
353 | } | 353 | } |
354 | len = bio->bi_hw_back_size + req->bio->bi_hw_front_size; | 354 | len = bio->bi_hw_back_size + req->bio->bi_hw_front_size; |
355 | if (unlikely(!bio_flagged(bio, BIO_SEG_VALID))) | 355 | if (!bio_flagged(bio, BIO_SEG_VALID)) |
356 | blk_recount_segments(q, bio); | 356 | blk_recount_segments(q, bio); |
357 | if (unlikely(!bio_flagged(req->bio, BIO_SEG_VALID))) | 357 | if (!bio_flagged(req->bio, BIO_SEG_VALID)) |
358 | blk_recount_segments(q, req->bio); | 358 | blk_recount_segments(q, req->bio); |
359 | if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), __BVEC_START(req->bio)) && | 359 | if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(bio), __BVEC_START(req->bio)) && |
360 | !BIOVEC_VIRT_OVERSIZE(len)) { | 360 | !BIOVEC_VIRT_OVERSIZE(len)) { |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index e85c4013e8a..304ec73ab82 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -146,11 +146,13 @@ static ssize_t queue_nomerges_store(struct request_queue *q, const char *page, | |||
146 | unsigned long nm; | 146 | unsigned long nm; |
147 | ssize_t ret = queue_var_store(&nm, page, count); | 147 | ssize_t ret = queue_var_store(&nm, page, count); |
148 | 148 | ||
149 | spin_lock_irq(q->queue_lock); | ||
149 | if (nm) | 150 | if (nm) |
150 | set_bit(QUEUE_FLAG_NOMERGES, &q->queue_flags); | 151 | queue_flag_set(QUEUE_FLAG_NOMERGES, q); |
151 | else | 152 | else |
152 | clear_bit(QUEUE_FLAG_NOMERGES, &q->queue_flags); | 153 | queue_flag_clear(QUEUE_FLAG_NOMERGES, q); |
153 | 154 | ||
155 | spin_unlock_irq(q->queue_lock); | ||
154 | return ret; | 156 | return ret; |
155 | } | 157 | } |
156 | 158 | ||
diff --git a/block/blk-tag.c b/block/blk-tag.c index de64e042997..32667beb03e 100644 --- a/block/blk-tag.c +++ b/block/blk-tag.c | |||
@@ -70,7 +70,7 @@ void __blk_queue_free_tags(struct request_queue *q) | |||
70 | __blk_free_tags(bqt); | 70 | __blk_free_tags(bqt); |
71 | 71 | ||
72 | q->queue_tags = NULL; | 72 | q->queue_tags = NULL; |
73 | queue_flag_clear(QUEUE_FLAG_QUEUED, q); | 73 | queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED, q); |
74 | } | 74 | } |
75 | 75 | ||
76 | /** | 76 | /** |
@@ -98,7 +98,7 @@ EXPORT_SYMBOL(blk_free_tags); | |||
98 | **/ | 98 | **/ |
99 | void blk_queue_free_tags(struct request_queue *q) | 99 | void blk_queue_free_tags(struct request_queue *q) |
100 | { | 100 | { |
101 | queue_flag_clear(QUEUE_FLAG_QUEUED, q); | 101 | queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED, q); |
102 | } | 102 | } |
103 | EXPORT_SYMBOL(blk_queue_free_tags); | 103 | EXPORT_SYMBOL(blk_queue_free_tags); |
104 | 104 | ||
@@ -171,6 +171,9 @@ EXPORT_SYMBOL(blk_init_tags); | |||
171 | * @q: the request queue for the device | 171 | * @q: the request queue for the device |
172 | * @depth: the maximum queue depth supported | 172 | * @depth: the maximum queue depth supported |
173 | * @tags: the tag to use | 173 | * @tags: the tag to use |
174 | * | ||
175 | * Queue lock must be held here if the function is called to resize an | ||
176 | * existing map. | ||
174 | **/ | 177 | **/ |
175 | int blk_queue_init_tags(struct request_queue *q, int depth, | 178 | int blk_queue_init_tags(struct request_queue *q, int depth, |
176 | struct blk_queue_tag *tags) | 179 | struct blk_queue_tag *tags) |
@@ -197,7 +200,7 @@ int blk_queue_init_tags(struct request_queue *q, int depth, | |||
197 | * assign it, all done | 200 | * assign it, all done |
198 | */ | 201 | */ |
199 | q->queue_tags = tags; | 202 | q->queue_tags = tags; |
200 | queue_flag_set(QUEUE_FLAG_QUEUED, q); | 203 | queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, q); |
201 | INIT_LIST_HEAD(&q->tag_busy_list); | 204 | INIT_LIST_HEAD(&q->tag_busy_list); |
202 | return 0; | 205 | return 0; |
203 | fail: | 206 | fail: |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index f4e1006c253..b399c62936e 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1142,6 +1142,17 @@ static void cfq_put_queue(struct cfq_queue *cfqq) | |||
1142 | kmem_cache_free(cfq_pool, cfqq); | 1142 | kmem_cache_free(cfq_pool, cfqq); |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | static void | ||
1146 | __call_for_each_cic(struct io_context *ioc, | ||
1147 | void (*func)(struct io_context *, struct cfq_io_context *)) | ||
1148 | { | ||
1149 | struct cfq_io_context *cic; | ||
1150 | struct hlist_node *n; | ||
1151 | |||
1152 | hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) | ||
1153 | func(ioc, cic); | ||
1154 | } | ||
1155 | |||
1145 | /* | 1156 | /* |
1146 | * Call func for each cic attached to this ioc. | 1157 | * Call func for each cic attached to this ioc. |
1147 | */ | 1158 | */ |
@@ -1149,12 +1160,8 @@ static void | |||
1149 | call_for_each_cic(struct io_context *ioc, | 1160 | call_for_each_cic(struct io_context *ioc, |
1150 | void (*func)(struct io_context *, struct cfq_io_context *)) | 1161 | void (*func)(struct io_context *, struct cfq_io_context *)) |
1151 | { | 1162 | { |
1152 | struct cfq_io_context *cic; | ||
1153 | struct hlist_node *n; | ||
1154 | |||
1155 | rcu_read_lock(); | 1163 | rcu_read_lock(); |
1156 | hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) | 1164 | __call_for_each_cic(ioc, func); |
1157 | func(ioc, cic); | ||
1158 | rcu_read_unlock(); | 1165 | rcu_read_unlock(); |
1159 | } | 1166 | } |
1160 | 1167 | ||
@@ -1198,7 +1205,7 @@ static void cfq_free_io_context(struct io_context *ioc) | |||
1198 | * should be ok to iterate over the known list, we will see all cic's | 1205 | * should be ok to iterate over the known list, we will see all cic's |
1199 | * since no new ones are added. | 1206 | * since no new ones are added. |
1200 | */ | 1207 | */ |
1201 | call_for_each_cic(ioc, cic_free_func); | 1208 | __call_for_each_cic(ioc, cic_free_func); |
1202 | } | 1209 | } |
1203 | 1210 | ||
1204 | static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq) | 1211 | static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq) |
@@ -1296,10 +1303,10 @@ static void cfq_init_prio_data(struct cfq_queue *cfqq, struct io_context *ioc) | |||
1296 | printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class); | 1303 | printk(KERN_ERR "cfq: bad prio %x\n", ioprio_class); |
1297 | case IOPRIO_CLASS_NONE: | 1304 | case IOPRIO_CLASS_NONE: |
1298 | /* | 1305 | /* |
1299 | * no prio set, place us in the middle of the BE classes | 1306 | * no prio set, inherit CPU scheduling settings |
1300 | */ | 1307 | */ |
1301 | cfqq->ioprio = task_nice_ioprio(tsk); | 1308 | cfqq->ioprio = task_nice_ioprio(tsk); |
1302 | cfqq->ioprio_class = IOPRIO_CLASS_BE; | 1309 | cfqq->ioprio_class = task_nice_ioclass(tsk); |
1303 | break; | 1310 | break; |
1304 | case IOPRIO_CLASS_RT: | 1311 | case IOPRIO_CLASS_RT: |
1305 | cfqq->ioprio = task_ioprio(ioc); | 1312 | cfqq->ioprio = task_ioprio(ioc); |
diff --git a/crypto/hmac.c b/crypto/hmac.c index b60c3c7aa32..14c6351e639 100644 --- a/crypto/hmac.c +++ b/crypto/hmac.c | |||
@@ -57,14 +57,35 @@ static int hmac_setkey(struct crypto_hash *parent, | |||
57 | if (keylen > bs) { | 57 | if (keylen > bs) { |
58 | struct hash_desc desc; | 58 | struct hash_desc desc; |
59 | struct scatterlist tmp; | 59 | struct scatterlist tmp; |
60 | int tmplen; | ||
60 | int err; | 61 | int err; |
61 | 62 | ||
62 | desc.tfm = tfm; | 63 | desc.tfm = tfm; |
63 | desc.flags = crypto_hash_get_flags(parent); | 64 | desc.flags = crypto_hash_get_flags(parent); |
64 | desc.flags &= CRYPTO_TFM_REQ_MAY_SLEEP; | 65 | desc.flags &= CRYPTO_TFM_REQ_MAY_SLEEP; |
65 | sg_init_one(&tmp, inkey, keylen); | ||
66 | 66 | ||
67 | err = crypto_hash_digest(&desc, &tmp, keylen, digest); | 67 | err = crypto_hash_init(&desc); |
68 | if (err) | ||
69 | return err; | ||
70 | |||
71 | tmplen = bs * 2 + ds; | ||
72 | sg_init_one(&tmp, ipad, tmplen); | ||
73 | |||
74 | for (; keylen > tmplen; inkey += tmplen, keylen -= tmplen) { | ||
75 | memcpy(ipad, inkey, tmplen); | ||
76 | err = crypto_hash_update(&desc, &tmp, tmplen); | ||
77 | if (err) | ||
78 | return err; | ||
79 | } | ||
80 | |||
81 | if (keylen) { | ||
82 | memcpy(ipad, inkey, keylen); | ||
83 | err = crypto_hash_update(&desc, &tmp, keylen); | ||
84 | if (err) | ||
85 | return err; | ||
86 | } | ||
87 | |||
88 | err = crypto_hash_final(&desc, digest); | ||
68 | if (err) | 89 | if (err) |
69 | return err; | 90 | return err; |
70 | 91 | ||
diff --git a/drivers/accessibility/Kconfig b/drivers/accessibility/Kconfig index 1264c4b9809..ef3b65bfdd0 100644 --- a/drivers/accessibility/Kconfig +++ b/drivers/accessibility/Kconfig | |||
@@ -1,7 +1,17 @@ | |||
1 | menuconfig ACCESSIBILITY | 1 | menuconfig ACCESSIBILITY |
2 | bool "Accessibility support" | 2 | bool "Accessibility support" |
3 | ---help--- | 3 | ---help--- |
4 | Enable a submenu where accessibility items may be enabled. | 4 | Accessibility handles all special kinds of hardware devices or |
5 | software adapters which help people with disabilities (e.g. | ||
6 | blindness) to use computers. | ||
7 | |||
8 | That includes braille devices, speech synthesis, keyboard | ||
9 | remapping, etc. | ||
10 | |||
11 | Say Y here to get to see options for accessibility. | ||
12 | This option alone does not add any kernel code. | ||
13 | |||
14 | If you say N, all options in this submenu will be skipped and disabled. | ||
5 | 15 | ||
6 | If unsure, say N. | 16 | If unsure, say N. |
7 | 17 | ||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 1c11df9a5f3..9bf2986a278 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -205,8 +205,8 @@ config SATA_VITESSE | |||
205 | If unsure, say N. | 205 | If unsure, say N. |
206 | 206 | ||
207 | config SATA_INIC162X | 207 | config SATA_INIC162X |
208 | tristate "Initio 162x SATA support (HIGHLY EXPERIMENTAL)" | 208 | tristate "Initio 162x SATA support" |
209 | depends on PCI && EXPERIMENTAL | 209 | depends on PCI |
210 | help | 210 | help |
211 | This option enables support for Initio 162x Serial ATA. | 211 | This option enables support for Initio 162x Serial ATA. |
212 | 212 | ||
@@ -697,6 +697,15 @@ config PATA_SCC | |||
697 | 697 | ||
698 | If unsure, say N. | 698 | If unsure, say N. |
699 | 699 | ||
700 | config PATA_SCH | ||
701 | tristate "Intel SCH PATA support" | ||
702 | depends on PCI | ||
703 | help | ||
704 | This option enables support for Intel SCH PATA on the Intel | ||
705 | SCH (US15W, US15L, UL11L) series host controllers. | ||
706 | |||
707 | If unsure, say N. | ||
708 | |||
700 | config PATA_BF54X | 709 | config PATA_BF54X |
701 | tristate "Blackfin 54x ATAPI support" | 710 | tristate "Blackfin 54x ATAPI support" |
702 | depends on BF542 || BF548 || BF549 | 711 | depends on BF542 || BF548 || BF549 |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index b693d829383..674965fa326 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -67,6 +67,7 @@ obj-$(CONFIG_PATA_SIS) += pata_sis.o | |||
67 | obj-$(CONFIG_PATA_TRIFLEX) += pata_triflex.o | 67 | obj-$(CONFIG_PATA_TRIFLEX) += pata_triflex.o |
68 | obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o | 68 | obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o |
69 | obj-$(CONFIG_PATA_SCC) += pata_scc.o | 69 | obj-$(CONFIG_PATA_SCC) += pata_scc.o |
70 | obj-$(CONFIG_PATA_SCH) += pata_sch.o | ||
70 | obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o | 71 | obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o |
71 | obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o | 72 | obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o |
72 | obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o | 73 | obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 8cace9aa9c0..97f83fb2ee2 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1267,9 +1267,7 @@ static int ahci_check_ready(struct ata_link *link) | |||
1267 | void __iomem *port_mmio = ahci_port_base(link->ap); | 1267 | void __iomem *port_mmio = ahci_port_base(link->ap); |
1268 | u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF; | 1268 | u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF; |
1269 | 1269 | ||
1270 | if (!(status & ATA_BUSY)) | 1270 | return ata_check_ready(status); |
1271 | return 1; | ||
1272 | return 0; | ||
1273 | } | 1271 | } |
1274 | 1272 | ||
1275 | static int ahci_softreset(struct ata_link *link, unsigned int *class, | 1273 | static int ahci_softreset(struct ata_link *link, unsigned int *class, |
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 47aeccd52fa..75a406f5e69 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -152,6 +152,12 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id | |||
152 | if (dev->vendor == PCI_VENDOR_ID_AL) | 152 | if (dev->vendor == PCI_VENDOR_ID_AL) |
153 | ata_pci_bmdma_clear_simplex(dev); | 153 | ata_pci_bmdma_clear_simplex(dev); |
154 | 154 | ||
155 | if (dev->vendor == PCI_VENDOR_ID_ATI) { | ||
156 | int rc = pcim_enable_device(dev); | ||
157 | if (rc < 0) | ||
158 | return rc; | ||
159 | pcim_pin_device(dev); | ||
160 | } | ||
155 | return ata_pci_sff_init_one(dev, ppi, &generic_sht, NULL); | 161 | return ata_pci_sff_init_one(dev, ppi, &generic_sht, NULL); |
156 | } | 162 | } |
157 | 163 | ||
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index ea2c7649d39..a9027b8fbdd 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -1348,6 +1348,8 @@ static void __devinit piix_init_sidpr(struct ata_host *host) | |||
1348 | { | 1348 | { |
1349 | struct pci_dev *pdev = to_pci_dev(host->dev); | 1349 | struct pci_dev *pdev = to_pci_dev(host->dev); |
1350 | struct piix_host_priv *hpriv = host->private_data; | 1350 | struct piix_host_priv *hpriv = host->private_data; |
1351 | struct ata_device *dev0 = &host->ports[0]->link.device[0]; | ||
1352 | u32 scontrol; | ||
1351 | int i; | 1353 | int i; |
1352 | 1354 | ||
1353 | /* check for availability */ | 1355 | /* check for availability */ |
@@ -1366,6 +1368,29 @@ static void __devinit piix_init_sidpr(struct ata_host *host) | |||
1366 | return; | 1368 | return; |
1367 | 1369 | ||
1368 | hpriv->sidpr = pcim_iomap_table(pdev)[PIIX_SIDPR_BAR]; | 1370 | hpriv->sidpr = pcim_iomap_table(pdev)[PIIX_SIDPR_BAR]; |
1371 | |||
1372 | /* SCR access via SIDPR doesn't work on some configurations. | ||
1373 | * Give it a test drive by inhibiting power save modes which | ||
1374 | * we'll do anyway. | ||
1375 | */ | ||
1376 | scontrol = piix_sidpr_read(dev0, SCR_CONTROL); | ||
1377 | |||
1378 | /* if IPM is already 3, SCR access is probably working. Don't | ||
1379 | * un-inhibit power save modes as BIOS might have inhibited | ||
1380 | * them for a reason. | ||
1381 | */ | ||
1382 | if ((scontrol & 0xf00) != 0x300) { | ||
1383 | scontrol |= 0x300; | ||
1384 | piix_sidpr_write(dev0, SCR_CONTROL, scontrol); | ||
1385 | scontrol = piix_sidpr_read(dev0, SCR_CONTROL); | ||
1386 | |||
1387 | if ((scontrol & 0xf00) != 0x300) { | ||
1388 | dev_printk(KERN_INFO, host->dev, "SCR access via " | ||
1389 | "SIDPR is available but doesn't work\n"); | ||
1390 | return; | ||
1391 | } | ||
1392 | } | ||
1393 | |||
1369 | host->ports[0]->ops = &piix_sidpr_sata_ops; | 1394 | host->ports[0]->ops = &piix_sidpr_sata_ops; |
1370 | host->ports[1]->ops = &piix_sidpr_sata_ops; | 1395 | host->ports[1]->ops = &piix_sidpr_sata_ops; |
1371 | } | 1396 | } |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 3bc48853820..927b692d723 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -6292,6 +6292,7 @@ EXPORT_SYMBOL_GPL(ata_eh_freeze_port); | |||
6292 | EXPORT_SYMBOL_GPL(ata_eh_thaw_port); | 6292 | EXPORT_SYMBOL_GPL(ata_eh_thaw_port); |
6293 | EXPORT_SYMBOL_GPL(ata_eh_qc_complete); | 6293 | EXPORT_SYMBOL_GPL(ata_eh_qc_complete); |
6294 | EXPORT_SYMBOL_GPL(ata_eh_qc_retry); | 6294 | EXPORT_SYMBOL_GPL(ata_eh_qc_retry); |
6295 | EXPORT_SYMBOL_GPL(ata_eh_analyze_ncq_error); | ||
6295 | EXPORT_SYMBOL_GPL(ata_do_eh); | 6296 | EXPORT_SYMBOL_GPL(ata_do_eh); |
6296 | EXPORT_SYMBOL_GPL(ata_std_error_handler); | 6297 | EXPORT_SYMBOL_GPL(ata_std_error_handler); |
6297 | 6298 | ||
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 61dcd0026c6..62e033146be 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1357,7 +1357,7 @@ static void ata_eh_analyze_serror(struct ata_link *link) | |||
1357 | * LOCKING: | 1357 | * LOCKING: |
1358 | * Kernel thread context (may sleep). | 1358 | * Kernel thread context (may sleep). |
1359 | */ | 1359 | */ |
1360 | static void ata_eh_analyze_ncq_error(struct ata_link *link) | 1360 | void ata_eh_analyze_ncq_error(struct ata_link *link) |
1361 | { | 1361 | { |
1362 | struct ata_port *ap = link->ap; | 1362 | struct ata_port *ap = link->ap; |
1363 | struct ata_eh_context *ehc = &link->eh_context; | 1363 | struct ata_eh_context *ehc = &link->eh_context; |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 2ec65a8fda7..3c2d2289f85 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -314,11 +314,7 @@ static int ata_sff_check_ready(struct ata_link *link) | |||
314 | { | 314 | { |
315 | u8 status = link->ap->ops->sff_check_status(link->ap); | 315 | u8 status = link->ap->ops->sff_check_status(link->ap); |
316 | 316 | ||
317 | if (!(status & ATA_BUSY)) | 317 | return ata_check_ready(status); |
318 | return 1; | ||
319 | if (status == 0xff) | ||
320 | return -ENODEV; | ||
321 | return 0; | ||
322 | } | 318 | } |
323 | 319 | ||
324 | /** | 320 | /** |
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index c5f91e62994..fbe60571155 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
@@ -259,6 +259,12 @@ static int pacpi_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
259 | .port_ops = &pacpi_ops, | 259 | .port_ops = &pacpi_ops, |
260 | }; | 260 | }; |
261 | const struct ata_port_info *ppi[] = { &info, NULL }; | 261 | const struct ata_port_info *ppi[] = { &info, NULL }; |
262 | if (pdev->vendor == PCI_VENDOR_ID_ATI) { | ||
263 | int rc = pcim_enable_device(pdev); | ||
264 | if (rc < 0) | ||
265 | return rc; | ||
266 | pcim_pin_device(pdev); | ||
267 | } | ||
262 | return ata_pci_sff_init_one(pdev, ppi, &pacpi_sht, NULL); | 268 | return ata_pci_sff_init_one(pdev, ppi, &pacpi_sht, NULL); |
263 | } | 269 | } |
264 | 270 | ||
diff --git a/drivers/ata/pata_sch.c b/drivers/ata/pata_sch.c new file mode 100644 index 00000000000..c8cc027789f --- /dev/null +++ b/drivers/ata/pata_sch.c | |||
@@ -0,0 +1,206 @@ | |||
1 | /* | ||
2 | * pata_sch.c - Intel SCH PATA controllers | ||
3 | * | ||
4 | * Copyright (c) 2008 Alek Du <alek.du@intel.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License 2 as published | ||
8 | * by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; see the file COPYING. If not, write to | ||
17 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * Supports: | ||
23 | * Intel SCH (AF82US15W, AF82US15L, AF82UL11L) chipsets -- see spec at: | ||
24 | * http://download.intel.com/design/chipsets/embedded/datashts/319537.pdf | ||
25 | */ | ||
26 | |||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/pci.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/blkdev.h> | ||
32 | #include <linux/delay.h> | ||
33 | #include <linux/device.h> | ||
34 | #include <scsi/scsi_host.h> | ||
35 | #include <linux/libata.h> | ||
36 | #include <linux/dmi.h> | ||
37 | |||
38 | #define DRV_NAME "pata_sch" | ||
39 | #define DRV_VERSION "0.2" | ||
40 | |||
41 | /* see SCH datasheet page 351 */ | ||
42 | enum { | ||
43 | D0TIM = 0x80, /* Device 0 Timing Register */ | ||
44 | D1TIM = 0x84, /* Device 1 Timing Register */ | ||
45 | PM = 0x07, /* PIO Mode Bit Mask */ | ||
46 | MDM = (0x03 << 8), /* Multi-word DMA Mode Bit Mask */ | ||
47 | UDM = (0x07 << 16), /* Ultra DMA Mode Bit Mask */ | ||
48 | PPE = (1 << 30), /* Prefetch/Post Enable */ | ||
49 | USD = (1 << 31), /* Use Synchronous DMA */ | ||
50 | }; | ||
51 | |||
52 | static int sch_init_one(struct pci_dev *pdev, | ||
53 | const struct pci_device_id *ent); | ||
54 | static void sch_set_piomode(struct ata_port *ap, struct ata_device *adev); | ||
55 | static void sch_set_dmamode(struct ata_port *ap, struct ata_device *adev); | ||
56 | |||
57 | static const struct pci_device_id sch_pci_tbl[] = { | ||
58 | /* Intel SCH PATA Controller */ | ||
59 | { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SCH_IDE), 0 }, | ||
60 | { } /* terminate list */ | ||
61 | }; | ||
62 | |||
63 | static struct pci_driver sch_pci_driver = { | ||
64 | .name = DRV_NAME, | ||
65 | .id_table = sch_pci_tbl, | ||
66 | .probe = sch_init_one, | ||
67 | .remove = ata_pci_remove_one, | ||
68 | #ifdef CONFIG_PM | ||
69 | .suspend = ata_pci_device_suspend, | ||
70 | .resume = ata_pci_device_resume, | ||
71 | #endif | ||
72 | }; | ||
73 | |||
74 | static struct scsi_host_template sch_sht = { | ||
75 | ATA_BMDMA_SHT(DRV_NAME), | ||
76 | }; | ||
77 | |||
78 | static struct ata_port_operations sch_pata_ops = { | ||
79 | .inherits = &ata_bmdma_port_ops, | ||
80 | .cable_detect = ata_cable_unknown, | ||
81 | .set_piomode = sch_set_piomode, | ||
82 | .set_dmamode = sch_set_dmamode, | ||
83 | }; | ||
84 | |||
85 | static struct ata_port_info sch_port_info = { | ||
86 | .flags = 0, | ||
87 | .pio_mask = ATA_PIO4, /* pio0-4 */ | ||
88 | .mwdma_mask = ATA_MWDMA2, /* mwdma0-2 */ | ||
89 | .udma_mask = ATA_UDMA5, /* udma0-5 */ | ||
90 | .port_ops = &sch_pata_ops, | ||
91 | }; | ||
92 | |||
93 | MODULE_AUTHOR("Alek Du <alek.du@intel.com>"); | ||
94 | MODULE_DESCRIPTION("SCSI low-level driver for Intel SCH PATA controllers"); | ||
95 | MODULE_LICENSE("GPL"); | ||
96 | MODULE_DEVICE_TABLE(pci, sch_pci_tbl); | ||
97 | MODULE_VERSION(DRV_VERSION); | ||
98 | |||
99 | /** | ||
100 | * sch_set_piomode - Initialize host controller PATA PIO timings | ||
101 | * @ap: Port whose timings we are configuring | ||
102 | * @adev: ATA device | ||
103 | * | ||
104 | * Set PIO mode for device, in host controller PCI config space. | ||
105 | * | ||
106 | * LOCKING: | ||
107 | * None (inherited from caller). | ||
108 | */ | ||
109 | |||
110 | static void sch_set_piomode(struct ata_port *ap, struct ata_device *adev) | ||
111 | { | ||
112 | unsigned int pio = adev->pio_mode - XFER_PIO_0; | ||
113 | struct pci_dev *dev = to_pci_dev(ap->host->dev); | ||
114 | unsigned int port = adev->devno ? D1TIM : D0TIM; | ||
115 | unsigned int data; | ||
116 | |||
117 | pci_read_config_dword(dev, port, &data); | ||
118 | /* see SCH datasheet page 351 */ | ||
119 | /* set PIO mode */ | ||
120 | data &= ~(PM | PPE); | ||
121 | data |= pio; | ||
122 | /* enable PPE for block device */ | ||
123 | if (adev->class == ATA_DEV_ATA) | ||
124 | data |= PPE; | ||
125 | pci_write_config_dword(dev, port, data); | ||
126 | } | ||
127 | |||
128 | /** | ||
129 | * sch_set_dmamode - Initialize host controller PATA DMA timings | ||
130 | * @ap: Port whose timings we are configuring | ||
131 | * @adev: ATA device | ||
132 | * | ||
133 | * Set MW/UDMA mode for device, in host controller PCI config space. | ||
134 | * | ||
135 | * LOCKING: | ||
136 | * None (inherited from caller). | ||
137 | */ | ||
138 | |||
139 | static void sch_set_dmamode(struct ata_port *ap, struct ata_device *adev) | ||
140 | { | ||
141 | unsigned int dma_mode = adev->dma_mode; | ||
142 | struct pci_dev *dev = to_pci_dev(ap->host->dev); | ||
143 | unsigned int port = adev->devno ? D1TIM : D0TIM; | ||
144 | unsigned int data; | ||
145 | |||
146 | pci_read_config_dword(dev, port, &data); | ||
147 | /* see SCH datasheet page 351 */ | ||
148 | if (dma_mode >= XFER_UDMA_0) { | ||
149 | /* enable Synchronous DMA mode */ | ||
150 | data |= USD; | ||
151 | data &= ~UDM; | ||
152 | data |= (dma_mode - XFER_UDMA_0) << 16; | ||
153 | } else { /* must be MWDMA mode, since we masked SWDMA already */ | ||
154 | data &= ~(USD | MDM); | ||
155 | data |= (dma_mode - XFER_MW_DMA_0) << 8; | ||
156 | } | ||
157 | pci_write_config_dword(dev, port, data); | ||
158 | } | ||
159 | |||
160 | /** | ||
161 | * sch_init_one - Register SCH ATA PCI device with kernel services | ||
162 | * @pdev: PCI device to register | ||
163 | * @ent: Entry in sch_pci_tbl matching with @pdev | ||
164 | * | ||
165 | * LOCKING: | ||
166 | * Inherited from PCI layer (may sleep). | ||
167 | * | ||
168 | * RETURNS: | ||
169 | * Zero on success, or -ERRNO value. | ||
170 | */ | ||
171 | |||
172 | static int __devinit sch_init_one(struct pci_dev *pdev, | ||
173 | const struct pci_device_id *ent) | ||
174 | { | ||
175 | static int printed_version; | ||
176 | const struct ata_port_info *ppi[] = { &sch_port_info, NULL }; | ||
177 | struct ata_host *host; | ||
178 | int rc; | ||
179 | |||
180 | if (!printed_version++) | ||
181 | dev_printk(KERN_DEBUG, &pdev->dev, | ||
182 | "version " DRV_VERSION "\n"); | ||
183 | |||
184 | /* enable device and prepare host */ | ||
185 | rc = pcim_enable_device(pdev); | ||
186 | if (rc) | ||
187 | return rc; | ||
188 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); | ||
189 | if (rc) | ||
190 | return rc; | ||
191 | pci_set_master(pdev); | ||
192 | return ata_pci_sff_activate_host(host, ata_sff_interrupt, &sch_sht); | ||
193 | } | ||
194 | |||
195 | static int __init sch_init(void) | ||
196 | { | ||
197 | return pci_register_driver(&sch_pci_driver); | ||
198 | } | ||
199 | |||
200 | static void __exit sch_exit(void) | ||
201 | { | ||
202 | pci_unregister_driver(&sch_pci_driver); | ||
203 | } | ||
204 | |||
205 | module_init(sch_init); | ||
206 | module_exit(sch_exit); | ||
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index d27bb9a2568..3ead02fe379 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
@@ -10,13 +10,33 @@ | |||
10 | * right. Documentation is available at initio's website but it only | 10 | * right. Documentation is available at initio's website but it only |
11 | * documents registers (not programming model). | 11 | * documents registers (not programming model). |
12 | * | 12 | * |
13 | * - ATA disks work. | 13 | * This driver has interesting history. The first version was written |
14 | * - Hotplug works. | 14 | * from the documentation and a 2.4 IDE driver posted on a Taiwan |
15 | * - ATAPI read works but burning doesn't. This thing is really | 15 | * company, which didn't use any IDMA features and couldn't handle |
16 | * peculiar about ATAPI and I couldn't figure out how ATAPI PIO and | 16 | * LBA48. The resulting driver couldn't handle LBA48 devices either |
17 | * ATAPI DMA WRITE should be programmed. If you've got a clue, be | 17 | * making it pretty useless. |
18 | * my guest. | 18 | * |
19 | * - Both STR and STD work. | 19 | * After a while, initio picked the driver up, renamed it to |
20 | * sata_initio162x, updated it to use IDMA for ATA DMA commands and | ||
21 | * posted it on their website. It only used ATA_PROT_DMA for IDMA and | ||
22 | * attaching both devices and issuing IDMA and !IDMA commands | ||
23 | * simultaneously broke it due to PIRQ masking interaction but it did | ||
24 | * show how to use the IDMA (ADMA + some initio specific twists) | ||
25 | * engine. | ||
26 | * | ||
27 | * Then, I picked up their changes again and here's the usable driver | ||
28 | * which uses IDMA for everything. Everything works now including | ||
29 | * LBA48, CD/DVD burning, suspend/resume and hotplug. There are some | ||
30 | * issues tho. Result Tf is not resported properly, NCQ isn't | ||
31 | * supported yet and CD/DVD writing works with DMA assisted PIO | ||
32 | * protocol (which, for native SATA devices, shouldn't cause any | ||
33 | * noticeable difference). | ||
34 | * | ||
35 | * Anyways, so, here's finally a working driver for inic162x. Enjoy! | ||
36 | * | ||
37 | * initio: If you guys wanna improve the driver regarding result TF | ||
38 | * access and other stuff, please feel free to contact me. I'll be | ||
39 | * happy to assist. | ||
20 | */ | 40 | */ |
21 | 41 | ||
22 | #include <linux/kernel.h> | 42 | #include <linux/kernel.h> |
@@ -28,13 +48,19 @@ | |||
28 | #include <scsi/scsi_device.h> | 48 | #include <scsi/scsi_device.h> |
29 | 49 | ||
30 | #define DRV_NAME "sata_inic162x" | 50 | #define DRV_NAME "sata_inic162x" |
31 | #define DRV_VERSION "0.3" | 51 | #define DRV_VERSION "0.4" |
32 | 52 | ||
33 | enum { | 53 | enum { |
34 | MMIO_BAR = 5, | 54 | MMIO_BAR_PCI = 5, |
55 | MMIO_BAR_CARDBUS = 1, | ||
35 | 56 | ||
36 | NR_PORTS = 2, | 57 | NR_PORTS = 2, |
37 | 58 | ||
59 | IDMA_CPB_TBL_SIZE = 4 * 32, | ||
60 | |||
61 | INIC_DMA_BOUNDARY = 0xffffff, | ||
62 | |||
63 | HOST_ACTRL = 0x08, | ||
38 | HOST_CTL = 0x7c, | 64 | HOST_CTL = 0x7c, |
39 | HOST_STAT = 0x7e, | 65 | HOST_STAT = 0x7e, |
40 | HOST_IRQ_STAT = 0xbc, | 66 | HOST_IRQ_STAT = 0xbc, |
@@ -43,22 +69,37 @@ enum { | |||
43 | PORT_SIZE = 0x40, | 69 | PORT_SIZE = 0x40, |
44 | 70 | ||
45 | /* registers for ATA TF operation */ | 71 | /* registers for ATA TF operation */ |
46 | PORT_TF = 0x00, | 72 | PORT_TF_DATA = 0x00, |
47 | PORT_ALT_STAT = 0x08, | 73 | PORT_TF_FEATURE = 0x01, |
74 | PORT_TF_NSECT = 0x02, | ||
75 | PORT_TF_LBAL = 0x03, | ||
76 | PORT_TF_LBAM = 0x04, | ||
77 | PORT_TF_LBAH = 0x05, | ||
78 | PORT_TF_DEVICE = 0x06, | ||
79 | PORT_TF_COMMAND = 0x07, | ||
80 | PORT_TF_ALT_STAT = 0x08, | ||
48 | PORT_IRQ_STAT = 0x09, | 81 | PORT_IRQ_STAT = 0x09, |
49 | PORT_IRQ_MASK = 0x0a, | 82 | PORT_IRQ_MASK = 0x0a, |
50 | PORT_PRD_CTL = 0x0b, | 83 | PORT_PRD_CTL = 0x0b, |
51 | PORT_PRD_ADDR = 0x0c, | 84 | PORT_PRD_ADDR = 0x0c, |
52 | PORT_PRD_XFERLEN = 0x10, | 85 | PORT_PRD_XFERLEN = 0x10, |
86 | PORT_CPB_CPBLAR = 0x18, | ||
87 | PORT_CPB_PTQFIFO = 0x1c, | ||
53 | 88 | ||
54 | /* IDMA register */ | 89 | /* IDMA register */ |
55 | PORT_IDMA_CTL = 0x14, | 90 | PORT_IDMA_CTL = 0x14, |
91 | PORT_IDMA_STAT = 0x16, | ||
92 | |||
93 | PORT_RPQ_FIFO = 0x1e, | ||
94 | PORT_RPQ_CNT = 0x1f, | ||
56 | 95 | ||
57 | PORT_SCR = 0x20, | 96 | PORT_SCR = 0x20, |
58 | 97 | ||
59 | /* HOST_CTL bits */ | 98 | /* HOST_CTL bits */ |
60 | HCTL_IRQOFF = (1 << 8), /* global IRQ off */ | 99 | HCTL_IRQOFF = (1 << 8), /* global IRQ off */ |
61 | HCTL_PWRDWN = (1 << 13), /* power down PHYs */ | 100 | HCTL_FTHD0 = (1 << 10), /* fifo threshold 0 */ |
101 | HCTL_FTHD1 = (1 << 11), /* fifo threshold 1*/ | ||
102 | HCTL_PWRDWN = (1 << 12), /* power down PHYs */ | ||
62 | HCTL_SOFTRST = (1 << 13), /* global reset (no phy reset) */ | 103 | HCTL_SOFTRST = (1 << 13), /* global reset (no phy reset) */ |
63 | HCTL_RPGSEL = (1 << 15), /* register page select */ | 104 | HCTL_RPGSEL = (1 << 15), /* register page select */ |
64 | 105 | ||
@@ -81,9 +122,7 @@ enum { | |||
81 | PIRQ_PENDING = (1 << 7), /* port IRQ pending (STAT only) */ | 122 | PIRQ_PENDING = (1 << 7), /* port IRQ pending (STAT only) */ |
82 | 123 | ||
83 | PIRQ_ERR = PIRQ_OFFLINE | PIRQ_ONLINE | PIRQ_FATAL, | 124 | PIRQ_ERR = PIRQ_OFFLINE | PIRQ_ONLINE | PIRQ_FATAL, |
84 | 125 | PIRQ_MASK_DEFAULT = PIRQ_REPLY | PIRQ_ATA, | |
85 | PIRQ_MASK_DMA_READ = PIRQ_REPLY | PIRQ_ATA, | ||
86 | PIRQ_MASK_OTHER = PIRQ_REPLY | PIRQ_COMPLETE, | ||
87 | PIRQ_MASK_FREEZE = 0xff, | 126 | PIRQ_MASK_FREEZE = 0xff, |
88 | 127 | ||
89 | /* PORT_PRD_CTL bits */ | 128 | /* PORT_PRD_CTL bits */ |
@@ -96,20 +135,104 @@ enum { | |||
96 | IDMA_CTL_RST_IDMA = (1 << 5), /* reset IDMA machinary */ | 135 | IDMA_CTL_RST_IDMA = (1 << 5), /* reset IDMA machinary */ |
97 | IDMA_CTL_GO = (1 << 7), /* IDMA mode go */ | 136 | IDMA_CTL_GO = (1 << 7), /* IDMA mode go */ |
98 | IDMA_CTL_ATA_NIEN = (1 << 8), /* ATA IRQ disable */ | 137 | IDMA_CTL_ATA_NIEN = (1 << 8), /* ATA IRQ disable */ |
138 | |||
139 | /* PORT_IDMA_STAT bits */ | ||
140 | IDMA_STAT_PERR = (1 << 0), /* PCI ERROR MODE */ | ||
141 | IDMA_STAT_CPBERR = (1 << 1), /* ADMA CPB error */ | ||
142 | IDMA_STAT_LGCY = (1 << 3), /* ADMA legacy */ | ||
143 | IDMA_STAT_UIRQ = (1 << 4), /* ADMA unsolicited irq */ | ||
144 | IDMA_STAT_STPD = (1 << 5), /* ADMA stopped */ | ||
145 | IDMA_STAT_PSD = (1 << 6), /* ADMA pause */ | ||
146 | IDMA_STAT_DONE = (1 << 7), /* ADMA done */ | ||
147 | |||
148 | IDMA_STAT_ERR = IDMA_STAT_PERR | IDMA_STAT_CPBERR, | ||
149 | |||
150 | /* CPB Control Flags*/ | ||
151 | CPB_CTL_VALID = (1 << 0), /* CPB valid */ | ||
152 | CPB_CTL_QUEUED = (1 << 1), /* queued command */ | ||
153 | CPB_CTL_DATA = (1 << 2), /* data, rsvd in datasheet */ | ||
154 | CPB_CTL_IEN = (1 << 3), /* PCI interrupt enable */ | ||
155 | CPB_CTL_DEVDIR = (1 << 4), /* device direction control */ | ||
156 | |||
157 | /* CPB Response Flags */ | ||
158 | CPB_RESP_DONE = (1 << 0), /* ATA command complete */ | ||
159 | CPB_RESP_REL = (1 << 1), /* ATA release */ | ||
160 | CPB_RESP_IGNORED = (1 << 2), /* CPB ignored */ | ||
161 | CPB_RESP_ATA_ERR = (1 << 3), /* ATA command error */ | ||
162 | CPB_RESP_SPURIOUS = (1 << 4), /* ATA spurious interrupt error */ | ||
163 | CPB_RESP_UNDERFLOW = (1 << 5), /* APRD deficiency length error */ | ||
164 | CPB_RESP_OVERFLOW = (1 << 6), /* APRD exccess length error */ | ||
165 | CPB_RESP_CPB_ERR = (1 << 7), /* CPB error flag */ | ||
166 | |||
167 | /* PRD Control Flags */ | ||
168 | PRD_DRAIN = (1 << 1), /* ignore data excess */ | ||
169 | PRD_CDB = (1 << 2), /* atapi packet command pointer */ | ||
170 | PRD_DIRECT_INTR = (1 << 3), /* direct interrupt */ | ||
171 | PRD_DMA = (1 << 4), /* data transfer method */ | ||
172 | PRD_WRITE = (1 << 5), /* data dir, rsvd in datasheet */ | ||
173 | PRD_IOM = (1 << 6), /* io/memory transfer */ | ||
174 | PRD_END = (1 << 7), /* APRD chain end */ | ||
99 | }; | 175 | }; |
100 | 176 | ||
177 | /* Comman Parameter Block */ | ||
178 | struct inic_cpb { | ||
179 | u8 resp_flags; /* Response Flags */ | ||
180 | u8 error; /* ATA Error */ | ||
181 | u8 status; /* ATA Status */ | ||
182 | u8 ctl_flags; /* Control Flags */ | ||
183 | __le32 len; /* Total Transfer Length */ | ||
184 | __le32 prd; /* First PRD pointer */ | ||
185 | u8 rsvd[4]; | ||
186 | /* 16 bytes */ | ||
187 | u8 feature; /* ATA Feature */ | ||
188 | u8 hob_feature; /* ATA Ex. Feature */ | ||
189 | u8 device; /* ATA Device/Head */ | ||
190 | u8 mirctl; /* Mirror Control */ | ||
191 | u8 nsect; /* ATA Sector Count */ | ||
192 | u8 hob_nsect; /* ATA Ex. Sector Count */ | ||
193 | u8 lbal; /* ATA Sector Number */ | ||
194 | u8 hob_lbal; /* ATA Ex. Sector Number */ | ||
195 | u8 lbam; /* ATA Cylinder Low */ | ||
196 | u8 hob_lbam; /* ATA Ex. Cylinder Low */ | ||
197 | u8 lbah; /* ATA Cylinder High */ | ||
198 | u8 hob_lbah; /* ATA Ex. Cylinder High */ | ||
199 | u8 command; /* ATA Command */ | ||
200 | u8 ctl; /* ATA Control */ | ||
201 | u8 slave_error; /* Slave ATA Error */ | ||
202 | u8 slave_status; /* Slave ATA Status */ | ||
203 | /* 32 bytes */ | ||
204 | } __packed; | ||
205 | |||
206 | /* Physical Region Descriptor */ | ||
207 | struct inic_prd { | ||
208 | __le32 mad; /* Physical Memory Address */ | ||
209 | __le16 len; /* Transfer Length */ | ||
210 | u8 rsvd; | ||
211 | u8 flags; /* Control Flags */ | ||
212 | } __packed; | ||
213 | |||
214 | struct inic_pkt { | ||
215 | struct inic_cpb cpb; | ||
216 | struct inic_prd prd[LIBATA_MAX_PRD + 1]; /* + 1 for cdb */ | ||
217 | u8 cdb[ATAPI_CDB_LEN]; | ||
218 | } __packed; | ||
219 | |||
101 | struct inic_host_priv { | 220 | struct inic_host_priv { |
102 | u16 cached_hctl; | 221 | void __iomem *mmio_base; |
222 | u16 cached_hctl; | ||
103 | }; | 223 | }; |
104 | 224 | ||
105 | struct inic_port_priv { | 225 | struct inic_port_priv { |
106 | u8 dfl_prdctl; | 226 | struct inic_pkt *pkt; |
107 | u8 cached_prdctl; | 227 | dma_addr_t pkt_dma; |
108 | u8 cached_pirq_mask; | 228 | u32 *cpb_tbl; |
229 | dma_addr_t cpb_tbl_dma; | ||
109 | }; | 230 | }; |
110 | 231 | ||
111 | static struct scsi_host_template inic_sht = { | 232 | static struct scsi_host_template inic_sht = { |
112 | ATA_BMDMA_SHT(DRV_NAME), | 233 | ATA_BASE_SHT(DRV_NAME), |
234 | .sg_tablesize = LIBATA_MAX_PRD, /* maybe it can be larger? */ | ||
235 | .dma_boundary = INIC_DMA_BOUNDARY, | ||
113 | }; | 236 | }; |
114 | 237 | ||
115 | static const int scr_map[] = { | 238 | static const int scr_map[] = { |
@@ -120,54 +243,34 @@ static const int scr_map[] = { | |||
120 | 243 | ||
121 | static void __iomem *inic_port_base(struct ata_port *ap) | 244 | static void __iomem *inic_port_base(struct ata_port *ap) |
122 | { | 245 | { |
123 | return ap->host->iomap[MMIO_BAR] + ap->port_no * PORT_SIZE; | 246 | struct inic_host_priv *hpriv = ap->host->private_data; |
124 | } | ||
125 | |||
126 | static void __inic_set_pirq_mask(struct ata_port *ap, u8 mask) | ||
127 | { | ||
128 | void __iomem *port_base = inic_port_base(ap); | ||
129 | struct inic_port_priv *pp = ap->private_data; | ||
130 | 247 | ||
131 | writeb(mask, port_base + PORT_IRQ_MASK); | 248 | return hpriv->mmio_base + ap->port_no * PORT_SIZE; |
132 | pp->cached_pirq_mask = mask; | ||
133 | } | ||
134 | |||
135 | static void inic_set_pirq_mask(struct ata_port *ap, u8 mask) | ||
136 | { | ||
137 | struct inic_port_priv *pp = ap->private_data; | ||
138 | |||
139 | if (pp->cached_pirq_mask != mask) | ||
140 | __inic_set_pirq_mask(ap, mask); | ||
141 | } | 249 | } |
142 | 250 | ||
143 | static void inic_reset_port(void __iomem *port_base) | 251 | static void inic_reset_port(void __iomem *port_base) |
144 | { | 252 | { |
145 | void __iomem *idma_ctl = port_base + PORT_IDMA_CTL; | 253 | void __iomem *idma_ctl = port_base + PORT_IDMA_CTL; |
146 | u16 ctl; | ||
147 | 254 | ||
148 | ctl = readw(idma_ctl); | 255 | /* stop IDMA engine */ |
149 | ctl &= ~(IDMA_CTL_RST_IDMA | IDMA_CTL_ATA_NIEN | IDMA_CTL_GO); | 256 | readw(idma_ctl); /* flush */ |
257 | msleep(1); | ||
150 | 258 | ||
151 | /* mask IRQ and assert reset */ | 259 | /* mask IRQ and assert reset */ |
152 | writew(ctl | IDMA_CTL_RST_IDMA | IDMA_CTL_ATA_NIEN, idma_ctl); | 260 | writew(IDMA_CTL_RST_IDMA, idma_ctl); |
153 | readw(idma_ctl); /* flush */ | 261 | readw(idma_ctl); /* flush */ |
154 | |||
155 | /* give it some time */ | ||
156 | msleep(1); | 262 | msleep(1); |
157 | 263 | ||
158 | /* release reset */ | 264 | /* release reset */ |
159 | writew(ctl | IDMA_CTL_ATA_NIEN, idma_ctl); | 265 | writew(0, idma_ctl); |
160 | 266 | ||
161 | /* clear irq */ | 267 | /* clear irq */ |
162 | writeb(0xff, port_base + PORT_IRQ_STAT); | 268 | writeb(0xff, port_base + PORT_IRQ_STAT); |
163 | |||
164 | /* reenable ATA IRQ, turn off IDMA mode */ | ||
165 | writew(ctl, idma_ctl); | ||
166 | } | 269 | } |
167 | 270 | ||
168 | static int inic_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val) | 271 | static int inic_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val) |
169 | { | 272 | { |
170 | void __iomem *scr_addr = ap->ioaddr.scr_addr; | 273 | void __iomem *scr_addr = inic_port_base(ap) + PORT_SCR; |
171 | void __iomem *addr; | 274 | void __iomem *addr; |
172 | 275 | ||
173 | if (unlikely(sc_reg >= ARRAY_SIZE(scr_map))) | 276 | if (unlikely(sc_reg >= ARRAY_SIZE(scr_map))) |
@@ -184,120 +287,126 @@ static int inic_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val) | |||
184 | 287 | ||
185 | static int inic_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val) | 288 | static int inic_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val) |
186 | { | 289 | { |
187 | void __iomem *scr_addr = ap->ioaddr.scr_addr; | 290 | void __iomem *scr_addr = inic_port_base(ap) + PORT_SCR; |
188 | void __iomem *addr; | ||
189 | 291 | ||
190 | if (unlikely(sc_reg >= ARRAY_SIZE(scr_map))) | 292 | if (unlikely(sc_reg >= ARRAY_SIZE(scr_map))) |
191 | return -EINVAL; | 293 | return -EINVAL; |
192 | 294 | ||
193 | addr = scr_addr + scr_map[sc_reg] * 4; | ||
194 | writel(val, scr_addr + scr_map[sc_reg] * 4); | 295 | writel(val, scr_addr + scr_map[sc_reg] * 4); |
195 | return 0; | 296 | return 0; |
196 | } | 297 | } |
197 | 298 | ||
198 | /* | 299 | static void inic_stop_idma(struct ata_port *ap) |
199 | * In TF mode, inic162x is very similar to SFF device. TF registers | ||
200 | * function the same. DMA engine behaves similary using the same PRD | ||
201 | * format as BMDMA but different command register, interrupt and event | ||
202 | * notification methods are used. The following inic_bmdma_*() | ||
203 | * functions do the impedance matching. | ||
204 | */ | ||
205 | static void inic_bmdma_setup(struct ata_queued_cmd *qc) | ||
206 | { | 300 | { |
207 | struct ata_port *ap = qc->ap; | ||
208 | struct inic_port_priv *pp = ap->private_data; | ||
209 | void __iomem *port_base = inic_port_base(ap); | 301 | void __iomem *port_base = inic_port_base(ap); |
210 | int rw = qc->tf.flags & ATA_TFLAG_WRITE; | ||
211 | |||
212 | /* make sure device sees PRD table writes */ | ||
213 | wmb(); | ||
214 | |||
215 | /* load transfer length */ | ||
216 | writel(qc->nbytes, port_base + PORT_PRD_XFERLEN); | ||
217 | |||
218 | /* turn on DMA and specify data direction */ | ||
219 | pp->cached_prdctl = pp->dfl_prdctl | PRD_CTL_DMAEN; | ||
220 | if (!rw) | ||
221 | pp->cached_prdctl |= PRD_CTL_WR; | ||
222 | writeb(pp->cached_prdctl, port_base + PORT_PRD_CTL); | ||
223 | 302 | ||
224 | /* issue r/w command */ | 303 | readb(port_base + PORT_RPQ_FIFO); |
225 | ap->ops->sff_exec_command(ap, &qc->tf); | 304 | readb(port_base + PORT_RPQ_CNT); |
305 | writew(0, port_base + PORT_IDMA_CTL); | ||
226 | } | 306 | } |
227 | 307 | ||
228 | static void inic_bmdma_start(struct ata_queued_cmd *qc) | 308 | static void inic_host_err_intr(struct ata_port *ap, u8 irq_stat, u16 idma_stat) |
229 | { | 309 | { |
230 | struct ata_port *ap = qc->ap; | 310 | struct ata_eh_info *ehi = &ap->link.eh_info; |
231 | struct inic_port_priv *pp = ap->private_data; | 311 | struct inic_port_priv *pp = ap->private_data; |
232 | void __iomem *port_base = inic_port_base(ap); | 312 | struct inic_cpb *cpb = &pp->pkt->cpb; |
313 | bool freeze = false; | ||
233 | 314 | ||
234 | /* start host DMA transaction */ | 315 | ata_ehi_clear_desc(ehi); |
235 | pp->cached_prdctl |= PRD_CTL_START; | 316 | ata_ehi_push_desc(ehi, "irq_stat=0x%x idma_stat=0x%x", |
236 | writeb(pp->cached_prdctl, port_base + PORT_PRD_CTL); | 317 | irq_stat, idma_stat); |
237 | } | ||
238 | 318 | ||
239 | static void inic_bmdma_stop(struct ata_queued_cmd *qc) | 319 | inic_stop_idma(ap); |
240 | { | ||
241 | struct ata_port *ap = qc->ap; | ||
242 | struct inic_port_priv *pp = ap->private_data; | ||
243 | void __iomem *port_base = inic_port_base(ap); | ||
244 | 320 | ||
245 | /* stop DMA engine */ | 321 | if (irq_stat & (PIRQ_OFFLINE | PIRQ_ONLINE)) { |
246 | writeb(pp->dfl_prdctl, port_base + PORT_PRD_CTL); | 322 | ata_ehi_push_desc(ehi, "hotplug"); |
247 | } | 323 | ata_ehi_hotplugged(ehi); |
324 | freeze = true; | ||
325 | } | ||
248 | 326 | ||
249 | static u8 inic_bmdma_status(struct ata_port *ap) | 327 | if (idma_stat & IDMA_STAT_PERR) { |
250 | { | 328 | ata_ehi_push_desc(ehi, "PCI error"); |
251 | /* event is already verified by the interrupt handler */ | 329 | freeze = true; |
252 | return ATA_DMA_INTR; | 330 | } |
331 | |||
332 | if (idma_stat & IDMA_STAT_CPBERR) { | ||
333 | ata_ehi_push_desc(ehi, "CPB error"); | ||
334 | |||
335 | if (cpb->resp_flags & CPB_RESP_IGNORED) { | ||
336 | __ata_ehi_push_desc(ehi, " ignored"); | ||
337 | ehi->err_mask |= AC_ERR_INVALID; | ||
338 | freeze = true; | ||
339 | } | ||
340 | |||
341 | if (cpb->resp_flags & CPB_RESP_ATA_ERR) | ||
342 | ehi->err_mask |= AC_ERR_DEV; | ||
343 | |||
344 | if (cpb->resp_flags & CPB_RESP_SPURIOUS) { | ||
345 | __ata_ehi_push_desc(ehi, " spurious-intr"); | ||
346 | ehi->err_mask |= AC_ERR_HSM; | ||
347 | freeze = true; | ||
348 | } | ||
349 | |||
350 | if (cpb->resp_flags & | ||
351 | (CPB_RESP_UNDERFLOW | CPB_RESP_OVERFLOW)) { | ||
352 | __ata_ehi_push_desc(ehi, " data-over/underflow"); | ||
353 | ehi->err_mask |= AC_ERR_HSM; | ||
354 | freeze = true; | ||
355 | } | ||
356 | } | ||
357 | |||
358 | if (freeze) | ||
359 | ata_port_freeze(ap); | ||
360 | else | ||
361 | ata_port_abort(ap); | ||
253 | } | 362 | } |
254 | 363 | ||
255 | static void inic_host_intr(struct ata_port *ap) | 364 | static void inic_host_intr(struct ata_port *ap) |
256 | { | 365 | { |
257 | void __iomem *port_base = inic_port_base(ap); | 366 | void __iomem *port_base = inic_port_base(ap); |
258 | struct ata_eh_info *ehi = &ap->link.eh_info; | 367 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag); |
259 | u8 irq_stat; | 368 | u8 irq_stat; |
369 | u16 idma_stat; | ||
260 | 370 | ||
261 | /* fetch and clear irq */ | 371 | /* read and clear IRQ status */ |
262 | irq_stat = readb(port_base + PORT_IRQ_STAT); | 372 | irq_stat = readb(port_base + PORT_IRQ_STAT); |
263 | writeb(irq_stat, port_base + PORT_IRQ_STAT); | 373 | writeb(irq_stat, port_base + PORT_IRQ_STAT); |
374 | idma_stat = readw(port_base + PORT_IDMA_STAT); | ||
264 | 375 | ||
265 | if (likely(!(irq_stat & PIRQ_ERR))) { | 376 | if (unlikely((irq_stat & PIRQ_ERR) || (idma_stat & IDMA_STAT_ERR))) |
266 | struct ata_queued_cmd *qc = | 377 | inic_host_err_intr(ap, irq_stat, idma_stat); |
267 | ata_qc_from_tag(ap, ap->link.active_tag); | ||
268 | 378 | ||
269 | if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) { | 379 | if (unlikely(!qc)) |
270 | ap->ops->sff_check_status(ap); /* clear ATA interrupt */ | 380 | goto spurious; |
271 | return; | ||
272 | } | ||
273 | 381 | ||
274 | if (likely(ata_sff_host_intr(ap, qc))) | 382 | if (likely(idma_stat & IDMA_STAT_DONE)) { |
275 | return; | 383 | inic_stop_idma(ap); |
276 | 384 | ||
277 | ap->ops->sff_check_status(ap); /* clear ATA interrupt */ | 385 | /* Depending on circumstances, device error |
278 | ata_port_printk(ap, KERN_WARNING, "unhandled " | 386 | * isn't reported by IDMA, check it explicitly. |
279 | "interrupt, irq_stat=%x\n", irq_stat); | 387 | */ |
388 | if (unlikely(readb(port_base + PORT_TF_COMMAND) & | ||
389 | (ATA_DF | ATA_ERR))) | ||
390 | qc->err_mask |= AC_ERR_DEV; | ||
391 | |||
392 | ata_qc_complete(qc); | ||
280 | return; | 393 | return; |
281 | } | 394 | } |
282 | 395 | ||
283 | /* error */ | 396 | spurious: |
284 | ata_ehi_push_desc(ehi, "irq_stat=0x%x", irq_stat); | 397 | ata_port_printk(ap, KERN_WARNING, "unhandled interrupt: " |
285 | 398 | "cmd=0x%x irq_stat=0x%x idma_stat=0x%x\n", | |
286 | if (irq_stat & (PIRQ_OFFLINE | PIRQ_ONLINE)) { | 399 | qc ? qc->tf.command : 0xff, irq_stat, idma_stat); |
287 | ata_ehi_hotplugged(ehi); | ||
288 | ata_port_freeze(ap); | ||
289 | } else | ||
290 | ata_port_abort(ap); | ||
291 | } | 400 | } |
292 | 401 | ||
293 | static irqreturn_t inic_interrupt(int irq, void *dev_instance) | 402 | static irqreturn_t inic_interrupt(int irq, void *dev_instance) |
294 | { | 403 | { |
295 | struct ata_host *host = dev_instance; | 404 | struct ata_host *host = dev_instance; |
296 | void __iomem *mmio_base = host->iomap[MMIO_BAR]; | 405 | struct inic_host_priv *hpriv = host->private_data; |
297 | u16 host_irq_stat; | 406 | u16 host_irq_stat; |
298 | int i, handled = 0;; | 407 | int i, handled = 0;; |
299 | 408 | ||
300 | host_irq_stat = readw(mmio_base + HOST_IRQ_STAT); | 409 | host_irq_stat = readw(hpriv->mmio_base + HOST_IRQ_STAT); |
301 | 410 | ||
302 | if (unlikely(!(host_irq_stat & HIRQ_GLOBAL))) | 411 | if (unlikely(!(host_irq_stat & HIRQ_GLOBAL))) |
303 | goto out; | 412 | goto out; |
@@ -327,60 +436,173 @@ static irqreturn_t inic_interrupt(int irq, void *dev_instance) | |||
327 | return IRQ_RETVAL(handled); | 436 | return IRQ_RETVAL(handled); |
328 | } | 437 | } |
329 | 438 | ||
439 | static int inic_check_atapi_dma(struct ata_queued_cmd *qc) | ||
440 | { | ||
441 | /* For some reason ATAPI_PROT_DMA doesn't work for some | ||
442 | * commands including writes and other misc ops. Use PIO | ||
443 | * protocol instead, which BTW is driven by the DMA engine | ||
444 | * anyway, so it shouldn't make much difference for native | ||
445 | * SATA devices. | ||
446 | */ | ||
447 | if (atapi_cmd_type(qc->cdb[0]) == READ) | ||
448 | return 0; | ||
449 | return 1; | ||
450 | } | ||
451 | |||
452 | static void inic_fill_sg(struct inic_prd *prd, struct ata_queued_cmd *qc) | ||
453 | { | ||
454 | struct scatterlist *sg; | ||
455 | unsigned int si; | ||
456 | u8 flags = 0; | ||
457 | |||
458 | if (qc->tf.flags & ATA_TFLAG_WRITE) | ||
459 | flags |= PRD_WRITE; | ||
460 | |||
461 | if (ata_is_dma(qc->tf.protocol)) | ||
462 | flags |= PRD_DMA; | ||
463 | |||
464 | for_each_sg(qc->sg, sg, qc->n_elem, si) { | ||
465 | prd->mad = cpu_to_le32(sg_dma_address(sg)); | ||
466 | prd->len = cpu_to_le16(sg_dma_len(sg)); | ||
467 | prd->flags = flags; | ||
468 | prd++; | ||
469 | } | ||
470 | |||
471 | WARN_ON(!si); | ||
472 | prd[-1].flags |= PRD_END; | ||
473 | } | ||
474 | |||
475 | static void inic_qc_prep(struct ata_queued_cmd *qc) | ||
476 | { | ||
477 | struct inic_port_priv *pp = qc->ap->private_data; | ||
478 | struct inic_pkt *pkt = pp->pkt; | ||
479 | struct inic_cpb *cpb = &pkt->cpb; | ||
480 | struct inic_prd *prd = pkt->prd; | ||
481 | bool is_atapi = ata_is_atapi(qc->tf.protocol); | ||
482 | bool is_data = ata_is_data(qc->tf.protocol); | ||
483 | unsigned int cdb_len = 0; | ||
484 | |||
485 | VPRINTK("ENTER\n"); | ||
486 | |||
487 | if (is_atapi) | ||
488 | cdb_len = qc->dev->cdb_len; | ||
489 | |||
490 | /* prepare packet, based on initio driver */ | ||
491 | memset(pkt, 0, sizeof(struct inic_pkt)); | ||
492 | |||
493 | cpb->ctl_flags = CPB_CTL_VALID | CPB_CTL_IEN; | ||
494 | if (is_atapi || is_data) | ||
495 | cpb->ctl_flags |= CPB_CTL_DATA; | ||
496 | |||
497 | cpb->len = cpu_to_le32(qc->nbytes + cdb_len); | ||
498 | cpb->prd = cpu_to_le32(pp->pkt_dma + offsetof(struct inic_pkt, prd)); | ||
499 | |||
500 | cpb->device = qc->tf.device; | ||
501 | cpb->feature = qc->tf.feature; | ||
502 | cpb->nsect = qc->tf.nsect; | ||
503 | cpb->lbal = qc->tf.lbal; | ||
504 | cpb->lbam = qc->tf.lbam; | ||
505 | cpb->lbah = qc->tf.lbah; | ||
506 | |||
507 | if (qc->tf.flags & ATA_TFLAG_LBA48) { | ||
508 | cpb->hob_feature = qc->tf.hob_feature; | ||
509 | cpb->hob_nsect = qc->tf.hob_nsect; | ||
510 | cpb->hob_lbal = qc->tf.hob_lbal; | ||
511 | cpb->hob_lbam = qc->tf.hob_lbam; | ||
512 | cpb->hob_lbah = qc->tf.hob_lbah; | ||
513 | } | ||
514 | |||
515 | cpb->command = qc->tf.command; | ||
516 | /* don't load ctl - dunno why. it's like that in the initio driver */ | ||
517 | |||
518 | /* setup PRD for CDB */ | ||
519 | if (is_atapi) { | ||
520 | memcpy(pkt->cdb, qc->cdb, ATAPI_CDB_LEN); | ||
521 | prd->mad = cpu_to_le32(pp->pkt_dma + | ||
522 | offsetof(struct inic_pkt, cdb)); | ||
523 | prd->len = cpu_to_le16(cdb_len); | ||
524 | prd->flags = PRD_CDB | PRD_WRITE; | ||
525 | if (!is_data) | ||
526 | prd->flags |= PRD_END; | ||
527 | prd++; | ||
528 | } | ||
529 | |||
530 | /* setup sg table */ | ||
531 | if (is_data) | ||
532 | inic_fill_sg(prd, qc); | ||
533 | |||
534 | pp->cpb_tbl[0] = pp->pkt_dma; | ||
535 | } | ||
536 | |||
330 | static unsigned int inic_qc_issue(struct ata_queued_cmd *qc) | 537 | static unsigned int inic_qc_issue(struct ata_queued_cmd *qc) |
331 | { | 538 | { |
332 | struct ata_port *ap = qc->ap; | 539 | struct ata_port *ap = qc->ap; |
540 | void __iomem *port_base = inic_port_base(ap); | ||
333 | 541 | ||
334 | /* ATA IRQ doesn't wait for DMA transfer completion and vice | 542 | /* fire up the ADMA engine */ |
335 | * versa. Mask IRQ selectively to detect command completion. | 543 | writew(HCTL_FTHD0, port_base + HOST_CTL); |
336 | * Without it, ATA DMA read command can cause data corruption. | 544 | writew(IDMA_CTL_GO, port_base + PORT_IDMA_CTL); |
337 | * | 545 | writeb(0, port_base + PORT_CPB_PTQFIFO); |
338 | * Something similar might be needed for ATAPI writes. I | 546 | |
339 | * tried a lot of combinations but couldn't find the solution. | 547 | return 0; |
340 | */ | 548 | } |
341 | if (qc->tf.protocol == ATA_PROT_DMA && | 549 | |
342 | !(qc->tf.flags & ATA_TFLAG_WRITE)) | 550 | static void inic_tf_read(struct ata_port *ap, struct ata_taskfile *tf) |
343 | inic_set_pirq_mask(ap, PIRQ_MASK_DMA_READ); | 551 | { |
344 | else | 552 | void __iomem *port_base = inic_port_base(ap); |
345 | inic_set_pirq_mask(ap, PIRQ_MASK_OTHER); | 553 | |
554 | tf->feature = readb(port_base + PORT_TF_FEATURE); | ||
555 | tf->nsect = readb(port_base + PORT_TF_NSECT); | ||
556 | tf->lbal = readb(port_base + PORT_TF_LBAL); | ||
557 | tf->lbam = readb(port_base + PORT_TF_LBAM); | ||
558 | tf->lbah = readb(port_base + PORT_TF_LBAH); | ||
559 | tf->device = readb(port_base + PORT_TF_DEVICE); | ||
560 | tf->command = readb(port_base + PORT_TF_COMMAND); | ||
561 | } | ||
346 | 562 | ||
347 | /* Issuing a command to yet uninitialized port locks up the | 563 | static bool inic_qc_fill_rtf(struct ata_queued_cmd *qc) |
348 | * controller. Most of the time, this happens for the first | 564 | { |
349 | * command after reset which are ATA and ATAPI IDENTIFYs. | 565 | struct ata_taskfile *rtf = &qc->result_tf; |
350 | * Fast fail if stat is 0x7f or 0xff for those commands. | 566 | struct ata_taskfile tf; |
567 | |||
568 | /* FIXME: Except for status and error, result TF access | ||
569 | * doesn't work. I tried reading from BAR0/2, CPB and BAR5. | ||
570 | * None works regardless of which command interface is used. | ||
571 | * For now return true iff status indicates device error. | ||
572 | * This means that we're reporting bogus sector for RW | ||
573 | * failures. Eeekk.... | ||
351 | */ | 574 | */ |
352 | if (unlikely(qc->tf.command == ATA_CMD_ID_ATA || | 575 | inic_tf_read(qc->ap, &tf); |
353 | qc->tf.command == ATA_CMD_ID_ATAPI)) { | ||
354 | u8 stat = ap->ops->sff_check_status(ap); | ||
355 | if (stat == 0x7f || stat == 0xff) | ||
356 | return AC_ERR_HSM; | ||
357 | } | ||
358 | 576 | ||
359 | return ata_sff_qc_issue(qc); | 577 | if (!(tf.command & ATA_ERR)) |
578 | return false; | ||
579 | |||
580 | rtf->command = tf.command; | ||
581 | rtf->feature = tf.feature; | ||
582 | return true; | ||
360 | } | 583 | } |
361 | 584 | ||
362 | static void inic_freeze(struct ata_port *ap) | 585 | static void inic_freeze(struct ata_port *ap) |
363 | { | 586 | { |
364 | void __iomem *port_base = inic_port_base(ap); | 587 | void __iomem *port_base = inic_port_base(ap); |
365 | 588 | ||
366 | __inic_set_pirq_mask(ap, PIRQ_MASK_FREEZE); | 589 | writeb(PIRQ_MASK_FREEZE, port_base + PORT_IRQ_MASK); |
367 | |||
368 | ap->ops->sff_check_status(ap); | ||
369 | writeb(0xff, port_base + PORT_IRQ_STAT); | 590 | writeb(0xff, port_base + PORT_IRQ_STAT); |
370 | |||
371 | readb(port_base + PORT_IRQ_STAT); /* flush */ | ||
372 | } | 591 | } |
373 | 592 | ||
374 | static void inic_thaw(struct ata_port *ap) | 593 | static void inic_thaw(struct ata_port *ap) |
375 | { | 594 | { |
376 | void __iomem *port_base = inic_port_base(ap); | 595 | void __iomem *port_base = inic_port_base(ap); |
377 | 596 | ||
378 | ap->ops->sff_check_status(ap); | ||
379 | writeb(0xff, port_base + PORT_IRQ_STAT); | 597 | writeb(0xff, port_base + PORT_IRQ_STAT); |
598 | writeb(PIRQ_MASK_DEFAULT, port_base + PORT_IRQ_MASK); | ||
599 | } | ||
380 | 600 | ||
381 | __inic_set_pirq_mask(ap, PIRQ_MASK_OTHER); | 601 | static int inic_check_ready(struct ata_link *link) |
602 | { | ||
603 | void __iomem *port_base = inic_port_base(link->ap); | ||
382 | 604 | ||
383 | readb(port_base + PORT_IRQ_STAT); /* flush */ | 605 | return ata_check_ready(readb(port_base + PORT_TF_COMMAND)); |
384 | } | 606 | } |
385 | 607 | ||
386 | /* | 608 | /* |
@@ -394,17 +616,15 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class, | |||
394 | void __iomem *port_base = inic_port_base(ap); | 616 | void __iomem *port_base = inic_port_base(ap); |
395 | void __iomem *idma_ctl = port_base + PORT_IDMA_CTL; | 617 | void __iomem *idma_ctl = port_base + PORT_IDMA_CTL; |
396 | const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); | 618 | const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); |
397 | u16 val; | ||
398 | int rc; | 619 | int rc; |
399 | 620 | ||
400 | /* hammer it into sane state */ | 621 | /* hammer it into sane state */ |
401 | inic_reset_port(port_base); | 622 | inic_reset_port(port_base); |
402 | 623 | ||
403 | val = readw(idma_ctl); | 624 | writew(IDMA_CTL_RST_ATA, idma_ctl); |
404 | writew(val | IDMA_CTL_RST_ATA, idma_ctl); | ||
405 | readw(idma_ctl); /* flush */ | 625 | readw(idma_ctl); /* flush */ |
406 | msleep(1); | 626 | msleep(1); |
407 | writew(val & ~IDMA_CTL_RST_ATA, idma_ctl); | 627 | writew(0, idma_ctl); |
408 | 628 | ||
409 | rc = sata_link_resume(link, timing, deadline); | 629 | rc = sata_link_resume(link, timing, deadline); |
410 | if (rc) { | 630 | if (rc) { |
@@ -418,7 +638,7 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class, | |||
418 | struct ata_taskfile tf; | 638 | struct ata_taskfile tf; |
419 | 639 | ||
420 | /* wait for link to become ready */ | 640 | /* wait for link to become ready */ |
421 | rc = ata_sff_wait_after_reset(link, 1, deadline); | 641 | rc = ata_wait_after_reset(link, deadline, inic_check_ready); |
422 | /* link occupied, -ENODEV too is an error */ | 642 | /* link occupied, -ENODEV too is an error */ |
423 | if (rc) { | 643 | if (rc) { |
424 | ata_link_printk(link, KERN_WARNING, "device not ready " | 644 | ata_link_printk(link, KERN_WARNING, "device not ready " |
@@ -426,7 +646,7 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class, | |||
426 | return rc; | 646 | return rc; |
427 | } | 647 | } |
428 | 648 | ||
429 | ata_sff_tf_read(ap, &tf); | 649 | inic_tf_read(ap, &tf); |
430 | *class = ata_dev_classify(&tf); | 650 | *class = ata_dev_classify(&tf); |
431 | } | 651 | } |
432 | 652 | ||
@@ -436,18 +656,8 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class, | |||
436 | static void inic_error_handler(struct ata_port *ap) | 656 | static void inic_error_handler(struct ata_port *ap) |
437 | { | 657 | { |
438 | void __iomem *port_base = inic_port_base(ap); | 658 | void __iomem *port_base = inic_port_base(ap); |
439 | struct inic_port_priv *pp = ap->private_data; | ||
440 | unsigned long flags; | ||
441 | 659 | ||
442 | /* reset PIO HSM and stop DMA engine */ | ||
443 | inic_reset_port(port_base); | 660 | inic_reset_port(port_base); |
444 | |||
445 | spin_lock_irqsave(ap->lock, flags); | ||
446 | ap->hsm_task_state = HSM_ST_IDLE; | ||
447 | writeb(pp->dfl_prdctl, port_base + PORT_PRD_CTL); | ||
448 | spin_unlock_irqrestore(ap->lock, flags); | ||
449 | |||
450 | /* PIO and DMA engines have been stopped, perform recovery */ | ||
451 | ata_std_error_handler(ap); | 661 | ata_std_error_handler(ap); |
452 | } | 662 | } |
453 | 663 | ||
@@ -458,26 +668,18 @@ static void inic_post_internal_cmd(struct ata_queued_cmd *qc) | |||
458 | inic_reset_port(inic_port_base(qc->ap)); | 668 | inic_reset_port(inic_port_base(qc->ap)); |
459 | } | 669 | } |
460 | 670 | ||
461 | static void inic_dev_config(struct ata_device *dev) | ||
462 | { | ||
463 | /* inic can only handle upto LBA28 max sectors */ | ||
464 | if (dev->max_sectors > ATA_MAX_SECTORS) | ||
465 | dev->max_sectors = ATA_MAX_SECTORS; | ||
466 | |||
467 | if (dev->n_sectors >= 1 << 28) { | ||
468 | ata_dev_printk(dev, KERN_ERR, | ||
469 | "ERROR: This driver doesn't support LBA48 yet and may cause\n" | ||
470 | " data corruption on such devices. Disabling.\n"); | ||
471 | ata_dev_disable(dev); | ||
472 | } | ||
473 | } | ||
474 | |||
475 | static void init_port(struct ata_port *ap) | 671 | static void init_port(struct ata_port *ap) |
476 | { | 672 | { |
477 | void __iomem *port_base = inic_port_base(ap); | 673 | void __iomem *port_base = inic_port_base(ap); |
674 | struct inic_port_priv *pp = ap->private_data; | ||
478 | 675 | ||
479 | /* Setup PRD address */ | 676 | /* clear packet and CPB table */ |
677 | memset(pp->pkt, 0, sizeof(struct inic_pkt)); | ||
678 | memset(pp->cpb_tbl, 0, IDMA_CPB_TBL_SIZE); | ||
679 | |||
680 | /* setup PRD and CPB lookup table addresses */ | ||
480 | writel(ap->prd_dma, port_base + PORT_PRD_ADDR); | 681 | writel(ap->prd_dma, port_base + PORT_PRD_ADDR); |
682 | writel(pp->cpb_tbl_dma, port_base + PORT_CPB_CPBLAR); | ||
481 | } | 683 | } |
482 | 684 | ||
483 | static int inic_port_resume(struct ata_port *ap) | 685 | static int inic_port_resume(struct ata_port *ap) |
@@ -488,28 +690,30 @@ static int inic_port_resume(struct ata_port *ap) | |||
488 | 690 | ||
489 | static int inic_port_start(struct ata_port *ap) | 691 | static int inic_port_start(struct ata_port *ap) |
490 | { | 692 | { |
491 | void __iomem *port_base = inic_port_base(ap); | 693 | struct device *dev = ap->host->dev; |
492 | struct inic_port_priv *pp; | 694 | struct inic_port_priv *pp; |
493 | u8 tmp; | ||
494 | int rc; | 695 | int rc; |
495 | 696 | ||
496 | /* alloc and initialize private data */ | 697 | /* alloc and initialize private data */ |
497 | pp = devm_kzalloc(ap->host->dev, sizeof(*pp), GFP_KERNEL); | 698 | pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); |
498 | if (!pp) | 699 | if (!pp) |
499 | return -ENOMEM; | 700 | return -ENOMEM; |
500 | ap->private_data = pp; | 701 | ap->private_data = pp; |
501 | 702 | ||
502 | /* default PRD_CTL value, DMAEN, WR and START off */ | ||
503 | tmp = readb(port_base + PORT_PRD_CTL); | ||
504 | tmp &= ~(PRD_CTL_DMAEN | PRD_CTL_WR | PRD_CTL_START); | ||
505 | pp->dfl_prdctl = tmp; | ||
506 | |||
507 | /* Alloc resources */ | 703 | /* Alloc resources */ |
508 | rc = ata_port_start(ap); | 704 | rc = ata_port_start(ap); |
509 | if (rc) { | 705 | if (rc) |
510 | kfree(pp); | ||
511 | return rc; | 706 | return rc; |
512 | } | 707 | |
708 | pp->pkt = dmam_alloc_coherent(dev, sizeof(struct inic_pkt), | ||
709 | &pp->pkt_dma, GFP_KERNEL); | ||
710 | if (!pp->pkt) | ||
711 | return -ENOMEM; | ||
712 | |||
713 | pp->cpb_tbl = dmam_alloc_coherent(dev, IDMA_CPB_TBL_SIZE, | ||
714 | &pp->cpb_tbl_dma, GFP_KERNEL); | ||
715 | if (!pp->cpb_tbl) | ||
716 | return -ENOMEM; | ||
513 | 717 | ||
514 | init_port(ap); | 718 | init_port(ap); |
515 | 719 | ||
@@ -517,21 +721,18 @@ static int inic_port_start(struct ata_port *ap) | |||
517 | } | 721 | } |
518 | 722 | ||
519 | static struct ata_port_operations inic_port_ops = { | 723 | static struct ata_port_operations inic_port_ops = { |
520 | .inherits = &ata_sff_port_ops, | 724 | .inherits = &sata_port_ops, |
521 | 725 | ||
522 | .bmdma_setup = inic_bmdma_setup, | 726 | .check_atapi_dma = inic_check_atapi_dma, |
523 | .bmdma_start = inic_bmdma_start, | 727 | .qc_prep = inic_qc_prep, |
524 | .bmdma_stop = inic_bmdma_stop, | ||
525 | .bmdma_status = inic_bmdma_status, | ||
526 | .qc_issue = inic_qc_issue, | 728 | .qc_issue = inic_qc_issue, |
729 | .qc_fill_rtf = inic_qc_fill_rtf, | ||
527 | 730 | ||
528 | .freeze = inic_freeze, | 731 | .freeze = inic_freeze, |
529 | .thaw = inic_thaw, | 732 | .thaw = inic_thaw, |
530 | .softreset = ATA_OP_NULL, /* softreset is broken */ | ||
531 | .hardreset = inic_hardreset, | 733 | .hardreset = inic_hardreset, |
532 | .error_handler = inic_error_handler, | 734 | .error_handler = inic_error_handler, |
533 | .post_internal_cmd = inic_post_internal_cmd, | 735 | .post_internal_cmd = inic_post_internal_cmd, |
534 | .dev_config = inic_dev_config, | ||
535 | 736 | ||
536 | .scr_read = inic_scr_read, | 737 | .scr_read = inic_scr_read, |
537 | .scr_write = inic_scr_write, | 738 | .scr_write = inic_scr_write, |
@@ -541,12 +742,6 @@ static struct ata_port_operations inic_port_ops = { | |||
541 | }; | 742 | }; |
542 | 743 | ||
543 | static struct ata_port_info inic_port_info = { | 744 | static struct ata_port_info inic_port_info = { |
544 | /* For some reason, ATAPI_PROT_PIO is broken on this | ||
545 | * controller, and no, PIO_POLLING does't fix it. It somehow | ||
546 | * manages to report the wrong ireason and ignoring ireason | ||
547 | * results in machine lock up. Tell libata to always prefer | ||
548 | * DMA. | ||
549 | */ | ||
550 | .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA, | 745 | .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA, |
551 | .pio_mask = 0x1f, /* pio0-4 */ | 746 | .pio_mask = 0x1f, /* pio0-4 */ |
552 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 747 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
@@ -599,7 +794,6 @@ static int inic_pci_device_resume(struct pci_dev *pdev) | |||
599 | { | 794 | { |
600 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 795 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
601 | struct inic_host_priv *hpriv = host->private_data; | 796 | struct inic_host_priv *hpriv = host->private_data; |
602 | void __iomem *mmio_base = host->iomap[MMIO_BAR]; | ||
603 | int rc; | 797 | int rc; |
604 | 798 | ||
605 | rc = ata_pci_device_do_resume(pdev); | 799 | rc = ata_pci_device_do_resume(pdev); |
@@ -607,7 +801,7 @@ static int inic_pci_device_resume(struct pci_dev *pdev) | |||
607 | return rc; | 801 | return rc; |
608 | 802 | ||
609 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { | 803 | if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { |
610 | rc = init_controller(mmio_base, hpriv->cached_hctl); | 804 | rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl); |
611 | if (rc) | 805 | if (rc) |
612 | return rc; | 806 | return rc; |
613 | } | 807 | } |
@@ -625,6 +819,7 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
625 | struct ata_host *host; | 819 | struct ata_host *host; |
626 | struct inic_host_priv *hpriv; | 820 | struct inic_host_priv *hpriv; |
627 | void __iomem * const *iomap; | 821 | void __iomem * const *iomap; |
822 | int mmio_bar; | ||
628 | int i, rc; | 823 | int i, rc; |
629 | 824 | ||
630 | if (!printed_version++) | 825 | if (!printed_version++) |
@@ -638,38 +833,31 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
638 | 833 | ||
639 | host->private_data = hpriv; | 834 | host->private_data = hpriv; |
640 | 835 | ||
641 | /* acquire resources and fill host */ | 836 | /* Acquire resources and fill host. Note that PCI and cardbus |
837 | * use different BARs. | ||
838 | */ | ||
642 | rc = pcim_enable_device(pdev); | 839 | rc = pcim_enable_device(pdev); |
643 | if (rc) | 840 | if (rc) |
644 | return rc; | 841 | return rc; |
645 | 842 | ||
646 | rc = pcim_iomap_regions(pdev, 0x3f, DRV_NAME); | 843 | if (pci_resource_flags(pdev, MMIO_BAR_PCI) & IORESOURCE_MEM) |
844 | mmio_bar = MMIO_BAR_PCI; | ||
845 | else | ||
846 | mmio_bar = MMIO_BAR_CARDBUS; | ||
847 | |||
848 | rc = pcim_iomap_regions(pdev, 1 << mmio_bar, DRV_NAME); | ||
647 | if (rc) | 849 | if (rc) |
648 | return rc; | 850 | return rc; |
649 | host->iomap = iomap = pcim_iomap_table(pdev); | 851 | host->iomap = iomap = pcim_iomap_table(pdev); |
852 | hpriv->mmio_base = iomap[mmio_bar]; | ||
853 | hpriv->cached_hctl = readw(hpriv->mmio_base + HOST_CTL); | ||
650 | 854 | ||
651 | for (i = 0; i < NR_PORTS; i++) { | 855 | for (i = 0; i < NR_PORTS; i++) { |
652 | struct ata_port *ap = host->ports[i]; | 856 | struct ata_port *ap = host->ports[i]; |
653 | struct ata_ioports *port = &ap->ioaddr; | ||
654 | unsigned int offset = i * PORT_SIZE; | ||
655 | |||
656 | port->cmd_addr = iomap[2 * i]; | ||
657 | port->altstatus_addr = | ||
658 | port->ctl_addr = (void __iomem *) | ||
659 | ((unsigned long)iomap[2 * i + 1] | ATA_PCI_CTL_OFS); | ||
660 | port->scr_addr = iomap[MMIO_BAR] + offset + PORT_SCR; | ||
661 | |||
662 | ata_sff_std_ports(port); | ||
663 | |||
664 | ata_port_pbar_desc(ap, MMIO_BAR, -1, "mmio"); | ||
665 | ata_port_pbar_desc(ap, MMIO_BAR, offset, "port"); | ||
666 | ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx", | ||
667 | (unsigned long long)pci_resource_start(pdev, 2 * i), | ||
668 | (unsigned long long)pci_resource_start(pdev, (2 * i + 1)) | | ||
669 | ATA_PCI_CTL_OFS); | ||
670 | } | ||
671 | 857 | ||
672 | hpriv->cached_hctl = readw(iomap[MMIO_BAR] + HOST_CTL); | 858 | ata_port_pbar_desc(ap, mmio_bar, -1, "mmio"); |
859 | ata_port_pbar_desc(ap, mmio_bar, i * PORT_SIZE, "port"); | ||
860 | } | ||
673 | 861 | ||
674 | /* Set dma_mask. This devices doesn't support 64bit addressing. */ | 862 | /* Set dma_mask. This devices doesn't support 64bit addressing. */ |
675 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 863 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
@@ -698,7 +886,7 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
698 | return rc; | 886 | return rc; |
699 | } | 887 | } |
700 | 888 | ||
701 | rc = init_controller(iomap[MMIO_BAR], hpriv->cached_hctl); | 889 | rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl); |
702 | if (rc) { | 890 | if (rc) { |
703 | dev_printk(KERN_ERR, &pdev->dev, | 891 | dev_printk(KERN_ERR, &pdev->dev, |
704 | "failed to initialize controller\n"); | 892 | "failed to initialize controller\n"); |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 842b1a15b78..bb73b222262 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -65,6 +65,7 @@ | |||
65 | #include <linux/platform_device.h> | 65 | #include <linux/platform_device.h> |
66 | #include <linux/ata_platform.h> | 66 | #include <linux/ata_platform.h> |
67 | #include <linux/mbus.h> | 67 | #include <linux/mbus.h> |
68 | #include <linux/bitops.h> | ||
68 | #include <scsi/scsi_host.h> | 69 | #include <scsi/scsi_host.h> |
69 | #include <scsi/scsi_cmnd.h> | 70 | #include <scsi/scsi_cmnd.h> |
70 | #include <scsi/scsi_device.h> | 71 | #include <scsi/scsi_device.h> |
@@ -91,9 +92,9 @@ enum { | |||
91 | MV_IRQ_COAL_TIME_THRESHOLD = (MV_IRQ_COAL_REG_BASE + 0xd0), | 92 | MV_IRQ_COAL_TIME_THRESHOLD = (MV_IRQ_COAL_REG_BASE + 0xd0), |
92 | 93 | ||
93 | MV_SATAHC0_REG_BASE = 0x20000, | 94 | MV_SATAHC0_REG_BASE = 0x20000, |
94 | MV_FLASH_CTL = 0x1046c, | 95 | MV_FLASH_CTL_OFS = 0x1046c, |
95 | MV_GPIO_PORT_CTL = 0x104f0, | 96 | MV_GPIO_PORT_CTL_OFS = 0x104f0, |
96 | MV_RESET_CFG = 0x180d8, | 97 | MV_RESET_CFG_OFS = 0x180d8, |
97 | 98 | ||
98 | MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ, | 99 | MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ, |
99 | MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ, | 100 | MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ, |
@@ -147,18 +148,21 @@ enum { | |||
147 | /* PCI interface registers */ | 148 | /* PCI interface registers */ |
148 | 149 | ||
149 | PCI_COMMAND_OFS = 0xc00, | 150 | PCI_COMMAND_OFS = 0xc00, |
151 | PCI_COMMAND_MRDTRIG = (1 << 7), /* PCI Master Read Trigger */ | ||
150 | 152 | ||
151 | PCI_MAIN_CMD_STS_OFS = 0xd30, | 153 | PCI_MAIN_CMD_STS_OFS = 0xd30, |
152 | STOP_PCI_MASTER = (1 << 2), | 154 | STOP_PCI_MASTER = (1 << 2), |
153 | PCI_MASTER_EMPTY = (1 << 3), | 155 | PCI_MASTER_EMPTY = (1 << 3), |
154 | GLOB_SFT_RST = (1 << 4), | 156 | GLOB_SFT_RST = (1 << 4), |
155 | 157 | ||
156 | MV_PCI_MODE = 0xd00, | 158 | MV_PCI_MODE_OFS = 0xd00, |
159 | MV_PCI_MODE_MASK = 0x30, | ||
160 | |||
157 | MV_PCI_EXP_ROM_BAR_CTL = 0xd2c, | 161 | MV_PCI_EXP_ROM_BAR_CTL = 0xd2c, |
158 | MV_PCI_DISC_TIMER = 0xd04, | 162 | MV_PCI_DISC_TIMER = 0xd04, |
159 | MV_PCI_MSI_TRIGGER = 0xc38, | 163 | MV_PCI_MSI_TRIGGER = 0xc38, |
160 | MV_PCI_SERR_MASK = 0xc28, | 164 | MV_PCI_SERR_MASK = 0xc28, |
161 | MV_PCI_XBAR_TMOUT = 0x1d04, | 165 | MV_PCI_XBAR_TMOUT_OFS = 0x1d04, |
162 | MV_PCI_ERR_LOW_ADDRESS = 0x1d40, | 166 | MV_PCI_ERR_LOW_ADDRESS = 0x1d40, |
163 | MV_PCI_ERR_HIGH_ADDRESS = 0x1d44, | 167 | MV_PCI_ERR_HIGH_ADDRESS = 0x1d44, |
164 | MV_PCI_ERR_ATTRIBUTE = 0x1d48, | 168 | MV_PCI_ERR_ATTRIBUTE = 0x1d48, |
@@ -225,16 +229,18 @@ enum { | |||
225 | PHY_MODE4 = 0x314, | 229 | PHY_MODE4 = 0x314, |
226 | PHY_MODE2 = 0x330, | 230 | PHY_MODE2 = 0x330, |
227 | SATA_IFCTL_OFS = 0x344, | 231 | SATA_IFCTL_OFS = 0x344, |
232 | SATA_TESTCTL_OFS = 0x348, | ||
228 | SATA_IFSTAT_OFS = 0x34c, | 233 | SATA_IFSTAT_OFS = 0x34c, |
229 | VENDOR_UNIQUE_FIS_OFS = 0x35c, | 234 | VENDOR_UNIQUE_FIS_OFS = 0x35c, |
230 | 235 | ||
231 | FIS_CFG_OFS = 0x360, | 236 | FISCFG_OFS = 0x360, |
232 | FIS_CFG_SINGLE_SYNC = (1 << 16), /* SYNC on DMA activation */ | 237 | FISCFG_WAIT_DEV_ERR = (1 << 8), /* wait for host on DevErr */ |
238 | FISCFG_SINGLE_SYNC = (1 << 16), /* SYNC on DMA activation */ | ||
233 | 239 | ||
234 | MV5_PHY_MODE = 0x74, | 240 | MV5_PHY_MODE = 0x74, |
235 | MV5_LT_MODE = 0x30, | 241 | MV5_LTMODE_OFS = 0x30, |
236 | MV5_PHY_CTL = 0x0C, | 242 | MV5_PHY_CTL_OFS = 0x0C, |
237 | SATA_INTERFACE_CFG = 0x050, | 243 | SATA_INTERFACE_CFG_OFS = 0x050, |
238 | 244 | ||
239 | MV_M2_PREAMP_MASK = 0x7e0, | 245 | MV_M2_PREAMP_MASK = 0x7e0, |
240 | 246 | ||
@@ -332,10 +338,16 @@ enum { | |||
332 | EDMA_CMD_OFS = 0x28, /* EDMA command register */ | 338 | EDMA_CMD_OFS = 0x28, /* EDMA command register */ |
333 | EDMA_EN = (1 << 0), /* enable EDMA */ | 339 | EDMA_EN = (1 << 0), /* enable EDMA */ |
334 | EDMA_DS = (1 << 1), /* disable EDMA; self-negated */ | 340 | EDMA_DS = (1 << 1), /* disable EDMA; self-negated */ |
335 | ATA_RST = (1 << 2), /* reset trans/link/phy */ | 341 | EDMA_RESET = (1 << 2), /* reset eng/trans/link/phy */ |
342 | |||
343 | EDMA_STATUS_OFS = 0x30, /* EDMA engine status */ | ||
344 | EDMA_STATUS_CACHE_EMPTY = (1 << 6), /* GenIIe command cache empty */ | ||
345 | EDMA_STATUS_IDLE = (1 << 7), /* GenIIe EDMA enabled/idle */ | ||
336 | 346 | ||
337 | EDMA_IORDY_TMOUT = 0x34, | 347 | EDMA_IORDY_TMOUT_OFS = 0x34, |
338 | EDMA_ARB_CFG = 0x38, | 348 | EDMA_ARB_CFG_OFS = 0x38, |
349 | |||
350 | EDMA_HALTCOND_OFS = 0x60, /* GenIIe halt conditions */ | ||
339 | 351 | ||
340 | GEN_II_NCQ_MAX_SECTORS = 256, /* max sects/io on Gen2 w/NCQ */ | 352 | GEN_II_NCQ_MAX_SECTORS = 256, /* max sects/io on Gen2 w/NCQ */ |
341 | 353 | ||
@@ -350,15 +362,19 @@ enum { | |||
350 | MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */ | 362 | MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */ |
351 | MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */ | 363 | MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */ |
352 | MV_HP_PCIE = (1 << 9), /* PCIe bus/regs: 7042 */ | 364 | MV_HP_PCIE = (1 << 9), /* PCIe bus/regs: 7042 */ |
365 | MV_HP_CUT_THROUGH = (1 << 10), /* can use EDMA cut-through */ | ||
353 | 366 | ||
354 | /* Port private flags (pp_flags) */ | 367 | /* Port private flags (pp_flags) */ |
355 | MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ | 368 | MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ |
356 | MV_PP_FLAG_NCQ_EN = (1 << 1), /* is EDMA set up for NCQ? */ | 369 | MV_PP_FLAG_NCQ_EN = (1 << 1), /* is EDMA set up for NCQ? */ |
370 | MV_PP_FLAG_FBS_EN = (1 << 2), /* is EDMA set up for FBS? */ | ||
371 | MV_PP_FLAG_DELAYED_EH = (1 << 3), /* delayed dev err handling */ | ||
357 | }; | 372 | }; |
358 | 373 | ||
359 | #define IS_GEN_I(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_I) | 374 | #define IS_GEN_I(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_I) |
360 | #define IS_GEN_II(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_II) | 375 | #define IS_GEN_II(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_II) |
361 | #define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) | 376 | #define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) |
377 | #define IS_PCIE(hpriv) ((hpriv)->hp_flags & MV_HP_PCIE) | ||
362 | #define HAS_PCI(host) (!((host)->ports[0]->flags & MV_FLAG_SOC)) | 378 | #define HAS_PCI(host) (!((host)->ports[0]->flags & MV_FLAG_SOC)) |
363 | 379 | ||
364 | #define WINDOW_CTRL(i) (0x20030 + ((i) << 4)) | 380 | #define WINDOW_CTRL(i) (0x20030 + ((i) << 4)) |
@@ -433,6 +449,7 @@ struct mv_port_priv { | |||
433 | unsigned int resp_idx; | 449 | unsigned int resp_idx; |
434 | 450 | ||
435 | u32 pp_flags; | 451 | u32 pp_flags; |
452 | unsigned int delayed_eh_pmp_map; | ||
436 | }; | 453 | }; |
437 | 454 | ||
438 | struct mv_port_signal { | 455 | struct mv_port_signal { |
@@ -479,6 +496,7 @@ static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val); | |||
479 | static int mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); | 496 | static int mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); |
480 | static int mv_port_start(struct ata_port *ap); | 497 | static int mv_port_start(struct ata_port *ap); |
481 | static void mv_port_stop(struct ata_port *ap); | 498 | static void mv_port_stop(struct ata_port *ap); |
499 | static int mv_qc_defer(struct ata_queued_cmd *qc); | ||
482 | static void mv_qc_prep(struct ata_queued_cmd *qc); | 500 | static void mv_qc_prep(struct ata_queued_cmd *qc); |
483 | static void mv_qc_prep_iie(struct ata_queued_cmd *qc); | 501 | static void mv_qc_prep_iie(struct ata_queued_cmd *qc); |
484 | static unsigned int mv_qc_issue(struct ata_queued_cmd *qc); | 502 | static unsigned int mv_qc_issue(struct ata_queued_cmd *qc); |
@@ -527,6 +545,9 @@ static int mv_pmp_hardreset(struct ata_link *link, unsigned int *class, | |||
527 | unsigned long deadline); | 545 | unsigned long deadline); |
528 | static int mv_softreset(struct ata_link *link, unsigned int *class, | 546 | static int mv_softreset(struct ata_link *link, unsigned int *class, |
529 | unsigned long deadline); | 547 | unsigned long deadline); |
548 | static void mv_pmp_error_handler(struct ata_port *ap); | ||
549 | static void mv_process_crpb_entries(struct ata_port *ap, | ||
550 | struct mv_port_priv *pp); | ||
530 | 551 | ||
531 | /* .sg_tablesize is (MV_MAX_SG_CT / 2) in the structures below | 552 | /* .sg_tablesize is (MV_MAX_SG_CT / 2) in the structures below |
532 | * because we have to allow room for worst case splitting of | 553 | * because we have to allow room for worst case splitting of |
@@ -548,6 +569,7 @@ static struct scsi_host_template mv6_sht = { | |||
548 | static struct ata_port_operations mv5_ops = { | 569 | static struct ata_port_operations mv5_ops = { |
549 | .inherits = &ata_sff_port_ops, | 570 | .inherits = &ata_sff_port_ops, |
550 | 571 | ||
572 | .qc_defer = mv_qc_defer, | ||
551 | .qc_prep = mv_qc_prep, | 573 | .qc_prep = mv_qc_prep, |
552 | .qc_issue = mv_qc_issue, | 574 | .qc_issue = mv_qc_issue, |
553 | 575 | ||
@@ -566,7 +588,6 @@ static struct ata_port_operations mv5_ops = { | |||
566 | 588 | ||
567 | static struct ata_port_operations mv6_ops = { | 589 | static struct ata_port_operations mv6_ops = { |
568 | .inherits = &mv5_ops, | 590 | .inherits = &mv5_ops, |
569 | .qc_defer = sata_pmp_qc_defer_cmd_switch, | ||
570 | .dev_config = mv6_dev_config, | 591 | .dev_config = mv6_dev_config, |
571 | .scr_read = mv_scr_read, | 592 | .scr_read = mv_scr_read, |
572 | .scr_write = mv_scr_write, | 593 | .scr_write = mv_scr_write, |
@@ -574,12 +595,11 @@ static struct ata_port_operations mv6_ops = { | |||
574 | .pmp_hardreset = mv_pmp_hardreset, | 595 | .pmp_hardreset = mv_pmp_hardreset, |
575 | .pmp_softreset = mv_softreset, | 596 | .pmp_softreset = mv_softreset, |
576 | .softreset = mv_softreset, | 597 | .softreset = mv_softreset, |
577 | .error_handler = sata_pmp_error_handler, | 598 | .error_handler = mv_pmp_error_handler, |
578 | }; | 599 | }; |
579 | 600 | ||
580 | static struct ata_port_operations mv_iie_ops = { | 601 | static struct ata_port_operations mv_iie_ops = { |
581 | .inherits = &mv6_ops, | 602 | .inherits = &mv6_ops, |
582 | .qc_defer = ata_std_qc_defer, /* FIS-based switching */ | ||
583 | .dev_config = ATA_OP_NULL, | 603 | .dev_config = ATA_OP_NULL, |
584 | .qc_prep = mv_qc_prep_iie, | 604 | .qc_prep = mv_qc_prep_iie, |
585 | }; | 605 | }; |
@@ -875,6 +895,29 @@ static void mv_start_dma(struct ata_port *ap, void __iomem *port_mmio, | |||
875 | } | 895 | } |
876 | } | 896 | } |
877 | 897 | ||
898 | static void mv_wait_for_edma_empty_idle(struct ata_port *ap) | ||
899 | { | ||
900 | void __iomem *port_mmio = mv_ap_base(ap); | ||
901 | const u32 empty_idle = (EDMA_STATUS_CACHE_EMPTY | EDMA_STATUS_IDLE); | ||
902 | const int per_loop = 5, timeout = (15 * 1000 / per_loop); | ||
903 | int i; | ||
904 | |||
905 | /* | ||
906 | * Wait for the EDMA engine to finish transactions in progress. | ||
907 | * No idea what a good "timeout" value might be, but measurements | ||
908 | * indicate that it often requires hundreds of microseconds | ||
909 | * with two drives in-use. So we use the 15msec value above | ||
910 | * as a rough guess at what even more drives might require. | ||
911 | */ | ||
912 | for (i = 0; i < timeout; ++i) { | ||
913 | u32 edma_stat = readl(port_mmio + EDMA_STATUS_OFS); | ||
914 | if ((edma_stat & empty_idle) == empty_idle) | ||
915 | break; | ||
916 | udelay(per_loop); | ||
917 | } | ||
918 | /* ata_port_printk(ap, KERN_INFO, "%s: %u+ usecs\n", __func__, i); */ | ||
919 | } | ||
920 | |||
878 | /** | 921 | /** |
879 | * mv_stop_edma_engine - Disable eDMA engine | 922 | * mv_stop_edma_engine - Disable eDMA engine |
880 | * @port_mmio: io base address | 923 | * @port_mmio: io base address |
@@ -907,6 +950,7 @@ static int mv_stop_edma(struct ata_port *ap) | |||
907 | if (!(pp->pp_flags & MV_PP_FLAG_EDMA_EN)) | 950 | if (!(pp->pp_flags & MV_PP_FLAG_EDMA_EN)) |
908 | return 0; | 951 | return 0; |
909 | pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; | 952 | pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; |
953 | mv_wait_for_edma_empty_idle(ap); | ||
910 | if (mv_stop_edma_engine(port_mmio)) { | 954 | if (mv_stop_edma_engine(port_mmio)) { |
911 | ata_port_printk(ap, KERN_ERR, "Unable to stop eDMA\n"); | 955 | ata_port_printk(ap, KERN_ERR, "Unable to stop eDMA\n"); |
912 | return -EIO; | 956 | return -EIO; |
@@ -1057,26 +1101,95 @@ static void mv6_dev_config(struct ata_device *adev) | |||
1057 | } | 1101 | } |
1058 | } | 1102 | } |
1059 | 1103 | ||
1060 | static void mv_config_fbs(void __iomem *port_mmio, int enable_fbs) | 1104 | static int mv_qc_defer(struct ata_queued_cmd *qc) |
1061 | { | 1105 | { |
1062 | u32 old_fcfg, new_fcfg, old_ltmode, new_ltmode; | 1106 | struct ata_link *link = qc->dev->link; |
1107 | struct ata_port *ap = link->ap; | ||
1108 | struct mv_port_priv *pp = ap->private_data; | ||
1109 | |||
1110 | /* | ||
1111 | * Don't allow new commands if we're in a delayed EH state | ||
1112 | * for NCQ and/or FIS-based switching. | ||
1113 | */ | ||
1114 | if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH) | ||
1115 | return ATA_DEFER_PORT; | ||
1063 | /* | 1116 | /* |
1064 | * Various bit settings required for operation | 1117 | * If the port is completely idle, then allow the new qc. |
1065 | * in FIS-based switching (fbs) mode on GenIIe: | ||
1066 | */ | 1118 | */ |
1067 | old_fcfg = readl(port_mmio + FIS_CFG_OFS); | 1119 | if (ap->nr_active_links == 0) |
1068 | old_ltmode = readl(port_mmio + LTMODE_OFS); | 1120 | return 0; |
1069 | if (enable_fbs) { | 1121 | |
1070 | new_fcfg = old_fcfg | FIS_CFG_SINGLE_SYNC; | 1122 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { |
1071 | new_ltmode = old_ltmode | LTMODE_BIT8; | 1123 | /* |
1072 | } else { /* disable fbs */ | 1124 | * The port is operating in host queuing mode (EDMA). |
1073 | new_fcfg = old_fcfg & ~FIS_CFG_SINGLE_SYNC; | 1125 | * It can accomodate a new qc if the qc protocol |
1074 | new_ltmode = old_ltmode & ~LTMODE_BIT8; | 1126 | * is compatible with the current host queue mode. |
1075 | } | 1127 | */ |
1076 | if (new_fcfg != old_fcfg) | 1128 | if (pp->pp_flags & MV_PP_FLAG_NCQ_EN) { |
1077 | writelfl(new_fcfg, port_mmio + FIS_CFG_OFS); | 1129 | /* |
1130 | * The host queue (EDMA) is in NCQ mode. | ||
1131 | * If the new qc is also an NCQ command, | ||
1132 | * then allow the new qc. | ||
1133 | */ | ||
1134 | if (qc->tf.protocol == ATA_PROT_NCQ) | ||
1135 | return 0; | ||
1136 | } else { | ||
1137 | /* | ||
1138 | * The host queue (EDMA) is in non-NCQ, DMA mode. | ||
1139 | * If the new qc is also a non-NCQ, DMA command, | ||
1140 | * then allow the new qc. | ||
1141 | */ | ||
1142 | if (qc->tf.protocol == ATA_PROT_DMA) | ||
1143 | return 0; | ||
1144 | } | ||
1145 | } | ||
1146 | return ATA_DEFER_PORT; | ||
1147 | } | ||
1148 | |||
1149 | static void mv_config_fbs(void __iomem *port_mmio, int want_ncq, int want_fbs) | ||
1150 | { | ||
1151 | u32 new_fiscfg, old_fiscfg; | ||
1152 | u32 new_ltmode, old_ltmode; | ||
1153 | u32 new_haltcond, old_haltcond; | ||
1154 | |||
1155 | old_fiscfg = readl(port_mmio + FISCFG_OFS); | ||
1156 | old_ltmode = readl(port_mmio + LTMODE_OFS); | ||
1157 | old_haltcond = readl(port_mmio + EDMA_HALTCOND_OFS); | ||
1158 | |||
1159 | new_fiscfg = old_fiscfg & ~(FISCFG_SINGLE_SYNC | FISCFG_WAIT_DEV_ERR); | ||
1160 | new_ltmode = old_ltmode & ~LTMODE_BIT8; | ||
1161 | new_haltcond = old_haltcond | EDMA_ERR_DEV; | ||
1162 | |||
1163 | if (want_fbs) { | ||
1164 | new_fiscfg = old_fiscfg | FISCFG_SINGLE_SYNC; | ||
1165 | new_ltmode = old_ltmode | LTMODE_BIT8; | ||
1166 | if (want_ncq) | ||
1167 | new_haltcond &= ~EDMA_ERR_DEV; | ||
1168 | else | ||
1169 | new_fiscfg |= FISCFG_WAIT_DEV_ERR; | ||
1170 | } | ||
1171 | |||
1172 | if (new_fiscfg != old_fiscfg) | ||
1173 | writelfl(new_fiscfg, port_mmio + FISCFG_OFS); | ||
1078 | if (new_ltmode != old_ltmode) | 1174 | if (new_ltmode != old_ltmode) |
1079 | writelfl(new_ltmode, port_mmio + LTMODE_OFS); | 1175 | writelfl(new_ltmode, port_mmio + LTMODE_OFS); |
1176 | if (new_haltcond != old_haltcond) | ||
1177 | writelfl(new_haltcond, port_mmio + EDMA_HALTCOND_OFS); | ||
1178 | } | ||
1179 | |||
1180 | static void mv_60x1_errata_sata25(struct ata_port *ap, int want_ncq) | ||
1181 | { | ||
1182 | struct mv_host_priv *hpriv = ap->host->private_data; | ||
1183 | u32 old, new; | ||
1184 | |||
1185 | /* workaround for 88SX60x1 FEr SATA#25 (part 1) */ | ||
1186 | old = readl(hpriv->base + MV_GPIO_PORT_CTL_OFS); | ||
1187 | if (want_ncq) | ||
1188 | new = old | (1 << 22); | ||
1189 | else | ||
1190 | new = old & ~(1 << 22); | ||
1191 | if (new != old) | ||
1192 | writel(new, hpriv->base + MV_GPIO_PORT_CTL_OFS); | ||
1080 | } | 1193 | } |
1081 | 1194 | ||
1082 | static void mv_edma_cfg(struct ata_port *ap, int want_ncq) | 1195 | static void mv_edma_cfg(struct ata_port *ap, int want_ncq) |
@@ -1088,25 +1201,40 @@ static void mv_edma_cfg(struct ata_port *ap, int want_ncq) | |||
1088 | 1201 | ||
1089 | /* set up non-NCQ EDMA configuration */ | 1202 | /* set up non-NCQ EDMA configuration */ |
1090 | cfg = EDMA_CFG_Q_DEPTH; /* always 0x1f for *all* chips */ | 1203 | cfg = EDMA_CFG_Q_DEPTH; /* always 0x1f for *all* chips */ |
1204 | pp->pp_flags &= ~MV_PP_FLAG_FBS_EN; | ||
1091 | 1205 | ||
1092 | if (IS_GEN_I(hpriv)) | 1206 | if (IS_GEN_I(hpriv)) |
1093 | cfg |= (1 << 8); /* enab config burst size mask */ | 1207 | cfg |= (1 << 8); /* enab config burst size mask */ |
1094 | 1208 | ||
1095 | else if (IS_GEN_II(hpriv)) | 1209 | else if (IS_GEN_II(hpriv)) { |
1096 | cfg |= EDMA_CFG_RD_BRST_EXT | EDMA_CFG_WR_BUFF_LEN; | 1210 | cfg |= EDMA_CFG_RD_BRST_EXT | EDMA_CFG_WR_BUFF_LEN; |
1211 | mv_60x1_errata_sata25(ap, want_ncq); | ||
1097 | 1212 | ||
1098 | else if (IS_GEN_IIE(hpriv)) { | 1213 | } else if (IS_GEN_IIE(hpriv)) { |
1099 | cfg |= (1 << 23); /* do not mask PM field in rx'd FIS */ | 1214 | int want_fbs = sata_pmp_attached(ap); |
1100 | cfg |= (1 << 22); /* enab 4-entry host queue cache */ | 1215 | /* |
1101 | cfg |= (1 << 18); /* enab early completion */ | 1216 | * Possible future enhancement: |
1102 | cfg |= (1 << 17); /* enab cut-through (dis stor&forwrd) */ | 1217 | * |
1218 | * The chip can use FBS with non-NCQ, if we allow it, | ||
1219 | * But first we need to have the error handling in place | ||
1220 | * for this mode (datasheet section 7.3.15.4.2.3). | ||
1221 | * So disallow non-NCQ FBS for now. | ||
1222 | */ | ||
1223 | want_fbs &= want_ncq; | ||
1224 | |||
1225 | mv_config_fbs(port_mmio, want_ncq, want_fbs); | ||
1103 | 1226 | ||
1104 | if (want_ncq && sata_pmp_attached(ap)) { | 1227 | if (want_fbs) { |
1228 | pp->pp_flags |= MV_PP_FLAG_FBS_EN; | ||
1105 | cfg |= EDMA_CFG_EDMA_FBS; /* FIS-based switching */ | 1229 | cfg |= EDMA_CFG_EDMA_FBS; /* FIS-based switching */ |
1106 | mv_config_fbs(port_mmio, 1); | ||
1107 | } else { | ||
1108 | mv_config_fbs(port_mmio, 0); | ||
1109 | } | 1230 | } |
1231 | |||
1232 | cfg |= (1 << 23); /* do not mask PM field in rx'd FIS */ | ||
1233 | cfg |= (1 << 22); /* enab 4-entry host queue cache */ | ||
1234 | if (HAS_PCI(ap->host)) | ||
1235 | cfg |= (1 << 18); /* enab early completion */ | ||
1236 | if (hpriv->hp_flags & MV_HP_CUT_THROUGH) | ||
1237 | cfg |= (1 << 17); /* enab cut-thru (dis stor&forwrd) */ | ||
1110 | } | 1238 | } |
1111 | 1239 | ||
1112 | if (want_ncq) { | 1240 | if (want_ncq) { |
@@ -1483,25 +1611,186 @@ static struct ata_queued_cmd *mv_get_active_qc(struct ata_port *ap) | |||
1483 | return qc; | 1611 | return qc; |
1484 | } | 1612 | } |
1485 | 1613 | ||
1486 | static void mv_unexpected_intr(struct ata_port *ap) | 1614 | static void mv_pmp_error_handler(struct ata_port *ap) |
1487 | { | 1615 | { |
1616 | unsigned int pmp, pmp_map; | ||
1488 | struct mv_port_priv *pp = ap->private_data; | 1617 | struct mv_port_priv *pp = ap->private_data; |
1489 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
1490 | char *when = ""; | ||
1491 | 1618 | ||
1619 | if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH) { | ||
1620 | /* | ||
1621 | * Perform NCQ error analysis on failed PMPs | ||
1622 | * before we freeze the port entirely. | ||
1623 | * | ||
1624 | * The failed PMPs are marked earlier by mv_pmp_eh_prep(). | ||
1625 | */ | ||
1626 | pmp_map = pp->delayed_eh_pmp_map; | ||
1627 | pp->pp_flags &= ~MV_PP_FLAG_DELAYED_EH; | ||
1628 | for (pmp = 0; pmp_map != 0; pmp++) { | ||
1629 | unsigned int this_pmp = (1 << pmp); | ||
1630 | if (pmp_map & this_pmp) { | ||
1631 | struct ata_link *link = &ap->pmp_link[pmp]; | ||
1632 | pmp_map &= ~this_pmp; | ||
1633 | ata_eh_analyze_ncq_error(link); | ||
1634 | } | ||
1635 | } | ||
1636 | ata_port_freeze(ap); | ||
1637 | } | ||
1638 | sata_pmp_error_handler(ap); | ||
1639 | } | ||
1640 | |||
1641 | static unsigned int mv_get_err_pmp_map(struct ata_port *ap) | ||
1642 | { | ||
1643 | void __iomem *port_mmio = mv_ap_base(ap); | ||
1644 | |||
1645 | return readl(port_mmio + SATA_TESTCTL_OFS) >> 16; | ||
1646 | } | ||
1647 | |||
1648 | static void mv_pmp_eh_prep(struct ata_port *ap, unsigned int pmp_map) | ||
1649 | { | ||
1650 | struct ata_eh_info *ehi; | ||
1651 | unsigned int pmp; | ||
1652 | |||
1653 | /* | ||
1654 | * Initialize EH info for PMPs which saw device errors | ||
1655 | */ | ||
1656 | ehi = &ap->link.eh_info; | ||
1657 | for (pmp = 0; pmp_map != 0; pmp++) { | ||
1658 | unsigned int this_pmp = (1 << pmp); | ||
1659 | if (pmp_map & this_pmp) { | ||
1660 | struct ata_link *link = &ap->pmp_link[pmp]; | ||
1661 | |||
1662 | pmp_map &= ~this_pmp; | ||
1663 | ehi = &link->eh_info; | ||
1664 | ata_ehi_clear_desc(ehi); | ||
1665 | ata_ehi_push_desc(ehi, "dev err"); | ||
1666 | ehi->err_mask |= AC_ERR_DEV; | ||
1667 | ehi->action |= ATA_EH_RESET; | ||
1668 | ata_link_abort(link); | ||
1669 | } | ||
1670 | } | ||
1671 | } | ||
1672 | |||
1673 | static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap) | ||
1674 | { | ||
1675 | struct mv_port_priv *pp = ap->private_data; | ||
1676 | int failed_links; | ||
1677 | unsigned int old_map, new_map; | ||
1678 | |||
1679 | /* | ||
1680 | * Device error during FBS+NCQ operation: | ||
1681 | * | ||
1682 | * Set a port flag to prevent further I/O being enqueued. | ||
1683 | * Leave the EDMA running to drain outstanding commands from this port. | ||
1684 | * Perform the post-mortem/EH only when all responses are complete. | ||
1685 | * Follow recovery sequence from 6042/7042 datasheet (7.3.15.4.2.2). | ||
1686 | */ | ||
1687 | if (!(pp->pp_flags & MV_PP_FLAG_DELAYED_EH)) { | ||
1688 | pp->pp_flags |= MV_PP_FLAG_DELAYED_EH; | ||
1689 | pp->delayed_eh_pmp_map = 0; | ||
1690 | } | ||
1691 | old_map = pp->delayed_eh_pmp_map; | ||
1692 | new_map = old_map | mv_get_err_pmp_map(ap); | ||
1693 | |||
1694 | if (old_map != new_map) { | ||
1695 | pp->delayed_eh_pmp_map = new_map; | ||
1696 | mv_pmp_eh_prep(ap, new_map & ~old_map); | ||
1697 | } | ||
1698 | failed_links = hweight16(new_map); | ||
1699 | |||
1700 | ata_port_printk(ap, KERN_INFO, "%s: pmp_map=%04x qc_map=%04x " | ||
1701 | "failed_links=%d nr_active_links=%d\n", | ||
1702 | __func__, pp->delayed_eh_pmp_map, | ||
1703 | ap->qc_active, failed_links, | ||
1704 | ap->nr_active_links); | ||
1705 | |||
1706 | if (ap->nr_active_links <= failed_links) { | ||
1707 | mv_process_crpb_entries(ap, pp); | ||
1708 | mv_stop_edma(ap); | ||
1709 | mv_eh_freeze(ap); | ||
1710 | ata_port_printk(ap, KERN_INFO, "%s: done\n", __func__); | ||
1711 | return 1; /* handled */ | ||
1712 | } | ||
1713 | ata_port_printk(ap, KERN_INFO, "%s: waiting\n", __func__); | ||
1714 | return 1; /* handled */ | ||
1715 | } | ||
1716 | |||
1717 | static int mv_handle_fbs_non_ncq_dev_err(struct ata_port *ap) | ||
1718 | { | ||
1492 | /* | 1719 | /* |
1493 | * We got a device interrupt from something that | 1720 | * Possible future enhancement: |
1494 | * was supposed to be using EDMA or polling. | 1721 | * |
1722 | * FBS+non-NCQ operation is not yet implemented. | ||
1723 | * See related notes in mv_edma_cfg(). | ||
1724 | * | ||
1725 | * Device error during FBS+non-NCQ operation: | ||
1726 | * | ||
1727 | * We need to snapshot the shadow registers for each failed command. | ||
1728 | * Follow recovery sequence from 6042/7042 datasheet (7.3.15.4.2.3). | ||
1495 | */ | 1729 | */ |
1730 | return 0; /* not handled */ | ||
1731 | } | ||
1732 | |||
1733 | static int mv_handle_dev_err(struct ata_port *ap, u32 edma_err_cause) | ||
1734 | { | ||
1735 | struct mv_port_priv *pp = ap->private_data; | ||
1736 | |||
1737 | if (!(pp->pp_flags & MV_PP_FLAG_EDMA_EN)) | ||
1738 | return 0; /* EDMA was not active: not handled */ | ||
1739 | if (!(pp->pp_flags & MV_PP_FLAG_FBS_EN)) | ||
1740 | return 0; /* FBS was not active: not handled */ | ||
1741 | |||
1742 | if (!(edma_err_cause & EDMA_ERR_DEV)) | ||
1743 | return 0; /* non DEV error: not handled */ | ||
1744 | edma_err_cause &= ~EDMA_ERR_IRQ_TRANSIENT; | ||
1745 | if (edma_err_cause & ~(EDMA_ERR_DEV | EDMA_ERR_SELF_DIS)) | ||
1746 | return 0; /* other problems: not handled */ | ||
1747 | |||
1748 | if (pp->pp_flags & MV_PP_FLAG_NCQ_EN) { | ||
1749 | /* | ||
1750 | * EDMA should NOT have self-disabled for this case. | ||
1751 | * If it did, then something is wrong elsewhere, | ||
1752 | * and we cannot handle it here. | ||
1753 | */ | ||
1754 | if (edma_err_cause & EDMA_ERR_SELF_DIS) { | ||
1755 | ata_port_printk(ap, KERN_WARNING, | ||
1756 | "%s: err_cause=0x%x pp_flags=0x%x\n", | ||
1757 | __func__, edma_err_cause, pp->pp_flags); | ||
1758 | return 0; /* not handled */ | ||
1759 | } | ||
1760 | return mv_handle_fbs_ncq_dev_err(ap); | ||
1761 | } else { | ||
1762 | /* | ||
1763 | * EDMA should have self-disabled for this case. | ||
1764 | * If it did not, then something is wrong elsewhere, | ||
1765 | * and we cannot handle it here. | ||
1766 | */ | ||
1767 | if (!(edma_err_cause & EDMA_ERR_SELF_DIS)) { | ||
1768 | ata_port_printk(ap, KERN_WARNING, | ||
1769 | "%s: err_cause=0x%x pp_flags=0x%x\n", | ||
1770 | __func__, edma_err_cause, pp->pp_flags); | ||
1771 | return 0; /* not handled */ | ||
1772 | } | ||
1773 | return mv_handle_fbs_non_ncq_dev_err(ap); | ||
1774 | } | ||
1775 | return 0; /* not handled */ | ||
1776 | } | ||
1777 | |||
1778 | static void mv_unexpected_intr(struct ata_port *ap, int edma_was_enabled) | ||
1779 | { | ||
1780 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
1781 | char *when = "idle"; | ||
1782 | |||
1496 | ata_ehi_clear_desc(ehi); | 1783 | ata_ehi_clear_desc(ehi); |
1497 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { | 1784 | if (!ap || (ap->flags & ATA_FLAG_DISABLED)) { |
1498 | when = " while EDMA enabled"; | 1785 | when = "disabled"; |
1786 | } else if (edma_was_enabled) { | ||
1787 | when = "EDMA enabled"; | ||
1499 | } else { | 1788 | } else { |
1500 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag); | 1789 | struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->link.active_tag); |
1501 | if (qc && (qc->tf.flags & ATA_TFLAG_POLLING)) | 1790 | if (qc && (qc->tf.flags & ATA_TFLAG_POLLING)) |
1502 | when = " while polling"; | 1791 | when = "polling"; |
1503 | } | 1792 | } |
1504 | ata_ehi_push_desc(ehi, "unexpected device interrupt%s", when); | 1793 | ata_ehi_push_desc(ehi, "unexpected device interrupt while %s", when); |
1505 | ehi->err_mask |= AC_ERR_OTHER; | 1794 | ehi->err_mask |= AC_ERR_OTHER; |
1506 | ehi->action |= ATA_EH_RESET; | 1795 | ehi->action |= ATA_EH_RESET; |
1507 | ata_port_freeze(ap); | 1796 | ata_port_freeze(ap); |
@@ -1519,7 +1808,7 @@ static void mv_unexpected_intr(struct ata_port *ap) | |||
1519 | * LOCKING: | 1808 | * LOCKING: |
1520 | * Inherited from caller. | 1809 | * Inherited from caller. |
1521 | */ | 1810 | */ |
1522 | static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | 1811 | static void mv_err_intr(struct ata_port *ap) |
1523 | { | 1812 | { |
1524 | void __iomem *port_mmio = mv_ap_base(ap); | 1813 | void __iomem *port_mmio = mv_ap_base(ap); |
1525 | u32 edma_err_cause, eh_freeze_mask, serr = 0; | 1814 | u32 edma_err_cause, eh_freeze_mask, serr = 0; |
@@ -1527,24 +1816,42 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
1527 | struct mv_host_priv *hpriv = ap->host->private_data; | 1816 | struct mv_host_priv *hpriv = ap->host->private_data; |
1528 | unsigned int action = 0, err_mask = 0; | 1817 | unsigned int action = 0, err_mask = 0; |
1529 | struct ata_eh_info *ehi = &ap->link.eh_info; | 1818 | struct ata_eh_info *ehi = &ap->link.eh_info; |
1530 | 1819 | struct ata_queued_cmd *qc; | |
1531 | ata_ehi_clear_desc(ehi); | 1820 | int abort = 0; |
1532 | 1821 | ||
1533 | /* | 1822 | /* |
1534 | * Read and clear the err_cause bits. This won't actually | 1823 | * Read and clear the SError and err_cause bits. |
1535 | * clear for some errors (eg. SError), but we will be doing | ||
1536 | * a hard reset in those cases regardless, which *will* clear it. | ||
1537 | */ | 1824 | */ |
1825 | sata_scr_read(&ap->link, SCR_ERROR, &serr); | ||
1826 | sata_scr_write_flush(&ap->link, SCR_ERROR, serr); | ||
1827 | |||
1538 | edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 1828 | edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
1539 | writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 1829 | writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
1540 | 1830 | ||
1541 | ata_ehi_push_desc(ehi, "edma_err_cause=%08x", edma_err_cause); | 1831 | ata_port_printk(ap, KERN_INFO, "%s: err_cause=%08x pp_flags=0x%x\n", |
1832 | __func__, edma_err_cause, pp->pp_flags); | ||
1833 | |||
1834 | if (edma_err_cause & EDMA_ERR_DEV) { | ||
1835 | /* | ||
1836 | * Device errors during FIS-based switching operation | ||
1837 | * require special handling. | ||
1838 | */ | ||
1839 | if (mv_handle_dev_err(ap, edma_err_cause)) | ||
1840 | return; | ||
1841 | } | ||
1542 | 1842 | ||
1843 | qc = mv_get_active_qc(ap); | ||
1844 | ata_ehi_clear_desc(ehi); | ||
1845 | ata_ehi_push_desc(ehi, "edma_err_cause=%08x pp_flags=%08x", | ||
1846 | edma_err_cause, pp->pp_flags); | ||
1543 | /* | 1847 | /* |
1544 | * All generations share these EDMA error cause bits: | 1848 | * All generations share these EDMA error cause bits: |
1545 | */ | 1849 | */ |
1546 | if (edma_err_cause & EDMA_ERR_DEV) | 1850 | if (edma_err_cause & EDMA_ERR_DEV) { |
1547 | err_mask |= AC_ERR_DEV; | 1851 | err_mask |= AC_ERR_DEV; |
1852 | action |= ATA_EH_RESET; | ||
1853 | ata_ehi_push_desc(ehi, "dev error"); | ||
1854 | } | ||
1548 | if (edma_err_cause & (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR | | 1855 | if (edma_err_cause & (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR | |
1549 | EDMA_ERR_CRQB_PAR | EDMA_ERR_CRPB_PAR | | 1856 | EDMA_ERR_CRQB_PAR | EDMA_ERR_CRPB_PAR | |
1550 | EDMA_ERR_INTRL_PAR)) { | 1857 | EDMA_ERR_INTRL_PAR)) { |
@@ -1576,13 +1883,6 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
1576 | ata_ehi_push_desc(ehi, "EDMA self-disable"); | 1883 | ata_ehi_push_desc(ehi, "EDMA self-disable"); |
1577 | } | 1884 | } |
1578 | if (edma_err_cause & EDMA_ERR_SERR) { | 1885 | if (edma_err_cause & EDMA_ERR_SERR) { |
1579 | /* | ||
1580 | * Ensure that we read our own SCR, not a pmp link SCR: | ||
1581 | */ | ||
1582 | ap->ops->scr_read(ap, SCR_ERROR, &serr); | ||
1583 | /* | ||
1584 | * Don't clear SError here; leave it for libata-eh: | ||
1585 | */ | ||
1586 | ata_ehi_push_desc(ehi, "SError=%08x", serr); | 1886 | ata_ehi_push_desc(ehi, "SError=%08x", serr); |
1587 | err_mask |= AC_ERR_ATA_BUS; | 1887 | err_mask |= AC_ERR_ATA_BUS; |
1588 | action |= ATA_EH_RESET; | 1888 | action |= ATA_EH_RESET; |
@@ -1602,10 +1902,29 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
1602 | else | 1902 | else |
1603 | ehi->err_mask |= err_mask; | 1903 | ehi->err_mask |= err_mask; |
1604 | 1904 | ||
1605 | if (edma_err_cause & eh_freeze_mask) | 1905 | if (err_mask == AC_ERR_DEV) { |
1906 | /* | ||
1907 | * Cannot do ata_port_freeze() here, | ||
1908 | * because it would kill PIO access, | ||
1909 | * which is needed for further diagnosis. | ||
1910 | */ | ||
1911 | mv_eh_freeze(ap); | ||
1912 | abort = 1; | ||
1913 | } else if (edma_err_cause & eh_freeze_mask) { | ||
1914 | /* | ||
1915 | * Note to self: ata_port_freeze() calls ata_port_abort() | ||
1916 | */ | ||
1606 | ata_port_freeze(ap); | 1917 | ata_port_freeze(ap); |
1607 | else | 1918 | } else { |
1608 | ata_port_abort(ap); | 1919 | abort = 1; |
1920 | } | ||
1921 | |||
1922 | if (abort) { | ||
1923 | if (qc) | ||
1924 | ata_link_abort(qc->dev->link); | ||
1925 | else | ||
1926 | ata_port_abort(ap); | ||
1927 | } | ||
1609 | } | 1928 | } |
1610 | 1929 | ||
1611 | static void mv_process_crpb_response(struct ata_port *ap, | 1930 | static void mv_process_crpb_response(struct ata_port *ap, |
@@ -1632,8 +1951,9 @@ static void mv_process_crpb_response(struct ata_port *ap, | |||
1632 | } | 1951 | } |
1633 | } | 1952 | } |
1634 | ata_status = edma_status >> CRPB_FLAG_STATUS_SHIFT; | 1953 | ata_status = edma_status >> CRPB_FLAG_STATUS_SHIFT; |
1635 | qc->err_mask |= ac_err_mask(ata_status); | 1954 | if (!ac_err_mask(ata_status)) |
1636 | ata_qc_complete(qc); | 1955 | ata_qc_complete(qc); |
1956 | /* else: leave it for mv_err_intr() */ | ||
1637 | } else { | 1957 | } else { |
1638 | ata_port_printk(ap, KERN_ERR, "%s: no qc for tag=%d\n", | 1958 | ata_port_printk(ap, KERN_ERR, "%s: no qc for tag=%d\n", |
1639 | __func__, tag); | 1959 | __func__, tag); |
@@ -1677,6 +1997,44 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp | |||
1677 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 1997 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
1678 | } | 1998 | } |
1679 | 1999 | ||
2000 | static void mv_port_intr(struct ata_port *ap, u32 port_cause) | ||
2001 | { | ||
2002 | struct mv_port_priv *pp; | ||
2003 | int edma_was_enabled; | ||
2004 | |||
2005 | if (!ap || (ap->flags & ATA_FLAG_DISABLED)) { | ||
2006 | mv_unexpected_intr(ap, 0); | ||
2007 | return; | ||
2008 | } | ||
2009 | /* | ||
2010 | * Grab a snapshot of the EDMA_EN flag setting, | ||
2011 | * so that we have a consistent view for this port, | ||
2012 | * even if something we call of our routines changes it. | ||
2013 | */ | ||
2014 | pp = ap->private_data; | ||
2015 | edma_was_enabled = (pp->pp_flags & MV_PP_FLAG_EDMA_EN); | ||
2016 | /* | ||
2017 | * Process completed CRPB response(s) before other events. | ||
2018 | */ | ||
2019 | if (edma_was_enabled && (port_cause & DONE_IRQ)) { | ||
2020 | mv_process_crpb_entries(ap, pp); | ||
2021 | if (pp->pp_flags & MV_PP_FLAG_DELAYED_EH) | ||
2022 | mv_handle_fbs_ncq_dev_err(ap); | ||
2023 | } | ||
2024 | /* | ||
2025 | * Handle chip-reported errors, or continue on to handle PIO. | ||
2026 | */ | ||
2027 | if (unlikely(port_cause & ERR_IRQ)) { | ||
2028 | mv_err_intr(ap); | ||
2029 | } else if (!edma_was_enabled) { | ||
2030 | struct ata_queued_cmd *qc = mv_get_active_qc(ap); | ||
2031 | if (qc) | ||
2032 | ata_sff_host_intr(ap, qc); | ||
2033 | else | ||
2034 | mv_unexpected_intr(ap, edma_was_enabled); | ||
2035 | } | ||
2036 | } | ||
2037 | |||
1680 | /** | 2038 | /** |
1681 | * mv_host_intr - Handle all interrupts on the given host controller | 2039 | * mv_host_intr - Handle all interrupts on the given host controller |
1682 | * @host: host specific structure | 2040 | * @host: host specific structure |
@@ -1688,66 +2046,58 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp | |||
1688 | static int mv_host_intr(struct ata_host *host, u32 main_irq_cause) | 2046 | static int mv_host_intr(struct ata_host *host, u32 main_irq_cause) |
1689 | { | 2047 | { |
1690 | struct mv_host_priv *hpriv = host->private_data; | 2048 | struct mv_host_priv *hpriv = host->private_data; |
1691 | void __iomem *mmio = hpriv->base, *hc_mmio = NULL; | 2049 | void __iomem *mmio = hpriv->base, *hc_mmio; |
1692 | u32 hc_irq_cause = 0; | ||
1693 | unsigned int handled = 0, port; | 2050 | unsigned int handled = 0, port; |
1694 | 2051 | ||
1695 | for (port = 0; port < hpriv->n_ports; port++) { | 2052 | for (port = 0; port < hpriv->n_ports; port++) { |
1696 | struct ata_port *ap = host->ports[port]; | 2053 | struct ata_port *ap = host->ports[port]; |
1697 | struct mv_port_priv *pp; | 2054 | unsigned int p, shift, hardport, port_cause; |
1698 | unsigned int shift, hardport, port_cause; | 2055 | |
1699 | /* | ||
1700 | * When we move to the second hc, flag our cached | ||
1701 | * copies of hc_mmio (and hc_irq_cause) as invalid again. | ||
1702 | */ | ||
1703 | if (port == MV_PORTS_PER_HC) | ||
1704 | hc_mmio = NULL; | ||
1705 | /* | ||
1706 | * Do nothing if port is not interrupting or is disabled: | ||
1707 | */ | ||
1708 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | 2056 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); |
1709 | port_cause = (main_irq_cause >> shift) & (DONE_IRQ | ERR_IRQ); | ||
1710 | if (!port_cause || !ap || (ap->flags & ATA_FLAG_DISABLED)) | ||
1711 | continue; | ||
1712 | /* | 2057 | /* |
1713 | * Each hc within the host has its own hc_irq_cause register. | 2058 | * Each hc within the host has its own hc_irq_cause register, |
1714 | * We defer reading it until we know we need it, right now: | 2059 | * where the interrupting ports bits get ack'd. |
1715 | * | ||
1716 | * FIXME later: we don't really need to read this register | ||
1717 | * (some logic changes required below if we go that way), | ||
1718 | * because it doesn't tell us anything new. But we do need | ||
1719 | * to write to it, outside the top of this loop, | ||
1720 | * to reset the interrupt triggers for next time. | ||
1721 | */ | 2060 | */ |
1722 | if (!hc_mmio) { | 2061 | if (hardport == 0) { /* first port on this hc ? */ |
2062 | u32 hc_cause = (main_irq_cause >> shift) & HC0_IRQ_PEND; | ||
2063 | u32 port_mask, ack_irqs; | ||
2064 | /* | ||
2065 | * Skip this entire hc if nothing pending for any ports | ||
2066 | */ | ||
2067 | if (!hc_cause) { | ||
2068 | port += MV_PORTS_PER_HC - 1; | ||
2069 | continue; | ||
2070 | } | ||
2071 | /* | ||
2072 | * We don't need/want to read the hc_irq_cause register, | ||
2073 | * because doing so hurts performance, and | ||
2074 | * main_irq_cause already gives us everything we need. | ||
2075 | * | ||
2076 | * But we do have to *write* to the hc_irq_cause to ack | ||
2077 | * the ports that we are handling this time through. | ||
2078 | * | ||
2079 | * This requires that we create a bitmap for those | ||
2080 | * ports which interrupted us, and use that bitmap | ||
2081 | * to ack (only) those ports via hc_irq_cause. | ||
2082 | */ | ||
2083 | ack_irqs = 0; | ||
2084 | for (p = 0; p < MV_PORTS_PER_HC; ++p) { | ||
2085 | if ((port + p) >= hpriv->n_ports) | ||
2086 | break; | ||
2087 | port_mask = (DONE_IRQ | ERR_IRQ) << (p * 2); | ||
2088 | if (hc_cause & port_mask) | ||
2089 | ack_irqs |= (DMA_IRQ | DEV_IRQ) << p; | ||
2090 | } | ||
1723 | hc_mmio = mv_hc_base_from_port(mmio, port); | 2091 | hc_mmio = mv_hc_base_from_port(mmio, port); |
1724 | hc_irq_cause = readl(hc_mmio + HC_IRQ_CAUSE_OFS); | 2092 | writelfl(~ack_irqs, hc_mmio + HC_IRQ_CAUSE_OFS); |
1725 | writelfl(~hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); | ||
1726 | handled = 1; | 2093 | handled = 1; |
1727 | } | 2094 | } |
1728 | /* | 2095 | /* |
1729 | * Process completed CRPB response(s) before other events. | 2096 | * Handle interrupts signalled for this port: |
1730 | */ | ||
1731 | pp = ap->private_data; | ||
1732 | if (hc_irq_cause & (DMA_IRQ << hardport)) { | ||
1733 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) | ||
1734 | mv_process_crpb_entries(ap, pp); | ||
1735 | } | ||
1736 | /* | ||
1737 | * Handle chip-reported errors, or continue on to handle PIO. | ||
1738 | */ | 2097 | */ |
1739 | if (unlikely(port_cause & ERR_IRQ)) { | 2098 | port_cause = (main_irq_cause >> shift) & (DONE_IRQ | ERR_IRQ); |
1740 | mv_err_intr(ap, mv_get_active_qc(ap)); | 2099 | if (port_cause) |
1741 | } else if (hc_irq_cause & (DEV_IRQ << hardport)) { | 2100 | mv_port_intr(ap, port_cause); |
1742 | if (!(pp->pp_flags & MV_PP_FLAG_EDMA_EN)) { | ||
1743 | struct ata_queued_cmd *qc = mv_get_active_qc(ap); | ||
1744 | if (qc) { | ||
1745 | ata_sff_host_intr(ap, qc); | ||
1746 | continue; | ||
1747 | } | ||
1748 | } | ||
1749 | mv_unexpected_intr(ap); | ||
1750 | } | ||
1751 | } | 2101 | } |
1752 | return handled; | 2102 | return handled; |
1753 | } | 2103 | } |
@@ -1894,7 +2244,7 @@ static void mv5_reset_bus(struct ata_host *host, void __iomem *mmio) | |||
1894 | 2244 | ||
1895 | static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) | 2245 | static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) |
1896 | { | 2246 | { |
1897 | writel(0x0fcfffff, mmio + MV_FLASH_CTL); | 2247 | writel(0x0fcfffff, mmio + MV_FLASH_CTL_OFS); |
1898 | } | 2248 | } |
1899 | 2249 | ||
1900 | static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, | 2250 | static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, |
@@ -1913,7 +2263,7 @@ static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) | |||
1913 | { | 2263 | { |
1914 | u32 tmp; | 2264 | u32 tmp; |
1915 | 2265 | ||
1916 | writel(0, mmio + MV_GPIO_PORT_CTL); | 2266 | writel(0, mmio + MV_GPIO_PORT_CTL_OFS); |
1917 | 2267 | ||
1918 | /* FIXME: handle MV_HP_ERRATA_50XXB2 errata */ | 2268 | /* FIXME: handle MV_HP_ERRATA_50XXB2 errata */ |
1919 | 2269 | ||
@@ -1931,14 +2281,14 @@ static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
1931 | int fix_apm_sq = (hpriv->hp_flags & MV_HP_ERRATA_50XXB0); | 2281 | int fix_apm_sq = (hpriv->hp_flags & MV_HP_ERRATA_50XXB0); |
1932 | 2282 | ||
1933 | if (fix_apm_sq) { | 2283 | if (fix_apm_sq) { |
1934 | tmp = readl(phy_mmio + MV5_LT_MODE); | 2284 | tmp = readl(phy_mmio + MV5_LTMODE_OFS); |
1935 | tmp |= (1 << 19); | 2285 | tmp |= (1 << 19); |
1936 | writel(tmp, phy_mmio + MV5_LT_MODE); | 2286 | writel(tmp, phy_mmio + MV5_LTMODE_OFS); |
1937 | 2287 | ||
1938 | tmp = readl(phy_mmio + MV5_PHY_CTL); | 2288 | tmp = readl(phy_mmio + MV5_PHY_CTL_OFS); |
1939 | tmp &= ~0x3; | 2289 | tmp &= ~0x3; |
1940 | tmp |= 0x1; | 2290 | tmp |= 0x1; |
1941 | writel(tmp, phy_mmio + MV5_PHY_CTL); | 2291 | writel(tmp, phy_mmio + MV5_PHY_CTL_OFS); |
1942 | } | 2292 | } |
1943 | 2293 | ||
1944 | tmp = readl(phy_mmio + MV5_PHY_MODE); | 2294 | tmp = readl(phy_mmio + MV5_PHY_MODE); |
@@ -1956,11 +2306,6 @@ static void mv5_reset_hc_port(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
1956 | { | 2306 | { |
1957 | void __iomem *port_mmio = mv_port_base(mmio, port); | 2307 | void __iomem *port_mmio = mv_port_base(mmio, port); |
1958 | 2308 | ||
1959 | /* | ||
1960 | * The datasheet warns against setting ATA_RST when EDMA is active | ||
1961 | * (but doesn't say what the problem might be). So we first try | ||
1962 | * to disable the EDMA engine before doing the ATA_RST operation. | ||
1963 | */ | ||
1964 | mv_reset_channel(hpriv, mmio, port); | 2309 | mv_reset_channel(hpriv, mmio, port); |
1965 | 2310 | ||
1966 | ZERO(0x028); /* command */ | 2311 | ZERO(0x028); /* command */ |
@@ -1975,7 +2320,7 @@ static void mv5_reset_hc_port(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
1975 | ZERO(0x024); /* respq outp */ | 2320 | ZERO(0x024); /* respq outp */ |
1976 | ZERO(0x020); /* respq inp */ | 2321 | ZERO(0x020); /* respq inp */ |
1977 | ZERO(0x02c); /* test control */ | 2322 | ZERO(0x02c); /* test control */ |
1978 | writel(0xbc, port_mmio + EDMA_IORDY_TMOUT); | 2323 | writel(0xbc, port_mmio + EDMA_IORDY_TMOUT_OFS); |
1979 | } | 2324 | } |
1980 | #undef ZERO | 2325 | #undef ZERO |
1981 | 2326 | ||
@@ -2021,13 +2366,13 @@ static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio) | |||
2021 | struct mv_host_priv *hpriv = host->private_data; | 2366 | struct mv_host_priv *hpriv = host->private_data; |
2022 | u32 tmp; | 2367 | u32 tmp; |
2023 | 2368 | ||
2024 | tmp = readl(mmio + MV_PCI_MODE); | 2369 | tmp = readl(mmio + MV_PCI_MODE_OFS); |
2025 | tmp &= 0xff00ffff; | 2370 | tmp &= 0xff00ffff; |
2026 | writel(tmp, mmio + MV_PCI_MODE); | 2371 | writel(tmp, mmio + MV_PCI_MODE_OFS); |
2027 | 2372 | ||
2028 | ZERO(MV_PCI_DISC_TIMER); | 2373 | ZERO(MV_PCI_DISC_TIMER); |
2029 | ZERO(MV_PCI_MSI_TRIGGER); | 2374 | ZERO(MV_PCI_MSI_TRIGGER); |
2030 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); | 2375 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT_OFS); |
2031 | ZERO(PCI_HC_MAIN_IRQ_MASK_OFS); | 2376 | ZERO(PCI_HC_MAIN_IRQ_MASK_OFS); |
2032 | ZERO(MV_PCI_SERR_MASK); | 2377 | ZERO(MV_PCI_SERR_MASK); |
2033 | ZERO(hpriv->irq_cause_ofs); | 2378 | ZERO(hpriv->irq_cause_ofs); |
@@ -2045,10 +2390,10 @@ static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) | |||
2045 | 2390 | ||
2046 | mv5_reset_flash(hpriv, mmio); | 2391 | mv5_reset_flash(hpriv, mmio); |
2047 | 2392 | ||
2048 | tmp = readl(mmio + MV_GPIO_PORT_CTL); | 2393 | tmp = readl(mmio + MV_GPIO_PORT_CTL_OFS); |
2049 | tmp &= 0x3; | 2394 | tmp &= 0x3; |
2050 | tmp |= (1 << 5) | (1 << 6); | 2395 | tmp |= (1 << 5) | (1 << 6); |
2051 | writel(tmp, mmio + MV_GPIO_PORT_CTL); | 2396 | writel(tmp, mmio + MV_GPIO_PORT_CTL_OFS); |
2052 | } | 2397 | } |
2053 | 2398 | ||
2054 | /** | 2399 | /** |
@@ -2121,7 +2466,7 @@ static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, | |||
2121 | void __iomem *port_mmio; | 2466 | void __iomem *port_mmio; |
2122 | u32 tmp; | 2467 | u32 tmp; |
2123 | 2468 | ||
2124 | tmp = readl(mmio + MV_RESET_CFG); | 2469 | tmp = readl(mmio + MV_RESET_CFG_OFS); |
2125 | if ((tmp & (1 << 0)) == 0) { | 2470 | if ((tmp & (1 << 0)) == 0) { |
2126 | hpriv->signal[idx].amps = 0x7 << 8; | 2471 | hpriv->signal[idx].amps = 0x7 << 8; |
2127 | hpriv->signal[idx].pre = 0x1 << 5; | 2472 | hpriv->signal[idx].pre = 0x1 << 5; |
@@ -2137,7 +2482,7 @@ static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, | |||
2137 | 2482 | ||
2138 | static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) | 2483 | static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) |
2139 | { | 2484 | { |
2140 | writel(0x00000060, mmio + MV_GPIO_PORT_CTL); | 2485 | writel(0x00000060, mmio + MV_GPIO_PORT_CTL_OFS); |
2141 | } | 2486 | } |
2142 | 2487 | ||
2143 | static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | 2488 | static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, |
@@ -2235,11 +2580,6 @@ static void mv_soc_reset_hc_port(struct mv_host_priv *hpriv, | |||
2235 | { | 2580 | { |
2236 | void __iomem *port_mmio = mv_port_base(mmio, port); | 2581 | void __iomem *port_mmio = mv_port_base(mmio, port); |
2237 | 2582 | ||
2238 | /* | ||
2239 | * The datasheet warns against setting ATA_RST when EDMA is active | ||
2240 | * (but doesn't say what the problem might be). So we first try | ||
2241 | * to disable the EDMA engine before doing the ATA_RST operation. | ||
2242 | */ | ||
2243 | mv_reset_channel(hpriv, mmio, port); | 2583 | mv_reset_channel(hpriv, mmio, port); |
2244 | 2584 | ||
2245 | ZERO(0x028); /* command */ | 2585 | ZERO(0x028); /* command */ |
@@ -2254,7 +2594,7 @@ static void mv_soc_reset_hc_port(struct mv_host_priv *hpriv, | |||
2254 | ZERO(0x024); /* respq outp */ | 2594 | ZERO(0x024); /* respq outp */ |
2255 | ZERO(0x020); /* respq inp */ | 2595 | ZERO(0x020); /* respq inp */ |
2256 | ZERO(0x02c); /* test control */ | 2596 | ZERO(0x02c); /* test control */ |
2257 | writel(0xbc, port_mmio + EDMA_IORDY_TMOUT); | 2597 | writel(0xbc, port_mmio + EDMA_IORDY_TMOUT_OFS); |
2258 | } | 2598 | } |
2259 | 2599 | ||
2260 | #undef ZERO | 2600 | #undef ZERO |
@@ -2297,38 +2637,39 @@ static void mv_soc_reset_bus(struct ata_host *host, void __iomem *mmio) | |||
2297 | return; | 2637 | return; |
2298 | } | 2638 | } |
2299 | 2639 | ||
2300 | static void mv_setup_ifctl(void __iomem *port_mmio, int want_gen2i) | 2640 | static void mv_setup_ifcfg(void __iomem *port_mmio, int want_gen2i) |
2301 | { | 2641 | { |
2302 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CFG); | 2642 | u32 ifcfg = readl(port_mmio + SATA_INTERFACE_CFG_OFS); |
2303 | 2643 | ||
2304 | ifctl = (ifctl & 0xf7f) | 0x9b1000; /* from chip spec */ | 2644 | ifcfg = (ifcfg & 0xf7f) | 0x9b1000; /* from chip spec */ |
2305 | if (want_gen2i) | 2645 | if (want_gen2i) |
2306 | ifctl |= (1 << 7); /* enable gen2i speed */ | 2646 | ifcfg |= (1 << 7); /* enable gen2i speed */ |
2307 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CFG); | 2647 | writelfl(ifcfg, port_mmio + SATA_INTERFACE_CFG_OFS); |
2308 | } | 2648 | } |
2309 | 2649 | ||
2310 | /* | ||
2311 | * Caller must ensure that EDMA is not active, | ||
2312 | * by first doing mv_stop_edma() where needed. | ||
2313 | */ | ||
2314 | static void mv_reset_channel(struct mv_host_priv *hpriv, void __iomem *mmio, | 2650 | static void mv_reset_channel(struct mv_host_priv *hpriv, void __iomem *mmio, |
2315 | unsigned int port_no) | 2651 | unsigned int port_no) |
2316 | { | 2652 | { |
2317 | void __iomem *port_mmio = mv_port_base(mmio, port_no); | 2653 | void __iomem *port_mmio = mv_port_base(mmio, port_no); |
2318 | 2654 | ||
2655 | /* | ||
2656 | * The datasheet warns against setting EDMA_RESET when EDMA is active | ||
2657 | * (but doesn't say what the problem might be). So we first try | ||
2658 | * to disable the EDMA engine before doing the EDMA_RESET operation. | ||
2659 | */ | ||
2319 | mv_stop_edma_engine(port_mmio); | 2660 | mv_stop_edma_engine(port_mmio); |
2320 | writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS); | 2661 | writelfl(EDMA_RESET, port_mmio + EDMA_CMD_OFS); |
2321 | 2662 | ||
2322 | if (!IS_GEN_I(hpriv)) { | 2663 | if (!IS_GEN_I(hpriv)) { |
2323 | /* Enable 3.0gb/s link speed */ | 2664 | /* Enable 3.0gb/s link speed: this survives EDMA_RESET */ |
2324 | mv_setup_ifctl(port_mmio, 1); | 2665 | mv_setup_ifcfg(port_mmio, 1); |
2325 | } | 2666 | } |
2326 | /* | 2667 | /* |
2327 | * Strobing ATA_RST here causes a hard reset of the SATA transport, | 2668 | * Strobing EDMA_RESET here causes a hard reset of the SATA transport, |
2328 | * link, and physical layers. It resets all SATA interface registers | 2669 | * link, and physical layers. It resets all SATA interface registers |
2329 | * (except for SATA_INTERFACE_CFG), and issues a COMRESET to the dev. | 2670 | * (except for SATA_INTERFACE_CFG), and issues a COMRESET to the dev. |
2330 | */ | 2671 | */ |
2331 | writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS); | 2672 | writelfl(EDMA_RESET, port_mmio + EDMA_CMD_OFS); |
2332 | udelay(25); /* allow reset propagation */ | 2673 | udelay(25); /* allow reset propagation */ |
2333 | writelfl(0, port_mmio + EDMA_CMD_OFS); | 2674 | writelfl(0, port_mmio + EDMA_CMD_OFS); |
2334 | 2675 | ||
@@ -2392,7 +2733,7 @@ static int mv_hardreset(struct ata_link *link, unsigned int *class, | |||
2392 | sata_scr_read(link, SCR_STATUS, &sstatus); | 2733 | sata_scr_read(link, SCR_STATUS, &sstatus); |
2393 | if (!IS_GEN_I(hpriv) && ++attempts >= 5 && sstatus == 0x121) { | 2734 | if (!IS_GEN_I(hpriv) && ++attempts >= 5 && sstatus == 0x121) { |
2394 | /* Force 1.5gb/s link speed and try again */ | 2735 | /* Force 1.5gb/s link speed and try again */ |
2395 | mv_setup_ifctl(mv_ap_base(ap), 0); | 2736 | mv_setup_ifcfg(mv_ap_base(ap), 0); |
2396 | if (time_after(jiffies + HZ, deadline)) | 2737 | if (time_after(jiffies + HZ, deadline)) |
2397 | extra = HZ; /* only extend it once, max */ | 2738 | extra = HZ; /* only extend it once, max */ |
2398 | } | 2739 | } |
@@ -2493,6 +2834,34 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) | |||
2493 | readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); | 2834 | readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); |
2494 | } | 2835 | } |
2495 | 2836 | ||
2837 | static unsigned int mv_in_pcix_mode(struct ata_host *host) | ||
2838 | { | ||
2839 | struct mv_host_priv *hpriv = host->private_data; | ||
2840 | void __iomem *mmio = hpriv->base; | ||
2841 | u32 reg; | ||
2842 | |||
2843 | if (!HAS_PCI(host) || !IS_PCIE(hpriv)) | ||
2844 | return 0; /* not PCI-X capable */ | ||
2845 | reg = readl(mmio + MV_PCI_MODE_OFS); | ||
2846 | if ((reg & MV_PCI_MODE_MASK) == 0) | ||
2847 | return 0; /* conventional PCI mode */ | ||
2848 | return 1; /* chip is in PCI-X mode */ | ||
2849 | } | ||
2850 | |||
2851 | static int mv_pci_cut_through_okay(struct ata_host *host) | ||
2852 | { | ||
2853 | struct mv_host_priv *hpriv = host->private_data; | ||
2854 | void __iomem *mmio = hpriv->base; | ||
2855 | u32 reg; | ||
2856 | |||
2857 | if (!mv_in_pcix_mode(host)) { | ||
2858 | reg = readl(mmio + PCI_COMMAND_OFS); | ||
2859 | if (reg & PCI_COMMAND_MRDTRIG) | ||
2860 | return 0; /* not okay */ | ||
2861 | } | ||
2862 | return 1; /* okay */ | ||
2863 | } | ||
2864 | |||
2496 | static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | 2865 | static int mv_chip_id(struct ata_host *host, unsigned int board_idx) |
2497 | { | 2866 | { |
2498 | struct pci_dev *pdev = to_pci_dev(host->dev); | 2867 | struct pci_dev *pdev = to_pci_dev(host->dev); |
@@ -2560,7 +2929,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
2560 | break; | 2929 | break; |
2561 | 2930 | ||
2562 | case chip_7042: | 2931 | case chip_7042: |
2563 | hp_flags |= MV_HP_PCIE; | 2932 | hp_flags |= MV_HP_PCIE | MV_HP_CUT_THROUGH; |
2564 | if (pdev->vendor == PCI_VENDOR_ID_TTI && | 2933 | if (pdev->vendor == PCI_VENDOR_ID_TTI && |
2565 | (pdev->device == 0x2300 || pdev->device == 0x2310)) | 2934 | (pdev->device == 0x2300 || pdev->device == 0x2310)) |
2566 | { | 2935 | { |
@@ -2590,9 +2959,12 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
2590 | " and avoid the final two gigabytes on" | 2959 | " and avoid the final two gigabytes on" |
2591 | " all RocketRAID BIOS initialized drives.\n"); | 2960 | " all RocketRAID BIOS initialized drives.\n"); |
2592 | } | 2961 | } |
2962 | /* drop through */ | ||
2593 | case chip_6042: | 2963 | case chip_6042: |
2594 | hpriv->ops = &mv6xxx_ops; | 2964 | hpriv->ops = &mv6xxx_ops; |
2595 | hp_flags |= MV_HP_GEN_IIE; | 2965 | hp_flags |= MV_HP_GEN_IIE; |
2966 | if (board_idx == chip_6042 && mv_pci_cut_through_okay(host)) | ||
2967 | hp_flags |= MV_HP_CUT_THROUGH; | ||
2596 | 2968 | ||
2597 | switch (pdev->revision) { | 2969 | switch (pdev->revision) { |
2598 | case 0x0: | 2970 | case 0x0: |
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 4fbb56bcb1e..358bb0be3c0 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -175,8 +175,7 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv) | |||
175 | } | 175 | } |
176 | 176 | ||
177 | /* Check whether this driver has already been added to a class. */ | 177 | /* Check whether this driver has already been added to a class. */ |
178 | if ((drv->entry.next != drv->entry.prev) || | 178 | if (drv->entry.next && !list_empty(&drv->entry)) { |
179 | (drv->entry.next != NULL)) { | ||
180 | printk(KERN_WARNING "sysdev: class %s: driver (%p) has already" | 179 | printk(KERN_WARNING "sysdev: class %s: driver (%p) has already" |
181 | " been registered to a class, something is wrong, but " | 180 | " been registered to a class, something is wrong, but " |
182 | "will forge on!\n", cls->name, drv); | 181 | "will forge on!\n", cls->name, drv); |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 8fc429cf82b..41f818be2f7 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -755,11 +755,13 @@ diskstats(struct gendisk *disk, struct bio *bio, ulong duration, sector_t sector | |||
755 | { | 755 | { |
756 | unsigned long n_sect = bio->bi_size >> 9; | 756 | unsigned long n_sect = bio->bi_size >> 9; |
757 | const int rw = bio_data_dir(bio); | 757 | const int rw = bio_data_dir(bio); |
758 | struct hd_struct *part; | ||
758 | 759 | ||
759 | all_stat_inc(disk, ios[rw], sector); | 760 | part = get_part(disk, sector); |
760 | all_stat_add(disk, ticks[rw], duration, sector); | 761 | all_stat_inc(disk, part, ios[rw], sector); |
761 | all_stat_add(disk, sectors[rw], n_sect, sector); | 762 | all_stat_add(disk, part, ticks[rw], duration, sector); |
762 | all_stat_add(disk, io_ticks, duration, sector); | 763 | all_stat_add(disk, part, sectors[rw], n_sect, sector); |
764 | all_stat_add(disk, part, io_ticks, duration, sector); | ||
763 | } | 765 | } |
764 | 766 | ||
765 | void | 767 | void |
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index fd2db07a50f..3b23270eaa6 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -1073,7 +1073,7 @@ static int cy_put_char(struct tty_struct *tty, unsigned char ch) | |||
1073 | return 0; | 1073 | return 0; |
1074 | 1074 | ||
1075 | if (!info->xmit_buf) | 1075 | if (!info->xmit_buf) |
1076 | return; | 1076 | return 0; |
1077 | 1077 | ||
1078 | local_irq_save(flags); | 1078 | local_irq_save(flags); |
1079 | if (info->xmit_cnt >= PAGE_SIZE - 1) { | 1079 | if (info->xmit_cnt >= PAGE_SIZE - 1) { |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index f39f6fd8935..b1a7a8cb65e 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -970,7 +970,8 @@ static int sx_set_real_termios(void *ptr) | |||
970 | sx_write_channel_byte(port, hi_mask, 0x1f); | 970 | sx_write_channel_byte(port, hi_mask, 0x1f); |
971 | break; | 971 | break; |
972 | default: | 972 | default: |
973 | printk(KERN_INFO "sx: Invalid wordsize: %u\n", CFLAG & CSIZE); | 973 | printk(KERN_INFO "sx: Invalid wordsize: %u\n", |
974 | (unsigned int)CFLAG & CSIZE); | ||
974 | break; | 975 | break; |
975 | } | 976 | } |
976 | 977 | ||
@@ -997,7 +998,8 @@ static int sx_set_real_termios(void *ptr) | |||
997 | set_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); | 998 | set_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); |
998 | } | 999 | } |
999 | sx_dprintk(SX_DEBUG_TERMIOS, "iflags: %x(%d) ", | 1000 | sx_dprintk(SX_DEBUG_TERMIOS, "iflags: %x(%d) ", |
1000 | port->gs.tty->termios->c_iflag, I_OTHER(port->gs.tty)); | 1001 | (unsigned int)port->gs.tty->termios->c_iflag, |
1002 | I_OTHER(port->gs.tty)); | ||
1001 | 1003 | ||
1002 | /* Tell line discipline whether we will do output cooking. | 1004 | /* Tell line discipline whether we will do output cooking. |
1003 | * If OPOST is set and no other output flags are set then we can do output | 1005 | * If OPOST is set and no other output flags are set then we can do output |
@@ -1010,7 +1012,8 @@ static int sx_set_real_termios(void *ptr) | |||
1010 | clear_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); | 1012 | clear_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); |
1011 | } | 1013 | } |
1012 | sx_dprintk(SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", | 1014 | sx_dprintk(SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", |
1013 | port->gs.tty->termios->c_oflag, O_OTHER(port->gs.tty)); | 1015 | (unsigned int)port->gs.tty->termios->c_oflag, |
1016 | O_OTHER(port->gs.tty)); | ||
1014 | /* port->c_dcd = sx_get_CD (port); */ | 1017 | /* port->c_dcd = sx_get_CD (port); */ |
1015 | func_exit(); | 1018 | func_exit(); |
1016 | return 0; | 1019 | return 0; |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index e458b08139a..fa1ffbf2c62 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -2742,6 +2742,10 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
2742 | tty->winsize.ws_row = vc_cons[currcons].d->vc_rows; | 2742 | tty->winsize.ws_row = vc_cons[currcons].d->vc_rows; |
2743 | tty->winsize.ws_col = vc_cons[currcons].d->vc_cols; | 2743 | tty->winsize.ws_col = vc_cons[currcons].d->vc_cols; |
2744 | } | 2744 | } |
2745 | if (vc->vc_utf) | ||
2746 | tty->termios->c_iflag |= IUTF8; | ||
2747 | else | ||
2748 | tty->termios->c_iflag &= ~IUTF8; | ||
2745 | release_console_sem(); | 2749 | release_console_sem(); |
2746 | vcs_make_sysfs(tty); | 2750 | vcs_make_sysfs(tty); |
2747 | return ret; | 2751 | return ret; |
@@ -2918,6 +2922,8 @@ int __init vty_init(void) | |||
2918 | console_driver->minor_start = 1; | 2922 | console_driver->minor_start = 1; |
2919 | console_driver->type = TTY_DRIVER_TYPE_CONSOLE; | 2923 | console_driver->type = TTY_DRIVER_TYPE_CONSOLE; |
2920 | console_driver->init_termios = tty_std_termios; | 2924 | console_driver->init_termios = tty_std_termios; |
2925 | if (default_utf8) | ||
2926 | console_driver->init_termios.c_iflag |= IUTF8; | ||
2921 | console_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS; | 2927 | console_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS; |
2922 | tty_set_operations(console_driver, &con_ops); | 2928 | tty_set_operations(console_driver, &con_ops); |
2923 | if (tty_register_driver(console_driver)) | 2929 | if (tty_register_driver(console_driver)) |
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h index a9aa845dbe7..b27b13c5eb5 100644 --- a/drivers/edac/edac_core.h +++ b/drivers/edac/edac_core.h | |||
@@ -97,7 +97,7 @@ extern int edac_debug_level; | |||
97 | #define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \ | 97 | #define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \ |
98 | PCI_DEVICE_ID_ ## vend ## _ ## dev | 98 | PCI_DEVICE_ID_ ## vend ## _ ## dev |
99 | 99 | ||
100 | #define dev_name(dev) (dev)->dev_name | 100 | #define edac_dev_name(dev) (dev)->dev_name |
101 | 101 | ||
102 | /* memory devices */ | 102 | /* memory devices */ |
103 | enum dev_type { | 103 | enum dev_type { |
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c index 63372fa7ecf..5fcd3d89c75 100644 --- a/drivers/edac/edac_device.c +++ b/drivers/edac/edac_device.c | |||
@@ -333,7 +333,7 @@ static int add_edac_dev_to_global_list(struct edac_device_ctl_info *edac_dev) | |||
333 | fail0: | 333 | fail0: |
334 | edac_printk(KERN_WARNING, EDAC_MC, | 334 | edac_printk(KERN_WARNING, EDAC_MC, |
335 | "%s (%s) %s %s already assigned %d\n", | 335 | "%s (%s) %s %s already assigned %d\n", |
336 | rover->dev->bus_id, dev_name(rover), | 336 | rover->dev->bus_id, edac_dev_name(rover), |
337 | rover->mod_name, rover->ctl_name, rover->dev_idx); | 337 | rover->mod_name, rover->ctl_name, rover->dev_idx); |
338 | return 1; | 338 | return 1; |
339 | 339 | ||
@@ -538,7 +538,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev) | |||
538 | "'%s': DEV '%s' (%s)\n", | 538 | "'%s': DEV '%s' (%s)\n", |
539 | edac_dev->mod_name, | 539 | edac_dev->mod_name, |
540 | edac_dev->ctl_name, | 540 | edac_dev->ctl_name, |
541 | dev_name(edac_dev), | 541 | edac_dev_name(edac_dev), |
542 | edac_op_state_to_string(edac_dev->op_state)); | 542 | edac_op_state_to_string(edac_dev->op_state)); |
543 | 543 | ||
544 | mutex_unlock(&device_ctls_mutex); | 544 | mutex_unlock(&device_ctls_mutex); |
@@ -599,7 +599,7 @@ struct edac_device_ctl_info *edac_device_del_device(struct device *dev) | |||
599 | edac_printk(KERN_INFO, EDAC_MC, | 599 | edac_printk(KERN_INFO, EDAC_MC, |
600 | "Removed device %d for %s %s: DEV %s\n", | 600 | "Removed device %d for %s %s: DEV %s\n", |
601 | edac_dev->dev_idx, | 601 | edac_dev->dev_idx, |
602 | edac_dev->mod_name, edac_dev->ctl_name, dev_name(edac_dev)); | 602 | edac_dev->mod_name, edac_dev->ctl_name, edac_dev_name(edac_dev)); |
603 | 603 | ||
604 | return edac_dev; | 604 | return edac_dev; |
605 | } | 605 | } |
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index a4cf1645f58..d110392d48f 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
@@ -402,7 +402,7 @@ static int add_mc_to_global_list(struct mem_ctl_info *mci) | |||
402 | fail0: | 402 | fail0: |
403 | edac_printk(KERN_WARNING, EDAC_MC, | 403 | edac_printk(KERN_WARNING, EDAC_MC, |
404 | "%s (%s) %s %s already assigned %d\n", p->dev->bus_id, | 404 | "%s (%s) %s %s already assigned %d\n", p->dev->bus_id, |
405 | dev_name(mci), p->mod_name, p->ctl_name, p->mc_idx); | 405 | edac_dev_name(mci), p->mod_name, p->ctl_name, p->mc_idx); |
406 | return 1; | 406 | return 1; |
407 | 407 | ||
408 | fail1: | 408 | fail1: |
@@ -517,7 +517,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci) | |||
517 | 517 | ||
518 | /* Report action taken */ | 518 | /* Report action taken */ |
519 | edac_mc_printk(mci, KERN_INFO, "Giving out device to '%s' '%s':" | 519 | edac_mc_printk(mci, KERN_INFO, "Giving out device to '%s' '%s':" |
520 | " DEV %s\n", mci->mod_name, mci->ctl_name, dev_name(mci)); | 520 | " DEV %s\n", mci->mod_name, mci->ctl_name, edac_dev_name(mci)); |
521 | 521 | ||
522 | mutex_unlock(&mem_ctls_mutex); | 522 | mutex_unlock(&mem_ctls_mutex); |
523 | return 0; | 523 | return 0; |
@@ -565,7 +565,7 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev) | |||
565 | 565 | ||
566 | edac_printk(KERN_INFO, EDAC_MC, | 566 | edac_printk(KERN_INFO, EDAC_MC, |
567 | "Removed device %d for %s %s: DEV %s\n", mci->mc_idx, | 567 | "Removed device %d for %s %s: DEV %s\n", mci->mc_idx, |
568 | mci->mod_name, mci->ctl_name, dev_name(mci)); | 568 | mci->mod_name, mci->ctl_name, edac_dev_name(mci)); |
569 | 569 | ||
570 | return mci; | 570 | return mci; |
571 | } | 571 | } |
diff --git a/drivers/edac/edac_pci.c b/drivers/edac/edac_pci.c index 9b24340b52e..22ec9d5d431 100644 --- a/drivers/edac/edac_pci.c +++ b/drivers/edac/edac_pci.c | |||
@@ -150,7 +150,7 @@ static int add_edac_pci_to_global_list(struct edac_pci_ctl_info *pci) | |||
150 | fail0: | 150 | fail0: |
151 | edac_printk(KERN_WARNING, EDAC_PCI, | 151 | edac_printk(KERN_WARNING, EDAC_PCI, |
152 | "%s (%s) %s %s already assigned %d\n", | 152 | "%s (%s) %s %s already assigned %d\n", |
153 | rover->dev->bus_id, dev_name(rover), | 153 | rover->dev->bus_id, edac_dev_name(rover), |
154 | rover->mod_name, rover->ctl_name, rover->pci_idx); | 154 | rover->mod_name, rover->ctl_name, rover->pci_idx); |
155 | return 1; | 155 | return 1; |
156 | 156 | ||
@@ -360,7 +360,7 @@ int edac_pci_add_device(struct edac_pci_ctl_info *pci, int edac_idx) | |||
360 | " DEV '%s' (%s)\n", | 360 | " DEV '%s' (%s)\n", |
361 | pci->mod_name, | 361 | pci->mod_name, |
362 | pci->ctl_name, | 362 | pci->ctl_name, |
363 | dev_name(pci), edac_op_state_to_string(pci->op_state)); | 363 | edac_dev_name(pci), edac_op_state_to_string(pci->op_state)); |
364 | 364 | ||
365 | mutex_unlock(&edac_pci_ctls_mutex); | 365 | mutex_unlock(&edac_pci_ctls_mutex); |
366 | return 0; | 366 | return 0; |
@@ -415,7 +415,7 @@ struct edac_pci_ctl_info *edac_pci_del_device(struct device *dev) | |||
415 | 415 | ||
416 | edac_printk(KERN_INFO, EDAC_PCI, | 416 | edac_printk(KERN_INFO, EDAC_PCI, |
417 | "Removed device %d for %s %s: DEV %s\n", | 417 | "Removed device %d for %s %s: DEV %s\n", |
418 | pci->pci_idx, pci->mod_name, pci->ctl_name, dev_name(pci)); | 418 | pci->pci_idx, pci->mod_name, pci->ctl_name, edac_dev_name(pci)); |
419 | 419 | ||
420 | return pci; | 420 | return pci; |
421 | } | 421 | } |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 591deda3f86..34b0d4f26b5 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1355,12 +1355,6 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
1355 | if (hwif->chipset != ide_dtc2278 || hwif->channel == 0) | 1355 | if (hwif->chipset != ide_dtc2278 || hwif->channel == 0) |
1356 | hwif->port_ops = d->port_ops; | 1356 | hwif->port_ops = d->port_ops; |
1357 | 1357 | ||
1358 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) || | ||
1359 | ((d->host_flags & IDE_HFLAG_SERIALIZE_DMA) && hwif->dma_base)) { | ||
1360 | if (hwif->mate) | ||
1361 | hwif->mate->serialized = hwif->serialized = 1; | ||
1362 | } | ||
1363 | |||
1364 | hwif->swdma_mask = d->swdma_mask; | 1358 | hwif->swdma_mask = d->swdma_mask; |
1365 | hwif->mwdma_mask = d->mwdma_mask; | 1359 | hwif->mwdma_mask = d->mwdma_mask; |
1366 | hwif->ultra_mask = d->udma_mask; | 1360 | hwif->ultra_mask = d->udma_mask; |
@@ -1382,6 +1376,12 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
1382 | hwif->dma_ops = d->dma_ops; | 1376 | hwif->dma_ops = d->dma_ops; |
1383 | } | 1377 | } |
1384 | 1378 | ||
1379 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) || | ||
1380 | ((d->host_flags & IDE_HFLAG_SERIALIZE_DMA) && hwif->dma_base)) { | ||
1381 | if (hwif->mate) | ||
1382 | hwif->mate->serialized = hwif->serialized = 1; | ||
1383 | } | ||
1384 | |||
1385 | if (d->host_flags & IDE_HFLAG_RQSIZE_256) | 1385 | if (d->host_flags & IDE_HFLAG_RQSIZE_256) |
1386 | hwif->rqsize = 256; | 1386 | hwif->rqsize = 256; |
1387 | 1387 | ||
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c index 83555ca513b..9e449a0c623 100644 --- a/drivers/ide/legacy/falconide.c +++ b/drivers/ide/legacy/falconide.c | |||
@@ -61,7 +61,7 @@ static void falconide_output_data(ide_drive_t *drive, struct request *rq, | |||
61 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 61 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
62 | 62 | ||
63 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) | 63 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) |
64 | return outsw(data_adr, buf, (len + 1) / 2); | 64 | return outsw(data_addr, buf, (len + 1) / 2); |
65 | 65 | ||
66 | outsw_swapw(data_addr, buf, (len + 1) / 2); | 66 | outsw_swapw(data_addr, buf, (len + 1) / 2); |
67 | } | 67 | } |
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index ed2ee4ba4b7..ebf9d3043f8 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.c +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c | |||
@@ -359,9 +359,10 @@ static void insert_recv_cqe(struct t3_wq *wq, struct t3_cq *cq) | |||
359 | cq->sw_wptr++; | 359 | cq->sw_wptr++; |
360 | } | 360 | } |
361 | 361 | ||
362 | void cxio_flush_rq(struct t3_wq *wq, struct t3_cq *cq, int count) | 362 | int cxio_flush_rq(struct t3_wq *wq, struct t3_cq *cq, int count) |
363 | { | 363 | { |
364 | u32 ptr; | 364 | u32 ptr; |
365 | int flushed = 0; | ||
365 | 366 | ||
366 | PDBG("%s wq %p cq %p\n", __func__, wq, cq); | 367 | PDBG("%s wq %p cq %p\n", __func__, wq, cq); |
367 | 368 | ||
@@ -369,8 +370,11 @@ void cxio_flush_rq(struct t3_wq *wq, struct t3_cq *cq, int count) | |||
369 | PDBG("%s rq_rptr %u rq_wptr %u skip count %u\n", __func__, | 370 | PDBG("%s rq_rptr %u rq_wptr %u skip count %u\n", __func__, |
370 | wq->rq_rptr, wq->rq_wptr, count); | 371 | wq->rq_rptr, wq->rq_wptr, count); |
371 | ptr = wq->rq_rptr + count; | 372 | ptr = wq->rq_rptr + count; |
372 | while (ptr++ != wq->rq_wptr) | 373 | while (ptr++ != wq->rq_wptr) { |
373 | insert_recv_cqe(wq, cq); | 374 | insert_recv_cqe(wq, cq); |
375 | flushed++; | ||
376 | } | ||
377 | return flushed; | ||
374 | } | 378 | } |
375 | 379 | ||
376 | static void insert_sq_cqe(struct t3_wq *wq, struct t3_cq *cq, | 380 | static void insert_sq_cqe(struct t3_wq *wq, struct t3_cq *cq, |
@@ -394,9 +398,10 @@ static void insert_sq_cqe(struct t3_wq *wq, struct t3_cq *cq, | |||
394 | cq->sw_wptr++; | 398 | cq->sw_wptr++; |
395 | } | 399 | } |
396 | 400 | ||
397 | void cxio_flush_sq(struct t3_wq *wq, struct t3_cq *cq, int count) | 401 | int cxio_flush_sq(struct t3_wq *wq, struct t3_cq *cq, int count) |
398 | { | 402 | { |
399 | __u32 ptr; | 403 | __u32 ptr; |
404 | int flushed = 0; | ||
400 | struct t3_swsq *sqp = wq->sq + Q_PTR2IDX(wq->sq_rptr, wq->sq_size_log2); | 405 | struct t3_swsq *sqp = wq->sq + Q_PTR2IDX(wq->sq_rptr, wq->sq_size_log2); |
401 | 406 | ||
402 | ptr = wq->sq_rptr + count; | 407 | ptr = wq->sq_rptr + count; |
@@ -405,7 +410,9 @@ void cxio_flush_sq(struct t3_wq *wq, struct t3_cq *cq, int count) | |||
405 | insert_sq_cqe(wq, cq, sqp); | 410 | insert_sq_cqe(wq, cq, sqp); |
406 | sqp++; | 411 | sqp++; |
407 | ptr++; | 412 | ptr++; |
413 | flushed++; | ||
408 | } | 414 | } |
415 | return flushed; | ||
409 | } | 416 | } |
410 | 417 | ||
411 | /* | 418 | /* |
@@ -581,7 +588,7 @@ static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p) | |||
581 | * caller aquires the ctrl_qp lock before the call | 588 | * caller aquires the ctrl_qp lock before the call |
582 | */ | 589 | */ |
583 | static int cxio_hal_ctrl_qp_write_mem(struct cxio_rdev *rdev_p, u32 addr, | 590 | static int cxio_hal_ctrl_qp_write_mem(struct cxio_rdev *rdev_p, u32 addr, |
584 | u32 len, void *data, int completion) | 591 | u32 len, void *data) |
585 | { | 592 | { |
586 | u32 i, nr_wqe, copy_len; | 593 | u32 i, nr_wqe, copy_len; |
587 | u8 *copy_data; | 594 | u8 *copy_data; |
@@ -617,7 +624,7 @@ static int cxio_hal_ctrl_qp_write_mem(struct cxio_rdev *rdev_p, u32 addr, | |||
617 | flag = 0; | 624 | flag = 0; |
618 | if (i == (nr_wqe - 1)) { | 625 | if (i == (nr_wqe - 1)) { |
619 | /* last WQE */ | 626 | /* last WQE */ |
620 | flag = completion ? T3_COMPLETION_FLAG : 0; | 627 | flag = T3_COMPLETION_FLAG; |
621 | if (len % 32) | 628 | if (len % 32) |
622 | utx_len = len / 32 + 1; | 629 | utx_len = len / 32 + 1; |
623 | else | 630 | else |
@@ -676,21 +683,20 @@ static int cxio_hal_ctrl_qp_write_mem(struct cxio_rdev *rdev_p, u32 addr, | |||
676 | return 0; | 683 | return 0; |
677 | } | 684 | } |
678 | 685 | ||
679 | /* IN: stag key, pdid, perm, zbva, to, len, page_size, pbl, and pbl_size | 686 | /* IN: stag key, pdid, perm, zbva, to, len, page_size, pbl_size and pbl_addr |
680 | * OUT: stag index, actual pbl_size, pbl_addr allocated. | 687 | * OUT: stag index |
681 | * TBD: shared memory region support | 688 | * TBD: shared memory region support |
682 | */ | 689 | */ |
683 | static int __cxio_tpt_op(struct cxio_rdev *rdev_p, u32 reset_tpt_entry, | 690 | static int __cxio_tpt_op(struct cxio_rdev *rdev_p, u32 reset_tpt_entry, |
684 | u32 *stag, u8 stag_state, u32 pdid, | 691 | u32 *stag, u8 stag_state, u32 pdid, |
685 | enum tpt_mem_type type, enum tpt_mem_perm perm, | 692 | enum tpt_mem_type type, enum tpt_mem_perm perm, |
686 | u32 zbva, u64 to, u32 len, u8 page_size, __be64 *pbl, | 693 | u32 zbva, u64 to, u32 len, u8 page_size, |
687 | u32 *pbl_size, u32 *pbl_addr) | 694 | u32 pbl_size, u32 pbl_addr) |
688 | { | 695 | { |
689 | int err; | 696 | int err; |
690 | struct tpt_entry tpt; | 697 | struct tpt_entry tpt; |
691 | u32 stag_idx; | 698 | u32 stag_idx; |
692 | u32 wptr; | 699 | u32 wptr; |
693 | int rereg = (*stag != T3_STAG_UNSET); | ||
694 | 700 | ||
695 | stag_state = stag_state > 0; | 701 | stag_state = stag_state > 0; |
696 | stag_idx = (*stag) >> 8; | 702 | stag_idx = (*stag) >> 8; |
@@ -704,30 +710,8 @@ static int __cxio_tpt_op(struct cxio_rdev *rdev_p, u32 reset_tpt_entry, | |||
704 | PDBG("%s stag_state 0x%0x type 0x%0x pdid 0x%0x, stag_idx 0x%x\n", | 710 | PDBG("%s stag_state 0x%0x type 0x%0x pdid 0x%0x, stag_idx 0x%x\n", |
705 | __func__, stag_state, type, pdid, stag_idx); | 711 | __func__, stag_state, type, pdid, stag_idx); |
706 | 712 | ||
707 | if (reset_tpt_entry) | ||
708 | cxio_hal_pblpool_free(rdev_p, *pbl_addr, *pbl_size << 3); | ||
709 | else if (!rereg) { | ||
710 | *pbl_addr = cxio_hal_pblpool_alloc(rdev_p, *pbl_size << 3); | ||
711 | if (!*pbl_addr) { | ||
712 | return -ENOMEM; | ||
713 | } | ||
714 | } | ||
715 | |||
716 | mutex_lock(&rdev_p->ctrl_qp.lock); | 713 | mutex_lock(&rdev_p->ctrl_qp.lock); |
717 | 714 | ||
718 | /* write PBL first if any - update pbl only if pbl list exist */ | ||
719 | if (pbl) { | ||
720 | |||
721 | PDBG("%s *pdb_addr 0x%x, pbl_base 0x%x, pbl_size %d\n", | ||
722 | __func__, *pbl_addr, rdev_p->rnic_info.pbl_base, | ||
723 | *pbl_size); | ||
724 | err = cxio_hal_ctrl_qp_write_mem(rdev_p, | ||
725 | (*pbl_addr >> 5), | ||
726 | (*pbl_size << 3), pbl, 0); | ||
727 | if (err) | ||
728 | goto ret; | ||
729 | } | ||
730 | |||
731 | /* write TPT entry */ | 715 | /* write TPT entry */ |
732 | if (reset_tpt_entry) | 716 | if (reset_tpt_entry) |
733 | memset(&tpt, 0, sizeof(tpt)); | 717 | memset(&tpt, 0, sizeof(tpt)); |
@@ -742,23 +726,23 @@ static int __cxio_tpt_op(struct cxio_rdev *rdev_p, u32 reset_tpt_entry, | |||
742 | V_TPT_ADDR_TYPE((zbva ? TPT_ZBTO : TPT_VATO)) | | 726 | V_TPT_ADDR_TYPE((zbva ? TPT_ZBTO : TPT_VATO)) | |
743 | V_TPT_PAGE_SIZE(page_size)); | 727 | V_TPT_PAGE_SIZE(page_size)); |
744 | tpt.rsvd_pbl_addr = reset_tpt_entry ? 0 : | 728 | tpt.rsvd_pbl_addr = reset_tpt_entry ? 0 : |
745 | cpu_to_be32(V_TPT_PBL_ADDR(PBL_OFF(rdev_p, *pbl_addr)>>3)); | 729 | cpu_to_be32(V_TPT_PBL_ADDR(PBL_OFF(rdev_p, pbl_addr)>>3)); |
746 | tpt.len = cpu_to_be32(len); | 730 | tpt.len = cpu_to_be32(len); |
747 | tpt.va_hi = cpu_to_be32((u32) (to >> 32)); | 731 | tpt.va_hi = cpu_to_be32((u32) (to >> 32)); |
748 | tpt.va_low_or_fbo = cpu_to_be32((u32) (to & 0xFFFFFFFFULL)); | 732 | tpt.va_low_or_fbo = cpu_to_be32((u32) (to & 0xFFFFFFFFULL)); |
749 | tpt.rsvd_bind_cnt_or_pstag = 0; | 733 | tpt.rsvd_bind_cnt_or_pstag = 0; |
750 | tpt.rsvd_pbl_size = reset_tpt_entry ? 0 : | 734 | tpt.rsvd_pbl_size = reset_tpt_entry ? 0 : |
751 | cpu_to_be32(V_TPT_PBL_SIZE((*pbl_size) >> 2)); | 735 | cpu_to_be32(V_TPT_PBL_SIZE(pbl_size >> 2)); |
752 | } | 736 | } |
753 | err = cxio_hal_ctrl_qp_write_mem(rdev_p, | 737 | err = cxio_hal_ctrl_qp_write_mem(rdev_p, |
754 | stag_idx + | 738 | stag_idx + |
755 | (rdev_p->rnic_info.tpt_base >> 5), | 739 | (rdev_p->rnic_info.tpt_base >> 5), |
756 | sizeof(tpt), &tpt, 1); | 740 | sizeof(tpt), &tpt); |
757 | 741 | ||
758 | /* release the stag index to free pool */ | 742 | /* release the stag index to free pool */ |
759 | if (reset_tpt_entry) | 743 | if (reset_tpt_entry) |
760 | cxio_hal_put_stag(rdev_p->rscp, stag_idx); | 744 | cxio_hal_put_stag(rdev_p->rscp, stag_idx); |
761 | ret: | 745 | |
762 | wptr = rdev_p->ctrl_qp.wptr; | 746 | wptr = rdev_p->ctrl_qp.wptr; |
763 | mutex_unlock(&rdev_p->ctrl_qp.lock); | 747 | mutex_unlock(&rdev_p->ctrl_qp.lock); |
764 | if (!err) | 748 | if (!err) |
@@ -769,44 +753,67 @@ ret: | |||
769 | return err; | 753 | return err; |
770 | } | 754 | } |
771 | 755 | ||
756 | int cxio_write_pbl(struct cxio_rdev *rdev_p, __be64 *pbl, | ||
757 | u32 pbl_addr, u32 pbl_size) | ||
758 | { | ||
759 | u32 wptr; | ||
760 | int err; | ||
761 | |||
762 | PDBG("%s *pdb_addr 0x%x, pbl_base 0x%x, pbl_size %d\n", | ||
763 | __func__, pbl_addr, rdev_p->rnic_info.pbl_base, | ||
764 | pbl_size); | ||
765 | |||
766 | mutex_lock(&rdev_p->ctrl_qp.lock); | ||
767 | err = cxio_hal_ctrl_qp_write_mem(rdev_p, pbl_addr >> 5, pbl_size << 3, | ||
768 | pbl); | ||
769 | wptr = rdev_p->ctrl_qp.wptr; | ||
770 | mutex_unlock(&rdev_p->ctrl_qp.lock); | ||
771 | if (err) | ||
772 | return err; | ||
773 | |||
774 | if (wait_event_interruptible(rdev_p->ctrl_qp.waitq, | ||
775 | SEQ32_GE(rdev_p->ctrl_qp.rptr, | ||
776 | wptr))) | ||
777 | return -ERESTARTSYS; | ||
778 | |||
779 | return 0; | ||
780 | } | ||
781 | |||
772 | int cxio_register_phys_mem(struct cxio_rdev *rdev_p, u32 *stag, u32 pdid, | 782 | int cxio_register_phys_mem(struct cxio_rdev *rdev_p, u32 *stag, u32 pdid, |
773 | enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len, | 783 | enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len, |
774 | u8 page_size, __be64 *pbl, u32 *pbl_size, | 784 | u8 page_size, u32 pbl_size, u32 pbl_addr) |
775 | u32 *pbl_addr) | ||
776 | { | 785 | { |
777 | *stag = T3_STAG_UNSET; | 786 | *stag = T3_STAG_UNSET; |
778 | return __cxio_tpt_op(rdev_p, 0, stag, 1, pdid, TPT_NON_SHARED_MR, perm, | 787 | return __cxio_tpt_op(rdev_p, 0, stag, 1, pdid, TPT_NON_SHARED_MR, perm, |
779 | zbva, to, len, page_size, pbl, pbl_size, pbl_addr); | 788 | zbva, to, len, page_size, pbl_size, pbl_addr); |
780 | } | 789 | } |
781 | 790 | ||
782 | int cxio_reregister_phys_mem(struct cxio_rdev *rdev_p, u32 *stag, u32 pdid, | 791 | int cxio_reregister_phys_mem(struct cxio_rdev *rdev_p, u32 *stag, u32 pdid, |
783 | enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len, | 792 | enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len, |
784 | u8 page_size, __be64 *pbl, u32 *pbl_size, | 793 | u8 page_size, u32 pbl_size, u32 pbl_addr) |
785 | u32 *pbl_addr) | ||
786 | { | 794 | { |
787 | return __cxio_tpt_op(rdev_p, 0, stag, 1, pdid, TPT_NON_SHARED_MR, perm, | 795 | return __cxio_tpt_op(rdev_p, 0, stag, 1, pdid, TPT_NON_SHARED_MR, perm, |
788 | zbva, to, len, page_size, pbl, pbl_size, pbl_addr); | 796 | zbva, to, len, page_size, pbl_size, pbl_addr); |
789 | } | 797 | } |
790 | 798 | ||
791 | int cxio_dereg_mem(struct cxio_rdev *rdev_p, u32 stag, u32 pbl_size, | 799 | int cxio_dereg_mem(struct cxio_rdev *rdev_p, u32 stag, u32 pbl_size, |
792 | u32 pbl_addr) | 800 | u32 pbl_addr) |
793 | { | 801 | { |
794 | return __cxio_tpt_op(rdev_p, 1, &stag, 0, 0, 0, 0, 0, 0ULL, 0, 0, NULL, | 802 | return __cxio_tpt_op(rdev_p, 1, &stag, 0, 0, 0, 0, 0, 0ULL, 0, 0, |
795 | &pbl_size, &pbl_addr); | 803 | pbl_size, pbl_addr); |
796 | } | 804 | } |
797 | 805 | ||
798 | int cxio_allocate_window(struct cxio_rdev *rdev_p, u32 * stag, u32 pdid) | 806 | int cxio_allocate_window(struct cxio_rdev *rdev_p, u32 * stag, u32 pdid) |
799 | { | 807 | { |
800 | u32 pbl_size = 0; | ||
801 | *stag = T3_STAG_UNSET; | 808 | *stag = T3_STAG_UNSET; |
802 | return __cxio_tpt_op(rdev_p, 0, stag, 0, pdid, TPT_MW, 0, 0, 0ULL, 0, 0, | 809 | return __cxio_tpt_op(rdev_p, 0, stag, 0, pdid, TPT_MW, 0, 0, 0ULL, 0, 0, |
803 | NULL, &pbl_size, NULL); | 810 | 0, 0); |
804 | } | 811 | } |
805 | 812 | ||
806 | int cxio_deallocate_window(struct cxio_rdev *rdev_p, u32 stag) | 813 | int cxio_deallocate_window(struct cxio_rdev *rdev_p, u32 stag) |
807 | { | 814 | { |
808 | return __cxio_tpt_op(rdev_p, 1, &stag, 0, 0, 0, 0, 0, 0ULL, 0, 0, NULL, | 815 | return __cxio_tpt_op(rdev_p, 1, &stag, 0, 0, 0, 0, 0, 0ULL, 0, 0, |
809 | NULL, NULL); | 816 | 0, 0); |
810 | } | 817 | } |
811 | 818 | ||
812 | int cxio_rdma_init(struct cxio_rdev *rdev_p, struct t3_rdma_init_attr *attr) | 819 | int cxio_rdma_init(struct cxio_rdev *rdev_p, struct t3_rdma_init_attr *attr) |
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.h b/drivers/infiniband/hw/cxgb3/cxio_hal.h index 2bcff7f5046..6e128f6bab0 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.h +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.h | |||
@@ -154,14 +154,14 @@ int cxio_create_qp(struct cxio_rdev *rdev, u32 kernel_domain, struct t3_wq *wq, | |||
154 | int cxio_destroy_qp(struct cxio_rdev *rdev, struct t3_wq *wq, | 154 | int cxio_destroy_qp(struct cxio_rdev *rdev, struct t3_wq *wq, |
155 | struct cxio_ucontext *uctx); | 155 | struct cxio_ucontext *uctx); |
156 | int cxio_peek_cq(struct t3_wq *wr, struct t3_cq *cq, int opcode); | 156 | int cxio_peek_cq(struct t3_wq *wr, struct t3_cq *cq, int opcode); |
157 | int cxio_write_pbl(struct cxio_rdev *rdev_p, __be64 *pbl, | ||
158 | u32 pbl_addr, u32 pbl_size); | ||
157 | int cxio_register_phys_mem(struct cxio_rdev *rdev, u32 * stag, u32 pdid, | 159 | int cxio_register_phys_mem(struct cxio_rdev *rdev, u32 * stag, u32 pdid, |
158 | enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len, | 160 | enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len, |
159 | u8 page_size, __be64 *pbl, u32 *pbl_size, | 161 | u8 page_size, u32 pbl_size, u32 pbl_addr); |
160 | u32 *pbl_addr); | ||
161 | int cxio_reregister_phys_mem(struct cxio_rdev *rdev, u32 * stag, u32 pdid, | 162 | int cxio_reregister_phys_mem(struct cxio_rdev *rdev, u32 * stag, u32 pdid, |
162 | enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len, | 163 | enum tpt_mem_perm perm, u32 zbva, u64 to, u32 len, |
163 | u8 page_size, __be64 *pbl, u32 *pbl_size, | 164 | u8 page_size, u32 pbl_size, u32 pbl_addr); |
164 | u32 *pbl_addr); | ||
165 | int cxio_dereg_mem(struct cxio_rdev *rdev, u32 stag, u32 pbl_size, | 165 | int cxio_dereg_mem(struct cxio_rdev *rdev, u32 stag, u32 pbl_size, |
166 | u32 pbl_addr); | 166 | u32 pbl_addr); |
167 | int cxio_allocate_window(struct cxio_rdev *rdev, u32 * stag, u32 pdid); | 167 | int cxio_allocate_window(struct cxio_rdev *rdev, u32 * stag, u32 pdid); |
@@ -173,8 +173,8 @@ u32 cxio_hal_get_pdid(struct cxio_hal_resource *rscp); | |||
173 | void cxio_hal_put_pdid(struct cxio_hal_resource *rscp, u32 pdid); | 173 | void cxio_hal_put_pdid(struct cxio_hal_resource *rscp, u32 pdid); |
174 | int __init cxio_hal_init(void); | 174 | int __init cxio_hal_init(void); |
175 | void __exit cxio_hal_exit(void); | 175 | void __exit cxio_hal_exit(void); |
176 | void cxio_flush_rq(struct t3_wq *wq, struct t3_cq *cq, int count); | 176 | int cxio_flush_rq(struct t3_wq *wq, struct t3_cq *cq, int count); |
177 | void cxio_flush_sq(struct t3_wq *wq, struct t3_cq *cq, int count); | 177 | int cxio_flush_sq(struct t3_wq *wq, struct t3_cq *cq, int count); |
178 | void cxio_count_rcqes(struct t3_cq *cq, struct t3_wq *wq, int *count); | 178 | void cxio_count_rcqes(struct t3_cq *cq, struct t3_wq *wq, int *count); |
179 | void cxio_count_scqes(struct t3_cq *cq, struct t3_wq *wq, int *count); | 179 | void cxio_count_scqes(struct t3_cq *cq, struct t3_wq *wq, int *count); |
180 | void cxio_flush_hw_cq(struct t3_cq *cq); | 180 | void cxio_flush_hw_cq(struct t3_cq *cq); |
diff --git a/drivers/infiniband/hw/cxgb3/cxio_resource.c b/drivers/infiniband/hw/cxgb3/cxio_resource.c index 45ed4f25ef7..bd233c08765 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_resource.c +++ b/drivers/infiniband/hw/cxgb3/cxio_resource.c | |||
@@ -250,7 +250,6 @@ void cxio_hal_destroy_resource(struct cxio_hal_resource *rscp) | |||
250 | */ | 250 | */ |
251 | 251 | ||
252 | #define MIN_PBL_SHIFT 8 /* 256B == min PBL size (32 entries) */ | 252 | #define MIN_PBL_SHIFT 8 /* 256B == min PBL size (32 entries) */ |
253 | #define PBL_CHUNK 2*1024*1024 | ||
254 | 253 | ||
255 | u32 cxio_hal_pblpool_alloc(struct cxio_rdev *rdev_p, int size) | 254 | u32 cxio_hal_pblpool_alloc(struct cxio_rdev *rdev_p, int size) |
256 | { | 255 | { |
@@ -267,14 +266,35 @@ void cxio_hal_pblpool_free(struct cxio_rdev *rdev_p, u32 addr, int size) | |||
267 | 266 | ||
268 | int cxio_hal_pblpool_create(struct cxio_rdev *rdev_p) | 267 | int cxio_hal_pblpool_create(struct cxio_rdev *rdev_p) |
269 | { | 268 | { |
270 | unsigned long i; | 269 | unsigned pbl_start, pbl_chunk; |
270 | |||
271 | rdev_p->pbl_pool = gen_pool_create(MIN_PBL_SHIFT, -1); | 271 | rdev_p->pbl_pool = gen_pool_create(MIN_PBL_SHIFT, -1); |
272 | if (rdev_p->pbl_pool) | 272 | if (!rdev_p->pbl_pool) |
273 | for (i = rdev_p->rnic_info.pbl_base; | 273 | return -ENOMEM; |
274 | i <= rdev_p->rnic_info.pbl_top - PBL_CHUNK + 1; | 274 | |
275 | i += PBL_CHUNK) | 275 | pbl_start = rdev_p->rnic_info.pbl_base; |
276 | gen_pool_add(rdev_p->pbl_pool, i, PBL_CHUNK, -1); | 276 | pbl_chunk = rdev_p->rnic_info.pbl_top - pbl_start + 1; |
277 | return rdev_p->pbl_pool ? 0 : -ENOMEM; | 277 | |
278 | while (pbl_start < rdev_p->rnic_info.pbl_top) { | ||
279 | pbl_chunk = min(rdev_p->rnic_info.pbl_top - pbl_start + 1, | ||
280 | pbl_chunk); | ||
281 | if (gen_pool_add(rdev_p->pbl_pool, pbl_start, pbl_chunk, -1)) { | ||
282 | PDBG("%s failed to add PBL chunk (%x/%x)\n", | ||
283 | __func__, pbl_start, pbl_chunk); | ||
284 | if (pbl_chunk <= 1024 << MIN_PBL_SHIFT) { | ||
285 | printk(KERN_WARNING MOD "%s: Failed to add all PBL chunks (%x/%x)\n", | ||
286 | __func__, pbl_start, rdev_p->rnic_info.pbl_top - pbl_start); | ||
287 | return 0; | ||
288 | } | ||
289 | pbl_chunk >>= 1; | ||
290 | } else { | ||
291 | PDBG("%s added PBL chunk (%x/%x)\n", | ||
292 | __func__, pbl_start, pbl_chunk); | ||
293 | pbl_start += pbl_chunk; | ||
294 | } | ||
295 | } | ||
296 | |||
297 | return 0; | ||
278 | } | 298 | } |
279 | 299 | ||
280 | void cxio_hal_pblpool_destroy(struct cxio_rdev *rdev_p) | 300 | void cxio_hal_pblpool_destroy(struct cxio_rdev *rdev_p) |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index d44a6df9ad8..c325c44807e 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
@@ -67,10 +67,10 @@ int peer2peer = 0; | |||
67 | module_param(peer2peer, int, 0644); | 67 | module_param(peer2peer, int, 0644); |
68 | MODULE_PARM_DESC(peer2peer, "Support peer2peer ULPs (default=0)"); | 68 | MODULE_PARM_DESC(peer2peer, "Support peer2peer ULPs (default=0)"); |
69 | 69 | ||
70 | static int ep_timeout_secs = 10; | 70 | static int ep_timeout_secs = 60; |
71 | module_param(ep_timeout_secs, int, 0644); | 71 | module_param(ep_timeout_secs, int, 0644); |
72 | MODULE_PARM_DESC(ep_timeout_secs, "CM Endpoint operation timeout " | 72 | MODULE_PARM_DESC(ep_timeout_secs, "CM Endpoint operation timeout " |
73 | "in seconds (default=10)"); | 73 | "in seconds (default=60)"); |
74 | 74 | ||
75 | static int mpa_rev = 1; | 75 | static int mpa_rev = 1; |
76 | module_param(mpa_rev, int, 0644); | 76 | module_param(mpa_rev, int, 0644); |
@@ -1650,8 +1650,8 @@ static int close_con_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
1650 | release = 1; | 1650 | release = 1; |
1651 | break; | 1651 | break; |
1652 | case ABORTING: | 1652 | case ABORTING: |
1653 | break; | ||
1654 | case DEAD: | 1653 | case DEAD: |
1654 | break; | ||
1655 | default: | 1655 | default: |
1656 | BUG_ON(1); | 1656 | BUG_ON(1); |
1657 | break; | 1657 | break; |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_mem.c b/drivers/infiniband/hw/cxgb3/iwch_mem.c index 58c3d61bcd1..ec49a5cbdeb 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_mem.c +++ b/drivers/infiniband/hw/cxgb3/iwch_mem.c | |||
@@ -35,17 +35,26 @@ | |||
35 | #include <rdma/ib_verbs.h> | 35 | #include <rdma/ib_verbs.h> |
36 | 36 | ||
37 | #include "cxio_hal.h" | 37 | #include "cxio_hal.h" |
38 | #include "cxio_resource.h" | ||
38 | #include "iwch.h" | 39 | #include "iwch.h" |
39 | #include "iwch_provider.h" | 40 | #include "iwch_provider.h" |
40 | 41 | ||
41 | int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php, | 42 | static void iwch_finish_mem_reg(struct iwch_mr *mhp, u32 stag) |
42 | struct iwch_mr *mhp, | ||
43 | int shift, | ||
44 | __be64 *page_list) | ||
45 | { | 43 | { |
46 | u32 stag; | ||
47 | u32 mmid; | 44 | u32 mmid; |
48 | 45 | ||
46 | mhp->attr.state = 1; | ||
47 | mhp->attr.stag = stag; | ||
48 | mmid = stag >> 8; | ||
49 | mhp->ibmr.rkey = mhp->ibmr.lkey = stag; | ||
50 | insert_handle(mhp->rhp, &mhp->rhp->mmidr, mhp, mmid); | ||
51 | PDBG("%s mmid 0x%x mhp %p\n", __func__, mmid, mhp); | ||
52 | } | ||
53 | |||
54 | int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php, | ||
55 | struct iwch_mr *mhp, int shift) | ||
56 | { | ||
57 | u32 stag; | ||
49 | 58 | ||
50 | if (cxio_register_phys_mem(&rhp->rdev, | 59 | if (cxio_register_phys_mem(&rhp->rdev, |
51 | &stag, mhp->attr.pdid, | 60 | &stag, mhp->attr.pdid, |
@@ -53,28 +62,21 @@ int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php, | |||
53 | mhp->attr.zbva, | 62 | mhp->attr.zbva, |
54 | mhp->attr.va_fbo, | 63 | mhp->attr.va_fbo, |
55 | mhp->attr.len, | 64 | mhp->attr.len, |
56 | shift-12, | 65 | shift - 12, |
57 | page_list, | 66 | mhp->attr.pbl_size, mhp->attr.pbl_addr)) |
58 | &mhp->attr.pbl_size, &mhp->attr.pbl_addr)) | ||
59 | return -ENOMEM; | 67 | return -ENOMEM; |
60 | mhp->attr.state = 1; | 68 | |
61 | mhp->attr.stag = stag; | 69 | iwch_finish_mem_reg(mhp, stag); |
62 | mmid = stag >> 8; | 70 | |
63 | mhp->ibmr.rkey = mhp->ibmr.lkey = stag; | ||
64 | insert_handle(rhp, &rhp->mmidr, mhp, mmid); | ||
65 | PDBG("%s mmid 0x%x mhp %p\n", __func__, mmid, mhp); | ||
66 | return 0; | 71 | return 0; |
67 | } | 72 | } |
68 | 73 | ||
69 | int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php, | 74 | int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php, |
70 | struct iwch_mr *mhp, | 75 | struct iwch_mr *mhp, |
71 | int shift, | 76 | int shift, |
72 | __be64 *page_list, | ||
73 | int npages) | 77 | int npages) |
74 | { | 78 | { |
75 | u32 stag; | 79 | u32 stag; |
76 | u32 mmid; | ||
77 | |||
78 | 80 | ||
79 | /* We could support this... */ | 81 | /* We could support this... */ |
80 | if (npages > mhp->attr.pbl_size) | 82 | if (npages > mhp->attr.pbl_size) |
@@ -87,19 +89,40 @@ int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php, | |||
87 | mhp->attr.zbva, | 89 | mhp->attr.zbva, |
88 | mhp->attr.va_fbo, | 90 | mhp->attr.va_fbo, |
89 | mhp->attr.len, | 91 | mhp->attr.len, |
90 | shift-12, | 92 | shift - 12, |
91 | page_list, | 93 | mhp->attr.pbl_size, mhp->attr.pbl_addr)) |
92 | &mhp->attr.pbl_size, &mhp->attr.pbl_addr)) | ||
93 | return -ENOMEM; | 94 | return -ENOMEM; |
94 | mhp->attr.state = 1; | 95 | |
95 | mhp->attr.stag = stag; | 96 | iwch_finish_mem_reg(mhp, stag); |
96 | mmid = stag >> 8; | 97 | |
97 | mhp->ibmr.rkey = mhp->ibmr.lkey = stag; | 98 | return 0; |
98 | insert_handle(rhp, &rhp->mmidr, mhp, mmid); | 99 | } |
99 | PDBG("%s mmid 0x%x mhp %p\n", __func__, mmid, mhp); | 100 | |
101 | int iwch_alloc_pbl(struct iwch_mr *mhp, int npages) | ||
102 | { | ||
103 | mhp->attr.pbl_addr = cxio_hal_pblpool_alloc(&mhp->rhp->rdev, | ||
104 | npages << 3); | ||
105 | |||
106 | if (!mhp->attr.pbl_addr) | ||
107 | return -ENOMEM; | ||
108 | |||
109 | mhp->attr.pbl_size = npages; | ||
110 | |||
100 | return 0; | 111 | return 0; |
101 | } | 112 | } |
102 | 113 | ||
114 | void iwch_free_pbl(struct iwch_mr *mhp) | ||
115 | { | ||
116 | cxio_hal_pblpool_free(&mhp->rhp->rdev, mhp->attr.pbl_addr, | ||
117 | mhp->attr.pbl_size << 3); | ||
118 | } | ||
119 | |||
120 | int iwch_write_pbl(struct iwch_mr *mhp, __be64 *pages, int npages, int offset) | ||
121 | { | ||
122 | return cxio_write_pbl(&mhp->rhp->rdev, pages, | ||
123 | mhp->attr.pbl_addr + (offset << 3), npages); | ||
124 | } | ||
125 | |||
103 | int build_phys_page_list(struct ib_phys_buf *buffer_list, | 126 | int build_phys_page_list(struct ib_phys_buf *buffer_list, |
104 | int num_phys_buf, | 127 | int num_phys_buf, |
105 | u64 *iova_start, | 128 | u64 *iova_start, |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index d07d3a377b5..8934178a23e 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -442,6 +442,7 @@ static int iwch_dereg_mr(struct ib_mr *ib_mr) | |||
442 | mmid = mhp->attr.stag >> 8; | 442 | mmid = mhp->attr.stag >> 8; |
443 | cxio_dereg_mem(&rhp->rdev, mhp->attr.stag, mhp->attr.pbl_size, | 443 | cxio_dereg_mem(&rhp->rdev, mhp->attr.stag, mhp->attr.pbl_size, |
444 | mhp->attr.pbl_addr); | 444 | mhp->attr.pbl_addr); |
445 | iwch_free_pbl(mhp); | ||
445 | remove_handle(rhp, &rhp->mmidr, mmid); | 446 | remove_handle(rhp, &rhp->mmidr, mmid); |
446 | if (mhp->kva) | 447 | if (mhp->kva) |
447 | kfree((void *) (unsigned long) mhp->kva); | 448 | kfree((void *) (unsigned long) mhp->kva); |
@@ -475,6 +476,8 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd, | |||
475 | if (!mhp) | 476 | if (!mhp) |
476 | return ERR_PTR(-ENOMEM); | 477 | return ERR_PTR(-ENOMEM); |
477 | 478 | ||
479 | mhp->rhp = rhp; | ||
480 | |||
478 | /* First check that we have enough alignment */ | 481 | /* First check that we have enough alignment */ |
479 | if ((*iova_start & ~PAGE_MASK) != (buffer_list[0].addr & ~PAGE_MASK)) { | 482 | if ((*iova_start & ~PAGE_MASK) != (buffer_list[0].addr & ~PAGE_MASK)) { |
480 | ret = -EINVAL; | 483 | ret = -EINVAL; |
@@ -492,7 +495,17 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd, | |||
492 | if (ret) | 495 | if (ret) |
493 | goto err; | 496 | goto err; |
494 | 497 | ||
495 | mhp->rhp = rhp; | 498 | ret = iwch_alloc_pbl(mhp, npages); |
499 | if (ret) { | ||
500 | kfree(page_list); | ||
501 | goto err_pbl; | ||
502 | } | ||
503 | |||
504 | ret = iwch_write_pbl(mhp, page_list, npages, 0); | ||
505 | kfree(page_list); | ||
506 | if (ret) | ||
507 | goto err_pbl; | ||
508 | |||
496 | mhp->attr.pdid = php->pdid; | 509 | mhp->attr.pdid = php->pdid; |
497 | mhp->attr.zbva = 0; | 510 | mhp->attr.zbva = 0; |
498 | 511 | ||
@@ -502,12 +515,15 @@ static struct ib_mr *iwch_register_phys_mem(struct ib_pd *pd, | |||
502 | 515 | ||
503 | mhp->attr.len = (u32) total_size; | 516 | mhp->attr.len = (u32) total_size; |
504 | mhp->attr.pbl_size = npages; | 517 | mhp->attr.pbl_size = npages; |
505 | ret = iwch_register_mem(rhp, php, mhp, shift, page_list); | 518 | ret = iwch_register_mem(rhp, php, mhp, shift); |
506 | kfree(page_list); | 519 | if (ret) |
507 | if (ret) { | 520 | goto err_pbl; |
508 | goto err; | 521 | |
509 | } | ||
510 | return &mhp->ibmr; | 522 | return &mhp->ibmr; |
523 | |||
524 | err_pbl: | ||
525 | iwch_free_pbl(mhp); | ||
526 | |||
511 | err: | 527 | err: |
512 | kfree(mhp); | 528 | kfree(mhp); |
513 | return ERR_PTR(ret); | 529 | return ERR_PTR(ret); |
@@ -560,7 +576,7 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr, | |||
560 | return ret; | 576 | return ret; |
561 | } | 577 | } |
562 | 578 | ||
563 | ret = iwch_reregister_mem(rhp, php, &mh, shift, page_list, npages); | 579 | ret = iwch_reregister_mem(rhp, php, &mh, shift, npages); |
564 | kfree(page_list); | 580 | kfree(page_list); |
565 | if (ret) { | 581 | if (ret) { |
566 | return ret; | 582 | return ret; |
@@ -602,6 +618,8 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, | |||
602 | if (!mhp) | 618 | if (!mhp) |
603 | return ERR_PTR(-ENOMEM); | 619 | return ERR_PTR(-ENOMEM); |
604 | 620 | ||
621 | mhp->rhp = rhp; | ||
622 | |||
605 | mhp->umem = ib_umem_get(pd->uobject->context, start, length, acc, 0); | 623 | mhp->umem = ib_umem_get(pd->uobject->context, start, length, acc, 0); |
606 | if (IS_ERR(mhp->umem)) { | 624 | if (IS_ERR(mhp->umem)) { |
607 | err = PTR_ERR(mhp->umem); | 625 | err = PTR_ERR(mhp->umem); |
@@ -615,10 +633,14 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, | |||
615 | list_for_each_entry(chunk, &mhp->umem->chunk_list, list) | 633 | list_for_each_entry(chunk, &mhp->umem->chunk_list, list) |
616 | n += chunk->nents; | 634 | n += chunk->nents; |
617 | 635 | ||
618 | pages = kmalloc(n * sizeof(u64), GFP_KERNEL); | 636 | err = iwch_alloc_pbl(mhp, n); |
637 | if (err) | ||
638 | goto err; | ||
639 | |||
640 | pages = (__be64 *) __get_free_page(GFP_KERNEL); | ||
619 | if (!pages) { | 641 | if (!pages) { |
620 | err = -ENOMEM; | 642 | err = -ENOMEM; |
621 | goto err; | 643 | goto err_pbl; |
622 | } | 644 | } |
623 | 645 | ||
624 | i = n = 0; | 646 | i = n = 0; |
@@ -630,25 +652,38 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, | |||
630 | pages[i++] = cpu_to_be64(sg_dma_address( | 652 | pages[i++] = cpu_to_be64(sg_dma_address( |
631 | &chunk->page_list[j]) + | 653 | &chunk->page_list[j]) + |
632 | mhp->umem->page_size * k); | 654 | mhp->umem->page_size * k); |
655 | if (i == PAGE_SIZE / sizeof *pages) { | ||
656 | err = iwch_write_pbl(mhp, pages, i, n); | ||
657 | if (err) | ||
658 | goto pbl_done; | ||
659 | n += i; | ||
660 | i = 0; | ||
661 | } | ||
633 | } | 662 | } |
634 | } | 663 | } |
635 | 664 | ||
636 | mhp->rhp = rhp; | 665 | if (i) |
666 | err = iwch_write_pbl(mhp, pages, i, n); | ||
667 | |||
668 | pbl_done: | ||
669 | free_page((unsigned long) pages); | ||
670 | if (err) | ||
671 | goto err_pbl; | ||
672 | |||
637 | mhp->attr.pdid = php->pdid; | 673 | mhp->attr.pdid = php->pdid; |
638 | mhp->attr.zbva = 0; | 674 | mhp->attr.zbva = 0; |
639 | mhp->attr.perms = iwch_ib_to_tpt_access(acc); | 675 | mhp->attr.perms = iwch_ib_to_tpt_access(acc); |
640 | mhp->attr.va_fbo = virt; | 676 | mhp->attr.va_fbo = virt; |
641 | mhp->attr.page_size = shift - 12; | 677 | mhp->attr.page_size = shift - 12; |
642 | mhp->attr.len = (u32) length; | 678 | mhp->attr.len = (u32) length; |
643 | mhp->attr.pbl_size = i; | 679 | |
644 | err = iwch_register_mem(rhp, php, mhp, shift, pages); | 680 | err = iwch_register_mem(rhp, php, mhp, shift); |
645 | kfree(pages); | ||
646 | if (err) | 681 | if (err) |
647 | goto err; | 682 | goto err_pbl; |
648 | 683 | ||
649 | if (udata && !t3a_device(rhp)) { | 684 | if (udata && !t3a_device(rhp)) { |
650 | uresp.pbl_addr = (mhp->attr.pbl_addr - | 685 | uresp.pbl_addr = (mhp->attr.pbl_addr - |
651 | rhp->rdev.rnic_info.pbl_base) >> 3; | 686 | rhp->rdev.rnic_info.pbl_base) >> 3; |
652 | PDBG("%s user resp pbl_addr 0x%x\n", __func__, | 687 | PDBG("%s user resp pbl_addr 0x%x\n", __func__, |
653 | uresp.pbl_addr); | 688 | uresp.pbl_addr); |
654 | 689 | ||
@@ -661,6 +696,9 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, | |||
661 | 696 | ||
662 | return &mhp->ibmr; | 697 | return &mhp->ibmr; |
663 | 698 | ||
699 | err_pbl: | ||
700 | iwch_free_pbl(mhp); | ||
701 | |||
664 | err: | 702 | err: |
665 | ib_umem_release(mhp->umem); | 703 | ib_umem_release(mhp->umem); |
666 | kfree(mhp); | 704 | kfree(mhp); |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.h b/drivers/infiniband/hw/cxgb3/iwch_provider.h index db5100d27ca..836163fc542 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.h +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.h | |||
@@ -340,14 +340,14 @@ int iwch_quiesce_qps(struct iwch_cq *chp); | |||
340 | int iwch_resume_qps(struct iwch_cq *chp); | 340 | int iwch_resume_qps(struct iwch_cq *chp); |
341 | void stop_read_rep_timer(struct iwch_qp *qhp); | 341 | void stop_read_rep_timer(struct iwch_qp *qhp); |
342 | int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php, | 342 | int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php, |
343 | struct iwch_mr *mhp, | 343 | struct iwch_mr *mhp, int shift); |
344 | int shift, | ||
345 | __be64 *page_list); | ||
346 | int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php, | 344 | int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php, |
347 | struct iwch_mr *mhp, | 345 | struct iwch_mr *mhp, |
348 | int shift, | 346 | int shift, |
349 | __be64 *page_list, | ||
350 | int npages); | 347 | int npages); |
348 | int iwch_alloc_pbl(struct iwch_mr *mhp, int npages); | ||
349 | void iwch_free_pbl(struct iwch_mr *mhp); | ||
350 | int iwch_write_pbl(struct iwch_mr *mhp, __be64 *pages, int npages, int offset); | ||
351 | int build_phys_page_list(struct ib_phys_buf *buffer_list, | 351 | int build_phys_page_list(struct ib_phys_buf *buffer_list, |
352 | int num_phys_buf, | 352 | int num_phys_buf, |
353 | u64 *iova_start, | 353 | u64 *iova_start, |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c index 9b4be889c58..79dbe5beae5 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_qp.c +++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c | |||
@@ -655,6 +655,7 @@ static void __flush_qp(struct iwch_qp *qhp, unsigned long *flag) | |||
655 | { | 655 | { |
656 | struct iwch_cq *rchp, *schp; | 656 | struct iwch_cq *rchp, *schp; |
657 | int count; | 657 | int count; |
658 | int flushed; | ||
658 | 659 | ||
659 | rchp = get_chp(qhp->rhp, qhp->attr.rcq); | 660 | rchp = get_chp(qhp->rhp, qhp->attr.rcq); |
660 | schp = get_chp(qhp->rhp, qhp->attr.scq); | 661 | schp = get_chp(qhp->rhp, qhp->attr.scq); |
@@ -669,20 +670,22 @@ static void __flush_qp(struct iwch_qp *qhp, unsigned long *flag) | |||
669 | spin_lock(&qhp->lock); | 670 | spin_lock(&qhp->lock); |
670 | cxio_flush_hw_cq(&rchp->cq); | 671 | cxio_flush_hw_cq(&rchp->cq); |
671 | cxio_count_rcqes(&rchp->cq, &qhp->wq, &count); | 672 | cxio_count_rcqes(&rchp->cq, &qhp->wq, &count); |
672 | cxio_flush_rq(&qhp->wq, &rchp->cq, count); | 673 | flushed = cxio_flush_rq(&qhp->wq, &rchp->cq, count); |
673 | spin_unlock(&qhp->lock); | 674 | spin_unlock(&qhp->lock); |
674 | spin_unlock_irqrestore(&rchp->lock, *flag); | 675 | spin_unlock_irqrestore(&rchp->lock, *flag); |
675 | (*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context); | 676 | if (flushed) |
677 | (*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context); | ||
676 | 678 | ||
677 | /* locking heirarchy: cq lock first, then qp lock. */ | 679 | /* locking heirarchy: cq lock first, then qp lock. */ |
678 | spin_lock_irqsave(&schp->lock, *flag); | 680 | spin_lock_irqsave(&schp->lock, *flag); |
679 | spin_lock(&qhp->lock); | 681 | spin_lock(&qhp->lock); |
680 | cxio_flush_hw_cq(&schp->cq); | 682 | cxio_flush_hw_cq(&schp->cq); |
681 | cxio_count_scqes(&schp->cq, &qhp->wq, &count); | 683 | cxio_count_scqes(&schp->cq, &qhp->wq, &count); |
682 | cxio_flush_sq(&qhp->wq, &schp->cq, count); | 684 | flushed = cxio_flush_sq(&qhp->wq, &schp->cq, count); |
683 | spin_unlock(&qhp->lock); | 685 | spin_unlock(&qhp->lock); |
684 | spin_unlock_irqrestore(&schp->lock, *flag); | 686 | spin_unlock_irqrestore(&schp->lock, *flag); |
685 | (*schp->ibcq.comp_handler)(&schp->ibcq, schp->ibcq.cq_context); | 687 | if (flushed) |
688 | (*schp->ibcq.comp_handler)(&schp->ibcq, schp->ibcq.cq_context); | ||
686 | 689 | ||
687 | /* deref */ | 690 | /* deref */ |
688 | if (atomic_dec_and_test(&qhp->refcnt)) | 691 | if (atomic_dec_and_test(&qhp->refcnt)) |
@@ -880,7 +883,6 @@ int iwch_modify_qp(struct iwch_dev *rhp, struct iwch_qp *qhp, | |||
880 | ep = qhp->ep; | 883 | ep = qhp->ep; |
881 | get_ep(&ep->com); | 884 | get_ep(&ep->com); |
882 | } | 885 | } |
883 | flush_qp(qhp, &flag); | ||
884 | break; | 886 | break; |
885 | case IWCH_QP_STATE_TERMINATE: | 887 | case IWCH_QP_STATE_TERMINATE: |
886 | qhp->attr.state = IWCH_QP_STATE_TERMINATE; | 888 | qhp->attr.state = IWCH_QP_STATE_TERMINATE; |
@@ -911,6 +913,7 @@ int iwch_modify_qp(struct iwch_dev *rhp, struct iwch_qp *qhp, | |||
911 | } | 913 | } |
912 | switch (attrs->next_state) { | 914 | switch (attrs->next_state) { |
913 | case IWCH_QP_STATE_IDLE: | 915 | case IWCH_QP_STATE_IDLE: |
916 | flush_qp(qhp, &flag); | ||
914 | qhp->attr.state = IWCH_QP_STATE_IDLE; | 917 | qhp->attr.state = IWCH_QP_STATE_IDLE; |
915 | qhp->attr.llp_stream_handle = NULL; | 918 | qhp->attr.llp_stream_handle = NULL; |
916 | put_ep(&qhp->ep->com); | 919 | put_ep(&qhp->ep->com); |
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 00bab60f6de..1e9e99a1393 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -192,6 +192,8 @@ struct ehca_qp { | |||
192 | int mtu_shift; | 192 | int mtu_shift; |
193 | u32 message_count; | 193 | u32 message_count; |
194 | u32 packet_count; | 194 | u32 packet_count; |
195 | atomic_t nr_events; /* events seen */ | ||
196 | wait_queue_head_t wait_completion; | ||
195 | }; | 197 | }; |
196 | 198 | ||
197 | #define IS_SRQ(qp) (qp->ext_type == EQPT_SRQ) | 199 | #define IS_SRQ(qp) (qp->ext_type == EQPT_SRQ) |
diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c index 2515cbde7e6..bc3b37d2070 100644 --- a/drivers/infiniband/hw/ehca/ehca_hca.c +++ b/drivers/infiniband/hw/ehca/ehca_hca.c | |||
@@ -101,7 +101,6 @@ int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props) | |||
101 | props->max_ee = limit_uint(rblock->max_rd_ee_context); | 101 | props->max_ee = limit_uint(rblock->max_rd_ee_context); |
102 | props->max_rdd = limit_uint(rblock->max_rd_domain); | 102 | props->max_rdd = limit_uint(rblock->max_rd_domain); |
103 | props->max_fmr = limit_uint(rblock->max_mr); | 103 | props->max_fmr = limit_uint(rblock->max_mr); |
104 | props->local_ca_ack_delay = limit_uint(rblock->local_ca_ack_delay); | ||
105 | props->max_qp_rd_atom = limit_uint(rblock->max_rr_qp); | 104 | props->max_qp_rd_atom = limit_uint(rblock->max_rr_qp); |
106 | props->max_ee_rd_atom = limit_uint(rblock->max_rr_ee_context); | 105 | props->max_ee_rd_atom = limit_uint(rblock->max_rr_ee_context); |
107 | props->max_res_rd_atom = limit_uint(rblock->max_rr_hca); | 106 | props->max_res_rd_atom = limit_uint(rblock->max_rr_hca); |
@@ -115,7 +114,7 @@ int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props) | |||
115 | } | 114 | } |
116 | 115 | ||
117 | props->max_pkeys = 16; | 116 | props->max_pkeys = 16; |
118 | props->local_ca_ack_delay = limit_uint(rblock->local_ca_ack_delay); | 117 | props->local_ca_ack_delay = min_t(u8, rblock->local_ca_ack_delay, 255); |
119 | props->max_raw_ipv6_qp = limit_uint(rblock->max_raw_ipv6_qp); | 118 | props->max_raw_ipv6_qp = limit_uint(rblock->max_raw_ipv6_qp); |
120 | props->max_raw_ethy_qp = limit_uint(rblock->max_raw_ethy_qp); | 119 | props->max_raw_ethy_qp = limit_uint(rblock->max_raw_ethy_qp); |
121 | props->max_mcast_grp = limit_uint(rblock->max_mcast_grp); | 120 | props->max_mcast_grp = limit_uint(rblock->max_mcast_grp); |
@@ -136,7 +135,7 @@ query_device1: | |||
136 | return ret; | 135 | return ret; |
137 | } | 136 | } |
138 | 137 | ||
139 | static int map_mtu(struct ehca_shca *shca, u32 fw_mtu) | 138 | static enum ib_mtu map_mtu(struct ehca_shca *shca, u32 fw_mtu) |
140 | { | 139 | { |
141 | switch (fw_mtu) { | 140 | switch (fw_mtu) { |
142 | case 0x1: | 141 | case 0x1: |
@@ -156,7 +155,7 @@ static int map_mtu(struct ehca_shca *shca, u32 fw_mtu) | |||
156 | } | 155 | } |
157 | } | 156 | } |
158 | 157 | ||
159 | static int map_number_of_vls(struct ehca_shca *shca, u32 vl_cap) | 158 | static u8 map_number_of_vls(struct ehca_shca *shca, u32 vl_cap) |
160 | { | 159 | { |
161 | switch (vl_cap) { | 160 | switch (vl_cap) { |
162 | case 0x1: | 161 | case 0x1: |
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c index ca5eb0cb628..ce1ab0571be 100644 --- a/drivers/infiniband/hw/ehca/ehca_irq.c +++ b/drivers/infiniband/hw/ehca/ehca_irq.c | |||
@@ -204,6 +204,8 @@ static void qp_event_callback(struct ehca_shca *shca, u64 eqe, | |||
204 | 204 | ||
205 | read_lock(&ehca_qp_idr_lock); | 205 | read_lock(&ehca_qp_idr_lock); |
206 | qp = idr_find(&ehca_qp_idr, token); | 206 | qp = idr_find(&ehca_qp_idr, token); |
207 | if (qp) | ||
208 | atomic_inc(&qp->nr_events); | ||
207 | read_unlock(&ehca_qp_idr_lock); | 209 | read_unlock(&ehca_qp_idr_lock); |
208 | 210 | ||
209 | if (!qp) | 211 | if (!qp) |
@@ -223,6 +225,8 @@ static void qp_event_callback(struct ehca_shca *shca, u64 eqe, | |||
223 | if (fatal && qp->ext_type == EQPT_SRQBASE) | 225 | if (fatal && qp->ext_type == EQPT_SRQBASE) |
224 | dispatch_qp_event(shca, qp, IB_EVENT_QP_LAST_WQE_REACHED); | 226 | dispatch_qp_event(shca, qp, IB_EVENT_QP_LAST_WQE_REACHED); |
225 | 227 | ||
228 | if (atomic_dec_and_test(&qp->nr_events)) | ||
229 | wake_up(&qp->wait_completion); | ||
226 | return; | 230 | return; |
227 | } | 231 | } |
228 | 232 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index 18fba92fa7a..3f59587338e 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -566,6 +566,8 @@ static struct ehca_qp *internal_create_qp( | |||
566 | return ERR_PTR(-ENOMEM); | 566 | return ERR_PTR(-ENOMEM); |
567 | } | 567 | } |
568 | 568 | ||
569 | atomic_set(&my_qp->nr_events, 0); | ||
570 | init_waitqueue_head(&my_qp->wait_completion); | ||
569 | spin_lock_init(&my_qp->spinlock_s); | 571 | spin_lock_init(&my_qp->spinlock_s); |
570 | spin_lock_init(&my_qp->spinlock_r); | 572 | spin_lock_init(&my_qp->spinlock_r); |
571 | my_qp->qp_type = qp_type; | 573 | my_qp->qp_type = qp_type; |
@@ -1934,6 +1936,9 @@ static int internal_destroy_qp(struct ib_device *dev, struct ehca_qp *my_qp, | |||
1934 | idr_remove(&ehca_qp_idr, my_qp->token); | 1936 | idr_remove(&ehca_qp_idr, my_qp->token); |
1935 | write_unlock_irqrestore(&ehca_qp_idr_lock, flags); | 1937 | write_unlock_irqrestore(&ehca_qp_idr_lock, flags); |
1936 | 1938 | ||
1939 | /* now wait until all pending events have completed */ | ||
1940 | wait_event(my_qp->wait_completion, !atomic_read(&my_qp->nr_events)); | ||
1941 | |||
1937 | h_ret = hipz_h_destroy_qp(shca->ipz_hca_handle, my_qp); | 1942 | h_ret = hipz_h_destroy_qp(shca->ipz_hca_handle, my_qp); |
1938 | if (h_ret != H_SUCCESS) { | 1943 | if (h_ret != H_SUCCESS) { |
1939 | ehca_err(dev, "hipz_h_destroy_qp() failed h_ret=%li " | 1944 | ehca_err(dev, "hipz_h_destroy_qp() failed h_ret=%li " |
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index acf30c06a0c..ce7b7c34360 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -1197,7 +1197,7 @@ void ipath_kreceive(struct ipath_portdata *pd) | |||
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | reloop: | 1199 | reloop: |
1200 | for (last = 0, i = 1; !last; i++) { | 1200 | for (last = 0, i = 1; !last; i += !last) { |
1201 | hdr = dd->ipath_f_get_msgheader(dd, rhf_addr); | 1201 | hdr = dd->ipath_f_get_msgheader(dd, rhf_addr); |
1202 | eflags = ipath_hdrget_err_flags(rhf_addr); | 1202 | eflags = ipath_hdrget_err_flags(rhf_addr); |
1203 | etype = ipath_hdrget_rcv_type(rhf_addr); | 1203 | etype = ipath_hdrget_rcv_type(rhf_addr); |
@@ -1428,6 +1428,40 @@ static void ipath_update_pio_bufs(struct ipath_devdata *dd) | |||
1428 | spin_unlock_irqrestore(&ipath_pioavail_lock, flags); | 1428 | spin_unlock_irqrestore(&ipath_pioavail_lock, flags); |
1429 | } | 1429 | } |
1430 | 1430 | ||
1431 | /* | ||
1432 | * used to force update of pioavailshadow if we can't get a pio buffer. | ||
1433 | * Needed primarily due to exitting freeze mode after recovering | ||
1434 | * from errors. Done lazily, because it's safer (known to not | ||
1435 | * be writing pio buffers). | ||
1436 | */ | ||
1437 | static void ipath_reset_availshadow(struct ipath_devdata *dd) | ||
1438 | { | ||
1439 | int i, im; | ||
1440 | unsigned long flags; | ||
1441 | |||
1442 | spin_lock_irqsave(&ipath_pioavail_lock, flags); | ||
1443 | for (i = 0; i < dd->ipath_pioavregs; i++) { | ||
1444 | u64 val, oldval; | ||
1445 | /* deal with 6110 chip bug on high register #s */ | ||
1446 | im = (i > 3 && (dd->ipath_flags & IPATH_SWAP_PIOBUFS)) ? | ||
1447 | i ^ 1 : i; | ||
1448 | val = le64_to_cpu(dd->ipath_pioavailregs_dma[im]); | ||
1449 | /* | ||
1450 | * busy out the buffers not in the kernel avail list, | ||
1451 | * without changing the generation bits. | ||
1452 | */ | ||
1453 | oldval = dd->ipath_pioavailshadow[i]; | ||
1454 | dd->ipath_pioavailshadow[i] = val | | ||
1455 | ((~dd->ipath_pioavailkernel[i] << | ||
1456 | INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT) & | ||
1457 | 0xaaaaaaaaaaaaaaaaULL); /* All BUSY bits in qword */ | ||
1458 | if (oldval != dd->ipath_pioavailshadow[i]) | ||
1459 | ipath_dbg("shadow[%d] was %Lx, now %lx\n", | ||
1460 | i, oldval, dd->ipath_pioavailshadow[i]); | ||
1461 | } | ||
1462 | spin_unlock_irqrestore(&ipath_pioavail_lock, flags); | ||
1463 | } | ||
1464 | |||
1431 | /** | 1465 | /** |
1432 | * ipath_setrcvhdrsize - set the receive header size | 1466 | * ipath_setrcvhdrsize - set the receive header size |
1433 | * @dd: the infinipath device | 1467 | * @dd: the infinipath device |
@@ -1482,9 +1516,12 @@ static noinline void no_pio_bufs(struct ipath_devdata *dd) | |||
1482 | */ | 1516 | */ |
1483 | ipath_stats.sps_nopiobufs++; | 1517 | ipath_stats.sps_nopiobufs++; |
1484 | if (!(++dd->ipath_consec_nopiobuf % 100000)) { | 1518 | if (!(++dd->ipath_consec_nopiobuf % 100000)) { |
1485 | ipath_dbg("%u pio sends with no bufavail; dmacopy: " | 1519 | ipath_force_pio_avail_update(dd); /* at start */ |
1486 | "%llx %llx %llx %llx; shadow: %lx %lx %lx %lx\n", | 1520 | ipath_dbg("%u tries no piobufavail ts%lx; dmacopy: " |
1521 | "%llx %llx %llx %llx\n" | ||
1522 | "ipath shadow: %lx %lx %lx %lx\n", | ||
1487 | dd->ipath_consec_nopiobuf, | 1523 | dd->ipath_consec_nopiobuf, |
1524 | (unsigned long)get_cycles(), | ||
1488 | (unsigned long long) le64_to_cpu(dma[0]), | 1525 | (unsigned long long) le64_to_cpu(dma[0]), |
1489 | (unsigned long long) le64_to_cpu(dma[1]), | 1526 | (unsigned long long) le64_to_cpu(dma[1]), |
1490 | (unsigned long long) le64_to_cpu(dma[2]), | 1527 | (unsigned long long) le64_to_cpu(dma[2]), |
@@ -1496,14 +1533,17 @@ static noinline void no_pio_bufs(struct ipath_devdata *dd) | |||
1496 | */ | 1533 | */ |
1497 | if ((dd->ipath_piobcnt2k + dd->ipath_piobcnt4k) > | 1534 | if ((dd->ipath_piobcnt2k + dd->ipath_piobcnt4k) > |
1498 | (sizeof(shadow[0]) * 4 * 4)) | 1535 | (sizeof(shadow[0]) * 4 * 4)) |
1499 | ipath_dbg("2nd group: dmacopy: %llx %llx " | 1536 | ipath_dbg("2nd group: dmacopy: " |
1500 | "%llx %llx; shadow: %lx %lx %lx %lx\n", | 1537 | "%llx %llx %llx %llx\n" |
1538 | "ipath shadow: %lx %lx %lx %lx\n", | ||
1501 | (unsigned long long)le64_to_cpu(dma[4]), | 1539 | (unsigned long long)le64_to_cpu(dma[4]), |
1502 | (unsigned long long)le64_to_cpu(dma[5]), | 1540 | (unsigned long long)le64_to_cpu(dma[5]), |
1503 | (unsigned long long)le64_to_cpu(dma[6]), | 1541 | (unsigned long long)le64_to_cpu(dma[6]), |
1504 | (unsigned long long)le64_to_cpu(dma[7]), | 1542 | (unsigned long long)le64_to_cpu(dma[7]), |
1505 | shadow[4], shadow[5], shadow[6], | 1543 | shadow[4], shadow[5], shadow[6], shadow[7]); |
1506 | shadow[7]); | 1544 | |
1545 | /* at end, so update likely happened */ | ||
1546 | ipath_reset_availshadow(dd); | ||
1507 | } | 1547 | } |
1508 | } | 1548 | } |
1509 | 1549 | ||
@@ -1652,19 +1692,46 @@ void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start, | |||
1652 | unsigned len, int avail) | 1692 | unsigned len, int avail) |
1653 | { | 1693 | { |
1654 | unsigned long flags; | 1694 | unsigned long flags; |
1655 | unsigned end; | 1695 | unsigned end, cnt = 0, next; |
1656 | 1696 | ||
1657 | /* There are two bits per send buffer (busy and generation) */ | 1697 | /* There are two bits per send buffer (busy and generation) */ |
1658 | start *= 2; | 1698 | start *= 2; |
1659 | len *= 2; | 1699 | end = start + len * 2; |
1660 | end = start + len; | ||
1661 | 1700 | ||
1662 | /* Set or clear the generation bits. */ | ||
1663 | spin_lock_irqsave(&ipath_pioavail_lock, flags); | 1701 | spin_lock_irqsave(&ipath_pioavail_lock, flags); |
1702 | /* Set or clear the busy bit in the shadow. */ | ||
1664 | while (start < end) { | 1703 | while (start < end) { |
1665 | if (avail) { | 1704 | if (avail) { |
1666 | __clear_bit(start + INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT, | 1705 | unsigned long dma; |
1667 | dd->ipath_pioavailshadow); | 1706 | int i, im; |
1707 | /* | ||
1708 | * the BUSY bit will never be set, because we disarm | ||
1709 | * the user buffers before we hand them back to the | ||
1710 | * kernel. We do have to make sure the generation | ||
1711 | * bit is set correctly in shadow, since it could | ||
1712 | * have changed many times while allocated to user. | ||
1713 | * We can't use the bitmap functions on the full | ||
1714 | * dma array because it is always little-endian, so | ||
1715 | * we have to flip to host-order first. | ||
1716 | * BITS_PER_LONG is slightly wrong, since it's | ||
1717 | * always 64 bits per register in chip... | ||
1718 | * We only work on 64 bit kernels, so that's OK. | ||
1719 | */ | ||
1720 | /* deal with 6110 chip bug on high register #s */ | ||
1721 | i = start / BITS_PER_LONG; | ||
1722 | im = (i > 3 && (dd->ipath_flags & IPATH_SWAP_PIOBUFS)) ? | ||
1723 | i ^ 1 : i; | ||
1724 | __clear_bit(INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT | ||
1725 | + start, dd->ipath_pioavailshadow); | ||
1726 | dma = (unsigned long) le64_to_cpu( | ||
1727 | dd->ipath_pioavailregs_dma[im]); | ||
1728 | if (test_bit((INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT | ||
1729 | + start) % BITS_PER_LONG, &dma)) | ||
1730 | __set_bit(INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT | ||
1731 | + start, dd->ipath_pioavailshadow); | ||
1732 | else | ||
1733 | __clear_bit(INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT | ||
1734 | + start, dd->ipath_pioavailshadow); | ||
1668 | __set_bit(start, dd->ipath_pioavailkernel); | 1735 | __set_bit(start, dd->ipath_pioavailkernel); |
1669 | } else { | 1736 | } else { |
1670 | __set_bit(start + INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT, | 1737 | __set_bit(start + INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT, |
@@ -1673,7 +1740,44 @@ void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start, | |||
1673 | } | 1740 | } |
1674 | start += 2; | 1741 | start += 2; |
1675 | } | 1742 | } |
1743 | |||
1744 | if (dd->ipath_pioupd_thresh) { | ||
1745 | end = 2 * (dd->ipath_piobcnt2k + dd->ipath_piobcnt4k); | ||
1746 | next = find_first_bit(dd->ipath_pioavailkernel, end); | ||
1747 | while (next < end) { | ||
1748 | cnt++; | ||
1749 | next = find_next_bit(dd->ipath_pioavailkernel, end, | ||
1750 | next + 1); | ||
1751 | } | ||
1752 | } | ||
1676 | spin_unlock_irqrestore(&ipath_pioavail_lock, flags); | 1753 | spin_unlock_irqrestore(&ipath_pioavail_lock, flags); |
1754 | |||
1755 | /* | ||
1756 | * When moving buffers from kernel to user, if number assigned to | ||
1757 | * the user is less than the pio update threshold, and threshold | ||
1758 | * is supported (cnt was computed > 0), drop the update threshold | ||
1759 | * so we update at least once per allocated number of buffers. | ||
1760 | * In any case, if the kernel buffers are less than the threshold, | ||
1761 | * drop the threshold. We don't bother increasing it, having once | ||
1762 | * decreased it, since it would typically just cycle back and forth. | ||
1763 | * If we don't decrease below buffers in use, we can wait a long | ||
1764 | * time for an update, until some other context uses PIO buffers. | ||
1765 | */ | ||
1766 | if (!avail && len < cnt) | ||
1767 | cnt = len; | ||
1768 | if (cnt < dd->ipath_pioupd_thresh) { | ||
1769 | dd->ipath_pioupd_thresh = cnt; | ||
1770 | ipath_dbg("Decreased pio update threshold to %u\n", | ||
1771 | dd->ipath_pioupd_thresh); | ||
1772 | spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); | ||
1773 | dd->ipath_sendctrl &= ~(INFINIPATH_S_UPDTHRESH_MASK | ||
1774 | << INFINIPATH_S_UPDTHRESH_SHIFT); | ||
1775 | dd->ipath_sendctrl |= dd->ipath_pioupd_thresh | ||
1776 | << INFINIPATH_S_UPDTHRESH_SHIFT; | ||
1777 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, | ||
1778 | dd->ipath_sendctrl); | ||
1779 | spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags); | ||
1780 | } | ||
1677 | } | 1781 | } |
1678 | 1782 | ||
1679 | /** | 1783 | /** |
@@ -1794,8 +1898,8 @@ void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl) | |||
1794 | 1898 | ||
1795 | spin_lock_irqsave(&dd->ipath_sdma_lock, flags); | 1899 | spin_lock_irqsave(&dd->ipath_sdma_lock, flags); |
1796 | skip_cancel = | 1900 | skip_cancel = |
1797 | !test_bit(IPATH_SDMA_DISABLED, statp) && | 1901 | test_and_set_bit(IPATH_SDMA_ABORTING, statp) |
1798 | test_and_set_bit(IPATH_SDMA_ABORTING, statp); | 1902 | && !test_bit(IPATH_SDMA_DISABLED, statp); |
1799 | spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); | 1903 | spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); |
1800 | if (skip_cancel) | 1904 | if (skip_cancel) |
1801 | goto bail; | 1905 | goto bail; |
@@ -1826,6 +1930,9 @@ void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl) | |||
1826 | ipath_disarm_piobufs(dd, 0, | 1930 | ipath_disarm_piobufs(dd, 0, |
1827 | dd->ipath_piobcnt2k + dd->ipath_piobcnt4k); | 1931 | dd->ipath_piobcnt2k + dd->ipath_piobcnt4k); |
1828 | 1932 | ||
1933 | if (dd->ipath_flags & IPATH_HAS_SEND_DMA) | ||
1934 | set_bit(IPATH_SDMA_DISARMED, &dd->ipath_sdma_status); | ||
1935 | |||
1829 | if (restore_sendctrl) { | 1936 | if (restore_sendctrl) { |
1830 | /* else done by caller later if needed */ | 1937 | /* else done by caller later if needed */ |
1831 | spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); | 1938 | spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); |
@@ -1845,7 +1952,6 @@ void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl) | |||
1845 | /* only wait so long for intr */ | 1952 | /* only wait so long for intr */ |
1846 | dd->ipath_sdma_abort_intr_timeout = jiffies + HZ; | 1953 | dd->ipath_sdma_abort_intr_timeout = jiffies + HZ; |
1847 | dd->ipath_sdma_reset_wait = 200; | 1954 | dd->ipath_sdma_reset_wait = 200; |
1848 | __set_bit(IPATH_SDMA_DISARMED, &dd->ipath_sdma_status); | ||
1849 | if (!test_bit(IPATH_SDMA_SHUTDOWN, &dd->ipath_sdma_status)) | 1955 | if (!test_bit(IPATH_SDMA_SHUTDOWN, &dd->ipath_sdma_status)) |
1850 | tasklet_hi_schedule(&dd->ipath_sdma_abort_task); | 1956 | tasklet_hi_schedule(&dd->ipath_sdma_abort_task); |
1851 | spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); | 1957 | spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); |
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index 8b1752202e7..3295177c937 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -173,47 +173,25 @@ static int ipath_get_base_info(struct file *fp, | |||
173 | (void *) dd->ipath_statusp - | 173 | (void *) dd->ipath_statusp - |
174 | (void *) dd->ipath_pioavailregs_dma; | 174 | (void *) dd->ipath_pioavailregs_dma; |
175 | if (!shared) { | 175 | if (!shared) { |
176 | kinfo->spi_piocnt = dd->ipath_pbufsport; | 176 | kinfo->spi_piocnt = pd->port_piocnt; |
177 | kinfo->spi_piobufbase = (u64) pd->port_piobufs; | 177 | kinfo->spi_piobufbase = (u64) pd->port_piobufs; |
178 | kinfo->__spi_uregbase = (u64) dd->ipath_uregbase + | 178 | kinfo->__spi_uregbase = (u64) dd->ipath_uregbase + |
179 | dd->ipath_ureg_align * pd->port_port; | 179 | dd->ipath_ureg_align * pd->port_port; |
180 | } else if (master) { | 180 | } else if (master) { |
181 | kinfo->spi_piocnt = (dd->ipath_pbufsport / subport_cnt) + | 181 | kinfo->spi_piocnt = (pd->port_piocnt / subport_cnt) + |
182 | (dd->ipath_pbufsport % subport_cnt); | 182 | (pd->port_piocnt % subport_cnt); |
183 | /* Master's PIO buffers are after all the slave's */ | 183 | /* Master's PIO buffers are after all the slave's */ |
184 | kinfo->spi_piobufbase = (u64) pd->port_piobufs + | 184 | kinfo->spi_piobufbase = (u64) pd->port_piobufs + |
185 | dd->ipath_palign * | 185 | dd->ipath_palign * |
186 | (dd->ipath_pbufsport - kinfo->spi_piocnt); | 186 | (pd->port_piocnt - kinfo->spi_piocnt); |
187 | } else { | 187 | } else { |
188 | unsigned slave = subport_fp(fp) - 1; | 188 | unsigned slave = subport_fp(fp) - 1; |
189 | 189 | ||
190 | kinfo->spi_piocnt = dd->ipath_pbufsport / subport_cnt; | 190 | kinfo->spi_piocnt = pd->port_piocnt / subport_cnt; |
191 | kinfo->spi_piobufbase = (u64) pd->port_piobufs + | 191 | kinfo->spi_piobufbase = (u64) pd->port_piobufs + |
192 | dd->ipath_palign * kinfo->spi_piocnt * slave; | 192 | dd->ipath_palign * kinfo->spi_piocnt * slave; |
193 | } | 193 | } |
194 | 194 | ||
195 | /* | ||
196 | * Set the PIO avail update threshold to no larger | ||
197 | * than the number of buffers per process. Note that | ||
198 | * we decrease it here, but won't ever increase it. | ||
199 | */ | ||
200 | if (dd->ipath_pioupd_thresh && | ||
201 | kinfo->spi_piocnt < dd->ipath_pioupd_thresh) { | ||
202 | unsigned long flags; | ||
203 | |||
204 | dd->ipath_pioupd_thresh = kinfo->spi_piocnt; | ||
205 | ipath_dbg("Decreased pio update threshold to %u\n", | ||
206 | dd->ipath_pioupd_thresh); | ||
207 | spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); | ||
208 | dd->ipath_sendctrl &= ~(INFINIPATH_S_UPDTHRESH_MASK | ||
209 | << INFINIPATH_S_UPDTHRESH_SHIFT); | ||
210 | dd->ipath_sendctrl |= dd->ipath_pioupd_thresh | ||
211 | << INFINIPATH_S_UPDTHRESH_SHIFT; | ||
212 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, | ||
213 | dd->ipath_sendctrl); | ||
214 | spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags); | ||
215 | } | ||
216 | |||
217 | if (shared) { | 195 | if (shared) { |
218 | kinfo->spi_port_uregbase = (u64) dd->ipath_uregbase + | 196 | kinfo->spi_port_uregbase = (u64) dd->ipath_uregbase + |
219 | dd->ipath_ureg_align * pd->port_port; | 197 | dd->ipath_ureg_align * pd->port_port; |
@@ -1309,19 +1287,19 @@ static int ipath_mmap(struct file *fp, struct vm_area_struct *vma) | |||
1309 | ureg = dd->ipath_uregbase + dd->ipath_ureg_align * pd->port_port; | 1287 | ureg = dd->ipath_uregbase + dd->ipath_ureg_align * pd->port_port; |
1310 | if (!pd->port_subport_cnt) { | 1288 | if (!pd->port_subport_cnt) { |
1311 | /* port is not shared */ | 1289 | /* port is not shared */ |
1312 | piocnt = dd->ipath_pbufsport; | 1290 | piocnt = pd->port_piocnt; |
1313 | piobufs = pd->port_piobufs; | 1291 | piobufs = pd->port_piobufs; |
1314 | } else if (!subport_fp(fp)) { | 1292 | } else if (!subport_fp(fp)) { |
1315 | /* caller is the master */ | 1293 | /* caller is the master */ |
1316 | piocnt = (dd->ipath_pbufsport / pd->port_subport_cnt) + | 1294 | piocnt = (pd->port_piocnt / pd->port_subport_cnt) + |
1317 | (dd->ipath_pbufsport % pd->port_subport_cnt); | 1295 | (pd->port_piocnt % pd->port_subport_cnt); |
1318 | piobufs = pd->port_piobufs + | 1296 | piobufs = pd->port_piobufs + |
1319 | dd->ipath_palign * (dd->ipath_pbufsport - piocnt); | 1297 | dd->ipath_palign * (pd->port_piocnt - piocnt); |
1320 | } else { | 1298 | } else { |
1321 | unsigned slave = subport_fp(fp) - 1; | 1299 | unsigned slave = subport_fp(fp) - 1; |
1322 | 1300 | ||
1323 | /* caller is a slave */ | 1301 | /* caller is a slave */ |
1324 | piocnt = dd->ipath_pbufsport / pd->port_subport_cnt; | 1302 | piocnt = pd->port_piocnt / pd->port_subport_cnt; |
1325 | piobufs = pd->port_piobufs + dd->ipath_palign * piocnt * slave; | 1303 | piobufs = pd->port_piobufs + dd->ipath_palign * piocnt * slave; |
1326 | } | 1304 | } |
1327 | 1305 | ||
@@ -1633,9 +1611,6 @@ static int try_alloc_port(struct ipath_devdata *dd, int port, | |||
1633 | port_fp(fp) = pd; | 1611 | port_fp(fp) = pd; |
1634 | pd->port_pid = current->pid; | 1612 | pd->port_pid = current->pid; |
1635 | strncpy(pd->port_comm, current->comm, sizeof(pd->port_comm)); | 1613 | strncpy(pd->port_comm, current->comm, sizeof(pd->port_comm)); |
1636 | ipath_chg_pioavailkernel(dd, | ||
1637 | dd->ipath_pbufsport * (pd->port_port - 1), | ||
1638 | dd->ipath_pbufsport, 0); | ||
1639 | ipath_stats.sps_ports++; | 1614 | ipath_stats.sps_ports++; |
1640 | ret = 0; | 1615 | ret = 0; |
1641 | } else | 1616 | } else |
@@ -1938,11 +1913,25 @@ static int ipath_do_user_init(struct file *fp, | |||
1938 | 1913 | ||
1939 | /* for now we do nothing with rcvhdrcnt: uinfo->spu_rcvhdrcnt */ | 1914 | /* for now we do nothing with rcvhdrcnt: uinfo->spu_rcvhdrcnt */ |
1940 | 1915 | ||
1916 | /* some ports may get extra buffers, calculate that here */ | ||
1917 | if (pd->port_port <= dd->ipath_ports_extrabuf) | ||
1918 | pd->port_piocnt = dd->ipath_pbufsport + 1; | ||
1919 | else | ||
1920 | pd->port_piocnt = dd->ipath_pbufsport; | ||
1921 | |||
1941 | /* for right now, kernel piobufs are at end, so port 1 is at 0 */ | 1922 | /* for right now, kernel piobufs are at end, so port 1 is at 0 */ |
1923 | if (pd->port_port <= dd->ipath_ports_extrabuf) | ||
1924 | pd->port_pio_base = (dd->ipath_pbufsport + 1) | ||
1925 | * (pd->port_port - 1); | ||
1926 | else | ||
1927 | pd->port_pio_base = dd->ipath_ports_extrabuf + | ||
1928 | dd->ipath_pbufsport * (pd->port_port - 1); | ||
1942 | pd->port_piobufs = dd->ipath_piobufbase + | 1929 | pd->port_piobufs = dd->ipath_piobufbase + |
1943 | dd->ipath_pbufsport * (pd->port_port - 1) * dd->ipath_palign; | 1930 | pd->port_pio_base * dd->ipath_palign; |
1944 | ipath_cdbg(VERBOSE, "Set base of piobufs for port %u to 0x%x\n", | 1931 | ipath_cdbg(VERBOSE, "piobuf base for port %u is 0x%x, piocnt %u," |
1945 | pd->port_port, pd->port_piobufs); | 1932 | " first pio %u\n", pd->port_port, pd->port_piobufs, |
1933 | pd->port_piocnt, pd->port_pio_base); | ||
1934 | ipath_chg_pioavailkernel(dd, pd->port_pio_base, pd->port_piocnt, 0); | ||
1946 | 1935 | ||
1947 | /* | 1936 | /* |
1948 | * Now allocate the rcvhdr Q and eager TIDs; skip the TID | 1937 | * Now allocate the rcvhdr Q and eager TIDs; skip the TID |
@@ -2107,7 +2096,6 @@ static int ipath_close(struct inode *in, struct file *fp) | |||
2107 | } | 2096 | } |
2108 | 2097 | ||
2109 | if (dd->ipath_kregbase) { | 2098 | if (dd->ipath_kregbase) { |
2110 | int i; | ||
2111 | /* atomically clear receive enable port and intr avail. */ | 2099 | /* atomically clear receive enable port and intr avail. */ |
2112 | clear_bit(dd->ipath_r_portenable_shift + port, | 2100 | clear_bit(dd->ipath_r_portenable_shift + port, |
2113 | &dd->ipath_rcvctrl); | 2101 | &dd->ipath_rcvctrl); |
@@ -2136,9 +2124,9 @@ static int ipath_close(struct inode *in, struct file *fp) | |||
2136 | ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdraddr, | 2124 | ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdraddr, |
2137 | pd->port_port, dd->ipath_dummy_hdrq_phys); | 2125 | pd->port_port, dd->ipath_dummy_hdrq_phys); |
2138 | 2126 | ||
2139 | i = dd->ipath_pbufsport * (port - 1); | 2127 | ipath_disarm_piobufs(dd, pd->port_pio_base, pd->port_piocnt); |
2140 | ipath_disarm_piobufs(dd, i, dd->ipath_pbufsport); | 2128 | ipath_chg_pioavailkernel(dd, pd->port_pio_base, |
2141 | ipath_chg_pioavailkernel(dd, i, dd->ipath_pbufsport, 1); | 2129 | pd->port_piocnt, 1); |
2142 | 2130 | ||
2143 | dd->ipath_f_clear_tids(dd, pd->port_port); | 2131 | dd->ipath_f_clear_tids(dd, pd->port_port); |
2144 | 2132 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_iba7220.c b/drivers/infiniband/hw/ipath/ipath_iba7220.c index e3ec0d1bdf5..8eee7830f04 100644 --- a/drivers/infiniband/hw/ipath/ipath_iba7220.c +++ b/drivers/infiniband/hw/ipath/ipath_iba7220.c | |||
@@ -595,7 +595,7 @@ static void ipath_7220_txe_recover(struct ipath_devdata *dd) | |||
595 | 595 | ||
596 | dev_info(&dd->pcidev->dev, | 596 | dev_info(&dd->pcidev->dev, |
597 | "Recovering from TXE PIO parity error\n"); | 597 | "Recovering from TXE PIO parity error\n"); |
598 | ipath_disarm_senderrbufs(dd, 1); | 598 | ipath_disarm_senderrbufs(dd); |
599 | } | 599 | } |
600 | 600 | ||
601 | 601 | ||
@@ -675,10 +675,8 @@ static void ipath_7220_handle_hwerrors(struct ipath_devdata *dd, char *msg, | |||
675 | ctrl = ipath_read_kreg32(dd, dd->ipath_kregs->kr_control); | 675 | ctrl = ipath_read_kreg32(dd, dd->ipath_kregs->kr_control); |
676 | if ((ctrl & INFINIPATH_C_FREEZEMODE) && !ipath_diag_inuse) { | 676 | if ((ctrl & INFINIPATH_C_FREEZEMODE) && !ipath_diag_inuse) { |
677 | /* | 677 | /* |
678 | * Parity errors in send memory are recoverable, | 678 | * Parity errors in send memory are recoverable by h/w |
679 | * just cancel the send (if indicated in * sendbuffererror), | 679 | * just do housekeeping, exit freeze mode and continue. |
680 | * count the occurrence, unfreeze (if no other handled | ||
681 | * hardware error bits are set), and continue. | ||
682 | */ | 680 | */ |
683 | if (hwerrs & ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | | 681 | if (hwerrs & ((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | |
684 | INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC) | 682 | INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC) |
@@ -687,13 +685,6 @@ static void ipath_7220_handle_hwerrors(struct ipath_devdata *dd, char *msg, | |||
687 | hwerrs &= ~((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | | 685 | hwerrs &= ~((INFINIPATH_HWE_TXEMEMPARITYERR_PIOBUF | |
688 | INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC) | 686 | INFINIPATH_HWE_TXEMEMPARITYERR_PIOPBC) |
689 | << INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT); | 687 | << INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT); |
690 | if (!hwerrs) { | ||
691 | /* else leave in freeze mode */ | ||
692 | ipath_write_kreg(dd, | ||
693 | dd->ipath_kregs->kr_control, | ||
694 | dd->ipath_control); | ||
695 | goto bail; | ||
696 | } | ||
697 | } | 688 | } |
698 | if (hwerrs) { | 689 | if (hwerrs) { |
699 | /* | 690 | /* |
@@ -723,8 +714,8 @@ static void ipath_7220_handle_hwerrors(struct ipath_devdata *dd, char *msg, | |||
723 | *dd->ipath_statusp |= IPATH_STATUS_HWERROR; | 714 | *dd->ipath_statusp |= IPATH_STATUS_HWERROR; |
724 | dd->ipath_flags &= ~IPATH_INITTED; | 715 | dd->ipath_flags &= ~IPATH_INITTED; |
725 | } else { | 716 | } else { |
726 | ipath_dbg("Clearing freezemode on ignored hardware " | 717 | ipath_dbg("Clearing freezemode on ignored or " |
727 | "error\n"); | 718 | "recovered hardware error\n"); |
728 | ipath_clear_freeze(dd); | 719 | ipath_clear_freeze(dd); |
729 | } | 720 | } |
730 | } | 721 | } |
@@ -870,8 +861,9 @@ static int ipath_7220_boardname(struct ipath_devdata *dd, char *name, | |||
870 | "revision %u.%u!\n", | 861 | "revision %u.%u!\n", |
871 | dd->ipath_majrev, dd->ipath_minrev); | 862 | dd->ipath_majrev, dd->ipath_minrev); |
872 | ret = 1; | 863 | ret = 1; |
873 | } else if (dd->ipath_minrev == 1) { | 864 | } else if (dd->ipath_minrev == 1 && |
874 | /* Rev1 chips are prototype. Complain, but allow use */ | 865 | !(dd->ipath_flags & IPATH_INITTED)) { |
866 | /* Rev1 chips are prototype. Complain at init, but allow use */ | ||
875 | ipath_dev_err(dd, "Unsupported hardware " | 867 | ipath_dev_err(dd, "Unsupported hardware " |
876 | "revision %u.%u, Contact support@qlogic.com\n", | 868 | "revision %u.%u, Contact support@qlogic.com\n", |
877 | dd->ipath_majrev, dd->ipath_minrev); | 869 | dd->ipath_majrev, dd->ipath_minrev); |
@@ -1966,7 +1958,7 @@ static void ipath_7220_config_ports(struct ipath_devdata *dd, ushort cfgports) | |||
1966 | dd->ipath_rcvctrl); | 1958 | dd->ipath_rcvctrl); |
1967 | dd->ipath_p0_rcvegrcnt = 2048; /* always */ | 1959 | dd->ipath_p0_rcvegrcnt = 2048; /* always */ |
1968 | if (dd->ipath_flags & IPATH_HAS_SEND_DMA) | 1960 | if (dd->ipath_flags & IPATH_HAS_SEND_DMA) |
1969 | dd->ipath_pioreserved = 1; /* reserve a buffer */ | 1961 | dd->ipath_pioreserved = 3; /* kpiobufs used for PIO */ |
1970 | } | 1962 | } |
1971 | 1963 | ||
1972 | 1964 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c index 27dd8947666..3e5baa43fc8 100644 --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c | |||
@@ -41,7 +41,7 @@ | |||
41 | /* | 41 | /* |
42 | * min buffers we want to have per port, after driver | 42 | * min buffers we want to have per port, after driver |
43 | */ | 43 | */ |
44 | #define IPATH_MIN_USER_PORT_BUFCNT 8 | 44 | #define IPATH_MIN_USER_PORT_BUFCNT 7 |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Number of ports we are configured to use (to allow for more pio | 47 | * Number of ports we are configured to use (to allow for more pio |
@@ -54,13 +54,9 @@ MODULE_PARM_DESC(cfgports, "Set max number of ports to use"); | |||
54 | 54 | ||
55 | /* | 55 | /* |
56 | * Number of buffers reserved for driver (verbs and layered drivers.) | 56 | * Number of buffers reserved for driver (verbs and layered drivers.) |
57 | * Reserved at end of buffer list. Initialized based on | 57 | * Initialized based on number of PIO buffers if not set via module interface. |
58 | * number of PIO buffers if not set via module interface. | ||
59 | * The problem with this is that it's global, but we'll use different | 58 | * The problem with this is that it's global, but we'll use different |
60 | * numbers for different chip types. So the default value is not | 59 | * numbers for different chip types. |
61 | * very useful. I've redefined it for the 1.3 release so that it's | ||
62 | * zero unless set by the user to something else, in which case we | ||
63 | * try to respect it. | ||
64 | */ | 60 | */ |
65 | static ushort ipath_kpiobufs; | 61 | static ushort ipath_kpiobufs; |
66 | 62 | ||
@@ -546,9 +542,12 @@ static void enable_chip(struct ipath_devdata *dd, int reinit) | |||
546 | pioavail = dd->ipath_pioavailregs_dma[i ^ 1]; | 542 | pioavail = dd->ipath_pioavailregs_dma[i ^ 1]; |
547 | else | 543 | else |
548 | pioavail = dd->ipath_pioavailregs_dma[i]; | 544 | pioavail = dd->ipath_pioavailregs_dma[i]; |
549 | dd->ipath_pioavailshadow[i] = le64_to_cpu(pioavail) | | 545 | /* |
550 | (~dd->ipath_pioavailkernel[i] << | 546 | * don't need to worry about ipath_pioavailkernel here |
551 | INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT); | 547 | * because we will call ipath_chg_pioavailkernel() later |
548 | * in initialization, to busy out buffers as needed | ||
549 | */ | ||
550 | dd->ipath_pioavailshadow[i] = le64_to_cpu(pioavail); | ||
552 | } | 551 | } |
553 | /* can get counters, stats, etc. */ | 552 | /* can get counters, stats, etc. */ |
554 | dd->ipath_flags |= IPATH_PRESENT; | 553 | dd->ipath_flags |= IPATH_PRESENT; |
@@ -708,12 +707,11 @@ static void verify_interrupt(unsigned long opaque) | |||
708 | int ipath_init_chip(struct ipath_devdata *dd, int reinit) | 707 | int ipath_init_chip(struct ipath_devdata *dd, int reinit) |
709 | { | 708 | { |
710 | int ret = 0; | 709 | int ret = 0; |
711 | u32 val32, kpiobufs; | 710 | u32 kpiobufs, defkbufs; |
712 | u32 piobufs, uports; | 711 | u32 piobufs, uports; |
713 | u64 val; | 712 | u64 val; |
714 | struct ipath_portdata *pd; | 713 | struct ipath_portdata *pd; |
715 | gfp_t gfp_flags = GFP_USER | __GFP_COMP; | 714 | gfp_t gfp_flags = GFP_USER | __GFP_COMP; |
716 | unsigned long flags; | ||
717 | 715 | ||
718 | ret = init_housekeeping(dd, reinit); | 716 | ret = init_housekeeping(dd, reinit); |
719 | if (ret) | 717 | if (ret) |
@@ -753,56 +751,46 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
753 | dd->ipath_pioavregs = ALIGN(piobufs, sizeof(u64) * BITS_PER_BYTE / 2) | 751 | dd->ipath_pioavregs = ALIGN(piobufs, sizeof(u64) * BITS_PER_BYTE / 2) |
754 | / (sizeof(u64) * BITS_PER_BYTE / 2); | 752 | / (sizeof(u64) * BITS_PER_BYTE / 2); |
755 | uports = dd->ipath_cfgports ? dd->ipath_cfgports - 1 : 0; | 753 | uports = dd->ipath_cfgports ? dd->ipath_cfgports - 1 : 0; |
756 | if (ipath_kpiobufs == 0) { | 754 | if (piobufs > 144) |
757 | /* not set by user (this is default) */ | 755 | defkbufs = 32 + dd->ipath_pioreserved; |
758 | if (piobufs > 144) | ||
759 | kpiobufs = 32; | ||
760 | else | ||
761 | kpiobufs = 16; | ||
762 | } | ||
763 | else | 756 | else |
764 | kpiobufs = ipath_kpiobufs; | 757 | defkbufs = 16 + dd->ipath_pioreserved; |
765 | 758 | ||
766 | if (kpiobufs + (uports * IPATH_MIN_USER_PORT_BUFCNT) > piobufs) { | 759 | if (ipath_kpiobufs && (ipath_kpiobufs + |
760 | (uports * IPATH_MIN_USER_PORT_BUFCNT)) > piobufs) { | ||
767 | int i = (int) piobufs - | 761 | int i = (int) piobufs - |
768 | (int) (uports * IPATH_MIN_USER_PORT_BUFCNT); | 762 | (int) (uports * IPATH_MIN_USER_PORT_BUFCNT); |
769 | if (i < 1) | 763 | if (i < 1) |
770 | i = 1; | 764 | i = 1; |
771 | dev_info(&dd->pcidev->dev, "Allocating %d PIO bufs of " | 765 | dev_info(&dd->pcidev->dev, "Allocating %d PIO bufs of " |
772 | "%d for kernel leaves too few for %d user ports " | 766 | "%d for kernel leaves too few for %d user ports " |
773 | "(%d each); using %u\n", kpiobufs, | 767 | "(%d each); using %u\n", ipath_kpiobufs, |
774 | piobufs, uports, IPATH_MIN_USER_PORT_BUFCNT, i); | 768 | piobufs, uports, IPATH_MIN_USER_PORT_BUFCNT, i); |
775 | /* | 769 | /* |
776 | * shouldn't change ipath_kpiobufs, because could be | 770 | * shouldn't change ipath_kpiobufs, because could be |
777 | * different for different devices... | 771 | * different for different devices... |
778 | */ | 772 | */ |
779 | kpiobufs = i; | 773 | kpiobufs = i; |
780 | } | 774 | } else if (ipath_kpiobufs) |
775 | kpiobufs = ipath_kpiobufs; | ||
776 | else | ||
777 | kpiobufs = defkbufs; | ||
781 | dd->ipath_lastport_piobuf = piobufs - kpiobufs; | 778 | dd->ipath_lastport_piobuf = piobufs - kpiobufs; |
782 | dd->ipath_pbufsport = | 779 | dd->ipath_pbufsport = |
783 | uports ? dd->ipath_lastport_piobuf / uports : 0; | 780 | uports ? dd->ipath_lastport_piobuf / uports : 0; |
784 | val32 = dd->ipath_lastport_piobuf - (dd->ipath_pbufsport * uports); | 781 | /* if not an even divisor, some user ports get extra buffers */ |
785 | if (val32 > 0) { | 782 | dd->ipath_ports_extrabuf = dd->ipath_lastport_piobuf - |
786 | ipath_dbg("allocating %u pbufs/port leaves %u unused, " | 783 | (dd->ipath_pbufsport * uports); |
787 | "add to kernel\n", dd->ipath_pbufsport, val32); | 784 | if (dd->ipath_ports_extrabuf) |
788 | dd->ipath_lastport_piobuf -= val32; | 785 | ipath_dbg("%u pbufs/port leaves some unused, add 1 buffer to " |
789 | kpiobufs += val32; | 786 | "ports <= %u\n", dd->ipath_pbufsport, |
790 | ipath_dbg("%u pbufs/port leaves %u unused, add to kernel\n", | 787 | dd->ipath_ports_extrabuf); |
791 | dd->ipath_pbufsport, val32); | ||
792 | } | ||
793 | dd->ipath_lastpioindex = 0; | 788 | dd->ipath_lastpioindex = 0; |
794 | dd->ipath_lastpioindexl = dd->ipath_piobcnt2k; | 789 | dd->ipath_lastpioindexl = dd->ipath_piobcnt2k; |
795 | ipath_chg_pioavailkernel(dd, 0, piobufs, 1); | 790 | /* ipath_pioavailshadow initialized earlier */ |
796 | ipath_cdbg(VERBOSE, "%d PIO bufs for kernel out of %d total %u " | 791 | ipath_cdbg(VERBOSE, "%d PIO bufs for kernel out of %d total %u " |
797 | "each for %u user ports\n", kpiobufs, | 792 | "each for %u user ports\n", kpiobufs, |
798 | piobufs, dd->ipath_pbufsport, uports); | 793 | piobufs, dd->ipath_pbufsport, uports); |
799 | if (dd->ipath_pioupd_thresh) { | ||
800 | if (dd->ipath_pbufsport < dd->ipath_pioupd_thresh) | ||
801 | dd->ipath_pioupd_thresh = dd->ipath_pbufsport; | ||
802 | if (kpiobufs < dd->ipath_pioupd_thresh) | ||
803 | dd->ipath_pioupd_thresh = kpiobufs; | ||
804 | } | ||
805 | |||
806 | ret = dd->ipath_f_early_init(dd); | 794 | ret = dd->ipath_f_early_init(dd); |
807 | if (ret) { | 795 | if (ret) { |
808 | ipath_dev_err(dd, "Early initialization failure\n"); | 796 | ipath_dev_err(dd, "Early initialization failure\n"); |
@@ -810,13 +798,6 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
810 | } | 798 | } |
811 | 799 | ||
812 | /* | 800 | /* |
813 | * Cancel any possible active sends from early driver load. | ||
814 | * Follows early_init because some chips have to initialize | ||
815 | * PIO buffers in early_init to avoid false parity errors. | ||
816 | */ | ||
817 | ipath_cancel_sends(dd, 0); | ||
818 | |||
819 | /* | ||
820 | * Early_init sets rcvhdrentsize and rcvhdrsize, so this must be | 801 | * Early_init sets rcvhdrentsize and rcvhdrsize, so this must be |
821 | * done after early_init. | 802 | * done after early_init. |
822 | */ | 803 | */ |
@@ -836,6 +817,7 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
836 | 817 | ||
837 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendpioavailaddr, | 818 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendpioavailaddr, |
838 | dd->ipath_pioavailregs_phys); | 819 | dd->ipath_pioavailregs_phys); |
820 | |||
839 | /* | 821 | /* |
840 | * this is to detect s/w errors, which the h/w works around by | 822 | * this is to detect s/w errors, which the h/w works around by |
841 | * ignoring the low 6 bits of address, if it wasn't aligned. | 823 | * ignoring the low 6 bits of address, if it wasn't aligned. |
@@ -862,12 +844,6 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
862 | ~0ULL&~INFINIPATH_HWE_MEMBISTFAILED); | 844 | ~0ULL&~INFINIPATH_HWE_MEMBISTFAILED); |
863 | ipath_write_kreg(dd, dd->ipath_kregs->kr_control, 0ULL); | 845 | ipath_write_kreg(dd, dd->ipath_kregs->kr_control, 0ULL); |
864 | 846 | ||
865 | spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); | ||
866 | dd->ipath_sendctrl = INFINIPATH_S_PIOENABLE; | ||
867 | ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, dd->ipath_sendctrl); | ||
868 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); | ||
869 | spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags); | ||
870 | |||
871 | /* | 847 | /* |
872 | * before error clears, since we expect serdes pll errors during | 848 | * before error clears, since we expect serdes pll errors during |
873 | * this, the first time after reset | 849 | * this, the first time after reset |
@@ -940,6 +916,19 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) | |||
940 | else | 916 | else |
941 | enable_chip(dd, reinit); | 917 | enable_chip(dd, reinit); |
942 | 918 | ||
919 | /* after enable_chip, so pioavailshadow setup */ | ||
920 | ipath_chg_pioavailkernel(dd, 0, piobufs, 1); | ||
921 | |||
922 | /* | ||
923 | * Cancel any possible active sends from early driver load. | ||
924 | * Follows early_init because some chips have to initialize | ||
925 | * PIO buffers in early_init to avoid false parity errors. | ||
926 | * After enable and ipath_chg_pioavailkernel so we can safely | ||
927 | * enable pioavail updates and PIOENABLE; packets are now | ||
928 | * ready to go out. | ||
929 | */ | ||
930 | ipath_cancel_sends(dd, 1); | ||
931 | |||
943 | if (!reinit) { | 932 | if (!reinit) { |
944 | /* | 933 | /* |
945 | * Used when we close a port, for DMA already in flight | 934 | * Used when we close a port, for DMA already in flight |
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c index 1b58f4737c7..26900b3b7a4 100644 --- a/drivers/infiniband/hw/ipath/ipath_intr.c +++ b/drivers/infiniband/hw/ipath/ipath_intr.c | |||
@@ -38,42 +38,12 @@ | |||
38 | #include "ipath_verbs.h" | 38 | #include "ipath_verbs.h" |
39 | #include "ipath_common.h" | 39 | #include "ipath_common.h" |
40 | 40 | ||
41 | /* | ||
42 | * clear (write) a pio buffer, to clear a parity error. This routine | ||
43 | * should only be called when in freeze mode, and the buffer should be | ||
44 | * canceled afterwards. | ||
45 | */ | ||
46 | static void ipath_clrpiobuf(struct ipath_devdata *dd, u32 pnum) | ||
47 | { | ||
48 | u32 __iomem *pbuf; | ||
49 | u32 dwcnt; /* dword count to write */ | ||
50 | if (pnum < dd->ipath_piobcnt2k) { | ||
51 | pbuf = (u32 __iomem *) (dd->ipath_pio2kbase + pnum * | ||
52 | dd->ipath_palign); | ||
53 | dwcnt = dd->ipath_piosize2k >> 2; | ||
54 | } | ||
55 | else { | ||
56 | pbuf = (u32 __iomem *) (dd->ipath_pio4kbase + | ||
57 | (pnum - dd->ipath_piobcnt2k) * dd->ipath_4kalign); | ||
58 | dwcnt = dd->ipath_piosize4k >> 2; | ||
59 | } | ||
60 | dev_info(&dd->pcidev->dev, | ||
61 | "Rewrite PIO buffer %u, to recover from parity error\n", | ||
62 | pnum); | ||
63 | |||
64 | /* no flush required, since already in freeze */ | ||
65 | writel(dwcnt + 1, pbuf); | ||
66 | while (--dwcnt) | ||
67 | writel(0, pbuf++); | ||
68 | } | ||
69 | 41 | ||
70 | /* | 42 | /* |
71 | * Called when we might have an error that is specific to a particular | 43 | * Called when we might have an error that is specific to a particular |
72 | * PIO buffer, and may need to cancel that buffer, so it can be re-used. | 44 | * PIO buffer, and may need to cancel that buffer, so it can be re-used. |
73 | * If rewrite is true, and bits are set in the sendbufferror registers, | ||
74 | * we'll write to the buffer, for error recovery on parity errors. | ||
75 | */ | 45 | */ |
76 | void ipath_disarm_senderrbufs(struct ipath_devdata *dd, int rewrite) | 46 | void ipath_disarm_senderrbufs(struct ipath_devdata *dd) |
77 | { | 47 | { |
78 | u32 piobcnt; | 48 | u32 piobcnt; |
79 | unsigned long sbuf[4]; | 49 | unsigned long sbuf[4]; |
@@ -109,11 +79,8 @@ void ipath_disarm_senderrbufs(struct ipath_devdata *dd, int rewrite) | |||
109 | } | 79 | } |
110 | 80 | ||
111 | for (i = 0; i < piobcnt; i++) | 81 | for (i = 0; i < piobcnt; i++) |
112 | if (test_bit(i, sbuf)) { | 82 | if (test_bit(i, sbuf)) |
113 | if (rewrite) | ||
114 | ipath_clrpiobuf(dd, i); | ||
115 | ipath_disarm_piobufs(dd, i, 1); | 83 | ipath_disarm_piobufs(dd, i, 1); |
116 | } | ||
117 | /* ignore armlaunch errs for a bit */ | 84 | /* ignore armlaunch errs for a bit */ |
118 | dd->ipath_lastcancel = jiffies+3; | 85 | dd->ipath_lastcancel = jiffies+3; |
119 | } | 86 | } |
@@ -164,7 +131,7 @@ static u64 handle_e_sum_errs(struct ipath_devdata *dd, ipath_err_t errs) | |||
164 | { | 131 | { |
165 | u64 ignore_this_time = 0; | 132 | u64 ignore_this_time = 0; |
166 | 133 | ||
167 | ipath_disarm_senderrbufs(dd, 0); | 134 | ipath_disarm_senderrbufs(dd); |
168 | if ((errs & E_SUM_LINK_PKTERRS) && | 135 | if ((errs & E_SUM_LINK_PKTERRS) && |
169 | !(dd->ipath_flags & IPATH_LINKACTIVE)) { | 136 | !(dd->ipath_flags & IPATH_LINKACTIVE)) { |
170 | /* | 137 | /* |
@@ -909,8 +876,8 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) | |||
909 | * processes (causing armlaunch), send errors due to going into freeze mode, | 876 | * processes (causing armlaunch), send errors due to going into freeze mode, |
910 | * etc., and try to avoid causing extra interrupts while doing so. | 877 | * etc., and try to avoid causing extra interrupts while doing so. |
911 | * Forcibly update the in-memory pioavail register copies after cleanup | 878 | * Forcibly update the in-memory pioavail register copies after cleanup |
912 | * because the chip won't do it for anything changing while in freeze mode | 879 | * because the chip won't do it while in freeze mode (the register values |
913 | * (we don't want to wait for the next pio buffer state change). | 880 | * themselves are kept correct). |
914 | * Make sure that we don't lose any important interrupts by using the chip | 881 | * Make sure that we don't lose any important interrupts by using the chip |
915 | * feature that says that writing 0 to a bit in *clear that is set in | 882 | * feature that says that writing 0 to a bit in *clear that is set in |
916 | * *status will cause an interrupt to be generated again (if allowed by | 883 | * *status will cause an interrupt to be generated again (if allowed by |
@@ -918,44 +885,23 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) | |||
918 | */ | 885 | */ |
919 | void ipath_clear_freeze(struct ipath_devdata *dd) | 886 | void ipath_clear_freeze(struct ipath_devdata *dd) |
920 | { | 887 | { |
921 | int i, im; | ||
922 | u64 val; | ||
923 | |||
924 | /* disable error interrupts, to avoid confusion */ | 888 | /* disable error interrupts, to avoid confusion */ |
925 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, 0ULL); | 889 | ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, 0ULL); |
926 | 890 | ||
927 | /* also disable interrupts; errormask is sometimes overwriten */ | 891 | /* also disable interrupts; errormask is sometimes overwriten */ |
928 | ipath_write_kreg(dd, dd->ipath_kregs->kr_intmask, 0ULL); | 892 | ipath_write_kreg(dd, dd->ipath_kregs->kr_intmask, 0ULL); |
929 | 893 | ||
930 | /* | 894 | ipath_cancel_sends(dd, 1); |
931 | * clear all sends, because they have may been | 895 | |
932 | * completed by usercode while in freeze mode, and | 896 | /* clear the freeze, and be sure chip saw it */ |
933 | * therefore would not be sent, and eventually | ||
934 | * might cause the process to run out of bufs | ||
935 | */ | ||
936 | ipath_cancel_sends(dd, 0); | ||
937 | ipath_write_kreg(dd, dd->ipath_kregs->kr_control, | 897 | ipath_write_kreg(dd, dd->ipath_kregs->kr_control, |
938 | dd->ipath_control); | 898 | dd->ipath_control); |
899 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); | ||
939 | 900 | ||
940 | /* ensure pio avail updates continue */ | 901 | /* force in-memory update now we are out of freeze */ |
941 | ipath_force_pio_avail_update(dd); | 902 | ipath_force_pio_avail_update(dd); |
942 | 903 | ||
943 | /* | 904 | /* |
944 | * We just enabled pioavailupdate, so dma copy is almost certainly | ||
945 | * not yet right, so read the registers directly. Similar to init | ||
946 | */ | ||
947 | for (i = 0; i < dd->ipath_pioavregs; i++) { | ||
948 | /* deal with 6110 chip bug */ | ||
949 | im = (i > 3 && (dd->ipath_flags & IPATH_SWAP_PIOBUFS)) ? | ||
950 | i ^ 1 : i; | ||
951 | val = ipath_read_kreg64(dd, (0x1000 / sizeof(u64)) + im); | ||
952 | dd->ipath_pioavailregs_dma[i] = cpu_to_le64(val); | ||
953 | dd->ipath_pioavailshadow[i] = val | | ||
954 | (~dd->ipath_pioavailkernel[i] << | ||
955 | INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT); | ||
956 | } | ||
957 | |||
958 | /* | ||
959 | * force new interrupt if any hwerr, error or interrupt bits are | 905 | * force new interrupt if any hwerr, error or interrupt bits are |
960 | * still set, and clear "safe" send packet errors related to freeze | 906 | * still set, and clear "safe" send packet errors related to freeze |
961 | * and cancelling sends. Re-enable error interrupts before possible | 907 | * and cancelling sends. Re-enable error interrupts before possible |
@@ -1312,10 +1258,8 @@ irqreturn_t ipath_intr(int irq, void *data) | |||
1312 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); | 1258 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); |
1313 | spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags); | 1259 | spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags); |
1314 | 1260 | ||
1315 | if (!(dd->ipath_flags & IPATH_HAS_SEND_DMA)) | 1261 | /* always process; sdma verbs uses PIO for acks and VL15 */ |
1316 | handle_layer_pioavail(dd); | 1262 | handle_layer_pioavail(dd); |
1317 | else | ||
1318 | ipath_dbg("unexpected BUFAVAIL intr\n"); | ||
1319 | } | 1263 | } |
1320 | 1264 | ||
1321 | ret = IRQ_HANDLED; | 1265 | ret = IRQ_HANDLED; |
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index 202337ae90d..02b24a34059 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h | |||
@@ -117,6 +117,10 @@ struct ipath_portdata { | |||
117 | u16 port_subport_cnt; | 117 | u16 port_subport_cnt; |
118 | /* non-zero if port is being shared. */ | 118 | /* non-zero if port is being shared. */ |
119 | u16 port_subport_id; | 119 | u16 port_subport_id; |
120 | /* number of pio bufs for this port (all procs, if shared) */ | ||
121 | u32 port_piocnt; | ||
122 | /* first pio buffer for this port */ | ||
123 | u32 port_pio_base; | ||
120 | /* chip offset of PIO buffers for this port */ | 124 | /* chip offset of PIO buffers for this port */ |
121 | u32 port_piobufs; | 125 | u32 port_piobufs; |
122 | /* how many alloc_pages() chunks in port_rcvegrbuf_pages */ | 126 | /* how many alloc_pages() chunks in port_rcvegrbuf_pages */ |
@@ -384,6 +388,8 @@ struct ipath_devdata { | |||
384 | u32 ipath_lastrpkts; | 388 | u32 ipath_lastrpkts; |
385 | /* pio bufs allocated per port */ | 389 | /* pio bufs allocated per port */ |
386 | u32 ipath_pbufsport; | 390 | u32 ipath_pbufsport; |
391 | /* if remainder on bufs/port, ports < extrabuf get 1 extra */ | ||
392 | u32 ipath_ports_extrabuf; | ||
387 | u32 ipath_pioupd_thresh; /* update threshold, some chips */ | 393 | u32 ipath_pioupd_thresh; /* update threshold, some chips */ |
388 | /* | 394 | /* |
389 | * number of ports configured as max; zero is set to number chip | 395 | * number of ports configured as max; zero is set to number chip |
@@ -1011,7 +1017,7 @@ void ipath_get_eeprom_info(struct ipath_devdata *); | |||
1011 | int ipath_update_eeprom_log(struct ipath_devdata *dd); | 1017 | int ipath_update_eeprom_log(struct ipath_devdata *dd); |
1012 | void ipath_inc_eeprom_err(struct ipath_devdata *dd, u32 eidx, u32 incr); | 1018 | void ipath_inc_eeprom_err(struct ipath_devdata *dd, u32 eidx, u32 incr); |
1013 | u64 ipath_snap_cntr(struct ipath_devdata *, ipath_creg); | 1019 | u64 ipath_snap_cntr(struct ipath_devdata *, ipath_creg); |
1014 | void ipath_disarm_senderrbufs(struct ipath_devdata *, int); | 1020 | void ipath_disarm_senderrbufs(struct ipath_devdata *); |
1015 | void ipath_force_pio_avail_update(struct ipath_devdata *); | 1021 | void ipath_force_pio_avail_update(struct ipath_devdata *); |
1016 | void signal_ib_event(struct ipath_devdata *dd, enum ib_event_type ev); | 1022 | void signal_ib_event(struct ipath_devdata *dd, enum ib_event_type ev); |
1017 | 1023 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c index c405dfba553..08b11b56761 100644 --- a/drivers/infiniband/hw/ipath/ipath_rc.c +++ b/drivers/infiniband/hw/ipath/ipath_rc.c | |||
@@ -1746,7 +1746,11 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, | |||
1746 | qp->r_wrid_valid = 0; | 1746 | qp->r_wrid_valid = 0; |
1747 | wc.wr_id = qp->r_wr_id; | 1747 | wc.wr_id = qp->r_wr_id; |
1748 | wc.status = IB_WC_SUCCESS; | 1748 | wc.status = IB_WC_SUCCESS; |
1749 | wc.opcode = IB_WC_RECV; | 1749 | if (opcode == OP(RDMA_WRITE_LAST_WITH_IMMEDIATE) || |
1750 | opcode == OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE)) | ||
1751 | wc.opcode = IB_WC_RECV_RDMA_WITH_IMM; | ||
1752 | else | ||
1753 | wc.opcode = IB_WC_RECV; | ||
1750 | wc.vendor_err = 0; | 1754 | wc.vendor_err = 0; |
1751 | wc.qp = &qp->ibqp; | 1755 | wc.qp = &qp->ibqp; |
1752 | wc.src_qp = qp->remote_qpn; | 1756 | wc.src_qp = qp->remote_qpn; |
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c index 8ac5c1d82cc..9e3fe61cbd0 100644 --- a/drivers/infiniband/hw/ipath/ipath_ruc.c +++ b/drivers/infiniband/hw/ipath/ipath_ruc.c | |||
@@ -481,9 +481,10 @@ done: | |||
481 | wake_up(&qp->wait); | 481 | wake_up(&qp->wait); |
482 | } | 482 | } |
483 | 483 | ||
484 | static void want_buffer(struct ipath_devdata *dd) | 484 | static void want_buffer(struct ipath_devdata *dd, struct ipath_qp *qp) |
485 | { | 485 | { |
486 | if (!(dd->ipath_flags & IPATH_HAS_SEND_DMA)) { | 486 | if (!(dd->ipath_flags & IPATH_HAS_SEND_DMA) || |
487 | qp->ibqp.qp_type == IB_QPT_SMI) { | ||
487 | unsigned long flags; | 488 | unsigned long flags; |
488 | 489 | ||
489 | spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); | 490 | spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); |
@@ -519,7 +520,7 @@ static void ipath_no_bufs_available(struct ipath_qp *qp, | |||
519 | spin_lock_irqsave(&dev->pending_lock, flags); | 520 | spin_lock_irqsave(&dev->pending_lock, flags); |
520 | list_add_tail(&qp->piowait, &dev->piowait); | 521 | list_add_tail(&qp->piowait, &dev->piowait); |
521 | spin_unlock_irqrestore(&dev->pending_lock, flags); | 522 | spin_unlock_irqrestore(&dev->pending_lock, flags); |
522 | want_buffer(dev->dd); | 523 | want_buffer(dev->dd, qp); |
523 | dev->n_piowait++; | 524 | dev->n_piowait++; |
524 | } | 525 | } |
525 | 526 | ||
diff --git a/drivers/infiniband/hw/ipath/ipath_sdma.c b/drivers/infiniband/hw/ipath/ipath_sdma.c index 1974df7a9f7..3697449c1ba 100644 --- a/drivers/infiniband/hw/ipath/ipath_sdma.c +++ b/drivers/infiniband/hw/ipath/ipath_sdma.c | |||
@@ -308,13 +308,15 @@ static void sdma_abort_task(unsigned long opaque) | |||
308 | spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); | 308 | spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); |
309 | 309 | ||
310 | /* | 310 | /* |
311 | * Don't restart sdma here. Wait until link is up to ACTIVE. | 311 | * Don't restart sdma here (with the exception |
312 | * VL15 MADs used to bring the link up use PIO, and multiple | 312 | * below). Wait until link is up to ACTIVE. VL15 MADs |
313 | * link transitions otherwise cause the sdma engine to be | 313 | * used to bring the link up use PIO, and multiple link |
314 | * transitions otherwise cause the sdma engine to be | ||
314 | * stopped and started multiple times. | 315 | * stopped and started multiple times. |
315 | * The disable is done here, including the shadow, so the | 316 | * The disable is done here, including the shadow, |
316 | * state is kept consistent. | 317 | * so the state is kept consistent. |
317 | * See ipath_restart_sdma() for the actual starting of sdma. | 318 | * See ipath_restart_sdma() for the actual starting |
319 | * of sdma. | ||
318 | */ | 320 | */ |
319 | spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); | 321 | spin_lock_irqsave(&dd->ipath_sendctrl_lock, flags); |
320 | dd->ipath_sendctrl &= ~INFINIPATH_S_SDMAENABLE; | 322 | dd->ipath_sendctrl &= ~INFINIPATH_S_SDMAENABLE; |
@@ -326,6 +328,13 @@ static void sdma_abort_task(unsigned long opaque) | |||
326 | /* make sure I see next message */ | 328 | /* make sure I see next message */ |
327 | dd->ipath_sdma_abort_jiffies = 0; | 329 | dd->ipath_sdma_abort_jiffies = 0; |
328 | 330 | ||
331 | /* | ||
332 | * Not everything that takes SDMA offline is a link | ||
333 | * status change. If the link was up, restart SDMA. | ||
334 | */ | ||
335 | if (dd->ipath_flags & IPATH_LINKACTIVE) | ||
336 | ipath_restart_sdma(dd); | ||
337 | |||
329 | goto done; | 338 | goto done; |
330 | } | 339 | } |
331 | 340 | ||
@@ -427,7 +436,12 @@ int setup_sdma(struct ipath_devdata *dd) | |||
427 | goto done; | 436 | goto done; |
428 | } | 437 | } |
429 | 438 | ||
430 | dd->ipath_sdma_status = 0; | 439 | /* |
440 | * Set initial status as if we had been up, then gone down. | ||
441 | * This lets initial start on transition to ACTIVE be the | ||
442 | * same as restart after link flap. | ||
443 | */ | ||
444 | dd->ipath_sdma_status = IPATH_SDMA_ABORT_ABORTED; | ||
431 | dd->ipath_sdma_abort_jiffies = 0; | 445 | dd->ipath_sdma_abort_jiffies = 0; |
432 | dd->ipath_sdma_generation = 0; | 446 | dd->ipath_sdma_generation = 0; |
433 | dd->ipath_sdma_descq_tail = 0; | 447 | dd->ipath_sdma_descq_tail = 0; |
@@ -449,16 +463,19 @@ int setup_sdma(struct ipath_devdata *dd) | |||
449 | ipath_write_kreg(dd, dd->ipath_kregs->kr_senddmaheadaddr, | 463 | ipath_write_kreg(dd, dd->ipath_kregs->kr_senddmaheadaddr, |
450 | dd->ipath_sdma_head_phys); | 464 | dd->ipath_sdma_head_phys); |
451 | 465 | ||
452 | /* Reserve all the former "kernel" piobufs */ | 466 | /* |
453 | n = dd->ipath_piobcnt2k + dd->ipath_piobcnt4k - dd->ipath_pioreserved; | 467 | * Reserve all the former "kernel" piobufs, using high number range |
454 | for (i = dd->ipath_lastport_piobuf; i < n; ++i) { | 468 | * so we get as many 4K buffers as possible |
469 | */ | ||
470 | n = dd->ipath_piobcnt2k + dd->ipath_piobcnt4k; | ||
471 | i = dd->ipath_lastport_piobuf + dd->ipath_pioreserved; | ||
472 | ipath_chg_pioavailkernel(dd, i, n - i , 0); | ||
473 | for (; i < n; ++i) { | ||
455 | unsigned word = i / 64; | 474 | unsigned word = i / 64; |
456 | unsigned bit = i & 63; | 475 | unsigned bit = i & 63; |
457 | BUG_ON(word >= 3); | 476 | BUG_ON(word >= 3); |
458 | senddmabufmask[word] |= 1ULL << bit; | 477 | senddmabufmask[word] |= 1ULL << bit; |
459 | } | 478 | } |
460 | ipath_chg_pioavailkernel(dd, dd->ipath_lastport_piobuf, | ||
461 | n - dd->ipath_lastport_piobuf, 0); | ||
462 | ipath_write_kreg(dd, dd->ipath_kregs->kr_senddmabufmask0, | 479 | ipath_write_kreg(dd, dd->ipath_kregs->kr_senddmabufmask0, |
463 | senddmabufmask[0]); | 480 | senddmabufmask[0]); |
464 | ipath_write_kreg(dd, dd->ipath_kregs->kr_senddmabufmask1, | 481 | ipath_write_kreg(dd, dd->ipath_kregs->kr_senddmabufmask1, |
@@ -615,6 +632,9 @@ void ipath_restart_sdma(struct ipath_devdata *dd) | |||
615 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); | 632 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); |
616 | spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags); | 633 | spin_unlock_irqrestore(&dd->ipath_sendctrl_lock, flags); |
617 | 634 | ||
635 | /* notify upper layers */ | ||
636 | ipath_ib_piobufavail(dd->verbs_dev); | ||
637 | |||
618 | bail: | 638 | bail: |
619 | return; | 639 | return; |
620 | } | 640 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index e63927cce5b..5015cd2e57b 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -396,7 +396,6 @@ static int ipath_post_one_send(struct ipath_qp *qp, struct ib_send_wr *wr) | |||
396 | 396 | ||
397 | wqe = get_swqe_ptr(qp, qp->s_head); | 397 | wqe = get_swqe_ptr(qp, qp->s_head); |
398 | wqe->wr = *wr; | 398 | wqe->wr = *wr; |
399 | wqe->ssn = qp->s_ssn++; | ||
400 | wqe->length = 0; | 399 | wqe->length = 0; |
401 | if (wr->num_sge) { | 400 | if (wr->num_sge) { |
402 | acc = wr->opcode >= IB_WR_RDMA_READ ? | 401 | acc = wr->opcode >= IB_WR_RDMA_READ ? |
@@ -422,6 +421,7 @@ static int ipath_post_one_send(struct ipath_qp *qp, struct ib_send_wr *wr) | |||
422 | goto bail_inval; | 421 | goto bail_inval; |
423 | } else if (wqe->length > to_idev(qp->ibqp.device)->dd->ipath_ibmtu) | 422 | } else if (wqe->length > to_idev(qp->ibqp.device)->dd->ipath_ibmtu) |
424 | goto bail_inval; | 423 | goto bail_inval; |
424 | wqe->ssn = qp->s_ssn++; | ||
425 | qp->s_head = next; | 425 | qp->s_head = next; |
426 | 426 | ||
427 | ret = 0; | 427 | ret = 0; |
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index 2f199c5c4a7..4521319b140 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -246,7 +246,7 @@ err_mtt: | |||
246 | if (context) | 246 | if (context) |
247 | ib_umem_release(cq->umem); | 247 | ib_umem_release(cq->umem); |
248 | else | 248 | else |
249 | mlx4_ib_free_cq_buf(dev, &cq->buf, entries); | 249 | mlx4_ib_free_cq_buf(dev, &cq->buf, cq->ibcq.cqe); |
250 | 250 | ||
251 | err_db: | 251 | err_db: |
252 | if (!context) | 252 | if (!context) |
@@ -434,7 +434,7 @@ int mlx4_ib_destroy_cq(struct ib_cq *cq) | |||
434 | mlx4_ib_db_unmap_user(to_mucontext(cq->uobject->context), &mcq->db); | 434 | mlx4_ib_db_unmap_user(to_mucontext(cq->uobject->context), &mcq->db); |
435 | ib_umem_release(mcq->umem); | 435 | ib_umem_release(mcq->umem); |
436 | } else { | 436 | } else { |
437 | mlx4_ib_free_cq_buf(dev, &mcq->buf, cq->cqe + 1); | 437 | mlx4_ib_free_cq_buf(dev, &mcq->buf, cq->cqe); |
438 | mlx4_db_free(dev->dev, &mcq->db); | 438 | mlx4_db_free(dev->dev, &mcq->db); |
439 | } | 439 | } |
440 | 440 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 9044f880353..ca126fc2b85 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -334,6 +334,7 @@ struct ipoib_dev_priv { | |||
334 | #endif | 334 | #endif |
335 | int hca_caps; | 335 | int hca_caps; |
336 | struct ipoib_ethtool_st ethtool; | 336 | struct ipoib_ethtool_st ethtool; |
337 | struct timer_list poll_timer; | ||
337 | }; | 338 | }; |
338 | 339 | ||
339 | struct ipoib_ah { | 340 | struct ipoib_ah { |
@@ -404,6 +405,7 @@ extern struct workqueue_struct *ipoib_workqueue; | |||
404 | 405 | ||
405 | int ipoib_poll(struct napi_struct *napi, int budget); | 406 | int ipoib_poll(struct napi_struct *napi, int budget); |
406 | void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr); | 407 | void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr); |
408 | void ipoib_send_comp_handler(struct ib_cq *cq, void *dev_ptr); | ||
407 | 409 | ||
408 | struct ipoib_ah *ipoib_create_ah(struct net_device *dev, | 410 | struct ipoib_ah *ipoib_create_ah(struct net_device *dev, |
409 | struct ib_pd *pd, struct ib_ah_attr *attr); | 411 | struct ib_pd *pd, struct ib_ah_attr *attr); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 97b815c1a3f..f429bce24c2 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -461,6 +461,26 @@ void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr) | |||
461 | netif_rx_schedule(dev, &priv->napi); | 461 | netif_rx_schedule(dev, &priv->napi); |
462 | } | 462 | } |
463 | 463 | ||
464 | static void drain_tx_cq(struct net_device *dev) | ||
465 | { | ||
466 | struct ipoib_dev_priv *priv = netdev_priv(dev); | ||
467 | unsigned long flags; | ||
468 | |||
469 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
470 | while (poll_tx(priv)) | ||
471 | ; /* nothing */ | ||
472 | |||
473 | if (netif_queue_stopped(dev)) | ||
474 | mod_timer(&priv->poll_timer, jiffies + 1); | ||
475 | |||
476 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
477 | } | ||
478 | |||
479 | void ipoib_send_comp_handler(struct ib_cq *cq, void *dev_ptr) | ||
480 | { | ||
481 | drain_tx_cq((struct net_device *)dev_ptr); | ||
482 | } | ||
483 | |||
464 | static inline int post_send(struct ipoib_dev_priv *priv, | 484 | static inline int post_send(struct ipoib_dev_priv *priv, |
465 | unsigned int wr_id, | 485 | unsigned int wr_id, |
466 | struct ib_ah *address, u32 qpn, | 486 | struct ib_ah *address, u32 qpn, |
@@ -555,12 +575,22 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb, | |||
555 | else | 575 | else |
556 | priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM; | 576 | priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM; |
557 | 577 | ||
578 | if (++priv->tx_outstanding == ipoib_sendq_size) { | ||
579 | ipoib_dbg(priv, "TX ring full, stopping kernel net queue\n"); | ||
580 | if (ib_req_notify_cq(priv->send_cq, IB_CQ_NEXT_COMP)) | ||
581 | ipoib_warn(priv, "request notify on send CQ failed\n"); | ||
582 | netif_stop_queue(dev); | ||
583 | } | ||
584 | |||
558 | if (unlikely(post_send(priv, priv->tx_head & (ipoib_sendq_size - 1), | 585 | if (unlikely(post_send(priv, priv->tx_head & (ipoib_sendq_size - 1), |
559 | address->ah, qpn, tx_req, phead, hlen))) { | 586 | address->ah, qpn, tx_req, phead, hlen))) { |
560 | ipoib_warn(priv, "post_send failed\n"); | 587 | ipoib_warn(priv, "post_send failed\n"); |
561 | ++dev->stats.tx_errors; | 588 | ++dev->stats.tx_errors; |
589 | --priv->tx_outstanding; | ||
562 | ipoib_dma_unmap_tx(priv->ca, tx_req); | 590 | ipoib_dma_unmap_tx(priv->ca, tx_req); |
563 | dev_kfree_skb_any(skb); | 591 | dev_kfree_skb_any(skb); |
592 | if (netif_queue_stopped(dev)) | ||
593 | netif_wake_queue(dev); | ||
564 | } else { | 594 | } else { |
565 | dev->trans_start = jiffies; | 595 | dev->trans_start = jiffies; |
566 | 596 | ||
@@ -568,14 +598,11 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb, | |||
568 | ++priv->tx_head; | 598 | ++priv->tx_head; |
569 | skb_orphan(skb); | 599 | skb_orphan(skb); |
570 | 600 | ||
571 | if (++priv->tx_outstanding == ipoib_sendq_size) { | ||
572 | ipoib_dbg(priv, "TX ring full, stopping kernel net queue\n"); | ||
573 | netif_stop_queue(dev); | ||
574 | } | ||
575 | } | 601 | } |
576 | 602 | ||
577 | if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) | 603 | if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) |
578 | poll_tx(priv); | 604 | while (poll_tx(priv)) |
605 | ; /* nothing */ | ||
579 | } | 606 | } |
580 | 607 | ||
581 | static void __ipoib_reap_ah(struct net_device *dev) | 608 | static void __ipoib_reap_ah(struct net_device *dev) |
@@ -609,6 +636,11 @@ void ipoib_reap_ah(struct work_struct *work) | |||
609 | round_jiffies_relative(HZ)); | 636 | round_jiffies_relative(HZ)); |
610 | } | 637 | } |
611 | 638 | ||
639 | static void ipoib_ib_tx_timer_func(unsigned long ctx) | ||
640 | { | ||
641 | drain_tx_cq((struct net_device *)ctx); | ||
642 | } | ||
643 | |||
612 | int ipoib_ib_dev_open(struct net_device *dev) | 644 | int ipoib_ib_dev_open(struct net_device *dev) |
613 | { | 645 | { |
614 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 646 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
@@ -645,6 +677,10 @@ int ipoib_ib_dev_open(struct net_device *dev) | |||
645 | queue_delayed_work(ipoib_workqueue, &priv->ah_reap_task, | 677 | queue_delayed_work(ipoib_workqueue, &priv->ah_reap_task, |
646 | round_jiffies_relative(HZ)); | 678 | round_jiffies_relative(HZ)); |
647 | 679 | ||
680 | init_timer(&priv->poll_timer); | ||
681 | priv->poll_timer.function = ipoib_ib_tx_timer_func; | ||
682 | priv->poll_timer.data = (unsigned long)dev; | ||
683 | |||
648 | set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); | 684 | set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags); |
649 | 685 | ||
650 | return 0; | 686 | return 0; |
@@ -810,6 +846,7 @@ int ipoib_ib_dev_stop(struct net_device *dev, int flush) | |||
810 | ipoib_dbg(priv, "All sends and receives done.\n"); | 846 | ipoib_dbg(priv, "All sends and receives done.\n"); |
811 | 847 | ||
812 | timeout: | 848 | timeout: |
849 | del_timer_sync(&priv->poll_timer); | ||
813 | qp_attr.qp_state = IB_QPS_RESET; | 850 | qp_attr.qp_state = IB_QPS_RESET; |
814 | if (ib_modify_qp(priv->qp, &qp_attr, IB_QP_STATE)) | 851 | if (ib_modify_qp(priv->qp, &qp_attr, IB_QP_STATE)) |
815 | ipoib_warn(priv, "Failed to modify QP to RESET state\n"); | 852 | ipoib_warn(priv, "Failed to modify QP to RESET state\n"); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index c1e7ece1fd4..8766d29ce3b 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c | |||
@@ -187,7 +187,8 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca) | |||
187 | goto out_free_mr; | 187 | goto out_free_mr; |
188 | } | 188 | } |
189 | 189 | ||
190 | priv->send_cq = ib_create_cq(priv->ca, NULL, NULL, dev, ipoib_sendq_size, 0); | 190 | priv->send_cq = ib_create_cq(priv->ca, ipoib_send_comp_handler, NULL, |
191 | dev, ipoib_sendq_size, 0); | ||
191 | if (IS_ERR(priv->send_cq)) { | 192 | if (IS_ERR(priv->send_cq)) { |
192 | printk(KERN_WARNING "%s: failed to create send CQ\n", ca->name); | 193 | printk(KERN_WARNING "%s: failed to create send CQ\n", ca->name); |
193 | goto out_free_recv_cq; | 194 | goto out_free_recv_cq; |
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 92b683411d5..3ad8bd9f754 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -14,7 +14,7 @@ if INPUT_MISC | |||
14 | 14 | ||
15 | config INPUT_PCSPKR | 15 | config INPUT_PCSPKR |
16 | tristate "PC Speaker support" | 16 | tristate "PC Speaker support" |
17 | depends on ALPHA || X86 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES | 17 | depends on PCSPKR_PLATFORM |
18 | depends on SND_PCSP=n | 18 | depends on SND_PCSP=n |
19 | help | 19 | help |
20 | Say Y here if you want the standard PC Speaker to be used for | 20 | Say Y here if you want the standard PC Speaker to be used for |
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c index 02b3ad8c082..edfedd9a166 100644 --- a/drivers/input/serio/hp_sdc.c +++ b/drivers/input/serio/hp_sdc.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #include <linux/time.h> | 69 | #include <linux/time.h> |
70 | #include <linux/slab.h> | 70 | #include <linux/slab.h> |
71 | #include <linux/hil.h> | 71 | #include <linux/hil.h> |
72 | #include <linux/semaphore.h> | ||
72 | #include <asm/io.h> | 73 | #include <asm/io.h> |
73 | #include <asm/system.h> | 74 | #include <asm/system.h> |
74 | 75 | ||
diff --git a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h index 3b4e13b9ce1..f451c7351a9 100644 --- a/drivers/input/serio/i8042-io.h +++ b/drivers/input/serio/i8042-io.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #elif defined(__arm__) | 25 | #elif defined(__arm__) |
26 | /* defined in include/asm-arm/arch-xxx/irqs.h */ | 26 | /* defined in include/asm-arm/arch-xxx/irqs.h */ |
27 | #include <asm/irq.h> | 27 | #include <asm/irq.h> |
28 | #elif defined(CONFIG_SUPERH64) | 28 | #elif defined(CONFIG_SH_CAYMAN) |
29 | #include <asm/irq.h> | 29 | #include <asm/irq.h> |
30 | #else | 30 | #else |
31 | # define I8042_KBD_IRQ 1 | 31 | # define I8042_KBD_IRQ 1 |
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index 20978205cd0..b8b9e44f7f4 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/device.h> | 37 | #include <linux/device.h> |
38 | #include <linux/kthread.h> | 38 | #include <linux/kthread.h> |
39 | #include <linux/platform_device.h> | 39 | #include <linux/platform_device.h> |
40 | #include <linux/semaphore.h> | 40 | #include <linux/mutex.h> |
41 | 41 | ||
42 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
43 | #ifdef CONFIG_PPC | 43 | #ifdef CONFIG_PPC |
@@ -102,7 +102,7 @@ static struct adb_handler { | |||
102 | } adb_handler[16]; | 102 | } adb_handler[16]; |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * The adb_handler_sem mutex protects all accesses to the original_address | 105 | * The adb_handler_mutex mutex protects all accesses to the original_address |
106 | * and handler_id fields of adb_handler[i] for all i, and changes to the | 106 | * and handler_id fields of adb_handler[i] for all i, and changes to the |
107 | * handler field. | 107 | * handler field. |
108 | * Accesses to the handler field are protected by the adb_handler_lock | 108 | * Accesses to the handler field are protected by the adb_handler_lock |
@@ -110,7 +110,7 @@ static struct adb_handler { | |||
110 | * time adb_unregister returns, we know that the old handler isn't being | 110 | * time adb_unregister returns, we know that the old handler isn't being |
111 | * called. | 111 | * called. |
112 | */ | 112 | */ |
113 | static DECLARE_MUTEX(adb_handler_sem); | 113 | static DEFINE_MUTEX(adb_handler_mutex); |
114 | static DEFINE_RWLOCK(adb_handler_lock); | 114 | static DEFINE_RWLOCK(adb_handler_lock); |
115 | 115 | ||
116 | #if 0 | 116 | #if 0 |
@@ -355,7 +355,7 @@ do_adb_reset_bus(void) | |||
355 | msleep(500); | 355 | msleep(500); |
356 | } | 356 | } |
357 | 357 | ||
358 | down(&adb_handler_sem); | 358 | mutex_lock(&adb_handler_mutex); |
359 | write_lock_irq(&adb_handler_lock); | 359 | write_lock_irq(&adb_handler_lock); |
360 | memset(adb_handler, 0, sizeof(adb_handler)); | 360 | memset(adb_handler, 0, sizeof(adb_handler)); |
361 | write_unlock_irq(&adb_handler_lock); | 361 | write_unlock_irq(&adb_handler_lock); |
@@ -376,7 +376,7 @@ do_adb_reset_bus(void) | |||
376 | if (adb_controller->autopoll) | 376 | if (adb_controller->autopoll) |
377 | adb_controller->autopoll(autopoll_devs); | 377 | adb_controller->autopoll(autopoll_devs); |
378 | } | 378 | } |
379 | up(&adb_handler_sem); | 379 | mutex_unlock(&adb_handler_mutex); |
380 | 380 | ||
381 | blocking_notifier_call_chain(&adb_client_list, | 381 | blocking_notifier_call_chain(&adb_client_list, |
382 | ADB_MSG_POST_RESET, NULL); | 382 | ADB_MSG_POST_RESET, NULL); |
@@ -454,7 +454,7 @@ adb_register(int default_id, int handler_id, struct adb_ids *ids, | |||
454 | { | 454 | { |
455 | int i; | 455 | int i; |
456 | 456 | ||
457 | down(&adb_handler_sem); | 457 | mutex_lock(&adb_handler_mutex); |
458 | ids->nids = 0; | 458 | ids->nids = 0; |
459 | for (i = 1; i < 16; i++) { | 459 | for (i = 1; i < 16; i++) { |
460 | if ((adb_handler[i].original_address == default_id) && | 460 | if ((adb_handler[i].original_address == default_id) && |
@@ -472,7 +472,7 @@ adb_register(int default_id, int handler_id, struct adb_ids *ids, | |||
472 | ids->id[ids->nids++] = i; | 472 | ids->id[ids->nids++] = i; |
473 | } | 473 | } |
474 | } | 474 | } |
475 | up(&adb_handler_sem); | 475 | mutex_unlock(&adb_handler_mutex); |
476 | return ids->nids; | 476 | return ids->nids; |
477 | } | 477 | } |
478 | 478 | ||
@@ -481,7 +481,7 @@ adb_unregister(int index) | |||
481 | { | 481 | { |
482 | int ret = -ENODEV; | 482 | int ret = -ENODEV; |
483 | 483 | ||
484 | down(&adb_handler_sem); | 484 | mutex_lock(&adb_handler_mutex); |
485 | write_lock_irq(&adb_handler_lock); | 485 | write_lock_irq(&adb_handler_lock); |
486 | if (adb_handler[index].handler) { | 486 | if (adb_handler[index].handler) { |
487 | while(adb_handler[index].busy) { | 487 | while(adb_handler[index].busy) { |
@@ -493,7 +493,7 @@ adb_unregister(int index) | |||
493 | adb_handler[index].handler = NULL; | 493 | adb_handler[index].handler = NULL; |
494 | } | 494 | } |
495 | write_unlock_irq(&adb_handler_lock); | 495 | write_unlock_irq(&adb_handler_lock); |
496 | up(&adb_handler_sem); | 496 | mutex_unlock(&adb_handler_mutex); |
497 | return ret; | 497 | return ret; |
498 | } | 498 | } |
499 | 499 | ||
@@ -557,19 +557,19 @@ adb_try_handler_change(int address, int new_id) | |||
557 | { | 557 | { |
558 | int ret; | 558 | int ret; |
559 | 559 | ||
560 | down(&adb_handler_sem); | 560 | mutex_lock(&adb_handler_mutex); |
561 | ret = try_handler_change(address, new_id); | 561 | ret = try_handler_change(address, new_id); |
562 | up(&adb_handler_sem); | 562 | mutex_unlock(&adb_handler_mutex); |
563 | return ret; | 563 | return ret; |
564 | } | 564 | } |
565 | 565 | ||
566 | int | 566 | int |
567 | adb_get_infos(int address, int *original_address, int *handler_id) | 567 | adb_get_infos(int address, int *original_address, int *handler_id) |
568 | { | 568 | { |
569 | down(&adb_handler_sem); | 569 | mutex_lock(&adb_handler_mutex); |
570 | *original_address = adb_handler[address].original_address; | 570 | *original_address = adb_handler[address].original_address; |
571 | *handler_id = adb_handler[address].handler_id; | 571 | *handler_id = adb_handler[address].handler_id; |
572 | up(&adb_handler_sem); | 572 | mutex_unlock(&adb_handler_mutex); |
573 | 573 | ||
574 | return (*original_address != 0); | 574 | return (*original_address != 0); |
575 | } | 575 | } |
@@ -628,10 +628,10 @@ do_adb_query(struct adb_request *req) | |||
628 | case ADB_QUERY_GETDEVINFO: | 628 | case ADB_QUERY_GETDEVINFO: |
629 | if (req->nbytes < 3) | 629 | if (req->nbytes < 3) |
630 | break; | 630 | break; |
631 | down(&adb_handler_sem); | 631 | mutex_lock(&adb_handler_mutex); |
632 | req->reply[0] = adb_handler[req->data[2]].original_address; | 632 | req->reply[0] = adb_handler[req->data[2]].original_address; |
633 | req->reply[1] = adb_handler[req->data[2]].handler_id; | 633 | req->reply[1] = adb_handler[req->data[2]].handler_id; |
634 | up(&adb_handler_sem); | 634 | mutex_unlock(&adb_handler_mutex); |
635 | req->complete = 1; | 635 | req->complete = 1; |
636 | req->reply_len = 2; | 636 | req->reply_len = 2; |
637 | adb_write_done(req); | 637 | adb_write_done(req); |
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 1e0a69a5e81..ddfb426a9ab 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
@@ -122,6 +122,7 @@ | |||
122 | #include <linux/kmod.h> | 122 | #include <linux/kmod.h> |
123 | #include <linux/i2c.h> | 123 | #include <linux/i2c.h> |
124 | #include <linux/kthread.h> | 124 | #include <linux/kthread.h> |
125 | #include <linux/mutex.h> | ||
125 | #include <asm/prom.h> | 126 | #include <asm/prom.h> |
126 | #include <asm/machdep.h> | 127 | #include <asm/machdep.h> |
127 | #include <asm/io.h> | 128 | #include <asm/io.h> |
@@ -169,7 +170,7 @@ static int rackmac; | |||
169 | static s32 dimm_output_clamp; | 170 | static s32 dimm_output_clamp; |
170 | static int fcu_rpm_shift; | 171 | static int fcu_rpm_shift; |
171 | static int fcu_tickle_ticks; | 172 | static int fcu_tickle_ticks; |
172 | static DECLARE_MUTEX(driver_lock); | 173 | static DEFINE_MUTEX(driver_lock); |
173 | 174 | ||
174 | /* | 175 | /* |
175 | * We have 3 types of CPU PID control. One is "split" old style control | 176 | * We have 3 types of CPU PID control. One is "split" old style control |
@@ -729,9 +730,9 @@ static void fetch_cpu_pumps_minmax(void) | |||
729 | static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ | 730 | static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ |
730 | { \ | 731 | { \ |
731 | ssize_t r; \ | 732 | ssize_t r; \ |
732 | down(&driver_lock); \ | 733 | mutex_lock(&driver_lock); \ |
733 | r = sprintf(buf, "%d.%03d", FIX32TOPRINT(data)); \ | 734 | r = sprintf(buf, "%d.%03d", FIX32TOPRINT(data)); \ |
734 | up(&driver_lock); \ | 735 | mutex_unlock(&driver_lock); \ |
735 | return r; \ | 736 | return r; \ |
736 | } | 737 | } |
737 | #define BUILD_SHOW_FUNC_INT(name, data) \ | 738 | #define BUILD_SHOW_FUNC_INT(name, data) \ |
@@ -1803,11 +1804,11 @@ static int main_control_loop(void *x) | |||
1803 | { | 1804 | { |
1804 | DBG("main_control_loop started\n"); | 1805 | DBG("main_control_loop started\n"); |
1805 | 1806 | ||
1806 | down(&driver_lock); | 1807 | mutex_lock(&driver_lock); |
1807 | 1808 | ||
1808 | if (start_fcu() < 0) { | 1809 | if (start_fcu() < 0) { |
1809 | printk(KERN_ERR "kfand: failed to start FCU\n"); | 1810 | printk(KERN_ERR "kfand: failed to start FCU\n"); |
1810 | up(&driver_lock); | 1811 | mutex_unlock(&driver_lock); |
1811 | goto out; | 1812 | goto out; |
1812 | } | 1813 | } |
1813 | 1814 | ||
@@ -1822,14 +1823,14 @@ static int main_control_loop(void *x) | |||
1822 | 1823 | ||
1823 | fcu_tickle_ticks = FCU_TICKLE_TICKS; | 1824 | fcu_tickle_ticks = FCU_TICKLE_TICKS; |
1824 | 1825 | ||
1825 | up(&driver_lock); | 1826 | mutex_unlock(&driver_lock); |
1826 | 1827 | ||
1827 | while (state == state_attached) { | 1828 | while (state == state_attached) { |
1828 | unsigned long elapsed, start; | 1829 | unsigned long elapsed, start; |
1829 | 1830 | ||
1830 | start = jiffies; | 1831 | start = jiffies; |
1831 | 1832 | ||
1832 | down(&driver_lock); | 1833 | mutex_lock(&driver_lock); |
1833 | 1834 | ||
1834 | /* Tickle the FCU just in case */ | 1835 | /* Tickle the FCU just in case */ |
1835 | if (--fcu_tickle_ticks < 0) { | 1836 | if (--fcu_tickle_ticks < 0) { |
@@ -1861,7 +1862,7 @@ static int main_control_loop(void *x) | |||
1861 | do_monitor_slots(&slots_state); | 1862 | do_monitor_slots(&slots_state); |
1862 | else | 1863 | else |
1863 | do_monitor_drives(&drives_state); | 1864 | do_monitor_drives(&drives_state); |
1864 | up(&driver_lock); | 1865 | mutex_unlock(&driver_lock); |
1865 | 1866 | ||
1866 | if (critical_state == 1) { | 1867 | if (critical_state == 1) { |
1867 | printk(KERN_WARNING "Temperature control detected a critical condition\n"); | 1868 | printk(KERN_WARNING "Temperature control detected a critical condition\n"); |
@@ -2019,13 +2020,13 @@ static void detach_fcu(void) | |||
2019 | */ | 2020 | */ |
2020 | static int therm_pm72_attach(struct i2c_adapter *adapter) | 2021 | static int therm_pm72_attach(struct i2c_adapter *adapter) |
2021 | { | 2022 | { |
2022 | down(&driver_lock); | 2023 | mutex_lock(&driver_lock); |
2023 | 2024 | ||
2024 | /* Check state */ | 2025 | /* Check state */ |
2025 | if (state == state_detached) | 2026 | if (state == state_detached) |
2026 | state = state_attaching; | 2027 | state = state_attaching; |
2027 | if (state != state_attaching) { | 2028 | if (state != state_attaching) { |
2028 | up(&driver_lock); | 2029 | mutex_unlock(&driver_lock); |
2029 | return 0; | 2030 | return 0; |
2030 | } | 2031 | } |
2031 | 2032 | ||
@@ -2054,7 +2055,7 @@ static int therm_pm72_attach(struct i2c_adapter *adapter) | |||
2054 | state = state_attached; | 2055 | state = state_attached; |
2055 | start_control_loops(); | 2056 | start_control_loops(); |
2056 | } | 2057 | } |
2057 | up(&driver_lock); | 2058 | mutex_unlock(&driver_lock); |
2058 | 2059 | ||
2059 | return 0; | 2060 | return 0; |
2060 | } | 2061 | } |
@@ -2065,16 +2066,16 @@ static int therm_pm72_attach(struct i2c_adapter *adapter) | |||
2065 | */ | 2066 | */ |
2066 | static int therm_pm72_detach(struct i2c_adapter *adapter) | 2067 | static int therm_pm72_detach(struct i2c_adapter *adapter) |
2067 | { | 2068 | { |
2068 | down(&driver_lock); | 2069 | mutex_lock(&driver_lock); |
2069 | 2070 | ||
2070 | if (state != state_detached) | 2071 | if (state != state_detached) |
2071 | state = state_detaching; | 2072 | state = state_detaching; |
2072 | 2073 | ||
2073 | /* Stop control loops if any */ | 2074 | /* Stop control loops if any */ |
2074 | DBG("stopping control loops\n"); | 2075 | DBG("stopping control loops\n"); |
2075 | up(&driver_lock); | 2076 | mutex_unlock(&driver_lock); |
2076 | stop_control_loops(); | 2077 | stop_control_loops(); |
2077 | down(&driver_lock); | 2078 | mutex_lock(&driver_lock); |
2078 | 2079 | ||
2079 | if (u3_0 != NULL && !strcmp(adapter->name, "u3 0")) { | 2080 | if (u3_0 != NULL && !strcmp(adapter->name, "u3 0")) { |
2080 | DBG("lost U3-0, disposing control loops\n"); | 2081 | DBG("lost U3-0, disposing control loops\n"); |
@@ -2090,7 +2091,7 @@ static int therm_pm72_detach(struct i2c_adapter *adapter) | |||
2090 | if (u3_0 == NULL && u3_1 == NULL) | 2091 | if (u3_0 == NULL && u3_1 == NULL) |
2091 | state = state_detached; | 2092 | state = state_detached; |
2092 | 2093 | ||
2093 | up(&driver_lock); | 2094 | mutex_unlock(&driver_lock); |
2094 | 2095 | ||
2095 | return 0; | 2096 | return 0; |
2096 | } | 2097 | } |
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c index 797918d0e59..7f2be4baaed 100644 --- a/drivers/macintosh/windfarm_smu_sat.c +++ b/drivers/macintosh/windfarm_smu_sat.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/wait.h> | 14 | #include <linux/wait.h> |
15 | #include <linux/i2c.h> | 15 | #include <linux/i2c.h> |
16 | #include <linux/semaphore.h> | 16 | #include <linux/mutex.h> |
17 | #include <asm/prom.h> | 17 | #include <asm/prom.h> |
18 | #include <asm/smu.h> | 18 | #include <asm/smu.h> |
19 | #include <asm/pmac_low_i2c.h> | 19 | #include <asm/pmac_low_i2c.h> |
@@ -36,7 +36,7 @@ | |||
36 | struct wf_sat { | 36 | struct wf_sat { |
37 | int nr; | 37 | int nr; |
38 | atomic_t refcnt; | 38 | atomic_t refcnt; |
39 | struct semaphore mutex; | 39 | struct mutex mutex; |
40 | unsigned long last_read; /* jiffies when cache last updated */ | 40 | unsigned long last_read; /* jiffies when cache last updated */ |
41 | u8 cache[16]; | 41 | u8 cache[16]; |
42 | struct i2c_client i2c; | 42 | struct i2c_client i2c; |
@@ -163,7 +163,7 @@ static int wf_sat_get(struct wf_sensor *sr, s32 *value) | |||
163 | if (sat->i2c.adapter == NULL) | 163 | if (sat->i2c.adapter == NULL) |
164 | return -ENODEV; | 164 | return -ENODEV; |
165 | 165 | ||
166 | down(&sat->mutex); | 166 | mutex_lock(&sat->mutex); |
167 | if (time_after(jiffies, (sat->last_read + MAX_AGE))) { | 167 | if (time_after(jiffies, (sat->last_read + MAX_AGE))) { |
168 | err = wf_sat_read_cache(sat); | 168 | err = wf_sat_read_cache(sat); |
169 | if (err) | 169 | if (err) |
@@ -182,7 +182,7 @@ static int wf_sat_get(struct wf_sensor *sr, s32 *value) | |||
182 | err = 0; | 182 | err = 0; |
183 | 183 | ||
184 | fail: | 184 | fail: |
185 | up(&sat->mutex); | 185 | mutex_unlock(&sat->mutex); |
186 | return err; | 186 | return err; |
187 | } | 187 | } |
188 | 188 | ||
@@ -233,7 +233,7 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev) | |||
233 | sat->nr = -1; | 233 | sat->nr = -1; |
234 | sat->node = of_node_get(dev); | 234 | sat->node = of_node_get(dev); |
235 | atomic_set(&sat->refcnt, 0); | 235 | atomic_set(&sat->refcnt, 0); |
236 | init_MUTEX(&sat->mutex); | 236 | mutex_init(&sat->mutex); |
237 | sat->i2c.addr = (addr >> 1) & 0x7f; | 237 | sat->i2c.addr = (addr >> 1) & 0x7f; |
238 | sat->i2c.adapter = adapter; | 238 | sat->i2c.adapter = adapter; |
239 | sat->i2c.driver = &wf_sat_driver; | 239 | sat->i2c.driver = &wf_sat_driver; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 5938fa96292..faf3d891297 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -886,7 +886,7 @@ static int make_request(struct request_queue *q, struct bio * bio) | |||
886 | */ | 886 | */ |
887 | raid10_find_phys(conf, r10_bio); | 887 | raid10_find_phys(conf, r10_bio); |
888 | retry_write: | 888 | retry_write: |
889 | blocked_rdev = 0; | 889 | blocked_rdev = NULL; |
890 | rcu_read_lock(); | 890 | rcu_read_lock(); |
891 | for (i = 0; i < conf->copies; i++) { | 891 | for (i = 0; i < conf->copies; i++) { |
892 | int d = r10_bio->devs[i].devnum; | 892 | int d = r10_bio->devs[i].devnum; |
diff --git a/drivers/media/Makefile b/drivers/media/Makefile index 73f742c7e81..cc11c4c0e7e 100644 --- a/drivers/media/Makefile +++ b/drivers/media/Makefile | |||
@@ -2,6 +2,8 @@ | |||
2 | # Makefile for the kernel multimedia device drivers. | 2 | # Makefile for the kernel multimedia device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := common/ | ||
6 | |||
5 | obj-$(CONFIG_VIDEO_MEDIA) += common/ | 7 | obj-$(CONFIG_VIDEO_MEDIA) += common/ |
6 | 8 | ||
7 | # Since hybrid devices are here, should be compiled if DVB and/or V4L | 9 | # Since hybrid devices are here, should be compiled if DVB and/or V4L |
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index 8f5ed9b4bf8..3f55d47bc4b 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c | |||
@@ -613,7 +613,7 @@ static int __devinit cx18_probe(struct pci_dev *dev, | |||
613 | } | 613 | } |
614 | 614 | ||
615 | cx = kzalloc(sizeof(struct cx18), GFP_ATOMIC); | 615 | cx = kzalloc(sizeof(struct cx18), GFP_ATOMIC); |
616 | if (cx == 0) { | 616 | if (!cx) { |
617 | spin_unlock(&cx18_cards_lock); | 617 | spin_unlock(&cx18_cards_lock); |
618 | return -ENOMEM; | 618 | return -ENOMEM; |
619 | } | 619 | } |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index a0baf2d0ba7..48e1a01718e 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1634,7 +1634,7 @@ static int saa7134_s_fmt_overlay(struct file *file, void *priv, | |||
1634 | struct saa7134_fh *fh = priv; | 1634 | struct saa7134_fh *fh = priv; |
1635 | struct saa7134_dev *dev = fh->dev; | 1635 | struct saa7134_dev *dev = fh->dev; |
1636 | int err; | 1636 | int err; |
1637 | unsigned int flags; | 1637 | unsigned long flags; |
1638 | 1638 | ||
1639 | if (saa7134_no_overlay > 0) { | 1639 | if (saa7134_no_overlay > 0) { |
1640 | printk(KERN_ERR "V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n"); | 1640 | printk(KERN_ERR "V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n"); |
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index 30a1af857c7..fa394104339 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c | |||
@@ -47,6 +47,7 @@ | |||
47 | * to test the HW NMI watchdog | 47 | * to test the HW NMI watchdog |
48 | * F## = Break at do_fork for ## iterations | 48 | * F## = Break at do_fork for ## iterations |
49 | * S## = Break at sys_open for ## iterations | 49 | * S## = Break at sys_open for ## iterations |
50 | * I## = Run the single step test ## iterations | ||
50 | * | 51 | * |
51 | * NOTE: that the do_fork and sys_open tests are mutually exclusive. | 52 | * NOTE: that the do_fork and sys_open tests are mutually exclusive. |
52 | * | 53 | * |
@@ -375,7 +376,7 @@ static void emul_sstep_get(char *arg) | |||
375 | break; | 376 | break; |
376 | case 1: | 377 | case 1: |
377 | /* set breakpoint */ | 378 | /* set breakpoint */ |
378 | break_helper("Z0", 0, sstep_addr); | 379 | break_helper("Z0", NULL, sstep_addr); |
379 | break; | 380 | break; |
380 | case 2: | 381 | case 2: |
381 | /* Continue */ | 382 | /* Continue */ |
@@ -383,7 +384,7 @@ static void emul_sstep_get(char *arg) | |||
383 | break; | 384 | break; |
384 | case 3: | 385 | case 3: |
385 | /* Clear breakpoint */ | 386 | /* Clear breakpoint */ |
386 | break_helper("z0", 0, sstep_addr); | 387 | break_helper("z0", NULL, sstep_addr); |
387 | break; | 388 | break; |
388 | default: | 389 | default: |
389 | eprintk("kgdbts: ERROR failed sstep get emulation\n"); | 390 | eprintk("kgdbts: ERROR failed sstep get emulation\n"); |
@@ -465,11 +466,11 @@ static struct test_struct sw_breakpoint_test[] = { | |||
465 | { "?", "S0*" }, /* Clear break points */ | 466 | { "?", "S0*" }, /* Clear break points */ |
466 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ | 467 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ |
467 | { "c", "T0*", }, /* Continue */ | 468 | { "c", "T0*", }, /* Continue */ |
468 | { "g", "kgdbts_break_test", 0, check_and_rewind_pc }, | 469 | { "g", "kgdbts_break_test", NULL, check_and_rewind_pc }, |
469 | { "write", "OK", write_regs }, | 470 | { "write", "OK", write_regs }, |
470 | { "kgdbts_break_test", "OK", sw_rem_break }, /*remove breakpoint */ | 471 | { "kgdbts_break_test", "OK", sw_rem_break }, /*remove breakpoint */ |
471 | { "D", "OK" }, /* Detach */ | 472 | { "D", "OK" }, /* Detach */ |
472 | { "D", "OK", 0, got_break }, /* If the test worked we made it here */ | 473 | { "D", "OK", NULL, got_break }, /* On success we made it here */ |
473 | { "", "" }, | 474 | { "", "" }, |
474 | }; | 475 | }; |
475 | 476 | ||
@@ -499,14 +500,14 @@ static struct test_struct singlestep_break_test[] = { | |||
499 | { "?", "S0*" }, /* Clear break points */ | 500 | { "?", "S0*" }, /* Clear break points */ |
500 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ | 501 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ |
501 | { "c", "T0*", }, /* Continue */ | 502 | { "c", "T0*", }, /* Continue */ |
502 | { "g", "kgdbts_break_test", 0, check_and_rewind_pc }, | 503 | { "g", "kgdbts_break_test", NULL, check_and_rewind_pc }, |
503 | { "write", "OK", write_regs }, /* Write registers */ | 504 | { "write", "OK", write_regs }, /* Write registers */ |
504 | { "kgdbts_break_test", "OK", sw_rem_break }, /*remove breakpoint */ | 505 | { "kgdbts_break_test", "OK", sw_rem_break }, /*remove breakpoint */ |
505 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ | 506 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ |
506 | { "g", "kgdbts_break_test", 0, check_single_step }, | 507 | { "g", "kgdbts_break_test", NULL, check_single_step }, |
507 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ | 508 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ |
508 | { "c", "T0*", }, /* Continue */ | 509 | { "c", "T0*", }, /* Continue */ |
509 | { "g", "kgdbts_break_test", 0, check_and_rewind_pc }, | 510 | { "g", "kgdbts_break_test", NULL, check_and_rewind_pc }, |
510 | { "write", "OK", write_regs }, /* Write registers */ | 511 | { "write", "OK", write_regs }, /* Write registers */ |
511 | { "D", "OK" }, /* Remove all breakpoints and continues */ | 512 | { "D", "OK" }, /* Remove all breakpoints and continues */ |
512 | { "", "" }, | 513 | { "", "" }, |
@@ -520,14 +521,14 @@ static struct test_struct do_fork_test[] = { | |||
520 | { "?", "S0*" }, /* Clear break points */ | 521 | { "?", "S0*" }, /* Clear break points */ |
521 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ | 522 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ |
522 | { "c", "T0*", }, /* Continue */ | 523 | { "c", "T0*", }, /* Continue */ |
523 | { "g", "do_fork", 0, check_and_rewind_pc }, /* check location */ | 524 | { "g", "do_fork", NULL, check_and_rewind_pc }, /* check location */ |
524 | { "write", "OK", write_regs }, /* Write registers */ | 525 | { "write", "OK", write_regs }, /* Write registers */ |
525 | { "do_fork", "OK", sw_rem_break }, /*remove breakpoint */ | 526 | { "do_fork", "OK", sw_rem_break }, /*remove breakpoint */ |
526 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ | 527 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ |
527 | { "g", "do_fork", 0, check_single_step }, | 528 | { "g", "do_fork", NULL, check_single_step }, |
528 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ | 529 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ |
529 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ | 530 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ |
530 | { "D", "OK", 0, final_ack_set }, /* detach and unregister I/O */ | 531 | { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ |
531 | { "", "" }, | 532 | { "", "" }, |
532 | }; | 533 | }; |
533 | 534 | ||
@@ -538,14 +539,14 @@ static struct test_struct sys_open_test[] = { | |||
538 | { "?", "S0*" }, /* Clear break points */ | 539 | { "?", "S0*" }, /* Clear break points */ |
539 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ | 540 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ |
540 | { "c", "T0*", }, /* Continue */ | 541 | { "c", "T0*", }, /* Continue */ |
541 | { "g", "sys_open", 0, check_and_rewind_pc }, /* check location */ | 542 | { "g", "sys_open", NULL, check_and_rewind_pc }, /* check location */ |
542 | { "write", "OK", write_regs }, /* Write registers */ | 543 | { "write", "OK", write_regs }, /* Write registers */ |
543 | { "sys_open", "OK", sw_rem_break }, /*remove breakpoint */ | 544 | { "sys_open", "OK", sw_rem_break }, /*remove breakpoint */ |
544 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ | 545 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ |
545 | { "g", "sys_open", 0, check_single_step }, | 546 | { "g", "sys_open", NULL, check_single_step }, |
546 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ | 547 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ |
547 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ | 548 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ |
548 | { "D", "OK", 0, final_ack_set }, /* detach and unregister I/O */ | 549 | { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ |
549 | { "", "" }, | 550 | { "", "" }, |
550 | }; | 551 | }; |
551 | 552 | ||
@@ -556,11 +557,11 @@ static struct test_struct hw_breakpoint_test[] = { | |||
556 | { "?", "S0*" }, /* Clear break points */ | 557 | { "?", "S0*" }, /* Clear break points */ |
557 | { "kgdbts_break_test", "OK", hw_break, }, /* set hw breakpoint */ | 558 | { "kgdbts_break_test", "OK", hw_break, }, /* set hw breakpoint */ |
558 | { "c", "T0*", }, /* Continue */ | 559 | { "c", "T0*", }, /* Continue */ |
559 | { "g", "kgdbts_break_test", 0, check_and_rewind_pc }, | 560 | { "g", "kgdbts_break_test", NULL, check_and_rewind_pc }, |
560 | { "write", "OK", write_regs }, | 561 | { "write", "OK", write_regs }, |
561 | { "kgdbts_break_test", "OK", hw_rem_break }, /*remove breakpoint */ | 562 | { "kgdbts_break_test", "OK", hw_rem_break }, /*remove breakpoint */ |
562 | { "D", "OK" }, /* Detach */ | 563 | { "D", "OK" }, /* Detach */ |
563 | { "D", "OK", 0, got_break }, /* If the test worked we made it here */ | 564 | { "D", "OK", NULL, got_break }, /* On success we made it here */ |
564 | { "", "" }, | 565 | { "", "" }, |
565 | }; | 566 | }; |
566 | 567 | ||
@@ -570,12 +571,12 @@ static struct test_struct hw_breakpoint_test[] = { | |||
570 | static struct test_struct hw_write_break_test[] = { | 571 | static struct test_struct hw_write_break_test[] = { |
571 | { "?", "S0*" }, /* Clear break points */ | 572 | { "?", "S0*" }, /* Clear break points */ |
572 | { "hw_break_val", "OK", hw_write_break, }, /* set hw breakpoint */ | 573 | { "hw_break_val", "OK", hw_write_break, }, /* set hw breakpoint */ |
573 | { "c", "T0*", 0, got_break }, /* Continue */ | 574 | { "c", "T0*", NULL, got_break }, /* Continue */ |
574 | { "g", "silent", 0, check_and_rewind_pc }, | 575 | { "g", "silent", NULL, check_and_rewind_pc }, |
575 | { "write", "OK", write_regs }, | 576 | { "write", "OK", write_regs }, |
576 | { "hw_break_val", "OK", hw_rem_write_break }, /*remove breakpoint */ | 577 | { "hw_break_val", "OK", hw_rem_write_break }, /*remove breakpoint */ |
577 | { "D", "OK" }, /* Detach */ | 578 | { "D", "OK" }, /* Detach */ |
578 | { "D", "OK", 0, got_break }, /* If the test worked we made it here */ | 579 | { "D", "OK", NULL, got_break }, /* On success we made it here */ |
579 | { "", "" }, | 580 | { "", "" }, |
580 | }; | 581 | }; |
581 | 582 | ||
@@ -585,12 +586,12 @@ static struct test_struct hw_write_break_test[] = { | |||
585 | static struct test_struct hw_access_break_test[] = { | 586 | static struct test_struct hw_access_break_test[] = { |
586 | { "?", "S0*" }, /* Clear break points */ | 587 | { "?", "S0*" }, /* Clear break points */ |
587 | { "hw_break_val", "OK", hw_access_break, }, /* set hw breakpoint */ | 588 | { "hw_break_val", "OK", hw_access_break, }, /* set hw breakpoint */ |
588 | { "c", "T0*", 0, got_break }, /* Continue */ | 589 | { "c", "T0*", NULL, got_break }, /* Continue */ |
589 | { "g", "silent", 0, check_and_rewind_pc }, | 590 | { "g", "silent", NULL, check_and_rewind_pc }, |
590 | { "write", "OK", write_regs }, | 591 | { "write", "OK", write_regs }, |
591 | { "hw_break_val", "OK", hw_rem_access_break }, /*remove breakpoint */ | 592 | { "hw_break_val", "OK", hw_rem_access_break }, /*remove breakpoint */ |
592 | { "D", "OK" }, /* Detach */ | 593 | { "D", "OK" }, /* Detach */ |
593 | { "D", "OK", 0, got_break }, /* If the test worked we made it here */ | 594 | { "D", "OK", NULL, got_break }, /* On success we made it here */ |
594 | { "", "" }, | 595 | { "", "" }, |
595 | }; | 596 | }; |
596 | 597 | ||
@@ -599,9 +600,9 @@ static struct test_struct hw_access_break_test[] = { | |||
599 | */ | 600 | */ |
600 | static struct test_struct nmi_sleep_test[] = { | 601 | static struct test_struct nmi_sleep_test[] = { |
601 | { "?", "S0*" }, /* Clear break points */ | 602 | { "?", "S0*" }, /* Clear break points */ |
602 | { "c", "T0*", 0, got_break }, /* Continue */ | 603 | { "c", "T0*", NULL, got_break }, /* Continue */ |
603 | { "D", "OK" }, /* Detach */ | 604 | { "D", "OK" }, /* Detach */ |
604 | { "D", "OK", 0, got_break }, /* If the test worked we made it here */ | 605 | { "D", "OK", NULL, got_break }, /* On success we made it here */ |
605 | { "", "" }, | 606 | { "", "" }, |
606 | }; | 607 | }; |
607 | 608 | ||
@@ -874,18 +875,23 @@ static void kgdbts_run_tests(void) | |||
874 | { | 875 | { |
875 | char *ptr; | 876 | char *ptr; |
876 | int fork_test = 0; | 877 | int fork_test = 0; |
877 | int sys_open_test = 0; | 878 | int do_sys_open_test = 0; |
879 | int sstep_test = 1000; | ||
878 | int nmi_sleep = 0; | 880 | int nmi_sleep = 0; |
881 | int i; | ||
879 | 882 | ||
880 | ptr = strstr(config, "F"); | 883 | ptr = strstr(config, "F"); |
881 | if (ptr) | 884 | if (ptr) |
882 | fork_test = simple_strtol(ptr+1, NULL, 10); | 885 | fork_test = simple_strtol(ptr + 1, NULL, 10); |
883 | ptr = strstr(config, "S"); | 886 | ptr = strstr(config, "S"); |
884 | if (ptr) | 887 | if (ptr) |
885 | sys_open_test = simple_strtol(ptr+1, NULL, 10); | 888 | do_sys_open_test = simple_strtol(ptr + 1, NULL, 10); |
886 | ptr = strstr(config, "N"); | 889 | ptr = strstr(config, "N"); |
887 | if (ptr) | 890 | if (ptr) |
888 | nmi_sleep = simple_strtol(ptr+1, NULL, 10); | 891 | nmi_sleep = simple_strtol(ptr+1, NULL, 10); |
892 | ptr = strstr(config, "I"); | ||
893 | if (ptr) | ||
894 | sstep_test = simple_strtol(ptr+1, NULL, 10); | ||
889 | 895 | ||
890 | /* required internal KGDB tests */ | 896 | /* required internal KGDB tests */ |
891 | v1printk("kgdbts:RUN plant and detach test\n"); | 897 | v1printk("kgdbts:RUN plant and detach test\n"); |
@@ -894,8 +900,13 @@ static void kgdbts_run_tests(void) | |||
894 | run_breakpoint_test(0); | 900 | run_breakpoint_test(0); |
895 | v1printk("kgdbts:RUN bad memory access test\n"); | 901 | v1printk("kgdbts:RUN bad memory access test\n"); |
896 | run_bad_read_test(); | 902 | run_bad_read_test(); |
897 | v1printk("kgdbts:RUN singlestep breakpoint test\n"); | 903 | v1printk("kgdbts:RUN singlestep test %i iterations\n", sstep_test); |
898 | run_singlestep_break_test(); | 904 | for (i = 0; i < sstep_test; i++) { |
905 | run_singlestep_break_test(); | ||
906 | if (i % 100 == 0) | ||
907 | v1printk("kgdbts:RUN singlestep [%i/%i]\n", | ||
908 | i, sstep_test); | ||
909 | } | ||
899 | 910 | ||
900 | /* ===Optional tests=== */ | 911 | /* ===Optional tests=== */ |
901 | 912 | ||
@@ -922,7 +933,7 @@ static void kgdbts_run_tests(void) | |||
922 | repeat_test = fork_test; | 933 | repeat_test = fork_test; |
923 | printk(KERN_INFO "kgdbts:RUN do_fork for %i breakpoints\n", | 934 | printk(KERN_INFO "kgdbts:RUN do_fork for %i breakpoints\n", |
924 | repeat_test); | 935 | repeat_test); |
925 | kthread_run(kgdbts_unreg_thread, 0, "kgdbts_unreg"); | 936 | kthread_run(kgdbts_unreg_thread, NULL, "kgdbts_unreg"); |
926 | run_do_fork_test(); | 937 | run_do_fork_test(); |
927 | return; | 938 | return; |
928 | } | 939 | } |
@@ -931,11 +942,11 @@ static void kgdbts_run_tests(void) | |||
931 | * executed because a kernel thread will be spawned at the very | 942 | * executed because a kernel thread will be spawned at the very |
932 | * end to unregister the debug hooks. | 943 | * end to unregister the debug hooks. |
933 | */ | 944 | */ |
934 | if (sys_open_test) { | 945 | if (do_sys_open_test) { |
935 | repeat_test = sys_open_test; | 946 | repeat_test = do_sys_open_test; |
936 | printk(KERN_INFO "kgdbts:RUN sys_open for %i breakpoints\n", | 947 | printk(KERN_INFO "kgdbts:RUN sys_open for %i breakpoints\n", |
937 | repeat_test); | 948 | repeat_test); |
938 | kthread_run(kgdbts_unreg_thread, 0, "kgdbts_unreg"); | 949 | kthread_run(kgdbts_unreg_thread, NULL, "kgdbts_unreg"); |
939 | run_sys_open_test(); | 950 | run_sys_open_test(); |
940 | return; | 951 | return; |
941 | } | 952 | } |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 626ac083f4e..da5fecad74d 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -425,7 +425,7 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
425 | host->cclk = host->mclk; | 425 | host->cclk = host->mclk; |
426 | } else { | 426 | } else { |
427 | clk = host->mclk / (2 * ios->clock) - 1; | 427 | clk = host->mclk / (2 * ios->clock) - 1; |
428 | if (clk > 256) | 428 | if (clk >= 256) |
429 | clk = 255; | 429 | clk = 255; |
430 | host->cclk = host->mclk / (2 * (clk + 1)); | 430 | host->cclk = host->mclk / (2 * (clk + 1)); |
431 | } | 431 | } |
@@ -512,6 +512,18 @@ static int mmci_probe(struct amba_device *dev, void *id) | |||
512 | 512 | ||
513 | host->plat = plat; | 513 | host->plat = plat; |
514 | host->mclk = clk_get_rate(host->clk); | 514 | host->mclk = clk_get_rate(host->clk); |
515 | /* | ||
516 | * According to the spec, mclk is max 100 MHz, | ||
517 | * so we try to adjust the clock down to this, | ||
518 | * (if possible). | ||
519 | */ | ||
520 | if (host->mclk > 100000000) { | ||
521 | ret = clk_set_rate(host->clk, 100000000); | ||
522 | if (ret < 0) | ||
523 | goto clk_disable; | ||
524 | host->mclk = clk_get_rate(host->clk); | ||
525 | DBG(host, "eventual mclk rate: %u Hz\n", host->mclk); | ||
526 | } | ||
515 | host->mmc = mmc; | 527 | host->mmc = mmc; |
516 | host->base = ioremap(dev->res.start, SZ_4K); | 528 | host->base = ioremap(dev->res.start, SZ_4K); |
517 | if (!host->base) { | 529 | if (!host->base) { |
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 1bd69aa9e22..17bc87a43ff 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -374,7 +374,7 @@ config MTD_REDWOOD | |||
374 | 374 | ||
375 | config MTD_SOLUTIONENGINE | 375 | config MTD_SOLUTIONENGINE |
376 | tristate "CFI Flash device mapped on Hitachi SolutionEngine" | 376 | tristate "CFI Flash device mapped on Hitachi SolutionEngine" |
377 | depends on SUPERH && MTD_CFI && MTD_REDBOOT_PARTS | 377 | depends on SUPERH && SOLUTION_ENGINE && MTD_CFI && MTD_REDBOOT_PARTS |
378 | help | 378 | help |
379 | This enables access to the flash chips on the Hitachi SolutionEngine and | 379 | This enables access to the flash chips on the Hitachi SolutionEngine and |
380 | similar boards. Say 'Y' if you are building a kernel for such a board. | 380 | similar boards. Say 'Y' if you are building a kernel for such a board. |
@@ -480,13 +480,6 @@ config MTD_H720X | |||
480 | This enables access to the flash chips on the Hynix evaluation boards. | 480 | This enables access to the flash chips on the Hynix evaluation boards. |
481 | If you have such a board, say 'Y'. | 481 | If you have such a board, say 'Y'. |
482 | 482 | ||
483 | config MTD_MPC1211 | ||
484 | tristate "CFI Flash device mapped on Interface MPC-1211" | ||
485 | depends on SH_MPC1211 && MTD_CFI | ||
486 | help | ||
487 | This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02). | ||
488 | If you have such a board, say 'Y'. | ||
489 | |||
490 | config MTD_OMAP_NOR | 483 | config MTD_OMAP_NOR |
491 | tristate "TI OMAP board mappings" | 484 | tristate "TI OMAP board mappings" |
492 | depends on MTD_CFI && ARCH_OMAP | 485 | depends on MTD_CFI && ARCH_OMAP |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index a9cbe80f99a..957fb5f70f5 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
@@ -58,7 +58,6 @@ obj-$(CONFIG_MTD_WALNUT) += walnut.o | |||
58 | obj-$(CONFIG_MTD_H720X) += h720x-flash.o | 58 | obj-$(CONFIG_MTD_H720X) += h720x-flash.o |
59 | obj-$(CONFIG_MTD_SBC8240) += sbc8240.o | 59 | obj-$(CONFIG_MTD_SBC8240) += sbc8240.o |
60 | obj-$(CONFIG_MTD_NOR_TOTO) += omap-toto-flash.o | 60 | obj-$(CONFIG_MTD_NOR_TOTO) += omap-toto-flash.o |
61 | obj-$(CONFIG_MTD_MPC1211) += mpc1211.o | ||
62 | obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o | 61 | obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o |
63 | obj-$(CONFIG_MTD_IXP2000) += ixp2000.o | 62 | obj-$(CONFIG_MTD_IXP2000) += ixp2000.o |
64 | obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o | 63 | obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o |
diff --git a/drivers/mtd/maps/mpc1211.c b/drivers/mtd/maps/mpc1211.c deleted file mode 100644 index 45a00fac88a..00000000000 --- a/drivers/mtd/maps/mpc1211.c +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* | ||
2 | * Flash on MPC-1211 | ||
3 | * | ||
4 | * $Id: mpc1211.c,v 1.4 2004/09/16 23:27:13 gleixner Exp $ | ||
5 | * | ||
6 | * (C) 2002 Interface, Saito.K & Jeanne | ||
7 | * | ||
8 | * GPL'd | ||
9 | */ | ||
10 | |||
11 | #include <linux/module.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <asm/io.h> | ||
15 | #include <linux/mtd/mtd.h> | ||
16 | #include <linux/mtd/map.h> | ||
17 | #include <linux/mtd/partitions.h> | ||
18 | |||
19 | static struct mtd_info *flash_mtd; | ||
20 | static struct mtd_partition *parsed_parts; | ||
21 | |||
22 | struct map_info mpc1211_flash_map = { | ||
23 | .name = "MPC-1211 FLASH", | ||
24 | .size = 0x80000, | ||
25 | .bankwidth = 1, | ||
26 | }; | ||
27 | |||
28 | static struct mtd_partition mpc1211_partitions[] = { | ||
29 | { | ||
30 | .name = "IPL & ETH-BOOT", | ||
31 | .offset = 0x00000000, | ||
32 | .size = 0x10000, | ||
33 | }, | ||
34 | { | ||
35 | .name = "Flash FS", | ||
36 | .offset = 0x00010000, | ||
37 | .size = MTDPART_SIZ_FULL, | ||
38 | } | ||
39 | }; | ||
40 | |||
41 | static int __init init_mpc1211_maps(void) | ||
42 | { | ||
43 | int nr_parts; | ||
44 | |||
45 | mpc1211_flash_map.phys = 0; | ||
46 | mpc1211_flash_map.virt = (void __iomem *)P2SEGADDR(0); | ||
47 | |||
48 | simple_map_init(&mpc1211_flash_map); | ||
49 | |||
50 | printk(KERN_NOTICE "Probing for flash chips at 0x00000000:\n"); | ||
51 | flash_mtd = do_map_probe("jedec_probe", &mpc1211_flash_map); | ||
52 | if (!flash_mtd) { | ||
53 | printk(KERN_NOTICE "Flash chips not detected at either possible location.\n"); | ||
54 | return -ENXIO; | ||
55 | } | ||
56 | printk(KERN_NOTICE "MPC-1211: Flash at 0x%08lx\n", mpc1211_flash_map.virt & 0x1fffffff); | ||
57 | flash_mtd->module = THIS_MODULE; | ||
58 | |||
59 | parsed_parts = mpc1211_partitions; | ||
60 | nr_parts = ARRAY_SIZE(mpc1211_partitions); | ||
61 | |||
62 | add_mtd_partitions(flash_mtd, parsed_parts, nr_parts); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static void __exit cleanup_mpc1211_maps(void) | ||
67 | { | ||
68 | if (parsed_parts) | ||
69 | del_mtd_partitions(flash_mtd); | ||
70 | else | ||
71 | del_mtd_device(flash_mtd); | ||
72 | map_destroy(flash_mtd); | ||
73 | } | ||
74 | |||
75 | module_init(init_mpc1211_maps); | ||
76 | module_exit(cleanup_mpc1211_maps); | ||
77 | |||
78 | MODULE_LICENSE("GPL"); | ||
79 | MODULE_AUTHOR("Saito.K & Jeanne <ksaito@interface.co.jp>"); | ||
80 | MODULE_DESCRIPTION("MTD map driver for MPC-1211 boards. Interface"); | ||
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 6f8e7d4cf74..2edda8cc7f9 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -319,7 +319,7 @@ static struct vortex_chip_info { | |||
319 | {"3c920B-EMB-WNM (ATI Radeon 9100 IGP)", | 319 | {"3c920B-EMB-WNM (ATI Radeon 9100 IGP)", |
320 | PCI_USES_MASTER, IS_TORNADO|HAS_MII|HAS_HWCKSM, 128, }, | 320 | PCI_USES_MASTER, IS_TORNADO|HAS_MII|HAS_HWCKSM, 128, }, |
321 | {"3c980 Cyclone", | 321 | {"3c980 Cyclone", |
322 | PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, }, | 322 | PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, |
323 | 323 | ||
324 | {"3c980C Python-T", | 324 | {"3c980C Python-T", |
325 | PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, }, | 325 | PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, }, |
@@ -600,7 +600,6 @@ struct vortex_private { | |||
600 | struct sk_buff* tx_skbuff[TX_RING_SIZE]; | 600 | struct sk_buff* tx_skbuff[TX_RING_SIZE]; |
601 | unsigned int cur_rx, cur_tx; /* The next free ring entry */ | 601 | unsigned int cur_rx, cur_tx; /* The next free ring entry */ |
602 | unsigned int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */ | 602 | unsigned int dirty_rx, dirty_tx; /* The ring entries to be free()ed. */ |
603 | struct net_device_stats stats; /* Generic stats */ | ||
604 | struct vortex_extra_stats xstats; /* NIC-specific extra stats */ | 603 | struct vortex_extra_stats xstats; /* NIC-specific extra stats */ |
605 | struct sk_buff *tx_skb; /* Packet being eaten by bus master ctrl. */ | 604 | struct sk_buff *tx_skb; /* Packet being eaten by bus master ctrl. */ |
606 | dma_addr_t tx_skb_dma; /* Allocated DMA address for bus master ctrl DMA. */ | 605 | dma_addr_t tx_skb_dma; /* Allocated DMA address for bus master ctrl DMA. */ |
@@ -1875,7 +1874,7 @@ static void vortex_tx_timeout(struct net_device *dev) | |||
1875 | 1874 | ||
1876 | issue_and_wait(dev, TxReset); | 1875 | issue_and_wait(dev, TxReset); |
1877 | 1876 | ||
1878 | vp->stats.tx_errors++; | 1877 | dev->stats.tx_errors++; |
1879 | if (vp->full_bus_master_tx) { | 1878 | if (vp->full_bus_master_tx) { |
1880 | printk(KERN_DEBUG "%s: Resetting the Tx ring pointer.\n", dev->name); | 1879 | printk(KERN_DEBUG "%s: Resetting the Tx ring pointer.\n", dev->name); |
1881 | if (vp->cur_tx - vp->dirty_tx > 0 && ioread32(ioaddr + DownListPtr) == 0) | 1880 | if (vp->cur_tx - vp->dirty_tx > 0 && ioread32(ioaddr + DownListPtr) == 0) |
@@ -1887,7 +1886,7 @@ static void vortex_tx_timeout(struct net_device *dev) | |||
1887 | iowrite8(PKT_BUF_SZ>>8, ioaddr + TxFreeThreshold); | 1886 | iowrite8(PKT_BUF_SZ>>8, ioaddr + TxFreeThreshold); |
1888 | iowrite16(DownUnstall, ioaddr + EL3_CMD); | 1887 | iowrite16(DownUnstall, ioaddr + EL3_CMD); |
1889 | } else { | 1888 | } else { |
1890 | vp->stats.tx_dropped++; | 1889 | dev->stats.tx_dropped++; |
1891 | netif_wake_queue(dev); | 1890 | netif_wake_queue(dev); |
1892 | } | 1891 | } |
1893 | 1892 | ||
@@ -1928,8 +1927,8 @@ vortex_error(struct net_device *dev, int status) | |||
1928 | } | 1927 | } |
1929 | dump_tx_ring(dev); | 1928 | dump_tx_ring(dev); |
1930 | } | 1929 | } |
1931 | if (tx_status & 0x14) vp->stats.tx_fifo_errors++; | 1930 | if (tx_status & 0x14) dev->stats.tx_fifo_errors++; |
1932 | if (tx_status & 0x38) vp->stats.tx_aborted_errors++; | 1931 | if (tx_status & 0x38) dev->stats.tx_aborted_errors++; |
1933 | if (tx_status & 0x08) vp->xstats.tx_max_collisions++; | 1932 | if (tx_status & 0x08) vp->xstats.tx_max_collisions++; |
1934 | iowrite8(0, ioaddr + TxStatus); | 1933 | iowrite8(0, ioaddr + TxStatus); |
1935 | if (tx_status & 0x30) { /* txJabber or txUnderrun */ | 1934 | if (tx_status & 0x30) { /* txJabber or txUnderrun */ |
@@ -2051,8 +2050,8 @@ vortex_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2051 | if (vortex_debug > 2) | 2050 | if (vortex_debug > 2) |
2052 | printk(KERN_DEBUG "%s: Tx error, status %2.2x.\n", | 2051 | printk(KERN_DEBUG "%s: Tx error, status %2.2x.\n", |
2053 | dev->name, tx_status); | 2052 | dev->name, tx_status); |
2054 | if (tx_status & 0x04) vp->stats.tx_fifo_errors++; | 2053 | if (tx_status & 0x04) dev->stats.tx_fifo_errors++; |
2055 | if (tx_status & 0x38) vp->stats.tx_aborted_errors++; | 2054 | if (tx_status & 0x38) dev->stats.tx_aborted_errors++; |
2056 | if (tx_status & 0x30) { | 2055 | if (tx_status & 0x30) { |
2057 | issue_and_wait(dev, TxReset); | 2056 | issue_and_wait(dev, TxReset); |
2058 | } | 2057 | } |
@@ -2350,7 +2349,7 @@ boomerang_interrupt(int irq, void *dev_id) | |||
2350 | } else { | 2349 | } else { |
2351 | printk(KERN_DEBUG "boomerang_interrupt: no skb!\n"); | 2350 | printk(KERN_DEBUG "boomerang_interrupt: no skb!\n"); |
2352 | } | 2351 | } |
2353 | /* vp->stats.tx_packets++; Counted below. */ | 2352 | /* dev->stats.tx_packets++; Counted below. */ |
2354 | dirty_tx++; | 2353 | dirty_tx++; |
2355 | } | 2354 | } |
2356 | vp->dirty_tx = dirty_tx; | 2355 | vp->dirty_tx = dirty_tx; |
@@ -2409,12 +2408,12 @@ static int vortex_rx(struct net_device *dev) | |||
2409 | unsigned char rx_error = ioread8(ioaddr + RxErrors); | 2408 | unsigned char rx_error = ioread8(ioaddr + RxErrors); |
2410 | if (vortex_debug > 2) | 2409 | if (vortex_debug > 2) |
2411 | printk(KERN_DEBUG " Rx error: status %2.2x.\n", rx_error); | 2410 | printk(KERN_DEBUG " Rx error: status %2.2x.\n", rx_error); |
2412 | vp->stats.rx_errors++; | 2411 | dev->stats.rx_errors++; |
2413 | if (rx_error & 0x01) vp->stats.rx_over_errors++; | 2412 | if (rx_error & 0x01) dev->stats.rx_over_errors++; |
2414 | if (rx_error & 0x02) vp->stats.rx_length_errors++; | 2413 | if (rx_error & 0x02) dev->stats.rx_length_errors++; |
2415 | if (rx_error & 0x04) vp->stats.rx_frame_errors++; | 2414 | if (rx_error & 0x04) dev->stats.rx_frame_errors++; |
2416 | if (rx_error & 0x08) vp->stats.rx_crc_errors++; | 2415 | if (rx_error & 0x08) dev->stats.rx_crc_errors++; |
2417 | if (rx_error & 0x10) vp->stats.rx_length_errors++; | 2416 | if (rx_error & 0x10) dev->stats.rx_length_errors++; |
2418 | } else { | 2417 | } else { |
2419 | /* The packet length: up to 4.5K!. */ | 2418 | /* The packet length: up to 4.5K!. */ |
2420 | int pkt_len = rx_status & 0x1fff; | 2419 | int pkt_len = rx_status & 0x1fff; |
@@ -2446,7 +2445,7 @@ static int vortex_rx(struct net_device *dev) | |||
2446 | skb->protocol = eth_type_trans(skb, dev); | 2445 | skb->protocol = eth_type_trans(skb, dev); |
2447 | netif_rx(skb); | 2446 | netif_rx(skb); |
2448 | dev->last_rx = jiffies; | 2447 | dev->last_rx = jiffies; |
2449 | vp->stats.rx_packets++; | 2448 | dev->stats.rx_packets++; |
2450 | /* Wait a limited time to go to next packet. */ | 2449 | /* Wait a limited time to go to next packet. */ |
2451 | for (i = 200; i >= 0; i--) | 2450 | for (i = 200; i >= 0; i--) |
2452 | if ( ! (ioread16(ioaddr + EL3_STATUS) & CmdInProgress)) | 2451 | if ( ! (ioread16(ioaddr + EL3_STATUS) & CmdInProgress)) |
@@ -2455,7 +2454,7 @@ static int vortex_rx(struct net_device *dev) | |||
2455 | } else if (vortex_debug > 0) | 2454 | } else if (vortex_debug > 0) |
2456 | printk(KERN_NOTICE "%s: No memory to allocate a sk_buff of " | 2455 | printk(KERN_NOTICE "%s: No memory to allocate a sk_buff of " |
2457 | "size %d.\n", dev->name, pkt_len); | 2456 | "size %d.\n", dev->name, pkt_len); |
2458 | vp->stats.rx_dropped++; | 2457 | dev->stats.rx_dropped++; |
2459 | } | 2458 | } |
2460 | issue_and_wait(dev, RxDiscard); | 2459 | issue_and_wait(dev, RxDiscard); |
2461 | } | 2460 | } |
@@ -2482,12 +2481,12 @@ boomerang_rx(struct net_device *dev) | |||
2482 | unsigned char rx_error = rx_status >> 16; | 2481 | unsigned char rx_error = rx_status >> 16; |
2483 | if (vortex_debug > 2) | 2482 | if (vortex_debug > 2) |
2484 | printk(KERN_DEBUG " Rx error: status %2.2x.\n", rx_error); | 2483 | printk(KERN_DEBUG " Rx error: status %2.2x.\n", rx_error); |
2485 | vp->stats.rx_errors++; | 2484 | dev->stats.rx_errors++; |
2486 | if (rx_error & 0x01) vp->stats.rx_over_errors++; | 2485 | if (rx_error & 0x01) dev->stats.rx_over_errors++; |
2487 | if (rx_error & 0x02) vp->stats.rx_length_errors++; | 2486 | if (rx_error & 0x02) dev->stats.rx_length_errors++; |
2488 | if (rx_error & 0x04) vp->stats.rx_frame_errors++; | 2487 | if (rx_error & 0x04) dev->stats.rx_frame_errors++; |
2489 | if (rx_error & 0x08) vp->stats.rx_crc_errors++; | 2488 | if (rx_error & 0x08) dev->stats.rx_crc_errors++; |
2490 | if (rx_error & 0x10) vp->stats.rx_length_errors++; | 2489 | if (rx_error & 0x10) dev->stats.rx_length_errors++; |
2491 | } else { | 2490 | } else { |
2492 | /* The packet length: up to 4.5K!. */ | 2491 | /* The packet length: up to 4.5K!. */ |
2493 | int pkt_len = rx_status & 0x1fff; | 2492 | int pkt_len = rx_status & 0x1fff; |
@@ -2529,7 +2528,7 @@ boomerang_rx(struct net_device *dev) | |||
2529 | } | 2528 | } |
2530 | netif_rx(skb); | 2529 | netif_rx(skb); |
2531 | dev->last_rx = jiffies; | 2530 | dev->last_rx = jiffies; |
2532 | vp->stats.rx_packets++; | 2531 | dev->stats.rx_packets++; |
2533 | } | 2532 | } |
2534 | entry = (++vp->cur_rx) % RX_RING_SIZE; | 2533 | entry = (++vp->cur_rx) % RX_RING_SIZE; |
2535 | } | 2534 | } |
@@ -2591,7 +2590,7 @@ vortex_down(struct net_device *dev, int final_down) | |||
2591 | del_timer_sync(&vp->rx_oom_timer); | 2590 | del_timer_sync(&vp->rx_oom_timer); |
2592 | del_timer_sync(&vp->timer); | 2591 | del_timer_sync(&vp->timer); |
2593 | 2592 | ||
2594 | /* Turn off statistics ASAP. We update vp->stats below. */ | 2593 | /* Turn off statistics ASAP. We update dev->stats below. */ |
2595 | iowrite16(StatsDisable, ioaddr + EL3_CMD); | 2594 | iowrite16(StatsDisable, ioaddr + EL3_CMD); |
2596 | 2595 | ||
2597 | /* Disable the receiver and transmitter. */ | 2596 | /* Disable the receiver and transmitter. */ |
@@ -2728,7 +2727,7 @@ static struct net_device_stats *vortex_get_stats(struct net_device *dev) | |||
2728 | update_stats(ioaddr, dev); | 2727 | update_stats(ioaddr, dev); |
2729 | spin_unlock_irqrestore (&vp->lock, flags); | 2728 | spin_unlock_irqrestore (&vp->lock, flags); |
2730 | } | 2729 | } |
2731 | return &vp->stats; | 2730 | return &dev->stats; |
2732 | } | 2731 | } |
2733 | 2732 | ||
2734 | /* Update statistics. | 2733 | /* Update statistics. |
@@ -2748,18 +2747,18 @@ static void update_stats(void __iomem *ioaddr, struct net_device *dev) | |||
2748 | /* Unlike the 3c5x9 we need not turn off stats updates while reading. */ | 2747 | /* Unlike the 3c5x9 we need not turn off stats updates while reading. */ |
2749 | /* Switch to the stats window, and read everything. */ | 2748 | /* Switch to the stats window, and read everything. */ |
2750 | EL3WINDOW(6); | 2749 | EL3WINDOW(6); |
2751 | vp->stats.tx_carrier_errors += ioread8(ioaddr + 0); | 2750 | dev->stats.tx_carrier_errors += ioread8(ioaddr + 0); |
2752 | vp->stats.tx_heartbeat_errors += ioread8(ioaddr + 1); | 2751 | dev->stats.tx_heartbeat_errors += ioread8(ioaddr + 1); |
2753 | vp->stats.tx_window_errors += ioread8(ioaddr + 4); | 2752 | dev->stats.tx_window_errors += ioread8(ioaddr + 4); |
2754 | vp->stats.rx_fifo_errors += ioread8(ioaddr + 5); | 2753 | dev->stats.rx_fifo_errors += ioread8(ioaddr + 5); |
2755 | vp->stats.tx_packets += ioread8(ioaddr + 6); | 2754 | dev->stats.tx_packets += ioread8(ioaddr + 6); |
2756 | vp->stats.tx_packets += (ioread8(ioaddr + 9)&0x30) << 4; | 2755 | dev->stats.tx_packets += (ioread8(ioaddr + 9)&0x30) << 4; |
2757 | /* Rx packets */ ioread8(ioaddr + 7); /* Must read to clear */ | 2756 | /* Rx packets */ ioread8(ioaddr + 7); /* Must read to clear */ |
2758 | /* Don't bother with register 9, an extension of registers 6&7. | 2757 | /* Don't bother with register 9, an extension of registers 6&7. |
2759 | If we do use the 6&7 values the atomic update assumption above | 2758 | If we do use the 6&7 values the atomic update assumption above |
2760 | is invalid. */ | 2759 | is invalid. */ |
2761 | vp->stats.rx_bytes += ioread16(ioaddr + 10); | 2760 | dev->stats.rx_bytes += ioread16(ioaddr + 10); |
2762 | vp->stats.tx_bytes += ioread16(ioaddr + 12); | 2761 | dev->stats.tx_bytes += ioread16(ioaddr + 12); |
2763 | /* Extra stats for get_ethtool_stats() */ | 2762 | /* Extra stats for get_ethtool_stats() */ |
2764 | vp->xstats.tx_multiple_collisions += ioread8(ioaddr + 2); | 2763 | vp->xstats.tx_multiple_collisions += ioread8(ioaddr + 2); |
2765 | vp->xstats.tx_single_collisions += ioread8(ioaddr + 3); | 2764 | vp->xstats.tx_single_collisions += ioread8(ioaddr + 3); |
@@ -2767,14 +2766,14 @@ static void update_stats(void __iomem *ioaddr, struct net_device *dev) | |||
2767 | EL3WINDOW(4); | 2766 | EL3WINDOW(4); |
2768 | vp->xstats.rx_bad_ssd += ioread8(ioaddr + 12); | 2767 | vp->xstats.rx_bad_ssd += ioread8(ioaddr + 12); |
2769 | 2768 | ||
2770 | vp->stats.collisions = vp->xstats.tx_multiple_collisions | 2769 | dev->stats.collisions = vp->xstats.tx_multiple_collisions |
2771 | + vp->xstats.tx_single_collisions | 2770 | + vp->xstats.tx_single_collisions |
2772 | + vp->xstats.tx_max_collisions; | 2771 | + vp->xstats.tx_max_collisions; |
2773 | 2772 | ||
2774 | { | 2773 | { |
2775 | u8 up = ioread8(ioaddr + 13); | 2774 | u8 up = ioread8(ioaddr + 13); |
2776 | vp->stats.rx_bytes += (up & 0x0f) << 16; | 2775 | dev->stats.rx_bytes += (up & 0x0f) << 16; |
2777 | vp->stats.tx_bytes += (up & 0xf0) << 12; | 2776 | dev->stats.tx_bytes += (up & 0xf0) << 12; |
2778 | } | 2777 | } |
2779 | 2778 | ||
2780 | EL3WINDOW(old_window >> 13); | 2779 | EL3WINDOW(old_window >> 13); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index af46341827f..d27f54a2df7 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1273,20 +1273,6 @@ config PCNET32 | |||
1273 | To compile this driver as a module, choose M here. The module | 1273 | To compile this driver as a module, choose M here. The module |
1274 | will be called pcnet32. | 1274 | will be called pcnet32. |
1275 | 1275 | ||
1276 | config PCNET32_NAPI | ||
1277 | bool "Use RX polling (NAPI)" | ||
1278 | depends on PCNET32 | ||
1279 | help | ||
1280 | NAPI is a new driver API designed to reduce CPU and interrupt load | ||
1281 | when the driver is receiving lots of packets from the card. It is | ||
1282 | still somewhat experimental and thus not yet enabled by default. | ||
1283 | |||
1284 | If your estimated Rx load is 10kpps or more, or if the card will be | ||
1285 | deployed on potentially unfriendly networks (e.g. in a firewall), | ||
1286 | then say Y here. | ||
1287 | |||
1288 | If in doubt, say N. | ||
1289 | |||
1290 | config AMD8111_ETH | 1276 | config AMD8111_ETH |
1291 | tristate "AMD 8111 (new PCI lance) support" | 1277 | tristate "AMD 8111 (new PCI lance) support" |
1292 | depends on NET_PCI && PCI | 1278 | depends on NET_PCI && PCI |
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c index 82e9a5bd0dd..a0b4c851607 100644 --- a/drivers/net/appletalk/cops.c +++ b/drivers/net/appletalk/cops.c | |||
@@ -499,19 +499,13 @@ static void cops_reset(struct net_device *dev, int sleep) | |||
499 | { | 499 | { |
500 | outb(0, ioaddr+DAYNA_RESET); /* Assert the reset port */ | 500 | outb(0, ioaddr+DAYNA_RESET); /* Assert the reset port */ |
501 | inb(ioaddr+DAYNA_RESET); /* Clear the reset */ | 501 | inb(ioaddr+DAYNA_RESET); /* Clear the reset */ |
502 | if(sleep) | 502 | if (sleep) |
503 | { | 503 | msleep(333); |
504 | long snap=jiffies; | 504 | else |
505 | 505 | mdelay(333); | |
506 | /* Let card finish initializing, about 1/3 second */ | ||
507 | while (time_before(jiffies, snap + HZ/3)) | ||
508 | schedule(); | ||
509 | } | ||
510 | else | ||
511 | mdelay(333); | ||
512 | } | 506 | } |
507 | |||
513 | netif_wake_queue(dev); | 508 | netif_wake_queue(dev); |
514 | return; | ||
515 | } | 509 | } |
516 | 510 | ||
517 | static void cops_load (struct net_device *dev) | 511 | static void cops_load (struct net_device *dev) |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 6425603bc37..50a40e43315 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1425,13 +1425,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1425 | res = netdev_set_master(slave_dev, bond_dev); | 1425 | res = netdev_set_master(slave_dev, bond_dev); |
1426 | if (res) { | 1426 | if (res) { |
1427 | dprintk("Error %d calling netdev_set_master\n", res); | 1427 | dprintk("Error %d calling netdev_set_master\n", res); |
1428 | goto err_close; | 1428 | goto err_restore_mac; |
1429 | } | 1429 | } |
1430 | /* open the slave since the application closed it */ | 1430 | /* open the slave since the application closed it */ |
1431 | res = dev_open(slave_dev); | 1431 | res = dev_open(slave_dev); |
1432 | if (res) { | 1432 | if (res) { |
1433 | dprintk("Openning slave %s failed\n", slave_dev->name); | 1433 | dprintk("Openning slave %s failed\n", slave_dev->name); |
1434 | goto err_restore_mac; | 1434 | goto err_unset_master; |
1435 | } | 1435 | } |
1436 | 1436 | ||
1437 | new_slave->dev = slave_dev; | 1437 | new_slave->dev = slave_dev; |
@@ -1444,7 +1444,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1444 | */ | 1444 | */ |
1445 | res = bond_alb_init_slave(bond, new_slave); | 1445 | res = bond_alb_init_slave(bond, new_slave); |
1446 | if (res) { | 1446 | if (res) { |
1447 | goto err_unset_master; | 1447 | goto err_close; |
1448 | } | 1448 | } |
1449 | } | 1449 | } |
1450 | 1450 | ||
@@ -1619,7 +1619,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1619 | 1619 | ||
1620 | res = bond_create_slave_symlinks(bond_dev, slave_dev); | 1620 | res = bond_create_slave_symlinks(bond_dev, slave_dev); |
1621 | if (res) | 1621 | if (res) |
1622 | goto err_unset_master; | 1622 | goto err_close; |
1623 | 1623 | ||
1624 | printk(KERN_INFO DRV_NAME | 1624 | printk(KERN_INFO DRV_NAME |
1625 | ": %s: enslaving %s as a%s interface with a%s link.\n", | 1625 | ": %s: enslaving %s as a%s interface with a%s link.\n", |
@@ -1631,12 +1631,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1631 | return 0; | 1631 | return 0; |
1632 | 1632 | ||
1633 | /* Undo stages on error */ | 1633 | /* Undo stages on error */ |
1634 | err_unset_master: | ||
1635 | netdev_set_master(slave_dev, NULL); | ||
1636 | |||
1637 | err_close: | 1634 | err_close: |
1638 | dev_close(slave_dev); | 1635 | dev_close(slave_dev); |
1639 | 1636 | ||
1637 | err_unset_master: | ||
1638 | netdev_set_master(slave_dev, NULL); | ||
1639 | |||
1640 | err_restore_mac: | 1640 | err_restore_mac: |
1641 | if (!bond->params.fail_over_mac) { | 1641 | if (!bond->params.fail_over_mac) { |
1642 | memcpy(addr.sa_data, new_slave->perm_hwaddr, ETH_ALEN); | 1642 | memcpy(addr.sa_data, new_slave->perm_hwaddr, ETH_ALEN); |
@@ -4936,7 +4936,9 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond | |||
4936 | if (res < 0) { | 4936 | if (res < 0) { |
4937 | rtnl_lock(); | 4937 | rtnl_lock(); |
4938 | down_write(&bonding_rwsem); | 4938 | down_write(&bonding_rwsem); |
4939 | goto out_bond; | 4939 | bond_deinit(bond_dev); |
4940 | unregister_netdevice(bond_dev); | ||
4941 | goto out_rtnl; | ||
4940 | } | 4942 | } |
4941 | 4943 | ||
4942 | return 0; | 4944 | return 0; |
@@ -4990,9 +4992,10 @@ err: | |||
4990 | destroy_workqueue(bond->wq); | 4992 | destroy_workqueue(bond->wq); |
4991 | } | 4993 | } |
4992 | 4994 | ||
4995 | bond_destroy_sysfs(); | ||
4996 | |||
4993 | rtnl_lock(); | 4997 | rtnl_lock(); |
4994 | bond_free_all(); | 4998 | bond_free_all(); |
4995 | bond_destroy_sysfs(); | ||
4996 | rtnl_unlock(); | 4999 | rtnl_unlock(); |
4997 | out: | 5000 | out: |
4998 | return res; | 5001 | return res; |
@@ -5004,9 +5007,10 @@ static void __exit bonding_exit(void) | |||
5004 | unregister_netdevice_notifier(&bond_netdev_notifier); | 5007 | unregister_netdevice_notifier(&bond_netdev_notifier); |
5005 | unregister_inetaddr_notifier(&bond_inetaddr_notifier); | 5008 | unregister_inetaddr_notifier(&bond_inetaddr_notifier); |
5006 | 5009 | ||
5010 | bond_destroy_sysfs(); | ||
5011 | |||
5007 | rtnl_lock(); | 5012 | rtnl_lock(); |
5008 | bond_free_all(); | 5013 | bond_free_all(); |
5009 | bond_destroy_sysfs(); | ||
5010 | rtnl_unlock(); | 5014 | rtnl_unlock(); |
5011 | } | 5015 | } |
5012 | 5016 | ||
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 979c2d05ff9..68c41a00d93 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -146,29 +146,29 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t | |||
146 | ": Unable remove bond %s due to open references.\n", | 146 | ": Unable remove bond %s due to open references.\n", |
147 | ifname); | 147 | ifname); |
148 | res = -EPERM; | 148 | res = -EPERM; |
149 | goto out; | 149 | goto out_unlock; |
150 | } | 150 | } |
151 | printk(KERN_INFO DRV_NAME | 151 | printk(KERN_INFO DRV_NAME |
152 | ": %s is being deleted...\n", | 152 | ": %s is being deleted...\n", |
153 | bond->dev->name); | 153 | bond->dev->name); |
154 | bond_destroy(bond); | 154 | bond_destroy(bond); |
155 | up_write(&bonding_rwsem); | 155 | goto out_unlock; |
156 | rtnl_unlock(); | ||
157 | goto out; | ||
158 | } | 156 | } |
159 | 157 | ||
160 | printk(KERN_ERR DRV_NAME | 158 | printk(KERN_ERR DRV_NAME |
161 | ": unable to delete non-existent bond %s\n", ifname); | 159 | ": unable to delete non-existent bond %s\n", ifname); |
162 | res = -ENODEV; | 160 | res = -ENODEV; |
163 | up_write(&bonding_rwsem); | 161 | goto out_unlock; |
164 | rtnl_unlock(); | ||
165 | goto out; | ||
166 | } | 162 | } |
167 | 163 | ||
168 | err_no_cmd: | 164 | err_no_cmd: |
169 | printk(KERN_ERR DRV_NAME | 165 | printk(KERN_ERR DRV_NAME |
170 | ": no command found in bonding_masters. Use +ifname or -ifname.\n"); | 166 | ": no command found in bonding_masters. Use +ifname or -ifname.\n"); |
171 | res = -EPERM; | 167 | return -EPERM; |
168 | |||
169 | out_unlock: | ||
170 | up_write(&bonding_rwsem); | ||
171 | rtnl_unlock(); | ||
172 | 172 | ||
173 | /* Always return either count or an error. If you return 0, you'll | 173 | /* Always return either count or an error. If you return 0, you'll |
174 | * get called forever, which is bad. | 174 | * get called forever, which is bad. |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 05e5f59e87f..ce949d5fae3 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -1894,11 +1894,11 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) | |||
1894 | u8 *fw_data; | 1894 | u8 *fw_data; |
1895 | struct ch_mem_range t; | 1895 | struct ch_mem_range t; |
1896 | 1896 | ||
1897 | if (!capable(CAP_NET_ADMIN)) | 1897 | if (!capable(CAP_SYS_RAWIO)) |
1898 | return -EPERM; | 1898 | return -EPERM; |
1899 | if (copy_from_user(&t, useraddr, sizeof(t))) | 1899 | if (copy_from_user(&t, useraddr, sizeof(t))) |
1900 | return -EFAULT; | 1900 | return -EFAULT; |
1901 | 1901 | /* Check t.len sanity ? */ | |
1902 | fw_data = kmalloc(t.len, GFP_KERNEL); | 1902 | fw_data = kmalloc(t.len, GFP_KERNEL); |
1903 | if (!fw_data) | 1903 | if (!fw_data) |
1904 | return -ENOMEM; | 1904 | return -ENOMEM; |
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index 2a53875cddb..f823b8ba578 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h | |||
@@ -648,6 +648,8 @@ | |||
648 | #define IFE_E_PHY_ID 0x02A80330 | 648 | #define IFE_E_PHY_ID 0x02A80330 |
649 | #define IFE_PLUS_E_PHY_ID 0x02A80320 | 649 | #define IFE_PLUS_E_PHY_ID 0x02A80320 |
650 | #define IFE_C_E_PHY_ID 0x02A80310 | 650 | #define IFE_C_E_PHY_ID 0x02A80310 |
651 | #define BME1000_E_PHY_ID 0x01410CB0 | ||
652 | #define BME1000_E_PHY_ID_R2 0x01410CB1 | ||
651 | 653 | ||
652 | /* M88E1000 Specific Registers */ | 654 | /* M88E1000 Specific Registers */ |
653 | #define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ | 655 | #define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ |
@@ -701,6 +703,14 @@ | |||
701 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00 | 703 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00 |
702 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X 0x0800 | 704 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X 0x0800 |
703 | 705 | ||
706 | /* BME1000 PHY Specific Control Register */ | ||
707 | #define BME1000_PSCR_ENABLE_DOWNSHIFT 0x0800 /* 1 = enable downshift */ | ||
708 | |||
709 | |||
710 | #define PHY_PAGE_SHIFT 5 | ||
711 | #define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \ | ||
712 | ((reg) & MAX_PHY_REG_ADDRESS)) | ||
713 | |||
704 | /* | 714 | /* |
705 | * Bits... | 715 | * Bits... |
706 | * 15-5: page | 716 | * 15-5: page |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 38bfd0d261f..d3bc6f8101f 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -127,7 +127,7 @@ struct e1000_buffer { | |||
127 | /* arrays of page information for packet split */ | 127 | /* arrays of page information for packet split */ |
128 | struct e1000_ps_page *ps_pages; | 128 | struct e1000_ps_page *ps_pages; |
129 | }; | 129 | }; |
130 | 130 | struct page *page; | |
131 | }; | 131 | }; |
132 | 132 | ||
133 | struct e1000_ring { | 133 | struct e1000_ring { |
@@ -304,6 +304,7 @@ struct e1000_info { | |||
304 | #define FLAG_HAS_CTRLEXT_ON_LOAD (1 << 5) | 304 | #define FLAG_HAS_CTRLEXT_ON_LOAD (1 << 5) |
305 | #define FLAG_HAS_SWSM_ON_LOAD (1 << 6) | 305 | #define FLAG_HAS_SWSM_ON_LOAD (1 << 6) |
306 | #define FLAG_HAS_JUMBO_FRAMES (1 << 7) | 306 | #define FLAG_HAS_JUMBO_FRAMES (1 << 7) |
307 | #define FLAG_IS_ICH (1 << 9) | ||
307 | #define FLAG_HAS_SMART_POWER_DOWN (1 << 11) | 308 | #define FLAG_HAS_SMART_POWER_DOWN (1 << 11) |
308 | #define FLAG_IS_QUAD_PORT_A (1 << 12) | 309 | #define FLAG_IS_QUAD_PORT_A (1 << 12) |
309 | #define FLAG_IS_QUAD_PORT (1 << 13) | 310 | #define FLAG_IS_QUAD_PORT (1 << 13) |
@@ -386,6 +387,7 @@ extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, | |||
386 | bool state); | 387 | bool state); |
387 | extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); | 388 | extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); |
388 | extern void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); | 389 | extern void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); |
390 | extern void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw); | ||
389 | 391 | ||
390 | extern s32 e1000e_check_for_copper_link(struct e1000_hw *hw); | 392 | extern s32 e1000e_check_for_copper_link(struct e1000_hw *hw); |
391 | extern s32 e1000e_check_for_fiber_link(struct e1000_hw *hw); | 393 | extern s32 e1000e_check_for_fiber_link(struct e1000_hw *hw); |
@@ -443,6 +445,9 @@ extern s32 e1000e_get_phy_info_m88(struct e1000_hw *hw); | |||
443 | extern s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data); | 445 | extern s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data); |
444 | extern s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data); | 446 | extern s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data); |
445 | extern enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id); | 447 | extern enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id); |
448 | extern s32 e1000e_determine_phy_address(struct e1000_hw *hw); | ||
449 | extern s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data); | ||
450 | extern s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data); | ||
446 | extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl); | 451 | extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl); |
447 | extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); | 452 | extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); |
448 | extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); | 453 | extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index ce045acce63..a14561f40db 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -494,8 +494,12 @@ static int e1000_get_eeprom(struct net_device *netdev, | |||
494 | for (i = 0; i < last_word - first_word + 1; i++) { | 494 | for (i = 0; i < last_word - first_word + 1; i++) { |
495 | ret_val = e1000_read_nvm(hw, first_word + i, 1, | 495 | ret_val = e1000_read_nvm(hw, first_word + i, 1, |
496 | &eeprom_buff[i]); | 496 | &eeprom_buff[i]); |
497 | if (ret_val) | 497 | if (ret_val) { |
498 | /* a read error occurred, throw away the | ||
499 | * result */ | ||
500 | memset(eeprom_buff, 0xff, sizeof(eeprom_buff)); | ||
498 | break; | 501 | break; |
502 | } | ||
499 | } | 503 | } |
500 | } | 504 | } |
501 | 505 | ||
@@ -803,8 +807,7 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data) | |||
803 | /* restore previous status */ | 807 | /* restore previous status */ |
804 | ew32(STATUS, before); | 808 | ew32(STATUS, before); |
805 | 809 | ||
806 | if ((mac->type != e1000_ich8lan) && | 810 | if (!(adapter->flags & FLAG_IS_ICH)) { |
807 | (mac->type != e1000_ich9lan)) { | ||
808 | REG_PATTERN_TEST(E1000_FCAL, 0xFFFFFFFF, 0xFFFFFFFF); | 811 | REG_PATTERN_TEST(E1000_FCAL, 0xFFFFFFFF, 0xFFFFFFFF); |
809 | REG_PATTERN_TEST(E1000_FCAH, 0x0000FFFF, 0xFFFFFFFF); | 812 | REG_PATTERN_TEST(E1000_FCAH, 0x0000FFFF, 0xFFFFFFFF); |
810 | REG_PATTERN_TEST(E1000_FCT, 0x0000FFFF, 0xFFFFFFFF); | 813 | REG_PATTERN_TEST(E1000_FCT, 0x0000FFFF, 0xFFFFFFFF); |
@@ -824,15 +827,13 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data) | |||
824 | 827 | ||
825 | REG_SET_AND_CHECK(E1000_RCTL, 0xFFFFFFFF, 0x00000000); | 828 | REG_SET_AND_CHECK(E1000_RCTL, 0xFFFFFFFF, 0x00000000); |
826 | 829 | ||
827 | before = (((mac->type == e1000_ich8lan) || | 830 | before = ((adapter->flags & FLAG_IS_ICH) ? 0x06C3B33E : 0x06DFB3FE); |
828 | (mac->type == e1000_ich9lan)) ? 0x06C3B33E : 0x06DFB3FE); | ||
829 | REG_SET_AND_CHECK(E1000_RCTL, before, 0x003FFFFB); | 831 | REG_SET_AND_CHECK(E1000_RCTL, before, 0x003FFFFB); |
830 | REG_SET_AND_CHECK(E1000_TCTL, 0xFFFFFFFF, 0x00000000); | 832 | REG_SET_AND_CHECK(E1000_TCTL, 0xFFFFFFFF, 0x00000000); |
831 | 833 | ||
832 | REG_SET_AND_CHECK(E1000_RCTL, before, 0xFFFFFFFF); | 834 | REG_SET_AND_CHECK(E1000_RCTL, before, 0xFFFFFFFF); |
833 | REG_PATTERN_TEST(E1000_RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); | 835 | REG_PATTERN_TEST(E1000_RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); |
834 | if ((mac->type != e1000_ich8lan) && | 836 | if (!(adapter->flags & FLAG_IS_ICH)) |
835 | (mac->type != e1000_ich9lan)) | ||
836 | REG_PATTERN_TEST(E1000_TXCW, 0xC000FFFF, 0x0000FFFF); | 837 | REG_PATTERN_TEST(E1000_TXCW, 0xC000FFFF, 0x0000FFFF); |
837 | REG_PATTERN_TEST(E1000_TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); | 838 | REG_PATTERN_TEST(E1000_TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); |
838 | REG_PATTERN_TEST(E1000_TIDV, 0x0000FFFF, 0x0000FFFF); | 839 | REG_PATTERN_TEST(E1000_TIDV, 0x0000FFFF, 0x0000FFFF); |
@@ -911,9 +912,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data) | |||
911 | 912 | ||
912 | /* Test each interrupt */ | 913 | /* Test each interrupt */ |
913 | for (i = 0; i < 10; i++) { | 914 | for (i = 0; i < 10; i++) { |
914 | 915 | if ((adapter->flags & FLAG_IS_ICH) && (i == 8)) | |
915 | if (((adapter->hw.mac.type == e1000_ich8lan) || | ||
916 | (adapter->hw.mac.type == e1000_ich9lan)) && i == 8) | ||
917 | continue; | 916 | continue; |
918 | 917 | ||
919 | /* Interrupt to test */ | 918 | /* Interrupt to test */ |
@@ -1184,6 +1183,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1184 | struct e1000_hw *hw = &adapter->hw; | 1183 | struct e1000_hw *hw = &adapter->hw; |
1185 | u32 ctrl_reg = 0; | 1184 | u32 ctrl_reg = 0; |
1186 | u32 stat_reg = 0; | 1185 | u32 stat_reg = 0; |
1186 | u16 phy_reg = 0; | ||
1187 | 1187 | ||
1188 | hw->mac.autoneg = 0; | 1188 | hw->mac.autoneg = 0; |
1189 | 1189 | ||
@@ -1211,6 +1211,28 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1211 | E1000_CTRL_SPD_100 |/* Force Speed to 100 */ | 1211 | E1000_CTRL_SPD_100 |/* Force Speed to 100 */ |
1212 | E1000_CTRL_FD); /* Force Duplex to FULL */ | 1212 | E1000_CTRL_FD); /* Force Duplex to FULL */ |
1213 | break; | 1213 | break; |
1214 | case e1000_phy_bm: | ||
1215 | /* Set Default MAC Interface speed to 1GB */ | ||
1216 | e1e_rphy(hw, PHY_REG(2, 21), &phy_reg); | ||
1217 | phy_reg &= ~0x0007; | ||
1218 | phy_reg |= 0x006; | ||
1219 | e1e_wphy(hw, PHY_REG(2, 21), phy_reg); | ||
1220 | /* Assert SW reset for above settings to take effect */ | ||
1221 | e1000e_commit_phy(hw); | ||
1222 | mdelay(1); | ||
1223 | /* Force Full Duplex */ | ||
1224 | e1e_rphy(hw, PHY_REG(769, 16), &phy_reg); | ||
1225 | e1e_wphy(hw, PHY_REG(769, 16), phy_reg | 0x000C); | ||
1226 | /* Set Link Up (in force link) */ | ||
1227 | e1e_rphy(hw, PHY_REG(776, 16), &phy_reg); | ||
1228 | e1e_wphy(hw, PHY_REG(776, 16), phy_reg | 0x0040); | ||
1229 | /* Force Link */ | ||
1230 | e1e_rphy(hw, PHY_REG(769, 16), &phy_reg); | ||
1231 | e1e_wphy(hw, PHY_REG(769, 16), phy_reg | 0x0040); | ||
1232 | /* Set Early Link Enable */ | ||
1233 | e1e_rphy(hw, PHY_REG(769, 20), &phy_reg); | ||
1234 | e1e_wphy(hw, PHY_REG(769, 20), phy_reg | 0x0400); | ||
1235 | /* fall through */ | ||
1214 | default: | 1236 | default: |
1215 | /* force 1000, set loopback */ | 1237 | /* force 1000, set loopback */ |
1216 | e1e_wphy(hw, PHY_CONTROL, 0x4140); | 1238 | e1e_wphy(hw, PHY_CONTROL, 0x4140); |
@@ -1224,8 +1246,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1224 | E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ | 1246 | E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ |
1225 | E1000_CTRL_FD); /* Force Duplex to FULL */ | 1247 | E1000_CTRL_FD); /* Force Duplex to FULL */ |
1226 | 1248 | ||
1227 | if ((adapter->hw.mac.type == e1000_ich8lan) || | 1249 | if (adapter->flags & FLAG_IS_ICH) |
1228 | (adapter->hw.mac.type == e1000_ich9lan)) | ||
1229 | ctrl_reg |= E1000_CTRL_SLU; /* Set Link Up */ | 1250 | ctrl_reg |= E1000_CTRL_SLU; /* Set Link Up */ |
1230 | } | 1251 | } |
1231 | 1252 | ||
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index a930e6d9cf0..74f263acb17 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -216,6 +216,21 @@ enum e1e_registers { | |||
216 | #define IGP01E1000_PHY_LINK_HEALTH 0x13 /* PHY Link Health */ | 216 | #define IGP01E1000_PHY_LINK_HEALTH 0x13 /* PHY Link Health */ |
217 | #define IGP02E1000_PHY_POWER_MGMT 0x19 /* Power Management */ | 217 | #define IGP02E1000_PHY_POWER_MGMT 0x19 /* Power Management */ |
218 | #define IGP01E1000_PHY_PAGE_SELECT 0x1F /* Page Select */ | 218 | #define IGP01E1000_PHY_PAGE_SELECT 0x1F /* Page Select */ |
219 | #define BM_PHY_PAGE_SELECT 22 /* Page Select for BM */ | ||
220 | #define IGP_PAGE_SHIFT 5 | ||
221 | #define PHY_REG_MASK 0x1F | ||
222 | |||
223 | #define BM_WUC_PAGE 800 | ||
224 | #define BM_WUC_ADDRESS_OPCODE 0x11 | ||
225 | #define BM_WUC_DATA_OPCODE 0x12 | ||
226 | #define BM_WUC_ENABLE_PAGE 769 | ||
227 | #define BM_WUC_ENABLE_REG 17 | ||
228 | #define BM_WUC_ENABLE_BIT (1 << 2) | ||
229 | #define BM_WUC_HOST_WU_BIT (1 << 4) | ||
230 | |||
231 | #define BM_WUC PHY_REG(BM_WUC_PAGE, 1) | ||
232 | #define BM_WUFC PHY_REG(BM_WUC_PAGE, 2) | ||
233 | #define BM_WUS PHY_REG(BM_WUC_PAGE, 3) | ||
219 | 234 | ||
220 | #define IGP01E1000_PHY_PCS_INIT_REG 0x00B4 | 235 | #define IGP01E1000_PHY_PCS_INIT_REG 0x00B4 |
221 | #define IGP01E1000_PHY_POLARITY_MASK 0x0078 | 236 | #define IGP01E1000_PHY_POLARITY_MASK 0x0078 |
@@ -331,10 +346,16 @@ enum e1e_registers { | |||
331 | #define E1000_DEV_ID_ICH8_IFE_G 0x10C5 | 346 | #define E1000_DEV_ID_ICH8_IFE_G 0x10C5 |
332 | #define E1000_DEV_ID_ICH8_IGP_M 0x104D | 347 | #define E1000_DEV_ID_ICH8_IGP_M 0x104D |
333 | #define E1000_DEV_ID_ICH9_IGP_AMT 0x10BD | 348 | #define E1000_DEV_ID_ICH9_IGP_AMT 0x10BD |
349 | #define E1000_DEV_ID_ICH9_IGP_M_AMT 0x10F5 | ||
350 | #define E1000_DEV_ID_ICH9_IGP_M 0x10BF | ||
351 | #define E1000_DEV_ID_ICH9_IGP_M_V 0x10CB | ||
334 | #define E1000_DEV_ID_ICH9_IGP_C 0x294C | 352 | #define E1000_DEV_ID_ICH9_IGP_C 0x294C |
335 | #define E1000_DEV_ID_ICH9_IFE 0x10C0 | 353 | #define E1000_DEV_ID_ICH9_IFE 0x10C0 |
336 | #define E1000_DEV_ID_ICH9_IFE_GT 0x10C3 | 354 | #define E1000_DEV_ID_ICH9_IFE_GT 0x10C3 |
337 | #define E1000_DEV_ID_ICH9_IFE_G 0x10C2 | 355 | #define E1000_DEV_ID_ICH9_IFE_G 0x10C2 |
356 | #define E1000_DEV_ID_ICH10_R_BM_LM 0x10CC | ||
357 | #define E1000_DEV_ID_ICH10_R_BM_LF 0x10CD | ||
358 | #define E1000_DEV_ID_ICH10_R_BM_V 0x10CE | ||
338 | 359 | ||
339 | #define E1000_FUNC_1 1 | 360 | #define E1000_FUNC_1 1 |
340 | 361 | ||
@@ -378,6 +399,7 @@ enum e1000_phy_type { | |||
378 | e1000_phy_gg82563, | 399 | e1000_phy_gg82563, |
379 | e1000_phy_igp_3, | 400 | e1000_phy_igp_3, |
380 | e1000_phy_ife, | 401 | e1000_phy_ife, |
402 | e1000_phy_bm, | ||
381 | }; | 403 | }; |
382 | 404 | ||
383 | enum e1000_bus_width { | 405 | enum e1000_bus_width { |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 768485dbb2c..9e38452a738 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -38,6 +38,12 @@ | |||
38 | * 82566DM Gigabit Network Connection | 38 | * 82566DM Gigabit Network Connection |
39 | * 82566MC Gigabit Network Connection | 39 | * 82566MC Gigabit Network Connection |
40 | * 82566MM Gigabit Network Connection | 40 | * 82566MM Gigabit Network Connection |
41 | * 82567LM Gigabit Network Connection | ||
42 | * 82567LF Gigabit Network Connection | ||
43 | * 82567LM-2 Gigabit Network Connection | ||
44 | * 82567LF-2 Gigabit Network Connection | ||
45 | * 82567V-2 Gigabit Network Connection | ||
46 | * 82562GT-3 10/100 Network Connection | ||
41 | */ | 47 | */ |
42 | 48 | ||
43 | #include <linux/netdevice.h> | 49 | #include <linux/netdevice.h> |
@@ -198,6 +204,19 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) | |||
198 | phy->addr = 1; | 204 | phy->addr = 1; |
199 | phy->reset_delay_us = 100; | 205 | phy->reset_delay_us = 100; |
200 | 206 | ||
207 | /* | ||
208 | * We may need to do this twice - once for IGP and if that fails, | ||
209 | * we'll set BM func pointers and try again | ||
210 | */ | ||
211 | ret_val = e1000e_determine_phy_address(hw); | ||
212 | if (ret_val) { | ||
213 | hw->phy.ops.write_phy_reg = e1000e_write_phy_reg_bm; | ||
214 | hw->phy.ops.read_phy_reg = e1000e_read_phy_reg_bm; | ||
215 | ret_val = e1000e_determine_phy_address(hw); | ||
216 | if (ret_val) | ||
217 | return ret_val; | ||
218 | } | ||
219 | |||
201 | phy->id = 0; | 220 | phy->id = 0; |
202 | while ((e1000_phy_unknown == e1000e_get_phy_type_from_id(phy->id)) && | 221 | while ((e1000_phy_unknown == e1000e_get_phy_type_from_id(phy->id)) && |
203 | (i++ < 100)) { | 222 | (i++ < 100)) { |
@@ -219,6 +238,13 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw) | |||
219 | phy->type = e1000_phy_ife; | 238 | phy->type = e1000_phy_ife; |
220 | phy->autoneg_mask = E1000_ALL_NOT_GIG; | 239 | phy->autoneg_mask = E1000_ALL_NOT_GIG; |
221 | break; | 240 | break; |
241 | case BME1000_E_PHY_ID: | ||
242 | phy->type = e1000_phy_bm; | ||
243 | phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; | ||
244 | hw->phy.ops.read_phy_reg = e1000e_read_phy_reg_bm; | ||
245 | hw->phy.ops.write_phy_reg = e1000e_write_phy_reg_bm; | ||
246 | hw->phy.ops.commit_phy = e1000e_phy_sw_reset; | ||
247 | break; | ||
222 | default: | 248 | default: |
223 | return -E1000_ERR_PHY; | 249 | return -E1000_ERR_PHY; |
224 | break; | 250 | break; |
@@ -664,6 +690,7 @@ static s32 e1000_get_phy_info_ich8lan(struct e1000_hw *hw) | |||
664 | return e1000_get_phy_info_ife_ich8lan(hw); | 690 | return e1000_get_phy_info_ife_ich8lan(hw); |
665 | break; | 691 | break; |
666 | case e1000_phy_igp_3: | 692 | case e1000_phy_igp_3: |
693 | case e1000_phy_bm: | ||
667 | return e1000e_get_phy_info_igp(hw); | 694 | return e1000e_get_phy_info_igp(hw); |
668 | break; | 695 | break; |
669 | default: | 696 | default: |
@@ -728,7 +755,7 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
728 | s32 ret_val = 0; | 755 | s32 ret_val = 0; |
729 | u16 data; | 756 | u16 data; |
730 | 757 | ||
731 | if (phy->type != e1000_phy_igp_3) | 758 | if (phy->type == e1000_phy_ife) |
732 | return ret_val; | 759 | return ret_val; |
733 | 760 | ||
734 | phy_ctrl = er32(PHY_CTRL); | 761 | phy_ctrl = er32(PHY_CTRL); |
@@ -1918,8 +1945,35 @@ static s32 e1000_setup_copper_link_ich8lan(struct e1000_hw *hw) | |||
1918 | ret_val = e1000e_copper_link_setup_igp(hw); | 1945 | ret_val = e1000e_copper_link_setup_igp(hw); |
1919 | if (ret_val) | 1946 | if (ret_val) |
1920 | return ret_val; | 1947 | return ret_val; |
1948 | } else if (hw->phy.type == e1000_phy_bm) { | ||
1949 | ret_val = e1000e_copper_link_setup_m88(hw); | ||
1950 | if (ret_val) | ||
1951 | return ret_val; | ||
1921 | } | 1952 | } |
1922 | 1953 | ||
1954 | if (hw->phy.type == e1000_phy_ife) { | ||
1955 | ret_val = e1e_rphy(hw, IFE_PHY_MDIX_CONTROL, ®_data); | ||
1956 | if (ret_val) | ||
1957 | return ret_val; | ||
1958 | |||
1959 | reg_data &= ~IFE_PMC_AUTO_MDIX; | ||
1960 | |||
1961 | switch (hw->phy.mdix) { | ||
1962 | case 1: | ||
1963 | reg_data &= ~IFE_PMC_FORCE_MDIX; | ||
1964 | break; | ||
1965 | case 2: | ||
1966 | reg_data |= IFE_PMC_FORCE_MDIX; | ||
1967 | break; | ||
1968 | case 0: | ||
1969 | default: | ||
1970 | reg_data |= IFE_PMC_AUTO_MDIX; | ||
1971 | break; | ||
1972 | } | ||
1973 | ret_val = e1e_wphy(hw, IFE_PHY_MDIX_CONTROL, reg_data); | ||
1974 | if (ret_val) | ||
1975 | return ret_val; | ||
1976 | } | ||
1923 | return e1000e_setup_copper_link(hw); | 1977 | return e1000e_setup_copper_link(hw); |
1924 | } | 1978 | } |
1925 | 1979 | ||
@@ -2127,6 +2181,31 @@ void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw) | |||
2127 | } | 2181 | } |
2128 | 2182 | ||
2129 | /** | 2183 | /** |
2184 | * e1000e_disable_gig_wol_ich8lan - disable gig during WoL | ||
2185 | * @hw: pointer to the HW structure | ||
2186 | * | ||
2187 | * During S0 to Sx transition, it is possible the link remains at gig | ||
2188 | * instead of negotiating to a lower speed. Before going to Sx, set | ||
2189 | * 'LPLU Enabled' and 'Gig Disable' to force link speed negotiation | ||
2190 | * to a lower speed. | ||
2191 | * | ||
2192 | * Should only be called for ICH9 devices. | ||
2193 | **/ | ||
2194 | void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw) | ||
2195 | { | ||
2196 | u32 phy_ctrl; | ||
2197 | |||
2198 | if (hw->mac.type == e1000_ich9lan) { | ||
2199 | phy_ctrl = er32(PHY_CTRL); | ||
2200 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | | ||
2201 | E1000_PHY_CTRL_GBE_DISABLE; | ||
2202 | ew32(PHY_CTRL, phy_ctrl); | ||
2203 | } | ||
2204 | |||
2205 | return; | ||
2206 | } | ||
2207 | |||
2208 | /** | ||
2130 | * e1000_cleanup_led_ich8lan - Restore the default LED operation | 2209 | * e1000_cleanup_led_ich8lan - Restore the default LED operation |
2131 | * @hw: pointer to the HW structure | 2210 | * @hw: pointer to the HW structure |
2132 | * | 2211 | * |
@@ -2247,6 +2326,7 @@ static struct e1000_nvm_operations ich8_nvm_ops = { | |||
2247 | struct e1000_info e1000_ich8_info = { | 2326 | struct e1000_info e1000_ich8_info = { |
2248 | .mac = e1000_ich8lan, | 2327 | .mac = e1000_ich8lan, |
2249 | .flags = FLAG_HAS_WOL | 2328 | .flags = FLAG_HAS_WOL |
2329 | | FLAG_IS_ICH | ||
2250 | | FLAG_RX_CSUM_ENABLED | 2330 | | FLAG_RX_CSUM_ENABLED |
2251 | | FLAG_HAS_CTRLEXT_ON_LOAD | 2331 | | FLAG_HAS_CTRLEXT_ON_LOAD |
2252 | | FLAG_HAS_AMT | 2332 | | FLAG_HAS_AMT |
@@ -2262,6 +2342,7 @@ struct e1000_info e1000_ich8_info = { | |||
2262 | struct e1000_info e1000_ich9_info = { | 2342 | struct e1000_info e1000_ich9_info = { |
2263 | .mac = e1000_ich9lan, | 2343 | .mac = e1000_ich9lan, |
2264 | .flags = FLAG_HAS_JUMBO_FRAMES | 2344 | .flags = FLAG_HAS_JUMBO_FRAMES |
2345 | | FLAG_IS_ICH | ||
2265 | | FLAG_HAS_WOL | 2346 | | FLAG_HAS_WOL |
2266 | | FLAG_RX_CSUM_ENABLED | 2347 | | FLAG_RX_CSUM_ENABLED |
2267 | | FLAG_HAS_CTRLEXT_ON_LOAD | 2348 | | FLAG_HAS_CTRLEXT_ON_LOAD |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 8991ab8911e..8cbb40f3a50 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -43,10 +43,11 @@ | |||
43 | #include <linux/if_vlan.h> | 43 | #include <linux/if_vlan.h> |
44 | #include <linux/cpu.h> | 44 | #include <linux/cpu.h> |
45 | #include <linux/smp.h> | 45 | #include <linux/smp.h> |
46 | #include <linux/pm_qos_params.h> | ||
46 | 47 | ||
47 | #include "e1000.h" | 48 | #include "e1000.h" |
48 | 49 | ||
49 | #define DRV_VERSION "0.2.1" | 50 | #define DRV_VERSION "0.3.3.3-k2" |
50 | char e1000e_driver_name[] = "e1000e"; | 51 | char e1000e_driver_name[] = "e1000e"; |
51 | const char e1000e_driver_version[] = DRV_VERSION; | 52 | const char e1000e_driver_version[] = DRV_VERSION; |
52 | 53 | ||
@@ -341,6 +342,89 @@ no_buffers: | |||
341 | } | 342 | } |
342 | 343 | ||
343 | /** | 344 | /** |
345 | * e1000_alloc_jumbo_rx_buffers - Replace used jumbo receive buffers | ||
346 | * @adapter: address of board private structure | ||
347 | * @rx_ring: pointer to receive ring structure | ||
348 | * @cleaned_count: number of buffers to allocate this pass | ||
349 | **/ | ||
350 | |||
351 | static void e1000_alloc_jumbo_rx_buffers(struct e1000_adapter *adapter, | ||
352 | int cleaned_count) | ||
353 | { | ||
354 | struct net_device *netdev = adapter->netdev; | ||
355 | struct pci_dev *pdev = adapter->pdev; | ||
356 | struct e1000_rx_desc *rx_desc; | ||
357 | struct e1000_ring *rx_ring = adapter->rx_ring; | ||
358 | struct e1000_buffer *buffer_info; | ||
359 | struct sk_buff *skb; | ||
360 | unsigned int i; | ||
361 | unsigned int bufsz = 256 - | ||
362 | 16 /* for skb_reserve */ - | ||
363 | NET_IP_ALIGN; | ||
364 | |||
365 | i = rx_ring->next_to_use; | ||
366 | buffer_info = &rx_ring->buffer_info[i]; | ||
367 | |||
368 | while (cleaned_count--) { | ||
369 | skb = buffer_info->skb; | ||
370 | if (skb) { | ||
371 | skb_trim(skb, 0); | ||
372 | goto check_page; | ||
373 | } | ||
374 | |||
375 | skb = netdev_alloc_skb(netdev, bufsz); | ||
376 | if (unlikely(!skb)) { | ||
377 | /* Better luck next round */ | ||
378 | adapter->alloc_rx_buff_failed++; | ||
379 | break; | ||
380 | } | ||
381 | |||
382 | /* Make buffer alignment 2 beyond a 16 byte boundary | ||
383 | * this will result in a 16 byte aligned IP header after | ||
384 | * the 14 byte MAC header is removed | ||
385 | */ | ||
386 | skb_reserve(skb, NET_IP_ALIGN); | ||
387 | |||
388 | buffer_info->skb = skb; | ||
389 | check_page: | ||
390 | /* allocate a new page if necessary */ | ||
391 | if (!buffer_info->page) { | ||
392 | buffer_info->page = alloc_page(GFP_ATOMIC); | ||
393 | if (unlikely(!buffer_info->page)) { | ||
394 | adapter->alloc_rx_buff_failed++; | ||
395 | break; | ||
396 | } | ||
397 | } | ||
398 | |||
399 | if (!buffer_info->dma) | ||
400 | buffer_info->dma = pci_map_page(pdev, | ||
401 | buffer_info->page, 0, | ||
402 | PAGE_SIZE, | ||
403 | PCI_DMA_FROMDEVICE); | ||
404 | |||
405 | rx_desc = E1000_RX_DESC(*rx_ring, i); | ||
406 | rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); | ||
407 | |||
408 | if (unlikely(++i == rx_ring->count)) | ||
409 | i = 0; | ||
410 | buffer_info = &rx_ring->buffer_info[i]; | ||
411 | } | ||
412 | |||
413 | if (likely(rx_ring->next_to_use != i)) { | ||
414 | rx_ring->next_to_use = i; | ||
415 | if (unlikely(i-- == 0)) | ||
416 | i = (rx_ring->count - 1); | ||
417 | |||
418 | /* Force memory writes to complete before letting h/w | ||
419 | * know there are new descriptors to fetch. (Only | ||
420 | * applicable for weak-ordered memory model archs, | ||
421 | * such as IA-64). */ | ||
422 | wmb(); | ||
423 | writel(i, adapter->hw.hw_addr + rx_ring->tail); | ||
424 | } | ||
425 | } | ||
426 | |||
427 | /** | ||
344 | * e1000_clean_rx_irq - Send received data up the network stack; legacy | 428 | * e1000_clean_rx_irq - Send received data up the network stack; legacy |
345 | * @adapter: board private structure | 429 | * @adapter: board private structure |
346 | * | 430 | * |
@@ -783,6 +867,186 @@ next_desc: | |||
783 | } | 867 | } |
784 | 868 | ||
785 | /** | 869 | /** |
870 | * e1000_consume_page - helper function | ||
871 | **/ | ||
872 | static void e1000_consume_page(struct e1000_buffer *bi, struct sk_buff *skb, | ||
873 | u16 length) | ||
874 | { | ||
875 | bi->page = NULL; | ||
876 | skb->len += length; | ||
877 | skb->data_len += length; | ||
878 | skb->truesize += length; | ||
879 | } | ||
880 | |||
881 | /** | ||
882 | * e1000_clean_jumbo_rx_irq - Send received data up the network stack; legacy | ||
883 | * @adapter: board private structure | ||
884 | * | ||
885 | * the return value indicates whether actual cleaning was done, there | ||
886 | * is no guarantee that everything was cleaned | ||
887 | **/ | ||
888 | |||
889 | static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, | ||
890 | int *work_done, int work_to_do) | ||
891 | { | ||
892 | struct net_device *netdev = adapter->netdev; | ||
893 | struct pci_dev *pdev = adapter->pdev; | ||
894 | struct e1000_ring *rx_ring = adapter->rx_ring; | ||
895 | struct e1000_rx_desc *rx_desc, *next_rxd; | ||
896 | struct e1000_buffer *buffer_info, *next_buffer; | ||
897 | u32 length; | ||
898 | unsigned int i; | ||
899 | int cleaned_count = 0; | ||
900 | bool cleaned = false; | ||
901 | unsigned int total_rx_bytes=0, total_rx_packets=0; | ||
902 | |||
903 | i = rx_ring->next_to_clean; | ||
904 | rx_desc = E1000_RX_DESC(*rx_ring, i); | ||
905 | buffer_info = &rx_ring->buffer_info[i]; | ||
906 | |||
907 | while (rx_desc->status & E1000_RXD_STAT_DD) { | ||
908 | struct sk_buff *skb; | ||
909 | u8 status; | ||
910 | |||
911 | if (*work_done >= work_to_do) | ||
912 | break; | ||
913 | (*work_done)++; | ||
914 | |||
915 | status = rx_desc->status; | ||
916 | skb = buffer_info->skb; | ||
917 | buffer_info->skb = NULL; | ||
918 | |||
919 | ++i; | ||
920 | if (i == rx_ring->count) | ||
921 | i = 0; | ||
922 | next_rxd = E1000_RX_DESC(*rx_ring, i); | ||
923 | prefetch(next_rxd); | ||
924 | |||
925 | next_buffer = &rx_ring->buffer_info[i]; | ||
926 | |||
927 | cleaned = true; | ||
928 | cleaned_count++; | ||
929 | pci_unmap_page(pdev, buffer_info->dma, PAGE_SIZE, | ||
930 | PCI_DMA_FROMDEVICE); | ||
931 | buffer_info->dma = 0; | ||
932 | |||
933 | length = le16_to_cpu(rx_desc->length); | ||
934 | |||
935 | /* errors is only valid for DD + EOP descriptors */ | ||
936 | if (unlikely((status & E1000_RXD_STAT_EOP) && | ||
937 | (rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK))) { | ||
938 | /* recycle both page and skb */ | ||
939 | buffer_info->skb = skb; | ||
940 | /* an error means any chain goes out the window | ||
941 | * too */ | ||
942 | if (rx_ring->rx_skb_top) | ||
943 | dev_kfree_skb(rx_ring->rx_skb_top); | ||
944 | rx_ring->rx_skb_top = NULL; | ||
945 | goto next_desc; | ||
946 | } | ||
947 | |||
948 | #define rxtop rx_ring->rx_skb_top | ||
949 | if (!(status & E1000_RXD_STAT_EOP)) { | ||
950 | /* this descriptor is only the beginning (or middle) */ | ||
951 | if (!rxtop) { | ||
952 | /* this is the beginning of a chain */ | ||
953 | rxtop = skb; | ||
954 | skb_fill_page_desc(rxtop, 0, buffer_info->page, | ||
955 | 0, length); | ||
956 | } else { | ||
957 | /* this is the middle of a chain */ | ||
958 | skb_fill_page_desc(rxtop, | ||
959 | skb_shinfo(rxtop)->nr_frags, | ||
960 | buffer_info->page, 0, length); | ||
961 | /* re-use the skb, only consumed the page */ | ||
962 | buffer_info->skb = skb; | ||
963 | } | ||
964 | e1000_consume_page(buffer_info, rxtop, length); | ||
965 | goto next_desc; | ||
966 | } else { | ||
967 | if (rxtop) { | ||
968 | /* end of the chain */ | ||
969 | skb_fill_page_desc(rxtop, | ||
970 | skb_shinfo(rxtop)->nr_frags, | ||
971 | buffer_info->page, 0, length); | ||
972 | /* re-use the current skb, we only consumed the | ||
973 | * page */ | ||
974 | buffer_info->skb = skb; | ||
975 | skb = rxtop; | ||
976 | rxtop = NULL; | ||
977 | e1000_consume_page(buffer_info, skb, length); | ||
978 | } else { | ||
979 | /* no chain, got EOP, this buf is the packet | ||
980 | * copybreak to save the put_page/alloc_page */ | ||
981 | if (length <= copybreak && | ||
982 | skb_tailroom(skb) >= length) { | ||
983 | u8 *vaddr; | ||
984 | vaddr = kmap_atomic(buffer_info->page, | ||
985 | KM_SKB_DATA_SOFTIRQ); | ||
986 | memcpy(skb_tail_pointer(skb), vaddr, | ||
987 | length); | ||
988 | kunmap_atomic(vaddr, | ||
989 | KM_SKB_DATA_SOFTIRQ); | ||
990 | /* re-use the page, so don't erase | ||
991 | * buffer_info->page */ | ||
992 | skb_put(skb, length); | ||
993 | } else { | ||
994 | skb_fill_page_desc(skb, 0, | ||
995 | buffer_info->page, 0, | ||
996 | length); | ||
997 | e1000_consume_page(buffer_info, skb, | ||
998 | length); | ||
999 | } | ||
1000 | } | ||
1001 | } | ||
1002 | |||
1003 | /* Receive Checksum Offload XXX recompute due to CRC strip? */ | ||
1004 | e1000_rx_checksum(adapter, | ||
1005 | (u32)(status) | | ||
1006 | ((u32)(rx_desc->errors) << 24), | ||
1007 | le16_to_cpu(rx_desc->csum), skb); | ||
1008 | |||
1009 | /* probably a little skewed due to removing CRC */ | ||
1010 | total_rx_bytes += skb->len; | ||
1011 | total_rx_packets++; | ||
1012 | |||
1013 | /* eth type trans needs skb->data to point to something */ | ||
1014 | if (!pskb_may_pull(skb, ETH_HLEN)) { | ||
1015 | ndev_err(netdev, "pskb_may_pull failed.\n"); | ||
1016 | dev_kfree_skb(skb); | ||
1017 | goto next_desc; | ||
1018 | } | ||
1019 | |||
1020 | e1000_receive_skb(adapter, netdev, skb, status, | ||
1021 | rx_desc->special); | ||
1022 | |||
1023 | next_desc: | ||
1024 | rx_desc->status = 0; | ||
1025 | |||
1026 | /* return some buffers to hardware, one at a time is too slow */ | ||
1027 | if (unlikely(cleaned_count >= E1000_RX_BUFFER_WRITE)) { | ||
1028 | adapter->alloc_rx_buf(adapter, cleaned_count); | ||
1029 | cleaned_count = 0; | ||
1030 | } | ||
1031 | |||
1032 | /* use prefetched values */ | ||
1033 | rx_desc = next_rxd; | ||
1034 | buffer_info = next_buffer; | ||
1035 | } | ||
1036 | rx_ring->next_to_clean = i; | ||
1037 | |||
1038 | cleaned_count = e1000_desc_unused(rx_ring); | ||
1039 | if (cleaned_count) | ||
1040 | adapter->alloc_rx_buf(adapter, cleaned_count); | ||
1041 | |||
1042 | adapter->total_rx_bytes += total_rx_bytes; | ||
1043 | adapter->total_rx_packets += total_rx_packets; | ||
1044 | adapter->net_stats.rx_bytes += total_rx_bytes; | ||
1045 | adapter->net_stats.rx_packets += total_rx_packets; | ||
1046 | return cleaned; | ||
1047 | } | ||
1048 | |||
1049 | /** | ||
786 | * e1000_clean_rx_ring - Free Rx Buffers per Queue | 1050 | * e1000_clean_rx_ring - Free Rx Buffers per Queue |
787 | * @adapter: board private structure | 1051 | * @adapter: board private structure |
788 | **/ | 1052 | **/ |
@@ -802,6 +1066,10 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
802 | pci_unmap_single(pdev, buffer_info->dma, | 1066 | pci_unmap_single(pdev, buffer_info->dma, |
803 | adapter->rx_buffer_len, | 1067 | adapter->rx_buffer_len, |
804 | PCI_DMA_FROMDEVICE); | 1068 | PCI_DMA_FROMDEVICE); |
1069 | else if (adapter->clean_rx == e1000_clean_jumbo_rx_irq) | ||
1070 | pci_unmap_page(pdev, buffer_info->dma, | ||
1071 | PAGE_SIZE, | ||
1072 | PCI_DMA_FROMDEVICE); | ||
805 | else if (adapter->clean_rx == e1000_clean_rx_irq_ps) | 1073 | else if (adapter->clean_rx == e1000_clean_rx_irq_ps) |
806 | pci_unmap_single(pdev, buffer_info->dma, | 1074 | pci_unmap_single(pdev, buffer_info->dma, |
807 | adapter->rx_ps_bsize0, | 1075 | adapter->rx_ps_bsize0, |
@@ -809,6 +1077,11 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter) | |||
809 | buffer_info->dma = 0; | 1077 | buffer_info->dma = 0; |
810 | } | 1078 | } |
811 | 1079 | ||
1080 | if (buffer_info->page) { | ||
1081 | put_page(buffer_info->page); | ||
1082 | buffer_info->page = NULL; | ||
1083 | } | ||
1084 | |||
812 | if (buffer_info->skb) { | 1085 | if (buffer_info->skb) { |
813 | dev_kfree_skb(buffer_info->skb); | 1086 | dev_kfree_skb(buffer_info->skb); |
814 | buffer_info->skb = NULL; | 1087 | buffer_info->skb = NULL; |
@@ -1755,10 +2028,12 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1755 | * a lot of memory, since we allocate 3 pages at all times | 2028 | * a lot of memory, since we allocate 3 pages at all times |
1756 | * per packet. | 2029 | * per packet. |
1757 | */ | 2030 | */ |
1758 | adapter->rx_ps_pages = 0; | ||
1759 | pages = PAGE_USE_COUNT(adapter->netdev->mtu); | 2031 | pages = PAGE_USE_COUNT(adapter->netdev->mtu); |
1760 | if ((pages <= 3) && (PAGE_SIZE <= 16384) && (rctl & E1000_RCTL_LPE)) | 2032 | if (!(adapter->flags & FLAG_IS_ICH) && (pages <= 3) && |
2033 | (PAGE_SIZE <= 16384) && (rctl & E1000_RCTL_LPE)) | ||
1761 | adapter->rx_ps_pages = pages; | 2034 | adapter->rx_ps_pages = pages; |
2035 | else | ||
2036 | adapter->rx_ps_pages = 0; | ||
1762 | 2037 | ||
1763 | if (adapter->rx_ps_pages) { | 2038 | if (adapter->rx_ps_pages) { |
1764 | /* Configure extra packet-split registers */ | 2039 | /* Configure extra packet-split registers */ |
@@ -1819,9 +2094,12 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
1819 | sizeof(union e1000_rx_desc_packet_split); | 2094 | sizeof(union e1000_rx_desc_packet_split); |
1820 | adapter->clean_rx = e1000_clean_rx_irq_ps; | 2095 | adapter->clean_rx = e1000_clean_rx_irq_ps; |
1821 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; | 2096 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; |
2097 | } else if (adapter->netdev->mtu > ETH_FRAME_LEN + ETH_FCS_LEN) { | ||
2098 | rdlen = rx_ring->count * sizeof(struct e1000_rx_desc); | ||
2099 | adapter->clean_rx = e1000_clean_jumbo_rx_irq; | ||
2100 | adapter->alloc_rx_buf = e1000_alloc_jumbo_rx_buffers; | ||
1822 | } else { | 2101 | } else { |
1823 | rdlen = rx_ring->count * | 2102 | rdlen = rx_ring->count * sizeof(struct e1000_rx_desc); |
1824 | sizeof(struct e1000_rx_desc); | ||
1825 | adapter->clean_rx = e1000_clean_rx_irq; | 2103 | adapter->clean_rx = e1000_clean_rx_irq; |
1826 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers; | 2104 | adapter->alloc_rx_buf = e1000_alloc_rx_buffers; |
1827 | } | 2105 | } |
@@ -1885,8 +2163,21 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
1885 | * units), e.g. using jumbo frames when setting to E1000_ERT_2048 | 2163 | * units), e.g. using jumbo frames when setting to E1000_ERT_2048 |
1886 | */ | 2164 | */ |
1887 | if ((adapter->flags & FLAG_HAS_ERT) && | 2165 | if ((adapter->flags & FLAG_HAS_ERT) && |
1888 | (adapter->netdev->mtu > ETH_DATA_LEN)) | 2166 | (adapter->netdev->mtu > ETH_DATA_LEN)) { |
1889 | ew32(ERT, E1000_ERT_2048); | 2167 | u32 rxdctl = er32(RXDCTL(0)); |
2168 | ew32(RXDCTL(0), rxdctl | 0x3); | ||
2169 | ew32(ERT, E1000_ERT_2048 | (1 << 13)); | ||
2170 | /* | ||
2171 | * With jumbo frames and early-receive enabled, excessive | ||
2172 | * C4->C2 latencies result in dropped transactions. | ||
2173 | */ | ||
2174 | pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY, | ||
2175 | e1000e_driver_name, 55); | ||
2176 | } else { | ||
2177 | pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY, | ||
2178 | e1000e_driver_name, | ||
2179 | PM_QOS_DEFAULT_VALUE); | ||
2180 | } | ||
1890 | 2181 | ||
1891 | /* Enable Receives */ | 2182 | /* Enable Receives */ |
1892 | ew32(RCTL, rctl); | 2183 | ew32(RCTL, rctl); |
@@ -2155,6 +2446,14 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
2155 | 2446 | ||
2156 | /* Allow time for pending master requests to run */ | 2447 | /* Allow time for pending master requests to run */ |
2157 | mac->ops.reset_hw(hw); | 2448 | mac->ops.reset_hw(hw); |
2449 | |||
2450 | /* | ||
2451 | * For parts with AMT enabled, let the firmware know | ||
2452 | * that the network interface is in control | ||
2453 | */ | ||
2454 | if ((adapter->flags & FLAG_HAS_AMT) && e1000e_check_mng_mode(hw)) | ||
2455 | e1000_get_hw_control(adapter); | ||
2456 | |||
2158 | ew32(WUC, 0); | 2457 | ew32(WUC, 0); |
2159 | 2458 | ||
2160 | if (mac->ops.init_hw(hw)) | 2459 | if (mac->ops.init_hw(hw)) |
@@ -3469,6 +3768,8 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
3469 | * means we reserve 2 more, this pushes us to allocate from the next | 3768 | * means we reserve 2 more, this pushes us to allocate from the next |
3470 | * larger slab size. | 3769 | * larger slab size. |
3471 | * i.e. RXBUFFER_2048 --> size-4096 slab | 3770 | * i.e. RXBUFFER_2048 --> size-4096 slab |
3771 | * However with the new *_jumbo_rx* routines, jumbo receives will use | ||
3772 | * fragmented skbs | ||
3472 | */ | 3773 | */ |
3473 | 3774 | ||
3474 | if (max_frame <= 256) | 3775 | if (max_frame <= 256) |
@@ -3626,6 +3927,9 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3626 | ew32(CTRL_EXT, ctrl_ext); | 3927 | ew32(CTRL_EXT, ctrl_ext); |
3627 | } | 3928 | } |
3628 | 3929 | ||
3930 | if (adapter->flags & FLAG_IS_ICH) | ||
3931 | e1000e_disable_gig_wol_ich8lan(&adapter->hw); | ||
3932 | |||
3629 | /* Allow time for pending master requests to run */ | 3933 | /* Allow time for pending master requests to run */ |
3630 | e1000e_disable_pcie_master(&adapter->hw); | 3934 | e1000e_disable_pcie_master(&adapter->hw); |
3631 | 3935 | ||
@@ -4292,6 +4596,13 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
4292 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IFE_GT), board_ich9lan }, | 4596 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IFE_GT), board_ich9lan }, |
4293 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_AMT), board_ich9lan }, | 4597 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_AMT), board_ich9lan }, |
4294 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_C), board_ich9lan }, | 4598 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_C), board_ich9lan }, |
4599 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_M), board_ich9lan }, | ||
4600 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_M_AMT), board_ich9lan }, | ||
4601 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH9_IGP_M_V), board_ich9lan }, | ||
4602 | |||
4603 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_R_BM_LM), board_ich9lan }, | ||
4604 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_R_BM_LF), board_ich9lan }, | ||
4605 | { PCI_VDEVICE(INTEL, E1000_DEV_ID_ICH10_R_BM_V), board_ich9lan }, | ||
4295 | 4606 | ||
4296 | { } /* terminate list */ | 4607 | { } /* terminate list */ |
4297 | }; | 4608 | }; |
@@ -4326,7 +4637,9 @@ static int __init e1000_init_module(void) | |||
4326 | printk(KERN_INFO "%s: Copyright (c) 1999-2008 Intel Corporation.\n", | 4637 | printk(KERN_INFO "%s: Copyright (c) 1999-2008 Intel Corporation.\n", |
4327 | e1000e_driver_name); | 4638 | e1000e_driver_name); |
4328 | ret = pci_register_driver(&e1000_driver); | 4639 | ret = pci_register_driver(&e1000_driver); |
4329 | 4640 | pm_qos_add_requirement(PM_QOS_CPU_DMA_LATENCY, e1000e_driver_name, | |
4641 | PM_QOS_DEFAULT_VALUE); | ||
4642 | |||
4330 | return ret; | 4643 | return ret; |
4331 | } | 4644 | } |
4332 | module_init(e1000_init_module); | 4645 | module_init(e1000_init_module); |
@@ -4340,6 +4653,7 @@ module_init(e1000_init_module); | |||
4340 | static void __exit e1000_exit_module(void) | 4653 | static void __exit e1000_exit_module(void) |
4341 | { | 4654 | { |
4342 | pci_unregister_driver(&e1000_driver); | 4655 | pci_unregister_driver(&e1000_driver); |
4656 | pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, e1000e_driver_name); | ||
4343 | } | 4657 | } |
4344 | module_exit(e1000_exit_module); | 4658 | module_exit(e1000_exit_module); |
4345 | 4659 | ||
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index e102332a6be..b133dcf0e95 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -34,6 +34,9 @@ static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw); | |||
34 | static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw); | 34 | static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw); |
35 | static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active); | 35 | static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active); |
36 | static s32 e1000_wait_autoneg(struct e1000_hw *hw); | 36 | static s32 e1000_wait_autoneg(struct e1000_hw *hw); |
37 | static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg); | ||
38 | static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, | ||
39 | u16 *data, bool read); | ||
37 | 40 | ||
38 | /* Cable length tables */ | 41 | /* Cable length tables */ |
39 | static const u16 e1000_m88_cable_length_table[] = | 42 | static const u16 e1000_m88_cable_length_table[] = |
@@ -465,6 +468,10 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw) | |||
465 | if (phy->disable_polarity_correction == 1) | 468 | if (phy->disable_polarity_correction == 1) |
466 | phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; | 469 | phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; |
467 | 470 | ||
471 | /* Enable downshift on BM (disabled by default) */ | ||
472 | if (phy->type == e1000_phy_bm) | ||
473 | phy_data |= BME1000_PSCR_ENABLE_DOWNSHIFT; | ||
474 | |||
468 | ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); | 475 | ret_val = e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
469 | if (ret_val) | 476 | if (ret_val) |
470 | return ret_val; | 477 | return ret_val; |
@@ -1776,6 +1783,10 @@ enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id) | |||
1776 | case IFE_C_E_PHY_ID: | 1783 | case IFE_C_E_PHY_ID: |
1777 | phy_type = e1000_phy_ife; | 1784 | phy_type = e1000_phy_ife; |
1778 | break; | 1785 | break; |
1786 | case BME1000_E_PHY_ID: | ||
1787 | case BME1000_E_PHY_ID_R2: | ||
1788 | phy_type = e1000_phy_bm; | ||
1789 | break; | ||
1779 | default: | 1790 | default: |
1780 | phy_type = e1000_phy_unknown; | 1791 | phy_type = e1000_phy_unknown; |
1781 | break; | 1792 | break; |
@@ -1784,6 +1795,273 @@ enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id) | |||
1784 | } | 1795 | } |
1785 | 1796 | ||
1786 | /** | 1797 | /** |
1798 | * e1000e_determine_phy_address - Determines PHY address. | ||
1799 | * @hw: pointer to the HW structure | ||
1800 | * | ||
1801 | * This uses a trial and error method to loop through possible PHY | ||
1802 | * addresses. It tests each by reading the PHY ID registers and | ||
1803 | * checking for a match. | ||
1804 | **/ | ||
1805 | s32 e1000e_determine_phy_address(struct e1000_hw *hw) | ||
1806 | { | ||
1807 | s32 ret_val = -E1000_ERR_PHY_TYPE; | ||
1808 | u32 phy_addr= 0; | ||
1809 | u32 i = 0; | ||
1810 | enum e1000_phy_type phy_type = e1000_phy_unknown; | ||
1811 | |||
1812 | do { | ||
1813 | for (phy_addr = 0; phy_addr < 4; phy_addr++) { | ||
1814 | hw->phy.addr = phy_addr; | ||
1815 | e1000e_get_phy_id(hw); | ||
1816 | phy_type = e1000e_get_phy_type_from_id(hw->phy.id); | ||
1817 | |||
1818 | /* | ||
1819 | * If phy_type is valid, break - we found our | ||
1820 | * PHY address | ||
1821 | */ | ||
1822 | if (phy_type != e1000_phy_unknown) { | ||
1823 | ret_val = 0; | ||
1824 | break; | ||
1825 | } | ||
1826 | } | ||
1827 | i++; | ||
1828 | } while ((ret_val != 0) && (i < 100)); | ||
1829 | |||
1830 | return ret_val; | ||
1831 | } | ||
1832 | |||
1833 | /** | ||
1834 | * e1000_get_phy_addr_for_bm_page - Retrieve PHY page address | ||
1835 | * @page: page to access | ||
1836 | * | ||
1837 | * Returns the phy address for the page requested. | ||
1838 | **/ | ||
1839 | static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg) | ||
1840 | { | ||
1841 | u32 phy_addr = 2; | ||
1842 | |||
1843 | if ((page >= 768) || (page == 0 && reg == 25) || (reg == 31)) | ||
1844 | phy_addr = 1; | ||
1845 | |||
1846 | return phy_addr; | ||
1847 | } | ||
1848 | |||
1849 | /** | ||
1850 | * e1000e_write_phy_reg_bm - Write BM PHY register | ||
1851 | * @hw: pointer to the HW structure | ||
1852 | * @offset: register offset to write to | ||
1853 | * @data: data to write at register offset | ||
1854 | * | ||
1855 | * Acquires semaphore, if necessary, then writes the data to PHY register | ||
1856 | * at the offset. Release any acquired semaphores before exiting. | ||
1857 | **/ | ||
1858 | s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) | ||
1859 | { | ||
1860 | s32 ret_val; | ||
1861 | u32 page_select = 0; | ||
1862 | u32 page = offset >> IGP_PAGE_SHIFT; | ||
1863 | u32 page_shift = 0; | ||
1864 | |||
1865 | /* Page 800 works differently than the rest so it has its own func */ | ||
1866 | if (page == BM_WUC_PAGE) { | ||
1867 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, &data, | ||
1868 | false); | ||
1869 | goto out; | ||
1870 | } | ||
1871 | |||
1872 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
1873 | if (ret_val) | ||
1874 | goto out; | ||
1875 | |||
1876 | hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); | ||
1877 | |||
1878 | if (offset > MAX_PHY_MULTI_PAGE_REG) { | ||
1879 | /* | ||
1880 | * Page select is register 31 for phy address 1 and 22 for | ||
1881 | * phy address 2 and 3. Page select is shifted only for | ||
1882 | * phy address 1. | ||
1883 | */ | ||
1884 | if (hw->phy.addr == 1) { | ||
1885 | page_shift = IGP_PAGE_SHIFT; | ||
1886 | page_select = IGP01E1000_PHY_PAGE_SELECT; | ||
1887 | } else { | ||
1888 | page_shift = 0; | ||
1889 | page_select = BM_PHY_PAGE_SELECT; | ||
1890 | } | ||
1891 | |||
1892 | /* Page is shifted left, PHY expects (page x 32) */ | ||
1893 | ret_val = e1000e_write_phy_reg_mdic(hw, page_select, | ||
1894 | (page << page_shift)); | ||
1895 | if (ret_val) { | ||
1896 | hw->phy.ops.release_phy(hw); | ||
1897 | goto out; | ||
1898 | } | ||
1899 | } | ||
1900 | |||
1901 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, | ||
1902 | data); | ||
1903 | |||
1904 | hw->phy.ops.release_phy(hw); | ||
1905 | |||
1906 | out: | ||
1907 | return ret_val; | ||
1908 | } | ||
1909 | |||
1910 | /** | ||
1911 | * e1000e_read_phy_reg_bm - Read BM PHY register | ||
1912 | * @hw: pointer to the HW structure | ||
1913 | * @offset: register offset to be read | ||
1914 | * @data: pointer to the read data | ||
1915 | * | ||
1916 | * Acquires semaphore, if necessary, then reads the PHY register at offset | ||
1917 | * and storing the retrieved information in data. Release any acquired | ||
1918 | * semaphores before exiting. | ||
1919 | **/ | ||
1920 | s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) | ||
1921 | { | ||
1922 | s32 ret_val; | ||
1923 | u32 page_select = 0; | ||
1924 | u32 page = offset >> IGP_PAGE_SHIFT; | ||
1925 | u32 page_shift = 0; | ||
1926 | |||
1927 | /* Page 800 works differently than the rest so it has its own func */ | ||
1928 | if (page == BM_WUC_PAGE) { | ||
1929 | ret_val = e1000_access_phy_wakeup_reg_bm(hw, offset, data, | ||
1930 | true); | ||
1931 | goto out; | ||
1932 | } | ||
1933 | |||
1934 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
1935 | if (ret_val) | ||
1936 | goto out; | ||
1937 | |||
1938 | hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); | ||
1939 | |||
1940 | if (offset > MAX_PHY_MULTI_PAGE_REG) { | ||
1941 | /* | ||
1942 | * Page select is register 31 for phy address 1 and 22 for | ||
1943 | * phy address 2 and 3. Page select is shifted only for | ||
1944 | * phy address 1. | ||
1945 | */ | ||
1946 | if (hw->phy.addr == 1) { | ||
1947 | page_shift = IGP_PAGE_SHIFT; | ||
1948 | page_select = IGP01E1000_PHY_PAGE_SELECT; | ||
1949 | } else { | ||
1950 | page_shift = 0; | ||
1951 | page_select = BM_PHY_PAGE_SELECT; | ||
1952 | } | ||
1953 | |||
1954 | /* Page is shifted left, PHY expects (page x 32) */ | ||
1955 | ret_val = e1000e_write_phy_reg_mdic(hw, page_select, | ||
1956 | (page << page_shift)); | ||
1957 | if (ret_val) { | ||
1958 | hw->phy.ops.release_phy(hw); | ||
1959 | goto out; | ||
1960 | } | ||
1961 | } | ||
1962 | |||
1963 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset, | ||
1964 | data); | ||
1965 | hw->phy.ops.release_phy(hw); | ||
1966 | |||
1967 | out: | ||
1968 | return ret_val; | ||
1969 | } | ||
1970 | |||
1971 | /** | ||
1972 | * e1000_access_phy_wakeup_reg_bm - Read BM PHY wakeup register | ||
1973 | * @hw: pointer to the HW structure | ||
1974 | * @offset: register offset to be read or written | ||
1975 | * @data: pointer to the data to read or write | ||
1976 | * @read: determines if operation is read or write | ||
1977 | * | ||
1978 | * Acquires semaphore, if necessary, then reads the PHY register at offset | ||
1979 | * and storing the retrieved information in data. Release any acquired | ||
1980 | * semaphores before exiting. Note that procedure to read the wakeup | ||
1981 | * registers are different. It works as such: | ||
1982 | * 1) Set page 769, register 17, bit 2 = 1 | ||
1983 | * 2) Set page to 800 for host (801 if we were manageability) | ||
1984 | * 3) Write the address using the address opcode (0x11) | ||
1985 | * 4) Read or write the data using the data opcode (0x12) | ||
1986 | * 5) Restore 769_17.2 to its original value | ||
1987 | **/ | ||
1988 | static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, | ||
1989 | u16 *data, bool read) | ||
1990 | { | ||
1991 | s32 ret_val; | ||
1992 | u16 reg = ((u16)offset) & PHY_REG_MASK; | ||
1993 | u16 phy_reg = 0; | ||
1994 | u8 phy_acquired = 1; | ||
1995 | |||
1996 | |||
1997 | ret_val = hw->phy.ops.acquire_phy(hw); | ||
1998 | if (ret_val) { | ||
1999 | phy_acquired = 0; | ||
2000 | goto out; | ||
2001 | } | ||
2002 | |||
2003 | /* All operations in this function are phy address 1 */ | ||
2004 | hw->phy.addr = 1; | ||
2005 | |||
2006 | /* Set page 769 */ | ||
2007 | e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, | ||
2008 | (BM_WUC_ENABLE_PAGE << IGP_PAGE_SHIFT)); | ||
2009 | |||
2010 | ret_val = e1000e_read_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, &phy_reg); | ||
2011 | if (ret_val) | ||
2012 | goto out; | ||
2013 | |||
2014 | /* First clear bit 4 to avoid a power state change */ | ||
2015 | phy_reg &= ~(BM_WUC_HOST_WU_BIT); | ||
2016 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); | ||
2017 | if (ret_val) | ||
2018 | goto out; | ||
2019 | |||
2020 | /* Write bit 2 = 1, and clear bit 4 to 769_17 */ | ||
2021 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, | ||
2022 | phy_reg | BM_WUC_ENABLE_BIT); | ||
2023 | if (ret_val) | ||
2024 | goto out; | ||
2025 | |||
2026 | /* Select page 800 */ | ||
2027 | ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, | ||
2028 | (BM_WUC_PAGE << IGP_PAGE_SHIFT)); | ||
2029 | |||
2030 | /* Write the page 800 offset value using opcode 0x11 */ | ||
2031 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ADDRESS_OPCODE, reg); | ||
2032 | if (ret_val) | ||
2033 | goto out; | ||
2034 | |||
2035 | if (read) { | ||
2036 | /* Read the page 800 value using opcode 0x12 */ | ||
2037 | ret_val = e1000e_read_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, | ||
2038 | data); | ||
2039 | } else { | ||
2040 | /* Read the page 800 value using opcode 0x12 */ | ||
2041 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_DATA_OPCODE, | ||
2042 | *data); | ||
2043 | } | ||
2044 | |||
2045 | if (ret_val) | ||
2046 | goto out; | ||
2047 | |||
2048 | /* | ||
2049 | * Restore 769_17.2 to its original value | ||
2050 | * Set page 769 | ||
2051 | */ | ||
2052 | e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, | ||
2053 | (BM_WUC_ENABLE_PAGE << IGP_PAGE_SHIFT)); | ||
2054 | |||
2055 | /* Clear 769_17.2 */ | ||
2056 | ret_val = e1000e_write_phy_reg_mdic(hw, BM_WUC_ENABLE_REG, phy_reg); | ||
2057 | |||
2058 | out: | ||
2059 | if (phy_acquired == 1) | ||
2060 | hw->phy.ops.release_phy(hw); | ||
2061 | return ret_val; | ||
2062 | } | ||
2063 | |||
2064 | /** | ||
1787 | * e1000e_commit_phy - Soft PHY reset | 2065 | * e1000e_commit_phy - Soft PHY reset |
1788 | * @hw: pointer to the HW structure | 2066 | * @hw: pointer to the HW structure |
1789 | * | 2067 | * |
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index 2eb82aba4a8..795c594a4b7 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c | |||
@@ -202,7 +202,7 @@ static unsigned short start_code[] = { | |||
202 | 0x0000,Cmd_MCast, | 202 | 0x0000,Cmd_MCast, |
203 | 0x0076, /* link to next command */ | 203 | 0x0076, /* link to next command */ |
204 | #define CONF_NR_MULTICAST 0x44 | 204 | #define CONF_NR_MULTICAST 0x44 |
205 | 0x0000, /* number of multicast addresses */ | 205 | 0x0000, /* number of bytes in multicast address(es) */ |
206 | #define CONF_MULTICAST 0x46 | 206 | #define CONF_MULTICAST 0x46 |
207 | 0x0000, 0x0000, 0x0000, /* some addresses */ | 207 | 0x0000, 0x0000, 0x0000, /* some addresses */ |
208 | 0x0000, 0x0000, 0x0000, | 208 | 0x0000, 0x0000, 0x0000, |
@@ -1569,7 +1569,7 @@ static void eexp_hw_init586(struct net_device *dev) | |||
1569 | 1569 | ||
1570 | static void eexp_setup_filter(struct net_device *dev) | 1570 | static void eexp_setup_filter(struct net_device *dev) |
1571 | { | 1571 | { |
1572 | struct dev_mc_list *dmi = dev->mc_list; | 1572 | struct dev_mc_list *dmi; |
1573 | unsigned short ioaddr = dev->base_addr; | 1573 | unsigned short ioaddr = dev->base_addr; |
1574 | int count = dev->mc_count; | 1574 | int count = dev->mc_count; |
1575 | int i; | 1575 | int i; |
@@ -1580,9 +1580,9 @@ static void eexp_setup_filter(struct net_device *dev) | |||
1580 | } | 1580 | } |
1581 | 1581 | ||
1582 | outw(CONF_NR_MULTICAST & ~31, ioaddr+SM_PTR); | 1582 | outw(CONF_NR_MULTICAST & ~31, ioaddr+SM_PTR); |
1583 | outw(count, ioaddr+SHADOW(CONF_NR_MULTICAST)); | 1583 | outw(6*count, ioaddr+SHADOW(CONF_NR_MULTICAST)); |
1584 | for (i = 0; i < count; i++) { | 1584 | for (i = 0, dmi = dev->mc_list; i < count; i++, dmi = dmi->next) { |
1585 | unsigned short *data = (unsigned short *)dmi->dmi_addr; | 1585 | unsigned short *data; |
1586 | if (!dmi) { | 1586 | if (!dmi) { |
1587 | printk(KERN_INFO "%s: too few multicast addresses\n", dev->name); | 1587 | printk(KERN_INFO "%s: too few multicast addresses\n", dev->name); |
1588 | break; | 1588 | break; |
@@ -1591,6 +1591,7 @@ static void eexp_setup_filter(struct net_device *dev) | |||
1591 | printk(KERN_INFO "%s: invalid multicast address length given.\n", dev->name); | 1591 | printk(KERN_INFO "%s: invalid multicast address length given.\n", dev->name); |
1592 | continue; | 1592 | continue; |
1593 | } | 1593 | } |
1594 | data = (unsigned short *)dmi->dmi_addr; | ||
1594 | outw((CONF_MULTICAST+(6*i)) & ~31, ioaddr+SM_PTR); | 1595 | outw((CONF_MULTICAST+(6*i)) & ~31, ioaddr+SM_PTR); |
1595 | outw(data[0], ioaddr+SHADOW(CONF_MULTICAST+(6*i))); | 1596 | outw(data[0], ioaddr+SHADOW(CONF_MULTICAST+(6*i))); |
1596 | outw((CONF_MULTICAST+(6*i)+2) & ~31, ioaddr+SM_PTR); | 1597 | outw((CONF_MULTICAST+(6*i)+2) & ~31, ioaddr+SM_PTR); |
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c index ba75efc9f5b..f0014cfbb27 100644 --- a/drivers/net/fs_enet/mii-fec.c +++ b/drivers/net/fs_enet/mii-fec.c | |||
@@ -194,7 +194,7 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, | |||
194 | 194 | ||
195 | ret = of_address_to_resource(ofdev->node, 0, &res); | 195 | ret = of_address_to_resource(ofdev->node, 0, &res); |
196 | if (ret) | 196 | if (ret) |
197 | return ret; | 197 | goto out_res; |
198 | 198 | ||
199 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); | 199 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); |
200 | 200 | ||
@@ -236,6 +236,7 @@ out_free_irqs: | |||
236 | kfree(new_bus->irq); | 236 | kfree(new_bus->irq); |
237 | out_unmap_regs: | 237 | out_unmap_regs: |
238 | iounmap(fec->fecp); | 238 | iounmap(fec->fecp); |
239 | out_res: | ||
239 | out_fec: | 240 | out_fec: |
240 | kfree(fec); | 241 | kfree(fec); |
241 | out_mii: | 242 | out_mii: |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 587afe7be68..6f22f068d6e 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -138,6 +138,7 @@ static int gfar_poll(struct napi_struct *napi, int budget); | |||
138 | static void gfar_netpoll(struct net_device *dev); | 138 | static void gfar_netpoll(struct net_device *dev); |
139 | #endif | 139 | #endif |
140 | int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); | 140 | int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); |
141 | static int gfar_clean_tx_ring(struct net_device *dev); | ||
141 | static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length); | 142 | static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length); |
142 | static void gfar_vlan_rx_register(struct net_device *netdev, | 143 | static void gfar_vlan_rx_register(struct net_device *netdev, |
143 | struct vlan_group *grp); | 144 | struct vlan_group *grp); |
@@ -1141,7 +1142,7 @@ static int gfar_close(struct net_device *dev) | |||
1141 | } | 1142 | } |
1142 | 1143 | ||
1143 | /* Changes the mac address if the controller is not running. */ | 1144 | /* Changes the mac address if the controller is not running. */ |
1144 | int gfar_set_mac_address(struct net_device *dev) | 1145 | static int gfar_set_mac_address(struct net_device *dev) |
1145 | { | 1146 | { |
1146 | gfar_set_mac_for_addr(dev, 0, dev->dev_addr); | 1147 | gfar_set_mac_for_addr(dev, 0, dev->dev_addr); |
1147 | 1148 | ||
@@ -1260,7 +1261,7 @@ static void gfar_timeout(struct net_device *dev) | |||
1260 | } | 1261 | } |
1261 | 1262 | ||
1262 | /* Interrupt Handler for Transmit complete */ | 1263 | /* Interrupt Handler for Transmit complete */ |
1263 | int gfar_clean_tx_ring(struct net_device *dev) | 1264 | static int gfar_clean_tx_ring(struct net_device *dev) |
1264 | { | 1265 | { |
1265 | struct txbd8 *bdp; | 1266 | struct txbd8 *bdp; |
1266 | struct gfar_private *priv = netdev_priv(dev); | 1267 | struct gfar_private *priv = netdev_priv(dev); |
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index fd487be3993..27f37c81e52 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -782,5 +782,8 @@ extern void gfar_halt(struct net_device *dev); | |||
782 | extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev, | 782 | extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev, |
783 | int enable, u32 regnum, u32 read); | 783 | int enable, u32 regnum, u32 read); |
784 | void gfar_init_sysfs(struct net_device *dev); | 784 | void gfar_init_sysfs(struct net_device *dev); |
785 | int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id, | ||
786 | int regnum, u16 value); | ||
787 | int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum); | ||
785 | 788 | ||
786 | #endif /* __GIANFAR_H */ | 789 | #endif /* __GIANFAR_H */ |
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c index 230878b9419..5116f68e01b 100644 --- a/drivers/net/gianfar_sysfs.c +++ b/drivers/net/gianfar_sysfs.c | |||
@@ -103,10 +103,10 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev, | |||
103 | 103 | ||
104 | spin_lock_irqsave(&priv->rxlock, flags); | 104 | spin_lock_irqsave(&priv->rxlock, flags); |
105 | if (length > priv->rx_buffer_size) | 105 | if (length > priv->rx_buffer_size) |
106 | return count; | 106 | goto out; |
107 | 107 | ||
108 | if (length == priv->rx_stash_size) | 108 | if (length == priv->rx_stash_size) |
109 | return count; | 109 | goto out; |
110 | 110 | ||
111 | priv->rx_stash_size = length; | 111 | priv->rx_stash_size = length; |
112 | 112 | ||
@@ -125,6 +125,7 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev, | |||
125 | 125 | ||
126 | gfar_write(&priv->regs->attr, temp); | 126 | gfar_write(&priv->regs->attr, temp); |
127 | 127 | ||
128 | out: | ||
128 | spin_unlock_irqrestore(&priv->rxlock, flags); | 129 | spin_unlock_irqrestore(&priv->rxlock, flags); |
129 | 130 | ||
130 | return count; | 131 | return count; |
@@ -154,10 +155,10 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev, | |||
154 | 155 | ||
155 | spin_lock_irqsave(&priv->rxlock, flags); | 156 | spin_lock_irqsave(&priv->rxlock, flags); |
156 | if (index > priv->rx_stash_size) | 157 | if (index > priv->rx_stash_size) |
157 | return count; | 158 | goto out; |
158 | 159 | ||
159 | if (index == priv->rx_stash_index) | 160 | if (index == priv->rx_stash_index) |
160 | return count; | 161 | goto out; |
161 | 162 | ||
162 | priv->rx_stash_index = index; | 163 | priv->rx_stash_index = index; |
163 | 164 | ||
@@ -166,6 +167,7 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev, | |||
166 | temp |= ATTRELI_EI(index); | 167 | temp |= ATTRELI_EI(index); |
167 | gfar_write(&priv->regs->attreli, flags); | 168 | gfar_write(&priv->regs->attreli, flags); |
168 | 169 | ||
170 | out: | ||
169 | spin_unlock_irqrestore(&priv->rxlock, flags); | 171 | spin_unlock_irqrestore(&priv->rxlock, flags); |
170 | 172 | ||
171 | return count; | 173 | return count; |
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c index a873d2b315c..a7714da7c28 100644 --- a/drivers/net/irda/nsc-ircc.c +++ b/drivers/net/irda/nsc-ircc.c | |||
@@ -100,7 +100,9 @@ static int nsc_ircc_probe_39x(nsc_chip_t *chip, chipio_t *info); | |||
100 | static int nsc_ircc_init_108(nsc_chip_t *chip, chipio_t *info); | 100 | static int nsc_ircc_init_108(nsc_chip_t *chip, chipio_t *info); |
101 | static int nsc_ircc_init_338(nsc_chip_t *chip, chipio_t *info); | 101 | static int nsc_ircc_init_338(nsc_chip_t *chip, chipio_t *info); |
102 | static int nsc_ircc_init_39x(nsc_chip_t *chip, chipio_t *info); | 102 | static int nsc_ircc_init_39x(nsc_chip_t *chip, chipio_t *info); |
103 | #ifdef CONFIG_PNP | ||
103 | static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id); | 104 | static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id); |
105 | #endif | ||
104 | 106 | ||
105 | /* These are the known NSC chips */ | 107 | /* These are the known NSC chips */ |
106 | static nsc_chip_t chips[] = { | 108 | static nsc_chip_t chips[] = { |
@@ -156,9 +158,11 @@ static const struct pnp_device_id nsc_ircc_pnp_table[] = { | |||
156 | MODULE_DEVICE_TABLE(pnp, nsc_ircc_pnp_table); | 158 | MODULE_DEVICE_TABLE(pnp, nsc_ircc_pnp_table); |
157 | 159 | ||
158 | static struct pnp_driver nsc_ircc_pnp_driver = { | 160 | static struct pnp_driver nsc_ircc_pnp_driver = { |
161 | #ifdef CONFIG_PNP | ||
159 | .name = "nsc-ircc", | 162 | .name = "nsc-ircc", |
160 | .id_table = nsc_ircc_pnp_table, | 163 | .id_table = nsc_ircc_pnp_table, |
161 | .probe = nsc_ircc_pnp_probe, | 164 | .probe = nsc_ircc_pnp_probe, |
165 | #endif | ||
162 | }; | 166 | }; |
163 | 167 | ||
164 | /* Some prototypes */ | 168 | /* Some prototypes */ |
@@ -916,6 +920,7 @@ static int nsc_ircc_probe_39x(nsc_chip_t *chip, chipio_t *info) | |||
916 | return 0; | 920 | return 0; |
917 | } | 921 | } |
918 | 922 | ||
923 | #ifdef CONFIG_PNP | ||
919 | /* PNP probing */ | 924 | /* PNP probing */ |
920 | static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id) | 925 | static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id) |
921 | { | 926 | { |
@@ -952,6 +957,7 @@ static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *i | |||
952 | 957 | ||
953 | return 0; | 958 | return 0; |
954 | } | 959 | } |
960 | #endif | ||
955 | 961 | ||
956 | /* | 962 | /* |
957 | * Function nsc_ircc_setup (info) | 963 | * Function nsc_ircc_setup (info) |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 1f26da761e9..cfe0194fef7 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -376,6 +376,7 @@ MODULE_DEVICE_TABLE(pnp, smsc_ircc_pnp_table); | |||
376 | 376 | ||
377 | static int pnp_driver_registered; | 377 | static int pnp_driver_registered; |
378 | 378 | ||
379 | #ifdef CONFIG_PNP | ||
379 | static int __init smsc_ircc_pnp_probe(struct pnp_dev *dev, | 380 | static int __init smsc_ircc_pnp_probe(struct pnp_dev *dev, |
380 | const struct pnp_device_id *dev_id) | 381 | const struct pnp_device_id *dev_id) |
381 | { | 382 | { |
@@ -402,7 +403,9 @@ static struct pnp_driver smsc_ircc_pnp_driver = { | |||
402 | .id_table = smsc_ircc_pnp_table, | 403 | .id_table = smsc_ircc_pnp_table, |
403 | .probe = smsc_ircc_pnp_probe, | 404 | .probe = smsc_ircc_pnp_probe, |
404 | }; | 405 | }; |
405 | 406 | #else /* CONFIG_PNP */ | |
407 | static struct pnp_driver smsc_ircc_pnp_driver; | ||
408 | #endif | ||
406 | 409 | ||
407 | /******************************************************************************* | 410 | /******************************************************************************* |
408 | * | 411 | * |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 2056cfc624d..c36a03ae9bf 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -450,7 +450,7 @@ static void macvlan_dellink(struct net_device *dev) | |||
450 | unregister_netdevice(dev); | 450 | unregister_netdevice(dev); |
451 | 451 | ||
452 | if (list_empty(&port->vlans)) | 452 | if (list_empty(&port->vlans)) |
453 | macvlan_port_destroy(dev); | 453 | macvlan_port_destroy(port->dev); |
454 | } | 454 | } |
455 | 455 | ||
456 | static struct rtnl_link_ops macvlan_link_ops __read_mostly = { | 456 | static struct rtnl_link_ops macvlan_link_ops __read_mostly = { |
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c index cb46446b269..03a9abcce52 100644 --- a/drivers/net/mlx4/mr.c +++ b/drivers/net/mlx4/mr.c | |||
@@ -551,7 +551,7 @@ int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages, | |||
551 | u64 mtt_seg; | 551 | u64 mtt_seg; |
552 | int err = -ENOMEM; | 552 | int err = -ENOMEM; |
553 | 553 | ||
554 | if (page_shift < 12 || page_shift >= 32) | 554 | if (page_shift < (ffs(dev->caps.page_size_cap) - 1) || page_shift >= 32) |
555 | return -EINVAL; | 555 | return -EINVAL; |
556 | 556 | ||
557 | /* All MTTs must fit in the same page */ | 557 | /* All MTTs must fit in the same page */ |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 381b36e5f64..b7915cdcc6a 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -91,6 +91,11 @@ | |||
91 | */ | 91 | */ |
92 | #define PHY_ADDR_REG 0x0000 | 92 | #define PHY_ADDR_REG 0x0000 |
93 | #define SMI_REG 0x0004 | 93 | #define SMI_REG 0x0004 |
94 | #define WINDOW_BASE(i) (0x0200 + ((i) << 3)) | ||
95 | #define WINDOW_SIZE(i) (0x0204 + ((i) << 3)) | ||
96 | #define WINDOW_REMAP_HIGH(i) (0x0280 + ((i) << 2)) | ||
97 | #define WINDOW_BAR_ENABLE 0x0290 | ||
98 | #define WINDOW_PROTECT(i) (0x0294 + ((i) << 4)) | ||
94 | 99 | ||
95 | /* | 100 | /* |
96 | * Per-port registers. | 101 | * Per-port registers. |
@@ -507,9 +512,23 @@ struct mv643xx_mib_counters { | |||
507 | u32 late_collision; | 512 | u32 late_collision; |
508 | }; | 513 | }; |
509 | 514 | ||
515 | struct mv643xx_shared_private { | ||
516 | void __iomem *eth_base; | ||
517 | |||
518 | /* used to protect SMI_REG, which is shared across ports */ | ||
519 | spinlock_t phy_lock; | ||
520 | |||
521 | u32 win_protect; | ||
522 | |||
523 | unsigned int t_clk; | ||
524 | }; | ||
525 | |||
510 | struct mv643xx_private { | 526 | struct mv643xx_private { |
527 | struct mv643xx_shared_private *shared; | ||
511 | int port_num; /* User Ethernet port number */ | 528 | int port_num; /* User Ethernet port number */ |
512 | 529 | ||
530 | struct mv643xx_shared_private *shared_smi; | ||
531 | |||
513 | u32 rx_sram_addr; /* Base address of rx sram area */ | 532 | u32 rx_sram_addr; /* Base address of rx sram area */ |
514 | u32 rx_sram_size; /* Size of rx sram area */ | 533 | u32 rx_sram_size; /* Size of rx sram area */ |
515 | u32 tx_sram_addr; /* Base address of tx sram area */ | 534 | u32 tx_sram_addr; /* Base address of tx sram area */ |
@@ -614,19 +633,14 @@ static const struct ethtool_ops mv643xx_ethtool_ops; | |||
614 | static char mv643xx_driver_name[] = "mv643xx_eth"; | 633 | static char mv643xx_driver_name[] = "mv643xx_eth"; |
615 | static char mv643xx_driver_version[] = "1.0"; | 634 | static char mv643xx_driver_version[] = "1.0"; |
616 | 635 | ||
617 | static void __iomem *mv643xx_eth_base; | ||
618 | |||
619 | /* used to protect SMI_REG, which is shared across ports */ | ||
620 | static DEFINE_SPINLOCK(mv643xx_eth_phy_lock); | ||
621 | |||
622 | static inline u32 rdl(struct mv643xx_private *mp, int offset) | 636 | static inline u32 rdl(struct mv643xx_private *mp, int offset) |
623 | { | 637 | { |
624 | return readl(mv643xx_eth_base + offset); | 638 | return readl(mp->shared->eth_base + offset); |
625 | } | 639 | } |
626 | 640 | ||
627 | static inline void wrl(struct mv643xx_private *mp, int offset, u32 data) | 641 | static inline void wrl(struct mv643xx_private *mp, int offset, u32 data) |
628 | { | 642 | { |
629 | writel(data, mv643xx_eth_base + offset); | 643 | writel(data, mp->shared->eth_base + offset); |
630 | } | 644 | } |
631 | 645 | ||
632 | /* | 646 | /* |
@@ -1119,7 +1133,6 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id) | |||
1119 | * | 1133 | * |
1120 | * INPUT: | 1134 | * INPUT: |
1121 | * struct mv643xx_private *mp Ethernet port | 1135 | * struct mv643xx_private *mp Ethernet port |
1122 | * unsigned int t_clk t_clk of the MV-643xx chip in HZ units | ||
1123 | * unsigned int delay Delay in usec | 1136 | * unsigned int delay Delay in usec |
1124 | * | 1137 | * |
1125 | * OUTPUT: | 1138 | * OUTPUT: |
@@ -1130,10 +1143,10 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id) | |||
1130 | * | 1143 | * |
1131 | */ | 1144 | */ |
1132 | static unsigned int eth_port_set_rx_coal(struct mv643xx_private *mp, | 1145 | static unsigned int eth_port_set_rx_coal(struct mv643xx_private *mp, |
1133 | unsigned int t_clk, unsigned int delay) | 1146 | unsigned int delay) |
1134 | { | 1147 | { |
1135 | unsigned int port_num = mp->port_num; | 1148 | unsigned int port_num = mp->port_num; |
1136 | unsigned int coal = ((t_clk / 1000000) * delay) / 64; | 1149 | unsigned int coal = ((mp->shared->t_clk / 1000000) * delay) / 64; |
1137 | 1150 | ||
1138 | /* Set RX Coalescing mechanism */ | 1151 | /* Set RX Coalescing mechanism */ |
1139 | wrl(mp, SDMA_CONFIG_REG(port_num), | 1152 | wrl(mp, SDMA_CONFIG_REG(port_num), |
@@ -1158,7 +1171,6 @@ static unsigned int eth_port_set_rx_coal(struct mv643xx_private *mp, | |||
1158 | * | 1171 | * |
1159 | * INPUT: | 1172 | * INPUT: |
1160 | * struct mv643xx_private *mp Ethernet port | 1173 | * struct mv643xx_private *mp Ethernet port |
1161 | * unsigned int t_clk t_clk of the MV-643xx chip in HZ units | ||
1162 | * unsigned int delay Delay in uSeconds | 1174 | * unsigned int delay Delay in uSeconds |
1163 | * | 1175 | * |
1164 | * OUTPUT: | 1176 | * OUTPUT: |
@@ -1169,9 +1181,9 @@ static unsigned int eth_port_set_rx_coal(struct mv643xx_private *mp, | |||
1169 | * | 1181 | * |
1170 | */ | 1182 | */ |
1171 | static unsigned int eth_port_set_tx_coal(struct mv643xx_private *mp, | 1183 | static unsigned int eth_port_set_tx_coal(struct mv643xx_private *mp, |
1172 | unsigned int t_clk, unsigned int delay) | 1184 | unsigned int delay) |
1173 | { | 1185 | { |
1174 | unsigned int coal = ((t_clk / 1000000) * delay) / 64; | 1186 | unsigned int coal = ((mp->shared->t_clk / 1000000) * delay) / 64; |
1175 | 1187 | ||
1176 | /* Set TX Coalescing mechanism */ | 1188 | /* Set TX Coalescing mechanism */ |
1177 | wrl(mp, TX_FIFO_URGENT_THRESHOLD_REG(mp->port_num), coal << 4); | 1189 | wrl(mp, TX_FIFO_URGENT_THRESHOLD_REG(mp->port_num), coal << 4); |
@@ -1413,11 +1425,11 @@ static int mv643xx_eth_open(struct net_device *dev) | |||
1413 | 1425 | ||
1414 | #ifdef MV643XX_COAL | 1426 | #ifdef MV643XX_COAL |
1415 | mp->rx_int_coal = | 1427 | mp->rx_int_coal = |
1416 | eth_port_set_rx_coal(mp, 133000000, MV643XX_RX_COAL); | 1428 | eth_port_set_rx_coal(mp, MV643XX_RX_COAL); |
1417 | #endif | 1429 | #endif |
1418 | 1430 | ||
1419 | mp->tx_int_coal = | 1431 | mp->tx_int_coal = |
1420 | eth_port_set_tx_coal(mp, 133000000, MV643XX_TX_COAL); | 1432 | eth_port_set_tx_coal(mp, MV643XX_TX_COAL); |
1421 | 1433 | ||
1422 | /* Unmask phy and link status changes interrupts */ | 1434 | /* Unmask phy and link status changes interrupts */ |
1423 | wrl(mp, INTERRUPT_EXTEND_MASK_REG(port_num), ETH_INT_UNMASK_ALL_EXT); | 1435 | wrl(mp, INTERRUPT_EXTEND_MASK_REG(port_num), ETH_INT_UNMASK_ALL_EXT); |
@@ -1827,6 +1839,11 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1827 | return -ENODEV; | 1839 | return -ENODEV; |
1828 | } | 1840 | } |
1829 | 1841 | ||
1842 | if (pd->shared == NULL) { | ||
1843 | printk(KERN_ERR "No mv643xx_eth_platform_data->shared\n"); | ||
1844 | return -ENODEV; | ||
1845 | } | ||
1846 | |||
1830 | dev = alloc_etherdev(sizeof(struct mv643xx_private)); | 1847 | dev = alloc_etherdev(sizeof(struct mv643xx_private)); |
1831 | if (!dev) | 1848 | if (!dev) |
1832 | return -ENOMEM; | 1849 | return -ENOMEM; |
@@ -1877,8 +1894,16 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1877 | 1894 | ||
1878 | spin_lock_init(&mp->lock); | 1895 | spin_lock_init(&mp->lock); |
1879 | 1896 | ||
1897 | mp->shared = platform_get_drvdata(pd->shared); | ||
1880 | port_num = mp->port_num = pd->port_number; | 1898 | port_num = mp->port_num = pd->port_number; |
1881 | 1899 | ||
1900 | if (mp->shared->win_protect) | ||
1901 | wrl(mp, WINDOW_PROTECT(port_num), mp->shared->win_protect); | ||
1902 | |||
1903 | mp->shared_smi = mp->shared; | ||
1904 | if (pd->shared_smi != NULL) | ||
1905 | mp->shared_smi = platform_get_drvdata(pd->shared_smi); | ||
1906 | |||
1882 | /* set default config values */ | 1907 | /* set default config values */ |
1883 | eth_port_uc_addr_get(mp, dev->dev_addr); | 1908 | eth_port_uc_addr_get(mp, dev->dev_addr); |
1884 | mp->rx_ring_size = PORT_DEFAULT_RECEIVE_QUEUE_SIZE; | 1909 | mp->rx_ring_size = PORT_DEFAULT_RECEIVE_QUEUE_SIZE; |
@@ -1983,30 +2008,91 @@ static int mv643xx_eth_remove(struct platform_device *pdev) | |||
1983 | return 0; | 2008 | return 0; |
1984 | } | 2009 | } |
1985 | 2010 | ||
2011 | static void mv643xx_eth_conf_mbus_windows(struct mv643xx_shared_private *msp, | ||
2012 | struct mbus_dram_target_info *dram) | ||
2013 | { | ||
2014 | void __iomem *base = msp->eth_base; | ||
2015 | u32 win_enable; | ||
2016 | u32 win_protect; | ||
2017 | int i; | ||
2018 | |||
2019 | for (i = 0; i < 6; i++) { | ||
2020 | writel(0, base + WINDOW_BASE(i)); | ||
2021 | writel(0, base + WINDOW_SIZE(i)); | ||
2022 | if (i < 4) | ||
2023 | writel(0, base + WINDOW_REMAP_HIGH(i)); | ||
2024 | } | ||
2025 | |||
2026 | win_enable = 0x3f; | ||
2027 | win_protect = 0; | ||
2028 | |||
2029 | for (i = 0; i < dram->num_cs; i++) { | ||
2030 | struct mbus_dram_window *cs = dram->cs + i; | ||
2031 | |||
2032 | writel((cs->base & 0xffff0000) | | ||
2033 | (cs->mbus_attr << 8) | | ||
2034 | dram->mbus_dram_target_id, base + WINDOW_BASE(i)); | ||
2035 | writel((cs->size - 1) & 0xffff0000, base + WINDOW_SIZE(i)); | ||
2036 | |||
2037 | win_enable &= ~(1 << i); | ||
2038 | win_protect |= 3 << (2 * i); | ||
2039 | } | ||
2040 | |||
2041 | writel(win_enable, base + WINDOW_BAR_ENABLE); | ||
2042 | msp->win_protect = win_protect; | ||
2043 | } | ||
2044 | |||
1986 | static int mv643xx_eth_shared_probe(struct platform_device *pdev) | 2045 | static int mv643xx_eth_shared_probe(struct platform_device *pdev) |
1987 | { | 2046 | { |
1988 | static int mv643xx_version_printed = 0; | 2047 | static int mv643xx_version_printed = 0; |
2048 | struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data; | ||
2049 | struct mv643xx_shared_private *msp; | ||
1989 | struct resource *res; | 2050 | struct resource *res; |
2051 | int ret; | ||
1990 | 2052 | ||
1991 | if (!mv643xx_version_printed++) | 2053 | if (!mv643xx_version_printed++) |
1992 | printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); | 2054 | printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); |
1993 | 2055 | ||
2056 | ret = -EINVAL; | ||
1994 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2057 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1995 | if (res == NULL) | 2058 | if (res == NULL) |
1996 | return -ENODEV; | 2059 | goto out; |
1997 | 2060 | ||
1998 | mv643xx_eth_base = ioremap(res->start, res->end - res->start + 1); | 2061 | ret = -ENOMEM; |
1999 | if (mv643xx_eth_base == NULL) | 2062 | msp = kmalloc(sizeof(*msp), GFP_KERNEL); |
2000 | return -ENOMEM; | 2063 | if (msp == NULL) |
2064 | goto out; | ||
2065 | memset(msp, 0, sizeof(*msp)); | ||
2066 | |||
2067 | msp->eth_base = ioremap(res->start, res->end - res->start + 1); | ||
2068 | if (msp->eth_base == NULL) | ||
2069 | goto out_free; | ||
2070 | |||
2071 | spin_lock_init(&msp->phy_lock); | ||
2072 | msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000; | ||
2073 | |||
2074 | platform_set_drvdata(pdev, msp); | ||
2075 | |||
2076 | /* | ||
2077 | * (Re-)program MBUS remapping windows if we are asked to. | ||
2078 | */ | ||
2079 | if (pd != NULL && pd->dram != NULL) | ||
2080 | mv643xx_eth_conf_mbus_windows(msp, pd->dram); | ||
2001 | 2081 | ||
2002 | return 0; | 2082 | return 0; |
2003 | 2083 | ||
2084 | out_free: | ||
2085 | kfree(msp); | ||
2086 | out: | ||
2087 | return ret; | ||
2004 | } | 2088 | } |
2005 | 2089 | ||
2006 | static int mv643xx_eth_shared_remove(struct platform_device *pdev) | 2090 | static int mv643xx_eth_shared_remove(struct platform_device *pdev) |
2007 | { | 2091 | { |
2008 | iounmap(mv643xx_eth_base); | 2092 | struct mv643xx_shared_private *msp = platform_get_drvdata(pdev); |
2009 | mv643xx_eth_base = NULL; | 2093 | |
2094 | iounmap(msp->eth_base); | ||
2095 | kfree(msp); | ||
2010 | 2096 | ||
2011 | return 0; | 2097 | return 0; |
2012 | } | 2098 | } |
@@ -2906,15 +2992,16 @@ static void eth_port_reset(struct mv643xx_private *mp) | |||
2906 | static void eth_port_read_smi_reg(struct mv643xx_private *mp, | 2992 | static void eth_port_read_smi_reg(struct mv643xx_private *mp, |
2907 | unsigned int phy_reg, unsigned int *value) | 2993 | unsigned int phy_reg, unsigned int *value) |
2908 | { | 2994 | { |
2995 | void __iomem *smi_reg = mp->shared_smi->eth_base + SMI_REG; | ||
2909 | int phy_addr = ethernet_phy_get(mp); | 2996 | int phy_addr = ethernet_phy_get(mp); |
2910 | unsigned long flags; | 2997 | unsigned long flags; |
2911 | int i; | 2998 | int i; |
2912 | 2999 | ||
2913 | /* the SMI register is a shared resource */ | 3000 | /* the SMI register is a shared resource */ |
2914 | spin_lock_irqsave(&mv643xx_eth_phy_lock, flags); | 3001 | spin_lock_irqsave(&mp->shared_smi->phy_lock, flags); |
2915 | 3002 | ||
2916 | /* wait for the SMI register to become available */ | 3003 | /* wait for the SMI register to become available */ |
2917 | for (i = 0; rdl(mp, SMI_REG) & ETH_SMI_BUSY; i++) { | 3004 | for (i = 0; readl(smi_reg) & ETH_SMI_BUSY; i++) { |
2918 | if (i == PHY_WAIT_ITERATIONS) { | 3005 | if (i == PHY_WAIT_ITERATIONS) { |
2919 | printk("%s: PHY busy timeout\n", mp->dev->name); | 3006 | printk("%s: PHY busy timeout\n", mp->dev->name); |
2920 | goto out; | 3007 | goto out; |
@@ -2922,11 +3009,11 @@ static void eth_port_read_smi_reg(struct mv643xx_private *mp, | |||
2922 | udelay(PHY_WAIT_MICRO_SECONDS); | 3009 | udelay(PHY_WAIT_MICRO_SECONDS); |
2923 | } | 3010 | } |
2924 | 3011 | ||
2925 | wrl(mp, SMI_REG, | 3012 | writel((phy_addr << 16) | (phy_reg << 21) | ETH_SMI_OPCODE_READ, |
2926 | (phy_addr << 16) | (phy_reg << 21) | ETH_SMI_OPCODE_READ); | 3013 | smi_reg); |
2927 | 3014 | ||
2928 | /* now wait for the data to be valid */ | 3015 | /* now wait for the data to be valid */ |
2929 | for (i = 0; !(rdl(mp, SMI_REG) & ETH_SMI_READ_VALID); i++) { | 3016 | for (i = 0; !(readl(smi_reg) & ETH_SMI_READ_VALID); i++) { |
2930 | if (i == PHY_WAIT_ITERATIONS) { | 3017 | if (i == PHY_WAIT_ITERATIONS) { |
2931 | printk("%s: PHY read timeout\n", mp->dev->name); | 3018 | printk("%s: PHY read timeout\n", mp->dev->name); |
2932 | goto out; | 3019 | goto out; |
@@ -2934,9 +3021,9 @@ static void eth_port_read_smi_reg(struct mv643xx_private *mp, | |||
2934 | udelay(PHY_WAIT_MICRO_SECONDS); | 3021 | udelay(PHY_WAIT_MICRO_SECONDS); |
2935 | } | 3022 | } |
2936 | 3023 | ||
2937 | *value = rdl(mp, SMI_REG) & 0xffff; | 3024 | *value = readl(smi_reg) & 0xffff; |
2938 | out: | 3025 | out: |
2939 | spin_unlock_irqrestore(&mv643xx_eth_phy_lock, flags); | 3026 | spin_unlock_irqrestore(&mp->shared_smi->phy_lock, flags); |
2940 | } | 3027 | } |
2941 | 3028 | ||
2942 | /* | 3029 | /* |
@@ -2962,17 +3049,16 @@ out: | |||
2962 | static void eth_port_write_smi_reg(struct mv643xx_private *mp, | 3049 | static void eth_port_write_smi_reg(struct mv643xx_private *mp, |
2963 | unsigned int phy_reg, unsigned int value) | 3050 | unsigned int phy_reg, unsigned int value) |
2964 | { | 3051 | { |
2965 | int phy_addr; | 3052 | void __iomem *smi_reg = mp->shared_smi->eth_base + SMI_REG; |
2966 | int i; | 3053 | int phy_addr = ethernet_phy_get(mp); |
2967 | unsigned long flags; | 3054 | unsigned long flags; |
2968 | 3055 | int i; | |
2969 | phy_addr = ethernet_phy_get(mp); | ||
2970 | 3056 | ||
2971 | /* the SMI register is a shared resource */ | 3057 | /* the SMI register is a shared resource */ |
2972 | spin_lock_irqsave(&mv643xx_eth_phy_lock, flags); | 3058 | spin_lock_irqsave(&mp->shared_smi->phy_lock, flags); |
2973 | 3059 | ||
2974 | /* wait for the SMI register to become available */ | 3060 | /* wait for the SMI register to become available */ |
2975 | for (i = 0; rdl(mp, SMI_REG) & ETH_SMI_BUSY; i++) { | 3061 | for (i = 0; readl(smi_reg) & ETH_SMI_BUSY; i++) { |
2976 | if (i == PHY_WAIT_ITERATIONS) { | 3062 | if (i == PHY_WAIT_ITERATIONS) { |
2977 | printk("%s: PHY busy timeout\n", mp->dev->name); | 3063 | printk("%s: PHY busy timeout\n", mp->dev->name); |
2978 | goto out; | 3064 | goto out; |
@@ -2980,10 +3066,10 @@ static void eth_port_write_smi_reg(struct mv643xx_private *mp, | |||
2980 | udelay(PHY_WAIT_MICRO_SECONDS); | 3066 | udelay(PHY_WAIT_MICRO_SECONDS); |
2981 | } | 3067 | } |
2982 | 3068 | ||
2983 | wrl(mp, SMI_REG, (phy_addr << 16) | (phy_reg << 21) | | 3069 | writel((phy_addr << 16) | (phy_reg << 21) | |
2984 | ETH_SMI_OPCODE_WRITE | (value & 0xffff)); | 3070 | ETH_SMI_OPCODE_WRITE | (value & 0xffff), smi_reg); |
2985 | out: | 3071 | out: |
2986 | spin_unlock_irqrestore(&mv643xx_eth_phy_lock, flags); | 3072 | spin_unlock_irqrestore(&mp->shared_smi->phy_lock, flags); |
2987 | } | 3073 | } |
2988 | 3074 | ||
2989 | /* | 3075 | /* |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 4009c4ce96b..57cfd72ffdf 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* niu.c: Neptune ethernet driver. | 1 | /* niu.c: Neptune ethernet driver. |
2 | * | 2 | * |
3 | * Copyright (C) 2007 David S. Miller (davem@davemloft.net) | 3 | * Copyright (C) 2007, 2008 David S. Miller (davem@davemloft.net) |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
@@ -33,8 +33,8 @@ | |||
33 | 33 | ||
34 | #define DRV_MODULE_NAME "niu" | 34 | #define DRV_MODULE_NAME "niu" |
35 | #define PFX DRV_MODULE_NAME ": " | 35 | #define PFX DRV_MODULE_NAME ": " |
36 | #define DRV_MODULE_VERSION "0.8" | 36 | #define DRV_MODULE_VERSION "0.9" |
37 | #define DRV_MODULE_RELDATE "April 24, 2008" | 37 | #define DRV_MODULE_RELDATE "May 4, 2008" |
38 | 38 | ||
39 | static char version[] __devinitdata = | 39 | static char version[] __devinitdata = |
40 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 40 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
@@ -7264,8 +7264,11 @@ static int __devinit niu_get_and_validate_port(struct niu *np) | |||
7264 | parent->num_ports = nr64(ESPC_NUM_PORTS_MACS) & | 7264 | parent->num_ports = nr64(ESPC_NUM_PORTS_MACS) & |
7265 | ESPC_NUM_PORTS_MACS_VAL; | 7265 | ESPC_NUM_PORTS_MACS_VAL; |
7266 | 7266 | ||
7267 | /* All of the current probing methods fail on | ||
7268 | * Maramba on-board parts. | ||
7269 | */ | ||
7267 | if (!parent->num_ports) | 7270 | if (!parent->num_ports) |
7268 | return -ENODEV; | 7271 | parent->num_ports = 4; |
7269 | } | 7272 | } |
7270 | } | 7273 | } |
7271 | } | 7274 | } |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 4eb322e5273..a1c454dbc16 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -22,12 +22,8 @@ | |||
22 | *************************************************************************/ | 22 | *************************************************************************/ |
23 | 23 | ||
24 | #define DRV_NAME "pcnet32" | 24 | #define DRV_NAME "pcnet32" |
25 | #ifdef CONFIG_PCNET32_NAPI | 25 | #define DRV_VERSION "1.35" |
26 | #define DRV_VERSION "1.34-NAPI" | 26 | #define DRV_RELDATE "21.Apr.2008" |
27 | #else | ||
28 | #define DRV_VERSION "1.34" | ||
29 | #endif | ||
30 | #define DRV_RELDATE "14.Aug.2007" | ||
31 | #define PFX DRV_NAME ": " | 27 | #define PFX DRV_NAME ": " |
32 | 28 | ||
33 | static const char *const version = | 29 | static const char *const version = |
@@ -445,30 +441,24 @@ static struct pcnet32_access pcnet32_dwio = { | |||
445 | 441 | ||
446 | static void pcnet32_netif_stop(struct net_device *dev) | 442 | static void pcnet32_netif_stop(struct net_device *dev) |
447 | { | 443 | { |
448 | #ifdef CONFIG_PCNET32_NAPI | ||
449 | struct pcnet32_private *lp = netdev_priv(dev); | 444 | struct pcnet32_private *lp = netdev_priv(dev); |
450 | #endif | 445 | |
451 | dev->trans_start = jiffies; | 446 | dev->trans_start = jiffies; |
452 | #ifdef CONFIG_PCNET32_NAPI | ||
453 | napi_disable(&lp->napi); | 447 | napi_disable(&lp->napi); |
454 | #endif | ||
455 | netif_tx_disable(dev); | 448 | netif_tx_disable(dev); |
456 | } | 449 | } |
457 | 450 | ||
458 | static void pcnet32_netif_start(struct net_device *dev) | 451 | static void pcnet32_netif_start(struct net_device *dev) |
459 | { | 452 | { |
460 | #ifdef CONFIG_PCNET32_NAPI | ||
461 | struct pcnet32_private *lp = netdev_priv(dev); | 453 | struct pcnet32_private *lp = netdev_priv(dev); |
462 | ulong ioaddr = dev->base_addr; | 454 | ulong ioaddr = dev->base_addr; |
463 | u16 val; | 455 | u16 val; |
464 | #endif | 456 | |
465 | netif_wake_queue(dev); | 457 | netif_wake_queue(dev); |
466 | #ifdef CONFIG_PCNET32_NAPI | ||
467 | val = lp->a.read_csr(ioaddr, CSR3); | 458 | val = lp->a.read_csr(ioaddr, CSR3); |
468 | val &= 0x00ff; | 459 | val &= 0x00ff; |
469 | lp->a.write_csr(ioaddr, CSR3, val); | 460 | lp->a.write_csr(ioaddr, CSR3, val); |
470 | napi_enable(&lp->napi); | 461 | napi_enable(&lp->napi); |
471 | #endif | ||
472 | } | 462 | } |
473 | 463 | ||
474 | /* | 464 | /* |
@@ -911,11 +901,7 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1) | |||
911 | rc = 1; /* default to fail */ | 901 | rc = 1; /* default to fail */ |
912 | 902 | ||
913 | if (netif_running(dev)) | 903 | if (netif_running(dev)) |
914 | #ifdef CONFIG_PCNET32_NAPI | ||
915 | pcnet32_netif_stop(dev); | 904 | pcnet32_netif_stop(dev); |
916 | #else | ||
917 | pcnet32_close(dev); | ||
918 | #endif | ||
919 | 905 | ||
920 | spin_lock_irqsave(&lp->lock, flags); | 906 | spin_lock_irqsave(&lp->lock, flags); |
921 | lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); /* stop the chip */ | 907 | lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); /* stop the chip */ |
@@ -1046,7 +1032,6 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1) | |||
1046 | x = a->read_bcr(ioaddr, 32); /* reset internal loopback */ | 1032 | x = a->read_bcr(ioaddr, 32); /* reset internal loopback */ |
1047 | a->write_bcr(ioaddr, 32, (x & ~0x0002)); | 1033 | a->write_bcr(ioaddr, 32, (x & ~0x0002)); |
1048 | 1034 | ||
1049 | #ifdef CONFIG_PCNET32_NAPI | ||
1050 | if (netif_running(dev)) { | 1035 | if (netif_running(dev)) { |
1051 | pcnet32_netif_start(dev); | 1036 | pcnet32_netif_start(dev); |
1052 | pcnet32_restart(dev, CSR0_NORMAL); | 1037 | pcnet32_restart(dev, CSR0_NORMAL); |
@@ -1055,16 +1040,6 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1) | |||
1055 | lp->a.write_bcr(ioaddr, 20, 4); /* return to 16bit mode */ | 1040 | lp->a.write_bcr(ioaddr, 20, 4); /* return to 16bit mode */ |
1056 | } | 1041 | } |
1057 | spin_unlock_irqrestore(&lp->lock, flags); | 1042 | spin_unlock_irqrestore(&lp->lock, flags); |
1058 | #else | ||
1059 | if (netif_running(dev)) { | ||
1060 | spin_unlock_irqrestore(&lp->lock, flags); | ||
1061 | pcnet32_open(dev); | ||
1062 | } else { | ||
1063 | pcnet32_purge_rx_ring(dev); | ||
1064 | lp->a.write_bcr(ioaddr, 20, 4); /* return to 16bit mode */ | ||
1065 | spin_unlock_irqrestore(&lp->lock, flags); | ||
1066 | } | ||
1067 | #endif | ||
1068 | 1043 | ||
1069 | return (rc); | 1044 | return (rc); |
1070 | } /* end pcnet32_loopback_test */ | 1045 | } /* end pcnet32_loopback_test */ |
@@ -1270,11 +1245,7 @@ static void pcnet32_rx_entry(struct net_device *dev, | |||
1270 | } | 1245 | } |
1271 | dev->stats.rx_bytes += skb->len; | 1246 | dev->stats.rx_bytes += skb->len; |
1272 | skb->protocol = eth_type_trans(skb, dev); | 1247 | skb->protocol = eth_type_trans(skb, dev); |
1273 | #ifdef CONFIG_PCNET32_NAPI | ||
1274 | netif_receive_skb(skb); | 1248 | netif_receive_skb(skb); |
1275 | #else | ||
1276 | netif_rx(skb); | ||
1277 | #endif | ||
1278 | dev->last_rx = jiffies; | 1249 | dev->last_rx = jiffies; |
1279 | dev->stats.rx_packets++; | 1250 | dev->stats.rx_packets++; |
1280 | return; | 1251 | return; |
@@ -1403,7 +1374,6 @@ static int pcnet32_tx(struct net_device *dev) | |||
1403 | return must_restart; | 1374 | return must_restart; |
1404 | } | 1375 | } |
1405 | 1376 | ||
1406 | #ifdef CONFIG_PCNET32_NAPI | ||
1407 | static int pcnet32_poll(struct napi_struct *napi, int budget) | 1377 | static int pcnet32_poll(struct napi_struct *napi, int budget) |
1408 | { | 1378 | { |
1409 | struct pcnet32_private *lp = container_of(napi, struct pcnet32_private, napi); | 1379 | struct pcnet32_private *lp = container_of(napi, struct pcnet32_private, napi); |
@@ -1442,7 +1412,6 @@ static int pcnet32_poll(struct napi_struct *napi, int budget) | |||
1442 | } | 1412 | } |
1443 | return work_done; | 1413 | return work_done; |
1444 | } | 1414 | } |
1445 | #endif | ||
1446 | 1415 | ||
1447 | #define PCNET32_REGS_PER_PHY 32 | 1416 | #define PCNET32_REGS_PER_PHY 32 |
1448 | #define PCNET32_MAX_PHYS 32 | 1417 | #define PCNET32_MAX_PHYS 32 |
@@ -1864,9 +1833,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1864 | /* napi.weight is used in both the napi and non-napi cases */ | 1833 | /* napi.weight is used in both the napi and non-napi cases */ |
1865 | lp->napi.weight = lp->rx_ring_size / 2; | 1834 | lp->napi.weight = lp->rx_ring_size / 2; |
1866 | 1835 | ||
1867 | #ifdef CONFIG_PCNET32_NAPI | ||
1868 | netif_napi_add(dev, &lp->napi, pcnet32_poll, lp->rx_ring_size / 2); | 1836 | netif_napi_add(dev, &lp->napi, pcnet32_poll, lp->rx_ring_size / 2); |
1869 | #endif | ||
1870 | 1837 | ||
1871 | if (fdx && !(lp->options & PCNET32_PORT_ASEL) && | 1838 | if (fdx && !(lp->options & PCNET32_PORT_ASEL) && |
1872 | ((cards_found >= MAX_UNITS) || full_duplex[cards_found])) | 1839 | ((cards_found >= MAX_UNITS) || full_duplex[cards_found])) |
@@ -2297,9 +2264,7 @@ static int pcnet32_open(struct net_device *dev) | |||
2297 | goto err_free_ring; | 2264 | goto err_free_ring; |
2298 | } | 2265 | } |
2299 | 2266 | ||
2300 | #ifdef CONFIG_PCNET32_NAPI | ||
2301 | napi_enable(&lp->napi); | 2267 | napi_enable(&lp->napi); |
2302 | #endif | ||
2303 | 2268 | ||
2304 | /* Re-initialize the PCNET32, and start it when done. */ | 2269 | /* Re-initialize the PCNET32, and start it when done. */ |
2305 | lp->a.write_csr(ioaddr, 1, (lp->init_dma_addr & 0xffff)); | 2270 | lp->a.write_csr(ioaddr, 1, (lp->init_dma_addr & 0xffff)); |
@@ -2623,7 +2588,6 @@ pcnet32_interrupt(int irq, void *dev_id) | |||
2623 | dev->name, csr0); | 2588 | dev->name, csr0); |
2624 | /* unlike for the lance, there is no restart needed */ | 2589 | /* unlike for the lance, there is no restart needed */ |
2625 | } | 2590 | } |
2626 | #ifdef CONFIG_PCNET32_NAPI | ||
2627 | if (netif_rx_schedule_prep(dev, &lp->napi)) { | 2591 | if (netif_rx_schedule_prep(dev, &lp->napi)) { |
2628 | u16 val; | 2592 | u16 val; |
2629 | /* set interrupt masks */ | 2593 | /* set interrupt masks */ |
@@ -2634,24 +2598,9 @@ pcnet32_interrupt(int irq, void *dev_id) | |||
2634 | __netif_rx_schedule(dev, &lp->napi); | 2598 | __netif_rx_schedule(dev, &lp->napi); |
2635 | break; | 2599 | break; |
2636 | } | 2600 | } |
2637 | #else | ||
2638 | pcnet32_rx(dev, lp->napi.weight); | ||
2639 | if (pcnet32_tx(dev)) { | ||
2640 | /* reset the chip to clear the error condition, then restart */ | ||
2641 | lp->a.reset(ioaddr); | ||
2642 | lp->a.write_csr(ioaddr, CSR4, 0x0915); /* auto tx pad */ | ||
2643 | pcnet32_restart(dev, CSR0_START); | ||
2644 | netif_wake_queue(dev); | ||
2645 | } | ||
2646 | #endif | ||
2647 | csr0 = lp->a.read_csr(ioaddr, CSR0); | 2601 | csr0 = lp->a.read_csr(ioaddr, CSR0); |
2648 | } | 2602 | } |
2649 | 2603 | ||
2650 | #ifndef CONFIG_PCNET32_NAPI | ||
2651 | /* Set interrupt enable. */ | ||
2652 | lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN); | ||
2653 | #endif | ||
2654 | |||
2655 | if (netif_msg_intr(lp)) | 2604 | if (netif_msg_intr(lp)) |
2656 | printk(KERN_DEBUG "%s: exiting interrupt, csr0=%#4.4x.\n", | 2605 | printk(KERN_DEBUG "%s: exiting interrupt, csr0=%#4.4x.\n", |
2657 | dev->name, lp->a.read_csr(ioaddr, CSR0)); | 2606 | dev->name, lp->a.read_csr(ioaddr, CSR0)); |
@@ -2670,9 +2619,7 @@ static int pcnet32_close(struct net_device *dev) | |||
2670 | del_timer_sync(&lp->watchdog_timer); | 2619 | del_timer_sync(&lp->watchdog_timer); |
2671 | 2620 | ||
2672 | netif_stop_queue(dev); | 2621 | netif_stop_queue(dev); |
2673 | #ifdef CONFIG_PCNET32_NAPI | ||
2674 | napi_disable(&lp->napi); | 2622 | napi_disable(&lp->napi); |
2675 | #endif | ||
2676 | 2623 | ||
2677 | spin_lock_irqsave(&lp->lock, flags); | 2624 | spin_lock_irqsave(&lp->lock, flags); |
2678 | 2625 | ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 3c18bb59495..45cc2914d34 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -547,7 +547,7 @@ static void phy_force_reduction(struct phy_device *phydev) | |||
547 | * Must not be called from interrupt context, or while the | 547 | * Must not be called from interrupt context, or while the |
548 | * phydev->lock is held. | 548 | * phydev->lock is held. |
549 | */ | 549 | */ |
550 | void phy_error(struct phy_device *phydev) | 550 | static void phy_error(struct phy_device *phydev) |
551 | { | 551 | { |
552 | mutex_lock(&phydev->lock); | 552 | mutex_lock(&phydev->lock); |
553 | phydev->state = PHY_HALTED; | 553 | phydev->state = PHY_HALTED; |
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index a59c1f224aa..2511ca7a12a 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -434,10 +434,6 @@ static int uli526x_open(struct net_device *dev) | |||
434 | 434 | ||
435 | ULI526X_DBUG(0, "uli526x_open", 0); | 435 | ULI526X_DBUG(0, "uli526x_open", 0); |
436 | 436 | ||
437 | ret = request_irq(dev->irq, &uli526x_interrupt, IRQF_SHARED, dev->name, dev); | ||
438 | if (ret) | ||
439 | return ret; | ||
440 | |||
441 | /* system variable init */ | 437 | /* system variable init */ |
442 | db->cr6_data = CR6_DEFAULT | uli526x_cr6_user_set; | 438 | db->cr6_data = CR6_DEFAULT | uli526x_cr6_user_set; |
443 | db->tx_packet_cnt = 0; | 439 | db->tx_packet_cnt = 0; |
@@ -456,6 +452,10 @@ static int uli526x_open(struct net_device *dev) | |||
456 | /* Initialize ULI526X board */ | 452 | /* Initialize ULI526X board */ |
457 | uli526x_init(dev); | 453 | uli526x_init(dev); |
458 | 454 | ||
455 | ret = request_irq(dev->irq, &uli526x_interrupt, IRQF_SHARED, dev->name, dev); | ||
456 | if (ret) | ||
457 | return ret; | ||
458 | |||
459 | /* Active System Interface */ | 459 | /* Active System Interface */ |
460 | netif_wake_queue(dev); | 460 | netif_wake_queue(dev); |
461 | 461 | ||
@@ -1368,6 +1368,12 @@ static void update_cr6(u32 cr6_data, unsigned long ioaddr) | |||
1368 | * This setup frame initialize ULI526X address filter mode | 1368 | * This setup frame initialize ULI526X address filter mode |
1369 | */ | 1369 | */ |
1370 | 1370 | ||
1371 | #ifdef __BIG_ENDIAN | ||
1372 | #define FLT_SHIFT 16 | ||
1373 | #else | ||
1374 | #define FLT_SHIFT 0 | ||
1375 | #endif | ||
1376 | |||
1371 | static void send_filter_frame(struct net_device *dev, int mc_cnt) | 1377 | static void send_filter_frame(struct net_device *dev, int mc_cnt) |
1372 | { | 1378 | { |
1373 | struct uli526x_board_info *db = netdev_priv(dev); | 1379 | struct uli526x_board_info *db = netdev_priv(dev); |
@@ -1384,27 +1390,27 @@ static void send_filter_frame(struct net_device *dev, int mc_cnt) | |||
1384 | 1390 | ||
1385 | /* Node address */ | 1391 | /* Node address */ |
1386 | addrptr = (u16 *) dev->dev_addr; | 1392 | addrptr = (u16 *) dev->dev_addr; |
1387 | *suptr++ = addrptr[0]; | 1393 | *suptr++ = addrptr[0] << FLT_SHIFT; |
1388 | *suptr++ = addrptr[1]; | 1394 | *suptr++ = addrptr[1] << FLT_SHIFT; |
1389 | *suptr++ = addrptr[2]; | 1395 | *suptr++ = addrptr[2] << FLT_SHIFT; |
1390 | 1396 | ||
1391 | /* broadcast address */ | 1397 | /* broadcast address */ |
1392 | *suptr++ = 0xffff; | 1398 | *suptr++ = 0xffff << FLT_SHIFT; |
1393 | *suptr++ = 0xffff; | 1399 | *suptr++ = 0xffff << FLT_SHIFT; |
1394 | *suptr++ = 0xffff; | 1400 | *suptr++ = 0xffff << FLT_SHIFT; |
1395 | 1401 | ||
1396 | /* fit the multicast address */ | 1402 | /* fit the multicast address */ |
1397 | for (mcptr = dev->mc_list, i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { | 1403 | for (mcptr = dev->mc_list, i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { |
1398 | addrptr = (u16 *) mcptr->dmi_addr; | 1404 | addrptr = (u16 *) mcptr->dmi_addr; |
1399 | *suptr++ = addrptr[0]; | 1405 | *suptr++ = addrptr[0] << FLT_SHIFT; |
1400 | *suptr++ = addrptr[1]; | 1406 | *suptr++ = addrptr[1] << FLT_SHIFT; |
1401 | *suptr++ = addrptr[2]; | 1407 | *suptr++ = addrptr[2] << FLT_SHIFT; |
1402 | } | 1408 | } |
1403 | 1409 | ||
1404 | for (; i<14; i++) { | 1410 | for (; i<14; i++) { |
1405 | *suptr++ = 0xffff; | 1411 | *suptr++ = 0xffff << FLT_SHIFT; |
1406 | *suptr++ = 0xffff; | 1412 | *suptr++ = 0xffff << FLT_SHIFT; |
1407 | *suptr++ = 0xffff; | 1413 | *suptr++ = 0xffff << FLT_SHIFT; |
1408 | } | 1414 | } |
1409 | 1415 | ||
1410 | /* prepare the setup frame */ | 1416 | /* prepare the setup frame */ |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 281ce3d3953..ca0bdac07a7 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -62,7 +62,6 @@ | |||
62 | #endif /* UGETH_VERBOSE_DEBUG */ | 62 | #endif /* UGETH_VERBOSE_DEBUG */ |
63 | #define UGETH_MSG_DEFAULT (NETIF_MSG_IFUP << 1 ) - 1 | 63 | #define UGETH_MSG_DEFAULT (NETIF_MSG_IFUP << 1 ) - 1 |
64 | 64 | ||
65 | void uec_set_ethtool_ops(struct net_device *netdev); | ||
66 | 65 | ||
67 | static DEFINE_SPINLOCK(ugeth_lock); | 66 | static DEFINE_SPINLOCK(ugeth_lock); |
68 | 67 | ||
@@ -216,7 +215,8 @@ static struct list_head *dequeue(struct list_head *lh) | |||
216 | } | 215 | } |
217 | } | 216 | } |
218 | 217 | ||
219 | static struct sk_buff *get_new_skb(struct ucc_geth_private *ugeth, u8 *bd) | 218 | static struct sk_buff *get_new_skb(struct ucc_geth_private *ugeth, |
219 | u8 __iomem *bd) | ||
220 | { | 220 | { |
221 | struct sk_buff *skb = NULL; | 221 | struct sk_buff *skb = NULL; |
222 | 222 | ||
@@ -236,21 +236,22 @@ static struct sk_buff *get_new_skb(struct ucc_geth_private *ugeth, u8 *bd) | |||
236 | 236 | ||
237 | skb->dev = ugeth->dev; | 237 | skb->dev = ugeth->dev; |
238 | 238 | ||
239 | out_be32(&((struct qe_bd *)bd)->buf, | 239 | out_be32(&((struct qe_bd __iomem *)bd)->buf, |
240 | dma_map_single(NULL, | 240 | dma_map_single(NULL, |
241 | skb->data, | 241 | skb->data, |
242 | ugeth->ug_info->uf_info.max_rx_buf_length + | 242 | ugeth->ug_info->uf_info.max_rx_buf_length + |
243 | UCC_GETH_RX_DATA_BUF_ALIGNMENT, | 243 | UCC_GETH_RX_DATA_BUF_ALIGNMENT, |
244 | DMA_FROM_DEVICE)); | 244 | DMA_FROM_DEVICE)); |
245 | 245 | ||
246 | out_be32((u32 *)bd, (R_E | R_I | (in_be32((u32 *)bd) & R_W))); | 246 | out_be32((u32 __iomem *)bd, |
247 | (R_E | R_I | (in_be32((u32 __iomem*)bd) & R_W))); | ||
247 | 248 | ||
248 | return skb; | 249 | return skb; |
249 | } | 250 | } |
250 | 251 | ||
251 | static int rx_bd_buffer_set(struct ucc_geth_private *ugeth, u8 rxQ) | 252 | static int rx_bd_buffer_set(struct ucc_geth_private *ugeth, u8 rxQ) |
252 | { | 253 | { |
253 | u8 *bd; | 254 | u8 __iomem *bd; |
254 | u32 bd_status; | 255 | u32 bd_status; |
255 | struct sk_buff *skb; | 256 | struct sk_buff *skb; |
256 | int i; | 257 | int i; |
@@ -259,7 +260,7 @@ static int rx_bd_buffer_set(struct ucc_geth_private *ugeth, u8 rxQ) | |||
259 | i = 0; | 260 | i = 0; |
260 | 261 | ||
261 | do { | 262 | do { |
262 | bd_status = in_be32((u32*)bd); | 263 | bd_status = in_be32((u32 __iomem *)bd); |
263 | skb = get_new_skb(ugeth, bd); | 264 | skb = get_new_skb(ugeth, bd); |
264 | 265 | ||
265 | if (!skb) /* If can not allocate data buffer, | 266 | if (!skb) /* If can not allocate data buffer, |
@@ -277,7 +278,7 @@ static int rx_bd_buffer_set(struct ucc_geth_private *ugeth, u8 rxQ) | |||
277 | } | 278 | } |
278 | 279 | ||
279 | static int fill_init_enet_entries(struct ucc_geth_private *ugeth, | 280 | static int fill_init_enet_entries(struct ucc_geth_private *ugeth, |
280 | volatile u32 *p_start, | 281 | u32 *p_start, |
281 | u8 num_entries, | 282 | u8 num_entries, |
282 | u32 thread_size, | 283 | u32 thread_size, |
283 | u32 thread_alignment, | 284 | u32 thread_alignment, |
@@ -316,7 +317,7 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth, | |||
316 | } | 317 | } |
317 | 318 | ||
318 | static int return_init_enet_entries(struct ucc_geth_private *ugeth, | 319 | static int return_init_enet_entries(struct ucc_geth_private *ugeth, |
319 | volatile u32 *p_start, | 320 | u32 *p_start, |
320 | u8 num_entries, | 321 | u8 num_entries, |
321 | enum qe_risc_allocation risc, | 322 | enum qe_risc_allocation risc, |
322 | int skip_page_for_first_entry) | 323 | int skip_page_for_first_entry) |
@@ -326,21 +327,22 @@ static int return_init_enet_entries(struct ucc_geth_private *ugeth, | |||
326 | int snum; | 327 | int snum; |
327 | 328 | ||
328 | for (i = 0; i < num_entries; i++) { | 329 | for (i = 0; i < num_entries; i++) { |
330 | u32 val = *p_start; | ||
331 | |||
329 | /* Check that this entry was actually valid -- | 332 | /* Check that this entry was actually valid -- |
330 | needed in case failed in allocations */ | 333 | needed in case failed in allocations */ |
331 | if ((*p_start & ENET_INIT_PARAM_RISC_MASK) == risc) { | 334 | if ((val & ENET_INIT_PARAM_RISC_MASK) == risc) { |
332 | snum = | 335 | snum = |
333 | (u32) (*p_start & ENET_INIT_PARAM_SNUM_MASK) >> | 336 | (u32) (val & ENET_INIT_PARAM_SNUM_MASK) >> |
334 | ENET_INIT_PARAM_SNUM_SHIFT; | 337 | ENET_INIT_PARAM_SNUM_SHIFT; |
335 | qe_put_snum((u8) snum); | 338 | qe_put_snum((u8) snum); |
336 | if (!((i == 0) && skip_page_for_first_entry)) { | 339 | if (!((i == 0) && skip_page_for_first_entry)) { |
337 | /* First entry of Rx does not have page */ | 340 | /* First entry of Rx does not have page */ |
338 | init_enet_offset = | 341 | init_enet_offset = |
339 | (in_be32(p_start) & | 342 | (val & ENET_INIT_PARAM_PTR_MASK); |
340 | ENET_INIT_PARAM_PTR_MASK); | ||
341 | qe_muram_free(init_enet_offset); | 343 | qe_muram_free(init_enet_offset); |
342 | } | 344 | } |
343 | *(p_start++) = 0; /* Just for cosmetics */ | 345 | *p_start++ = 0; |
344 | } | 346 | } |
345 | } | 347 | } |
346 | 348 | ||
@@ -349,7 +351,7 @@ static int return_init_enet_entries(struct ucc_geth_private *ugeth, | |||
349 | 351 | ||
350 | #ifdef DEBUG | 352 | #ifdef DEBUG |
351 | static int dump_init_enet_entries(struct ucc_geth_private *ugeth, | 353 | static int dump_init_enet_entries(struct ucc_geth_private *ugeth, |
352 | volatile u32 *p_start, | 354 | u32 __iomem *p_start, |
353 | u8 num_entries, | 355 | u8 num_entries, |
354 | u32 thread_size, | 356 | u32 thread_size, |
355 | enum qe_risc_allocation risc, | 357 | enum qe_risc_allocation risc, |
@@ -360,11 +362,13 @@ static int dump_init_enet_entries(struct ucc_geth_private *ugeth, | |||
360 | int snum; | 362 | int snum; |
361 | 363 | ||
362 | for (i = 0; i < num_entries; i++) { | 364 | for (i = 0; i < num_entries; i++) { |
365 | u32 val = in_be32(p_start); | ||
366 | |||
363 | /* Check that this entry was actually valid -- | 367 | /* Check that this entry was actually valid -- |
364 | needed in case failed in allocations */ | 368 | needed in case failed in allocations */ |
365 | if ((*p_start & ENET_INIT_PARAM_RISC_MASK) == risc) { | 369 | if ((val & ENET_INIT_PARAM_RISC_MASK) == risc) { |
366 | snum = | 370 | snum = |
367 | (u32) (*p_start & ENET_INIT_PARAM_SNUM_MASK) >> | 371 | (u32) (val & ENET_INIT_PARAM_SNUM_MASK) >> |
368 | ENET_INIT_PARAM_SNUM_SHIFT; | 372 | ENET_INIT_PARAM_SNUM_SHIFT; |
369 | qe_put_snum((u8) snum); | 373 | qe_put_snum((u8) snum); |
370 | if (!((i == 0) && skip_page_for_first_entry)) { | 374 | if (!((i == 0) && skip_page_for_first_entry)) { |
@@ -440,7 +444,7 @@ static int hw_add_addr_in_paddr(struct ucc_geth_private *ugeth, | |||
440 | 444 | ||
441 | static int hw_clear_addr_in_paddr(struct ucc_geth_private *ugeth, u8 paddr_num) | 445 | static int hw_clear_addr_in_paddr(struct ucc_geth_private *ugeth, u8 paddr_num) |
442 | { | 446 | { |
443 | struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt; | 447 | struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt; |
444 | 448 | ||
445 | if (!(paddr_num < NUM_OF_PADDRS)) { | 449 | if (!(paddr_num < NUM_OF_PADDRS)) { |
446 | ugeth_warn("%s: Illagel paddr_num.", __FUNCTION__); | 450 | ugeth_warn("%s: Illagel paddr_num.", __FUNCTION__); |
@@ -448,7 +452,7 @@ static int hw_clear_addr_in_paddr(struct ucc_geth_private *ugeth, u8 paddr_num) | |||
448 | } | 452 | } |
449 | 453 | ||
450 | p_82xx_addr_filt = | 454 | p_82xx_addr_filt = |
451 | (struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram-> | 455 | (struct ucc_geth_82xx_address_filtering_pram __iomem *) ugeth->p_rx_glbl_pram-> |
452 | addressfiltering; | 456 | addressfiltering; |
453 | 457 | ||
454 | /* Writing address ff.ff.ff.ff.ff.ff disables address | 458 | /* Writing address ff.ff.ff.ff.ff.ff disables address |
@@ -463,11 +467,11 @@ static int hw_clear_addr_in_paddr(struct ucc_geth_private *ugeth, u8 paddr_num) | |||
463 | static void hw_add_addr_in_hash(struct ucc_geth_private *ugeth, | 467 | static void hw_add_addr_in_hash(struct ucc_geth_private *ugeth, |
464 | u8 *p_enet_addr) | 468 | u8 *p_enet_addr) |
465 | { | 469 | { |
466 | struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt; | 470 | struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt; |
467 | u32 cecr_subblock; | 471 | u32 cecr_subblock; |
468 | 472 | ||
469 | p_82xx_addr_filt = | 473 | p_82xx_addr_filt = |
470 | (struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram-> | 474 | (struct ucc_geth_82xx_address_filtering_pram __iomem *) ugeth->p_rx_glbl_pram-> |
471 | addressfiltering; | 475 | addressfiltering; |
472 | 476 | ||
473 | cecr_subblock = | 477 | cecr_subblock = |
@@ -487,7 +491,7 @@ static void hw_add_addr_in_hash(struct ucc_geth_private *ugeth, | |||
487 | static void magic_packet_detection_enable(struct ucc_geth_private *ugeth) | 491 | static void magic_packet_detection_enable(struct ucc_geth_private *ugeth) |
488 | { | 492 | { |
489 | struct ucc_fast_private *uccf; | 493 | struct ucc_fast_private *uccf; |
490 | struct ucc_geth *ug_regs; | 494 | struct ucc_geth __iomem *ug_regs; |
491 | u32 maccfg2, uccm; | 495 | u32 maccfg2, uccm; |
492 | 496 | ||
493 | uccf = ugeth->uccf; | 497 | uccf = ugeth->uccf; |
@@ -507,7 +511,7 @@ static void magic_packet_detection_enable(struct ucc_geth_private *ugeth) | |||
507 | static void magic_packet_detection_disable(struct ucc_geth_private *ugeth) | 511 | static void magic_packet_detection_disable(struct ucc_geth_private *ugeth) |
508 | { | 512 | { |
509 | struct ucc_fast_private *uccf; | 513 | struct ucc_fast_private *uccf; |
510 | struct ucc_geth *ug_regs; | 514 | struct ucc_geth __iomem *ug_regs; |
511 | u32 maccfg2, uccm; | 515 | u32 maccfg2, uccm; |
512 | 516 | ||
513 | uccf = ugeth->uccf; | 517 | uccf = ugeth->uccf; |
@@ -538,13 +542,13 @@ static void get_statistics(struct ucc_geth_private *ugeth, | |||
538 | rx_firmware_statistics, | 542 | rx_firmware_statistics, |
539 | struct ucc_geth_hardware_statistics *hardware_statistics) | 543 | struct ucc_geth_hardware_statistics *hardware_statistics) |
540 | { | 544 | { |
541 | struct ucc_fast *uf_regs; | 545 | struct ucc_fast __iomem *uf_regs; |
542 | struct ucc_geth *ug_regs; | 546 | struct ucc_geth __iomem *ug_regs; |
543 | struct ucc_geth_tx_firmware_statistics_pram *p_tx_fw_statistics_pram; | 547 | struct ucc_geth_tx_firmware_statistics_pram *p_tx_fw_statistics_pram; |
544 | struct ucc_geth_rx_firmware_statistics_pram *p_rx_fw_statistics_pram; | 548 | struct ucc_geth_rx_firmware_statistics_pram *p_rx_fw_statistics_pram; |
545 | 549 | ||
546 | ug_regs = ugeth->ug_regs; | 550 | ug_regs = ugeth->ug_regs; |
547 | uf_regs = (struct ucc_fast *) ug_regs; | 551 | uf_regs = (struct ucc_fast __iomem *) ug_regs; |
548 | p_tx_fw_statistics_pram = ugeth->p_tx_fw_statistics_pram; | 552 | p_tx_fw_statistics_pram = ugeth->p_tx_fw_statistics_pram; |
549 | p_rx_fw_statistics_pram = ugeth->p_rx_fw_statistics_pram; | 553 | p_rx_fw_statistics_pram = ugeth->p_rx_fw_statistics_pram; |
550 | 554 | ||
@@ -1132,9 +1136,9 @@ static void dump_regs(struct ucc_geth_private *ugeth) | |||
1132 | } | 1136 | } |
1133 | #endif /* DEBUG */ | 1137 | #endif /* DEBUG */ |
1134 | 1138 | ||
1135 | static void init_default_reg_vals(volatile u32 *upsmr_register, | 1139 | static void init_default_reg_vals(u32 __iomem *upsmr_register, |
1136 | volatile u32 *maccfg1_register, | 1140 | u32 __iomem *maccfg1_register, |
1137 | volatile u32 *maccfg2_register) | 1141 | u32 __iomem *maccfg2_register) |
1138 | { | 1142 | { |
1139 | out_be32(upsmr_register, UCC_GETH_UPSMR_INIT); | 1143 | out_be32(upsmr_register, UCC_GETH_UPSMR_INIT); |
1140 | out_be32(maccfg1_register, UCC_GETH_MACCFG1_INIT); | 1144 | out_be32(maccfg1_register, UCC_GETH_MACCFG1_INIT); |
@@ -1148,7 +1152,7 @@ static int init_half_duplex_params(int alt_beb, | |||
1148 | u8 alt_beb_truncation, | 1152 | u8 alt_beb_truncation, |
1149 | u8 max_retransmissions, | 1153 | u8 max_retransmissions, |
1150 | u8 collision_window, | 1154 | u8 collision_window, |
1151 | volatile u32 *hafdup_register) | 1155 | u32 __iomem *hafdup_register) |
1152 | { | 1156 | { |
1153 | u32 value = 0; | 1157 | u32 value = 0; |
1154 | 1158 | ||
@@ -1180,7 +1184,7 @@ static int init_inter_frame_gap_params(u8 non_btb_cs_ipg, | |||
1180 | u8 non_btb_ipg, | 1184 | u8 non_btb_ipg, |
1181 | u8 min_ifg, | 1185 | u8 min_ifg, |
1182 | u8 btb_ipg, | 1186 | u8 btb_ipg, |
1183 | volatile u32 *ipgifg_register) | 1187 | u32 __iomem *ipgifg_register) |
1184 | { | 1188 | { |
1185 | u32 value = 0; | 1189 | u32 value = 0; |
1186 | 1190 | ||
@@ -1215,9 +1219,9 @@ int init_flow_control_params(u32 automatic_flow_control_mode, | |||
1215 | int tx_flow_control_enable, | 1219 | int tx_flow_control_enable, |
1216 | u16 pause_period, | 1220 | u16 pause_period, |
1217 | u16 extension_field, | 1221 | u16 extension_field, |
1218 | volatile u32 *upsmr_register, | 1222 | u32 __iomem *upsmr_register, |
1219 | volatile u32 *uempr_register, | 1223 | u32 __iomem *uempr_register, |
1220 | volatile u32 *maccfg1_register) | 1224 | u32 __iomem *maccfg1_register) |
1221 | { | 1225 | { |
1222 | u32 value = 0; | 1226 | u32 value = 0; |
1223 | 1227 | ||
@@ -1243,8 +1247,8 @@ int init_flow_control_params(u32 automatic_flow_control_mode, | |||
1243 | 1247 | ||
1244 | static int init_hw_statistics_gathering_mode(int enable_hardware_statistics, | 1248 | static int init_hw_statistics_gathering_mode(int enable_hardware_statistics, |
1245 | int auto_zero_hardware_statistics, | 1249 | int auto_zero_hardware_statistics, |
1246 | volatile u32 *upsmr_register, | 1250 | u32 __iomem *upsmr_register, |
1247 | volatile u16 *uescr_register) | 1251 | u16 __iomem *uescr_register) |
1248 | { | 1252 | { |
1249 | u32 upsmr_value = 0; | 1253 | u32 upsmr_value = 0; |
1250 | u16 uescr_value = 0; | 1254 | u16 uescr_value = 0; |
@@ -1270,12 +1274,12 @@ static int init_hw_statistics_gathering_mode(int enable_hardware_statistics, | |||
1270 | static int init_firmware_statistics_gathering_mode(int | 1274 | static int init_firmware_statistics_gathering_mode(int |
1271 | enable_tx_firmware_statistics, | 1275 | enable_tx_firmware_statistics, |
1272 | int enable_rx_firmware_statistics, | 1276 | int enable_rx_firmware_statistics, |
1273 | volatile u32 *tx_rmon_base_ptr, | 1277 | u32 __iomem *tx_rmon_base_ptr, |
1274 | u32 tx_firmware_statistics_structure_address, | 1278 | u32 tx_firmware_statistics_structure_address, |
1275 | volatile u32 *rx_rmon_base_ptr, | 1279 | u32 __iomem *rx_rmon_base_ptr, |
1276 | u32 rx_firmware_statistics_structure_address, | 1280 | u32 rx_firmware_statistics_structure_address, |
1277 | volatile u16 *temoder_register, | 1281 | u16 __iomem *temoder_register, |
1278 | volatile u32 *remoder_register) | 1282 | u32 __iomem *remoder_register) |
1279 | { | 1283 | { |
1280 | /* Note: this function does not check if */ | 1284 | /* Note: this function does not check if */ |
1281 | /* the parameters it receives are NULL */ | 1285 | /* the parameters it receives are NULL */ |
@@ -1307,8 +1311,8 @@ static int init_mac_station_addr_regs(u8 address_byte_0, | |||
1307 | u8 address_byte_3, | 1311 | u8 address_byte_3, |
1308 | u8 address_byte_4, | 1312 | u8 address_byte_4, |
1309 | u8 address_byte_5, | 1313 | u8 address_byte_5, |
1310 | volatile u32 *macstnaddr1_register, | 1314 | u32 __iomem *macstnaddr1_register, |
1311 | volatile u32 *macstnaddr2_register) | 1315 | u32 __iomem *macstnaddr2_register) |
1312 | { | 1316 | { |
1313 | u32 value = 0; | 1317 | u32 value = 0; |
1314 | 1318 | ||
@@ -1344,7 +1348,7 @@ static int init_mac_station_addr_regs(u8 address_byte_0, | |||
1344 | } | 1348 | } |
1345 | 1349 | ||
1346 | static int init_check_frame_length_mode(int length_check, | 1350 | static int init_check_frame_length_mode(int length_check, |
1347 | volatile u32 *maccfg2_register) | 1351 | u32 __iomem *maccfg2_register) |
1348 | { | 1352 | { |
1349 | u32 value = 0; | 1353 | u32 value = 0; |
1350 | 1354 | ||
@@ -1360,7 +1364,7 @@ static int init_check_frame_length_mode(int length_check, | |||
1360 | } | 1364 | } |
1361 | 1365 | ||
1362 | static int init_preamble_length(u8 preamble_length, | 1366 | static int init_preamble_length(u8 preamble_length, |
1363 | volatile u32 *maccfg2_register) | 1367 | u32 __iomem *maccfg2_register) |
1364 | { | 1368 | { |
1365 | u32 value = 0; | 1369 | u32 value = 0; |
1366 | 1370 | ||
@@ -1376,7 +1380,7 @@ static int init_preamble_length(u8 preamble_length, | |||
1376 | 1380 | ||
1377 | static int init_rx_parameters(int reject_broadcast, | 1381 | static int init_rx_parameters(int reject_broadcast, |
1378 | int receive_short_frames, | 1382 | int receive_short_frames, |
1379 | int promiscuous, volatile u32 *upsmr_register) | 1383 | int promiscuous, u32 __iomem *upsmr_register) |
1380 | { | 1384 | { |
1381 | u32 value = 0; | 1385 | u32 value = 0; |
1382 | 1386 | ||
@@ -1403,7 +1407,7 @@ static int init_rx_parameters(int reject_broadcast, | |||
1403 | } | 1407 | } |
1404 | 1408 | ||
1405 | static int init_max_rx_buff_len(u16 max_rx_buf_len, | 1409 | static int init_max_rx_buff_len(u16 max_rx_buf_len, |
1406 | volatile u16 *mrblr_register) | 1410 | u16 __iomem *mrblr_register) |
1407 | { | 1411 | { |
1408 | /* max_rx_buf_len value must be a multiple of 128 */ | 1412 | /* max_rx_buf_len value must be a multiple of 128 */ |
1409 | if ((max_rx_buf_len == 0) | 1413 | if ((max_rx_buf_len == 0) |
@@ -1415,8 +1419,8 @@ static int init_max_rx_buff_len(u16 max_rx_buf_len, | |||
1415 | } | 1419 | } |
1416 | 1420 | ||
1417 | static int init_min_frame_len(u16 min_frame_length, | 1421 | static int init_min_frame_len(u16 min_frame_length, |
1418 | volatile u16 *minflr_register, | 1422 | u16 __iomem *minflr_register, |
1419 | volatile u16 *mrblr_register) | 1423 | u16 __iomem *mrblr_register) |
1420 | { | 1424 | { |
1421 | u16 mrblr_value = 0; | 1425 | u16 mrblr_value = 0; |
1422 | 1426 | ||
@@ -1431,8 +1435,8 @@ static int init_min_frame_len(u16 min_frame_length, | |||
1431 | static int adjust_enet_interface(struct ucc_geth_private *ugeth) | 1435 | static int adjust_enet_interface(struct ucc_geth_private *ugeth) |
1432 | { | 1436 | { |
1433 | struct ucc_geth_info *ug_info; | 1437 | struct ucc_geth_info *ug_info; |
1434 | struct ucc_geth *ug_regs; | 1438 | struct ucc_geth __iomem *ug_regs; |
1435 | struct ucc_fast *uf_regs; | 1439 | struct ucc_fast __iomem *uf_regs; |
1436 | int ret_val; | 1440 | int ret_val; |
1437 | u32 upsmr, maccfg2, tbiBaseAddress; | 1441 | u32 upsmr, maccfg2, tbiBaseAddress; |
1438 | u16 value; | 1442 | u16 value; |
@@ -1517,8 +1521,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth) | |||
1517 | static void adjust_link(struct net_device *dev) | 1521 | static void adjust_link(struct net_device *dev) |
1518 | { | 1522 | { |
1519 | struct ucc_geth_private *ugeth = netdev_priv(dev); | 1523 | struct ucc_geth_private *ugeth = netdev_priv(dev); |
1520 | struct ucc_geth *ug_regs; | 1524 | struct ucc_geth __iomem *ug_regs; |
1521 | struct ucc_fast *uf_regs; | 1525 | struct ucc_fast __iomem *uf_regs; |
1522 | struct phy_device *phydev = ugeth->phydev; | 1526 | struct phy_device *phydev = ugeth->phydev; |
1523 | unsigned long flags; | 1527 | unsigned long flags; |
1524 | int new_state = 0; | 1528 | int new_state = 0; |
@@ -1678,9 +1682,9 @@ static int ugeth_graceful_stop_rx(struct ucc_geth_private * ugeth) | |||
1678 | uccf = ugeth->uccf; | 1682 | uccf = ugeth->uccf; |
1679 | 1683 | ||
1680 | /* Clear acknowledge bit */ | 1684 | /* Clear acknowledge bit */ |
1681 | temp = ugeth->p_rx_glbl_pram->rxgstpack; | 1685 | temp = in_8(&ugeth->p_rx_glbl_pram->rxgstpack); |
1682 | temp &= ~GRACEFUL_STOP_ACKNOWLEDGE_RX; | 1686 | temp &= ~GRACEFUL_STOP_ACKNOWLEDGE_RX; |
1683 | ugeth->p_rx_glbl_pram->rxgstpack = temp; | 1687 | out_8(&ugeth->p_rx_glbl_pram->rxgstpack, temp); |
1684 | 1688 | ||
1685 | /* Keep issuing command and checking acknowledge bit until | 1689 | /* Keep issuing command and checking acknowledge bit until |
1686 | it is asserted, according to spec */ | 1690 | it is asserted, according to spec */ |
@@ -1692,7 +1696,7 @@ static int ugeth_graceful_stop_rx(struct ucc_geth_private * ugeth) | |||
1692 | qe_issue_cmd(QE_GRACEFUL_STOP_RX, cecr_subblock, | 1696 | qe_issue_cmd(QE_GRACEFUL_STOP_RX, cecr_subblock, |
1693 | QE_CR_PROTOCOL_ETHERNET, 0); | 1697 | QE_CR_PROTOCOL_ETHERNET, 0); |
1694 | 1698 | ||
1695 | temp = ugeth->p_rx_glbl_pram->rxgstpack; | 1699 | temp = in_8(&ugeth->p_rx_glbl_pram->rxgstpack); |
1696 | } while (!(temp & GRACEFUL_STOP_ACKNOWLEDGE_RX)); | 1700 | } while (!(temp & GRACEFUL_STOP_ACKNOWLEDGE_RX)); |
1697 | 1701 | ||
1698 | uccf->stopped_rx = 1; | 1702 | uccf->stopped_rx = 1; |
@@ -1991,19 +1995,20 @@ static int ugeth_82xx_filtering_clear_all_addr_in_hash(struct ucc_geth_private * | |||
1991 | enum enet_addr_type | 1995 | enum enet_addr_type |
1992 | enet_addr_type) | 1996 | enet_addr_type) |
1993 | { | 1997 | { |
1994 | struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt; | 1998 | struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt; |
1995 | struct ucc_fast_private *uccf; | 1999 | struct ucc_fast_private *uccf; |
1996 | enum comm_dir comm_dir; | 2000 | enum comm_dir comm_dir; |
1997 | struct list_head *p_lh; | 2001 | struct list_head *p_lh; |
1998 | u16 i, num; | 2002 | u16 i, num; |
1999 | u32 *addr_h, *addr_l; | 2003 | u32 __iomem *addr_h; |
2004 | u32 __iomem *addr_l; | ||
2000 | u8 *p_counter; | 2005 | u8 *p_counter; |
2001 | 2006 | ||
2002 | uccf = ugeth->uccf; | 2007 | uccf = ugeth->uccf; |
2003 | 2008 | ||
2004 | p_82xx_addr_filt = | 2009 | p_82xx_addr_filt = |
2005 | (struct ucc_geth_82xx_address_filtering_pram *) ugeth->p_rx_glbl_pram-> | 2010 | (struct ucc_geth_82xx_address_filtering_pram __iomem *) |
2006 | addressfiltering; | 2011 | ugeth->p_rx_glbl_pram->addressfiltering; |
2007 | 2012 | ||
2008 | if (enet_addr_type == ENET_ADDR_TYPE_GROUP) { | 2013 | if (enet_addr_type == ENET_ADDR_TYPE_GROUP) { |
2009 | addr_h = &(p_82xx_addr_filt->gaddr_h); | 2014 | addr_h = &(p_82xx_addr_filt->gaddr_h); |
@@ -2079,7 +2084,7 @@ static int ugeth_82xx_filtering_clear_addr_in_paddr(struct ucc_geth_private *uge | |||
2079 | static void ucc_geth_memclean(struct ucc_geth_private *ugeth) | 2084 | static void ucc_geth_memclean(struct ucc_geth_private *ugeth) |
2080 | { | 2085 | { |
2081 | u16 i, j; | 2086 | u16 i, j; |
2082 | u8 *bd; | 2087 | u8 __iomem *bd; |
2083 | 2088 | ||
2084 | if (!ugeth) | 2089 | if (!ugeth) |
2085 | return; | 2090 | return; |
@@ -2154,8 +2159,8 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth) | |||
2154 | for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) { | 2159 | for (j = 0; j < ugeth->ug_info->bdRingLenTx[i]; j++) { |
2155 | if (ugeth->tx_skbuff[i][j]) { | 2160 | if (ugeth->tx_skbuff[i][j]) { |
2156 | dma_unmap_single(NULL, | 2161 | dma_unmap_single(NULL, |
2157 | ((struct qe_bd *)bd)->buf, | 2162 | in_be32(&((struct qe_bd __iomem *)bd)->buf), |
2158 | (in_be32((u32 *)bd) & | 2163 | (in_be32((u32 __iomem *)bd) & |
2159 | BD_LENGTH_MASK), | 2164 | BD_LENGTH_MASK), |
2160 | DMA_TO_DEVICE); | 2165 | DMA_TO_DEVICE); |
2161 | dev_kfree_skb_any(ugeth->tx_skbuff[i][j]); | 2166 | dev_kfree_skb_any(ugeth->tx_skbuff[i][j]); |
@@ -2182,7 +2187,7 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth) | |||
2182 | for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) { | 2187 | for (j = 0; j < ugeth->ug_info->bdRingLenRx[i]; j++) { |
2183 | if (ugeth->rx_skbuff[i][j]) { | 2188 | if (ugeth->rx_skbuff[i][j]) { |
2184 | dma_unmap_single(NULL, | 2189 | dma_unmap_single(NULL, |
2185 | ((struct qe_bd *)bd)->buf, | 2190 | in_be32(&((struct qe_bd __iomem *)bd)->buf), |
2186 | ugeth->ug_info-> | 2191 | ugeth->ug_info-> |
2187 | uf_info.max_rx_buf_length + | 2192 | uf_info.max_rx_buf_length + |
2188 | UCC_GETH_RX_DATA_BUF_ALIGNMENT, | 2193 | UCC_GETH_RX_DATA_BUF_ALIGNMENT, |
@@ -2218,8 +2223,8 @@ static void ucc_geth_set_multi(struct net_device *dev) | |||
2218 | { | 2223 | { |
2219 | struct ucc_geth_private *ugeth; | 2224 | struct ucc_geth_private *ugeth; |
2220 | struct dev_mc_list *dmi; | 2225 | struct dev_mc_list *dmi; |
2221 | struct ucc_fast *uf_regs; | 2226 | struct ucc_fast __iomem *uf_regs; |
2222 | struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt; | 2227 | struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt; |
2223 | int i; | 2228 | int i; |
2224 | 2229 | ||
2225 | ugeth = netdev_priv(dev); | 2230 | ugeth = netdev_priv(dev); |
@@ -2228,14 +2233,14 @@ static void ucc_geth_set_multi(struct net_device *dev) | |||
2228 | 2233 | ||
2229 | if (dev->flags & IFF_PROMISC) { | 2234 | if (dev->flags & IFF_PROMISC) { |
2230 | 2235 | ||
2231 | uf_regs->upsmr |= UPSMR_PRO; | 2236 | out_be32(&uf_regs->upsmr, in_be32(&uf_regs->upsmr) | UPSMR_PRO); |
2232 | 2237 | ||
2233 | } else { | 2238 | } else { |
2234 | 2239 | ||
2235 | uf_regs->upsmr &= ~UPSMR_PRO; | 2240 | out_be32(&uf_regs->upsmr, in_be32(&uf_regs->upsmr)&~UPSMR_PRO); |
2236 | 2241 | ||
2237 | p_82xx_addr_filt = | 2242 | p_82xx_addr_filt = |
2238 | (struct ucc_geth_82xx_address_filtering_pram *) ugeth-> | 2243 | (struct ucc_geth_82xx_address_filtering_pram __iomem *) ugeth-> |
2239 | p_rx_glbl_pram->addressfiltering; | 2244 | p_rx_glbl_pram->addressfiltering; |
2240 | 2245 | ||
2241 | if (dev->flags & IFF_ALLMULTI) { | 2246 | if (dev->flags & IFF_ALLMULTI) { |
@@ -2270,7 +2275,7 @@ static void ucc_geth_set_multi(struct net_device *dev) | |||
2270 | 2275 | ||
2271 | static void ucc_geth_stop(struct ucc_geth_private *ugeth) | 2276 | static void ucc_geth_stop(struct ucc_geth_private *ugeth) |
2272 | { | 2277 | { |
2273 | struct ucc_geth *ug_regs = ugeth->ug_regs; | 2278 | struct ucc_geth __iomem *ug_regs = ugeth->ug_regs; |
2274 | struct phy_device *phydev = ugeth->phydev; | 2279 | struct phy_device *phydev = ugeth->phydev; |
2275 | u32 tempval; | 2280 | u32 tempval; |
2276 | 2281 | ||
@@ -2419,20 +2424,20 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) | |||
2419 | return -ENOMEM; | 2424 | return -ENOMEM; |
2420 | } | 2425 | } |
2421 | 2426 | ||
2422 | ugeth->ug_regs = (struct ucc_geth *) ioremap(uf_info->regs, sizeof(struct ucc_geth)); | 2427 | ugeth->ug_regs = (struct ucc_geth __iomem *) ioremap(uf_info->regs, sizeof(struct ucc_geth)); |
2423 | 2428 | ||
2424 | return 0; | 2429 | return 0; |
2425 | } | 2430 | } |
2426 | 2431 | ||
2427 | static int ucc_geth_startup(struct ucc_geth_private *ugeth) | 2432 | static int ucc_geth_startup(struct ucc_geth_private *ugeth) |
2428 | { | 2433 | { |
2429 | struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt; | 2434 | struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt; |
2430 | struct ucc_geth_init_pram *p_init_enet_pram; | 2435 | struct ucc_geth_init_pram __iomem *p_init_enet_pram; |
2431 | struct ucc_fast_private *uccf; | 2436 | struct ucc_fast_private *uccf; |
2432 | struct ucc_geth_info *ug_info; | 2437 | struct ucc_geth_info *ug_info; |
2433 | struct ucc_fast_info *uf_info; | 2438 | struct ucc_fast_info *uf_info; |
2434 | struct ucc_fast *uf_regs; | 2439 | struct ucc_fast __iomem *uf_regs; |
2435 | struct ucc_geth *ug_regs; | 2440 | struct ucc_geth __iomem *ug_regs; |
2436 | int ret_val = -EINVAL; | 2441 | int ret_val = -EINVAL; |
2437 | u32 remoder = UCC_GETH_REMODER_INIT; | 2442 | u32 remoder = UCC_GETH_REMODER_INIT; |
2438 | u32 init_enet_pram_offset, cecr_subblock, command, maccfg1; | 2443 | u32 init_enet_pram_offset, cecr_subblock, command, maccfg1; |
@@ -2440,7 +2445,8 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2440 | u16 temoder = UCC_GETH_TEMODER_INIT; | 2445 | u16 temoder = UCC_GETH_TEMODER_INIT; |
2441 | u16 test; | 2446 | u16 test; |
2442 | u8 function_code = 0; | 2447 | u8 function_code = 0; |
2443 | u8 *bd, *endOfRing; | 2448 | u8 __iomem *bd; |
2449 | u8 __iomem *endOfRing; | ||
2444 | u8 numThreadsRxNumerical, numThreadsTxNumerical; | 2450 | u8 numThreadsRxNumerical, numThreadsTxNumerical; |
2445 | 2451 | ||
2446 | ugeth_vdbg("%s: IN", __FUNCTION__); | 2452 | ugeth_vdbg("%s: IN", __FUNCTION__); |
@@ -2602,11 +2608,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2602 | if (UCC_GETH_TX_BD_RING_ALIGNMENT > 4) | 2608 | if (UCC_GETH_TX_BD_RING_ALIGNMENT > 4) |
2603 | align = UCC_GETH_TX_BD_RING_ALIGNMENT; | 2609 | align = UCC_GETH_TX_BD_RING_ALIGNMENT; |
2604 | ugeth->tx_bd_ring_offset[j] = | 2610 | ugeth->tx_bd_ring_offset[j] = |
2605 | kmalloc((u32) (length + align), GFP_KERNEL); | 2611 | (u32) kmalloc((u32) (length + align), GFP_KERNEL); |
2606 | 2612 | ||
2607 | if (ugeth->tx_bd_ring_offset[j] != 0) | 2613 | if (ugeth->tx_bd_ring_offset[j] != 0) |
2608 | ugeth->p_tx_bd_ring[j] = | 2614 | ugeth->p_tx_bd_ring[j] = |
2609 | (void*)((ugeth->tx_bd_ring_offset[j] + | 2615 | (u8 __iomem *)((ugeth->tx_bd_ring_offset[j] + |
2610 | align) & ~(align - 1)); | 2616 | align) & ~(align - 1)); |
2611 | } else if (uf_info->bd_mem_part == MEM_PART_MURAM) { | 2617 | } else if (uf_info->bd_mem_part == MEM_PART_MURAM) { |
2612 | ugeth->tx_bd_ring_offset[j] = | 2618 | ugeth->tx_bd_ring_offset[j] = |
@@ -2614,7 +2620,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2614 | UCC_GETH_TX_BD_RING_ALIGNMENT); | 2620 | UCC_GETH_TX_BD_RING_ALIGNMENT); |
2615 | if (!IS_ERR_VALUE(ugeth->tx_bd_ring_offset[j])) | 2621 | if (!IS_ERR_VALUE(ugeth->tx_bd_ring_offset[j])) |
2616 | ugeth->p_tx_bd_ring[j] = | 2622 | ugeth->p_tx_bd_ring[j] = |
2617 | (u8 *) qe_muram_addr(ugeth-> | 2623 | (u8 __iomem *) qe_muram_addr(ugeth-> |
2618 | tx_bd_ring_offset[j]); | 2624 | tx_bd_ring_offset[j]); |
2619 | } | 2625 | } |
2620 | if (!ugeth->p_tx_bd_ring[j]) { | 2626 | if (!ugeth->p_tx_bd_ring[j]) { |
@@ -2626,8 +2632,8 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2626 | return -ENOMEM; | 2632 | return -ENOMEM; |
2627 | } | 2633 | } |
2628 | /* Zero unused end of bd ring, according to spec */ | 2634 | /* Zero unused end of bd ring, according to spec */ |
2629 | memset(ugeth->p_tx_bd_ring[j] + | 2635 | memset_io((void __iomem *)(ugeth->p_tx_bd_ring[j] + |
2630 | ug_info->bdRingLenTx[j] * sizeof(struct qe_bd), 0, | 2636 | ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)), 0, |
2631 | length - ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)); | 2637 | length - ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)); |
2632 | } | 2638 | } |
2633 | 2639 | ||
@@ -2639,10 +2645,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2639 | if (UCC_GETH_RX_BD_RING_ALIGNMENT > 4) | 2645 | if (UCC_GETH_RX_BD_RING_ALIGNMENT > 4) |
2640 | align = UCC_GETH_RX_BD_RING_ALIGNMENT; | 2646 | align = UCC_GETH_RX_BD_RING_ALIGNMENT; |
2641 | ugeth->rx_bd_ring_offset[j] = | 2647 | ugeth->rx_bd_ring_offset[j] = |
2642 | kmalloc((u32) (length + align), GFP_KERNEL); | 2648 | (u32) kmalloc((u32) (length + align), GFP_KERNEL); |
2643 | if (ugeth->rx_bd_ring_offset[j] != 0) | 2649 | if (ugeth->rx_bd_ring_offset[j] != 0) |
2644 | ugeth->p_rx_bd_ring[j] = | 2650 | ugeth->p_rx_bd_ring[j] = |
2645 | (void*)((ugeth->rx_bd_ring_offset[j] + | 2651 | (u8 __iomem *)((ugeth->rx_bd_ring_offset[j] + |
2646 | align) & ~(align - 1)); | 2652 | align) & ~(align - 1)); |
2647 | } else if (uf_info->bd_mem_part == MEM_PART_MURAM) { | 2653 | } else if (uf_info->bd_mem_part == MEM_PART_MURAM) { |
2648 | ugeth->rx_bd_ring_offset[j] = | 2654 | ugeth->rx_bd_ring_offset[j] = |
@@ -2650,7 +2656,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2650 | UCC_GETH_RX_BD_RING_ALIGNMENT); | 2656 | UCC_GETH_RX_BD_RING_ALIGNMENT); |
2651 | if (!IS_ERR_VALUE(ugeth->rx_bd_ring_offset[j])) | 2657 | if (!IS_ERR_VALUE(ugeth->rx_bd_ring_offset[j])) |
2652 | ugeth->p_rx_bd_ring[j] = | 2658 | ugeth->p_rx_bd_ring[j] = |
2653 | (u8 *) qe_muram_addr(ugeth-> | 2659 | (u8 __iomem *) qe_muram_addr(ugeth-> |
2654 | rx_bd_ring_offset[j]); | 2660 | rx_bd_ring_offset[j]); |
2655 | } | 2661 | } |
2656 | if (!ugeth->p_rx_bd_ring[j]) { | 2662 | if (!ugeth->p_rx_bd_ring[j]) { |
@@ -2685,14 +2691,14 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2685 | bd = ugeth->confBd[j] = ugeth->txBd[j] = ugeth->p_tx_bd_ring[j]; | 2691 | bd = ugeth->confBd[j] = ugeth->txBd[j] = ugeth->p_tx_bd_ring[j]; |
2686 | for (i = 0; i < ug_info->bdRingLenTx[j]; i++) { | 2692 | for (i = 0; i < ug_info->bdRingLenTx[j]; i++) { |
2687 | /* clear bd buffer */ | 2693 | /* clear bd buffer */ |
2688 | out_be32(&((struct qe_bd *)bd)->buf, 0); | 2694 | out_be32(&((struct qe_bd __iomem *)bd)->buf, 0); |
2689 | /* set bd status and length */ | 2695 | /* set bd status and length */ |
2690 | out_be32((u32 *)bd, 0); | 2696 | out_be32((u32 __iomem *)bd, 0); |
2691 | bd += sizeof(struct qe_bd); | 2697 | bd += sizeof(struct qe_bd); |
2692 | } | 2698 | } |
2693 | bd -= sizeof(struct qe_bd); | 2699 | bd -= sizeof(struct qe_bd); |
2694 | /* set bd status and length */ | 2700 | /* set bd status and length */ |
2695 | out_be32((u32 *)bd, T_W); /* for last BD set Wrap bit */ | 2701 | out_be32((u32 __iomem *)bd, T_W); /* for last BD set Wrap bit */ |
2696 | } | 2702 | } |
2697 | 2703 | ||
2698 | /* Init Rx bds */ | 2704 | /* Init Rx bds */ |
@@ -2717,14 +2723,14 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2717 | bd = ugeth->rxBd[j] = ugeth->p_rx_bd_ring[j]; | 2723 | bd = ugeth->rxBd[j] = ugeth->p_rx_bd_ring[j]; |
2718 | for (i = 0; i < ug_info->bdRingLenRx[j]; i++) { | 2724 | for (i = 0; i < ug_info->bdRingLenRx[j]; i++) { |
2719 | /* set bd status and length */ | 2725 | /* set bd status and length */ |
2720 | out_be32((u32 *)bd, R_I); | 2726 | out_be32((u32 __iomem *)bd, R_I); |
2721 | /* clear bd buffer */ | 2727 | /* clear bd buffer */ |
2722 | out_be32(&((struct qe_bd *)bd)->buf, 0); | 2728 | out_be32(&((struct qe_bd __iomem *)bd)->buf, 0); |
2723 | bd += sizeof(struct qe_bd); | 2729 | bd += sizeof(struct qe_bd); |
2724 | } | 2730 | } |
2725 | bd -= sizeof(struct qe_bd); | 2731 | bd -= sizeof(struct qe_bd); |
2726 | /* set bd status and length */ | 2732 | /* set bd status and length */ |
2727 | out_be32((u32 *)bd, R_W); /* for last BD set Wrap bit */ | 2733 | out_be32((u32 __iomem *)bd, R_W); /* for last BD set Wrap bit */ |
2728 | } | 2734 | } |
2729 | 2735 | ||
2730 | /* | 2736 | /* |
@@ -2744,10 +2750,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2744 | return -ENOMEM; | 2750 | return -ENOMEM; |
2745 | } | 2751 | } |
2746 | ugeth->p_tx_glbl_pram = | 2752 | ugeth->p_tx_glbl_pram = |
2747 | (struct ucc_geth_tx_global_pram *) qe_muram_addr(ugeth-> | 2753 | (struct ucc_geth_tx_global_pram __iomem *) qe_muram_addr(ugeth-> |
2748 | tx_glbl_pram_offset); | 2754 | tx_glbl_pram_offset); |
2749 | /* Zero out p_tx_glbl_pram */ | 2755 | /* Zero out p_tx_glbl_pram */ |
2750 | memset(ugeth->p_tx_glbl_pram, 0, sizeof(struct ucc_geth_tx_global_pram)); | 2756 | memset_io((void __iomem *)ugeth->p_tx_glbl_pram, 0, sizeof(struct ucc_geth_tx_global_pram)); |
2751 | 2757 | ||
2752 | /* Fill global PRAM */ | 2758 | /* Fill global PRAM */ |
2753 | 2759 | ||
@@ -2768,7 +2774,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2768 | } | 2774 | } |
2769 | 2775 | ||
2770 | ugeth->p_thread_data_tx = | 2776 | ugeth->p_thread_data_tx = |
2771 | (struct ucc_geth_thread_data_tx *) qe_muram_addr(ugeth-> | 2777 | (struct ucc_geth_thread_data_tx __iomem *) qe_muram_addr(ugeth-> |
2772 | thread_dat_tx_offset); | 2778 | thread_dat_tx_offset); |
2773 | out_be32(&ugeth->p_tx_glbl_pram->tqptr, ugeth->thread_dat_tx_offset); | 2779 | out_be32(&ugeth->p_tx_glbl_pram->tqptr, ugeth->thread_dat_tx_offset); |
2774 | 2780 | ||
@@ -2779,7 +2785,8 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2779 | 2785 | ||
2780 | /* iphoffset */ | 2786 | /* iphoffset */ |
2781 | for (i = 0; i < TX_IP_OFFSET_ENTRY_MAX; i++) | 2787 | for (i = 0; i < TX_IP_OFFSET_ENTRY_MAX; i++) |
2782 | ugeth->p_tx_glbl_pram->iphoffset[i] = ug_info->iphoffset[i]; | 2788 | out_8(&ugeth->p_tx_glbl_pram->iphoffset[i], |
2789 | ug_info->iphoffset[i]); | ||
2783 | 2790 | ||
2784 | /* SQPTR */ | 2791 | /* SQPTR */ |
2785 | /* Size varies with number of Tx queues */ | 2792 | /* Size varies with number of Tx queues */ |
@@ -2797,7 +2804,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2797 | } | 2804 | } |
2798 | 2805 | ||
2799 | ugeth->p_send_q_mem_reg = | 2806 | ugeth->p_send_q_mem_reg = |
2800 | (struct ucc_geth_send_queue_mem_region *) qe_muram_addr(ugeth-> | 2807 | (struct ucc_geth_send_queue_mem_region __iomem *) qe_muram_addr(ugeth-> |
2801 | send_q_mem_reg_offset); | 2808 | send_q_mem_reg_offset); |
2802 | out_be32(&ugeth->p_tx_glbl_pram->sqptr, ugeth->send_q_mem_reg_offset); | 2809 | out_be32(&ugeth->p_tx_glbl_pram->sqptr, ugeth->send_q_mem_reg_offset); |
2803 | 2810 | ||
@@ -2841,25 +2848,26 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2841 | } | 2848 | } |
2842 | 2849 | ||
2843 | ugeth->p_scheduler = | 2850 | ugeth->p_scheduler = |
2844 | (struct ucc_geth_scheduler *) qe_muram_addr(ugeth-> | 2851 | (struct ucc_geth_scheduler __iomem *) qe_muram_addr(ugeth-> |
2845 | scheduler_offset); | 2852 | scheduler_offset); |
2846 | out_be32(&ugeth->p_tx_glbl_pram->schedulerbasepointer, | 2853 | out_be32(&ugeth->p_tx_glbl_pram->schedulerbasepointer, |
2847 | ugeth->scheduler_offset); | 2854 | ugeth->scheduler_offset); |
2848 | /* Zero out p_scheduler */ | 2855 | /* Zero out p_scheduler */ |
2849 | memset(ugeth->p_scheduler, 0, sizeof(struct ucc_geth_scheduler)); | 2856 | memset_io((void __iomem *)ugeth->p_scheduler, 0, sizeof(struct ucc_geth_scheduler)); |
2850 | 2857 | ||
2851 | /* Set values in scheduler */ | 2858 | /* Set values in scheduler */ |
2852 | out_be32(&ugeth->p_scheduler->mblinterval, | 2859 | out_be32(&ugeth->p_scheduler->mblinterval, |
2853 | ug_info->mblinterval); | 2860 | ug_info->mblinterval); |
2854 | out_be16(&ugeth->p_scheduler->nortsrbytetime, | 2861 | out_be16(&ugeth->p_scheduler->nortsrbytetime, |
2855 | ug_info->nortsrbytetime); | 2862 | ug_info->nortsrbytetime); |
2856 | ugeth->p_scheduler->fracsiz = ug_info->fracsiz; | 2863 | out_8(&ugeth->p_scheduler->fracsiz, ug_info->fracsiz); |
2857 | ugeth->p_scheduler->strictpriorityq = ug_info->strictpriorityq; | 2864 | out_8(&ugeth->p_scheduler->strictpriorityq, |
2858 | ugeth->p_scheduler->txasap = ug_info->txasap; | 2865 | ug_info->strictpriorityq); |
2859 | ugeth->p_scheduler->extrabw = ug_info->extrabw; | 2866 | out_8(&ugeth->p_scheduler->txasap, ug_info->txasap); |
2867 | out_8(&ugeth->p_scheduler->extrabw, ug_info->extrabw); | ||
2860 | for (i = 0; i < NUM_TX_QUEUES; i++) | 2868 | for (i = 0; i < NUM_TX_QUEUES; i++) |
2861 | ugeth->p_scheduler->weightfactor[i] = | 2869 | out_8(&ugeth->p_scheduler->weightfactor[i], |
2862 | ug_info->weightfactor[i]; | 2870 | ug_info->weightfactor[i]); |
2863 | 2871 | ||
2864 | /* Set pointers to cpucount registers in scheduler */ | 2872 | /* Set pointers to cpucount registers in scheduler */ |
2865 | ugeth->p_cpucount[0] = &(ugeth->p_scheduler->cpucount0); | 2873 | ugeth->p_cpucount[0] = &(ugeth->p_scheduler->cpucount0); |
@@ -2890,10 +2898,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2890 | return -ENOMEM; | 2898 | return -ENOMEM; |
2891 | } | 2899 | } |
2892 | ugeth->p_tx_fw_statistics_pram = | 2900 | ugeth->p_tx_fw_statistics_pram = |
2893 | (struct ucc_geth_tx_firmware_statistics_pram *) | 2901 | (struct ucc_geth_tx_firmware_statistics_pram __iomem *) |
2894 | qe_muram_addr(ugeth->tx_fw_statistics_pram_offset); | 2902 | qe_muram_addr(ugeth->tx_fw_statistics_pram_offset); |
2895 | /* Zero out p_tx_fw_statistics_pram */ | 2903 | /* Zero out p_tx_fw_statistics_pram */ |
2896 | memset(ugeth->p_tx_fw_statistics_pram, | 2904 | memset_io((void __iomem *)ugeth->p_tx_fw_statistics_pram, |
2897 | 0, sizeof(struct ucc_geth_tx_firmware_statistics_pram)); | 2905 | 0, sizeof(struct ucc_geth_tx_firmware_statistics_pram)); |
2898 | } | 2906 | } |
2899 | 2907 | ||
@@ -2930,10 +2938,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2930 | return -ENOMEM; | 2938 | return -ENOMEM; |
2931 | } | 2939 | } |
2932 | ugeth->p_rx_glbl_pram = | 2940 | ugeth->p_rx_glbl_pram = |
2933 | (struct ucc_geth_rx_global_pram *) qe_muram_addr(ugeth-> | 2941 | (struct ucc_geth_rx_global_pram __iomem *) qe_muram_addr(ugeth-> |
2934 | rx_glbl_pram_offset); | 2942 | rx_glbl_pram_offset); |
2935 | /* Zero out p_rx_glbl_pram */ | 2943 | /* Zero out p_rx_glbl_pram */ |
2936 | memset(ugeth->p_rx_glbl_pram, 0, sizeof(struct ucc_geth_rx_global_pram)); | 2944 | memset_io((void __iomem *)ugeth->p_rx_glbl_pram, 0, sizeof(struct ucc_geth_rx_global_pram)); |
2937 | 2945 | ||
2938 | /* Fill global PRAM */ | 2946 | /* Fill global PRAM */ |
2939 | 2947 | ||
@@ -2953,7 +2961,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2953 | } | 2961 | } |
2954 | 2962 | ||
2955 | ugeth->p_thread_data_rx = | 2963 | ugeth->p_thread_data_rx = |
2956 | (struct ucc_geth_thread_data_rx *) qe_muram_addr(ugeth-> | 2964 | (struct ucc_geth_thread_data_rx __iomem *) qe_muram_addr(ugeth-> |
2957 | thread_dat_rx_offset); | 2965 | thread_dat_rx_offset); |
2958 | out_be32(&ugeth->p_rx_glbl_pram->rqptr, ugeth->thread_dat_rx_offset); | 2966 | out_be32(&ugeth->p_rx_glbl_pram->rqptr, ugeth->thread_dat_rx_offset); |
2959 | 2967 | ||
@@ -2976,10 +2984,10 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2976 | return -ENOMEM; | 2984 | return -ENOMEM; |
2977 | } | 2985 | } |
2978 | ugeth->p_rx_fw_statistics_pram = | 2986 | ugeth->p_rx_fw_statistics_pram = |
2979 | (struct ucc_geth_rx_firmware_statistics_pram *) | 2987 | (struct ucc_geth_rx_firmware_statistics_pram __iomem *) |
2980 | qe_muram_addr(ugeth->rx_fw_statistics_pram_offset); | 2988 | qe_muram_addr(ugeth->rx_fw_statistics_pram_offset); |
2981 | /* Zero out p_rx_fw_statistics_pram */ | 2989 | /* Zero out p_rx_fw_statistics_pram */ |
2982 | memset(ugeth->p_rx_fw_statistics_pram, 0, | 2990 | memset_io((void __iomem *)ugeth->p_rx_fw_statistics_pram, 0, |
2983 | sizeof(struct ucc_geth_rx_firmware_statistics_pram)); | 2991 | sizeof(struct ucc_geth_rx_firmware_statistics_pram)); |
2984 | } | 2992 | } |
2985 | 2993 | ||
@@ -3000,7 +3008,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3000 | } | 3008 | } |
3001 | 3009 | ||
3002 | ugeth->p_rx_irq_coalescing_tbl = | 3010 | ugeth->p_rx_irq_coalescing_tbl = |
3003 | (struct ucc_geth_rx_interrupt_coalescing_table *) | 3011 | (struct ucc_geth_rx_interrupt_coalescing_table __iomem *) |
3004 | qe_muram_addr(ugeth->rx_irq_coalescing_tbl_offset); | 3012 | qe_muram_addr(ugeth->rx_irq_coalescing_tbl_offset); |
3005 | out_be32(&ugeth->p_rx_glbl_pram->intcoalescingptr, | 3013 | out_be32(&ugeth->p_rx_glbl_pram->intcoalescingptr, |
3006 | ugeth->rx_irq_coalescing_tbl_offset); | 3014 | ugeth->rx_irq_coalescing_tbl_offset); |
@@ -3069,11 +3077,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3069 | } | 3077 | } |
3070 | 3078 | ||
3071 | ugeth->p_rx_bd_qs_tbl = | 3079 | ugeth->p_rx_bd_qs_tbl = |
3072 | (struct ucc_geth_rx_bd_queues_entry *) qe_muram_addr(ugeth-> | 3080 | (struct ucc_geth_rx_bd_queues_entry __iomem *) qe_muram_addr(ugeth-> |
3073 | rx_bd_qs_tbl_offset); | 3081 | rx_bd_qs_tbl_offset); |
3074 | out_be32(&ugeth->p_rx_glbl_pram->rbdqptr, ugeth->rx_bd_qs_tbl_offset); | 3082 | out_be32(&ugeth->p_rx_glbl_pram->rbdqptr, ugeth->rx_bd_qs_tbl_offset); |
3075 | /* Zero out p_rx_bd_qs_tbl */ | 3083 | /* Zero out p_rx_bd_qs_tbl */ |
3076 | memset(ugeth->p_rx_bd_qs_tbl, | 3084 | memset_io((void __iomem *)ugeth->p_rx_bd_qs_tbl, |
3077 | 0, | 3085 | 0, |
3078 | ug_info->numQueuesRx * (sizeof(struct ucc_geth_rx_bd_queues_entry) + | 3086 | ug_info->numQueuesRx * (sizeof(struct ucc_geth_rx_bd_queues_entry) + |
3079 | sizeof(struct ucc_geth_rx_prefetched_bds))); | 3087 | sizeof(struct ucc_geth_rx_prefetched_bds))); |
@@ -3133,7 +3141,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3133 | &ugeth->p_rx_glbl_pram->remoder); | 3141 | &ugeth->p_rx_glbl_pram->remoder); |
3134 | 3142 | ||
3135 | /* function code register */ | 3143 | /* function code register */ |
3136 | ugeth->p_rx_glbl_pram->rstate = function_code; | 3144 | out_8(&ugeth->p_rx_glbl_pram->rstate, function_code); |
3137 | 3145 | ||
3138 | /* initialize extended filtering */ | 3146 | /* initialize extended filtering */ |
3139 | if (ug_info->rxExtendedFiltering) { | 3147 | if (ug_info->rxExtendedFiltering) { |
@@ -3160,7 +3168,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3160 | } | 3168 | } |
3161 | 3169 | ||
3162 | ugeth->p_exf_glbl_param = | 3170 | ugeth->p_exf_glbl_param = |
3163 | (struct ucc_geth_exf_global_pram *) qe_muram_addr(ugeth-> | 3171 | (struct ucc_geth_exf_global_pram __iomem *) qe_muram_addr(ugeth-> |
3164 | exf_glbl_param_offset); | 3172 | exf_glbl_param_offset); |
3165 | out_be32(&ugeth->p_rx_glbl_pram->exfGlobalParam, | 3173 | out_be32(&ugeth->p_rx_glbl_pram->exfGlobalParam, |
3166 | ugeth->exf_glbl_param_offset); | 3174 | ugeth->exf_glbl_param_offset); |
@@ -3175,7 +3183,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3175 | ugeth_82xx_filtering_clear_addr_in_paddr(ugeth, (u8) j); | 3183 | ugeth_82xx_filtering_clear_addr_in_paddr(ugeth, (u8) j); |
3176 | 3184 | ||
3177 | p_82xx_addr_filt = | 3185 | p_82xx_addr_filt = |
3178 | (struct ucc_geth_82xx_address_filtering_pram *) ugeth-> | 3186 | (struct ucc_geth_82xx_address_filtering_pram __iomem *) ugeth-> |
3179 | p_rx_glbl_pram->addressfiltering; | 3187 | p_rx_glbl_pram->addressfiltering; |
3180 | 3188 | ||
3181 | ugeth_82xx_filtering_clear_all_addr_in_hash(ugeth, | 3189 | ugeth_82xx_filtering_clear_all_addr_in_hash(ugeth, |
@@ -3307,17 +3315,21 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3307 | return -ENOMEM; | 3315 | return -ENOMEM; |
3308 | } | 3316 | } |
3309 | p_init_enet_pram = | 3317 | p_init_enet_pram = |
3310 | (struct ucc_geth_init_pram *) qe_muram_addr(init_enet_pram_offset); | 3318 | (struct ucc_geth_init_pram __iomem *) qe_muram_addr(init_enet_pram_offset); |
3311 | 3319 | ||
3312 | /* Copy shadow InitEnet command parameter structure into PRAM */ | 3320 | /* Copy shadow InitEnet command parameter structure into PRAM */ |
3313 | p_init_enet_pram->resinit1 = ugeth->p_init_enet_param_shadow->resinit1; | 3321 | out_8(&p_init_enet_pram->resinit1, |
3314 | p_init_enet_pram->resinit2 = ugeth->p_init_enet_param_shadow->resinit2; | 3322 | ugeth->p_init_enet_param_shadow->resinit1); |
3315 | p_init_enet_pram->resinit3 = ugeth->p_init_enet_param_shadow->resinit3; | 3323 | out_8(&p_init_enet_pram->resinit2, |
3316 | p_init_enet_pram->resinit4 = ugeth->p_init_enet_param_shadow->resinit4; | 3324 | ugeth->p_init_enet_param_shadow->resinit2); |
3325 | out_8(&p_init_enet_pram->resinit3, | ||
3326 | ugeth->p_init_enet_param_shadow->resinit3); | ||
3327 | out_8(&p_init_enet_pram->resinit4, | ||
3328 | ugeth->p_init_enet_param_shadow->resinit4); | ||
3317 | out_be16(&p_init_enet_pram->resinit5, | 3329 | out_be16(&p_init_enet_pram->resinit5, |
3318 | ugeth->p_init_enet_param_shadow->resinit5); | 3330 | ugeth->p_init_enet_param_shadow->resinit5); |
3319 | p_init_enet_pram->largestexternallookupkeysize = | 3331 | out_8(&p_init_enet_pram->largestexternallookupkeysize, |
3320 | ugeth->p_init_enet_param_shadow->largestexternallookupkeysize; | 3332 | ugeth->p_init_enet_param_shadow->largestexternallookupkeysize); |
3321 | out_be32(&p_init_enet_pram->rgftgfrxglobal, | 3333 | out_be32(&p_init_enet_pram->rgftgfrxglobal, |
3322 | ugeth->p_init_enet_param_shadow->rgftgfrxglobal); | 3334 | ugeth->p_init_enet_param_shadow->rgftgfrxglobal); |
3323 | for (i = 0; i < ENET_INIT_PARAM_MAX_ENTRIES_RX; i++) | 3335 | for (i = 0; i < ENET_INIT_PARAM_MAX_ENTRIES_RX; i++) |
@@ -3371,7 +3383,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3371 | #ifdef CONFIG_UGETH_TX_ON_DEMAND | 3383 | #ifdef CONFIG_UGETH_TX_ON_DEMAND |
3372 | struct ucc_fast_private *uccf; | 3384 | struct ucc_fast_private *uccf; |
3373 | #endif | 3385 | #endif |
3374 | u8 *bd; /* BD pointer */ | 3386 | u8 __iomem *bd; /* BD pointer */ |
3375 | u32 bd_status; | 3387 | u32 bd_status; |
3376 | u8 txQ = 0; | 3388 | u8 txQ = 0; |
3377 | 3389 | ||
@@ -3383,7 +3395,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3383 | 3395 | ||
3384 | /* Start from the next BD that should be filled */ | 3396 | /* Start from the next BD that should be filled */ |
3385 | bd = ugeth->txBd[txQ]; | 3397 | bd = ugeth->txBd[txQ]; |
3386 | bd_status = in_be32((u32 *)bd); | 3398 | bd_status = in_be32((u32 __iomem *)bd); |
3387 | /* Save the skb pointer so we can free it later */ | 3399 | /* Save the skb pointer so we can free it later */ |
3388 | ugeth->tx_skbuff[txQ][ugeth->skb_curtx[txQ]] = skb; | 3400 | ugeth->tx_skbuff[txQ][ugeth->skb_curtx[txQ]] = skb; |
3389 | 3401 | ||
@@ -3393,7 +3405,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3393 | 1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]); | 3405 | 1) & TX_RING_MOD_MASK(ugeth->ug_info->bdRingLenTx[txQ]); |
3394 | 3406 | ||
3395 | /* set up the buffer descriptor */ | 3407 | /* set up the buffer descriptor */ |
3396 | out_be32(&((struct qe_bd *)bd)->buf, | 3408 | out_be32(&((struct qe_bd __iomem *)bd)->buf, |
3397 | dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE)); | 3409 | dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE)); |
3398 | 3410 | ||
3399 | /* printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); */ | 3411 | /* printk(KERN_DEBUG"skb->data is 0x%x\n",skb->data); */ |
@@ -3401,7 +3413,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3401 | bd_status = (bd_status & T_W) | T_R | T_I | T_L | skb->len; | 3413 | bd_status = (bd_status & T_W) | T_R | T_I | T_L | skb->len; |
3402 | 3414 | ||
3403 | /* set bd status and length */ | 3415 | /* set bd status and length */ |
3404 | out_be32((u32 *)bd, bd_status); | 3416 | out_be32((u32 __iomem *)bd, bd_status); |
3405 | 3417 | ||
3406 | dev->trans_start = jiffies; | 3418 | dev->trans_start = jiffies; |
3407 | 3419 | ||
@@ -3441,7 +3453,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3441 | static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit) | 3453 | static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit) |
3442 | { | 3454 | { |
3443 | struct sk_buff *skb; | 3455 | struct sk_buff *skb; |
3444 | u8 *bd; | 3456 | u8 __iomem *bd; |
3445 | u16 length, howmany = 0; | 3457 | u16 length, howmany = 0; |
3446 | u32 bd_status; | 3458 | u32 bd_status; |
3447 | u8 *bdBuffer; | 3459 | u8 *bdBuffer; |
@@ -3454,11 +3466,11 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit | |||
3454 | /* collect received buffers */ | 3466 | /* collect received buffers */ |
3455 | bd = ugeth->rxBd[rxQ]; | 3467 | bd = ugeth->rxBd[rxQ]; |
3456 | 3468 | ||
3457 | bd_status = in_be32((u32 *)bd); | 3469 | bd_status = in_be32((u32 __iomem *)bd); |
3458 | 3470 | ||
3459 | /* while there are received buffers and BD is full (~R_E) */ | 3471 | /* while there are received buffers and BD is full (~R_E) */ |
3460 | while (!((bd_status & (R_E)) || (--rx_work_limit < 0))) { | 3472 | while (!((bd_status & (R_E)) || (--rx_work_limit < 0))) { |
3461 | bdBuffer = (u8 *) in_be32(&((struct qe_bd *)bd)->buf); | 3473 | bdBuffer = (u8 *) in_be32(&((struct qe_bd __iomem *)bd)->buf); |
3462 | length = (u16) ((bd_status & BD_LENGTH_MASK) - 4); | 3474 | length = (u16) ((bd_status & BD_LENGTH_MASK) - 4); |
3463 | skb = ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]]; | 3475 | skb = ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]]; |
3464 | 3476 | ||
@@ -3516,7 +3528,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit | |||
3516 | else | 3528 | else |
3517 | bd += sizeof(struct qe_bd); | 3529 | bd += sizeof(struct qe_bd); |
3518 | 3530 | ||
3519 | bd_status = in_be32((u32 *)bd); | 3531 | bd_status = in_be32((u32 __iomem *)bd); |
3520 | } | 3532 | } |
3521 | 3533 | ||
3522 | ugeth->rxBd[rxQ] = bd; | 3534 | ugeth->rxBd[rxQ] = bd; |
@@ -3527,11 +3539,11 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ) | |||
3527 | { | 3539 | { |
3528 | /* Start from the next BD that should be filled */ | 3540 | /* Start from the next BD that should be filled */ |
3529 | struct ucc_geth_private *ugeth = netdev_priv(dev); | 3541 | struct ucc_geth_private *ugeth = netdev_priv(dev); |
3530 | u8 *bd; /* BD pointer */ | 3542 | u8 __iomem *bd; /* BD pointer */ |
3531 | u32 bd_status; | 3543 | u32 bd_status; |
3532 | 3544 | ||
3533 | bd = ugeth->confBd[txQ]; | 3545 | bd = ugeth->confBd[txQ]; |
3534 | bd_status = in_be32((u32 *)bd); | 3546 | bd_status = in_be32((u32 __iomem *)bd); |
3535 | 3547 | ||
3536 | /* Normal processing. */ | 3548 | /* Normal processing. */ |
3537 | while ((bd_status & T_R) == 0) { | 3549 | while ((bd_status & T_R) == 0) { |
@@ -3561,7 +3573,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ) | |||
3561 | bd += sizeof(struct qe_bd); | 3573 | bd += sizeof(struct qe_bd); |
3562 | else | 3574 | else |
3563 | bd = ugeth->p_tx_bd_ring[txQ]; | 3575 | bd = ugeth->p_tx_bd_ring[txQ]; |
3564 | bd_status = in_be32((u32 *)bd); | 3576 | bd_status = in_be32((u32 __iomem *)bd); |
3565 | } | 3577 | } |
3566 | ugeth->confBd[txQ] = bd; | 3578 | ugeth->confBd[txQ] = bd; |
3567 | return 0; | 3579 | return 0; |
@@ -3910,7 +3922,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3910 | return -EINVAL; | 3922 | return -EINVAL; |
3911 | } | 3923 | } |
3912 | } else { | 3924 | } else { |
3913 | prop = of_get_property(np, "rx-clock", NULL); | 3925 | prop = of_get_property(np, "tx-clock", NULL); |
3914 | if (!prop) { | 3926 | if (!prop) { |
3915 | printk(KERN_ERR | 3927 | printk(KERN_ERR |
3916 | "ucc_geth: mising tx-clock-name property\n"); | 3928 | "ucc_geth: mising tx-clock-name property\n"); |
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h index 9f8b7580a3a..abc0e224263 100644 --- a/drivers/net/ucc_geth.h +++ b/drivers/net/ucc_geth.h | |||
@@ -700,8 +700,8 @@ struct ucc_geth_82xx_address_filtering_pram { | |||
700 | u32 iaddr_l; /* individual address filter, low */ | 700 | u32 iaddr_l; /* individual address filter, low */ |
701 | u32 gaddr_h; /* group address filter, high */ | 701 | u32 gaddr_h; /* group address filter, high */ |
702 | u32 gaddr_l; /* group address filter, low */ | 702 | u32 gaddr_l; /* group address filter, low */ |
703 | struct ucc_geth_82xx_enet_address taddr; | 703 | struct ucc_geth_82xx_enet_address __iomem taddr; |
704 | struct ucc_geth_82xx_enet_address paddr[NUM_OF_PADDRS]; | 704 | struct ucc_geth_82xx_enet_address __iomem paddr[NUM_OF_PADDRS]; |
705 | u8 res0[0x40 - 0x38]; | 705 | u8 res0[0x40 - 0x38]; |
706 | } __attribute__ ((packed)); | 706 | } __attribute__ ((packed)); |
707 | 707 | ||
@@ -1186,40 +1186,40 @@ struct ucc_geth_private { | |||
1186 | struct ucc_fast_private *uccf; | 1186 | struct ucc_fast_private *uccf; |
1187 | struct net_device *dev; | 1187 | struct net_device *dev; |
1188 | struct napi_struct napi; | 1188 | struct napi_struct napi; |
1189 | struct ucc_geth *ug_regs; | 1189 | struct ucc_geth __iomem *ug_regs; |
1190 | struct ucc_geth_init_pram *p_init_enet_param_shadow; | 1190 | struct ucc_geth_init_pram *p_init_enet_param_shadow; |
1191 | struct ucc_geth_exf_global_pram *p_exf_glbl_param; | 1191 | struct ucc_geth_exf_global_pram __iomem *p_exf_glbl_param; |
1192 | u32 exf_glbl_param_offset; | 1192 | u32 exf_glbl_param_offset; |
1193 | struct ucc_geth_rx_global_pram *p_rx_glbl_pram; | 1193 | struct ucc_geth_rx_global_pram __iomem *p_rx_glbl_pram; |
1194 | u32 rx_glbl_pram_offset; | 1194 | u32 rx_glbl_pram_offset; |
1195 | struct ucc_geth_tx_global_pram *p_tx_glbl_pram; | 1195 | struct ucc_geth_tx_global_pram __iomem *p_tx_glbl_pram; |
1196 | u32 tx_glbl_pram_offset; | 1196 | u32 tx_glbl_pram_offset; |
1197 | struct ucc_geth_send_queue_mem_region *p_send_q_mem_reg; | 1197 | struct ucc_geth_send_queue_mem_region __iomem *p_send_q_mem_reg; |
1198 | u32 send_q_mem_reg_offset; | 1198 | u32 send_q_mem_reg_offset; |
1199 | struct ucc_geth_thread_data_tx *p_thread_data_tx; | 1199 | struct ucc_geth_thread_data_tx __iomem *p_thread_data_tx; |
1200 | u32 thread_dat_tx_offset; | 1200 | u32 thread_dat_tx_offset; |
1201 | struct ucc_geth_thread_data_rx *p_thread_data_rx; | 1201 | struct ucc_geth_thread_data_rx __iomem *p_thread_data_rx; |
1202 | u32 thread_dat_rx_offset; | 1202 | u32 thread_dat_rx_offset; |
1203 | struct ucc_geth_scheduler *p_scheduler; | 1203 | struct ucc_geth_scheduler __iomem *p_scheduler; |
1204 | u32 scheduler_offset; | 1204 | u32 scheduler_offset; |
1205 | struct ucc_geth_tx_firmware_statistics_pram *p_tx_fw_statistics_pram; | 1205 | struct ucc_geth_tx_firmware_statistics_pram __iomem *p_tx_fw_statistics_pram; |
1206 | u32 tx_fw_statistics_pram_offset; | 1206 | u32 tx_fw_statistics_pram_offset; |
1207 | struct ucc_geth_rx_firmware_statistics_pram *p_rx_fw_statistics_pram; | 1207 | struct ucc_geth_rx_firmware_statistics_pram __iomem *p_rx_fw_statistics_pram; |
1208 | u32 rx_fw_statistics_pram_offset; | 1208 | u32 rx_fw_statistics_pram_offset; |
1209 | struct ucc_geth_rx_interrupt_coalescing_table *p_rx_irq_coalescing_tbl; | 1209 | struct ucc_geth_rx_interrupt_coalescing_table __iomem *p_rx_irq_coalescing_tbl; |
1210 | u32 rx_irq_coalescing_tbl_offset; | 1210 | u32 rx_irq_coalescing_tbl_offset; |
1211 | struct ucc_geth_rx_bd_queues_entry *p_rx_bd_qs_tbl; | 1211 | struct ucc_geth_rx_bd_queues_entry __iomem *p_rx_bd_qs_tbl; |
1212 | u32 rx_bd_qs_tbl_offset; | 1212 | u32 rx_bd_qs_tbl_offset; |
1213 | u8 *p_tx_bd_ring[NUM_TX_QUEUES]; | 1213 | u8 __iomem *p_tx_bd_ring[NUM_TX_QUEUES]; |
1214 | u32 tx_bd_ring_offset[NUM_TX_QUEUES]; | 1214 | u32 tx_bd_ring_offset[NUM_TX_QUEUES]; |
1215 | u8 *p_rx_bd_ring[NUM_RX_QUEUES]; | 1215 | u8 __iomem *p_rx_bd_ring[NUM_RX_QUEUES]; |
1216 | u32 rx_bd_ring_offset[NUM_RX_QUEUES]; | 1216 | u32 rx_bd_ring_offset[NUM_RX_QUEUES]; |
1217 | u8 *confBd[NUM_TX_QUEUES]; | 1217 | u8 __iomem *confBd[NUM_TX_QUEUES]; |
1218 | u8 *txBd[NUM_TX_QUEUES]; | 1218 | u8 __iomem *txBd[NUM_TX_QUEUES]; |
1219 | u8 *rxBd[NUM_RX_QUEUES]; | 1219 | u8 __iomem *rxBd[NUM_RX_QUEUES]; |
1220 | int badFrame[NUM_RX_QUEUES]; | 1220 | int badFrame[NUM_RX_QUEUES]; |
1221 | u16 cpucount[NUM_TX_QUEUES]; | 1221 | u16 cpucount[NUM_TX_QUEUES]; |
1222 | volatile u16 *p_cpucount[NUM_TX_QUEUES]; | 1222 | u16 __iomem *p_cpucount[NUM_TX_QUEUES]; |
1223 | int indAddrRegUsed[NUM_OF_PADDRS]; | 1223 | int indAddrRegUsed[NUM_OF_PADDRS]; |
1224 | u8 paddr[NUM_OF_PADDRS][ENET_NUM_OCTETS_PER_ADDRESS]; /* ethernet address */ | 1224 | u8 paddr[NUM_OF_PADDRS][ENET_NUM_OCTETS_PER_ADDRESS]; /* ethernet address */ |
1225 | u8 numGroupAddrInHash; | 1225 | u8 numGroupAddrInHash; |
@@ -1251,4 +1251,12 @@ struct ucc_geth_private { | |||
1251 | int oldlink; | 1251 | int oldlink; |
1252 | }; | 1252 | }; |
1253 | 1253 | ||
1254 | void uec_set_ethtool_ops(struct net_device *netdev); | ||
1255 | int init_flow_control_params(u32 automatic_flow_control_mode, | ||
1256 | int rx_flow_control_enable, int tx_flow_control_enable, | ||
1257 | u16 pause_period, u16 extension_field, | ||
1258 | u32 __iomem *upsmr_register, u32 __iomem *uempr_register, | ||
1259 | u32 __iomem *maccfg1_register); | ||
1260 | |||
1261 | |||
1254 | #endif /* __UCC_GETH_H__ */ | 1262 | #endif /* __UCC_GETH_H__ */ |
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c index 9a9622c13e2..299b7f17695 100644 --- a/drivers/net/ucc_geth_ethtool.c +++ b/drivers/net/ucc_geth_ethtool.c | |||
@@ -108,12 +108,6 @@ static char rx_fw_stat_gstrings[][ETH_GSTRING_LEN] = { | |||
108 | #define UEC_TX_FW_STATS_LEN ARRAY_SIZE(tx_fw_stat_gstrings) | 108 | #define UEC_TX_FW_STATS_LEN ARRAY_SIZE(tx_fw_stat_gstrings) |
109 | #define UEC_RX_FW_STATS_LEN ARRAY_SIZE(rx_fw_stat_gstrings) | 109 | #define UEC_RX_FW_STATS_LEN ARRAY_SIZE(rx_fw_stat_gstrings) |
110 | 110 | ||
111 | extern int init_flow_control_params(u32 automatic_flow_control_mode, | ||
112 | int rx_flow_control_enable, | ||
113 | int tx_flow_control_enable, u16 pause_period, | ||
114 | u16 extension_field, volatile u32 *upsmr_register, | ||
115 | volatile u32 *uempr_register, volatile u32 *maccfg1_register); | ||
116 | |||
117 | static int | 111 | static int |
118 | uec_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | 112 | uec_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) |
119 | { | 113 | { |
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c index 2af49078100..94047473692 100644 --- a/drivers/net/ucc_geth_mii.c +++ b/drivers/net/ucc_geth_mii.c | |||
@@ -104,7 +104,7 @@ int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | /* Reset the MIIM registers, and wait for the bus to free */ | 106 | /* Reset the MIIM registers, and wait for the bus to free */ |
107 | int uec_mdio_reset(struct mii_bus *bus) | 107 | static int uec_mdio_reset(struct mii_bus *bus) |
108 | { | 108 | { |
109 | struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv; | 109 | struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv; |
110 | unsigned int timeout = PHY_INIT_TIMEOUT; | 110 | unsigned int timeout = PHY_INIT_TIMEOUT; |
@@ -240,7 +240,7 @@ reg_map_fail: | |||
240 | return err; | 240 | return err; |
241 | } | 241 | } |
242 | 242 | ||
243 | int uec_mdio_remove(struct of_device *ofdev) | 243 | static int uec_mdio_remove(struct of_device *ofdev) |
244 | { | 244 | { |
245 | struct device *device = &ofdev->dev; | 245 | struct device *device = &ofdev->dev; |
246 | struct mii_bus *bus = dev_get_drvdata(device); | 246 | struct mii_bus *bus = dev_get_drvdata(device); |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 6f245cfb662..dc6f097062d 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -1381,6 +1381,10 @@ static const struct usb_device_id products [] = { | |||
1381 | USB_DEVICE (0x0411, 0x003d), | 1381 | USB_DEVICE (0x0411, 0x003d), |
1382 | .driver_info = (unsigned long) &ax8817x_info, | 1382 | .driver_info = (unsigned long) &ax8817x_info, |
1383 | }, { | 1383 | }, { |
1384 | // Buffalo LUA-U2-GT 10/100/1000 | ||
1385 | USB_DEVICE (0x0411, 0x006e), | ||
1386 | .driver_info = (unsigned long) &ax88178_info, | ||
1387 | }, { | ||
1384 | // Sitecom LN-029 "USB 2.0 10/100 Ethernet adapter" | 1388 | // Sitecom LN-029 "USB 2.0 10/100 Ethernet adapter" |
1385 | USB_DEVICE (0x6189, 0x182d), | 1389 | USB_DEVICE (0x6189, 0x182d), |
1386 | .driver_info = (unsigned long) &ax8817x_info, | 1390 | .driver_info = (unsigned long) &ax8817x_info, |
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c index b5860b97a93..24fd613466b 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c | |||
@@ -459,6 +459,7 @@ static void __exit lapbeth_cleanup_driver(void) | |||
459 | list_for_each_safe(entry, tmp, &lapbeth_devices) { | 459 | list_for_each_safe(entry, tmp, &lapbeth_devices) { |
460 | lapbeth = list_entry(entry, struct lapbethdev, node); | 460 | lapbeth = list_entry(entry, struct lapbethdev, node); |
461 | 461 | ||
462 | dev_put(lapbeth->ethdev); | ||
462 | unregister_netdevice(lapbeth->axdev); | 463 | unregister_netdevice(lapbeth->axdev); |
463 | } | 464 | } |
464 | rtnl_unlock(); | 465 | rtnl_unlock(); |
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index d5b7a76fcaa..62fb89d8231 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
@@ -1,6 +1,5 @@ | |||
1 | config IWLWIFI | 1 | config IWLWIFI |
2 | bool | 2 | tristate |
3 | default n | ||
4 | 3 | ||
5 | config IWLCORE | 4 | config IWLCORE |
6 | tristate "Intel Wireless Wifi Core" | 5 | tristate "Intel Wireless Wifi Core" |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 4a55bf38095..3706ce7972d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -842,13 +842,25 @@ static void set_pcie_port_type(struct pci_dev *pdev) | |||
842 | * reading the dword at 0x100 which must either be 0 or a valid extended | 842 | * reading the dword at 0x100 which must either be 0 or a valid extended |
843 | * capability header. | 843 | * capability header. |
844 | */ | 844 | */ |
845 | int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix) | 845 | int pci_cfg_space_size_ext(struct pci_dev *dev) |
846 | { | 846 | { |
847 | int pos; | ||
848 | u32 status; | 847 | u32 status; |
849 | 848 | ||
850 | if (!check_exp_pcix) | 849 | if (pci_read_config_dword(dev, 256, &status) != PCIBIOS_SUCCESSFUL) |
851 | goto skip; | 850 | goto fail; |
851 | if (status == 0xffffffff) | ||
852 | goto fail; | ||
853 | |||
854 | return PCI_CFG_SPACE_EXP_SIZE; | ||
855 | |||
856 | fail: | ||
857 | return PCI_CFG_SPACE_SIZE; | ||
858 | } | ||
859 | |||
860 | int pci_cfg_space_size(struct pci_dev *dev) | ||
861 | { | ||
862 | int pos; | ||
863 | u32 status; | ||
852 | 864 | ||
853 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); | 865 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); |
854 | if (!pos) { | 866 | if (!pos) { |
@@ -861,23 +873,12 @@ int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix) | |||
861 | goto fail; | 873 | goto fail; |
862 | } | 874 | } |
863 | 875 | ||
864 | skip: | 876 | return pci_cfg_space_size_ext(dev); |
865 | if (pci_read_config_dword(dev, 256, &status) != PCIBIOS_SUCCESSFUL) | ||
866 | goto fail; | ||
867 | if (status == 0xffffffff) | ||
868 | goto fail; | ||
869 | |||
870 | return PCI_CFG_SPACE_EXP_SIZE; | ||
871 | 877 | ||
872 | fail: | 878 | fail: |
873 | return PCI_CFG_SPACE_SIZE; | 879 | return PCI_CFG_SPACE_SIZE; |
874 | } | 880 | } |
875 | 881 | ||
876 | int pci_cfg_space_size(struct pci_dev *dev) | ||
877 | { | ||
878 | return pci_cfg_space_size_ext(dev, 1); | ||
879 | } | ||
880 | |||
881 | static void pci_release_bus_bridge_dev(struct device *dev) | 882 | static void pci_release_bus_bridge_dev(struct device *dev) |
882 | { | 883 | { |
883 | kfree(dev); | 884 | kfree(dev); |
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index a83a40b3eba..0f0d27d1c4c 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c | |||
@@ -184,7 +184,7 @@ ds1511_wdog_disable(void) | |||
184 | static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm) | 184 | static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm) |
185 | { | 185 | { |
186 | u8 mon, day, dow, hrs, min, sec, yrs, cen; | 186 | u8 mon, day, dow, hrs, min, sec, yrs, cen; |
187 | unsigned int flags; | 187 | unsigned long flags; |
188 | 188 | ||
189 | /* | 189 | /* |
190 | * won't have to change this for a while | 190 | * won't have to change this for a while |
@@ -247,7 +247,7 @@ static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm) | |||
247 | static int ds1511_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) | 247 | static int ds1511_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) |
248 | { | 248 | { |
249 | unsigned int century; | 249 | unsigned int century; |
250 | unsigned int flags; | 250 | unsigned long flags; |
251 | 251 | ||
252 | spin_lock_irqsave(&ds1511_lock, flags); | 252 | spin_lock_irqsave(&ds1511_lock, flags); |
253 | rtc_disable_update(); | 253 | rtc_disable_update(); |
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 110699bb478..1f88e9e914e 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -616,7 +616,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
616 | goto err_badres; | 616 | goto err_badres; |
617 | } | 617 | } |
618 | 618 | ||
619 | rtc->regbase = (void __iomem *)rtc->res->start; | 619 | rtc->regbase = ioremap_nocache(rtc->res->start, rtc->regsize); |
620 | if (unlikely(!rtc->regbase)) { | 620 | if (unlikely(!rtc->regbase)) { |
621 | ret = -EINVAL; | 621 | ret = -EINVAL; |
622 | goto err_badmap; | 622 | goto err_badmap; |
@@ -626,7 +626,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
626 | &sh_rtc_ops, THIS_MODULE); | 626 | &sh_rtc_ops, THIS_MODULE); |
627 | if (IS_ERR(rtc->rtc_dev)) { | 627 | if (IS_ERR(rtc->rtc_dev)) { |
628 | ret = PTR_ERR(rtc->rtc_dev); | 628 | ret = PTR_ERR(rtc->rtc_dev); |
629 | goto err_badmap; | 629 | goto err_unmap; |
630 | } | 630 | } |
631 | 631 | ||
632 | rtc->capabilities = RTC_DEF_CAPABILITIES; | 632 | rtc->capabilities = RTC_DEF_CAPABILITIES; |
@@ -653,7 +653,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
653 | dev_err(&pdev->dev, | 653 | dev_err(&pdev->dev, |
654 | "request period IRQ failed with %d, IRQ %d\n", ret, | 654 | "request period IRQ failed with %d, IRQ %d\n", ret, |
655 | rtc->periodic_irq); | 655 | rtc->periodic_irq); |
656 | goto err_badmap; | 656 | goto err_unmap; |
657 | } | 657 | } |
658 | 658 | ||
659 | ret = request_irq(rtc->carry_irq, sh_rtc_interrupt, IRQF_DISABLED, | 659 | ret = request_irq(rtc->carry_irq, sh_rtc_interrupt, IRQF_DISABLED, |
@@ -663,7 +663,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
663 | "request carry IRQ failed with %d, IRQ %d\n", ret, | 663 | "request carry IRQ failed with %d, IRQ %d\n", ret, |
664 | rtc->carry_irq); | 664 | rtc->carry_irq); |
665 | free_irq(rtc->periodic_irq, rtc); | 665 | free_irq(rtc->periodic_irq, rtc); |
666 | goto err_badmap; | 666 | goto err_unmap; |
667 | } | 667 | } |
668 | 668 | ||
669 | ret = request_irq(rtc->alarm_irq, sh_rtc_alarm, IRQF_DISABLED, | 669 | ret = request_irq(rtc->alarm_irq, sh_rtc_alarm, IRQF_DISABLED, |
@@ -674,7 +674,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
674 | rtc->alarm_irq); | 674 | rtc->alarm_irq); |
675 | free_irq(rtc->carry_irq, rtc); | 675 | free_irq(rtc->carry_irq, rtc); |
676 | free_irq(rtc->periodic_irq, rtc); | 676 | free_irq(rtc->periodic_irq, rtc); |
677 | goto err_badmap; | 677 | goto err_unmap; |
678 | } | 678 | } |
679 | 679 | ||
680 | tmp = readb(rtc->regbase + RCR1); | 680 | tmp = readb(rtc->regbase + RCR1); |
@@ -684,6 +684,8 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
684 | 684 | ||
685 | return 0; | 685 | return 0; |
686 | 686 | ||
687 | err_unmap: | ||
688 | iounmap(rtc->regbase); | ||
687 | err_badmap: | 689 | err_badmap: |
688 | release_resource(rtc->res); | 690 | release_resource(rtc->res); |
689 | err_badres: | 691 | err_badres: |
@@ -708,6 +710,8 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev) | |||
708 | 710 | ||
709 | release_resource(rtc->res); | 711 | release_resource(rtc->res); |
710 | 712 | ||
713 | iounmap(rtc->regbase); | ||
714 | |||
711 | platform_set_drvdata(pdev, NULL); | 715 | platform_set_drvdata(pdev, NULL); |
712 | 716 | ||
713 | kfree(rtc); | 717 | kfree(rtc); |
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index c1f2adefad4..5043150019a 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -965,8 +965,7 @@ tty3270_write_room(struct tty_struct *tty) | |||
965 | * Insert character into the screen at the current position with the | 965 | * Insert character into the screen at the current position with the |
966 | * current color and highlight. This function does NOT do cursor movement. | 966 | * current color and highlight. This function does NOT do cursor movement. |
967 | */ | 967 | */ |
968 | static int | 968 | static void tty3270_put_character(struct tty3270 *tp, char ch) |
969 | tty3270_put_character(struct tty3270 *tp, char ch) | ||
970 | { | 969 | { |
971 | struct tty3270_line *line; | 970 | struct tty3270_line *line; |
972 | struct tty3270_cell *cell; | 971 | struct tty3270_cell *cell; |
@@ -986,7 +985,6 @@ tty3270_put_character(struct tty3270 *tp, char ch) | |||
986 | cell->character = tp->view.ascebc[(unsigned int) ch]; | 985 | cell->character = tp->view.ascebc[(unsigned int) ch]; |
987 | cell->highlight = tp->highlight; | 986 | cell->highlight = tp->highlight; |
988 | cell->f_color = tp->f_color; | 987 | cell->f_color = tp->f_color; |
989 | return 1; | ||
990 | } | 988 | } |
991 | 989 | ||
992 | /* | 990 | /* |
@@ -1612,16 +1610,15 @@ tty3270_write(struct tty_struct * tty, | |||
1612 | /* | 1610 | /* |
1613 | * Put single characters to the ttys character buffer | 1611 | * Put single characters to the ttys character buffer |
1614 | */ | 1612 | */ |
1615 | static void | 1613 | static int tty3270_put_char(struct tty_struct *tty, unsigned char ch) |
1616 | tty3270_put_char(struct tty_struct *tty, unsigned char ch) | ||
1617 | { | 1614 | { |
1618 | struct tty3270 *tp; | 1615 | struct tty3270 *tp; |
1619 | 1616 | ||
1620 | tp = tty->driver_data; | 1617 | tp = tty->driver_data; |
1621 | if (!tp) | 1618 | if (!tp || tp->char_count >= TTY3270_CHAR_BUF_SIZE) |
1622 | return; | 1619 | return 0; |
1623 | if (tp->char_count < TTY3270_CHAR_BUF_SIZE) | 1620 | tp->char_buf[tp->char_count++] = ch; |
1624 | tp->char_buf[tp->char_count++] = ch; | 1621 | return 1; |
1625 | } | 1622 | } |
1626 | 1623 | ||
1627 | /* | 1624 | /* |
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c index 40ef948fcb3..9c21b8f43f9 100644 --- a/drivers/s390/cio/blacklist.c +++ b/drivers/s390/cio/blacklist.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <asm/cio.h> | 20 | #include <asm/cio.h> |
21 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
22 | #include <asm/cio.h> | ||
22 | 23 | ||
23 | #include "blacklist.h" | 24 | #include "blacklist.h" |
24 | #include "cio.h" | 25 | #include "cio.h" |
@@ -43,164 +44,169 @@ typedef enum {add, free} range_action; | |||
43 | * Function: blacklist_range | 44 | * Function: blacklist_range |
44 | * (Un-)blacklist the devices from-to | 45 | * (Un-)blacklist the devices from-to |
45 | */ | 46 | */ |
46 | static void | 47 | static int blacklist_range(range_action action, unsigned int from_ssid, |
47 | blacklist_range (range_action action, unsigned int from, unsigned int to, | 48 | unsigned int to_ssid, unsigned int from, |
48 | unsigned int ssid) | 49 | unsigned int to, int msgtrigger) |
49 | { | 50 | { |
50 | if (!to) | 51 | if ((from_ssid > to_ssid) || ((from_ssid == to_ssid) && (from > to))) { |
51 | to = from; | 52 | if (msgtrigger) |
52 | 53 | printk(KERN_WARNING "cio: Invalid cio_ignore range " | |
53 | if (from > to || to > __MAX_SUBCHANNEL || ssid > __MAX_SSID) { | 54 | "0.%x.%04x-0.%x.%04x\n", from_ssid, from, |
54 | printk (KERN_WARNING "cio: Invalid blacklist range " | 55 | to_ssid, to); |
55 | "0.%x.%04x to 0.%x.%04x, skipping\n", | 56 | return 1; |
56 | ssid, from, ssid, to); | ||
57 | return; | ||
58 | } | 57 | } |
59 | for (; from <= to; from++) { | 58 | |
59 | while ((from_ssid < to_ssid) || ((from_ssid == to_ssid) && | ||
60 | (from <= to))) { | ||
60 | if (action == add) | 61 | if (action == add) |
61 | set_bit (from, bl_dev[ssid]); | 62 | set_bit(from, bl_dev[from_ssid]); |
62 | else | 63 | else |
63 | clear_bit (from, bl_dev[ssid]); | 64 | clear_bit(from, bl_dev[from_ssid]); |
65 | from++; | ||
66 | if (from > __MAX_SUBCHANNEL) { | ||
67 | from_ssid++; | ||
68 | from = 0; | ||
69 | } | ||
64 | } | 70 | } |
71 | |||
72 | return 0; | ||
65 | } | 73 | } |
66 | 74 | ||
67 | /* | 75 | static int pure_hex(char **cp, unsigned int *val, int min_digit, |
68 | * Function: blacklist_busid | 76 | int max_digit, int max_val) |
69 | * Get devno/busid from given string. | ||
70 | * Shamelessly grabbed from dasd_devmap.c. | ||
71 | */ | ||
72 | static int | ||
73 | blacklist_busid(char **str, int *id0, int *ssid, int *devno) | ||
74 | { | 77 | { |
75 | int val, old_style; | 78 | int diff; |
76 | char *sav; | 79 | unsigned int value; |
77 | 80 | ||
78 | sav = *str; | 81 | diff = 0; |
82 | *val = 0; | ||
79 | 83 | ||
80 | /* check for leading '0x' */ | 84 | while (isxdigit(**cp) && (diff <= max_digit)) { |
81 | old_style = 0; | 85 | |
82 | if ((*str)[0] == '0' && (*str)[1] == 'x') { | 86 | if (isdigit(**cp)) |
83 | *str += 2; | 87 | value = **cp - '0'; |
84 | old_style = 1; | 88 | else |
85 | } | 89 | value = tolower(**cp) - 'a' + 10; |
86 | if (!isxdigit((*str)[0])) /* We require at least one hex digit */ | 90 | *val = *val * 16 + value; |
87 | goto confused; | 91 | (*cp)++; |
88 | val = simple_strtoul(*str, str, 16); | 92 | diff++; |
89 | if (old_style || (*str)[0] != '.') { | ||
90 | *id0 = *ssid = 0; | ||
91 | if (val < 0 || val > 0xffff) | ||
92 | goto confused; | ||
93 | *devno = val; | ||
94 | if ((*str)[0] != ',' && (*str)[0] != '-' && | ||
95 | (*str)[0] != '\n' && (*str)[0] != '\0') | ||
96 | goto confused; | ||
97 | return 0; | ||
98 | } | 93 | } |
99 | /* New style x.y.z busid */ | 94 | |
100 | if (val < 0 || val > 0xff) | 95 | if ((diff < min_digit) || (diff > max_digit) || (*val > max_val)) |
101 | goto confused; | 96 | return 1; |
102 | *id0 = val; | 97 | |
103 | (*str)++; | ||
104 | if (!isxdigit((*str)[0])) /* We require at least one hex digit */ | ||
105 | goto confused; | ||
106 | val = simple_strtoul(*str, str, 16); | ||
107 | if (val < 0 || val > 0xff || (*str)++[0] != '.') | ||
108 | goto confused; | ||
109 | *ssid = val; | ||
110 | if (!isxdigit((*str)[0])) /* We require at least one hex digit */ | ||
111 | goto confused; | ||
112 | val = simple_strtoul(*str, str, 16); | ||
113 | if (val < 0 || val > 0xffff) | ||
114 | goto confused; | ||
115 | *devno = val; | ||
116 | if ((*str)[0] != ',' && (*str)[0] != '-' && | ||
117 | (*str)[0] != '\n' && (*str)[0] != '\0') | ||
118 | goto confused; | ||
119 | return 0; | 98 | return 0; |
120 | confused: | ||
121 | strsep(str, ",\n"); | ||
122 | printk(KERN_WARNING "cio: Invalid cio_ignore parameter '%s'\n", sav); | ||
123 | return 1; | ||
124 | } | 99 | } |
125 | 100 | ||
126 | static int | 101 | static int parse_busid(char *str, int *cssid, int *ssid, int *devno, |
127 | blacklist_parse_parameters (char *str, range_action action) | 102 | int msgtrigger) |
128 | { | 103 | { |
129 | int from, to, from_id0, to_id0, from_ssid, to_ssid; | 104 | char *str_work; |
130 | 105 | int val, rc, ret; | |
131 | while (*str != 0 && *str != '\n') { | 106 | |
132 | range_action ra = action; | 107 | rc = 1; |
133 | while(*str == ',') | 108 | |
134 | str++; | 109 | if (*str == '\0') |
135 | if (*str == '!') { | 110 | goto out; |
136 | ra = !action; | 111 | |
137 | ++str; | 112 | /* old style */ |
113 | str_work = str; | ||
114 | val = simple_strtoul(str, &str_work, 16); | ||
115 | |||
116 | if (*str_work == '\0') { | ||
117 | if (val <= __MAX_SUBCHANNEL) { | ||
118 | *devno = val; | ||
119 | *ssid = 0; | ||
120 | *cssid = 0; | ||
121 | rc = 0; | ||
138 | } | 122 | } |
123 | goto out; | ||
124 | } | ||
139 | 125 | ||
140 | /* | 126 | /* new style */ |
141 | * Since we have to parse the proc commands and the | 127 | str_work = str; |
142 | * kernel arguments we have to check four cases | 128 | ret = pure_hex(&str_work, cssid, 1, 2, __MAX_CSSID); |
143 | */ | 129 | if (ret || (str_work[0] != '.')) |
144 | if (strncmp(str,"all,",4) == 0 || strcmp(str,"all") == 0 || | 130 | goto out; |
145 | strncmp(str,"all\n",4) == 0 || strncmp(str,"all ",4) == 0) { | 131 | str_work++; |
146 | int j; | 132 | ret = pure_hex(&str_work, ssid, 1, 1, __MAX_SSID); |
147 | 133 | if (ret || (str_work[0] != '.')) | |
148 | str += 3; | 134 | goto out; |
149 | for (j=0; j <= __MAX_SSID; j++) | 135 | str_work++; |
150 | blacklist_range(ra, 0, __MAX_SUBCHANNEL, j); | 136 | ret = pure_hex(&str_work, devno, 4, 4, __MAX_SUBCHANNEL); |
151 | } else { | 137 | if (ret || (str_work[0] != '\0')) |
152 | int rc; | 138 | goto out; |
139 | |||
140 | rc = 0; | ||
141 | out: | ||
142 | if (rc && msgtrigger) | ||
143 | printk(KERN_WARNING "cio: Invalid cio_ignore device '%s'\n", | ||
144 | str); | ||
145 | |||
146 | return rc; | ||
147 | } | ||
153 | 148 | ||
154 | rc = blacklist_busid(&str, &from_id0, | 149 | static int blacklist_parse_parameters(char *str, range_action action, |
155 | &from_ssid, &from); | 150 | int msgtrigger) |
156 | if (rc) | 151 | { |
157 | continue; | 152 | int from_cssid, to_cssid, from_ssid, to_ssid, from, to; |
158 | to = from; | 153 | int rc, totalrc; |
159 | to_id0 = from_id0; | 154 | char *parm; |
160 | to_ssid = from_ssid; | 155 | range_action ra; |
161 | if (*str == '-') { | 156 | |
162 | str++; | 157 | totalrc = 0; |
163 | rc = blacklist_busid(&str, &to_id0, | 158 | |
164 | &to_ssid, &to); | 159 | while ((parm = strsep(&str, ","))) { |
165 | if (rc) | 160 | rc = 0; |
166 | continue; | 161 | ra = action; |
167 | } | 162 | if (*parm == '!') { |
168 | if (*str == '-') { | 163 | if (ra == add) |
169 | printk(KERN_WARNING "cio: invalid cio_ignore " | 164 | ra = free; |
170 | "parameter '%s'\n", | 165 | else |
171 | strsep(&str, ",\n")); | 166 | ra = add; |
172 | continue; | 167 | parm++; |
173 | } | 168 | } |
174 | if ((from_id0 != to_id0) || | 169 | if (strcmp(parm, "all") == 0) { |
175 | (from_ssid != to_ssid)) { | 170 | from_cssid = 0; |
176 | printk(KERN_WARNING "cio: invalid cio_ignore " | 171 | from_ssid = 0; |
177 | "range %x.%x.%04x-%x.%x.%04x\n", | 172 | from = 0; |
178 | from_id0, from_ssid, from, | 173 | to_cssid = __MAX_CSSID; |
179 | to_id0, to_ssid, to); | 174 | to_ssid = __MAX_SSID; |
180 | continue; | 175 | to = __MAX_SUBCHANNEL; |
176 | } else { | ||
177 | rc = parse_busid(strsep(&parm, "-"), &from_cssid, | ||
178 | &from_ssid, &from, msgtrigger); | ||
179 | if (!rc) { | ||
180 | if (parm != NULL) | ||
181 | rc = parse_busid(parm, &to_cssid, | ||
182 | &to_ssid, &to, | ||
183 | msgtrigger); | ||
184 | else { | ||
185 | to_cssid = from_cssid; | ||
186 | to_ssid = from_ssid; | ||
187 | to = from; | ||
188 | } | ||
181 | } | 189 | } |
182 | blacklist_range (ra, from, to, to_ssid); | ||
183 | } | 190 | } |
191 | if (!rc) { | ||
192 | rc = blacklist_range(ra, from_ssid, to_ssid, from, to, | ||
193 | msgtrigger); | ||
194 | if (rc) | ||
195 | totalrc = 1; | ||
196 | } else | ||
197 | totalrc = 1; | ||
184 | } | 198 | } |
185 | return 1; | 199 | |
200 | return totalrc; | ||
186 | } | 201 | } |
187 | 202 | ||
188 | /* Parsing the commandline for blacklist parameters, e.g. to blacklist | ||
189 | * bus ids 0.0.1234, 0.0.1235 and 0.0.1236, you could use any of: | ||
190 | * - cio_ignore=1234-1236 | ||
191 | * - cio_ignore=0x1234-0x1235,1236 | ||
192 | * - cio_ignore=0x1234,1235-1236 | ||
193 | * - cio_ignore=1236 cio_ignore=1234-0x1236 | ||
194 | * - cio_ignore=1234 cio_ignore=1236 cio_ignore=0x1235 | ||
195 | * - cio_ignore=0.0.1234-0.0.1236 | ||
196 | * - cio_ignore=0.0.1234,0x1235,1236 | ||
197 | * - ... | ||
198 | */ | ||
199 | static int __init | 203 | static int __init |
200 | blacklist_setup (char *str) | 204 | blacklist_setup (char *str) |
201 | { | 205 | { |
202 | CIO_MSG_EVENT(6, "Reading blacklist parameters\n"); | 206 | CIO_MSG_EVENT(6, "Reading blacklist parameters\n"); |
203 | return blacklist_parse_parameters (str, add); | 207 | if (blacklist_parse_parameters(str, add, 1)) |
208 | return 0; | ||
209 | return 1; | ||
204 | } | 210 | } |
205 | 211 | ||
206 | __setup ("cio_ignore=", blacklist_setup); | 212 | __setup ("cio_ignore=", blacklist_setup); |
@@ -224,27 +230,23 @@ is_blacklisted (int ssid, int devno) | |||
224 | * Function: blacklist_parse_proc_parameters | 230 | * Function: blacklist_parse_proc_parameters |
225 | * parse the stuff which is piped to /proc/cio_ignore | 231 | * parse the stuff which is piped to /proc/cio_ignore |
226 | */ | 232 | */ |
227 | static void | 233 | static int blacklist_parse_proc_parameters(char *buf) |
228 | blacklist_parse_proc_parameters (char *buf) | ||
229 | { | 234 | { |
230 | if (strncmp (buf, "free ", 5) == 0) { | 235 | int rc; |
231 | blacklist_parse_parameters (buf + 5, free); | 236 | char *parm; |
232 | } else if (strncmp (buf, "add ", 4) == 0) { | 237 | |
233 | /* | 238 | parm = strsep(&buf, " "); |
234 | * We don't need to check for known devices since | 239 | |
235 | * css_probe_device will handle this correctly. | 240 | if (strcmp("free", parm) == 0) |
236 | */ | 241 | rc = blacklist_parse_parameters(buf, free, 0); |
237 | blacklist_parse_parameters (buf + 4, add); | 242 | else if (strcmp("add", parm) == 0) |
238 | } else { | 243 | rc = blacklist_parse_parameters(buf, add, 0); |
239 | printk (KERN_WARNING "cio: cio_ignore: Parse error; \n" | 244 | else |
240 | KERN_WARNING "try using 'free all|<devno-range>," | 245 | return 1; |
241 | "<devno-range>,...'\n" | ||
242 | KERN_WARNING "or 'add <devno-range>," | ||
243 | "<devno-range>,...'\n"); | ||
244 | return; | ||
245 | } | ||
246 | 246 | ||
247 | css_schedule_reprobe(); | 247 | css_schedule_reprobe(); |
248 | |||
249 | return rc; | ||
248 | } | 250 | } |
249 | 251 | ||
250 | /* Iterator struct for all devices. */ | 252 | /* Iterator struct for all devices. */ |
@@ -328,6 +330,8 @@ cio_ignore_write(struct file *file, const char __user *user_buf, | |||
328 | size_t user_len, loff_t *offset) | 330 | size_t user_len, loff_t *offset) |
329 | { | 331 | { |
330 | char *buf; | 332 | char *buf; |
333 | size_t i; | ||
334 | ssize_t rc, ret; | ||
331 | 335 | ||
332 | if (*offset) | 336 | if (*offset) |
333 | return -EINVAL; | 337 | return -EINVAL; |
@@ -336,16 +340,27 @@ cio_ignore_write(struct file *file, const char __user *user_buf, | |||
336 | buf = vmalloc (user_len + 1); /* maybe better use the stack? */ | 340 | buf = vmalloc (user_len + 1); /* maybe better use the stack? */ |
337 | if (buf == NULL) | 341 | if (buf == NULL) |
338 | return -ENOMEM; | 342 | return -ENOMEM; |
343 | memset(buf, 0, user_len + 1); | ||
344 | |||
339 | if (strncpy_from_user (buf, user_buf, user_len) < 0) { | 345 | if (strncpy_from_user (buf, user_buf, user_len) < 0) { |
340 | vfree (buf); | 346 | rc = -EFAULT; |
341 | return -EFAULT; | 347 | goto out_free; |
342 | } | 348 | } |
343 | buf[user_len] = '\0'; | ||
344 | 349 | ||
345 | blacklist_parse_proc_parameters (buf); | 350 | i = user_len - 1; |
351 | while ((i >= 0) && (isspace(buf[i]) || (buf[i] == 0))) { | ||
352 | buf[i] = '\0'; | ||
353 | i--; | ||
354 | } | ||
355 | ret = blacklist_parse_proc_parameters(buf); | ||
356 | if (ret) | ||
357 | rc = -EINVAL; | ||
358 | else | ||
359 | rc = user_len; | ||
346 | 360 | ||
361 | out_free: | ||
347 | vfree (buf); | 362 | vfree (buf); |
348 | return user_len; | 363 | return rc; |
349 | } | 364 | } |
350 | 365 | ||
351 | static const struct seq_operations cio_ignore_proc_seq_ops = { | 366 | static const struct seq_operations cio_ignore_proc_seq_ops = { |
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 08a57816130..82c6a2d4512 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
@@ -39,23 +39,6 @@ debug_info_t *cio_debug_msg_id; | |||
39 | debug_info_t *cio_debug_trace_id; | 39 | debug_info_t *cio_debug_trace_id; |
40 | debug_info_t *cio_debug_crw_id; | 40 | debug_info_t *cio_debug_crw_id; |
41 | 41 | ||
42 | int cio_show_msg; | ||
43 | |||
44 | static int __init | ||
45 | cio_setup (char *parm) | ||
46 | { | ||
47 | if (!strcmp (parm, "yes")) | ||
48 | cio_show_msg = 1; | ||
49 | else if (!strcmp (parm, "no")) | ||
50 | cio_show_msg = 0; | ||
51 | else | ||
52 | printk(KERN_ERR "cio: cio_setup: " | ||
53 | "invalid cio_msg parameter '%s'", parm); | ||
54 | return 1; | ||
55 | } | ||
56 | |||
57 | __setup ("cio_msg=", cio_setup); | ||
58 | |||
59 | /* | 42 | /* |
60 | * Function: cio_debug_init | 43 | * Function: cio_debug_init |
61 | * Initializes three debug logs for common I/O: | 44 | * Initializes three debug logs for common I/O: |
@@ -166,7 +149,7 @@ cio_start_handle_notoper(struct subchannel *sch, __u8 lpm) | |||
166 | 149 | ||
167 | stsch (sch->schid, &sch->schib); | 150 | stsch (sch->schid, &sch->schib); |
168 | 151 | ||
169 | CIO_MSG_EVENT(0, "cio_start: 'not oper' status for " | 152 | CIO_MSG_EVENT(2, "cio_start: 'not oper' status for " |
170 | "subchannel 0.%x.%04x!\n", sch->schid.ssid, | 153 | "subchannel 0.%x.%04x!\n", sch->schid.ssid, |
171 | sch->schid.sch_no); | 154 | sch->schid.sch_no); |
172 | sprintf(dbf_text, "no%s", sch->dev.bus_id); | 155 | sprintf(dbf_text, "no%s", sch->dev.bus_id); |
@@ -567,10 +550,9 @@ cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid) | |||
567 | * ... just being curious we check for non I/O subchannels | 550 | * ... just being curious we check for non I/O subchannels |
568 | */ | 551 | */ |
569 | if (sch->st != 0) { | 552 | if (sch->st != 0) { |
570 | CIO_DEBUG(KERN_INFO, 0, | 553 | CIO_MSG_EVENT(4, "Subchannel 0.%x.%04x reports " |
571 | "Subchannel 0.%x.%04x reports " | 554 | "non-I/O subchannel type %04X\n", |
572 | "non-I/O subchannel type %04X\n", | 555 | sch->schid.ssid, sch->schid.sch_no, sch->st); |
573 | sch->schid.ssid, sch->schid.sch_no, sch->st); | ||
574 | /* We stop here for non-io subchannels. */ | 556 | /* We stop here for non-io subchannels. */ |
575 | err = sch->st; | 557 | err = sch->st; |
576 | goto out; | 558 | goto out; |
@@ -588,7 +570,7 @@ cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid) | |||
588 | * This device must not be known to Linux. So we simply | 570 | * This device must not be known to Linux. So we simply |
589 | * say that there is no device and return ENODEV. | 571 | * say that there is no device and return ENODEV. |
590 | */ | 572 | */ |
591 | CIO_MSG_EVENT(4, "Blacklisted device detected " | 573 | CIO_MSG_EVENT(6, "Blacklisted device detected " |
592 | "at devno %04X, subchannel set %x\n", | 574 | "at devno %04X, subchannel set %x\n", |
593 | sch->schib.pmcw.dev, sch->schid.ssid); | 575 | sch->schib.pmcw.dev, sch->schid.ssid); |
594 | err = -ENODEV; | 576 | err = -ENODEV; |
@@ -601,12 +583,11 @@ cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid) | |||
601 | sch->lpm = sch->schib.pmcw.pam & sch->opm; | 583 | sch->lpm = sch->schib.pmcw.pam & sch->opm; |
602 | sch->isc = 3; | 584 | sch->isc = 3; |
603 | 585 | ||
604 | CIO_DEBUG(KERN_INFO, 0, | 586 | CIO_MSG_EVENT(6, "Detected device %04x on subchannel 0.%x.%04X " |
605 | "Detected device %04x on subchannel 0.%x.%04X" | 587 | "- PIM = %02X, PAM = %02X, POM = %02X\n", |
606 | " - PIM = %02X, PAM = %02X, POM = %02X\n", | 588 | sch->schib.pmcw.dev, sch->schid.ssid, |
607 | sch->schib.pmcw.dev, sch->schid.ssid, | 589 | sch->schid.sch_no, sch->schib.pmcw.pim, |
608 | sch->schid.sch_no, sch->schib.pmcw.pim, | 590 | sch->schib.pmcw.pam, sch->schib.pmcw.pom); |
609 | sch->schib.pmcw.pam, sch->schib.pmcw.pom); | ||
610 | 591 | ||
611 | /* | 592 | /* |
612 | * We now have to initially ... | 593 | * We now have to initially ... |
diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h index 3c75412904d..6e933aebe01 100644 --- a/drivers/s390/cio/cio.h +++ b/drivers/s390/cio/cio.h | |||
@@ -118,6 +118,4 @@ extern void *cio_get_console_priv(void); | |||
118 | #define cio_get_console_priv() NULL | 118 | #define cio_get_console_priv() NULL |
119 | #endif | 119 | #endif |
120 | 120 | ||
121 | extern int cio_show_msg; | ||
122 | |||
123 | #endif | 121 | #endif |
diff --git a/drivers/s390/cio/cio_debug.h b/drivers/s390/cio/cio_debug.h index d7429ef6c66..e64e8278c42 100644 --- a/drivers/s390/cio/cio_debug.h +++ b/drivers/s390/cio/cio_debug.h | |||
@@ -31,10 +31,4 @@ static inline void CIO_HEX_EVENT(int level, void *data, int length) | |||
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | #define CIO_DEBUG(printk_level, event_level, msg...) do { \ | ||
35 | if (cio_show_msg) \ | ||
36 | printk(printk_level "cio: " msg); \ | ||
37 | CIO_MSG_EVENT(event_level, msg); \ | ||
38 | } while (0) | ||
39 | |||
40 | #endif | 34 | #endif |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 595e327d2f7..a76956512b2 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -570,7 +570,7 @@ static void reprobe_all(struct work_struct *unused) | |||
570 | { | 570 | { |
571 | int ret; | 571 | int ret; |
572 | 572 | ||
573 | CIO_MSG_EVENT(2, "reprobe start\n"); | 573 | CIO_MSG_EVENT(4, "reprobe start\n"); |
574 | 574 | ||
575 | need_reprobe = 0; | 575 | need_reprobe = 0; |
576 | /* Make sure initial subchannel scan is done. */ | 576 | /* Make sure initial subchannel scan is done. */ |
@@ -578,7 +578,7 @@ static void reprobe_all(struct work_struct *unused) | |||
578 | atomic_read(&ccw_device_init_count) == 0); | 578 | atomic_read(&ccw_device_init_count) == 0); |
579 | ret = for_each_subchannel_staged(NULL, reprobe_subchannel, NULL); | 579 | ret = for_each_subchannel_staged(NULL, reprobe_subchannel, NULL); |
580 | 580 | ||
581 | CIO_MSG_EVENT(2, "reprobe done (rc=%d, need_reprobe=%d)\n", ret, | 581 | CIO_MSG_EVENT(4, "reprobe done (rc=%d, need_reprobe=%d)\n", ret, |
582 | need_reprobe); | 582 | need_reprobe); |
583 | } | 583 | } |
584 | 584 | ||
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index abfd601d237..e22813db74a 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -341,7 +341,7 @@ ccw_device_remove_disconnected(struct ccw_device *cdev) | |||
341 | rc = device_schedule_callback(&cdev->dev, | 341 | rc = device_schedule_callback(&cdev->dev, |
342 | ccw_device_remove_orphan_cb); | 342 | ccw_device_remove_orphan_cb); |
343 | if (rc) | 343 | if (rc) |
344 | CIO_MSG_EVENT(2, "Couldn't unregister orphan " | 344 | CIO_MSG_EVENT(0, "Couldn't unregister orphan " |
345 | "0.%x.%04x\n", | 345 | "0.%x.%04x\n", |
346 | cdev->private->dev_id.ssid, | 346 | cdev->private->dev_id.ssid, |
347 | cdev->private->dev_id.devno); | 347 | cdev->private->dev_id.devno); |
@@ -351,7 +351,7 @@ ccw_device_remove_disconnected(struct ccw_device *cdev) | |||
351 | rc = device_schedule_callback(cdev->dev.parent, | 351 | rc = device_schedule_callback(cdev->dev.parent, |
352 | ccw_device_remove_sch_cb); | 352 | ccw_device_remove_sch_cb); |
353 | if (rc) | 353 | if (rc) |
354 | CIO_MSG_EVENT(2, "Couldn't unregister disconnected device " | 354 | CIO_MSG_EVENT(0, "Couldn't unregister disconnected device " |
355 | "0.%x.%04x\n", | 355 | "0.%x.%04x\n", |
356 | cdev->private->dev_id.ssid, | 356 | cdev->private->dev_id.ssid, |
357 | cdev->private->dev_id.devno); | 357 | cdev->private->dev_id.devno); |
@@ -397,7 +397,7 @@ int ccw_device_set_offline(struct ccw_device *cdev) | |||
397 | if (ret == 0) | 397 | if (ret == 0) |
398 | wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev)); | 398 | wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev)); |
399 | else { | 399 | else { |
400 | CIO_MSG_EVENT(2, "ccw_device_offline returned %d, " | 400 | CIO_MSG_EVENT(0, "ccw_device_offline returned %d, " |
401 | "device 0.%x.%04x\n", | 401 | "device 0.%x.%04x\n", |
402 | ret, cdev->private->dev_id.ssid, | 402 | ret, cdev->private->dev_id.ssid, |
403 | cdev->private->dev_id.devno); | 403 | cdev->private->dev_id.devno); |
@@ -433,7 +433,7 @@ int ccw_device_set_online(struct ccw_device *cdev) | |||
433 | if (ret == 0) | 433 | if (ret == 0) |
434 | wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev)); | 434 | wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev)); |
435 | else { | 435 | else { |
436 | CIO_MSG_EVENT(2, "ccw_device_online returned %d, " | 436 | CIO_MSG_EVENT(0, "ccw_device_online returned %d, " |
437 | "device 0.%x.%04x\n", | 437 | "device 0.%x.%04x\n", |
438 | ret, cdev->private->dev_id.ssid, | 438 | ret, cdev->private->dev_id.ssid, |
439 | cdev->private->dev_id.devno); | 439 | cdev->private->dev_id.devno); |
@@ -451,7 +451,7 @@ int ccw_device_set_online(struct ccw_device *cdev) | |||
451 | if (ret == 0) | 451 | if (ret == 0) |
452 | wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev)); | 452 | wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev)); |
453 | else | 453 | else |
454 | CIO_MSG_EVENT(2, "ccw_device_offline returned %d, " | 454 | CIO_MSG_EVENT(0, "ccw_device_offline returned %d, " |
455 | "device 0.%x.%04x\n", | 455 | "device 0.%x.%04x\n", |
456 | ret, cdev->private->dev_id.ssid, | 456 | ret, cdev->private->dev_id.ssid, |
457 | cdev->private->dev_id.devno); | 457 | cdev->private->dev_id.devno); |
@@ -803,7 +803,7 @@ static void sch_attach_disconnected_device(struct subchannel *sch, | |||
803 | other_sch = to_subchannel(get_device(cdev->dev.parent)); | 803 | other_sch = to_subchannel(get_device(cdev->dev.parent)); |
804 | ret = device_move(&cdev->dev, &sch->dev); | 804 | ret = device_move(&cdev->dev, &sch->dev); |
805 | if (ret) { | 805 | if (ret) { |
806 | CIO_MSG_EVENT(2, "Moving disconnected device 0.%x.%04x failed " | 806 | CIO_MSG_EVENT(0, "Moving disconnected device 0.%x.%04x failed " |
807 | "(ret=%d)!\n", cdev->private->dev_id.ssid, | 807 | "(ret=%d)!\n", cdev->private->dev_id.ssid, |
808 | cdev->private->dev_id.devno, ret); | 808 | cdev->private->dev_id.devno, ret); |
809 | put_device(&other_sch->dev); | 809 | put_device(&other_sch->dev); |
@@ -933,7 +933,7 @@ io_subchannel_register(struct work_struct *work) | |||
933 | ret = device_reprobe(&cdev->dev); | 933 | ret = device_reprobe(&cdev->dev); |
934 | if (ret) | 934 | if (ret) |
935 | /* We can't do much here. */ | 935 | /* We can't do much here. */ |
936 | CIO_MSG_EVENT(2, "device_reprobe() returned" | 936 | CIO_MSG_EVENT(0, "device_reprobe() returned" |
937 | " %d for 0.%x.%04x\n", ret, | 937 | " %d for 0.%x.%04x\n", ret, |
938 | cdev->private->dev_id.ssid, | 938 | cdev->private->dev_id.ssid, |
939 | cdev->private->dev_id.devno); | 939 | cdev->private->dev_id.devno); |
@@ -1086,7 +1086,7 @@ static void ccw_device_move_to_sch(struct work_struct *work) | |||
1086 | rc = device_move(&cdev->dev, &sch->dev); | 1086 | rc = device_move(&cdev->dev, &sch->dev); |
1087 | mutex_unlock(&sch->reg_mutex); | 1087 | mutex_unlock(&sch->reg_mutex); |
1088 | if (rc) { | 1088 | if (rc) { |
1089 | CIO_MSG_EVENT(2, "Moving device 0.%x.%04x to subchannel " | 1089 | CIO_MSG_EVENT(0, "Moving device 0.%x.%04x to subchannel " |
1090 | "0.%x.%04x failed (ret=%d)!\n", | 1090 | "0.%x.%04x failed (ret=%d)!\n", |
1091 | cdev->private->dev_id.ssid, | 1091 | cdev->private->dev_id.ssid, |
1092 | cdev->private->dev_id.devno, sch->schid.ssid, | 1092 | cdev->private->dev_id.devno, sch->schid.ssid, |
@@ -1446,8 +1446,7 @@ ccw_device_remove (struct device *dev) | |||
1446 | wait_event(cdev->private->wait_q, | 1446 | wait_event(cdev->private->wait_q, |
1447 | dev_fsm_final_state(cdev)); | 1447 | dev_fsm_final_state(cdev)); |
1448 | else | 1448 | else |
1449 | //FIXME: we can't fail! | 1449 | CIO_MSG_EVENT(0, "ccw_device_offline returned %d, " |
1450 | CIO_MSG_EVENT(2, "ccw_device_offline returned %d, " | ||
1451 | "device 0.%x.%04x\n", | 1450 | "device 0.%x.%04x\n", |
1452 | ret, cdev->private->dev_id.ssid, | 1451 | ret, cdev->private->dev_id.ssid, |
1453 | cdev->private->dev_id.devno); | 1452 | cdev->private->dev_id.devno); |
@@ -1524,7 +1523,7 @@ static int recovery_check(struct device *dev, void *data) | |||
1524 | spin_lock_irq(cdev->ccwlock); | 1523 | spin_lock_irq(cdev->ccwlock); |
1525 | switch (cdev->private->state) { | 1524 | switch (cdev->private->state) { |
1526 | case DEV_STATE_DISCONNECTED: | 1525 | case DEV_STATE_DISCONNECTED: |
1527 | CIO_MSG_EVENT(3, "recovery: trigger 0.%x.%04x\n", | 1526 | CIO_MSG_EVENT(4, "recovery: trigger 0.%x.%04x\n", |
1528 | cdev->private->dev_id.ssid, | 1527 | cdev->private->dev_id.ssid, |
1529 | cdev->private->dev_id.devno); | 1528 | cdev->private->dev_id.devno); |
1530 | dev_fsm_event(cdev, DEV_EVENT_VERIFY); | 1529 | dev_fsm_event(cdev, DEV_EVENT_VERIFY); |
@@ -1554,7 +1553,7 @@ static void recovery_work_func(struct work_struct *unused) | |||
1554 | } | 1553 | } |
1555 | spin_unlock_irq(&recovery_lock); | 1554 | spin_unlock_irq(&recovery_lock); |
1556 | } else | 1555 | } else |
1557 | CIO_MSG_EVENT(2, "recovery: end\n"); | 1556 | CIO_MSG_EVENT(4, "recovery: end\n"); |
1558 | } | 1557 | } |
1559 | 1558 | ||
1560 | static DECLARE_WORK(recovery_work, recovery_work_func); | 1559 | static DECLARE_WORK(recovery_work, recovery_work_func); |
@@ -1572,7 +1571,7 @@ void ccw_device_schedule_recovery(void) | |||
1572 | { | 1571 | { |
1573 | unsigned long flags; | 1572 | unsigned long flags; |
1574 | 1573 | ||
1575 | CIO_MSG_EVENT(2, "recovery: schedule\n"); | 1574 | CIO_MSG_EVENT(4, "recovery: schedule\n"); |
1576 | spin_lock_irqsave(&recovery_lock, flags); | 1575 | spin_lock_irqsave(&recovery_lock, flags); |
1577 | if (!timer_pending(&recovery_timer) || (recovery_phase != 0)) { | 1576 | if (!timer_pending(&recovery_timer) || (recovery_phase != 0)) { |
1578 | recovery_phase = 0; | 1577 | recovery_phase = 0; |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 99403b0a97a..e268d5a77c1 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -322,10 +322,10 @@ ccw_device_recog_done(struct ccw_device *cdev, int state) | |||
322 | same_dev = 0; /* Keep the compiler quiet... */ | 322 | same_dev = 0; /* Keep the compiler quiet... */ |
323 | switch (state) { | 323 | switch (state) { |
324 | case DEV_STATE_NOT_OPER: | 324 | case DEV_STATE_NOT_OPER: |
325 | CIO_DEBUG(KERN_WARNING, 2, | 325 | CIO_MSG_EVENT(2, "SenseID : unknown device %04x on " |
326 | "SenseID : unknown device %04x on subchannel " | 326 | "subchannel 0.%x.%04x\n", |
327 | "0.%x.%04x\n", cdev->private->dev_id.devno, | 327 | cdev->private->dev_id.devno, |
328 | sch->schid.ssid, sch->schid.sch_no); | 328 | sch->schid.ssid, sch->schid.sch_no); |
329 | break; | 329 | break; |
330 | case DEV_STATE_OFFLINE: | 330 | case DEV_STATE_OFFLINE: |
331 | if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID) { | 331 | if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID) { |
@@ -348,20 +348,19 @@ ccw_device_recog_done(struct ccw_device *cdev, int state) | |||
348 | return; | 348 | return; |
349 | } | 349 | } |
350 | /* Issue device info message. */ | 350 | /* Issue device info message. */ |
351 | CIO_DEBUG(KERN_INFO, 2, | 351 | CIO_MSG_EVENT(4, "SenseID : device 0.%x.%04x reports: " |
352 | "SenseID : device 0.%x.%04x reports: " | 352 | "CU Type/Mod = %04X/%02X, Dev Type/Mod = " |
353 | "CU Type/Mod = %04X/%02X, Dev Type/Mod = " | 353 | "%04X/%02X\n", |
354 | "%04X/%02X\n", | 354 | cdev->private->dev_id.ssid, |
355 | cdev->private->dev_id.ssid, | 355 | cdev->private->dev_id.devno, |
356 | cdev->private->dev_id.devno, | 356 | cdev->id.cu_type, cdev->id.cu_model, |
357 | cdev->id.cu_type, cdev->id.cu_model, | 357 | cdev->id.dev_type, cdev->id.dev_model); |
358 | cdev->id.dev_type, cdev->id.dev_model); | ||
359 | break; | 358 | break; |
360 | case DEV_STATE_BOXED: | 359 | case DEV_STATE_BOXED: |
361 | CIO_DEBUG(KERN_WARNING, 2, | 360 | CIO_MSG_EVENT(0, "SenseID : boxed device %04x on " |
362 | "SenseID : boxed device %04x on subchannel " | 361 | " subchannel 0.%x.%04x\n", |
363 | "0.%x.%04x\n", cdev->private->dev_id.devno, | 362 | cdev->private->dev_id.devno, |
364 | sch->schid.ssid, sch->schid.sch_no); | 363 | sch->schid.ssid, sch->schid.sch_no); |
365 | break; | 364 | break; |
366 | } | 365 | } |
367 | cdev->private->state = state; | 366 | cdev->private->state = state; |
@@ -443,9 +442,8 @@ ccw_device_done(struct ccw_device *cdev, int state) | |||
443 | 442 | ||
444 | 443 | ||
445 | if (state == DEV_STATE_BOXED) | 444 | if (state == DEV_STATE_BOXED) |
446 | CIO_DEBUG(KERN_WARNING, 2, | 445 | CIO_MSG_EVENT(0, "Boxed device %04x on subchannel %04x\n", |
447 | "Boxed device %04x on subchannel %04x\n", | 446 | cdev->private->dev_id.devno, sch->schid.sch_no); |
448 | cdev->private->dev_id.devno, sch->schid.sch_no); | ||
449 | 447 | ||
450 | if (cdev->private->flags.donotify) { | 448 | if (cdev->private->flags.donotify) { |
451 | cdev->private->flags.donotify = 0; | 449 | cdev->private->flags.donotify = 0; |
@@ -900,7 +898,7 @@ ccw_device_w4sense(struct ccw_device *cdev, enum dev_event dev_event) | |||
900 | /* Basic sense hasn't started. Try again. */ | 898 | /* Basic sense hasn't started. Try again. */ |
901 | ccw_device_do_sense(cdev, irb); | 899 | ccw_device_do_sense(cdev, irb); |
902 | else { | 900 | else { |
903 | CIO_MSG_EVENT(2, "Huh? 0.%x.%04x: unsolicited " | 901 | CIO_MSG_EVENT(0, "0.%x.%04x: unsolicited " |
904 | "interrupt during w4sense...\n", | 902 | "interrupt during w4sense...\n", |
905 | cdev->private->dev_id.ssid, | 903 | cdev->private->dev_id.ssid, |
906 | cdev->private->dev_id.devno); | 904 | cdev->private->dev_id.devno); |
@@ -1169,8 +1167,10 @@ ccw_device_nop(struct ccw_device *cdev, enum dev_event dev_event) | |||
1169 | static void | 1167 | static void |
1170 | ccw_device_bug(struct ccw_device *cdev, enum dev_event dev_event) | 1168 | ccw_device_bug(struct ccw_device *cdev, enum dev_event dev_event) |
1171 | { | 1169 | { |
1172 | CIO_MSG_EVENT(0, "dev_jumptable[%i][%i] == NULL\n", | 1170 | CIO_MSG_EVENT(0, "Internal state [%i][%i] not handled for device " |
1173 | cdev->private->state, dev_event); | 1171 | "0.%x.%04x\n", cdev->private->state, dev_event, |
1172 | cdev->private->dev_id.ssid, | ||
1173 | cdev->private->dev_id.devno); | ||
1174 | BUG(); | 1174 | BUG(); |
1175 | } | 1175 | } |
1176 | 1176 | ||
diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c index dc4d87f77f6..cba7020517e 100644 --- a/drivers/s390/cio/device_id.c +++ b/drivers/s390/cio/device_id.c | |||
@@ -214,7 +214,7 @@ ccw_device_check_sense_id(struct ccw_device *cdev) | |||
214 | * sense id information. So, for intervention required, | 214 | * sense id information. So, for intervention required, |
215 | * we use the "whack it until it talks" strategy... | 215 | * we use the "whack it until it talks" strategy... |
216 | */ | 216 | */ |
217 | CIO_MSG_EVENT(2, "SenseID : device %04x on Subchannel " | 217 | CIO_MSG_EVENT(0, "SenseID : device %04x on Subchannel " |
218 | "0.%x.%04x reports cmd reject\n", | 218 | "0.%x.%04x reports cmd reject\n", |
219 | cdev->private->dev_id.devno, sch->schid.ssid, | 219 | cdev->private->dev_id.devno, sch->schid.ssid, |
220 | sch->schid.sch_no); | 220 | sch->schid.sch_no); |
@@ -239,7 +239,7 @@ ccw_device_check_sense_id(struct ccw_device *cdev) | |||
239 | 239 | ||
240 | lpm = to_io_private(sch)->orb.lpm; | 240 | lpm = to_io_private(sch)->orb.lpm; |
241 | if ((lpm & sch->schib.pmcw.pim & sch->schib.pmcw.pam) != 0) | 241 | if ((lpm & sch->schib.pmcw.pim & sch->schib.pmcw.pam) != 0) |
242 | CIO_MSG_EVENT(2, "SenseID : path %02X for device %04x " | 242 | CIO_MSG_EVENT(4, "SenseID : path %02X for device %04x " |
243 | "on subchannel 0.%x.%04x is " | 243 | "on subchannel 0.%x.%04x is " |
244 | "'not operational'\n", lpm, | 244 | "'not operational'\n", lpm, |
245 | cdev->private->dev_id.devno, | 245 | cdev->private->dev_id.devno, |
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c index c52449a1f9f..ba559053402 100644 --- a/drivers/s390/cio/device_pgid.c +++ b/drivers/s390/cio/device_pgid.c | |||
@@ -79,7 +79,7 @@ __ccw_device_sense_pgid_start(struct ccw_device *cdev) | |||
79 | /* ret is 0, -EBUSY, -EACCES or -ENODEV */ | 79 | /* ret is 0, -EBUSY, -EACCES or -ENODEV */ |
80 | if (ret != -EACCES) | 80 | if (ret != -EACCES) |
81 | return ret; | 81 | return ret; |
82 | CIO_MSG_EVENT(2, "SNID - Device %04x on Subchannel " | 82 | CIO_MSG_EVENT(3, "SNID - Device %04x on Subchannel " |
83 | "0.%x.%04x, lpm %02X, became 'not " | 83 | "0.%x.%04x, lpm %02X, became 'not " |
84 | "operational'\n", | 84 | "operational'\n", |
85 | cdev->private->dev_id.devno, | 85 | cdev->private->dev_id.devno, |
@@ -159,7 +159,7 @@ __ccw_device_check_sense_pgid(struct ccw_device *cdev) | |||
159 | u8 lpm; | 159 | u8 lpm; |
160 | 160 | ||
161 | lpm = to_io_private(sch)->orb.lpm; | 161 | lpm = to_io_private(sch)->orb.lpm; |
162 | CIO_MSG_EVENT(2, "SNID - Device %04x on Subchannel 0.%x.%04x," | 162 | CIO_MSG_EVENT(3, "SNID - Device %04x on Subchannel 0.%x.%04x," |
163 | " lpm %02X, became 'not operational'\n", | 163 | " lpm %02X, became 'not operational'\n", |
164 | cdev->private->dev_id.devno, sch->schid.ssid, | 164 | cdev->private->dev_id.devno, sch->schid.ssid, |
165 | sch->schid.sch_no, lpm); | 165 | sch->schid.sch_no, lpm); |
@@ -275,7 +275,7 @@ __ccw_device_do_pgid(struct ccw_device *cdev, __u8 func) | |||
275 | return ret; | 275 | return ret; |
276 | } | 276 | } |
277 | /* PGID command failed on this path. */ | 277 | /* PGID command failed on this path. */ |
278 | CIO_MSG_EVENT(2, "SPID - Device %04x on Subchannel " | 278 | CIO_MSG_EVENT(3, "SPID - Device %04x on Subchannel " |
279 | "0.%x.%04x, lpm %02X, became 'not operational'\n", | 279 | "0.%x.%04x, lpm %02X, became 'not operational'\n", |
280 | cdev->private->dev_id.devno, sch->schid.ssid, | 280 | cdev->private->dev_id.devno, sch->schid.ssid, |
281 | sch->schid.sch_no, cdev->private->imask); | 281 | sch->schid.sch_no, cdev->private->imask); |
@@ -317,7 +317,7 @@ static int __ccw_device_do_nop(struct ccw_device *cdev) | |||
317 | return ret; | 317 | return ret; |
318 | } | 318 | } |
319 | /* nop command failed on this path. */ | 319 | /* nop command failed on this path. */ |
320 | CIO_MSG_EVENT(2, "NOP - Device %04x on Subchannel " | 320 | CIO_MSG_EVENT(3, "NOP - Device %04x on Subchannel " |
321 | "0.%x.%04x, lpm %02X, became 'not operational'\n", | 321 | "0.%x.%04x, lpm %02X, became 'not operational'\n", |
322 | cdev->private->dev_id.devno, sch->schid.ssid, | 322 | cdev->private->dev_id.devno, sch->schid.ssid, |
323 | sch->schid.sch_no, cdev->private->imask); | 323 | sch->schid.sch_no, cdev->private->imask); |
@@ -362,7 +362,7 @@ __ccw_device_check_pgid(struct ccw_device *cdev) | |||
362 | return -EAGAIN; | 362 | return -EAGAIN; |
363 | } | 363 | } |
364 | if (irb->scsw.cc == 3) { | 364 | if (irb->scsw.cc == 3) { |
365 | CIO_MSG_EVENT(2, "SPID - Device %04x on Subchannel 0.%x.%04x," | 365 | CIO_MSG_EVENT(3, "SPID - Device %04x on Subchannel 0.%x.%04x," |
366 | " lpm %02X, became 'not operational'\n", | 366 | " lpm %02X, became 'not operational'\n", |
367 | cdev->private->dev_id.devno, sch->schid.ssid, | 367 | cdev->private->dev_id.devno, sch->schid.ssid, |
368 | sch->schid.sch_no, cdev->private->imask); | 368 | sch->schid.sch_no, cdev->private->imask); |
@@ -391,7 +391,7 @@ static int __ccw_device_check_nop(struct ccw_device *cdev) | |||
391 | return -ETIME; | 391 | return -ETIME; |
392 | } | 392 | } |
393 | if (irb->scsw.cc == 3) { | 393 | if (irb->scsw.cc == 3) { |
394 | CIO_MSG_EVENT(2, "NOP - Device %04x on Subchannel 0.%x.%04x," | 394 | CIO_MSG_EVENT(3, "NOP - Device %04x on Subchannel 0.%x.%04x," |
395 | " lpm %02X, became 'not operational'\n", | 395 | " lpm %02X, became 'not operational'\n", |
396 | cdev->private->dev_id.devno, sch->schid.ssid, | 396 | cdev->private->dev_id.devno, sch->schid.ssid, |
397 | sch->schid.sch_no, cdev->private->imask); | 397 | sch->schid.sch_no, cdev->private->imask); |
diff --git a/drivers/s390/s390mach.c b/drivers/s390/s390mach.c index 4d4b54277c4..5080f343ad7 100644 --- a/drivers/s390/s390mach.c +++ b/drivers/s390/s390mach.c | |||
@@ -48,10 +48,11 @@ s390_collect_crw_info(void *param) | |||
48 | int ccode; | 48 | int ccode; |
49 | struct semaphore *sem; | 49 | struct semaphore *sem; |
50 | unsigned int chain; | 50 | unsigned int chain; |
51 | int ignore; | ||
51 | 52 | ||
52 | sem = (struct semaphore *)param; | 53 | sem = (struct semaphore *)param; |
53 | repeat: | 54 | repeat: |
54 | down_interruptible(sem); | 55 | ignore = down_interruptible(sem); |
55 | chain = 0; | 56 | chain = 0; |
56 | while (1) { | 57 | while (1) { |
57 | if (unlikely(chain > 1)) { | 58 | if (unlikely(chain > 1)) { |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 46d7e400c8b..81ccbd7f9e3 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -1679,6 +1679,7 @@ config MAC_SCSI | |||
1679 | config SCSI_MAC_ESP | 1679 | config SCSI_MAC_ESP |
1680 | tristate "Macintosh NCR53c9[46] SCSI" | 1680 | tristate "Macintosh NCR53c9[46] SCSI" |
1681 | depends on MAC && SCSI | 1681 | depends on MAC && SCSI |
1682 | select SCSI_SPI_ATTRS | ||
1682 | help | 1683 | help |
1683 | This is the NCR 53c9x SCSI controller found on most of the 68040 | 1684 | This is the NCR 53c9x SCSI controller found on most of the 68040 |
1684 | based Macintoshes. | 1685 | based Macintoshes. |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 0fb5bf4c43a..8508816f303 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -1967,45 +1967,6 @@ cleanup: | |||
1967 | return rcode; | 1967 | return rcode; |
1968 | } | 1968 | } |
1969 | 1969 | ||
1970 | |||
1971 | /* | ||
1972 | * This routine returns information about the system. This does not effect | ||
1973 | * any logic and if the info is wrong - it doesn't matter. | ||
1974 | */ | ||
1975 | |||
1976 | /* Get all the info we can not get from kernel services */ | ||
1977 | static int adpt_system_info(void __user *buffer) | ||
1978 | { | ||
1979 | sysInfo_S si; | ||
1980 | |||
1981 | memset(&si, 0, sizeof(si)); | ||
1982 | |||
1983 | si.osType = OS_LINUX; | ||
1984 | si.osMajorVersion = 0; | ||
1985 | si.osMinorVersion = 0; | ||
1986 | si.osRevision = 0; | ||
1987 | si.busType = SI_PCI_BUS; | ||
1988 | si.processorFamily = DPTI_sig.dsProcessorFamily; | ||
1989 | |||
1990 | #if defined __i386__ | ||
1991 | adpt_i386_info(&si); | ||
1992 | #elif defined (__ia64__) | ||
1993 | adpt_ia64_info(&si); | ||
1994 | #elif defined(__sparc__) | ||
1995 | adpt_sparc_info(&si); | ||
1996 | #elif defined (__alpha__) | ||
1997 | adpt_alpha_info(&si); | ||
1998 | #else | ||
1999 | si.processorType = 0xff ; | ||
2000 | #endif | ||
2001 | if(copy_to_user(buffer, &si, sizeof(si))){ | ||
2002 | printk(KERN_WARNING"dpti: Could not copy buffer TO user\n"); | ||
2003 | return -EFAULT; | ||
2004 | } | ||
2005 | |||
2006 | return 0; | ||
2007 | } | ||
2008 | |||
2009 | #if defined __ia64__ | 1970 | #if defined __ia64__ |
2010 | static void adpt_ia64_info(sysInfo_S* si) | 1971 | static void adpt_ia64_info(sysInfo_S* si) |
2011 | { | 1972 | { |
@@ -2016,7 +1977,6 @@ static void adpt_ia64_info(sysInfo_S* si) | |||
2016 | } | 1977 | } |
2017 | #endif | 1978 | #endif |
2018 | 1979 | ||
2019 | |||
2020 | #if defined __sparc__ | 1980 | #if defined __sparc__ |
2021 | static void adpt_sparc_info(sysInfo_S* si) | 1981 | static void adpt_sparc_info(sysInfo_S* si) |
2022 | { | 1982 | { |
@@ -2026,7 +1986,6 @@ static void adpt_sparc_info(sysInfo_S* si) | |||
2026 | si->processorType = PROC_ULTRASPARC; | 1986 | si->processorType = PROC_ULTRASPARC; |
2027 | } | 1987 | } |
2028 | #endif | 1988 | #endif |
2029 | |||
2030 | #if defined __alpha__ | 1989 | #if defined __alpha__ |
2031 | static void adpt_alpha_info(sysInfo_S* si) | 1990 | static void adpt_alpha_info(sysInfo_S* si) |
2032 | { | 1991 | { |
@@ -2038,7 +1997,6 @@ static void adpt_alpha_info(sysInfo_S* si) | |||
2038 | #endif | 1997 | #endif |
2039 | 1998 | ||
2040 | #if defined __i386__ | 1999 | #if defined __i386__ |
2041 | |||
2042 | static void adpt_i386_info(sysInfo_S* si) | 2000 | static void adpt_i386_info(sysInfo_S* si) |
2043 | { | 2001 | { |
2044 | // This is all the info we need for now | 2002 | // This is all the info we need for now |
@@ -2059,9 +2017,45 @@ static void adpt_i386_info(sysInfo_S* si) | |||
2059 | break; | 2017 | break; |
2060 | } | 2018 | } |
2061 | } | 2019 | } |
2020 | #endif | ||
2021 | |||
2022 | /* | ||
2023 | * This routine returns information about the system. This does not effect | ||
2024 | * any logic and if the info is wrong - it doesn't matter. | ||
2025 | */ | ||
2062 | 2026 | ||
2027 | /* Get all the info we can not get from kernel services */ | ||
2028 | static int adpt_system_info(void __user *buffer) | ||
2029 | { | ||
2030 | sysInfo_S si; | ||
2031 | |||
2032 | memset(&si, 0, sizeof(si)); | ||
2033 | |||
2034 | si.osType = OS_LINUX; | ||
2035 | si.osMajorVersion = 0; | ||
2036 | si.osMinorVersion = 0; | ||
2037 | si.osRevision = 0; | ||
2038 | si.busType = SI_PCI_BUS; | ||
2039 | si.processorFamily = DPTI_sig.dsProcessorFamily; | ||
2040 | |||
2041 | #if defined __i386__ | ||
2042 | adpt_i386_info(&si); | ||
2043 | #elif defined (__ia64__) | ||
2044 | adpt_ia64_info(&si); | ||
2045 | #elif defined(__sparc__) | ||
2046 | adpt_sparc_info(&si); | ||
2047 | #elif defined (__alpha__) | ||
2048 | adpt_alpha_info(&si); | ||
2049 | #else | ||
2050 | si.processorType = 0xff ; | ||
2063 | #endif | 2051 | #endif |
2052 | if (copy_to_user(buffer, &si, sizeof(si))){ | ||
2053 | printk(KERN_WARNING"dpti: Could not copy buffer TO user\n"); | ||
2054 | return -EFAULT; | ||
2055 | } | ||
2064 | 2056 | ||
2057 | return 0; | ||
2058 | } | ||
2065 | 2059 | ||
2066 | static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, | 2060 | static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, |
2067 | ulong arg) | 2061 | ulong arg) |
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h index 924cd5a5167..337746d4604 100644 --- a/drivers/scsi/dpti.h +++ b/drivers/scsi/dpti.h | |||
@@ -316,19 +316,6 @@ static int adpt_close(struct inode *inode, struct file *file); | |||
316 | static void adpt_delay(int millisec); | 316 | static void adpt_delay(int millisec); |
317 | #endif | 317 | #endif |
318 | 318 | ||
319 | #if defined __ia64__ | ||
320 | static void adpt_ia64_info(sysInfo_S* si); | ||
321 | #endif | ||
322 | #if defined __sparc__ | ||
323 | static void adpt_sparc_info(sysInfo_S* si); | ||
324 | #endif | ||
325 | #if defined __alpha__ | ||
326 | static void adpt_sparc_info(sysInfo_S* si); | ||
327 | #endif | ||
328 | #if defined __i386__ | ||
329 | static void adpt_i386_info(sysInfo_S* si); | ||
330 | #endif | ||
331 | |||
332 | #define PRINT_BUFFER_SIZE 512 | 319 | #define PRINT_BUFFER_SIZE 512 |
333 | 320 | ||
334 | #define HBA_FLAGS_DBG_FLAGS_MASK 0xffff0000 // Mask for debug flags | 321 | #define HBA_FLAGS_DBG_FLAGS_MASK 0xffff0000 // Mask for debug flags |
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 8a2f6a1baa7..d6b4ead693b 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
@@ -65,9 +65,6 @@ static void bfin_serial_stop_tx(struct uart_port *port) | |||
65 | { | 65 | { |
66 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; | 66 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; |
67 | struct circ_buf *xmit = &uart->port.info->xmit; | 67 | struct circ_buf *xmit = &uart->port.info->xmit; |
68 | #if !defined(CONFIG_BF54x) && !defined(CONFIG_SERIAL_BFIN_DMA) | ||
69 | unsigned short ier; | ||
70 | #endif | ||
71 | 68 | ||
72 | while (!(UART_GET_LSR(uart) & TEMT)) | 69 | while (!(UART_GET_LSR(uart) & TEMT)) |
73 | cpu_relax(); | 70 | cpu_relax(); |
@@ -82,12 +79,8 @@ static void bfin_serial_stop_tx(struct uart_port *port) | |||
82 | #ifdef CONFIG_BF54x | 79 | #ifdef CONFIG_BF54x |
83 | /* Clear TFI bit */ | 80 | /* Clear TFI bit */ |
84 | UART_PUT_LSR(uart, TFI); | 81 | UART_PUT_LSR(uart, TFI); |
85 | UART_CLEAR_IER(uart, ETBEI); | ||
86 | #else | ||
87 | ier = UART_GET_IER(uart); | ||
88 | ier &= ~ETBEI; | ||
89 | UART_PUT_IER(uart, ier); | ||
90 | #endif | 82 | #endif |
83 | UART_CLEAR_IER(uart, ETBEI); | ||
91 | #endif | 84 | #endif |
92 | } | 85 | } |
93 | 86 | ||
@@ -102,14 +95,7 @@ static void bfin_serial_start_tx(struct uart_port *port) | |||
102 | if (uart->tx_done) | 95 | if (uart->tx_done) |
103 | bfin_serial_dma_tx_chars(uart); | 96 | bfin_serial_dma_tx_chars(uart); |
104 | #else | 97 | #else |
105 | #ifdef CONFIG_BF54x | ||
106 | UART_SET_IER(uart, ETBEI); | 98 | UART_SET_IER(uart, ETBEI); |
107 | #else | ||
108 | unsigned short ier; | ||
109 | ier = UART_GET_IER(uart); | ||
110 | ier |= ETBEI; | ||
111 | UART_PUT_IER(uart, ier); | ||
112 | #endif | ||
113 | bfin_serial_tx_chars(uart); | 99 | bfin_serial_tx_chars(uart); |
114 | #endif | 100 | #endif |
115 | } | 101 | } |
@@ -120,21 +106,10 @@ static void bfin_serial_start_tx(struct uart_port *port) | |||
120 | static void bfin_serial_stop_rx(struct uart_port *port) | 106 | static void bfin_serial_stop_rx(struct uart_port *port) |
121 | { | 107 | { |
122 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; | 108 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; |
123 | #ifdef CONFIG_KGDB_UART | 109 | #ifdef CONFIG_KGDB_UART |
124 | if (uart->port.line != CONFIG_KGDB_UART_PORT) { | 110 | if (uart->port.line != CONFIG_KGDB_UART_PORT) |
125 | #endif | 111 | #endif |
126 | #ifdef CONFIG_BF54x | ||
127 | UART_CLEAR_IER(uart, ERBFI); | 112 | UART_CLEAR_IER(uart, ERBFI); |
128 | #else | ||
129 | unsigned short ier; | ||
130 | |||
131 | ier = UART_GET_IER(uart); | ||
132 | ier &= ~ERBFI; | ||
133 | UART_PUT_IER(uart, ier); | ||
134 | #endif | ||
135 | #ifdef CONFIG_KGDB_UART | ||
136 | } | ||
137 | #endif | ||
138 | } | 113 | } |
139 | 114 | ||
140 | /* | 115 | /* |
@@ -161,10 +136,7 @@ void kgdb_put_debug_char(int chr) | |||
161 | SSYNC(); | 136 | SSYNC(); |
162 | } | 137 | } |
163 | 138 | ||
164 | #ifndef CONFIG_BF54x | 139 | UART_CLEAR_DLAB(uart); |
165 | UART_PUT_LCR(uart, UART_GET_LCR(uart)&(~DLAB)); | ||
166 | SSYNC(); | ||
167 | #endif | ||
168 | UART_PUT_CHAR(uart, (unsigned char)chr); | 140 | UART_PUT_CHAR(uart, (unsigned char)chr); |
169 | SSYNC(); | 141 | SSYNC(); |
170 | } | 142 | } |
@@ -183,10 +155,7 @@ int kgdb_get_debug_char(void) | |||
183 | while(!(UART_GET_LSR(uart) & DR)) { | 155 | while(!(UART_GET_LSR(uart) & DR)) { |
184 | SSYNC(); | 156 | SSYNC(); |
185 | } | 157 | } |
186 | #ifndef CONFIG_BF54x | 158 | UART_CLEAR_DLAB(uart); |
187 | UART_PUT_LCR(uart, UART_GET_LCR(uart)&(~DLAB)); | ||
188 | SSYNC(); | ||
189 | #endif | ||
190 | chr = UART_GET_CHAR(uart); | 159 | chr = UART_GET_CHAR(uart); |
191 | SSYNC(); | 160 | SSYNC(); |
192 | 161 | ||
@@ -208,9 +177,6 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | |||
208 | struct tty_struct *tty = uart->port.info->tty; | 177 | struct tty_struct *tty = uart->port.info->tty; |
209 | unsigned int status, ch, flg; | 178 | unsigned int status, ch, flg; |
210 | static struct timeval anomaly_start = { .tv_sec = 0 }; | 179 | static struct timeval anomaly_start = { .tv_sec = 0 }; |
211 | #ifdef CONFIG_KGDB_UART | ||
212 | struct pt_regs *regs = get_irq_regs(); | ||
213 | #endif | ||
214 | 180 | ||
215 | status = UART_GET_LSR(uart); | 181 | status = UART_GET_LSR(uart); |
216 | UART_CLEAR_LSR(uart); | 182 | UART_CLEAR_LSR(uart); |
@@ -220,6 +186,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | |||
220 | 186 | ||
221 | #ifdef CONFIG_KGDB_UART | 187 | #ifdef CONFIG_KGDB_UART |
222 | if (uart->port.line == CONFIG_KGDB_UART_PORT) { | 188 | if (uart->port.line == CONFIG_KGDB_UART_PORT) { |
189 | struct pt_regs *regs = get_irq_regs(); | ||
223 | if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */ | 190 | if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */ |
224 | kgdb_breakkey_pressed(regs); | 191 | kgdb_breakkey_pressed(regs); |
225 | return; | 192 | return; |
@@ -391,7 +358,6 @@ static void bfin_serial_do_work(struct work_struct *work) | |||
391 | static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) | 358 | static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) |
392 | { | 359 | { |
393 | struct circ_buf *xmit = &uart->port.info->xmit; | 360 | struct circ_buf *xmit = &uart->port.info->xmit; |
394 | unsigned short ier; | ||
395 | 361 | ||
396 | uart->tx_done = 0; | 362 | uart->tx_done = 0; |
397 | 363 | ||
@@ -429,13 +395,7 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) | |||
429 | set_dma_x_modify(uart->tx_dma_channel, 1); | 395 | set_dma_x_modify(uart->tx_dma_channel, 1); |
430 | enable_dma(uart->tx_dma_channel); | 396 | enable_dma(uart->tx_dma_channel); |
431 | 397 | ||
432 | #ifdef CONFIG_BF54x | ||
433 | UART_SET_IER(uart, ETBEI); | 398 | UART_SET_IER(uart, ETBEI); |
434 | #else | ||
435 | ier = UART_GET_IER(uart); | ||
436 | ier |= ETBEI; | ||
437 | UART_PUT_IER(uart, ier); | ||
438 | #endif | ||
439 | } | 399 | } |
440 | 400 | ||
441 | static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) | 401 | static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) |
@@ -513,19 +473,12 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id) | |||
513 | { | 473 | { |
514 | struct bfin_serial_port *uart = dev_id; | 474 | struct bfin_serial_port *uart = dev_id; |
515 | struct circ_buf *xmit = &uart->port.info->xmit; | 475 | struct circ_buf *xmit = &uart->port.info->xmit; |
516 | unsigned short ier; | ||
517 | 476 | ||
518 | spin_lock(&uart->port.lock); | 477 | spin_lock(&uart->port.lock); |
519 | if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) { | 478 | if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) { |
520 | disable_dma(uart->tx_dma_channel); | 479 | disable_dma(uart->tx_dma_channel); |
521 | clear_dma_irqstat(uart->tx_dma_channel); | 480 | clear_dma_irqstat(uart->tx_dma_channel); |
522 | #ifdef CONFIG_BF54x | ||
523 | UART_CLEAR_IER(uart, ETBEI); | 481 | UART_CLEAR_IER(uart, ETBEI); |
524 | #else | ||
525 | ier = UART_GET_IER(uart); | ||
526 | ier &= ~ETBEI; | ||
527 | UART_PUT_IER(uart, ier); | ||
528 | #endif | ||
529 | xmit->tail = (xmit->tail + uart->tx_count) & (UART_XMIT_SIZE - 1); | 482 | xmit->tail = (xmit->tail + uart->tx_count) & (UART_XMIT_SIZE - 1); |
530 | uart->port.icount.tx += uart->tx_count; | 483 | uart->port.icount.tx += uart->tx_count; |
531 | 484 | ||
@@ -701,7 +654,6 @@ static int bfin_serial_startup(struct uart_port *port) | |||
701 | # endif | 654 | # endif |
702 | } | 655 | } |
703 | 656 | ||
704 | |||
705 | if (request_irq | 657 | if (request_irq |
706 | (uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED, | 658 | (uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED, |
707 | "BFIN_UART_TX", uart)) { | 659 | "BFIN_UART_TX", uart)) { |
@@ -710,11 +662,7 @@ static int bfin_serial_startup(struct uart_port *port) | |||
710 | return -EBUSY; | 662 | return -EBUSY; |
711 | } | 663 | } |
712 | #endif | 664 | #endif |
713 | #ifdef CONFIG_BF54x | ||
714 | UART_SET_IER(uart, ERBFI); | 665 | UART_SET_IER(uart, ERBFI); |
715 | #else | ||
716 | UART_PUT_IER(uart, UART_GET_IER(uart) | ERBFI); | ||
717 | #endif | ||
718 | return 0; | 666 | return 0; |
719 | } | 667 | } |
720 | 668 | ||
@@ -810,26 +758,15 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
810 | UART_PUT_IER(uart, 0); | 758 | UART_PUT_IER(uart, 0); |
811 | #endif | 759 | #endif |
812 | 760 | ||
813 | #ifndef CONFIG_BF54x | ||
814 | /* Set DLAB in LCR to Access DLL and DLH */ | 761 | /* Set DLAB in LCR to Access DLL and DLH */ |
815 | val = UART_GET_LCR(uart); | 762 | UART_SET_DLAB(uart); |
816 | val |= DLAB; | ||
817 | UART_PUT_LCR(uart, val); | ||
818 | SSYNC(); | ||
819 | #endif | ||
820 | 763 | ||
821 | UART_PUT_DLL(uart, quot & 0xFF); | 764 | UART_PUT_DLL(uart, quot & 0xFF); |
822 | SSYNC(); | ||
823 | UART_PUT_DLH(uart, (quot >> 8) & 0xFF); | 765 | UART_PUT_DLH(uart, (quot >> 8) & 0xFF); |
824 | SSYNC(); | 766 | SSYNC(); |
825 | 767 | ||
826 | #ifndef CONFIG_BF54x | ||
827 | /* Clear DLAB in LCR to Access THR RBR IER */ | 768 | /* Clear DLAB in LCR to Access THR RBR IER */ |
828 | val = UART_GET_LCR(uart); | 769 | UART_CLEAR_DLAB(uart); |
829 | val &= ~DLAB; | ||
830 | UART_PUT_LCR(uart, val); | ||
831 | SSYNC(); | ||
832 | #endif | ||
833 | 770 | ||
834 | UART_PUT_LCR(uart, lcr); | 771 | UART_PUT_LCR(uart, lcr); |
835 | 772 | ||
@@ -992,8 +929,7 @@ bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud, | |||
992 | status = UART_GET_IER(uart) & (ERBFI | ETBEI); | 929 | status = UART_GET_IER(uart) & (ERBFI | ETBEI); |
993 | if (status == (ERBFI | ETBEI)) { | 930 | if (status == (ERBFI | ETBEI)) { |
994 | /* ok, the port was enabled */ | 931 | /* ok, the port was enabled */ |
995 | unsigned short lcr, val; | 932 | u16 lcr, dlh, dll; |
996 | unsigned short dlh, dll; | ||
997 | 933 | ||
998 | lcr = UART_GET_LCR(uart); | 934 | lcr = UART_GET_LCR(uart); |
999 | 935 | ||
@@ -1010,22 +946,14 @@ bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud, | |||
1010 | case 2: *bits = 7; break; | 946 | case 2: *bits = 7; break; |
1011 | case 3: *bits = 8; break; | 947 | case 3: *bits = 8; break; |
1012 | } | 948 | } |
1013 | #ifndef CONFIG_BF54x | ||
1014 | /* Set DLAB in LCR to Access DLL and DLH */ | 949 | /* Set DLAB in LCR to Access DLL and DLH */ |
1015 | val = UART_GET_LCR(uart); | 950 | UART_SET_DLAB(uart); |
1016 | val |= DLAB; | ||
1017 | UART_PUT_LCR(uart, val); | ||
1018 | #endif | ||
1019 | 951 | ||
1020 | dll = UART_GET_DLL(uart); | 952 | dll = UART_GET_DLL(uart); |
1021 | dlh = UART_GET_DLH(uart); | 953 | dlh = UART_GET_DLH(uart); |
1022 | 954 | ||
1023 | #ifndef CONFIG_BF54x | ||
1024 | /* Clear DLAB in LCR to Access THR RBR IER */ | 955 | /* Clear DLAB in LCR to Access THR RBR IER */ |
1025 | val = UART_GET_LCR(uart); | 956 | UART_CLEAR_DLAB(uart); |
1026 | val &= ~DLAB; | ||
1027 | UART_PUT_LCR(uart, val); | ||
1028 | #endif | ||
1029 | 957 | ||
1030 | *baud = get_sclk() / (16*(dll | dlh << 8)); | 958 | *baud = get_sclk() / (16*(dll | dlh << 8)); |
1031 | } | 959 | } |
@@ -1290,11 +1218,7 @@ static int __init bfin_serial_init(void) | |||
1290 | request_irq(uart->port.irq, bfin_serial_rx_int, | 1218 | request_irq(uart->port.irq, bfin_serial_rx_int, |
1291 | IRQF_DISABLED, "BFIN_UART_RX", uart); | 1219 | IRQF_DISABLED, "BFIN_UART_RX", uart); |
1292 | pr_info("Request irq for kgdb uart port\n"); | 1220 | pr_info("Request irq for kgdb uart port\n"); |
1293 | #ifdef CONFIG_BF54x | ||
1294 | UART_SET_IER(uart, ERBFI); | 1221 | UART_SET_IER(uart, ERBFI); |
1295 | #else | ||
1296 | UART_PUT_IER(uart, UART_GET_IER(uart) | ERBFI); | ||
1297 | #endif | ||
1298 | SSYNC(); | 1222 | SSYNC(); |
1299 | t.c_cflag = CS8|B57600; | 1223 | t.c_cflag = CS8|B57600; |
1300 | t.c_iflag = 0; | 1224 | t.c_iflag = 0; |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 1e2b9d826f6..eab03273379 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -556,7 +556,7 @@ static int uart_chars_in_buffer(struct tty_struct *tty) | |||
556 | static void uart_flush_buffer(struct tty_struct *tty) | 556 | static void uart_flush_buffer(struct tty_struct *tty) |
557 | { | 557 | { |
558 | struct uart_state *state = tty->driver_data; | 558 | struct uart_state *state = tty->driver_data; |
559 | struct uart_port *port = state->port; | 559 | struct uart_port *port; |
560 | unsigned long flags; | 560 | unsigned long flags; |
561 | 561 | ||
562 | /* | 562 | /* |
@@ -568,6 +568,7 @@ static void uart_flush_buffer(struct tty_struct *tty) | |||
568 | return; | 568 | return; |
569 | } | 569 | } |
570 | 570 | ||
571 | port = state->port; | ||
571 | pr_debug("uart_flush_buffer(%d) called\n", tty->index); | 572 | pr_debug("uart_flush_buffer(%d) called\n", tty->index); |
572 | 573 | ||
573 | spin_lock_irqsave(&port->lock, flags); | 574 | spin_lock_irqsave(&port->lock, flags); |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 96910618771..8fdafc27fce 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -42,14 +42,12 @@ | |||
42 | #include <linux/console.h> | 42 | #include <linux/console.h> |
43 | #include <linux/platform_device.h> | 43 | #include <linux/platform_device.h> |
44 | #include <linux/serial_sci.h> | 44 | #include <linux/serial_sci.h> |
45 | |||
46 | #ifdef CONFIG_CPU_FREQ | ||
47 | #include <linux/notifier.h> | 45 | #include <linux/notifier.h> |
48 | #include <linux/cpufreq.h> | 46 | #include <linux/cpufreq.h> |
49 | #endif | 47 | #include <linux/clk.h> |
50 | |||
51 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | ||
52 | #include <linux/ctype.h> | 48 | #include <linux/ctype.h> |
49 | |||
50 | #ifdef CONFIG_SUPERH | ||
53 | #include <asm/clock.h> | 51 | #include <asm/clock.h> |
54 | #include <asm/sh_bios.h> | 52 | #include <asm/sh_bios.h> |
55 | #include <asm/kgdb.h> | 53 | #include <asm/kgdb.h> |
@@ -80,7 +78,7 @@ struct sci_port { | |||
80 | struct timer_list break_timer; | 78 | struct timer_list break_timer; |
81 | int break_flag; | 79 | int break_flag; |
82 | 80 | ||
83 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | 81 | #ifdef CONFIG_SUPERH |
84 | /* Port clock */ | 82 | /* Port clock */ |
85 | struct clk *clk; | 83 | struct clk *clk; |
86 | #endif | 84 | #endif |
@@ -365,21 +363,19 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) | |||
365 | static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) | 363 | static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) |
366 | { | 364 | { |
367 | unsigned int fcr_val = 0; | 365 | unsigned int fcr_val = 0; |
366 | unsigned short data; | ||
368 | 367 | ||
369 | if (cflag & CRTSCTS) { | 368 | if (port->mapbase == 0xffe00000) { |
370 | fcr_val |= SCFCR_MCE; | 369 | data = ctrl_inw(PSCR); |
371 | 370 | data &= ~0x03cf; | |
372 | ctrl_outw(0x0000, PORT_PSCR); | 371 | if (cflag & CRTSCTS) |
373 | } else { | 372 | fcr_val |= SCFCR_MCE; |
374 | unsigned short data; | 373 | else |
375 | 374 | data |= 0x0340; | |
376 | data = ctrl_inw(PORT_PSCR); | ||
377 | data &= 0x033f; | ||
378 | data |= 0x0400; | ||
379 | ctrl_outw(data, PORT_PSCR); | ||
380 | 375 | ||
381 | ctrl_outw(ctrl_inw(SCSPTR0) & 0x17, SCSPTR0); | 376 | ctrl_outw(data, PSCR); |
382 | } | 377 | } |
378 | /* SCIF1 and SCIF2 should be setup by board code */ | ||
383 | 379 | ||
384 | sci_out(port, SCFCR, fcr_val); | 380 | sci_out(port, SCFCR, fcr_val); |
385 | } | 381 | } |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index fa8700a968f..eb84833233f 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -76,12 +76,13 @@ | |||
76 | # define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0,CKE=1 */ | 76 | # define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0,CKE=1 */ |
77 | # define SCIF_ONLY | 77 | # define SCIF_ONLY |
78 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) | 78 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) |
79 | # define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */ | 79 | # define PADR 0xA4050120 |
80 | # define SCSPTR0 SCPDR0 | 80 | # define PSDR 0xA405013e |
81 | # define PWDR 0xA4050166 | ||
82 | # define PSCR 0xA405011E | ||
81 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 83 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
82 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 84 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
83 | # define SCIF_ONLY | 85 | # define SCIF_ONLY |
84 | # define PORT_PSCR 0xA405011E | ||
85 | #elif defined(CONFIG_CPU_SUBTYPE_SH7366) | 86 | #elif defined(CONFIG_CPU_SUBTYPE_SH7366) |
86 | # define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */ | 87 | # define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */ |
87 | # define SCSPTR0 SCPDR0 | 88 | # define SCSPTR0 SCPDR0 |
@@ -320,7 +321,7 @@ | |||
320 | unsigned int addr = port->mapbase + (offset); \ | 321 | unsigned int addr = port->mapbase + (offset); \ |
321 | if ((size) == 8) { \ | 322 | if ((size) == 8) { \ |
322 | ctrl_outb(value, addr); \ | 323 | ctrl_outb(value, addr); \ |
323 | } else { \ | 324 | } else if ((size) == 16) { \ |
324 | ctrl_outw(value, addr); \ | 325 | ctrl_outw(value, addr); \ |
325 | } | 326 | } |
326 | 327 | ||
@@ -451,7 +452,11 @@ SCIF_FNS(SCSPTR, 0, 0, 0x24, 16) | |||
451 | SCIF_FNS(SCLSR, 0, 0, 0x28, 16) | 452 | SCIF_FNS(SCLSR, 0, 0, 0x28, 16) |
452 | #else | 453 | #else |
453 | SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) | 454 | SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) |
455 | #if defined(CONFIG_CPU_SUBTYPE_SH7722) | ||
456 | SCIF_FNS(SCSPTR, 0, 0, 0, 0) | ||
457 | #else | ||
454 | SCIF_FNS(SCSPTR, 0, 0, 0x20, 16) | 458 | SCIF_FNS(SCSPTR, 0, 0, 0x20, 16) |
459 | #endif | ||
455 | SCIF_FNS(SCLSR, 0, 0, 0x24, 16) | 460 | SCIF_FNS(SCLSR, 0, 0, 0x24, 16) |
456 | #endif | 461 | #endif |
457 | #endif | 462 | #endif |
@@ -593,13 +598,25 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
593 | return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ | 598 | return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ |
594 | return 1; | 599 | return 1; |
595 | } | 600 | } |
596 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) || defined(CONFIG_CPU_SUBTYPE_SH7366) | 601 | #elif defined(CONFIG_CPU_SUBTYPE_SH7366) |
597 | static inline int sci_rxd_in(struct uart_port *port) | 602 | static inline int sci_rxd_in(struct uart_port *port) |
598 | { | 603 | { |
599 | if (port->mapbase == 0xffe00000) | 604 | if (port->mapbase == 0xffe00000) |
600 | return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */ | 605 | return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */ |
601 | return 1; | 606 | return 1; |
602 | } | 607 | } |
608 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) | ||
609 | static inline int sci_rxd_in(struct uart_port *port) | ||
610 | { | ||
611 | if (port->mapbase == 0xffe00000) | ||
612 | return ctrl_inb(PSDR) & 0x02 ? 1 : 0; /* SCIF0 */ | ||
613 | if (port->mapbase == 0xffe10000) | ||
614 | return ctrl_inb(PADR) & 0x40 ? 1 : 0; /* SCIF1 */ | ||
615 | if (port->mapbase == 0xffe20000) | ||
616 | return ctrl_inb(PWDR) & 0x04 ? 1 : 0; /* SCIF2 */ | ||
617 | |||
618 | return 1; | ||
619 | } | ||
603 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) | 620 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) |
604 | static inline int sci_rxd_in(struct uart_port *port) | 621 | static inline int sci_rxd_in(struct uart_port *port) |
605 | { | 622 | { |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 8a217648b25..a01e987c7d3 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -643,7 +643,7 @@ static void read_buf_callback(struct urb *urb) | |||
643 | static int iuu_bulk_write(struct usb_serial_port *port) | 643 | static int iuu_bulk_write(struct usb_serial_port *port) |
644 | { | 644 | { |
645 | struct iuu_private *priv = usb_get_serial_port_data(port); | 645 | struct iuu_private *priv = usb_get_serial_port_data(port); |
646 | unsigned int flags; | 646 | unsigned long flags; |
647 | int result; | 647 | int result; |
648 | int i; | 648 | int i; |
649 | char *buf_ptr = port->write_urb->transfer_buffer; | 649 | char *buf_ptr = port->write_urb->transfer_buffer; |
@@ -694,7 +694,7 @@ static void iuu_uart_read_callback(struct urb *urb) | |||
694 | { | 694 | { |
695 | struct usb_serial_port *port = urb->context; | 695 | struct usb_serial_port *port = urb->context; |
696 | struct iuu_private *priv = usb_get_serial_port_data(port); | 696 | struct iuu_private *priv = usb_get_serial_port_data(port); |
697 | unsigned int flags; | 697 | unsigned long flags; |
698 | int status; | 698 | int status; |
699 | int error = 0; | 699 | int error = 0; |
700 | int len = 0; | 700 | int len = 0; |
@@ -759,7 +759,7 @@ static int iuu_uart_write(struct usb_serial_port *port, const u8 *buf, | |||
759 | int count) | 759 | int count) |
760 | { | 760 | { |
761 | struct iuu_private *priv = usb_get_serial_port_data(port); | 761 | struct iuu_private *priv = usb_get_serial_port_data(port); |
762 | unsigned int flags; | 762 | unsigned long flags; |
763 | dbg("%s - enter", __func__); | 763 | dbg("%s - enter", __func__); |
764 | 764 | ||
765 | if (count > 256) | 765 | if (count > 256) |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 3ab6e3d973a..48aea39c35a 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -1301,8 +1301,8 @@ static void pxafb_decode_mode_info(struct pxafb_info *fbi, | |||
1301 | } | 1301 | } |
1302 | } | 1302 | } |
1303 | 1303 | ||
1304 | static int pxafb_decode_mach_info(struct pxafb_info *fbi, | 1304 | static void pxafb_decode_mach_info(struct pxafb_info *fbi, |
1305 | struct pxafb_mach_info *inf) | 1305 | struct pxafb_mach_info *inf) |
1306 | { | 1306 | { |
1307 | unsigned int lcd_conn = inf->lcd_conn; | 1307 | unsigned int lcd_conn = inf->lcd_conn; |
1308 | 1308 | ||
@@ -1333,7 +1333,7 @@ static int pxafb_decode_mach_info(struct pxafb_info *fbi, | |||
1333 | fbi->lccr0 = inf->lccr0; | 1333 | fbi->lccr0 = inf->lccr0; |
1334 | fbi->lccr3 = inf->lccr3; | 1334 | fbi->lccr3 = inf->lccr3; |
1335 | fbi->lccr4 = inf->lccr4; | 1335 | fbi->lccr4 = inf->lccr4; |
1336 | return -EINVAL; | 1336 | goto decode_mode; |
1337 | } | 1337 | } |
1338 | 1338 | ||
1339 | if (lcd_conn == LCD_MONO_STN_8BPP) | 1339 | if (lcd_conn == LCD_MONO_STN_8BPP) |
@@ -1343,8 +1343,8 @@ static int pxafb_decode_mach_info(struct pxafb_info *fbi, | |||
1343 | fbi->lccr3 |= (lcd_conn & LCD_BIAS_ACTIVE_LOW) ? LCCR3_OEP : 0; | 1343 | fbi->lccr3 |= (lcd_conn & LCD_BIAS_ACTIVE_LOW) ? LCCR3_OEP : 0; |
1344 | fbi->lccr3 |= (lcd_conn & LCD_PCLK_EDGE_FALL) ? LCCR3_PCP : 0; | 1344 | fbi->lccr3 |= (lcd_conn & LCD_PCLK_EDGE_FALL) ? LCCR3_PCP : 0; |
1345 | 1345 | ||
1346 | decode_mode: | ||
1346 | pxafb_decode_mode_info(fbi, inf->modes, inf->num_modes); | 1347 | pxafb_decode_mode_info(fbi, inf->modes, inf->num_modes); |
1347 | return 0; | ||
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) | 1350 | static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) |
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index d5bd497ab9c..223b1917093 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
@@ -48,7 +48,7 @@ struct affs_ext_key { | |||
48 | * affs fs inode data in memory | 48 | * affs fs inode data in memory |
49 | */ | 49 | */ |
50 | struct affs_inode_info { | 50 | struct affs_inode_info { |
51 | u32 i_opencnt; | 51 | atomic_t i_opencnt; |
52 | struct semaphore i_link_lock; /* Protects internal inode access. */ | 52 | struct semaphore i_link_lock; /* Protects internal inode access. */ |
53 | struct semaphore i_ext_lock; /* Protects internal inode access. */ | 53 | struct semaphore i_ext_lock; /* Protects internal inode access. */ |
54 | #define i_hash_lock i_ext_lock | 54 | #define i_hash_lock i_ext_lock |
@@ -170,8 +170,6 @@ extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
170 | extern unsigned long affs_parent_ino(struct inode *dir); | 170 | extern unsigned long affs_parent_ino(struct inode *dir); |
171 | extern struct inode *affs_new_inode(struct inode *dir); | 171 | extern struct inode *affs_new_inode(struct inode *dir); |
172 | extern int affs_notify_change(struct dentry *dentry, struct iattr *attr); | 172 | extern int affs_notify_change(struct dentry *dentry, struct iattr *attr); |
173 | extern void affs_put_inode(struct inode *inode); | ||
174 | extern void affs_drop_inode(struct inode *inode); | ||
175 | extern void affs_delete_inode(struct inode *inode); | 173 | extern void affs_delete_inode(struct inode *inode); |
176 | extern void affs_clear_inode(struct inode *inode); | 174 | extern void affs_clear_inode(struct inode *inode); |
177 | extern struct inode *affs_iget(struct super_block *sb, | 175 | extern struct inode *affs_iget(struct super_block *sb, |
diff --git a/fs/affs/file.c b/fs/affs/file.c index 1a4f092f24e..6eac7bdeec9 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -48,8 +48,9 @@ affs_file_open(struct inode *inode, struct file *filp) | |||
48 | { | 48 | { |
49 | if (atomic_read(&filp->f_count) != 1) | 49 | if (atomic_read(&filp->f_count) != 1) |
50 | return 0; | 50 | return 0; |
51 | pr_debug("AFFS: open(%d)\n", AFFS_I(inode)->i_opencnt); | 51 | pr_debug("AFFS: open(%lu,%d)\n", |
52 | AFFS_I(inode)->i_opencnt++; | 52 | inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); |
53 | atomic_inc(&AFFS_I(inode)->i_opencnt); | ||
53 | return 0; | 54 | return 0; |
54 | } | 55 | } |
55 | 56 | ||
@@ -58,10 +59,16 @@ affs_file_release(struct inode *inode, struct file *filp) | |||
58 | { | 59 | { |
59 | if (atomic_read(&filp->f_count) != 0) | 60 | if (atomic_read(&filp->f_count) != 0) |
60 | return 0; | 61 | return 0; |
61 | pr_debug("AFFS: release(%d)\n", AFFS_I(inode)->i_opencnt); | 62 | pr_debug("AFFS: release(%lu, %d)\n", |
62 | AFFS_I(inode)->i_opencnt--; | 63 | inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); |
63 | if (!AFFS_I(inode)->i_opencnt) | 64 | |
65 | if (atomic_dec_and_test(&AFFS_I(inode)->i_opencnt)) { | ||
66 | mutex_lock(&inode->i_mutex); | ||
67 | if (inode->i_size != AFFS_I(inode)->mmu_private) | ||
68 | affs_truncate(inode); | ||
64 | affs_free_prealloc(inode); | 69 | affs_free_prealloc(inode); |
70 | mutex_unlock(&inode->i_mutex); | ||
71 | } | ||
65 | 72 | ||
66 | return 0; | 73 | return 0; |
67 | } | 74 | } |
@@ -180,7 +187,7 @@ affs_get_extblock(struct inode *inode, u32 ext) | |||
180 | /* inline the simplest case: same extended block as last time */ | 187 | /* inline the simplest case: same extended block as last time */ |
181 | struct buffer_head *bh = AFFS_I(inode)->i_ext_bh; | 188 | struct buffer_head *bh = AFFS_I(inode)->i_ext_bh; |
182 | if (ext == AFFS_I(inode)->i_ext_last) | 189 | if (ext == AFFS_I(inode)->i_ext_last) |
183 | atomic_inc(&bh->b_count); | 190 | get_bh(bh); |
184 | else | 191 | else |
185 | /* we have to do more (not inlined) */ | 192 | /* we have to do more (not inlined) */ |
186 | bh = affs_get_extblock_slow(inode, ext); | 193 | bh = affs_get_extblock_slow(inode, ext); |
@@ -306,7 +313,7 @@ store_ext: | |||
306 | affs_brelse(AFFS_I(inode)->i_ext_bh); | 313 | affs_brelse(AFFS_I(inode)->i_ext_bh); |
307 | AFFS_I(inode)->i_ext_last = ext; | 314 | AFFS_I(inode)->i_ext_last = ext; |
308 | AFFS_I(inode)->i_ext_bh = bh; | 315 | AFFS_I(inode)->i_ext_bh = bh; |
309 | atomic_inc(&bh->b_count); | 316 | get_bh(bh); |
310 | 317 | ||
311 | return bh; | 318 | return bh; |
312 | 319 | ||
@@ -324,7 +331,6 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul | |||
324 | 331 | ||
325 | pr_debug("AFFS: get_block(%u, %lu)\n", (u32)inode->i_ino, (unsigned long)block); | 332 | pr_debug("AFFS: get_block(%u, %lu)\n", (u32)inode->i_ino, (unsigned long)block); |
326 | 333 | ||
327 | |||
328 | BUG_ON(block > (sector_t)0x7fffffffUL); | 334 | BUG_ON(block > (sector_t)0x7fffffffUL); |
329 | 335 | ||
330 | if (block >= AFFS_I(inode)->i_blkcnt) { | 336 | if (block >= AFFS_I(inode)->i_blkcnt) { |
@@ -827,6 +833,8 @@ affs_truncate(struct inode *inode) | |||
827 | res = mapping->a_ops->write_begin(NULL, mapping, size, 0, 0, &page, &fsdata); | 833 | res = mapping->a_ops->write_begin(NULL, mapping, size, 0, 0, &page, &fsdata); |
828 | if (!res) | 834 | if (!res) |
829 | res = mapping->a_ops->write_end(NULL, mapping, size, 0, 0, page, fsdata); | 835 | res = mapping->a_ops->write_end(NULL, mapping, size, 0, 0, page, fsdata); |
836 | else | ||
837 | inode->i_size = AFFS_I(inode)->mmu_private; | ||
830 | mark_inode_dirty(inode); | 838 | mark_inode_dirty(inode); |
831 | return; | 839 | return; |
832 | } else if (inode->i_size == AFFS_I(inode)->mmu_private) | 840 | } else if (inode->i_size == AFFS_I(inode)->mmu_private) |
@@ -862,6 +870,7 @@ affs_truncate(struct inode *inode) | |||
862 | blk++; | 870 | blk++; |
863 | } else | 871 | } else |
864 | AFFS_HEAD(ext_bh)->first_data = 0; | 872 | AFFS_HEAD(ext_bh)->first_data = 0; |
873 | AFFS_HEAD(ext_bh)->block_count = cpu_to_be32(i); | ||
865 | size = AFFS_SB(sb)->s_hashsize; | 874 | size = AFFS_SB(sb)->s_hashsize; |
866 | if (size > blkcnt - blk + i) | 875 | if (size > blkcnt - blk + i) |
867 | size = blkcnt - blk + i; | 876 | size = blkcnt - blk + i; |
diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 27fe6cbe43a..a13b334a391 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c | |||
@@ -58,7 +58,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) | |||
58 | AFFS_I(inode)->i_extcnt = 1; | 58 | AFFS_I(inode)->i_extcnt = 1; |
59 | AFFS_I(inode)->i_ext_last = ~1; | 59 | AFFS_I(inode)->i_ext_last = ~1; |
60 | AFFS_I(inode)->i_protect = prot; | 60 | AFFS_I(inode)->i_protect = prot; |
61 | AFFS_I(inode)->i_opencnt = 0; | 61 | atomic_set(&AFFS_I(inode)->i_opencnt, 0); |
62 | AFFS_I(inode)->i_blkcnt = 0; | 62 | AFFS_I(inode)->i_blkcnt = 0; |
63 | AFFS_I(inode)->i_lc = NULL; | 63 | AFFS_I(inode)->i_lc = NULL; |
64 | AFFS_I(inode)->i_lc_size = 0; | 64 | AFFS_I(inode)->i_lc_size = 0; |
@@ -108,8 +108,6 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) | |||
108 | inode->i_mode |= S_IFDIR; | 108 | inode->i_mode |= S_IFDIR; |
109 | } else | 109 | } else |
110 | inode->i_mode = S_IRUGO | S_IXUGO | S_IWUSR | S_IFDIR; | 110 | inode->i_mode = S_IRUGO | S_IXUGO | S_IWUSR | S_IFDIR; |
111 | if (tail->link_chain) | ||
112 | inode->i_nlink = 2; | ||
113 | /* Maybe it should be controlled by mount parameter? */ | 111 | /* Maybe it should be controlled by mount parameter? */ |
114 | //inode->i_mode |= S_ISVTX; | 112 | //inode->i_mode |= S_ISVTX; |
115 | inode->i_op = &affs_dir_inode_operations; | 113 | inode->i_op = &affs_dir_inode_operations; |
@@ -245,31 +243,12 @@ out: | |||
245 | } | 243 | } |
246 | 244 | ||
247 | void | 245 | void |
248 | affs_put_inode(struct inode *inode) | ||
249 | { | ||
250 | pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); | ||
251 | affs_free_prealloc(inode); | ||
252 | } | ||
253 | |||
254 | void | ||
255 | affs_drop_inode(struct inode *inode) | ||
256 | { | ||
257 | mutex_lock(&inode->i_mutex); | ||
258 | if (inode->i_size != AFFS_I(inode)->mmu_private) | ||
259 | affs_truncate(inode); | ||
260 | mutex_unlock(&inode->i_mutex); | ||
261 | |||
262 | generic_drop_inode(inode); | ||
263 | } | ||
264 | |||
265 | void | ||
266 | affs_delete_inode(struct inode *inode) | 246 | affs_delete_inode(struct inode *inode) |
267 | { | 247 | { |
268 | pr_debug("AFFS: delete_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); | 248 | pr_debug("AFFS: delete_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); |
269 | truncate_inode_pages(&inode->i_data, 0); | 249 | truncate_inode_pages(&inode->i_data, 0); |
270 | inode->i_size = 0; | 250 | inode->i_size = 0; |
271 | if (S_ISREG(inode->i_mode)) | 251 | affs_truncate(inode); |
272 | affs_truncate(inode); | ||
273 | clear_inode(inode); | 252 | clear_inode(inode); |
274 | affs_free_block(inode->i_sb, inode->i_ino); | 253 | affs_free_block(inode->i_sb, inode->i_ino); |
275 | } | 254 | } |
@@ -277,9 +256,12 @@ affs_delete_inode(struct inode *inode) | |||
277 | void | 256 | void |
278 | affs_clear_inode(struct inode *inode) | 257 | affs_clear_inode(struct inode *inode) |
279 | { | 258 | { |
280 | unsigned long cache_page = (unsigned long) AFFS_I(inode)->i_lc; | 259 | unsigned long cache_page; |
281 | 260 | ||
282 | pr_debug("AFFS: clear_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); | 261 | pr_debug("AFFS: clear_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); |
262 | |||
263 | affs_free_prealloc(inode); | ||
264 | cache_page = (unsigned long)AFFS_I(inode)->i_lc; | ||
283 | if (cache_page) { | 265 | if (cache_page) { |
284 | pr_debug("AFFS: freeing ext cache\n"); | 266 | pr_debug("AFFS: freeing ext cache\n"); |
285 | AFFS_I(inode)->i_lc = NULL; | 267 | AFFS_I(inode)->i_lc = NULL; |
@@ -316,7 +298,7 @@ affs_new_inode(struct inode *dir) | |||
316 | inode->i_ino = block; | 298 | inode->i_ino = block; |
317 | inode->i_nlink = 1; | 299 | inode->i_nlink = 1; |
318 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; | 300 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; |
319 | AFFS_I(inode)->i_opencnt = 0; | 301 | atomic_set(&AFFS_I(inode)->i_opencnt, 0); |
320 | AFFS_I(inode)->i_blkcnt = 0; | 302 | AFFS_I(inode)->i_blkcnt = 0; |
321 | AFFS_I(inode)->i_lc = NULL; | 303 | AFFS_I(inode)->i_lc = NULL; |
322 | AFFS_I(inode)->i_lc_size = 0; | 304 | AFFS_I(inode)->i_lc_size = 0; |
@@ -369,12 +351,12 @@ affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s3 | |||
369 | switch (type) { | 351 | switch (type) { |
370 | case ST_LINKFILE: | 352 | case ST_LINKFILE: |
371 | case ST_LINKDIR: | 353 | case ST_LINKDIR: |
372 | inode_bh = bh; | ||
373 | retval = -ENOSPC; | 354 | retval = -ENOSPC; |
374 | block = affs_alloc_block(dir, dir->i_ino); | 355 | block = affs_alloc_block(dir, dir->i_ino); |
375 | if (!block) | 356 | if (!block) |
376 | goto err; | 357 | goto err; |
377 | retval = -EIO; | 358 | retval = -EIO; |
359 | inode_bh = bh; | ||
378 | bh = affs_getzeroblk(sb, block); | 360 | bh = affs_getzeroblk(sb, block); |
379 | if (!bh) | 361 | if (!bh) |
380 | goto err; | 362 | goto err; |
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index 2218f1ee71c..cfcf1b6cf82 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
@@ -234,7 +234,8 @@ affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
234 | int | 234 | int |
235 | affs_unlink(struct inode *dir, struct dentry *dentry) | 235 | affs_unlink(struct inode *dir, struct dentry *dentry) |
236 | { | 236 | { |
237 | pr_debug("AFFS: unlink(dir=%d, \"%.*s\")\n", (u32)dir->i_ino, | 237 | pr_debug("AFFS: unlink(dir=%d, %lu \"%.*s\")\n", (u32)dir->i_ino, |
238 | dentry->d_inode->i_ino, | ||
238 | (int)dentry->d_name.len, dentry->d_name.name); | 239 | (int)dentry->d_name.len, dentry->d_name.name); |
239 | 240 | ||
240 | return affs_remove_header(dentry); | 241 | return affs_remove_header(dentry); |
@@ -302,7 +303,8 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
302 | int | 303 | int |
303 | affs_rmdir(struct inode *dir, struct dentry *dentry) | 304 | affs_rmdir(struct inode *dir, struct dentry *dentry) |
304 | { | 305 | { |
305 | pr_debug("AFFS: rmdir(dir=%u, \"%.*s\")\n", (u32)dir->i_ino, | 306 | pr_debug("AFFS: rmdir(dir=%u, %lu \"%.*s\")\n", (u32)dir->i_ino, |
307 | dentry->d_inode->i_ino, | ||
306 | (int)dentry->d_name.len, dentry->d_name.name); | 308 | (int)dentry->d_name.len, dentry->d_name.name); |
307 | 309 | ||
308 | return affs_remove_header(dentry); | 310 | return affs_remove_header(dentry); |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 01d25d53254..d214837d5e4 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -71,12 +71,18 @@ static struct kmem_cache * affs_inode_cachep; | |||
71 | 71 | ||
72 | static struct inode *affs_alloc_inode(struct super_block *sb) | 72 | static struct inode *affs_alloc_inode(struct super_block *sb) |
73 | { | 73 | { |
74 | struct affs_inode_info *ei; | 74 | struct affs_inode_info *i; |
75 | ei = (struct affs_inode_info *)kmem_cache_alloc(affs_inode_cachep, GFP_KERNEL); | 75 | |
76 | if (!ei) | 76 | i = kmem_cache_alloc(affs_inode_cachep, GFP_KERNEL); |
77 | if (!i) | ||
77 | return NULL; | 78 | return NULL; |
78 | ei->vfs_inode.i_version = 1; | 79 | |
79 | return &ei->vfs_inode; | 80 | i->vfs_inode.i_version = 1; |
81 | i->i_lc = NULL; | ||
82 | i->i_ext_bh = NULL; | ||
83 | i->i_pa_cnt = 0; | ||
84 | |||
85 | return &i->vfs_inode; | ||
80 | } | 86 | } |
81 | 87 | ||
82 | static void affs_destroy_inode(struct inode *inode) | 88 | static void affs_destroy_inode(struct inode *inode) |
@@ -114,8 +120,6 @@ static const struct super_operations affs_sops = { | |||
114 | .alloc_inode = affs_alloc_inode, | 120 | .alloc_inode = affs_alloc_inode, |
115 | .destroy_inode = affs_destroy_inode, | 121 | .destroy_inode = affs_destroy_inode, |
116 | .write_inode = affs_write_inode, | 122 | .write_inode = affs_write_inode, |
117 | .put_inode = affs_put_inode, | ||
118 | .drop_inode = affs_drop_inode, | ||
119 | .delete_inode = affs_delete_inode, | 123 | .delete_inode = affs_delete_inode, |
120 | .clear_inode = affs_clear_inode, | 124 | .clear_inode = affs_clear_inode, |
121 | .put_super = affs_put_super, | 125 | .put_super = affs_put_super, |
@@ -158,7 +158,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) | |||
158 | 158 | ||
159 | bio_init(bio); | 159 | bio_init(bio); |
160 | if (likely(nr_iovecs)) { | 160 | if (likely(nr_iovecs)) { |
161 | unsigned long idx = 0; /* shut up gcc */ | 161 | unsigned long uninitialized_var(idx); |
162 | 162 | ||
163 | bvl = bvec_alloc_bs(gfp_mask, nr_iovecs, &idx, bs); | 163 | bvl = bvec_alloc_bs(gfp_mask, nr_iovecs, &idx, bs); |
164 | if (unlikely(!bvl)) { | 164 | if (unlikely(!bvl)) { |
@@ -963,6 +963,7 @@ static void bio_copy_kern_endio(struct bio *bio, int err) | |||
963 | * @data: pointer to buffer to copy | 963 | * @data: pointer to buffer to copy |
964 | * @len: length in bytes | 964 | * @len: length in bytes |
965 | * @gfp_mask: allocation flags for bio and page allocation | 965 | * @gfp_mask: allocation flags for bio and page allocation |
966 | * @reading: data direction is READ | ||
966 | * | 967 | * |
967 | * copy the kernel address into a bio suitable for io to a block | 968 | * copy the kernel address into a bio suitable for io to a block |
968 | * device. Returns an error pointer in case of error. | 969 | * device. Returns an error pointer in case of error. |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 05c9da6181c..8355e918fdd 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,3 +1,6 @@ | |||
1 | Version 1.53 | ||
2 | ------------ | ||
3 | |||
1 | Version 1.52 | 4 | Version 1.52 |
2 | ------------ | 5 | ------------ |
3 | Fix oops on second mount to server when null auth is used. | 6 | Fix oops on second mount to server when null auth is used. |
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c index bcda2c6b6a0..cb52cbbe45f 100644 --- a/fs/cifs/asn1.c +++ b/fs/cifs/asn1.c | |||
@@ -460,8 +460,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
460 | unsigned char *sequence_end; | 460 | unsigned char *sequence_end; |
461 | unsigned long *oid = NULL; | 461 | unsigned long *oid = NULL; |
462 | unsigned int cls, con, tag, oidlen, rc; | 462 | unsigned int cls, con, tag, oidlen, rc; |
463 | int use_ntlmssp = FALSE; | 463 | bool use_ntlmssp = false; |
464 | int use_kerberos = FALSE; | 464 | bool use_kerberos = false; |
465 | 465 | ||
466 | *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/ | 466 | *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/ |
467 | 467 | ||
@@ -561,15 +561,15 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
561 | if (compare_oid(oid, oidlen, | 561 | if (compare_oid(oid, oidlen, |
562 | MSKRB5_OID, | 562 | MSKRB5_OID, |
563 | MSKRB5_OID_LEN)) | 563 | MSKRB5_OID_LEN)) |
564 | use_kerberos = TRUE; | 564 | use_kerberos = true; |
565 | else if (compare_oid(oid, oidlen, | 565 | else if (compare_oid(oid, oidlen, |
566 | KRB5_OID, | 566 | KRB5_OID, |
567 | KRB5_OID_LEN)) | 567 | KRB5_OID_LEN)) |
568 | use_kerberos = TRUE; | 568 | use_kerberos = true; |
569 | else if (compare_oid(oid, oidlen, | 569 | else if (compare_oid(oid, oidlen, |
570 | NTLMSSP_OID, | 570 | NTLMSSP_OID, |
571 | NTLMSSP_OID_LEN)) | 571 | NTLMSSP_OID_LEN)) |
572 | use_ntlmssp = TRUE; | 572 | use_ntlmssp = true; |
573 | 573 | ||
574 | kfree(oid); | 574 | kfree(oid); |
575 | } | 575 | } |
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index 95024c066d8..f6fdecf6598 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
@@ -93,15 +93,11 @@ static char *cifs_get_share_name(const char *node_name) | |||
93 | /* find sharename end */ | 93 | /* find sharename end */ |
94 | pSep++; | 94 | pSep++; |
95 | pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC)); | 95 | pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC)); |
96 | if (!pSep) { | 96 | if (pSep) { |
97 | cERROR(1, ("%s:2 cant find share name in node name: %s", | 97 | /* trim path up to sharename end |
98 | __func__, node_name)); | 98 | * now we have share name in UNC */ |
99 | kfree(UNC); | 99 | *pSep = 0; |
100 | return NULL; | ||
101 | } | 100 | } |
102 | /* trim path up to sharename end | ||
103 | * * now we have share name in UNC */ | ||
104 | *pSep = 0; | ||
105 | 101 | ||
106 | return UNC; | 102 | return UNC; |
107 | } | 103 | } |
@@ -188,7 +184,7 @@ static char *compose_mount_options(const char *sb_mountdata, | |||
188 | tkn_e = strchr(tkn_e+1, '\\'); | 184 | tkn_e = strchr(tkn_e+1, '\\'); |
189 | if (tkn_e) { | 185 | if (tkn_e) { |
190 | strcat(mountdata, ",prefixpath="); | 186 | strcat(mountdata, ",prefixpath="); |
191 | strcat(mountdata, tkn_e); | 187 | strcat(mountdata, tkn_e+1); |
192 | } | 188 | } |
193 | } | 189 | } |
194 | 190 | ||
@@ -244,7 +240,8 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry) | |||
244 | return NULL; | 240 | return NULL; |
245 | 241 | ||
246 | if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) { | 242 | if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) { |
247 | /* we should use full path name to correct working with DFS */ | 243 | int i; |
244 | /* we should use full path name for correct working with DFS */ | ||
248 | l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) + | 245 | l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) + |
249 | strnlen(search_path, MAX_PATHCONF) + 1; | 246 | strnlen(search_path, MAX_PATHCONF) + 1; |
250 | tmp_path = kmalloc(l_max_len, GFP_KERNEL); | 247 | tmp_path = kmalloc(l_max_len, GFP_KERNEL); |
@@ -253,8 +250,14 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry) | |||
253 | return NULL; | 250 | return NULL; |
254 | } | 251 | } |
255 | strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len); | 252 | strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len); |
256 | strcat(tmp_path, search_path); | ||
257 | tmp_path[l_max_len-1] = 0; | 253 | tmp_path[l_max_len-1] = 0; |
254 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) | ||
255 | for (i = 0; i < l_max_len; i++) { | ||
256 | if (tmp_path[i] == '\\') | ||
257 | tmp_path[i] = '/'; | ||
258 | } | ||
259 | strncat(tmp_path, search_path, l_max_len - strlen(tmp_path)); | ||
260 | |||
258 | full_path = tmp_path; | 261 | full_path = tmp_path; |
259 | kfree(search_path); | 262 | kfree(search_path); |
260 | } else { | 263 | } else { |
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index e99d4faf5f0..34902cff540 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -559,7 +559,7 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode, | |||
559 | const char *path, const __u16 *pfid) | 559 | const char *path, const __u16 *pfid) |
560 | { | 560 | { |
561 | struct cifsFileInfo *open_file = NULL; | 561 | struct cifsFileInfo *open_file = NULL; |
562 | int unlock_file = FALSE; | 562 | bool unlock_file = false; |
563 | int xid; | 563 | int xid; |
564 | int rc = -EIO; | 564 | int rc = -EIO; |
565 | __u16 fid; | 565 | __u16 fid; |
@@ -586,10 +586,10 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode, | |||
586 | cifs_sb = CIFS_SB(sb); | 586 | cifs_sb = CIFS_SB(sb); |
587 | 587 | ||
588 | if (open_file) { | 588 | if (open_file) { |
589 | unlock_file = TRUE; | 589 | unlock_file = true; |
590 | fid = open_file->netfid; | 590 | fid = open_file->netfid; |
591 | } else if (pfid == NULL) { | 591 | } else if (pfid == NULL) { |
592 | int oplock = FALSE; | 592 | int oplock = 0; |
593 | /* open file */ | 593 | /* open file */ |
594 | rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, | 594 | rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, |
595 | READ_CONTROL, 0, &fid, &oplock, NULL, | 595 | READ_CONTROL, 0, &fid, &oplock, NULL, |
@@ -604,7 +604,7 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode, | |||
604 | 604 | ||
605 | rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); | 605 | rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); |
606 | cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen)); | 606 | cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen)); |
607 | if (unlock_file == TRUE) /* find_readable_file increments ref count */ | 607 | if (unlock_file == true) /* find_readable_file increments ref count */ |
608 | atomic_dec(&open_file->wrtPending); | 608 | atomic_dec(&open_file->wrtPending); |
609 | else if (pfid == NULL) /* if opened above we have to close the handle */ | 609 | else if (pfid == NULL) /* if opened above we have to close the handle */ |
610 | CIFSSMBClose(xid, cifs_sb->tcon, fid); | 610 | CIFSSMBClose(xid, cifs_sb->tcon, fid); |
@@ -619,7 +619,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, | |||
619 | struct inode *inode, const char *path) | 619 | struct inode *inode, const char *path) |
620 | { | 620 | { |
621 | struct cifsFileInfo *open_file; | 621 | struct cifsFileInfo *open_file; |
622 | int unlock_file = FALSE; | 622 | bool unlock_file = false; |
623 | int xid; | 623 | int xid; |
624 | int rc = -EIO; | 624 | int rc = -EIO; |
625 | __u16 fid; | 625 | __u16 fid; |
@@ -640,10 +640,10 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, | |||
640 | 640 | ||
641 | open_file = find_readable_file(CIFS_I(inode)); | 641 | open_file = find_readable_file(CIFS_I(inode)); |
642 | if (open_file) { | 642 | if (open_file) { |
643 | unlock_file = TRUE; | 643 | unlock_file = true; |
644 | fid = open_file->netfid; | 644 | fid = open_file->netfid; |
645 | } else { | 645 | } else { |
646 | int oplock = FALSE; | 646 | int oplock = 0; |
647 | /* open file */ | 647 | /* open file */ |
648 | rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, | 648 | rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, |
649 | WRITE_DAC, 0, &fid, &oplock, NULL, | 649 | WRITE_DAC, 0, &fid, &oplock, NULL, |
@@ -658,7 +658,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, | |||
658 | 658 | ||
659 | rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); | 659 | rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); |
660 | cFYI(DBG2, ("SetCIFSACL rc = %d", rc)); | 660 | cFYI(DBG2, ("SetCIFSACL rc = %d", rc)); |
661 | if (unlock_file == TRUE) | 661 | if (unlock_file) |
662 | atomic_dec(&open_file->wrtPending); | 662 | atomic_dec(&open_file->wrtPending); |
663 | else | 663 | else |
664 | CIFSSMBClose(xid, cifs_sb->tcon, fid); | 664 | CIFSSMBClose(xid, cifs_sb->tcon, fid); |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 39c2cbdface..427a7c69589 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -222,50 +222,50 @@ static int | |||
222 | cifs_statfs(struct dentry *dentry, struct kstatfs *buf) | 222 | cifs_statfs(struct dentry *dentry, struct kstatfs *buf) |
223 | { | 223 | { |
224 | struct super_block *sb = dentry->d_sb; | 224 | struct super_block *sb = dentry->d_sb; |
225 | int xid; | 225 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
226 | struct cifsTconInfo *tcon = cifs_sb->tcon; | ||
226 | int rc = -EOPNOTSUPP; | 227 | int rc = -EOPNOTSUPP; |
227 | struct cifs_sb_info *cifs_sb; | 228 | int xid; |
228 | struct cifsTconInfo *pTcon; | ||
229 | 229 | ||
230 | xid = GetXid(); | 230 | xid = GetXid(); |
231 | 231 | ||
232 | cifs_sb = CIFS_SB(sb); | ||
233 | pTcon = cifs_sb->tcon; | ||
234 | |||
235 | buf->f_type = CIFS_MAGIC_NUMBER; | 232 | buf->f_type = CIFS_MAGIC_NUMBER; |
236 | 233 | ||
237 | /* instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO */ | 234 | /* |
238 | buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would | 235 | * PATH_MAX may be too long - it would presumably be total path, |
239 | presumably be total path, but note | 236 | * but note that some servers (includinng Samba 3) have a shorter |
240 | that some servers (includinng Samba 3) | 237 | * maximum path. |
241 | have a shorter maximum path */ | 238 | * |
239 | * Instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO. | ||
240 | */ | ||
241 | buf->f_namelen = PATH_MAX; | ||
242 | buf->f_files = 0; /* undefined */ | 242 | buf->f_files = 0; /* undefined */ |
243 | buf->f_ffree = 0; /* unlimited */ | 243 | buf->f_ffree = 0; /* unlimited */ |
244 | 244 | ||
245 | /* BB we could add a second check for a QFS Unix capability bit */ | 245 | /* |
246 | /* BB FIXME check CIFS_POSIX_EXTENSIONS Unix cap first FIXME BB */ | 246 | * We could add a second check for a QFS Unix capability bit |
247 | if ((pTcon->ses->capabilities & CAP_UNIX) && (CIFS_POSIX_EXTENSIONS & | 247 | */ |
248 | le64_to_cpu(pTcon->fsUnixInfo.Capability))) | 248 | if ((tcon->ses->capabilities & CAP_UNIX) && |
249 | rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf); | 249 | (CIFS_POSIX_EXTENSIONS & le64_to_cpu(tcon->fsUnixInfo.Capability))) |
250 | 250 | rc = CIFSSMBQFSPosixInfo(xid, tcon, buf); | |
251 | /* Only need to call the old QFSInfo if failed | 251 | |
252 | on newer one */ | 252 | /* |
253 | if (rc) | 253 | * Only need to call the old QFSInfo if failed on newer one, |
254 | if (pTcon->ses->capabilities & CAP_NT_SMBS) | 254 | * e.g. by OS/2. |
255 | rc = CIFSSMBQFSInfo(xid, pTcon, buf); /* not supported by OS2 */ | 255 | **/ |
256 | 256 | if (rc && (tcon->ses->capabilities & CAP_NT_SMBS)) | |
257 | /* Some old Windows servers also do not support level 103, retry with | 257 | rc = CIFSSMBQFSInfo(xid, tcon, buf); |
258 | older level one if old server failed the previous call or we | 258 | |
259 | bypassed it because we detected that this was an older LANMAN sess */ | 259 | /* |
260 | * Some old Windows servers also do not support level 103, retry with | ||
261 | * older level one if old server failed the previous call or we | ||
262 | * bypassed it because we detected that this was an older LANMAN sess | ||
263 | */ | ||
260 | if (rc) | 264 | if (rc) |
261 | rc = SMBOldQFSInfo(xid, pTcon, buf); | 265 | rc = SMBOldQFSInfo(xid, tcon, buf); |
262 | /* int f_type; | 266 | |
263 | __fsid_t f_fsid; | ||
264 | int f_namelen; */ | ||
265 | /* BB get from info in tcon struct at mount time call to QFSAttrInfo */ | ||
266 | FreeXid(xid); | 267 | FreeXid(xid); |
267 | return 0; /* always return success? what if volume is no | 268 | return 0; |
268 | longer available? */ | ||
269 | } | 269 | } |
270 | 270 | ||
271 | static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd) | 271 | static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd) |
@@ -306,8 +306,8 @@ cifs_alloc_inode(struct super_block *sb) | |||
306 | /* Until the file is open and we have gotten oplock | 306 | /* Until the file is open and we have gotten oplock |
307 | info back from the server, can not assume caching of | 307 | info back from the server, can not assume caching of |
308 | file data or metadata */ | 308 | file data or metadata */ |
309 | cifs_inode->clientCanCacheRead = FALSE; | 309 | cifs_inode->clientCanCacheRead = false; |
310 | cifs_inode->clientCanCacheAll = FALSE; | 310 | cifs_inode->clientCanCacheAll = false; |
311 | cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ | 311 | cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ |
312 | 312 | ||
313 | /* Can not set i_flags here - they get immediately overwritten | 313 | /* Can not set i_flags here - they get immediately overwritten |
@@ -940,7 +940,7 @@ static int cifs_oplock_thread(void *dummyarg) | |||
940 | rc = CIFSSMBLock(0, pTcon, netfid, | 940 | rc = CIFSSMBLock(0, pTcon, netfid, |
941 | 0 /* len */ , 0 /* offset */, 0, | 941 | 0 /* len */ , 0 /* offset */, 0, |
942 | 0, LOCKING_ANDX_OPLOCK_RELEASE, | 942 | 0, LOCKING_ANDX_OPLOCK_RELEASE, |
943 | 0 /* wait flag */); | 943 | false /* wait flag */); |
944 | cFYI(1, ("Oplock release rc = %d", rc)); | 944 | cFYI(1, ("Oplock release rc = %d", rc)); |
945 | } | 945 | } |
946 | } else | 946 | } else |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index e1dd9f32e1d..cd1301a09b3 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -24,14 +24,6 @@ | |||
24 | 24 | ||
25 | #define ROOT_I 2 | 25 | #define ROOT_I 2 |
26 | 26 | ||
27 | #ifndef FALSE | ||
28 | #define FALSE 0 | ||
29 | #endif | ||
30 | |||
31 | #ifndef TRUE | ||
32 | #define TRUE 1 | ||
33 | #endif | ||
34 | |||
35 | extern struct file_system_type cifs_fs_type; | 27 | extern struct file_system_type cifs_fs_type; |
36 | extern const struct address_space_operations cifs_addr_ops; | 28 | extern const struct address_space_operations cifs_addr_ops; |
37 | extern const struct address_space_operations cifs_addr_ops_smallbuf; | 29 | extern const struct address_space_operations cifs_addr_ops_smallbuf; |
@@ -110,5 +102,5 @@ extern int cifs_ioctl(struct inode *inode, struct file *filep, | |||
110 | extern const struct export_operations cifs_export_ops; | 102 | extern const struct export_operations cifs_export_ops; |
111 | #endif /* EXPERIMENTAL */ | 103 | #endif /* EXPERIMENTAL */ |
112 | 104 | ||
113 | #define CIFS_VERSION "1.52" | 105 | #define CIFS_VERSION "1.53" |
114 | #endif /* _CIFSFS_H */ | 106 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 69a2e194254..b7d9f698e63 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -57,14 +57,6 @@ | |||
57 | 57 | ||
58 | #include "cifspdu.h" | 58 | #include "cifspdu.h" |
59 | 59 | ||
60 | #ifndef FALSE | ||
61 | #define FALSE 0 | ||
62 | #endif | ||
63 | |||
64 | #ifndef TRUE | ||
65 | #define TRUE 1 | ||
66 | #endif | ||
67 | |||
68 | #ifndef XATTR_DOS_ATTRIB | 60 | #ifndef XATTR_DOS_ATTRIB |
69 | #define XATTR_DOS_ATTRIB "user.DOSATTRIB" | 61 | #define XATTR_DOS_ATTRIB "user.DOSATTRIB" |
70 | #endif | 62 | #endif |
@@ -147,7 +139,7 @@ struct TCP_Server_Info { | |||
147 | enum protocolEnum protocolType; | 139 | enum protocolEnum protocolType; |
148 | char versionMajor; | 140 | char versionMajor; |
149 | char versionMinor; | 141 | char versionMinor; |
150 | unsigned svlocal:1; /* local server or remote */ | 142 | bool svlocal:1; /* local server or remote */ |
151 | atomic_t socketUseCount; /* number of open cifs sessions on socket */ | 143 | atomic_t socketUseCount; /* number of open cifs sessions on socket */ |
152 | atomic_t inFlight; /* number of requests on the wire to server */ | 144 | atomic_t inFlight; /* number of requests on the wire to server */ |
153 | #ifdef CONFIG_CIFS_STATS2 | 145 | #ifdef CONFIG_CIFS_STATS2 |
@@ -286,10 +278,10 @@ struct cifsTconInfo { | |||
286 | FILE_SYSTEM_DEVICE_INFO fsDevInfo; | 278 | FILE_SYSTEM_DEVICE_INFO fsDevInfo; |
287 | FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */ | 279 | FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */ |
288 | FILE_SYSTEM_UNIX_INFO fsUnixInfo; | 280 | FILE_SYSTEM_UNIX_INFO fsUnixInfo; |
289 | unsigned ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */ | 281 | bool ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */ |
290 | unsigned retry:1; | 282 | bool retry:1; |
291 | unsigned nocase:1; | 283 | bool nocase:1; |
292 | unsigned unix_ext:1; /* if off disable Linux extensions to CIFS protocol | 284 | bool unix_ext:1; /* if false disable Linux extensions to CIFS protocol |
293 | for this mount even if server would support */ | 285 | for this mount even if server would support */ |
294 | /* BB add field for back pointer to sb struct(s)? */ | 286 | /* BB add field for back pointer to sb struct(s)? */ |
295 | }; | 287 | }; |
@@ -317,10 +309,10 @@ struct cifs_search_info { | |||
317 | char *srch_entries_start; | 309 | char *srch_entries_start; |
318 | char *presume_name; | 310 | char *presume_name; |
319 | unsigned int resume_name_len; | 311 | unsigned int resume_name_len; |
320 | unsigned endOfSearch:1; | 312 | bool endOfSearch:1; |
321 | unsigned emptyDir:1; | 313 | bool emptyDir:1; |
322 | unsigned unicode:1; | 314 | bool unicode:1; |
323 | unsigned smallBuf:1; /* so we know which buf_release function to call */ | 315 | bool smallBuf:1; /* so we know which buf_release function to call */ |
324 | }; | 316 | }; |
325 | 317 | ||
326 | struct cifsFileInfo { | 318 | struct cifsFileInfo { |
@@ -335,9 +327,9 @@ struct cifsFileInfo { | |||
335 | struct inode *pInode; /* needed for oplock break */ | 327 | struct inode *pInode; /* needed for oplock break */ |
336 | struct mutex lock_mutex; | 328 | struct mutex lock_mutex; |
337 | struct list_head llist; /* list of byte range locks we have. */ | 329 | struct list_head llist; /* list of byte range locks we have. */ |
338 | unsigned closePend:1; /* file is marked to close */ | 330 | bool closePend:1; /* file is marked to close */ |
339 | unsigned invalidHandle:1; /* file closed via session abend */ | 331 | bool invalidHandle:1; /* file closed via session abend */ |
340 | unsigned messageMode:1; /* for pipes: message vs byte mode */ | 332 | bool messageMode:1; /* for pipes: message vs byte mode */ |
341 | atomic_t wrtPending; /* handle in use - defer close */ | 333 | atomic_t wrtPending; /* handle in use - defer close */ |
342 | struct semaphore fh_sem; /* prevents reopen race after dead ses*/ | 334 | struct semaphore fh_sem; /* prevents reopen race after dead ses*/ |
343 | char *search_resume_name; /* BB removeme BB */ | 335 | char *search_resume_name; /* BB removeme BB */ |
@@ -356,9 +348,9 @@ struct cifsInodeInfo { | |||
356 | __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ | 348 | __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ |
357 | atomic_t inUse; /* num concurrent users (local openers cifs) of file*/ | 349 | atomic_t inUse; /* num concurrent users (local openers cifs) of file*/ |
358 | unsigned long time; /* jiffies of last update/check of inode */ | 350 | unsigned long time; /* jiffies of last update/check of inode */ |
359 | unsigned clientCanCacheRead:1; /* read oplock */ | 351 | bool clientCanCacheRead:1; /* read oplock */ |
360 | unsigned clientCanCacheAll:1; /* read and writebehind oplock */ | 352 | bool clientCanCacheAll:1; /* read and writebehind oplock */ |
361 | unsigned oplockPending:1; | 353 | bool oplockPending:1; |
362 | struct inode vfs_inode; | 354 | struct inode vfs_inode; |
363 | }; | 355 | }; |
364 | 356 | ||
@@ -426,9 +418,9 @@ struct mid_q_entry { | |||
426 | struct smb_hdr *resp_buf; /* response buffer */ | 418 | struct smb_hdr *resp_buf; /* response buffer */ |
427 | int midState; /* wish this were enum but can not pass to wait_event */ | 419 | int midState; /* wish this were enum but can not pass to wait_event */ |
428 | __u8 command; /* smb command code */ | 420 | __u8 command; /* smb command code */ |
429 | unsigned largeBuf:1; /* if valid response, is pointer to large buf */ | 421 | bool largeBuf:1; /* if valid response, is pointer to large buf */ |
430 | unsigned multiRsp:1; /* multiple trans2 responses for one request */ | 422 | bool multiRsp:1; /* multiple trans2 responses for one request */ |
431 | unsigned multiEnd:1; /* both received */ | 423 | bool multiEnd:1; /* both received */ |
432 | }; | 424 | }; |
433 | 425 | ||
434 | struct oplock_q_entry { | 426 | struct oplock_q_entry { |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 9f49c2f3582..a0d26b540d4 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -2050,7 +2050,7 @@ typedef struct { | |||
2050 | to 0xFFFF00 */ | 2050 | to 0xFFFF00 */ |
2051 | #define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080 | 2051 | #define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080 |
2052 | #define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP 0x00000100 /* can do SPNEGO crypt */ | 2052 | #define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP 0x00000100 /* can do SPNEGO crypt */ |
2053 | #define CIFS_UNIX_TRANPSORT_ENCRYPTION_MANDATORY_CAP 0x00000200 /* must do */ | 2053 | #define CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP 0x00000200 /* must do */ |
2054 | #define CIFS_UNIX_PROXY_CAP 0x00000400 /* Proxy cap: 0xACE ioctl and | 2054 | #define CIFS_UNIX_PROXY_CAP 0x00000400 /* Proxy cap: 0xACE ioctl and |
2055 | QFS PROXY call */ | 2055 | QFS PROXY call */ |
2056 | #ifdef CONFIG_CIFS_POSIX | 2056 | #ifdef CONFIG_CIFS_POSIX |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 50f9fdae19b..d481f6c5a2b 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -59,8 +59,9 @@ extern int SendReceiveBlockingLock(const unsigned int xid, | |||
59 | struct smb_hdr *out_buf, | 59 | struct smb_hdr *out_buf, |
60 | int *bytes_returned); | 60 | int *bytes_returned); |
61 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); | 61 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); |
62 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); | 62 | extern bool is_valid_oplock_break(struct smb_hdr *smb, |
63 | extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); | 63 | struct TCP_Server_Info *); |
64 | extern bool is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); | ||
64 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); | 65 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); |
65 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 66 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
66 | extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *); | 67 | extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *); |
@@ -69,7 +70,7 @@ extern unsigned int smbCalcSize(struct smb_hdr *ptr); | |||
69 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); | 70 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); |
70 | extern int decode_negTokenInit(unsigned char *security_blob, int length, | 71 | extern int decode_negTokenInit(unsigned char *security_blob, int length, |
71 | enum securityEnum *secType); | 72 | enum securityEnum *secType); |
72 | extern int cifs_inet_pton(int, char *source, void *dst); | 73 | extern int cifs_inet_pton(const int, const char *source, void *dst); |
73 | extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); | 74 | extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); |
74 | extern void header_assemble(struct smb_hdr *, char /* command */ , | 75 | extern void header_assemble(struct smb_hdr *, char /* command */ , |
75 | const struct cifsTconInfo *, int /* length of | 76 | const struct cifsTconInfo *, int /* length of |
@@ -187,12 +188,12 @@ extern int CIFSSMBSetAttrLegacy(int xid, struct cifsTconInfo *tcon, | |||
187 | #endif /* possibly unneeded function */ | 188 | #endif /* possibly unneeded function */ |
188 | extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, | 189 | extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, |
189 | const char *fileName, __u64 size, | 190 | const char *fileName, __u64 size, |
190 | int setAllocationSizeFlag, | 191 | bool setAllocationSizeFlag, |
191 | const struct nls_table *nls_codepage, | 192 | const struct nls_table *nls_codepage, |
192 | int remap_special_chars); | 193 | int remap_special_chars); |
193 | extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, | 194 | extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, |
194 | __u64 size, __u16 fileHandle, __u32 opener_pid, | 195 | __u64 size, __u16 fileHandle, __u32 opener_pid, |
195 | int AllocSizeFlag); | 196 | bool AllocSizeFlag); |
196 | extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon, | 197 | extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon, |
197 | char *full_path, __u64 mode, __u64 uid, | 198 | char *full_path, __u64 mode, __u64 uid, |
198 | __u64 gid, dev_t dev, | 199 | __u64 gid, dev_t dev, |
@@ -291,11 +292,11 @@ extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
291 | const __u16 netfid, const __u64 len, | 292 | const __u16 netfid, const __u64 len, |
292 | const __u64 offset, const __u32 numUnlock, | 293 | const __u64 offset, const __u32 numUnlock, |
293 | const __u32 numLock, const __u8 lockType, | 294 | const __u32 numLock, const __u8 lockType, |
294 | const int waitFlag); | 295 | const bool waitFlag); |
295 | extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | 296 | extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, |
296 | const __u16 smb_file_id, const int get_flag, | 297 | const __u16 smb_file_id, const int get_flag, |
297 | const __u64 len, struct file_lock *, | 298 | const __u64 len, struct file_lock *, |
298 | const __u16 lock_type, const int waitFlag); | 299 | const __u16 lock_type, const bool waitFlag); |
299 | extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon); | 300 | extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon); |
300 | extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses); | 301 | extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses); |
301 | 302 | ||
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 4728fa982a4..cfd9750852b 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -95,7 +95,7 @@ static void mark_open_files_invalid(struct cifsTconInfo *pTcon) | |||
95 | list_for_each_safe(tmp, tmp1, &pTcon->openFileList) { | 95 | list_for_each_safe(tmp, tmp1, &pTcon->openFileList) { |
96 | open_file = list_entry(tmp, struct cifsFileInfo, tlist); | 96 | open_file = list_entry(tmp, struct cifsFileInfo, tlist); |
97 | if (open_file) | 97 | if (open_file) |
98 | open_file->invalidHandle = TRUE; | 98 | open_file->invalidHandle = true; |
99 | } | 99 | } |
100 | write_unlock(&GlobalSMBSeslock); | 100 | write_unlock(&GlobalSMBSeslock); |
101 | /* BB Add call to invalidate_inodes(sb) for all superblocks mounted | 101 | /* BB Add call to invalidate_inodes(sb) for all superblocks mounted |
@@ -141,7 +141,7 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
141 | if (tcon->ses->server->tcpStatus == | 141 | if (tcon->ses->server->tcpStatus == |
142 | CifsNeedReconnect) { | 142 | CifsNeedReconnect) { |
143 | /* on "soft" mounts we wait once */ | 143 | /* on "soft" mounts we wait once */ |
144 | if ((tcon->retry == FALSE) || | 144 | if (!tcon->retry || |
145 | (tcon->ses->status == CifsExiting)) { | 145 | (tcon->ses->status == CifsExiting)) { |
146 | cFYI(1, ("gave up waiting on " | 146 | cFYI(1, ("gave up waiting on " |
147 | "reconnect in smb_init")); | 147 | "reconnect in smb_init")); |
@@ -289,7 +289,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
289 | if (tcon->ses->server->tcpStatus == | 289 | if (tcon->ses->server->tcpStatus == |
290 | CifsNeedReconnect) { | 290 | CifsNeedReconnect) { |
291 | /* on "soft" mounts we wait once */ | 291 | /* on "soft" mounts we wait once */ |
292 | if ((tcon->retry == FALSE) || | 292 | if (!tcon->retry || |
293 | (tcon->ses->status == CifsExiting)) { | 293 | (tcon->ses->status == CifsExiting)) { |
294 | cFYI(1, ("gave up waiting on " | 294 | cFYI(1, ("gave up waiting on " |
295 | "reconnect in smb_init")); | 295 | "reconnect in smb_init")); |
@@ -1686,7 +1686,7 @@ int | |||
1686 | CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | 1686 | CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, |
1687 | const __u16 smb_file_id, const __u64 len, | 1687 | const __u16 smb_file_id, const __u64 len, |
1688 | const __u64 offset, const __u32 numUnlock, | 1688 | const __u64 offset, const __u32 numUnlock, |
1689 | const __u32 numLock, const __u8 lockType, const int waitFlag) | 1689 | const __u32 numLock, const __u8 lockType, const bool waitFlag) |
1690 | { | 1690 | { |
1691 | int rc = 0; | 1691 | int rc = 0; |
1692 | LOCK_REQ *pSMB = NULL; | 1692 | LOCK_REQ *pSMB = NULL; |
@@ -1695,7 +1695,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
1695 | int timeout = 0; | 1695 | int timeout = 0; |
1696 | __u16 count; | 1696 | __u16 count; |
1697 | 1697 | ||
1698 | cFYI(1, ("CIFSSMBLock timeout %d numLock %d", waitFlag, numLock)); | 1698 | cFYI(1, ("CIFSSMBLock timeout %d numLock %d", (int)waitFlag, numLock)); |
1699 | rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB); | 1699 | rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB); |
1700 | 1700 | ||
1701 | if (rc) | 1701 | if (rc) |
@@ -1706,7 +1706,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
1706 | if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) { | 1706 | if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) { |
1707 | timeout = CIFS_ASYNC_OP; /* no response expected */ | 1707 | timeout = CIFS_ASYNC_OP; /* no response expected */ |
1708 | pSMB->Timeout = 0; | 1708 | pSMB->Timeout = 0; |
1709 | } else if (waitFlag == TRUE) { | 1709 | } else if (waitFlag) { |
1710 | timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */ | 1710 | timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */ |
1711 | pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */ | 1711 | pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */ |
1712 | } else { | 1712 | } else { |
@@ -1756,7 +1756,7 @@ int | |||
1756 | CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | 1756 | CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, |
1757 | const __u16 smb_file_id, const int get_flag, const __u64 len, | 1757 | const __u16 smb_file_id, const int get_flag, const __u64 len, |
1758 | struct file_lock *pLockData, const __u16 lock_type, | 1758 | struct file_lock *pLockData, const __u16 lock_type, |
1759 | const int waitFlag) | 1759 | const bool waitFlag) |
1760 | { | 1760 | { |
1761 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | 1761 | struct smb_com_transaction2_sfi_req *pSMB = NULL; |
1762 | struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; | 1762 | struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; |
@@ -3581,9 +3581,9 @@ findFirstRetry: | |||
3581 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); | 3581 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); |
3582 | if (rc == 0) { | 3582 | if (rc == 0) { |
3583 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) | 3583 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) |
3584 | psrch_inf->unicode = TRUE; | 3584 | psrch_inf->unicode = true; |
3585 | else | 3585 | else |
3586 | psrch_inf->unicode = FALSE; | 3586 | psrch_inf->unicode = false; |
3587 | 3587 | ||
3588 | psrch_inf->ntwrk_buf_start = (char *)pSMBr; | 3588 | psrch_inf->ntwrk_buf_start = (char *)pSMBr; |
3589 | psrch_inf->smallBuf = 0; | 3589 | psrch_inf->smallBuf = 0; |
@@ -3594,9 +3594,9 @@ findFirstRetry: | |||
3594 | le16_to_cpu(pSMBr->t2.ParameterOffset)); | 3594 | le16_to_cpu(pSMBr->t2.ParameterOffset)); |
3595 | 3595 | ||
3596 | if (parms->EndofSearch) | 3596 | if (parms->EndofSearch) |
3597 | psrch_inf->endOfSearch = TRUE; | 3597 | psrch_inf->endOfSearch = true; |
3598 | else | 3598 | else |
3599 | psrch_inf->endOfSearch = FALSE; | 3599 | psrch_inf->endOfSearch = false; |
3600 | 3600 | ||
3601 | psrch_inf->entries_in_buffer = | 3601 | psrch_inf->entries_in_buffer = |
3602 | le16_to_cpu(parms->SearchCount); | 3602 | le16_to_cpu(parms->SearchCount); |
@@ -3624,7 +3624,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3624 | 3624 | ||
3625 | cFYI(1, ("In FindNext")); | 3625 | cFYI(1, ("In FindNext")); |
3626 | 3626 | ||
3627 | if (psrch_inf->endOfSearch == TRUE) | 3627 | if (psrch_inf->endOfSearch) |
3628 | return -ENOENT; | 3628 | return -ENOENT; |
3629 | 3629 | ||
3630 | rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, | 3630 | rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, |
@@ -3682,7 +3682,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3682 | cifs_stats_inc(&tcon->num_fnext); | 3682 | cifs_stats_inc(&tcon->num_fnext); |
3683 | if (rc) { | 3683 | if (rc) { |
3684 | if (rc == -EBADF) { | 3684 | if (rc == -EBADF) { |
3685 | psrch_inf->endOfSearch = TRUE; | 3685 | psrch_inf->endOfSearch = true; |
3686 | rc = 0; /* search probably was closed at end of search*/ | 3686 | rc = 0; /* search probably was closed at end of search*/ |
3687 | } else | 3687 | } else |
3688 | cFYI(1, ("FindNext returned = %d", rc)); | 3688 | cFYI(1, ("FindNext returned = %d", rc)); |
@@ -3692,9 +3692,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3692 | if (rc == 0) { | 3692 | if (rc == 0) { |
3693 | /* BB fixme add lock for file (srch_info) struct here */ | 3693 | /* BB fixme add lock for file (srch_info) struct here */ |
3694 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) | 3694 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) |
3695 | psrch_inf->unicode = TRUE; | 3695 | psrch_inf->unicode = true; |
3696 | else | 3696 | else |
3697 | psrch_inf->unicode = FALSE; | 3697 | psrch_inf->unicode = false; |
3698 | response_data = (char *) &pSMBr->hdr.Protocol + | 3698 | response_data = (char *) &pSMBr->hdr.Protocol + |
3699 | le16_to_cpu(pSMBr->t2.ParameterOffset); | 3699 | le16_to_cpu(pSMBr->t2.ParameterOffset); |
3700 | parms = (T2_FNEXT_RSP_PARMS *)response_data; | 3700 | parms = (T2_FNEXT_RSP_PARMS *)response_data; |
@@ -3709,9 +3709,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3709 | psrch_inf->ntwrk_buf_start = (char *)pSMB; | 3709 | psrch_inf->ntwrk_buf_start = (char *)pSMB; |
3710 | psrch_inf->smallBuf = 0; | 3710 | psrch_inf->smallBuf = 0; |
3711 | if (parms->EndofSearch) | 3711 | if (parms->EndofSearch) |
3712 | psrch_inf->endOfSearch = TRUE; | 3712 | psrch_inf->endOfSearch = true; |
3713 | else | 3713 | else |
3714 | psrch_inf->endOfSearch = FALSE; | 3714 | psrch_inf->endOfSearch = false; |
3715 | psrch_inf->entries_in_buffer = | 3715 | psrch_inf->entries_in_buffer = |
3716 | le16_to_cpu(parms->SearchCount); | 3716 | le16_to_cpu(parms->SearchCount); |
3717 | psrch_inf->index_of_last_entry += | 3717 | psrch_inf->index_of_last_entry += |
@@ -4586,7 +4586,7 @@ QFSPosixRetry: | |||
4586 | 4586 | ||
4587 | int | 4587 | int |
4588 | CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName, | 4588 | CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName, |
4589 | __u64 size, int SetAllocation, | 4589 | __u64 size, bool SetAllocation, |
4590 | const struct nls_table *nls_codepage, int remap) | 4590 | const struct nls_table *nls_codepage, int remap) |
4591 | { | 4591 | { |
4592 | struct smb_com_transaction2_spi_req *pSMB = NULL; | 4592 | struct smb_com_transaction2_spi_req *pSMB = NULL; |
@@ -4675,7 +4675,7 @@ SetEOFRetry: | |||
4675 | 4675 | ||
4676 | int | 4676 | int |
4677 | CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, | 4677 | CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, |
4678 | __u16 fid, __u32 pid_of_opener, int SetAllocation) | 4678 | __u16 fid, __u32 pid_of_opener, bool SetAllocation) |
4679 | { | 4679 | { |
4680 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | 4680 | struct smb_com_transaction2_sfi_req *pSMB = NULL; |
4681 | char *data_offset; | 4681 | char *data_offset; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index e1710673016..791ca5c1a11 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -49,8 +49,6 @@ | |||
49 | #define CIFS_PORT 445 | 49 | #define CIFS_PORT 445 |
50 | #define RFC1001_PORT 139 | 50 | #define RFC1001_PORT 139 |
51 | 51 | ||
52 | static DECLARE_COMPLETION(cifsd_complete); | ||
53 | |||
54 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, | 52 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, |
55 | unsigned char *p24); | 53 | unsigned char *p24); |
56 | 54 | ||
@@ -71,23 +69,23 @@ struct smb_vol { | |||
71 | mode_t file_mode; | 69 | mode_t file_mode; |
72 | mode_t dir_mode; | 70 | mode_t dir_mode; |
73 | unsigned secFlg; | 71 | unsigned secFlg; |
74 | unsigned rw:1; | 72 | bool rw:1; |
75 | unsigned retry:1; | 73 | bool retry:1; |
76 | unsigned intr:1; | 74 | bool intr:1; |
77 | unsigned setuids:1; | 75 | bool setuids:1; |
78 | unsigned override_uid:1; | 76 | bool override_uid:1; |
79 | unsigned override_gid:1; | 77 | bool override_gid:1; |
80 | unsigned noperm:1; | 78 | bool noperm:1; |
81 | unsigned no_psx_acl:1; /* set if posix acl support should be disabled */ | 79 | bool no_psx_acl:1; /* set if posix acl support should be disabled */ |
82 | unsigned cifs_acl:1; | 80 | bool cifs_acl:1; |
83 | unsigned no_xattr:1; /* set if xattr (EA) support should be disabled*/ | 81 | bool no_xattr:1; /* set if xattr (EA) support should be disabled*/ |
84 | unsigned server_ino:1; /* use inode numbers from server ie UniqueId */ | 82 | bool server_ino:1; /* use inode numbers from server ie UniqueId */ |
85 | unsigned direct_io:1; | 83 | bool direct_io:1; |
86 | unsigned remap:1; /* set to remap seven reserved chars in filenames */ | 84 | bool remap:1; /* set to remap seven reserved chars in filenames */ |
87 | unsigned posix_paths:1; /* unset to not ask for posix pathnames. */ | 85 | bool posix_paths:1; /* unset to not ask for posix pathnames. */ |
88 | unsigned no_linux_ext:1; | 86 | bool no_linux_ext:1; |
89 | unsigned sfu_emul:1; | 87 | bool sfu_emul:1; |
90 | unsigned nullauth:1; /* attempt to authenticate with null user */ | 88 | bool nullauth:1; /* attempt to authenticate with null user */ |
91 | unsigned nocase; /* request case insensitive filenames */ | 89 | unsigned nocase; /* request case insensitive filenames */ |
92 | unsigned nobrl; /* disable sending byte range locks to srv */ | 90 | unsigned nobrl; /* disable sending byte range locks to srv */ |
93 | unsigned int rsize; | 91 | unsigned int rsize; |
@@ -345,8 +343,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
345 | struct task_struct *task_to_wake = NULL; | 343 | struct task_struct *task_to_wake = NULL; |
346 | struct mid_q_entry *mid_entry; | 344 | struct mid_q_entry *mid_entry; |
347 | char temp; | 345 | char temp; |
348 | int isLargeBuf = FALSE; | 346 | bool isLargeBuf = false; |
349 | int isMultiRsp; | 347 | bool isMultiRsp; |
350 | int reconnect; | 348 | int reconnect; |
351 | 349 | ||
352 | current->flags |= PF_MEMALLOC; | 350 | current->flags |= PF_MEMALLOC; |
@@ -356,7 +354,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
356 | atomic_inc(&tcpSesAllocCount); | 354 | atomic_inc(&tcpSesAllocCount); |
357 | length = tcpSesAllocCount.counter; | 355 | length = tcpSesAllocCount.counter; |
358 | write_unlock(&GlobalSMBSeslock); | 356 | write_unlock(&GlobalSMBSeslock); |
359 | complete(&cifsd_complete); | ||
360 | if (length > 1) | 357 | if (length > 1) |
361 | mempool_resize(cifs_req_poolp, length + cifs_min_rcv, | 358 | mempool_resize(cifs_req_poolp, length + cifs_min_rcv, |
362 | GFP_KERNEL); | 359 | GFP_KERNEL); |
@@ -390,8 +387,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
390 | } else /* if existing small buf clear beginning */ | 387 | } else /* if existing small buf clear beginning */ |
391 | memset(smallbuf, 0, sizeof(struct smb_hdr)); | 388 | memset(smallbuf, 0, sizeof(struct smb_hdr)); |
392 | 389 | ||
393 | isLargeBuf = FALSE; | 390 | isLargeBuf = false; |
394 | isMultiRsp = FALSE; | 391 | isMultiRsp = false; |
395 | smb_buffer = smallbuf; | 392 | smb_buffer = smallbuf; |
396 | iov.iov_base = smb_buffer; | 393 | iov.iov_base = smb_buffer; |
397 | iov.iov_len = 4; | 394 | iov.iov_len = 4; |
@@ -517,7 +514,7 @@ incomplete_rcv: | |||
517 | reconnect = 0; | 514 | reconnect = 0; |
518 | 515 | ||
519 | if (pdu_length > MAX_CIFS_SMALL_BUFFER_SIZE - 4) { | 516 | if (pdu_length > MAX_CIFS_SMALL_BUFFER_SIZE - 4) { |
520 | isLargeBuf = TRUE; | 517 | isLargeBuf = true; |
521 | memcpy(bigbuf, smallbuf, 4); | 518 | memcpy(bigbuf, smallbuf, 4); |
522 | smb_buffer = bigbuf; | 519 | smb_buffer = bigbuf; |
523 | } | 520 | } |
@@ -582,16 +579,18 @@ incomplete_rcv: | |||
582 | (mid_entry->command == smb_buffer->Command)) { | 579 | (mid_entry->command == smb_buffer->Command)) { |
583 | if (check2ndT2(smb_buffer,server->maxBuf) > 0) { | 580 | if (check2ndT2(smb_buffer,server->maxBuf) > 0) { |
584 | /* We have a multipart transact2 resp */ | 581 | /* We have a multipart transact2 resp */ |
585 | isMultiRsp = TRUE; | 582 | isMultiRsp = true; |
586 | if (mid_entry->resp_buf) { | 583 | if (mid_entry->resp_buf) { |
587 | /* merge response - fix up 1st*/ | 584 | /* merge response - fix up 1st*/ |
588 | if (coalesce_t2(smb_buffer, | 585 | if (coalesce_t2(smb_buffer, |
589 | mid_entry->resp_buf)) { | 586 | mid_entry->resp_buf)) { |
590 | mid_entry->multiRsp = 1; | 587 | mid_entry->multiRsp = |
588 | true; | ||
591 | break; | 589 | break; |
592 | } else { | 590 | } else { |
593 | /* all parts received */ | 591 | /* all parts received */ |
594 | mid_entry->multiEnd = 1; | 592 | mid_entry->multiEnd = |
593 | true; | ||
595 | goto multi_t2_fnd; | 594 | goto multi_t2_fnd; |
596 | } | 595 | } |
597 | } else { | 596 | } else { |
@@ -603,17 +602,15 @@ incomplete_rcv: | |||
603 | /* Have first buffer */ | 602 | /* Have first buffer */ |
604 | mid_entry->resp_buf = | 603 | mid_entry->resp_buf = |
605 | smb_buffer; | 604 | smb_buffer; |
606 | mid_entry->largeBuf = 1; | 605 | mid_entry->largeBuf = |
606 | true; | ||
607 | bigbuf = NULL; | 607 | bigbuf = NULL; |
608 | } | 608 | } |
609 | } | 609 | } |
610 | break; | 610 | break; |
611 | } | 611 | } |
612 | mid_entry->resp_buf = smb_buffer; | 612 | mid_entry->resp_buf = smb_buffer; |
613 | if (isLargeBuf) | 613 | mid_entry->largeBuf = isLargeBuf; |
614 | mid_entry->largeBuf = 1; | ||
615 | else | ||
616 | mid_entry->largeBuf = 0; | ||
617 | multi_t2_fnd: | 614 | multi_t2_fnd: |
618 | task_to_wake = mid_entry->tsk; | 615 | task_to_wake = mid_entry->tsk; |
619 | mid_entry->midState = MID_RESPONSE_RECEIVED; | 616 | mid_entry->midState = MID_RESPONSE_RECEIVED; |
@@ -638,8 +635,8 @@ multi_t2_fnd: | |||
638 | smallbuf = NULL; | 635 | smallbuf = NULL; |
639 | } | 636 | } |
640 | wake_up_process(task_to_wake); | 637 | wake_up_process(task_to_wake); |
641 | } else if ((is_valid_oplock_break(smb_buffer, server) == FALSE) | 638 | } else if (!is_valid_oplock_break(smb_buffer, server) && |
642 | && (isMultiRsp == FALSE)) { | 639 | !isMultiRsp) { |
643 | cERROR(1, ("No task to wake, unknown frame received! " | 640 | cERROR(1, ("No task to wake, unknown frame received! " |
644 | "NumMids %d", midCount.counter)); | 641 | "NumMids %d", midCount.counter)); |
645 | cifs_dump_mem("Received Data is: ", (char *)smb_buffer, | 642 | cifs_dump_mem("Received Data is: ", (char *)smb_buffer, |
@@ -825,7 +822,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
825 | vol->file_mode = (S_IRWXUGO | S_ISGID) & (~S_IXGRP); | 822 | vol->file_mode = (S_IRWXUGO | S_ISGID) & (~S_IXGRP); |
826 | 823 | ||
827 | /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ | 824 | /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ |
828 | vol->rw = TRUE; | 825 | vol->rw = true; |
829 | /* default is always to request posix paths. */ | 826 | /* default is always to request posix paths. */ |
830 | vol->posix_paths = 1; | 827 | vol->posix_paths = 1; |
831 | 828 | ||
@@ -1181,7 +1178,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1181 | } else if (strnicmp(data, "guest", 5) == 0) { | 1178 | } else if (strnicmp(data, "guest", 5) == 0) { |
1182 | /* ignore */ | 1179 | /* ignore */ |
1183 | } else if (strnicmp(data, "rw", 2) == 0) { | 1180 | } else if (strnicmp(data, "rw", 2) == 0) { |
1184 | vol->rw = TRUE; | 1181 | vol->rw = true; |
1185 | } else if ((strnicmp(data, "suid", 4) == 0) || | 1182 | } else if ((strnicmp(data, "suid", 4) == 0) || |
1186 | (strnicmp(data, "nosuid", 6) == 0) || | 1183 | (strnicmp(data, "nosuid", 6) == 0) || |
1187 | (strnicmp(data, "exec", 4) == 0) || | 1184 | (strnicmp(data, "exec", 4) == 0) || |
@@ -1197,7 +1194,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1197 | is ok to just ignore them */ | 1194 | is ok to just ignore them */ |
1198 | continue; | 1195 | continue; |
1199 | } else if (strnicmp(data, "ro", 2) == 0) { | 1196 | } else if (strnicmp(data, "ro", 2) == 0) { |
1200 | vol->rw = FALSE; | 1197 | vol->rw = false; |
1201 | } else if (strnicmp(data, "hard", 4) == 0) { | 1198 | } else if (strnicmp(data, "hard", 4) == 0) { |
1202 | vol->retry = 1; | 1199 | vol->retry = 1; |
1203 | } else if (strnicmp(data, "soft", 4) == 0) { | 1200 | } else if (strnicmp(data, "soft", 4) == 0) { |
@@ -1305,6 +1302,9 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1305 | "begin with // or \\\\ \n"); | 1302 | "begin with // or \\\\ \n"); |
1306 | return 1; | 1303 | return 1; |
1307 | } | 1304 | } |
1305 | value = strpbrk(vol->UNC+2, "/\\"); | ||
1306 | if (value) | ||
1307 | *value = '\\'; | ||
1308 | } else { | 1308 | } else { |
1309 | printk(KERN_WARNING "CIFS: UNC name too long\n"); | 1309 | printk(KERN_WARNING "CIFS: UNC name too long\n"); |
1310 | return 1; | 1310 | return 1; |
@@ -1362,45 +1362,43 @@ find_unc(__be32 new_target_ip_addr, char *uncName, char *userName) | |||
1362 | { | 1362 | { |
1363 | struct list_head *tmp; | 1363 | struct list_head *tmp; |
1364 | struct cifsTconInfo *tcon; | 1364 | struct cifsTconInfo *tcon; |
1365 | __be32 old_ip; | ||
1365 | 1366 | ||
1366 | read_lock(&GlobalSMBSeslock); | 1367 | read_lock(&GlobalSMBSeslock); |
1368 | |||
1367 | list_for_each(tmp, &GlobalTreeConnectionList) { | 1369 | list_for_each(tmp, &GlobalTreeConnectionList) { |
1368 | cFYI(1, ("Next tcon")); | 1370 | cFYI(1, ("Next tcon")); |
1369 | tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); | 1371 | tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); |
1370 | if (tcon->ses) { | 1372 | if (!tcon->ses || !tcon->ses->server) |
1371 | if (tcon->ses->server) { | 1373 | continue; |
1372 | cFYI(1, | 1374 | |
1373 | ("old ip addr: %x == new ip %x ?", | 1375 | old_ip = tcon->ses->server->addr.sockAddr.sin_addr.s_addr; |
1374 | tcon->ses->server->addr.sockAddr.sin_addr. | 1376 | cFYI(1, ("old ip addr: %x == new ip %x ?", |
1375 | s_addr, new_target_ip_addr)); | 1377 | old_ip, new_target_ip_addr)); |
1376 | if (tcon->ses->server->addr.sockAddr.sin_addr. | 1378 | |
1377 | s_addr == new_target_ip_addr) { | 1379 | if (old_ip != new_target_ip_addr) |
1378 | /* BB lock tcon, server and tcp session and increment use count here? */ | 1380 | continue; |
1379 | /* found a match on the TCP session */ | 1381 | |
1380 | /* BB check if reconnection needed */ | 1382 | /* BB lock tcon, server, tcp session and increment use count? */ |
1381 | cFYI(1, | 1383 | /* found a match on the TCP session */ |
1382 | ("IP match, old UNC: %s new: %s", | 1384 | /* BB check if reconnection needed */ |
1383 | tcon->treeName, uncName)); | 1385 | cFYI(1, ("IP match, old UNC: %s new: %s", |
1384 | if (strncmp | 1386 | tcon->treeName, uncName)); |
1385 | (tcon->treeName, uncName, | 1387 | |
1386 | MAX_TREE_SIZE) == 0) { | 1388 | if (strncmp(tcon->treeName, uncName, MAX_TREE_SIZE)) |
1387 | cFYI(1, | 1389 | continue; |
1388 | ("and old usr: %s new: %s", | 1390 | |
1389 | tcon->treeName, uncName)); | 1391 | cFYI(1, ("and old usr: %s new: %s", |
1390 | if (strncmp | 1392 | tcon->treeName, uncName)); |
1391 | (tcon->ses->userName, | 1393 | |
1392 | userName, | 1394 | if (strncmp(tcon->ses->userName, userName, MAX_USERNAME_SIZE)) |
1393 | MAX_USERNAME_SIZE) == 0) { | 1395 | continue; |
1394 | read_unlock(&GlobalSMBSeslock); | 1396 | |
1395 | /* matched smb session | 1397 | /* matched smb session (user name) */ |
1396 | (user name */ | 1398 | read_unlock(&GlobalSMBSeslock); |
1397 | return tcon; | 1399 | return tcon; |
1398 | } | ||
1399 | } | ||
1400 | } | ||
1401 | } | ||
1402 | } | ||
1403 | } | 1400 | } |
1401 | |||
1404 | read_unlock(&GlobalSMBSeslock); | 1402 | read_unlock(&GlobalSMBSeslock); |
1405 | return NULL; | 1403 | return NULL; |
1406 | } | 1404 | } |
@@ -1982,7 +1980,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1982 | kfree(srvTcp->hostname); | 1980 | kfree(srvTcp->hostname); |
1983 | goto out; | 1981 | goto out; |
1984 | } | 1982 | } |
1985 | wait_for_completion(&cifsd_complete); | ||
1986 | rc = 0; | 1983 | rc = 0; |
1987 | memcpy(srvTcp->workstation_RFC1001_name, | 1984 | memcpy(srvTcp->workstation_RFC1001_name, |
1988 | volume_info.source_rfc1001_name, 16); | 1985 | volume_info.source_rfc1001_name, 16); |
@@ -2602,7 +2599,7 @@ sesssetup_nomem: /* do not return an error on nomem for the info strings, | |||
2602 | 2599 | ||
2603 | static int | 2600 | static int |
2604 | CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | 2601 | CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, |
2605 | struct cifsSesInfo *ses, int *pNTLMv2_flag, | 2602 | struct cifsSesInfo *ses, bool *pNTLMv2_flag, |
2606 | const struct nls_table *nls_codepage) | 2603 | const struct nls_table *nls_codepage) |
2607 | { | 2604 | { |
2608 | struct smb_hdr *smb_buffer; | 2605 | struct smb_hdr *smb_buffer; |
@@ -2625,7 +2622,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2625 | if (ses == NULL) | 2622 | if (ses == NULL) |
2626 | return -EINVAL; | 2623 | return -EINVAL; |
2627 | domain = ses->domainName; | 2624 | domain = ses->domainName; |
2628 | *pNTLMv2_flag = FALSE; | 2625 | *pNTLMv2_flag = false; |
2629 | smb_buffer = cifs_buf_get(); | 2626 | smb_buffer = cifs_buf_get(); |
2630 | if (smb_buffer == NULL) { | 2627 | if (smb_buffer == NULL) { |
2631 | return -ENOMEM; | 2628 | return -ENOMEM; |
@@ -2778,7 +2775,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2778 | CIFS_CRYPTO_KEY_SIZE); | 2775 | CIFS_CRYPTO_KEY_SIZE); |
2779 | if (SecurityBlob2->NegotiateFlags & | 2776 | if (SecurityBlob2->NegotiateFlags & |
2780 | cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2)) | 2777 | cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2)) |
2781 | *pNTLMv2_flag = TRUE; | 2778 | *pNTLMv2_flag = true; |
2782 | 2779 | ||
2783 | if ((SecurityBlob2->NegotiateFlags & | 2780 | if ((SecurityBlob2->NegotiateFlags & |
2784 | cpu_to_le32(NTLMSSP_NEGOTIATE_ALWAYS_SIGN)) | 2781 | cpu_to_le32(NTLMSSP_NEGOTIATE_ALWAYS_SIGN)) |
@@ -2939,7 +2936,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2939 | } | 2936 | } |
2940 | static int | 2937 | static int |
2941 | CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | 2938 | CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, |
2942 | char *ntlm_session_key, int ntlmv2_flag, | 2939 | char *ntlm_session_key, bool ntlmv2_flag, |
2943 | const struct nls_table *nls_codepage) | 2940 | const struct nls_table *nls_codepage) |
2944 | { | 2941 | { |
2945 | struct smb_hdr *smb_buffer; | 2942 | struct smb_hdr *smb_buffer; |
@@ -3556,8 +3553,6 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) | |||
3556 | cifs_sb->prepath = NULL; | 3553 | cifs_sb->prepath = NULL; |
3557 | kfree(tmp); | 3554 | kfree(tmp); |
3558 | if (ses) | 3555 | if (ses) |
3559 | schedule_timeout_interruptible(msecs_to_jiffies(500)); | ||
3560 | if (ses) | ||
3561 | sesInfoFree(ses); | 3556 | sesInfoFree(ses); |
3562 | 3557 | ||
3563 | FreeXid(xid); | 3558 | FreeXid(xid); |
@@ -3569,7 +3564,7 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, | |||
3569 | { | 3564 | { |
3570 | int rc = 0; | 3565 | int rc = 0; |
3571 | char ntlm_session_key[CIFS_SESS_KEY_SIZE]; | 3566 | char ntlm_session_key[CIFS_SESS_KEY_SIZE]; |
3572 | int ntlmv2_flag = FALSE; | 3567 | bool ntlmv2_flag = false; |
3573 | int first_time = 0; | 3568 | int first_time = 0; |
3574 | 3569 | ||
3575 | /* what if server changes its buffer size after dropping the session? */ | 3570 | /* what if server changes its buffer size after dropping the session? */ |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 0f5c62ba403..6ed775986be 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -130,7 +130,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
130 | struct cifsFileInfo *pCifsFile = NULL; | 130 | struct cifsFileInfo *pCifsFile = NULL; |
131 | struct cifsInodeInfo *pCifsInode; | 131 | struct cifsInodeInfo *pCifsInode; |
132 | int disposition = FILE_OVERWRITE_IF; | 132 | int disposition = FILE_OVERWRITE_IF; |
133 | int write_only = FALSE; | 133 | bool write_only = false; |
134 | 134 | ||
135 | xid = GetXid(); | 135 | xid = GetXid(); |
136 | 136 | ||
@@ -152,7 +152,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
152 | if (oflags & FMODE_WRITE) { | 152 | if (oflags & FMODE_WRITE) { |
153 | desiredAccess |= GENERIC_WRITE; | 153 | desiredAccess |= GENERIC_WRITE; |
154 | if (!(oflags & FMODE_READ)) | 154 | if (!(oflags & FMODE_READ)) |
155 | write_only = TRUE; | 155 | write_only = true; |
156 | } | 156 | } |
157 | 157 | ||
158 | if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) | 158 | if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) |
@@ -254,7 +254,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
254 | d_instantiate(direntry, newinode); | 254 | d_instantiate(direntry, newinode); |
255 | } | 255 | } |
256 | if ((nd == NULL /* nfsd case - nfs srv does not set nd */) || | 256 | if ((nd == NULL /* nfsd case - nfs srv does not set nd */) || |
257 | ((nd->flags & LOOKUP_OPEN) == FALSE)) { | 257 | (!(nd->flags & LOOKUP_OPEN))) { |
258 | /* mknod case - do not leave file open */ | 258 | /* mknod case - do not leave file open */ |
259 | CIFSSMBClose(xid, pTcon, fileHandle); | 259 | CIFSSMBClose(xid, pTcon, fileHandle); |
260 | } else if (newinode) { | 260 | } else if (newinode) { |
@@ -266,8 +266,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
266 | pCifsFile->netfid = fileHandle; | 266 | pCifsFile->netfid = fileHandle; |
267 | pCifsFile->pid = current->tgid; | 267 | pCifsFile->pid = current->tgid; |
268 | pCifsFile->pInode = newinode; | 268 | pCifsFile->pInode = newinode; |
269 | pCifsFile->invalidHandle = FALSE; | 269 | pCifsFile->invalidHandle = false; |
270 | pCifsFile->closePend = FALSE; | 270 | pCifsFile->closePend = false; |
271 | init_MUTEX(&pCifsFile->fh_sem); | 271 | init_MUTEX(&pCifsFile->fh_sem); |
272 | mutex_init(&pCifsFile->lock_mutex); | 272 | mutex_init(&pCifsFile->lock_mutex); |
273 | INIT_LIST_HEAD(&pCifsFile->llist); | 273 | INIT_LIST_HEAD(&pCifsFile->llist); |
@@ -280,7 +280,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
280 | pCifsInode = CIFS_I(newinode); | 280 | pCifsInode = CIFS_I(newinode); |
281 | if (pCifsInode) { | 281 | if (pCifsInode) { |
282 | /* if readable file instance put first in list*/ | 282 | /* if readable file instance put first in list*/ |
283 | if (write_only == TRUE) { | 283 | if (write_only) { |
284 | list_add_tail(&pCifsFile->flist, | 284 | list_add_tail(&pCifsFile->flist, |
285 | &pCifsInode->openFileList); | 285 | &pCifsInode->openFileList); |
286 | } else { | 286 | } else { |
@@ -288,12 +288,12 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
288 | &pCifsInode->openFileList); | 288 | &pCifsInode->openFileList); |
289 | } | 289 | } |
290 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 290 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
291 | pCifsInode->clientCanCacheAll = TRUE; | 291 | pCifsInode->clientCanCacheAll = true; |
292 | pCifsInode->clientCanCacheRead = TRUE; | 292 | pCifsInode->clientCanCacheRead = true; |
293 | cFYI(1, ("Exclusive Oplock inode %p", | 293 | cFYI(1, ("Exclusive Oplock inode %p", |
294 | newinode)); | 294 | newinode)); |
295 | } else if ((oplock & 0xF) == OPLOCK_READ) | 295 | } else if ((oplock & 0xF) == OPLOCK_READ) |
296 | pCifsInode->clientCanCacheRead = TRUE; | 296 | pCifsInode->clientCanCacheRead = true; |
297 | } | 297 | } |
298 | write_unlock(&GlobalSMBSeslock); | 298 | write_unlock(&GlobalSMBSeslock); |
299 | } | 299 | } |
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index 7cc86c41818..939e256f849 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c | |||
@@ -55,6 +55,32 @@ struct key_type key_type_dns_resolver = { | |||
55 | .match = user_match, | 55 | .match = user_match, |
56 | }; | 56 | }; |
57 | 57 | ||
58 | /* Checks if supplied name is IP address | ||
59 | * returns: | ||
60 | * 1 - name is IP | ||
61 | * 0 - name is not IP | ||
62 | */ | ||
63 | static int is_ip(const char *name) | ||
64 | { | ||
65 | int rc; | ||
66 | struct sockaddr_in sin_server; | ||
67 | struct sockaddr_in6 sin_server6; | ||
68 | |||
69 | rc = cifs_inet_pton(AF_INET, name, | ||
70 | &sin_server.sin_addr.s_addr); | ||
71 | |||
72 | if (rc <= 0) { | ||
73 | /* not ipv4 address, try ipv6 */ | ||
74 | rc = cifs_inet_pton(AF_INET6, name, | ||
75 | &sin_server6.sin6_addr.in6_u); | ||
76 | if (rc > 0) | ||
77 | return 1; | ||
78 | } else { | ||
79 | return 1; | ||
80 | } | ||
81 | /* we failed translating address */ | ||
82 | return 0; | ||
83 | } | ||
58 | 84 | ||
59 | /* Resolves server name to ip address. | 85 | /* Resolves server name to ip address. |
60 | * input: | 86 | * input: |
@@ -67,8 +93,9 @@ int | |||
67 | dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) | 93 | dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) |
68 | { | 94 | { |
69 | int rc = -EAGAIN; | 95 | int rc = -EAGAIN; |
70 | struct key *rkey; | 96 | struct key *rkey = ERR_PTR(-EAGAIN); |
71 | char *name; | 97 | char *name; |
98 | char *data = NULL; | ||
72 | int len; | 99 | int len; |
73 | 100 | ||
74 | if (!ip_addr || !unc) | 101 | if (!ip_addr || !unc) |
@@ -97,26 +124,41 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) | |||
97 | memcpy(name, unc+2, len); | 124 | memcpy(name, unc+2, len); |
98 | name[len] = 0; | 125 | name[len] = 0; |
99 | 126 | ||
127 | if (is_ip(name)) { | ||
128 | cFYI(1, ("%s: it is IP, skipping dns upcall: %s", | ||
129 | __func__, name)); | ||
130 | data = name; | ||
131 | goto skip_upcall; | ||
132 | } | ||
133 | |||
100 | rkey = request_key(&key_type_dns_resolver, name, ""); | 134 | rkey = request_key(&key_type_dns_resolver, name, ""); |
101 | if (!IS_ERR(rkey)) { | 135 | if (!IS_ERR(rkey)) { |
102 | len = strlen(rkey->payload.data); | 136 | data = rkey->payload.data; |
103 | *ip_addr = kmalloc(len+1, GFP_KERNEL); | 137 | cFYI(1, ("%s: resolved: %s to %s", __func__, |
104 | if (*ip_addr) { | ||
105 | memcpy(*ip_addr, rkey->payload.data, len); | ||
106 | (*ip_addr)[len] = '\0'; | ||
107 | cFYI(1, ("%s: resolved: %s to %s", __func__, | ||
108 | rkey->description, | 138 | rkey->description, |
109 | *ip_addr | 139 | *ip_addr |
110 | )); | 140 | )); |
141 | } else { | ||
142 | cERROR(1, ("%s: unable to resolve: %s", __func__, name)); | ||
143 | goto out; | ||
144 | } | ||
145 | |||
146 | skip_upcall: | ||
147 | if (data) { | ||
148 | len = strlen(data); | ||
149 | *ip_addr = kmalloc(len+1, GFP_KERNEL); | ||
150 | if (*ip_addr) { | ||
151 | memcpy(*ip_addr, data, len); | ||
152 | (*ip_addr)[len] = '\0'; | ||
111 | rc = 0; | 153 | rc = 0; |
112 | } else { | 154 | } else { |
113 | rc = -ENOMEM; | 155 | rc = -ENOMEM; |
114 | } | 156 | } |
115 | key_put(rkey); | 157 | if (!IS_ERR(rkey)) |
116 | } else { | 158 | key_put(rkey); |
117 | cERROR(1, ("%s: unable to resolve: %s", __func__, name)); | ||
118 | } | 159 | } |
119 | 160 | ||
161 | out: | ||
120 | kfree(name); | 162 | kfree(name); |
121 | return rc; | 163 | return rc; |
122 | } | 164 | } |
diff --git a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c index 7d1d5aa4c43..5a57581eb4b 100644 --- a/fs/cifs/fcntl.c +++ b/fs/cifs/fcntl.c | |||
@@ -68,7 +68,7 @@ int cifs_dir_notify(struct file *file, unsigned long arg) | |||
68 | { | 68 | { |
69 | int xid; | 69 | int xid; |
70 | int rc = -EINVAL; | 70 | int rc = -EINVAL; |
71 | int oplock = FALSE; | 71 | int oplock = 0; |
72 | struct cifs_sb_info *cifs_sb; | 72 | struct cifs_sb_info *cifs_sb; |
73 | struct cifsTconInfo *pTcon; | 73 | struct cifsTconInfo *pTcon; |
74 | char *full_path = NULL; | 74 | char *full_path = NULL; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 40b690073fc..31a0a33b9d9 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -51,8 +51,8 @@ static inline struct cifsFileInfo *cifs_init_private( | |||
51 | INIT_LIST_HEAD(&private_data->llist); | 51 | INIT_LIST_HEAD(&private_data->llist); |
52 | private_data->pfile = file; /* needed for writepage */ | 52 | private_data->pfile = file; /* needed for writepage */ |
53 | private_data->pInode = inode; | 53 | private_data->pInode = inode; |
54 | private_data->invalidHandle = FALSE; | 54 | private_data->invalidHandle = false; |
55 | private_data->closePend = FALSE; | 55 | private_data->closePend = false; |
56 | /* we have to track num writers to the inode, since writepages | 56 | /* we have to track num writers to the inode, since writepages |
57 | does not tell us which handle the write is for so there can | 57 | does not tell us which handle the write is for so there can |
58 | be a close (overlapping with write) of the filehandle that | 58 | be a close (overlapping with write) of the filehandle that |
@@ -148,12 +148,12 @@ client_can_cache: | |||
148 | full_path, buf, inode->i_sb, xid, NULL); | 148 | full_path, buf, inode->i_sb, xid, NULL); |
149 | 149 | ||
150 | if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 150 | if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
151 | pCifsInode->clientCanCacheAll = TRUE; | 151 | pCifsInode->clientCanCacheAll = true; |
152 | pCifsInode->clientCanCacheRead = TRUE; | 152 | pCifsInode->clientCanCacheRead = true; |
153 | cFYI(1, ("Exclusive Oplock granted on inode %p", | 153 | cFYI(1, ("Exclusive Oplock granted on inode %p", |
154 | file->f_path.dentry->d_inode)); | 154 | file->f_path.dentry->d_inode)); |
155 | } else if ((*oplock & 0xF) == OPLOCK_READ) | 155 | } else if ((*oplock & 0xF) == OPLOCK_READ) |
156 | pCifsInode->clientCanCacheRead = TRUE; | 156 | pCifsInode->clientCanCacheRead = true; |
157 | 157 | ||
158 | return rc; | 158 | return rc; |
159 | } | 159 | } |
@@ -247,7 +247,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
247 | if (oplockEnabled) | 247 | if (oplockEnabled) |
248 | oplock = REQ_OPLOCK; | 248 | oplock = REQ_OPLOCK; |
249 | else | 249 | else |
250 | oplock = FALSE; | 250 | oplock = 0; |
251 | 251 | ||
252 | /* BB pass O_SYNC flag through on file attributes .. BB */ | 252 | /* BB pass O_SYNC flag through on file attributes .. BB */ |
253 | 253 | ||
@@ -339,7 +339,7 @@ static int cifs_relock_file(struct cifsFileInfo *cifsFile) | |||
339 | return rc; | 339 | return rc; |
340 | } | 340 | } |
341 | 341 | ||
342 | static int cifs_reopen_file(struct file *file, int can_flush) | 342 | static int cifs_reopen_file(struct file *file, bool can_flush) |
343 | { | 343 | { |
344 | int rc = -EACCES; | 344 | int rc = -EACCES; |
345 | int xid, oplock; | 345 | int xid, oplock; |
@@ -360,7 +360,7 @@ static int cifs_reopen_file(struct file *file, int can_flush) | |||
360 | 360 | ||
361 | xid = GetXid(); | 361 | xid = GetXid(); |
362 | down(&pCifsFile->fh_sem); | 362 | down(&pCifsFile->fh_sem); |
363 | if (pCifsFile->invalidHandle == FALSE) { | 363 | if (!pCifsFile->invalidHandle) { |
364 | up(&pCifsFile->fh_sem); | 364 | up(&pCifsFile->fh_sem); |
365 | FreeXid(xid); | 365 | FreeXid(xid); |
366 | return 0; | 366 | return 0; |
@@ -404,7 +404,7 @@ reopen_error_exit: | |||
404 | if (oplockEnabled) | 404 | if (oplockEnabled) |
405 | oplock = REQ_OPLOCK; | 405 | oplock = REQ_OPLOCK; |
406 | else | 406 | else |
407 | oplock = FALSE; | 407 | oplock = 0; |
408 | 408 | ||
409 | /* Can not refresh inode by passing in file_info buf to be returned | 409 | /* Can not refresh inode by passing in file_info buf to be returned |
410 | by SMBOpen and then calling get_inode_info with returned buf | 410 | by SMBOpen and then calling get_inode_info with returned buf |
@@ -422,7 +422,7 @@ reopen_error_exit: | |||
422 | cFYI(1, ("oplock: %d", oplock)); | 422 | cFYI(1, ("oplock: %d", oplock)); |
423 | } else { | 423 | } else { |
424 | pCifsFile->netfid = netfid; | 424 | pCifsFile->netfid = netfid; |
425 | pCifsFile->invalidHandle = FALSE; | 425 | pCifsFile->invalidHandle = false; |
426 | up(&pCifsFile->fh_sem); | 426 | up(&pCifsFile->fh_sem); |
427 | pCifsInode = CIFS_I(inode); | 427 | pCifsInode = CIFS_I(inode); |
428 | if (pCifsInode) { | 428 | if (pCifsInode) { |
@@ -432,8 +432,8 @@ reopen_error_exit: | |||
432 | CIFS_I(inode)->write_behind_rc = rc; | 432 | CIFS_I(inode)->write_behind_rc = rc; |
433 | /* temporarily disable caching while we | 433 | /* temporarily disable caching while we |
434 | go to server to get inode info */ | 434 | go to server to get inode info */ |
435 | pCifsInode->clientCanCacheAll = FALSE; | 435 | pCifsInode->clientCanCacheAll = false; |
436 | pCifsInode->clientCanCacheRead = FALSE; | 436 | pCifsInode->clientCanCacheRead = false; |
437 | if (pTcon->unix_ext) | 437 | if (pTcon->unix_ext) |
438 | rc = cifs_get_inode_info_unix(&inode, | 438 | rc = cifs_get_inode_info_unix(&inode, |
439 | full_path, inode->i_sb, xid); | 439 | full_path, inode->i_sb, xid); |
@@ -448,16 +448,16 @@ reopen_error_exit: | |||
448 | we can not go to the server to get the new inod | 448 | we can not go to the server to get the new inod |
449 | info */ | 449 | info */ |
450 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 450 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
451 | pCifsInode->clientCanCacheAll = TRUE; | 451 | pCifsInode->clientCanCacheAll = true; |
452 | pCifsInode->clientCanCacheRead = TRUE; | 452 | pCifsInode->clientCanCacheRead = true; |
453 | cFYI(1, ("Exclusive Oplock granted on inode %p", | 453 | cFYI(1, ("Exclusive Oplock granted on inode %p", |
454 | file->f_path.dentry->d_inode)); | 454 | file->f_path.dentry->d_inode)); |
455 | } else if ((oplock & 0xF) == OPLOCK_READ) { | 455 | } else if ((oplock & 0xF) == OPLOCK_READ) { |
456 | pCifsInode->clientCanCacheRead = TRUE; | 456 | pCifsInode->clientCanCacheRead = true; |
457 | pCifsInode->clientCanCacheAll = FALSE; | 457 | pCifsInode->clientCanCacheAll = false; |
458 | } else { | 458 | } else { |
459 | pCifsInode->clientCanCacheRead = FALSE; | 459 | pCifsInode->clientCanCacheRead = false; |
460 | pCifsInode->clientCanCacheAll = FALSE; | 460 | pCifsInode->clientCanCacheAll = false; |
461 | } | 461 | } |
462 | cifs_relock_file(pCifsFile); | 462 | cifs_relock_file(pCifsFile); |
463 | } | 463 | } |
@@ -484,7 +484,7 @@ int cifs_close(struct inode *inode, struct file *file) | |||
484 | if (pSMBFile) { | 484 | if (pSMBFile) { |
485 | struct cifsLockInfo *li, *tmp; | 485 | struct cifsLockInfo *li, *tmp; |
486 | 486 | ||
487 | pSMBFile->closePend = TRUE; | 487 | pSMBFile->closePend = true; |
488 | if (pTcon) { | 488 | if (pTcon) { |
489 | /* no sense reconnecting to close a file that is | 489 | /* no sense reconnecting to close a file that is |
490 | already closed */ | 490 | already closed */ |
@@ -553,8 +553,8 @@ int cifs_close(struct inode *inode, struct file *file) | |||
553 | cFYI(1, ("closing last open instance for inode %p", inode)); | 553 | cFYI(1, ("closing last open instance for inode %p", inode)); |
554 | /* if the file is not open we do not know if we can cache info | 554 | /* if the file is not open we do not know if we can cache info |
555 | on this inode, much less write behind and read ahead */ | 555 | on this inode, much less write behind and read ahead */ |
556 | CIFS_I(inode)->clientCanCacheRead = FALSE; | 556 | CIFS_I(inode)->clientCanCacheRead = false; |
557 | CIFS_I(inode)->clientCanCacheAll = FALSE; | 557 | CIFS_I(inode)->clientCanCacheAll = false; |
558 | } | 558 | } |
559 | read_unlock(&GlobalSMBSeslock); | 559 | read_unlock(&GlobalSMBSeslock); |
560 | if ((rc == 0) && CIFS_I(inode)->write_behind_rc) | 560 | if ((rc == 0) && CIFS_I(inode)->write_behind_rc) |
@@ -583,9 +583,9 @@ int cifs_closedir(struct inode *inode, struct file *file) | |||
583 | pTcon = cifs_sb->tcon; | 583 | pTcon = cifs_sb->tcon; |
584 | 584 | ||
585 | cFYI(1, ("Freeing private data in close dir")); | 585 | cFYI(1, ("Freeing private data in close dir")); |
586 | if ((pCFileStruct->srch_inf.endOfSearch == FALSE) && | 586 | if (!pCFileStruct->srch_inf.endOfSearch && |
587 | (pCFileStruct->invalidHandle == FALSE)) { | 587 | !pCFileStruct->invalidHandle) { |
588 | pCFileStruct->invalidHandle = TRUE; | 588 | pCFileStruct->invalidHandle = true; |
589 | rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); | 589 | rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); |
590 | cFYI(1, ("Closing uncompleted readdir with rc %d", | 590 | cFYI(1, ("Closing uncompleted readdir with rc %d", |
591 | rc)); | 591 | rc)); |
@@ -637,12 +637,12 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
637 | __u32 numLock = 0; | 637 | __u32 numLock = 0; |
638 | __u32 numUnlock = 0; | 638 | __u32 numUnlock = 0; |
639 | __u64 length; | 639 | __u64 length; |
640 | int wait_flag = FALSE; | 640 | bool wait_flag = false; |
641 | struct cifs_sb_info *cifs_sb; | 641 | struct cifs_sb_info *cifs_sb; |
642 | struct cifsTconInfo *pTcon; | 642 | struct cifsTconInfo *pTcon; |
643 | __u16 netfid; | 643 | __u16 netfid; |
644 | __u8 lockType = LOCKING_ANDX_LARGE_FILES; | 644 | __u8 lockType = LOCKING_ANDX_LARGE_FILES; |
645 | int posix_locking; | 645 | bool posix_locking; |
646 | 646 | ||
647 | length = 1 + pfLock->fl_end - pfLock->fl_start; | 647 | length = 1 + pfLock->fl_end - pfLock->fl_start; |
648 | rc = -EACCES; | 648 | rc = -EACCES; |
@@ -659,7 +659,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
659 | cFYI(1, ("Flock")); | 659 | cFYI(1, ("Flock")); |
660 | if (pfLock->fl_flags & FL_SLEEP) { | 660 | if (pfLock->fl_flags & FL_SLEEP) { |
661 | cFYI(1, ("Blocking lock")); | 661 | cFYI(1, ("Blocking lock")); |
662 | wait_flag = TRUE; | 662 | wait_flag = true; |
663 | } | 663 | } |
664 | if (pfLock->fl_flags & FL_ACCESS) | 664 | if (pfLock->fl_flags & FL_ACCESS) |
665 | cFYI(1, ("Process suspended by mandatory locking - " | 665 | cFYI(1, ("Process suspended by mandatory locking - " |
@@ -794,7 +794,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
794 | stored_rc = CIFSSMBLock(xid, pTcon, | 794 | stored_rc = CIFSSMBLock(xid, pTcon, |
795 | netfid, | 795 | netfid, |
796 | li->length, li->offset, | 796 | li->length, li->offset, |
797 | 1, 0, li->type, FALSE); | 797 | 1, 0, li->type, false); |
798 | if (stored_rc) | 798 | if (stored_rc) |
799 | rc = stored_rc; | 799 | rc = stored_rc; |
800 | 800 | ||
@@ -866,7 +866,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data, | |||
866 | filemap_fdatawait from here so tell | 866 | filemap_fdatawait from here so tell |
867 | reopen_file not to flush data to server | 867 | reopen_file not to flush data to server |
868 | now */ | 868 | now */ |
869 | rc = cifs_reopen_file(file, FALSE); | 869 | rc = cifs_reopen_file(file, false); |
870 | if (rc != 0) | 870 | if (rc != 0) |
871 | break; | 871 | break; |
872 | } | 872 | } |
@@ -966,7 +966,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
966 | filemap_fdatawait from here so tell | 966 | filemap_fdatawait from here so tell |
967 | reopen_file not to flush data to | 967 | reopen_file not to flush data to |
968 | server now */ | 968 | server now */ |
969 | rc = cifs_reopen_file(file, FALSE); | 969 | rc = cifs_reopen_file(file, false); |
970 | if (rc != 0) | 970 | if (rc != 0) |
971 | break; | 971 | break; |
972 | } | 972 | } |
@@ -1093,7 +1093,7 @@ refind_writable: | |||
1093 | 1093 | ||
1094 | read_unlock(&GlobalSMBSeslock); | 1094 | read_unlock(&GlobalSMBSeslock); |
1095 | /* Had to unlock since following call can block */ | 1095 | /* Had to unlock since following call can block */ |
1096 | rc = cifs_reopen_file(open_file->pfile, FALSE); | 1096 | rc = cifs_reopen_file(open_file->pfile, false); |
1097 | if (!rc) { | 1097 | if (!rc) { |
1098 | if (!open_file->closePend) | 1098 | if (!open_file->closePend) |
1099 | return open_file; | 1099 | return open_file; |
@@ -1608,7 +1608,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, | |||
1608 | int buf_type = CIFS_NO_BUFFER; | 1608 | int buf_type = CIFS_NO_BUFFER; |
1609 | if ((open_file->invalidHandle) && | 1609 | if ((open_file->invalidHandle) && |
1610 | (!open_file->closePend)) { | 1610 | (!open_file->closePend)) { |
1611 | rc = cifs_reopen_file(file, TRUE); | 1611 | rc = cifs_reopen_file(file, true); |
1612 | if (rc != 0) | 1612 | if (rc != 0) |
1613 | break; | 1613 | break; |
1614 | } | 1614 | } |
@@ -1693,7 +1693,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, | |||
1693 | while (rc == -EAGAIN) { | 1693 | while (rc == -EAGAIN) { |
1694 | if ((open_file->invalidHandle) && | 1694 | if ((open_file->invalidHandle) && |
1695 | (!open_file->closePend)) { | 1695 | (!open_file->closePend)) { |
1696 | rc = cifs_reopen_file(file, TRUE); | 1696 | rc = cifs_reopen_file(file, true); |
1697 | if (rc != 0) | 1697 | if (rc != 0) |
1698 | break; | 1698 | break; |
1699 | } | 1699 | } |
@@ -1850,7 +1850,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
1850 | while (rc == -EAGAIN) { | 1850 | while (rc == -EAGAIN) { |
1851 | if ((open_file->invalidHandle) && | 1851 | if ((open_file->invalidHandle) && |
1852 | (!open_file->closePend)) { | 1852 | (!open_file->closePend)) { |
1853 | rc = cifs_reopen_file(file, TRUE); | 1853 | rc = cifs_reopen_file(file, true); |
1854 | if (rc != 0) | 1854 | if (rc != 0) |
1855 | break; | 1855 | break; |
1856 | } | 1856 | } |
@@ -2009,10 +2009,10 @@ static int is_inode_writable(struct cifsInodeInfo *cifs_inode) | |||
2009 | refreshing the inode only on increases in the file size | 2009 | refreshing the inode only on increases in the file size |
2010 | but this is tricky to do without racing with writebehind | 2010 | but this is tricky to do without racing with writebehind |
2011 | page caching in the current Linux kernel design */ | 2011 | page caching in the current Linux kernel design */ |
2012 | int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) | 2012 | bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) |
2013 | { | 2013 | { |
2014 | if (!cifsInode) | 2014 | if (!cifsInode) |
2015 | return 1; | 2015 | return true; |
2016 | 2016 | ||
2017 | if (is_inode_writable(cifsInode)) { | 2017 | if (is_inode_writable(cifsInode)) { |
2018 | /* This inode is open for write at least once */ | 2018 | /* This inode is open for write at least once */ |
@@ -2022,15 +2022,15 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) | |||
2022 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | 2022 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { |
2023 | /* since no page cache to corrupt on directio | 2023 | /* since no page cache to corrupt on directio |
2024 | we can change size safely */ | 2024 | we can change size safely */ |
2025 | return 1; | 2025 | return true; |
2026 | } | 2026 | } |
2027 | 2027 | ||
2028 | if (i_size_read(&cifsInode->vfs_inode) < end_of_file) | 2028 | if (i_size_read(&cifsInode->vfs_inode) < end_of_file) |
2029 | return 1; | 2029 | return true; |
2030 | 2030 | ||
2031 | return 0; | 2031 | return false; |
2032 | } else | 2032 | } else |
2033 | return 1; | 2033 | return true; |
2034 | } | 2034 | } |
2035 | 2035 | ||
2036 | static int cifs_prepare_write(struct file *file, struct page *page, | 2036 | static int cifs_prepare_write(struct file *file, struct page *page, |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index e1031b9e2c5..0d9d2e6d7af 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -281,7 +281,7 @@ static int decode_sfu_inode(struct inode *inode, __u64 size, | |||
281 | struct cifs_sb_info *cifs_sb, int xid) | 281 | struct cifs_sb_info *cifs_sb, int xid) |
282 | { | 282 | { |
283 | int rc; | 283 | int rc; |
284 | int oplock = FALSE; | 284 | int oplock = 0; |
285 | __u16 netfid; | 285 | __u16 netfid; |
286 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | 286 | struct cifsTconInfo *pTcon = cifs_sb->tcon; |
287 | char buf[24]; | 287 | char buf[24]; |
@@ -389,7 +389,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
389 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 389 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
390 | const unsigned char *full_path = NULL; | 390 | const unsigned char *full_path = NULL; |
391 | char *buf = NULL; | 391 | char *buf = NULL; |
392 | int adjustTZ = FALSE; | 392 | bool adjustTZ = false; |
393 | bool is_dfs_referral = false; | 393 | bool is_dfs_referral = false; |
394 | 394 | ||
395 | pTcon = cifs_sb->tcon; | 395 | pTcon = cifs_sb->tcon; |
@@ -425,7 +425,7 @@ try_again_CIFSSMBQPathInfo: | |||
425 | pfindData, cifs_sb->local_nls, | 425 | pfindData, cifs_sb->local_nls, |
426 | cifs_sb->mnt_cifs_flags & | 426 | cifs_sb->mnt_cifs_flags & |
427 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 427 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
428 | adjustTZ = TRUE; | 428 | adjustTZ = true; |
429 | } | 429 | } |
430 | } | 430 | } |
431 | /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ | 431 | /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ |
@@ -703,7 +703,7 @@ psx_del_no_retry: | |||
703 | } else if (rc == -ENOENT) { | 703 | } else if (rc == -ENOENT) { |
704 | d_drop(direntry); | 704 | d_drop(direntry); |
705 | } else if (rc == -ETXTBSY) { | 705 | } else if (rc == -ETXTBSY) { |
706 | int oplock = FALSE; | 706 | int oplock = 0; |
707 | __u16 netfid; | 707 | __u16 netfid; |
708 | 708 | ||
709 | rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, | 709 | rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, |
@@ -736,7 +736,7 @@ psx_del_no_retry: | |||
736 | rc = -EOPNOTSUPP; | 736 | rc = -EOPNOTSUPP; |
737 | 737 | ||
738 | if (rc == -EOPNOTSUPP) { | 738 | if (rc == -EOPNOTSUPP) { |
739 | int oplock = FALSE; | 739 | int oplock = 0; |
740 | __u16 netfid; | 740 | __u16 netfid; |
741 | /* rc = CIFSSMBSetAttrLegacy(xid, pTcon, | 741 | /* rc = CIFSSMBSetAttrLegacy(xid, pTcon, |
742 | full_path, | 742 | full_path, |
@@ -774,7 +774,7 @@ psx_del_no_retry: | |||
774 | if (direntry->d_inode) | 774 | if (direntry->d_inode) |
775 | drop_nlink(direntry->d_inode); | 775 | drop_nlink(direntry->d_inode); |
776 | } else if (rc == -ETXTBSY) { | 776 | } else if (rc == -ETXTBSY) { |
777 | int oplock = FALSE; | 777 | int oplock = 0; |
778 | __u16 netfid; | 778 | __u16 netfid; |
779 | 779 | ||
780 | rc = CIFSSMBOpen(xid, pTcon, full_path, | 780 | rc = CIFSSMBOpen(xid, pTcon, full_path, |
@@ -1149,7 +1149,7 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry, | |||
1149 | cFYI(1, ("rename rc %d", rc)); | 1149 | cFYI(1, ("rename rc %d", rc)); |
1150 | 1150 | ||
1151 | if ((rc == -EIO) || (rc == -EEXIST)) { | 1151 | if ((rc == -EIO) || (rc == -EEXIST)) { |
1152 | int oplock = FALSE; | 1152 | int oplock = 0; |
1153 | __u16 netfid; | 1153 | __u16 netfid; |
1154 | 1154 | ||
1155 | /* BB FIXME Is Generic Read correct for rename? */ | 1155 | /* BB FIXME Is Generic Read correct for rename? */ |
@@ -1186,7 +1186,7 @@ int cifs_revalidate(struct dentry *direntry) | |||
1186 | struct cifsInodeInfo *cifsInode; | 1186 | struct cifsInodeInfo *cifsInode; |
1187 | loff_t local_size; | 1187 | loff_t local_size; |
1188 | struct timespec local_mtime; | 1188 | struct timespec local_mtime; |
1189 | int invalidate_inode = FALSE; | 1189 | bool invalidate_inode = false; |
1190 | 1190 | ||
1191 | if (direntry->d_inode == NULL) | 1191 | if (direntry->d_inode == NULL) |
1192 | return -ENOENT; | 1192 | return -ENOENT; |
@@ -1268,7 +1268,7 @@ int cifs_revalidate(struct dentry *direntry) | |||
1268 | only ones who could have modified the file and the | 1268 | only ones who could have modified the file and the |
1269 | server copy is staler than ours */ | 1269 | server copy is staler than ours */ |
1270 | } else { | 1270 | } else { |
1271 | invalidate_inode = TRUE; | 1271 | invalidate_inode = true; |
1272 | } | 1272 | } |
1273 | } | 1273 | } |
1274 | 1274 | ||
@@ -1402,8 +1402,8 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1402 | int rc = -EACCES; | 1402 | int rc = -EACCES; |
1403 | struct cifsFileInfo *open_file = NULL; | 1403 | struct cifsFileInfo *open_file = NULL; |
1404 | FILE_BASIC_INFO time_buf; | 1404 | FILE_BASIC_INFO time_buf; |
1405 | int set_time = FALSE; | 1405 | bool set_time = false; |
1406 | int set_dosattr = FALSE; | 1406 | bool set_dosattr = false; |
1407 | __u64 mode = 0xFFFFFFFFFFFFFFFFULL; | 1407 | __u64 mode = 0xFFFFFFFFFFFFFFFFULL; |
1408 | __u64 uid = 0xFFFFFFFFFFFFFFFFULL; | 1408 | __u64 uid = 0xFFFFFFFFFFFFFFFFULL; |
1409 | __u64 gid = 0xFFFFFFFFFFFFFFFFULL; | 1409 | __u64 gid = 0xFFFFFFFFFFFFFFFFULL; |
@@ -1464,7 +1464,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1464 | __u16 nfid = open_file->netfid; | 1464 | __u16 nfid = open_file->netfid; |
1465 | __u32 npid = open_file->pid; | 1465 | __u32 npid = open_file->pid; |
1466 | rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, | 1466 | rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, |
1467 | nfid, npid, FALSE); | 1467 | nfid, npid, false); |
1468 | atomic_dec(&open_file->wrtPending); | 1468 | atomic_dec(&open_file->wrtPending); |
1469 | cFYI(1, ("SetFSize for attrs rc = %d", rc)); | 1469 | cFYI(1, ("SetFSize for attrs rc = %d", rc)); |
1470 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { | 1470 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { |
@@ -1484,14 +1484,14 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1484 | it was found or because there was an error setting | 1484 | it was found or because there was an error setting |
1485 | it by handle */ | 1485 | it by handle */ |
1486 | rc = CIFSSMBSetEOF(xid, pTcon, full_path, | 1486 | rc = CIFSSMBSetEOF(xid, pTcon, full_path, |
1487 | attrs->ia_size, FALSE, | 1487 | attrs->ia_size, false, |
1488 | cifs_sb->local_nls, | 1488 | cifs_sb->local_nls, |
1489 | cifs_sb->mnt_cifs_flags & | 1489 | cifs_sb->mnt_cifs_flags & |
1490 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1490 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1491 | cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc)); | 1491 | cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc)); |
1492 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { | 1492 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { |
1493 | __u16 netfid; | 1493 | __u16 netfid; |
1494 | int oplock = FALSE; | 1494 | int oplock = 0; |
1495 | 1495 | ||
1496 | rc = SMBLegacyOpen(xid, pTcon, full_path, | 1496 | rc = SMBLegacyOpen(xid, pTcon, full_path, |
1497 | FILE_OPEN, | 1497 | FILE_OPEN, |
@@ -1516,7 +1516,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1516 | 1516 | ||
1517 | /* Server is ok setting allocation size implicitly - no need | 1517 | /* Server is ok setting allocation size implicitly - no need |
1518 | to call: | 1518 | to call: |
1519 | CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size, TRUE, | 1519 | CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size, true, |
1520 | cifs_sb->local_nls); | 1520 | cifs_sb->local_nls); |
1521 | */ | 1521 | */ |
1522 | 1522 | ||
@@ -1564,7 +1564,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1564 | #endif | 1564 | #endif |
1565 | /* not writeable */ | 1565 | /* not writeable */ |
1566 | if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) { | 1566 | if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) { |
1567 | set_dosattr = TRUE; | 1567 | set_dosattr = true; |
1568 | time_buf.Attributes = | 1568 | time_buf.Attributes = |
1569 | cpu_to_le32(cifsInode->cifsAttrs | | 1569 | cpu_to_le32(cifsInode->cifsAttrs | |
1570 | ATTR_READONLY); | 1570 | ATTR_READONLY); |
@@ -1574,28 +1574,24 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1574 | not be able to write to it - so if any write | 1574 | not be able to write to it - so if any write |
1575 | bit is enabled for user or group or other we | 1575 | bit is enabled for user or group or other we |
1576 | need to at least try to remove r/o dos attr */ | 1576 | need to at least try to remove r/o dos attr */ |
1577 | set_dosattr = TRUE; | 1577 | set_dosattr = true; |
1578 | time_buf.Attributes = cpu_to_le32(cifsInode->cifsAttrs & | 1578 | time_buf.Attributes = cpu_to_le32(cifsInode->cifsAttrs & |
1579 | (~ATTR_READONLY)); | 1579 | (~ATTR_READONLY)); |
1580 | /* Windows ignores set to zero */ | 1580 | /* Windows ignores set to zero */ |
1581 | if (time_buf.Attributes == 0) | 1581 | if (time_buf.Attributes == 0) |
1582 | time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL); | 1582 | time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL); |
1583 | } | 1583 | } |
1584 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
1585 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) | ||
1586 | mode_to_acl(direntry->d_inode, full_path, mode); | ||
1587 | #endif | ||
1588 | } | 1584 | } |
1589 | 1585 | ||
1590 | if (attrs->ia_valid & ATTR_ATIME) { | 1586 | if (attrs->ia_valid & ATTR_ATIME) { |
1591 | set_time = TRUE; | 1587 | set_time = true; |
1592 | time_buf.LastAccessTime = | 1588 | time_buf.LastAccessTime = |
1593 | cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_atime)); | 1589 | cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_atime)); |
1594 | } else | 1590 | } else |
1595 | time_buf.LastAccessTime = 0; | 1591 | time_buf.LastAccessTime = 0; |
1596 | 1592 | ||
1597 | if (attrs->ia_valid & ATTR_MTIME) { | 1593 | if (attrs->ia_valid & ATTR_MTIME) { |
1598 | set_time = TRUE; | 1594 | set_time = true; |
1599 | time_buf.LastWriteTime = | 1595 | time_buf.LastWriteTime = |
1600 | cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_mtime)); | 1596 | cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_mtime)); |
1601 | } else | 1597 | } else |
@@ -1606,7 +1602,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1606 | server times */ | 1602 | server times */ |
1607 | 1603 | ||
1608 | if (set_time && (attrs->ia_valid & ATTR_CTIME)) { | 1604 | if (set_time && (attrs->ia_valid & ATTR_CTIME)) { |
1609 | set_time = TRUE; | 1605 | set_time = true; |
1610 | /* Although Samba throws this field away | 1606 | /* Although Samba throws this field away |
1611 | it may be useful to Windows - but we do | 1607 | it may be useful to Windows - but we do |
1612 | not want to set ctime unless some other | 1608 | not want to set ctime unless some other |
@@ -1630,7 +1626,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1630 | rc = -EOPNOTSUPP; | 1626 | rc = -EOPNOTSUPP; |
1631 | 1627 | ||
1632 | if (rc == -EOPNOTSUPP) { | 1628 | if (rc == -EOPNOTSUPP) { |
1633 | int oplock = FALSE; | 1629 | int oplock = 0; |
1634 | __u16 netfid; | 1630 | __u16 netfid; |
1635 | 1631 | ||
1636 | cFYI(1, ("calling SetFileInfo since SetPathInfo for " | 1632 | cFYI(1, ("calling SetFileInfo since SetPathInfo for " |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index d4e7ec93285..1c2c3ce5020 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -230,7 +230,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) | |||
230 | struct inode *inode = direntry->d_inode; | 230 | struct inode *inode = direntry->d_inode; |
231 | int rc = -EACCES; | 231 | int rc = -EACCES; |
232 | int xid; | 232 | int xid; |
233 | int oplock = FALSE; | 233 | int oplock = 0; |
234 | struct cifs_sb_info *cifs_sb; | 234 | struct cifs_sb_info *cifs_sb; |
235 | struct cifsTconInfo *pTcon; | 235 | struct cifsTconInfo *pTcon; |
236 | char *full_path = NULL; | 236 | char *full_path = NULL; |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 2a42d9fedbb..1d69b8014e0 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -496,7 +496,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) | |||
496 | } | 496 | } |
497 | return 0; | 497 | return 0; |
498 | } | 498 | } |
499 | int | 499 | |
500 | bool | ||
500 | is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | 501 | is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) |
501 | { | 502 | { |
502 | struct smb_com_lock_req *pSMB = (struct smb_com_lock_req *)buf; | 503 | struct smb_com_lock_req *pSMB = (struct smb_com_lock_req *)buf; |
@@ -522,17 +523,17 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
522 | pnotify->Action)); /* BB removeme BB */ | 523 | pnotify->Action)); /* BB removeme BB */ |
523 | /* cifs_dump_mem("Rcvd notify Data: ",buf, | 524 | /* cifs_dump_mem("Rcvd notify Data: ",buf, |
524 | sizeof(struct smb_hdr)+60); */ | 525 | sizeof(struct smb_hdr)+60); */ |
525 | return TRUE; | 526 | return true; |
526 | } | 527 | } |
527 | if (pSMBr->hdr.Status.CifsError) { | 528 | if (pSMBr->hdr.Status.CifsError) { |
528 | cFYI(1, ("notify err 0x%d", | 529 | cFYI(1, ("notify err 0x%d", |
529 | pSMBr->hdr.Status.CifsError)); | 530 | pSMBr->hdr.Status.CifsError)); |
530 | return TRUE; | 531 | return true; |
531 | } | 532 | } |
532 | return FALSE; | 533 | return false; |
533 | } | 534 | } |
534 | if (pSMB->hdr.Command != SMB_COM_LOCKING_ANDX) | 535 | if (pSMB->hdr.Command != SMB_COM_LOCKING_ANDX) |
535 | return FALSE; | 536 | return false; |
536 | if (pSMB->hdr.Flags & SMBFLG_RESPONSE) { | 537 | if (pSMB->hdr.Flags & SMBFLG_RESPONSE) { |
537 | /* no sense logging error on invalid handle on oplock | 538 | /* no sense logging error on invalid handle on oplock |
538 | break - harmless race between close request and oplock | 539 | break - harmless race between close request and oplock |
@@ -541,21 +542,21 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
541 | if ((NT_STATUS_INVALID_HANDLE) == | 542 | if ((NT_STATUS_INVALID_HANDLE) == |
542 | le32_to_cpu(pSMB->hdr.Status.CifsError)) { | 543 | le32_to_cpu(pSMB->hdr.Status.CifsError)) { |
543 | cFYI(1, ("invalid handle on oplock break")); | 544 | cFYI(1, ("invalid handle on oplock break")); |
544 | return TRUE; | 545 | return true; |
545 | } else if (ERRbadfid == | 546 | } else if (ERRbadfid == |
546 | le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { | 547 | le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { |
547 | return TRUE; | 548 | return true; |
548 | } else { | 549 | } else { |
549 | return FALSE; /* on valid oplock brk we get "request" */ | 550 | return false; /* on valid oplock brk we get "request" */ |
550 | } | 551 | } |
551 | } | 552 | } |
552 | if (pSMB->hdr.WordCount != 8) | 553 | if (pSMB->hdr.WordCount != 8) |
553 | return FALSE; | 554 | return false; |
554 | 555 | ||
555 | cFYI(1, ("oplock type 0x%d level 0x%d", | 556 | cFYI(1, ("oplock type 0x%d level 0x%d", |
556 | pSMB->LockType, pSMB->OplockLevel)); | 557 | pSMB->LockType, pSMB->OplockLevel)); |
557 | if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) | 558 | if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) |
558 | return FALSE; | 559 | return false; |
559 | 560 | ||
560 | /* look up tcon based on tid & uid */ | 561 | /* look up tcon based on tid & uid */ |
561 | read_lock(&GlobalSMBSeslock); | 562 | read_lock(&GlobalSMBSeslock); |
@@ -573,11 +574,11 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
573 | ("file id match, oplock break")); | 574 | ("file id match, oplock break")); |
574 | pCifsInode = | 575 | pCifsInode = |
575 | CIFS_I(netfile->pInode); | 576 | CIFS_I(netfile->pInode); |
576 | pCifsInode->clientCanCacheAll = FALSE; | 577 | pCifsInode->clientCanCacheAll = false; |
577 | if (pSMB->OplockLevel == 0) | 578 | if (pSMB->OplockLevel == 0) |
578 | pCifsInode->clientCanCacheRead | 579 | pCifsInode->clientCanCacheRead |
579 | = FALSE; | 580 | = false; |
580 | pCifsInode->oplockPending = TRUE; | 581 | pCifsInode->oplockPending = true; |
581 | AllocOplockQEntry(netfile->pInode, | 582 | AllocOplockQEntry(netfile->pInode, |
582 | netfile->netfid, | 583 | netfile->netfid, |
583 | tcon); | 584 | tcon); |
@@ -585,17 +586,17 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
585 | ("about to wake up oplock thread")); | 586 | ("about to wake up oplock thread")); |
586 | if (oplockThread) | 587 | if (oplockThread) |
587 | wake_up_process(oplockThread); | 588 | wake_up_process(oplockThread); |
588 | return TRUE; | 589 | return true; |
589 | } | 590 | } |
590 | } | 591 | } |
591 | read_unlock(&GlobalSMBSeslock); | 592 | read_unlock(&GlobalSMBSeslock); |
592 | cFYI(1, ("No matching file for oplock break")); | 593 | cFYI(1, ("No matching file for oplock break")); |
593 | return TRUE; | 594 | return true; |
594 | } | 595 | } |
595 | } | 596 | } |
596 | read_unlock(&GlobalSMBSeslock); | 597 | read_unlock(&GlobalSMBSeslock); |
597 | cFYI(1, ("Can not process oplock break for non-existent connection")); | 598 | cFYI(1, ("Can not process oplock break for non-existent connection")); |
598 | return TRUE; | 599 | return true; |
599 | } | 600 | } |
600 | 601 | ||
601 | void | 602 | void |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 3b5a5ce882b..00f4cff400b 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -132,47 +132,17 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = { | |||
132 | {0, 0} | 132 | {0, 0} |
133 | }; | 133 | }; |
134 | 134 | ||
135 | |||
136 | /* if the mount helper is missing we need to reverse the 1st slash | ||
137 | from '/' to backslash in order to format the UNC properly for | ||
138 | ip address parsing and for tree connect (unless the user | ||
139 | remembered to put the UNC name in properly). Fortunately we do | ||
140 | not have to call this twice (we check for IPv4 addresses | ||
141 | first, so it is already converted by the time we | ||
142 | try IPv6 addresses */ | ||
143 | static int canonicalize_unc(char *cp) | ||
144 | { | ||
145 | int i; | ||
146 | |||
147 | for (i = 0; i <= 46 /* INET6_ADDRSTRLEN */ ; i++) { | ||
148 | if (cp[i] == 0) | ||
149 | break; | ||
150 | if (cp[i] == '\\') | ||
151 | break; | ||
152 | if (cp[i] == '/') { | ||
153 | cFYI(DBG2, ("change slash to \\ in malformed UNC")); | ||
154 | cp[i] = '\\'; | ||
155 | return 1; | ||
156 | } | ||
157 | } | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | /* Convert string containing dotted ip address to binary form */ | 135 | /* Convert string containing dotted ip address to binary form */ |
162 | /* returns 0 if invalid address */ | 136 | /* returns 0 if invalid address */ |
163 | 137 | ||
164 | int | 138 | int |
165 | cifs_inet_pton(int address_family, char *cp, void *dst) | 139 | cifs_inet_pton(const int address_family, const char *cp, void *dst) |
166 | { | 140 | { |
167 | int ret = 0; | 141 | int ret = 0; |
168 | 142 | ||
169 | /* calculate length by finding first slash or NULL */ | 143 | /* calculate length by finding first slash or NULL */ |
170 | if (address_family == AF_INET) { | 144 | if (address_family == AF_INET) { |
171 | ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL); | 145 | ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL); |
172 | if (ret == 0) { | ||
173 | if (canonicalize_unc(cp)) | ||
174 | ret = in4_pton(cp, -1, dst, '\\', NULL); | ||
175 | } | ||
176 | } else if (address_family == AF_INET6) { | 146 | } else if (address_family == AF_INET6) { |
177 | ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); | 147 | ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); |
178 | } | 148 | } |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 32b445edc88..34ec32100c7 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -447,8 +447,8 @@ static int initiate_cifs_search(const int xid, struct file *file) | |||
447 | if (file->private_data == NULL) | 447 | if (file->private_data == NULL) |
448 | return -ENOMEM; | 448 | return -ENOMEM; |
449 | cifsFile = file->private_data; | 449 | cifsFile = file->private_data; |
450 | cifsFile->invalidHandle = TRUE; | 450 | cifsFile->invalidHandle = true; |
451 | cifsFile->srch_inf.endOfSearch = FALSE; | 451 | cifsFile->srch_inf.endOfSearch = false; |
452 | 452 | ||
453 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 453 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
454 | if (cifs_sb == NULL) | 454 | if (cifs_sb == NULL) |
@@ -485,7 +485,7 @@ ffirst_retry: | |||
485 | cifs_sb->mnt_cifs_flags & | 485 | cifs_sb->mnt_cifs_flags & |
486 | CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb)); | 486 | CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb)); |
487 | if (rc == 0) | 487 | if (rc == 0) |
488 | cifsFile->invalidHandle = FALSE; | 488 | cifsFile->invalidHandle = false; |
489 | if ((rc == -EOPNOTSUPP) && | 489 | if ((rc == -EOPNOTSUPP) && |
490 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) { | 490 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) { |
491 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; | 491 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; |
@@ -670,7 +670,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
670 | (index_to_find < first_entry_in_buffer)) { | 670 | (index_to_find < first_entry_in_buffer)) { |
671 | /* close and restart search */ | 671 | /* close and restart search */ |
672 | cFYI(1, ("search backing up - close and restart search")); | 672 | cFYI(1, ("search backing up - close and restart search")); |
673 | cifsFile->invalidHandle = TRUE; | 673 | cifsFile->invalidHandle = true; |
674 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 674 | CIFSFindClose(xid, pTcon, cifsFile->netfid); |
675 | kfree(cifsFile->search_resume_name); | 675 | kfree(cifsFile->search_resume_name); |
676 | cifsFile->search_resume_name = NULL; | 676 | cifsFile->search_resume_name = NULL; |
@@ -692,7 +692,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
692 | } | 692 | } |
693 | 693 | ||
694 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && | 694 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && |
695 | (rc == 0) && (cifsFile->srch_inf.endOfSearch == FALSE)) { | 695 | (rc == 0) && !cifsFile->srch_inf.endOfSearch) { |
696 | cFYI(1, ("calling findnext2")); | 696 | cFYI(1, ("calling findnext2")); |
697 | rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, | 697 | rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, |
698 | &cifsFile->srch_inf); | 698 | &cifsFile->srch_inf); |
@@ -1038,7 +1038,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
1038 | break; | 1038 | break; |
1039 | } | 1039 | } |
1040 | } /* else { | 1040 | } /* else { |
1041 | cifsFile->invalidHandle = TRUE; | 1041 | cifsFile->invalidHandle = true; |
1042 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 1042 | CIFSFindClose(xid, pTcon, cifsFile->netfid); |
1043 | } | 1043 | } |
1044 | kfree(cifsFile->search_resume_name); | 1044 | kfree(cifsFile->search_resume_name); |
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c index 58bbfd992cc..ff3232fa101 100644 --- a/fs/cifs/smbencrypt.c +++ b/fs/cifs/smbencrypt.c | |||
@@ -35,11 +35,11 @@ | |||
35 | #include "cifs_debug.h" | 35 | #include "cifs_debug.h" |
36 | #include "cifsencrypt.h" | 36 | #include "cifsencrypt.h" |
37 | 37 | ||
38 | #ifndef FALSE | 38 | #ifndef false |
39 | #define FALSE 0 | 39 | #define false 0 |
40 | #endif | 40 | #endif |
41 | #ifndef TRUE | 41 | #ifndef true |
42 | #define TRUE 1 | 42 | #define true 1 |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | /* following came from the other byteorder.h to avoid include conflicts */ | 45 | /* following came from the other byteorder.h to avoid include conflicts */ |
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 8cd6a445b01..e9527eedc63 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -264,7 +264,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
264 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 264 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
265 | else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { | 265 | else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { |
266 | __u16 fid; | 266 | __u16 fid; |
267 | int oplock = FALSE; | 267 | int oplock = 0; |
268 | struct cifs_ntsd *pacl = NULL; | 268 | struct cifs_ntsd *pacl = NULL; |
269 | __u32 buflen = 0; | 269 | __u32 buflen = 0; |
270 | if (experimEnabled) | 270 | if (experimEnabled) |
diff --git a/fs/inode.c b/fs/inode.c index bf647813042..c36d9480335 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1149,13 +1149,8 @@ static inline void iput_final(struct inode *inode) | |||
1149 | void iput(struct inode *inode) | 1149 | void iput(struct inode *inode) |
1150 | { | 1150 | { |
1151 | if (inode) { | 1151 | if (inode) { |
1152 | const struct super_operations *op = inode->i_sb->s_op; | ||
1153 | |||
1154 | BUG_ON(inode->i_state == I_CLEAR); | 1152 | BUG_ON(inode->i_state == I_CLEAR); |
1155 | 1153 | ||
1156 | if (op && op->put_inode) | ||
1157 | op->put_inode(inode); | ||
1158 | |||
1159 | if (atomic_dec_and_lock(&inode->i_count, &inode_lock)) | 1154 | if (atomic_dec_and_lock(&inode->i_count, &inode_lock)) |
1160 | iput_final(inode); | 1155 | iput_final(inode); |
1161 | } | 1156 | } |
diff --git a/fs/locks.c b/fs/locks.c index 663c069b59b..0ac6b92cb0b 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1753,6 +1753,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, | |||
1753 | struct file_lock *file_lock = locks_alloc_lock(); | 1753 | struct file_lock *file_lock = locks_alloc_lock(); |
1754 | struct flock flock; | 1754 | struct flock flock; |
1755 | struct inode *inode; | 1755 | struct inode *inode; |
1756 | struct file *f; | ||
1756 | int error; | 1757 | int error; |
1757 | 1758 | ||
1758 | if (file_lock == NULL) | 1759 | if (file_lock == NULL) |
@@ -1825,7 +1826,15 @@ again: | |||
1825 | * Attempt to detect a close/fcntl race and recover by | 1826 | * Attempt to detect a close/fcntl race and recover by |
1826 | * releasing the lock that was just acquired. | 1827 | * releasing the lock that was just acquired. |
1827 | */ | 1828 | */ |
1828 | if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) { | 1829 | /* |
1830 | * we need that spin_lock here - it prevents reordering between | ||
1831 | * update of inode->i_flock and check for it done in close(). | ||
1832 | * rcu_read_lock() wouldn't do. | ||
1833 | */ | ||
1834 | spin_lock(¤t->files->file_lock); | ||
1835 | f = fcheck(fd); | ||
1836 | spin_unlock(¤t->files->file_lock); | ||
1837 | if (!error && f != filp && flock.l_type != F_UNLCK) { | ||
1829 | flock.l_type = F_UNLCK; | 1838 | flock.l_type = F_UNLCK; |
1830 | goto again; | 1839 | goto again; |
1831 | } | 1840 | } |
@@ -1881,6 +1890,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, | |||
1881 | struct file_lock *file_lock = locks_alloc_lock(); | 1890 | struct file_lock *file_lock = locks_alloc_lock(); |
1882 | struct flock64 flock; | 1891 | struct flock64 flock; |
1883 | struct inode *inode; | 1892 | struct inode *inode; |
1893 | struct file *f; | ||
1884 | int error; | 1894 | int error; |
1885 | 1895 | ||
1886 | if (file_lock == NULL) | 1896 | if (file_lock == NULL) |
@@ -1953,7 +1963,10 @@ again: | |||
1953 | * Attempt to detect a close/fcntl race and recover by | 1963 | * Attempt to detect a close/fcntl race and recover by |
1954 | * releasing the lock that was just acquired. | 1964 | * releasing the lock that was just acquired. |
1955 | */ | 1965 | */ |
1956 | if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) { | 1966 | spin_lock(¤t->files->file_lock); |
1967 | f = fcheck(fd); | ||
1968 | spin_unlock(¤t->files->file_lock); | ||
1969 | if (!error && f != filp && flock.l_type != F_UNLCK) { | ||
1957 | flock.l_type = F_UNLCK; | 1970 | flock.l_type = F_UNLCK; |
1958 | goto again; | 1971 | goto again; |
1959 | } | 1972 | } |
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/highmem.h> | 17 | #include <linux/highmem.h> |
18 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
19 | #include <linux/audit.h> | 19 | #include <linux/audit.h> |
20 | #include <linux/syscalls.h> | ||
20 | 21 | ||
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
22 | #include <asm/ioctls.h> | 23 | #include <asm/ioctls.h> |
@@ -1086,8 +1087,11 @@ asmlinkage long __weak sys_pipe(int __user *fildes) | |||
1086 | 1087 | ||
1087 | error = do_pipe(fd); | 1088 | error = do_pipe(fd); |
1088 | if (!error) { | 1089 | if (!error) { |
1089 | if (copy_to_user(fildes, fd, sizeof(fd))) | 1090 | if (copy_to_user(fildes, fd, sizeof(fd))) { |
1091 | sys_close(fd[0]); | ||
1092 | sys_close(fd[1]); | ||
1090 | error = -EFAULT; | 1093 | error = -EFAULT; |
1094 | } | ||
1091 | } | 1095 | } |
1092 | return error; | 1096 | return error; |
1093 | } | 1097 | } |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index e2b8e769f51..88717c0f941 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -5,11 +5,9 @@ | |||
5 | #include <linux/highmem.h> | 5 | #include <linux/highmem.h> |
6 | #include <linux/ptrace.h> | 6 | #include <linux/ptrace.h> |
7 | #include <linux/pagemap.h> | 7 | #include <linux/pagemap.h> |
8 | #include <linux/ptrace.h> | ||
9 | #include <linux/mempolicy.h> | 8 | #include <linux/mempolicy.h> |
10 | #include <linux/swap.h> | 9 | #include <linux/swap.h> |
11 | #include <linux/swapops.h> | 10 | #include <linux/swapops.h> |
12 | #include <linux/seq_file.h> | ||
13 | 11 | ||
14 | #include <asm/elf.h> | 12 | #include <asm/elf.h> |
15 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 4b733f10845..4b4f9cc2f18 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c | |||
@@ -1,6 +1,7 @@ | |||
1 | 1 | ||
2 | #include <linux/mm.h> | 2 | #include <linux/mm.h> |
3 | #include <linux/file.h> | 3 | #include <linux/file.h> |
4 | #include <linux/fdtable.h> | ||
4 | #include <linux/mount.h> | 5 | #include <linux/mount.h> |
5 | #include <linux/ptrace.h> | 6 | #include <linux/ptrace.h> |
6 | #include <linux/seq_file.h> | 7 | #include <linux/seq_file.h> |
diff --git a/fs/splice.c b/fs/splice.c index 633f58ebfb7..78150038b58 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -811,24 +811,19 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
811 | { | 811 | { |
812 | struct address_space *mapping = out->f_mapping; | 812 | struct address_space *mapping = out->f_mapping; |
813 | struct inode *inode = mapping->host; | 813 | struct inode *inode = mapping->host; |
814 | int killsuid, killpriv; | 814 | struct splice_desc sd = { |
815 | .total_len = len, | ||
816 | .flags = flags, | ||
817 | .pos = *ppos, | ||
818 | .u.file = out, | ||
819 | }; | ||
815 | ssize_t ret; | 820 | ssize_t ret; |
816 | int err = 0; | ||
817 | |||
818 | killpriv = security_inode_need_killpriv(out->f_path.dentry); | ||
819 | killsuid = should_remove_suid(out->f_path.dentry); | ||
820 | if (unlikely(killsuid || killpriv)) { | ||
821 | mutex_lock(&inode->i_mutex); | ||
822 | if (killpriv) | ||
823 | err = security_inode_killpriv(out->f_path.dentry); | ||
824 | if (!err && killsuid) | ||
825 | err = __remove_suid(out->f_path.dentry, killsuid); | ||
826 | mutex_unlock(&inode->i_mutex); | ||
827 | if (err) | ||
828 | return err; | ||
829 | } | ||
830 | 821 | ||
831 | ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); | 822 | inode_double_lock(inode, pipe->inode); |
823 | ret = remove_suid(out->f_path.dentry); | ||
824 | if (likely(!ret)) | ||
825 | ret = __splice_from_pipe(pipe, &sd, pipe_to_file); | ||
826 | inode_double_unlock(inode, pipe->inode); | ||
832 | if (ret > 0) { | 827 | if (ret > 0) { |
833 | unsigned long nr_pages; | 828 | unsigned long nr_pages; |
834 | 829 | ||
@@ -840,6 +835,8 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
840 | * sync it. | 835 | * sync it. |
841 | */ | 836 | */ |
842 | if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { | 837 | if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { |
838 | int err; | ||
839 | |||
843 | mutex_lock(&inode->i_mutex); | 840 | mutex_lock(&inode->i_mutex); |
844 | err = generic_osync_inode(inode, mapping, | 841 | err = generic_osync_inode(inode, mapping, |
845 | OSYNC_METADATA|OSYNC_DATA); | 842 | OSYNC_METADATA|OSYNC_DATA); |
@@ -1075,7 +1072,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | |||
1075 | 1072 | ||
1076 | ret = splice_direct_to_actor(in, &sd, direct_splice_actor); | 1073 | ret = splice_direct_to_actor(in, &sd, direct_splice_actor); |
1077 | if (ret > 0) | 1074 | if (ret > 0) |
1078 | *ppos = sd.pos; | 1075 | *ppos += ret; |
1079 | 1076 | ||
1080 | return ret; | 1077 | return ret; |
1081 | } | 1078 | } |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 2b34c8ca6c8..d3231947db1 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/buffer_head.h> | 32 | #include <linux/buffer_head.h> |
33 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
34 | #include <linux/crc-itu-t.h> | 34 | #include <linux/crc-itu-t.h> |
35 | #include <linux/exportfs.h> | ||
35 | 36 | ||
36 | static inline int udf_match(int len1, const char *name1, int len2, | 37 | static inline int udf_match(int len1, const char *name1, int len2, |
37 | const char *name2) | 38 | const char *name2) |
@@ -158,6 +159,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, | |||
158 | sector_t offset; | 159 | sector_t offset; |
159 | struct extent_position epos = {}; | 160 | struct extent_position epos = {}; |
160 | struct udf_inode_info *dinfo = UDF_I(dir); | 161 | struct udf_inode_info *dinfo = UDF_I(dir); |
162 | int isdotdot = dentry->d_name.len == 2 && | ||
163 | dentry->d_name.name[0] == '.' && dentry->d_name.name[1] == '.'; | ||
161 | 164 | ||
162 | size = udf_ext0_offset(dir) + dir->i_size; | 165 | size = udf_ext0_offset(dir) + dir->i_size; |
163 | f_pos = udf_ext0_offset(dir); | 166 | f_pos = udf_ext0_offset(dir); |
@@ -225,6 +228,12 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, | |||
225 | continue; | 228 | continue; |
226 | } | 229 | } |
227 | 230 | ||
231 | if ((cfi->fileCharacteristics & FID_FILE_CHAR_PARENT) && | ||
232 | isdotdot) { | ||
233 | brelse(epos.bh); | ||
234 | return fi; | ||
235 | } | ||
236 | |||
228 | if (!lfi) | 237 | if (!lfi) |
229 | continue; | 238 | continue; |
230 | 239 | ||
@@ -286,9 +295,8 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, | |||
286 | } | 295 | } |
287 | } | 296 | } |
288 | unlock_kernel(); | 297 | unlock_kernel(); |
289 | d_add(dentry, inode); | ||
290 | 298 | ||
291 | return NULL; | 299 | return d_splice_alias(inode, dentry); |
292 | } | 300 | } |
293 | 301 | ||
294 | static struct fileIdentDesc *udf_add_entry(struct inode *dir, | 302 | static struct fileIdentDesc *udf_add_entry(struct inode *dir, |
@@ -307,7 +315,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, | |||
307 | uint16_t liu; | 315 | uint16_t liu; |
308 | int block; | 316 | int block; |
309 | kernel_lb_addr eloc; | 317 | kernel_lb_addr eloc; |
310 | uint32_t elen; | 318 | uint32_t elen = 0; |
311 | sector_t offset; | 319 | sector_t offset; |
312 | struct extent_position epos = {}; | 320 | struct extent_position epos = {}; |
313 | struct udf_inode_info *dinfo; | 321 | struct udf_inode_info *dinfo; |
@@ -398,7 +406,8 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, | |||
398 | } | 406 | } |
399 | 407 | ||
400 | add: | 408 | add: |
401 | if (dinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { | 409 | /* Is there any extent whose size we need to round up? */ |
410 | if (dinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB && elen) { | ||
402 | elen = (elen + sb->s_blocksize - 1) & ~(sb->s_blocksize - 1); | 411 | elen = (elen + sb->s_blocksize - 1) & ~(sb->s_blocksize - 1); |
403 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 412 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
404 | epos.offset -= sizeof(short_ad); | 413 | epos.offset -= sizeof(short_ad); |
@@ -1232,6 +1241,134 @@ end_rename: | |||
1232 | return retval; | 1241 | return retval; |
1233 | } | 1242 | } |
1234 | 1243 | ||
1244 | static struct dentry *udf_get_parent(struct dentry *child) | ||
1245 | { | ||
1246 | struct dentry *parent; | ||
1247 | struct inode *inode = NULL; | ||
1248 | struct dentry dotdot; | ||
1249 | struct fileIdentDesc cfi; | ||
1250 | struct udf_fileident_bh fibh; | ||
1251 | |||
1252 | dotdot.d_name.name = ".."; | ||
1253 | dotdot.d_name.len = 2; | ||
1254 | |||
1255 | lock_kernel(); | ||
1256 | if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) | ||
1257 | goto out_unlock; | ||
1258 | |||
1259 | if (fibh.sbh != fibh.ebh) | ||
1260 | brelse(fibh.ebh); | ||
1261 | brelse(fibh.sbh); | ||
1262 | |||
1263 | inode = udf_iget(child->d_inode->i_sb, | ||
1264 | lelb_to_cpu(cfi.icb.extLocation)); | ||
1265 | if (!inode) | ||
1266 | goto out_unlock; | ||
1267 | unlock_kernel(); | ||
1268 | |||
1269 | parent = d_alloc_anon(inode); | ||
1270 | if (!parent) { | ||
1271 | iput(inode); | ||
1272 | parent = ERR_PTR(-ENOMEM); | ||
1273 | } | ||
1274 | |||
1275 | return parent; | ||
1276 | out_unlock: | ||
1277 | unlock_kernel(); | ||
1278 | return ERR_PTR(-EACCES); | ||
1279 | } | ||
1280 | |||
1281 | |||
1282 | static struct dentry *udf_nfs_get_inode(struct super_block *sb, u32 block, | ||
1283 | u16 partref, __u32 generation) | ||
1284 | { | ||
1285 | struct inode *inode; | ||
1286 | struct dentry *result; | ||
1287 | kernel_lb_addr loc; | ||
1288 | |||
1289 | if (block == 0) | ||
1290 | return ERR_PTR(-ESTALE); | ||
1291 | |||
1292 | loc.logicalBlockNum = block; | ||
1293 | loc.partitionReferenceNum = partref; | ||
1294 | inode = udf_iget(sb, loc); | ||
1295 | |||
1296 | if (inode == NULL) | ||
1297 | return ERR_PTR(-ENOMEM); | ||
1298 | |||
1299 | if (generation && inode->i_generation != generation) { | ||
1300 | iput(inode); | ||
1301 | return ERR_PTR(-ESTALE); | ||
1302 | } | ||
1303 | result = d_alloc_anon(inode); | ||
1304 | if (!result) { | ||
1305 | iput(inode); | ||
1306 | return ERR_PTR(-ENOMEM); | ||
1307 | } | ||
1308 | return result; | ||
1309 | } | ||
1310 | |||
1311 | static struct dentry *udf_fh_to_dentry(struct super_block *sb, | ||
1312 | struct fid *fid, int fh_len, int fh_type) | ||
1313 | { | ||
1314 | if ((fh_len != 3 && fh_len != 5) || | ||
1315 | (fh_type != FILEID_UDF_WITH_PARENT && | ||
1316 | fh_type != FILEID_UDF_WITHOUT_PARENT)) | ||
1317 | return NULL; | ||
1318 | |||
1319 | return udf_nfs_get_inode(sb, fid->udf.block, fid->udf.partref, | ||
1320 | fid->udf.generation); | ||
1321 | } | ||
1322 | |||
1323 | static struct dentry *udf_fh_to_parent(struct super_block *sb, | ||
1324 | struct fid *fid, int fh_len, int fh_type) | ||
1325 | { | ||
1326 | if (fh_len != 5 || fh_type != FILEID_UDF_WITH_PARENT) | ||
1327 | return NULL; | ||
1328 | |||
1329 | return udf_nfs_get_inode(sb, fid->udf.parent_block, | ||
1330 | fid->udf.parent_partref, | ||
1331 | fid->udf.parent_generation); | ||
1332 | } | ||
1333 | static int udf_encode_fh(struct dentry *de, __u32 *fh, int *lenp, | ||
1334 | int connectable) | ||
1335 | { | ||
1336 | int len = *lenp; | ||
1337 | struct inode *inode = de->d_inode; | ||
1338 | kernel_lb_addr location = UDF_I(inode)->i_location; | ||
1339 | struct fid *fid = (struct fid *)fh; | ||
1340 | int type = FILEID_UDF_WITHOUT_PARENT; | ||
1341 | |||
1342 | if (len < 3 || (connectable && len < 5)) | ||
1343 | return 255; | ||
1344 | |||
1345 | *lenp = 3; | ||
1346 | fid->udf.block = location.logicalBlockNum; | ||
1347 | fid->udf.partref = location.partitionReferenceNum; | ||
1348 | fid->udf.generation = inode->i_generation; | ||
1349 | |||
1350 | if (connectable && !S_ISDIR(inode->i_mode)) { | ||
1351 | spin_lock(&de->d_lock); | ||
1352 | inode = de->d_parent->d_inode; | ||
1353 | location = UDF_I(inode)->i_location; | ||
1354 | fid->udf.parent_block = location.logicalBlockNum; | ||
1355 | fid->udf.parent_partref = location.partitionReferenceNum; | ||
1356 | fid->udf.parent_generation = inode->i_generation; | ||
1357 | spin_unlock(&de->d_lock); | ||
1358 | *lenp = 5; | ||
1359 | type = FILEID_UDF_WITH_PARENT; | ||
1360 | } | ||
1361 | |||
1362 | return type; | ||
1363 | } | ||
1364 | |||
1365 | const struct export_operations udf_export_ops = { | ||
1366 | .encode_fh = udf_encode_fh, | ||
1367 | .fh_to_dentry = udf_fh_to_dentry, | ||
1368 | .fh_to_parent = udf_fh_to_parent, | ||
1369 | .get_parent = udf_get_parent, | ||
1370 | }; | ||
1371 | |||
1235 | const struct inode_operations udf_dir_inode_operations = { | 1372 | const struct inode_operations udf_dir_inode_operations = { |
1236 | .lookup = udf_lookup, | 1373 | .lookup = udf_lookup, |
1237 | .create = udf_create, | 1374 | .create = udf_create, |
diff --git a/fs/udf/partition.c b/fs/udf/partition.c index 63610f026ae..96dfd207c3d 100644 --- a/fs/udf/partition.c +++ b/fs/udf/partition.c | |||
@@ -27,8 +27,8 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/buffer_head.h> | 28 | #include <linux/buffer_head.h> |
29 | 29 | ||
30 | inline uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, | 30 | uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, |
31 | uint16_t partition, uint32_t offset) | 31 | uint16_t partition, uint32_t offset) |
32 | { | 32 | { |
33 | struct udf_sb_info *sbi = UDF_SB(sb); | 33 | struct udf_sb_info *sbi = UDF_SB(sb); |
34 | struct udf_part_map *map; | 34 | struct udf_part_map *map; |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 9fb18a340fc..7a5f69be6ac 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -1933,6 +1933,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1933 | 1933 | ||
1934 | /* Fill in the rest of the superblock */ | 1934 | /* Fill in the rest of the superblock */ |
1935 | sb->s_op = &udf_sb_ops; | 1935 | sb->s_op = &udf_sb_ops; |
1936 | sb->s_export_op = &udf_export_ops; | ||
1936 | sb->dq_op = NULL; | 1937 | sb->dq_op = NULL; |
1937 | sb->s_dirt = 0; | 1938 | sb->s_dirt = 0; |
1938 | sb->s_magic = UDF_SUPER_MAGIC; | 1939 | sb->s_magic = UDF_SUPER_MAGIC; |
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index f3f45d02927..8fa9c2d7091 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
@@ -73,6 +73,7 @@ struct task_struct; | |||
73 | struct buffer_head; | 73 | struct buffer_head; |
74 | struct super_block; | 74 | struct super_block; |
75 | 75 | ||
76 | extern const struct export_operations udf_export_ops; | ||
76 | extern const struct inode_operations udf_dir_inode_operations; | 77 | extern const struct inode_operations udf_dir_inode_operations; |
77 | extern const struct file_operations udf_dir_operations; | 78 | extern const struct file_operations udf_dir_operations; |
78 | extern const struct inode_operations udf_file_inode_operations; | 79 | extern const struct inode_operations udf_file_inode_operations; |
diff --git a/include/asm-alpha/types.h b/include/asm-alpha/types.h index a9e34ca4d46..c1541353cce 100644 --- a/include/asm-alpha/types.h +++ b/include/asm-alpha/types.h | |||
@@ -23,5 +23,11 @@ typedef unsigned int umode_t; | |||
23 | 23 | ||
24 | #define BITS_PER_LONG 64 | 24 | #define BITS_PER_LONG 64 |
25 | 25 | ||
26 | #ifndef __ASSEMBLY__ | ||
27 | |||
28 | typedef u64 dma_addr_t; | ||
29 | typedef u64 dma64_addr_t; | ||
30 | |||
31 | #endif /* __ASSEMBLY__ */ | ||
26 | #endif /* __KERNEL__ */ | 32 | #endif /* __KERNEL__ */ |
27 | #endif /* _ALPHA_TYPES_H */ | 33 | #endif /* _ALPHA_TYPES_H */ |
diff --git a/include/asm-arm/arch-pxa/pm.h b/include/asm-arm/arch-pxa/pm.h index 9d9f4b54b2c..261e5bc958d 100644 --- a/include/asm-arm/arch-pxa/pm.h +++ b/include/asm-arm/arch-pxa/pm.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <linux/suspend.h> | 10 | #include <linux/suspend.h> |
11 | 11 | ||
12 | struct pxa_cpu_pm_fns { | 12 | struct pxa_cpu_pm_fns { |
13 | int save_size; | 13 | int save_count; |
14 | void (*save)(unsigned long *); | 14 | void (*save)(unsigned long *); |
15 | void (*restore)(unsigned long *); | 15 | void (*restore)(unsigned long *); |
16 | int (*valid)(suspend_state_t state); | 16 | int (*valid)(suspend_state_t state); |
diff --git a/include/asm-arm/arch-pxa/system.h b/include/asm-arm/arch-pxa/system.h index a758a719180..9aa6c2e939e 100644 --- a/include/asm-arm/arch-pxa/system.h +++ b/include/asm-arm/arch-pxa/system.h | |||
@@ -22,7 +22,8 @@ static inline void arch_idle(void) | |||
22 | 22 | ||
23 | static inline void arch_reset(char mode) | 23 | static inline void arch_reset(char mode) |
24 | { | 24 | { |
25 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | 25 | if (cpu_is_pxa2xx()) |
26 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
26 | 27 | ||
27 | if (mode == 's') { | 28 | if (mode == 's') { |
28 | /* Jump into ROM at address 0 */ | 29 | /* Jump into ROM at address 0 */ |
diff --git a/include/asm-blackfin/dpmc.h b/include/asm-blackfin/dpmc.h index 686cf83a526..7f34cd384f1 100644 --- a/include/asm-blackfin/dpmc.h +++ b/include/asm-blackfin/dpmc.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * include/asm-blackfin/dpmc.h - Miscellaneous IOCTL commands for Dynamic Power | 2 | * include/asm-blackfin/dpmc.h - Miscellaneous IOCTL commands for Dynamic Power |
3 | * Management Controller Driver. | 3 | * Management Controller Driver. |
4 | * Copyright (C) 2004 Analog Device Inc. | 4 | * Copyright (C) 2004-2008 Analog Device Inc. |
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | #ifndef _BLACKFIN_DPMC_H_ | 7 | #ifndef _BLACKFIN_DPMC_H_ |
@@ -65,6 +65,14 @@ void disable_wdog_timer(void); | |||
65 | extern unsigned long get_cclk(void); | 65 | extern unsigned long get_cclk(void); |
66 | extern unsigned long get_sclk(void); | 66 | extern unsigned long get_sclk(void); |
67 | 67 | ||
68 | struct bfin_dpmc_platform_data { | ||
69 | const unsigned int *tuple_tab; | ||
70 | unsigned short tabsize; | ||
71 | unsigned short vr_settling_time; /* in us */ | ||
72 | }; | ||
73 | |||
74 | #define VRPAIR(vlev, freq) (((vlev) << 16) | ((freq) >> 16)) | ||
75 | |||
68 | #endif /* __KERNEL__ */ | 76 | #endif /* __KERNEL__ */ |
69 | 77 | ||
70 | #endif /*_BLACKFIN_DPMC_H_*/ | 78 | #endif /*_BLACKFIN_DPMC_H_*/ |
diff --git a/include/asm-blackfin/entry.h b/include/asm-blackfin/entry.h index 562c6d3a323..c4f721e0d00 100644 --- a/include/asm-blackfin/entry.h +++ b/include/asm-blackfin/entry.h | |||
@@ -17,6 +17,11 @@ | |||
17 | #define PF_DTRACE_OFF 1 | 17 | #define PF_DTRACE_OFF 1 |
18 | #define PF_DTRACE_BIT 5 | 18 | #define PF_DTRACE_BIT 5 |
19 | 19 | ||
20 | /* | ||
21 | * NOTE! The single-stepping code assumes that all interrupt handlers | ||
22 | * start by saving SYSCFG on the stack with their first instruction. | ||
23 | */ | ||
24 | |||
20 | /* This one is used for exceptions, emulation, and NMI. It doesn't push | 25 | /* This one is used for exceptions, emulation, and NMI. It doesn't push |
21 | RETI and doesn't do cli. */ | 26 | RETI and doesn't do cli. */ |
22 | #define SAVE_ALL_SYS save_context_no_interrupts | 27 | #define SAVE_ALL_SYS save_context_no_interrupts |
diff --git a/include/asm-blackfin/mach-bf527/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf527/bfin_serial_5xx.h index f0ab2736a68..26e3c8076b4 100644 --- a/include/asm-blackfin/mach-bf527/bfin_serial_5xx.h +++ b/include/asm-blackfin/mach-bf527/bfin_serial_5xx.h | |||
@@ -44,10 +44,15 @@ | |||
44 | #define UART_PUT_CHAR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_THR), v) | 44 | #define UART_PUT_CHAR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_THR), v) |
45 | #define UART_PUT_DLL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLL), v) | 45 | #define UART_PUT_DLL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLL), v) |
46 | #define UART_PUT_IER(uart, v) bfin_write16(((uart)->port.membase + OFFSET_IER), v) | 46 | #define UART_PUT_IER(uart, v) bfin_write16(((uart)->port.membase + OFFSET_IER), v) |
47 | #define UART_SET_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v)) | ||
48 | #define UART_CLEAR_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v)) | ||
47 | #define UART_PUT_DLH(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLH), v) | 49 | #define UART_PUT_DLH(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLH), v) |
48 | #define UART_PUT_LCR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_LCR), v) | 50 | #define UART_PUT_LCR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_LCR), v) |
49 | #define UART_PUT_GCTL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_GCTL), v) | 51 | #define UART_PUT_GCTL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_GCTL), v) |
50 | 52 | ||
53 | #define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) | ||
54 | #define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) | ||
55 | |||
51 | #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) | 56 | #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) |
52 | # define CONFIG_SERIAL_BFIN_CTSRTS | 57 | # define CONFIG_SERIAL_BFIN_CTSRTS |
53 | 58 | ||
diff --git a/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h index fbe88dee3e2..d016603b661 100644 --- a/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h +++ b/include/asm-blackfin/mach-bf533/bfin_serial_5xx.h | |||
@@ -44,10 +44,15 @@ | |||
44 | #define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) | 44 | #define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) |
45 | #define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) | 45 | #define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) |
46 | #define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v) | 46 | #define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v) |
47 | #define UART_SET_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v)) | ||
48 | #define UART_CLEAR_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v)) | ||
47 | #define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) | 49 | #define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) |
48 | #define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) | 50 | #define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) |
49 | #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) | 51 | #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) |
50 | 52 | ||
53 | #define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) | ||
54 | #define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) | ||
55 | |||
51 | #ifdef CONFIG_BFIN_UART0_CTSRTS | 56 | #ifdef CONFIG_BFIN_UART0_CTSRTS |
52 | # define CONFIG_SERIAL_BFIN_CTSRTS | 57 | # define CONFIG_SERIAL_BFIN_CTSRTS |
53 | # ifndef CONFIG_UART0_CTS_PIN | 58 | # ifndef CONFIG_UART0_CTS_PIN |
diff --git a/include/asm-blackfin/mach-bf533/defBF532.h b/include/asm-blackfin/mach-bf533/defBF532.h index 17e1548cec0..0ab4dd7494c 100644 --- a/include/asm-blackfin/mach-bf533/defBF532.h +++ b/include/asm-blackfin/mach-bf533/defBF532.h | |||
@@ -468,6 +468,8 @@ | |||
468 | #define VLEV_110 0x00B0 /* VLEV = 1.10 V (-5% - +10% Accuracy) */ | 468 | #define VLEV_110 0x00B0 /* VLEV = 1.10 V (-5% - +10% Accuracy) */ |
469 | #define VLEV_115 0x00C0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */ | 469 | #define VLEV_115 0x00C0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */ |
470 | #define VLEV_120 0x00D0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */ | 470 | #define VLEV_120 0x00D0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */ |
471 | #define VLEV_125 0x00E0 /* VLEV = 1.25 V (-5% - +10% Accuracy) */ | ||
472 | #define VLEV_130 0x00F0 /* VLEV = 1.30 V (-5% - +10% Accuracy) */ | ||
471 | 473 | ||
472 | #define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */ | 474 | #define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */ |
473 | #define SCKELOW 0x8000 /* Do Not Drive SCKE High During Reset After Hibernate */ | 475 | #define SCKELOW 0x8000 /* Do Not Drive SCKE High During Reset After Hibernate */ |
diff --git a/include/asm-blackfin/mach-bf533/irq.h b/include/asm-blackfin/mach-bf533/irq.h index 832e6f6122d..5aa38e5da6b 100644 --- a/include/asm-blackfin/mach-bf533/irq.h +++ b/include/asm-blackfin/mach-bf533/irq.h | |||
@@ -66,12 +66,13 @@ Core Emulation ** | |||
66 | DMA8/9 Interrupt IVG13 28 | 66 | DMA8/9 Interrupt IVG13 28 |
67 | DMA10/11 Interrupt IVG13 29 | 67 | DMA10/11 Interrupt IVG13 29 |
68 | Watchdog Timer IVG13 30 | 68 | Watchdog Timer IVG13 30 |
69 | Software Interrupt 1 IVG14 31 | 69 | |
70 | Software Interrupt 2 -- | 70 | Softirq IVG14 31 |
71 | System Call -- | ||
71 | (lowest priority) IVG15 32 * | 72 | (lowest priority) IVG15 32 * |
72 | */ | 73 | */ |
73 | #define SYS_IRQS 32 | 74 | #define SYS_IRQS 31 |
74 | #define NR_PERI_INTS 24 | 75 | #define NR_PERI_INTS 24 |
75 | 76 | ||
76 | /* The ABSTRACT IRQ definitions */ | 77 | /* The ABSTRACT IRQ definitions */ |
77 | /** the first seven of the following are fixed, the rest you change if you need to **/ | 78 | /** the first seven of the following are fixed, the rest you change if you need to **/ |
@@ -96,7 +97,7 @@ Core Emulation ** | |||
96 | #define IRQ_SPORT0_TX 17 /*DMA2 Interrupt (SPORT0 TX) */ | 97 | #define IRQ_SPORT0_TX 17 /*DMA2 Interrupt (SPORT0 TX) */ |
97 | #define IRQ_SPORT1_RX 18 /*DMA3 Interrupt (SPORT1 RX) */ | 98 | #define IRQ_SPORT1_RX 18 /*DMA3 Interrupt (SPORT1 RX) */ |
98 | #define IRQ_SPORT1_TX 19 /*DMA4 Interrupt (SPORT1 TX) */ | 99 | #define IRQ_SPORT1_TX 19 /*DMA4 Interrupt (SPORT1 TX) */ |
99 | #define IRQ_SPI 20 /*DMA5 Interrupt (SPI) */ | 100 | #define IRQ_SPI 20 /*DMA5 Interrupt (SPI) */ |
100 | #define IRQ_UART_RX 21 /*DMA6 Interrupt (UART RX) */ | 101 | #define IRQ_UART_RX 21 /*DMA6 Interrupt (UART RX) */ |
101 | #define IRQ_UART_TX 22 /*DMA7 Interrupt (UART TX) */ | 102 | #define IRQ_UART_TX 22 /*DMA7 Interrupt (UART TX) */ |
102 | #define IRQ_TMR0 23 /*Timer 0 */ | 103 | #define IRQ_TMR0 23 /*Timer 0 */ |
@@ -108,9 +109,6 @@ Core Emulation ** | |||
108 | #define IRQ_MEM_DMA1 29 /*DMA10/11 Interrupt (Memory DMA Stream 1) */ | 109 | #define IRQ_MEM_DMA1 29 /*DMA10/11 Interrupt (Memory DMA Stream 1) */ |
109 | #define IRQ_WATCH 30 /*Watch Dog Timer */ | 110 | #define IRQ_WATCH 30 /*Watch Dog Timer */ |
110 | 111 | ||
111 | #define IRQ_SW_INT1 31 /*Software Int 1 */ | ||
112 | #define IRQ_SW_INT2 32 /*Software Int 2 (reserved for SYSCALL) */ | ||
113 | |||
114 | #define IRQ_PF0 33 | 112 | #define IRQ_PF0 33 |
115 | #define IRQ_PF1 34 | 113 | #define IRQ_PF1 34 |
116 | #define IRQ_PF2 35 | 114 | #define IRQ_PF2 35 |
diff --git a/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h index fd100a415b9..f79d1a0e912 100644 --- a/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h +++ b/include/asm-blackfin/mach-bf537/bfin_serial_5xx.h | |||
@@ -44,10 +44,15 @@ | |||
44 | #define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) | 44 | #define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) |
45 | #define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) | 45 | #define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) |
46 | #define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v) | 46 | #define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v) |
47 | #define UART_SET_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v)) | ||
48 | #define UART_CLEAR_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v)) | ||
47 | #define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) | 49 | #define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) |
48 | #define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) | 50 | #define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) |
49 | #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) | 51 | #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) |
50 | 52 | ||
53 | #define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) | ||
54 | #define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) | ||
55 | |||
51 | #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) | 56 | #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) |
52 | # define CONFIG_SERIAL_BFIN_CTSRTS | 57 | # define CONFIG_SERIAL_BFIN_CTSRTS |
53 | 58 | ||
diff --git a/include/asm-blackfin/mach-bf537/irq.h b/include/asm-blackfin/mach-bf537/irq.h index be6f2ff77f3..2e68a8a1e73 100644 --- a/include/asm-blackfin/mach-bf537/irq.h +++ b/include/asm-blackfin/mach-bf537/irq.h | |||
@@ -34,24 +34,23 @@ | |||
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Interrupt source definitions | 36 | * Interrupt source definitions |
37 | Event Source Core Event Name | 37 | * Event Source Core Event Name |
38 | Core Emulation ** | 38 | * Core Emulation ** |
39 | Events (highest priority) EMU 0 | 39 | * Events (highest priority) EMU 0 |
40 | Reset RST 1 | 40 | * Reset RST 1 |
41 | NMI NMI 2 | 41 | * NMI NMI 2 |
42 | Exception EVX 3 | 42 | * Exception EVX 3 |
43 | Reserved -- 4 | 43 | * Reserved -- 4 |
44 | Hardware Error IVHW 5 | 44 | * Hardware Error IVHW 5 |
45 | Core Timer IVTMR 6 * | 45 | * Core Timer IVTMR 6 |
46 | 46 | * ..... | |
47 | ..... | 47 | * |
48 | 48 | * Softirq IVG14 | |
49 | Software Interrupt 1 IVG14 31 | 49 | * System Call -- |
50 | Software Interrupt 2 -- | 50 | * (lowest priority) IVG15 |
51 | (lowest priority) IVG15 32 * | ||
52 | */ | 51 | */ |
53 | 52 | ||
54 | #define SYS_IRQS 41 | 53 | #define SYS_IRQS 39 |
55 | #define NR_PERI_INTS 32 | 54 | #define NR_PERI_INTS 32 |
56 | 55 | ||
57 | /* The ABSTRACT IRQ definitions */ | 56 | /* The ABSTRACT IRQ definitions */ |
@@ -95,10 +94,8 @@ Core Emulation ** | |||
95 | #define IRQ_PORTG_INTB 35 /* PF Port G (PF15:0) Interrupt B */ | 94 | #define IRQ_PORTG_INTB 35 /* PF Port G (PF15:0) Interrupt B */ |
96 | #define IRQ_MEM_DMA0 36 /*(Memory DMA Stream 0) */ | 95 | #define IRQ_MEM_DMA0 36 /*(Memory DMA Stream 0) */ |
97 | #define IRQ_MEM_DMA1 37 /*(Memory DMA Stream 1) */ | 96 | #define IRQ_MEM_DMA1 37 /*(Memory DMA Stream 1) */ |
98 | #define IRQ_PROG_INTB 38 /* PF Ports F (PF15:0) Interrupt B */ | 97 | #define IRQ_PROG_INTB 38 /* PF Ports F (PF15:0) Interrupt B */ |
99 | #define IRQ_WATCH 38 /*Watch Dog Timer */ | 98 | #define IRQ_WATCH 38 /*Watch Dog Timer */ |
100 | #define IRQ_SW_INT1 40 /*Software Int 1 */ | ||
101 | #define IRQ_SW_INT2 41 /*Software Int 2 (reserved for SYSCALL) */ | ||
102 | 99 | ||
103 | #define IRQ_PPI_ERROR 42 /*PPI Error Interrupt */ | 100 | #define IRQ_PPI_ERROR 42 /*PPI Error Interrupt */ |
104 | #define IRQ_CAN_ERROR 43 /*CAN Error Interrupt */ | 101 | #define IRQ_CAN_ERROR 43 /*CAN Error Interrupt */ |
diff --git a/include/asm-blackfin/mach-bf548/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf548/bfin_serial_5xx.h index 6547027cd3e..5eb46a77d91 100644 --- a/include/asm-blackfin/mach-bf548/bfin_serial_5xx.h +++ b/include/asm-blackfin/mach-bf548/bfin_serial_5xx.h | |||
@@ -54,6 +54,9 @@ | |||
54 | #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) | 54 | #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) |
55 | #define UART_PUT_MCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_MCR),v) | 55 | #define UART_PUT_MCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_MCR),v) |
56 | 56 | ||
57 | #define UART_SET_DLAB(uart) /* MMRs not muxed on BF54x */ | ||
58 | #define UART_CLEAR_DLAB(uart) /* MMRs not muxed on BF54x */ | ||
59 | |||
57 | #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) | 60 | #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) |
58 | # define CONFIG_SERIAL_BFIN_CTSRTS | 61 | # define CONFIG_SERIAL_BFIN_CTSRTS |
59 | 62 | ||
diff --git a/include/asm-blackfin/mach-bf548/defBF54x_base.h b/include/asm-blackfin/mach-bf548/defBF54x_base.h index 08f90c21fe8..e022e896cb1 100644 --- a/include/asm-blackfin/mach-bf548/defBF54x_base.h +++ b/include/asm-blackfin/mach-bf548/defBF54x_base.h | |||
@@ -2329,6 +2329,26 @@ | |||
2329 | #define KPADWE 0x1000 /* Keypad Wake-Up Enable */ | 2329 | #define KPADWE 0x1000 /* Keypad Wake-Up Enable */ |
2330 | #define ROTWE 0x2000 /* Rotary Wake-Up Enable */ | 2330 | #define ROTWE 0x2000 /* Rotary Wake-Up Enable */ |
2331 | 2331 | ||
2332 | #define FREQ_333 0x0001 /* Switching Frequency Is 333 kHz */ | ||
2333 | #define FREQ_667 0x0002 /* Switching Frequency Is 667 kHz */ | ||
2334 | #define FREQ_1000 0x0003 /* Switching Frequency Is 1 MHz */ | ||
2335 | |||
2336 | #define GAIN_5 0x0000 /* GAIN = 5*/ | ||
2337 | #define GAIN_10 0x0004 /* GAIN = 1*/ | ||
2338 | #define GAIN_20 0x0008 /* GAIN = 2*/ | ||
2339 | #define GAIN_50 0x000C /* GAIN = 5*/ | ||
2340 | |||
2341 | #define VLEV_085 0x0060 /* VLEV = 0.85 V (-5% - +10% Accuracy) */ | ||
2342 | #define VLEV_090 0x0070 /* VLEV = 0.90 V (-5% - +10% Accuracy) */ | ||
2343 | #define VLEV_095 0x0080 /* VLEV = 0.95 V (-5% - +10% Accuracy) */ | ||
2344 | #define VLEV_100 0x0090 /* VLEV = 1.00 V (-5% - +10% Accuracy) */ | ||
2345 | #define VLEV_105 0x00A0 /* VLEV = 1.05 V (-5% - +10% Accuracy) */ | ||
2346 | #define VLEV_110 0x00B0 /* VLEV = 1.10 V (-5% - +10% Accuracy) */ | ||
2347 | #define VLEV_115 0x00C0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */ | ||
2348 | #define VLEV_120 0x00D0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */ | ||
2349 | #define VLEV_125 0x00E0 /* VLEV = 1.25 V (-5% - +10% Accuracy) */ | ||
2350 | #define VLEV_130 0x00F0 /* VLEV = 1.30 V (-5% - +10% Accuracy) */ | ||
2351 | |||
2332 | /* Bit masks for NFC_CTL */ | 2352 | /* Bit masks for NFC_CTL */ |
2333 | 2353 | ||
2334 | #define WR_DLY 0xf /* Write Strobe Delay */ | 2354 | #define WR_DLY 0xf /* Write Strobe Delay */ |
diff --git a/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h b/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h index 8a4e66d1db3..7a962876929 100644 --- a/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h +++ b/include/asm-blackfin/mach-bf561/bfin_serial_5xx.h | |||
@@ -44,10 +44,15 @@ | |||
44 | #define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) | 44 | #define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) |
45 | #define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) | 45 | #define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) |
46 | #define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v) | 46 | #define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v) |
47 | #define UART_SET_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v)) | ||
48 | #define UART_CLEAR_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v)) | ||
47 | #define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) | 49 | #define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) |
48 | #define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) | 50 | #define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) |
49 | #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) | 51 | #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) |
50 | 52 | ||
53 | #define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) | ||
54 | #define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) | ||
55 | |||
51 | #ifdef CONFIG_BFIN_UART0_CTSRTS | 56 | #ifdef CONFIG_BFIN_UART0_CTSRTS |
52 | # define CONFIG_SERIAL_BFIN_CTSRTS | 57 | # define CONFIG_SERIAL_BFIN_CTSRTS |
53 | # ifndef CONFIG_UART0_CTS_PIN | 58 | # ifndef CONFIG_UART0_CTS_PIN |
diff --git a/include/asm-blackfin/mach-bf561/defBF561.h b/include/asm-blackfin/mach-bf561/defBF561.h index 366c9b9a0cb..1ab50e906fe 100644 --- a/include/asm-blackfin/mach-bf561/defBF561.h +++ b/include/asm-blackfin/mach-bf561/defBF561.h | |||
@@ -868,6 +868,34 @@ | |||
868 | #define CHIPID_FAMILY 0x0FFFF000 | 868 | #define CHIPID_FAMILY 0x0FFFF000 |
869 | #define CHIPID_MANUFACTURE 0x00000FFE | 869 | #define CHIPID_MANUFACTURE 0x00000FFE |
870 | 870 | ||
871 | /* VR_CTL Masks */ | ||
872 | #define FREQ 0x0003 /* Switching Oscillator Frequency For Regulator */ | ||
873 | #define HIBERNATE 0x0000 /* Powerdown/Bypass On-Board Regulation */ | ||
874 | #define FREQ_333 0x0001 /* Switching Frequency Is 333 kHz */ | ||
875 | #define FREQ_667 0x0002 /* Switching Frequency Is 667 kHz */ | ||
876 | #define FREQ_1000 0x0003 /* Switching Frequency Is 1 MHz */ | ||
877 | |||
878 | #define GAIN 0x000C /* Voltage Level Gain */ | ||
879 | #define GAIN_5 0x0000 /* GAIN = 5*/ | ||
880 | #define GAIN_10 0x0004 /* GAIN = 1*/ | ||
881 | #define GAIN_20 0x0008 /* GAIN = 2*/ | ||
882 | #define GAIN_50 0x000C /* GAIN = 5*/ | ||
883 | |||
884 | #define VLEV 0x00F0 /* Internal Voltage Level */ | ||
885 | #define VLEV_085 0x0060 /* VLEV = 0.85 V (-5% - +10% Accuracy) */ | ||
886 | #define VLEV_090 0x0070 /* VLEV = 0.90 V (-5% - +10% Accuracy) */ | ||
887 | #define VLEV_095 0x0080 /* VLEV = 0.95 V (-5% - +10% Accuracy) */ | ||
888 | #define VLEV_100 0x0090 /* VLEV = 1.00 V (-5% - +10% Accuracy) */ | ||
889 | #define VLEV_105 0x00A0 /* VLEV = 1.05 V (-5% - +10% Accuracy) */ | ||
890 | #define VLEV_110 0x00B0 /* VLEV = 1.10 V (-5% - +10% Accuracy) */ | ||
891 | #define VLEV_115 0x00C0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */ | ||
892 | #define VLEV_120 0x00D0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */ | ||
893 | #define VLEV_125 0x00E0 /* VLEV = 1.25 V (-5% - +10% Accuracy) */ | ||
894 | #define VLEV_130 0x00F0 /* VLEV = 1.30 V (-5% - +10% Accuracy) */ | ||
895 | |||
896 | #define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */ | ||
897 | #define SCKELOW 0x8000 /* Do Not Drive SCKE High During Reset After Hibernate */ | ||
898 | |||
871 | /* PLL_DIV Masks */ | 899 | /* PLL_DIV Masks */ |
872 | #define SCLK_DIV(x) (x) /* SCLK = VCO / x */ | 900 | #define SCLK_DIV(x) (x) /* SCLK = VCO / x */ |
873 | 901 | ||
diff --git a/include/asm-blackfin/mach-bf561/irq.h b/include/asm-blackfin/mach-bf561/irq.h index 83f0383957d..6698389c556 100644 --- a/include/asm-blackfin/mach-bf561/irq.h +++ b/include/asm-blackfin/mach-bf561/irq.h | |||
@@ -118,12 +118,13 @@ | |||
118 | Supplemental interrupt 0 IVG7 69 | 118 | Supplemental interrupt 0 IVG7 69 |
119 | supplemental interrupt 1 IVG7 70 | 119 | supplemental interrupt 1 IVG7 70 |
120 | 120 | ||
121 | Software Interrupt 1 IVG14 71 | 121 | Softirq IVG14 |
122 | Software Interrupt 2 IVG15 72 * | 122 | System Call -- |
123 | (lowest priority) | 123 | (lowest priority) IVG15 |
124 | |||
124 | **********************************************************************/ | 125 | **********************************************************************/ |
125 | 126 | ||
126 | #define SYS_IRQS 72 | 127 | #define SYS_IRQS 71 |
127 | #define NR_PERI_INTS 64 | 128 | #define NR_PERI_INTS 64 |
128 | 129 | ||
129 | /* | 130 | /* |
@@ -237,9 +238,7 @@ | |||
237 | #define IRQ_RESERVED_2 (IVG_BASE + 61) /* Reserved interrupt */ | 238 | #define IRQ_RESERVED_2 (IVG_BASE + 61) /* Reserved interrupt */ |
238 | #define IRQ_SUPPLE_0 (IVG_BASE + 62) /* Supplemental interrupt 0 */ | 239 | #define IRQ_SUPPLE_0 (IVG_BASE + 62) /* Supplemental interrupt 0 */ |
239 | #define IRQ_SUPPLE_1 (IVG_BASE + 63) /* supplemental interrupt 1 */ | 240 | #define IRQ_SUPPLE_1 (IVG_BASE + 63) /* supplemental interrupt 1 */ |
240 | #define IRQ_SW_INT1 71 /* Software Interrupt 1 */ | 241 | |
241 | #define IRQ_SW_INT2 72 /* Software Interrupt 2 */ | ||
242 | /* reserved for SYSCALL */ | ||
243 | #define IRQ_PF0 73 | 242 | #define IRQ_PF0 73 |
244 | #define IRQ_PF1 74 | 243 | #define IRQ_PF1 74 |
245 | #define IRQ_PF2 75 | 244 | #define IRQ_PF2 75 |
diff --git a/include/asm-blackfin/mach-common/context.S b/include/asm-blackfin/mach-common/context.S index fd0ebe1862b..c0e630edfb9 100644 --- a/include/asm-blackfin/mach-common/context.S +++ b/include/asm-blackfin/mach-common/context.S | |||
@@ -28,6 +28,11 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * NOTE! The single-stepping code assumes that all interrupt handlers | ||
32 | * start by saving SYSCFG on the stack with their first instruction. | ||
33 | */ | ||
34 | |||
35 | /* | ||
31 | * Code to save processor context. | 36 | * Code to save processor context. |
32 | * We even save the register which are preserved by a function call | 37 | * We even save the register which are preserved by a function call |
33 | * - r4, r5, r6, r7, p3, p4, p5 | 38 | * - r4, r5, r6, r7, p3, p4, p5 |
diff --git a/include/asm-blackfin/time.h b/include/asm-blackfin/time.h index 6e5859b6ea3..ddc43ce3853 100644 --- a/include/asm-blackfin/time.h +++ b/include/asm-blackfin/time.h | |||
@@ -24,6 +24,8 @@ | |||
24 | 24 | ||
25 | #ifndef CONFIG_CPU_FREQ | 25 | #ifndef CONFIG_CPU_FREQ |
26 | #define TIME_SCALE 1 | 26 | #define TIME_SCALE 1 |
27 | #define __bfin_cycles_off (0) | ||
28 | #define __bfin_cycles_mod (0) | ||
27 | #else | 29 | #else |
28 | /* | 30 | /* |
29 | * Blackfin CPU frequency scaling supports max Core Clock 1, 1/2 and 1/4 . | 31 | * Blackfin CPU frequency scaling supports max Core Clock 1, 1/2 and 1/4 . |
@@ -31,6 +33,8 @@ | |||
31 | * adjust the Core Timer Presale Register. This way we don't lose time. | 33 | * adjust the Core Timer Presale Register. This way we don't lose time. |
32 | */ | 34 | */ |
33 | #define TIME_SCALE 4 | 35 | #define TIME_SCALE 4 |
36 | extern unsigned long long __bfin_cycles_off; | ||
37 | extern unsigned int __bfin_cycles_mod; | ||
34 | #endif | 38 | #endif |
35 | 39 | ||
36 | #endif | 40 | #endif |
diff --git a/include/asm-m68k/machw.h b/include/asm-m68k/machw.h index d2e0e25d5c9..35624998291 100644 --- a/include/asm-m68k/machw.h +++ b/include/asm-m68k/machw.h | |||
@@ -66,36 +66,6 @@ struct MAC_SCC | |||
66 | # define mac_scc ((*(volatile struct SCC*)MAC_SCC_BAS)) | 66 | # define mac_scc ((*(volatile struct SCC*)MAC_SCC_BAS)) |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | /* hardware stuff */ | ||
70 | |||
71 | #define MACHW_DECLARE(name) unsigned name : 1 | ||
72 | #define MACHW_SET(name) (mac_hw_present.name = 1) | ||
73 | #define MACHW_PRESENT(name) (mac_hw_present.name) | ||
74 | |||
75 | struct mac_hw_present { | ||
76 | /* video hardware */ | ||
77 | /* sound hardware */ | ||
78 | /* disk storage interfaces */ | ||
79 | MACHW_DECLARE(MAC_SCSI_80); /* Directly mapped NCR5380 */ | ||
80 | MACHW_DECLARE(MAC_SCSI_96); /* 53c9[46] */ | ||
81 | MACHW_DECLARE(MAC_SCSI_96_2); /* 2nd 53c9[46] Q900 and Q950 */ | ||
82 | MACHW_DECLARE(IDE); /* IDE Interface */ | ||
83 | /* other I/O hardware */ | ||
84 | MACHW_DECLARE(SCC); /* Serial Communications Contr. */ | ||
85 | /* DMA */ | ||
86 | MACHW_DECLARE(SCSI_DMA); /* DMA for the NCR5380 */ | ||
87 | /* real time clocks */ | ||
88 | MACHW_DECLARE(RTC_CLK); /* clock chip */ | ||
89 | /* supporting hardware */ | ||
90 | MACHW_DECLARE(VIA1); /* Versatile Interface Ad. 1 */ | ||
91 | MACHW_DECLARE(VIA2); /* Versatile Interface Ad. 2 */ | ||
92 | MACHW_DECLARE(RBV); /* Versatile Interface Ad. 2+ */ | ||
93 | /* NUBUS */ | ||
94 | MACHW_DECLARE(NUBUS); /* NUBUS */ | ||
95 | }; | ||
96 | |||
97 | extern struct mac_hw_present mac_hw_present; | ||
98 | |||
99 | #endif /* __ASSEMBLY__ */ | 69 | #endif /* __ASSEMBLY__ */ |
100 | 70 | ||
101 | #endif /* linux/machw.h */ | 71 | #endif /* linux/machw.h */ |
diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h index 7a2ee4f4013..bcbb8d675af 100644 --- a/include/asm-mips/types.h +++ b/include/asm-mips/types.h | |||
@@ -19,8 +19,6 @@ | |||
19 | 19 | ||
20 | typedef unsigned short umode_t; | 20 | typedef unsigned short umode_t; |
21 | 21 | ||
22 | #endif | ||
23 | |||
24 | #endif /* __ASSEMBLY__ */ | 22 | #endif /* __ASSEMBLY__ */ |
25 | 23 | ||
26 | /* | 24 | /* |
diff --git a/include/asm-mn10300/processor.h b/include/asm-mn10300/processor.h index f1b081f5346..73239271873 100644 --- a/include/asm-mn10300/processor.h +++ b/include/asm-mn10300/processor.h | |||
@@ -58,7 +58,7 @@ extern struct mn10300_cpuinfo boot_cpu_data; | |||
58 | extern void identify_cpu(struct mn10300_cpuinfo *); | 58 | extern void identify_cpu(struct mn10300_cpuinfo *); |
59 | extern void print_cpu_info(struct mn10300_cpuinfo *); | 59 | extern void print_cpu_info(struct mn10300_cpuinfo *); |
60 | extern void dodgy_tsc(void); | 60 | extern void dodgy_tsc(void); |
61 | #define cpu_relax() do {} while (0) | 61 | #define cpu_relax() barrier() |
62 | 62 | ||
63 | /* | 63 | /* |
64 | * User space process size: 1.75GB (default). | 64 | * User space process size: 1.75GB (default). |
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h index afae0697e8c..e0062d73db1 100644 --- a/include/asm-powerpc/io.h +++ b/include/asm-powerpc/io.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define _ASM_POWERPC_IO_H | 2 | #define _ASM_POWERPC_IO_H |
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | /* | 5 | /* |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
8 | * as published by the Free Software Foundation; either version | 8 | * as published by the Free Software Foundation; either version |
@@ -18,6 +18,9 @@ extern int check_legacy_ioport(unsigned long base_port); | |||
18 | #define _PNPWRP 0xa79 | 18 | #define _PNPWRP 0xa79 |
19 | #define PNPBIOS_BASE 0xf000 | 19 | #define PNPBIOS_BASE 0xf000 |
20 | 20 | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/io.h> | ||
23 | |||
21 | #include <linux/compiler.h> | 24 | #include <linux/compiler.h> |
22 | #include <asm/page.h> | 25 | #include <asm/page.h> |
23 | #include <asm/byteorder.h> | 26 | #include <asm/byteorder.h> |
@@ -744,6 +747,9 @@ static inline void * bus_to_virt(unsigned long address) | |||
744 | 747 | ||
745 | #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) | 748 | #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) |
746 | 749 | ||
750 | void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset, | ||
751 | size_t size, unsigned long flags); | ||
752 | |||
747 | #endif /* __KERNEL__ */ | 753 | #endif /* __KERNEL__ */ |
748 | 754 | ||
749 | #endif /* _ASM_POWERPC_IO_H */ | 755 | #endif /* _ASM_POWERPC_IO_H */ |
diff --git a/include/asm-powerpc/kvm_host.h b/include/asm-powerpc/kvm_host.h index 04ffbb8e0a3..81a69d71101 100644 --- a/include/asm-powerpc/kvm_host.h +++ b/include/asm-powerpc/kvm_host.h | |||
@@ -59,6 +59,7 @@ struct kvm_vcpu_stat { | |||
59 | u32 emulated_inst_exits; | 59 | u32 emulated_inst_exits; |
60 | u32 dec_exits; | 60 | u32 dec_exits; |
61 | u32 ext_intr_exits; | 61 | u32 ext_intr_exits; |
62 | u32 halt_wakeup; | ||
62 | }; | 63 | }; |
63 | 64 | ||
64 | struct tlbe { | 65 | struct tlbe { |
diff --git a/include/asm-powerpc/kvm_ppc.h b/include/asm-powerpc/kvm_ppc.h index 7ac820308a7..b35a7e3ef97 100644 --- a/include/asm-powerpc/kvm_ppc.h +++ b/include/asm-powerpc/kvm_ppc.h | |||
@@ -77,12 +77,17 @@ static inline void kvmppc_clear_exception(struct kvm_vcpu *vcpu, int exception) | |||
77 | clear_bit(priority, &vcpu->arch.pending_exceptions); | 77 | clear_bit(priority, &vcpu->arch.pending_exceptions); |
78 | } | 78 | } |
79 | 79 | ||
80 | /* Helper function for "full" MSR writes. No need to call this if only EE is | ||
81 | * changing. */ | ||
80 | static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr) | 82 | static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr) |
81 | { | 83 | { |
82 | if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR)) | 84 | if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR)) |
83 | kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR); | 85 | kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR); |
84 | 86 | ||
85 | vcpu->arch.msr = new_msr; | 87 | vcpu->arch.msr = new_msr; |
88 | |||
89 | if (vcpu->arch.msr & MSR_WE) | ||
90 | kvm_vcpu_block(vcpu); | ||
86 | } | 91 | } |
87 | 92 | ||
88 | #endif /* __POWERPC_KVM_PPC_H__ */ | 93 | #endif /* __POWERPC_KVM_PPC_H__ */ |
diff --git a/include/asm-powerpc/pgtable-ppc32.h b/include/asm-powerpc/pgtable-ppc32.h index 7c97b5a08d0..c08e714d0c4 100644 --- a/include/asm-powerpc/pgtable-ppc32.h +++ b/include/asm-powerpc/pgtable-ppc32.h | |||
@@ -209,6 +209,13 @@ extern int icache_44x_need_flush; | |||
209 | * 0 1 2 3 4 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 209 | * 0 1 2 3 4 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
210 | * - - - - - - U0 U1 U2 U3 W I M G E - UX UW UR SX SW SR | 210 | * - - - - - - U0 U1 U2 U3 W I M G E - UX UW UR SX SW SR |
211 | * | 211 | * |
212 | * Newer 440 cores (440x6 as used on AMCC 460EX/460GT) have additional | ||
213 | * TLB2 storage attibute fields. Those are: | ||
214 | * | ||
215 | * TLB2: | ||
216 | * 0...10 11 12 13 14 15 16...31 | ||
217 | * no change WL1 IL1I IL1D IL2I IL2D no change | ||
218 | * | ||
212 | * There are some constrains and options, to decide mapping software bits | 219 | * There are some constrains and options, to decide mapping software bits |
213 | * into TLB entry. | 220 | * into TLB entry. |
214 | * | 221 | * |
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h index e3c845b0f76..6abead6e681 100644 --- a/include/asm-powerpc/spu.h +++ b/include/asm-powerpc/spu.h | |||
@@ -100,6 +100,7 @@ | |||
100 | 100 | ||
101 | /* Flag indicating progress during context switch. */ | 101 | /* Flag indicating progress during context switch. */ |
102 | #define SPU_CONTEXT_SWITCH_PENDING 0UL | 102 | #define SPU_CONTEXT_SWITCH_PENDING 0UL |
103 | #define SPU_CONTEXT_FAULT_PENDING 1UL | ||
103 | 104 | ||
104 | struct spu_context; | 105 | struct spu_context; |
105 | struct spu_runqueue; | 106 | struct spu_runqueue; |
@@ -128,9 +129,11 @@ struct spu { | |||
128 | unsigned int irqs[3]; | 129 | unsigned int irqs[3]; |
129 | u32 node; | 130 | u32 node; |
130 | u64 flags; | 131 | u64 flags; |
131 | u64 dar; | ||
132 | u64 dsisr; | ||
133 | u64 class_0_pending; | 132 | u64 class_0_pending; |
133 | u64 class_0_dar; | ||
134 | u64 class_0_dsisr; | ||
135 | u64 class_1_dar; | ||
136 | u64 class_1_dsisr; | ||
134 | size_t ls_size; | 137 | size_t ls_size; |
135 | unsigned int slb_replace; | 138 | unsigned int slb_replace; |
136 | struct mm_struct *mm; | 139 | struct mm_struct *mm; |
@@ -143,7 +146,7 @@ struct spu { | |||
143 | 146 | ||
144 | void (* wbox_callback)(struct spu *spu); | 147 | void (* wbox_callback)(struct spu *spu); |
145 | void (* ibox_callback)(struct spu *spu); | 148 | void (* ibox_callback)(struct spu *spu); |
146 | void (* stop_callback)(struct spu *spu); | 149 | void (* stop_callback)(struct spu *spu, int irq); |
147 | void (* mfc_callback)(struct spu *spu); | 150 | void (* mfc_callback)(struct spu *spu); |
148 | 151 | ||
149 | char irq_c0[8]; | 152 | char irq_c0[8]; |
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h index 0ab6bff8607..129ec148d45 100644 --- a/include/asm-powerpc/spu_csa.h +++ b/include/asm-powerpc/spu_csa.h | |||
@@ -254,7 +254,8 @@ struct spu_state { | |||
254 | u64 spu_chnldata_RW[32]; | 254 | u64 spu_chnldata_RW[32]; |
255 | u32 spu_mailbox_data[4]; | 255 | u32 spu_mailbox_data[4]; |
256 | u32 pu_mailbox_data[1]; | 256 | u32 pu_mailbox_data[1]; |
257 | u64 dar, dsisr, class_0_pending; | 257 | u64 class_0_dar, class_0_dsisr, class_0_pending; |
258 | u64 class_1_dar, class_1_dsisr; | ||
258 | unsigned long suspend_time; | 259 | unsigned long suspend_time; |
259 | spinlock_t register_lock; | 260 | spinlock_t register_lock; |
260 | }; | 261 | }; |
diff --git a/include/asm-s390/kvm_host.h b/include/asm-s390/kvm_host.h index f8204a4f2e0..18cbd8a3979 100644 --- a/include/asm-s390/kvm_host.h +++ b/include/asm-s390/kvm_host.h | |||
@@ -104,6 +104,7 @@ struct sie_block { | |||
104 | 104 | ||
105 | struct kvm_vcpu_stat { | 105 | struct kvm_vcpu_stat { |
106 | u32 exit_userspace; | 106 | u32 exit_userspace; |
107 | u32 exit_null; | ||
107 | u32 exit_external_request; | 108 | u32 exit_external_request; |
108 | u32 exit_external_interrupt; | 109 | u32 exit_external_interrupt; |
109 | u32 exit_stop_request; | 110 | u32 exit_stop_request; |
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h index f0f4579eac1..12fd9c4f0f1 100644 --- a/include/asm-s390/page.h +++ b/include/asm-s390/page.h | |||
@@ -125,6 +125,17 @@ page_get_storage_key(unsigned long addr) | |||
125 | return skey; | 125 | return skey; |
126 | } | 126 | } |
127 | 127 | ||
128 | #ifdef CONFIG_PAGE_STATES | ||
129 | |||
130 | struct page; | ||
131 | void arch_free_page(struct page *page, int order); | ||
132 | void arch_alloc_page(struct page *page, int order); | ||
133 | |||
134 | #define HAVE_ARCH_FREE_PAGE | ||
135 | #define HAVE_ARCH_ALLOC_PAGE | ||
136 | |||
137 | #endif | ||
138 | |||
128 | #endif /* !__ASSEMBLY__ */ | 139 | #endif /* !__ASSEMBLY__ */ |
129 | 140 | ||
130 | /* to align the pointer to the (next) page boundary */ | 141 | /* to align the pointer to the (next) page boundary */ |
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h index 441d7c26085..d7d4e2eb3e6 100644 --- a/include/asm-s390/ptrace.h +++ b/include/asm-s390/ptrace.h | |||
@@ -471,6 +471,8 @@ struct task_struct; | |||
471 | extern void user_enable_single_step(struct task_struct *); | 471 | extern void user_enable_single_step(struct task_struct *); |
472 | extern void user_disable_single_step(struct task_struct *); | 472 | extern void user_disable_single_step(struct task_struct *); |
473 | 473 | ||
474 | #define __ARCH_WANT_COMPAT_SYS_PTRACE | ||
475 | |||
474 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) | 476 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) |
475 | #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) | 477 | #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) |
476 | #define regs_return_value(regs)((regs)->gprs[2]) | 478 | #define regs_return_value(regs)((regs)->gprs[2]) |
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index c819ae25a84..e0d4500d5f9 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h | |||
@@ -116,6 +116,12 @@ extern void pfault_fini(void); | |||
116 | #define pfault_fini() do { } while (0) | 116 | #define pfault_fini() do { } while (0) |
117 | #endif /* CONFIG_PFAULT */ | 117 | #endif /* CONFIG_PFAULT */ |
118 | 118 | ||
119 | #ifdef CONFIG_PAGE_STATES | ||
120 | extern void cmma_init(void); | ||
121 | #else | ||
122 | static inline void cmma_init(void) { } | ||
123 | #endif | ||
124 | |||
119 | #define finish_arch_switch(prev) do { \ | 125 | #define finish_arch_switch(prev) do { \ |
120 | set_fs(current->thread.mm_segment); \ | 126 | set_fs(current->thread.mm_segment); \ |
121 | account_vtime(prev); \ | 127 | account_vtime(prev); \ |
diff --git a/include/asm-sh/cpu-sh3/dma.h b/include/asm-sh/cpu-sh3/dma.h index 092ff9d872c..6813c3220a1 100644 --- a/include/asm-sh/cpu-sh3/dma.h +++ b/include/asm-sh/cpu-sh3/dma.h | |||
@@ -3,19 +3,19 @@ | |||
3 | 3 | ||
4 | 4 | ||
5 | #if defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 5 | #if defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
6 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ | 6 | defined(CONFIG_CPU_SUBTYPE_SH7721) |
7 | defined(CONFIG_CPU_SUBTYPE_SH7709) | ||
8 | #define SH_DMAC_BASE 0xa4010020 | 7 | #define SH_DMAC_BASE 0xa4010020 |
8 | #else | ||
9 | #define SH_DMAC_BASE 0xa4000020 | ||
10 | #endif | ||
9 | 11 | ||
12 | #if defined(CONFIG_CPU_SUBTYPE_SH7720) || defined(CONFIG_CPU_SUBTYPE_SH7709) | ||
10 | #define DMTE0_IRQ 48 | 13 | #define DMTE0_IRQ 48 |
11 | #define DMTE1_IRQ 49 | 14 | #define DMTE1_IRQ 49 |
12 | #define DMTE2_IRQ 50 | 15 | #define DMTE2_IRQ 50 |
13 | #define DMTE3_IRQ 51 | 16 | #define DMTE3_IRQ 51 |
14 | #define DMTE4_IRQ 76 | 17 | #define DMTE4_IRQ 76 |
15 | #define DMTE5_IRQ 77 | 18 | #define DMTE5_IRQ 77 |
16 | |||
17 | #else | ||
18 | #define SH_DMAC_BASE 0xa4000020 | ||
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | /* Definitions for the SuperH DMAC */ | 21 | /* Definitions for the SuperH DMAC */ |
diff --git a/include/asm-sh/hw_irq.h b/include/asm-sh/hw_irq.h index c958fdaa009..7438d1e21bc 100644 --- a/include/asm-sh/hw_irq.h +++ b/include/asm-sh/hw_irq.h | |||
@@ -79,6 +79,10 @@ struct intc_desc { | |||
79 | struct intc_sense_reg *sense_regs; | 79 | struct intc_sense_reg *sense_regs; |
80 | unsigned int nr_sense_regs; | 80 | unsigned int nr_sense_regs; |
81 | char *name; | 81 | char *name; |
82 | #ifdef CONFIG_CPU_SH3 | ||
83 | struct intc_mask_reg *ack_regs; | ||
84 | unsigned int nr_ack_regs; | ||
85 | #endif | ||
82 | }; | 86 | }; |
83 | 87 | ||
84 | #define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) | 88 | #define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) |
@@ -91,10 +95,25 @@ struct intc_desc symbol __initdata = { \ | |||
91 | chipname, \ | 95 | chipname, \ |
92 | } | 96 | } |
93 | 97 | ||
98 | #ifdef CONFIG_CPU_SH3 | ||
99 | #define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \ | ||
100 | mask_regs, prio_regs, sense_regs, ack_regs) \ | ||
101 | struct intc_desc symbol __initdata = { \ | ||
102 | _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ | ||
103 | _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ | ||
104 | _INTC_ARRAY(sense_regs), \ | ||
105 | chipname, \ | ||
106 | _INTC_ARRAY(ack_regs), \ | ||
107 | } | ||
108 | #endif | ||
109 | |||
94 | void __init register_intc_controller(struct intc_desc *desc); | 110 | void __init register_intc_controller(struct intc_desc *desc); |
95 | int intc_set_priority(unsigned int irq, unsigned int prio); | 111 | int intc_set_priority(unsigned int irq, unsigned int prio); |
96 | 112 | ||
97 | void __init plat_irq_setup(void); | 113 | void __init plat_irq_setup(void); |
114 | #ifdef CONFIG_CPU_SH3 | ||
115 | void __init plat_irq_setup_sh3(void); | ||
116 | #endif | ||
98 | 117 | ||
99 | enum { IRQ_MODE_IRQ, IRQ_MODE_IRQ7654, IRQ_MODE_IRQ3210, | 118 | enum { IRQ_MODE_IRQ, IRQ_MODE_IRQ7654, IRQ_MODE_IRQ3210, |
100 | IRQ_MODE_IRL7654_MASK, IRQ_MODE_IRL3210_MASK, | 119 | IRQ_MODE_IRL7654_MASK, IRQ_MODE_IRL3210_MASK, |
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h index 356e50d0674..a4fbf0c84fb 100644 --- a/include/asm-sh/io.h +++ b/include/asm-sh/io.h | |||
@@ -268,11 +268,6 @@ unsigned long long peek_real_address_q(unsigned long long addr); | |||
268 | unsigned long long poke_real_address_q(unsigned long long addr, | 268 | unsigned long long poke_real_address_q(unsigned long long addr, |
269 | unsigned long long val); | 269 | unsigned long long val); |
270 | 270 | ||
271 | /* arch/sh/mm/ioremap_64.c */ | ||
272 | unsigned long onchip_remap(unsigned long addr, unsigned long size, | ||
273 | const char *name); | ||
274 | extern void onchip_unmap(unsigned long vaddr); | ||
275 | |||
276 | #if !defined(CONFIG_MMU) | 271 | #if !defined(CONFIG_MMU) |
277 | #define virt_to_phys(address) ((unsigned long)(address)) | 272 | #define virt_to_phys(address) ((unsigned long)(address)) |
278 | #define phys_to_virt(address) ((void *)(address)) | 273 | #define phys_to_virt(address) ((void *)(address)) |
@@ -302,9 +297,16 @@ extern void onchip_unmap(unsigned long vaddr); | |||
302 | void __iomem *__ioremap(unsigned long offset, unsigned long size, | 297 | void __iomem *__ioremap(unsigned long offset, unsigned long size, |
303 | unsigned long flags); | 298 | unsigned long flags); |
304 | void __iounmap(void __iomem *addr); | 299 | void __iounmap(void __iomem *addr); |
300 | |||
301 | /* arch/sh/mm/ioremap_64.c */ | ||
302 | unsigned long onchip_remap(unsigned long addr, unsigned long size, | ||
303 | const char *name); | ||
304 | extern void onchip_unmap(unsigned long vaddr); | ||
305 | #else | 305 | #else |
306 | #define __ioremap(offset, size, flags) ((void __iomem *)(offset)) | 306 | #define __ioremap(offset, size, flags) ((void __iomem *)(offset)) |
307 | #define __iounmap(addr) do { } while (0) | 307 | #define __iounmap(addr) do { } while (0) |
308 | #define onchip_remap(addr, size, name) (addr) | ||
309 | #define onchip_unmap(addr) do { } while (0) | ||
308 | #endif /* CONFIG_MMU */ | 310 | #endif /* CONFIG_MMU */ |
309 | 311 | ||
310 | static inline void __iomem * | 312 | static inline void __iomem * |
diff --git a/include/asm-sh/keyboard.h b/include/asm-sh/keyboard.h deleted file mode 100644 index 31dcc4fa5f2..00000000000 --- a/include/asm-sh/keyboard.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #ifndef __ASM_SH_KEYBOARD_H | ||
2 | #define __ASM_SH_KEYBOARD_H | ||
3 | /* | ||
4 | * $Id: keyboard.h,v 1.1.1.1 2001/10/15 20:45:09 mrbrown Exp $ | ||
5 | */ | ||
6 | |||
7 | #include <linux/kd.h> | ||
8 | #include <asm/machvec.h> | ||
9 | |||
10 | #ifdef CONFIG_SH_MPC1211 | ||
11 | #include <asm/mpc1211/keyboard-mpc1211.h> | ||
12 | #endif | ||
13 | #endif | ||
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h index fe58d00b250..87e812f68bb 100644 --- a/include/asm-sh/mmu_context.h +++ b/include/asm-sh/mmu_context.h | |||
@@ -27,6 +27,7 @@ | |||
27 | /* ASID is 8-bit value, so it can't be 0x100 */ | 27 | /* ASID is 8-bit value, so it can't be 0x100 */ |
28 | #define MMU_NO_ASID 0x100 | 28 | #define MMU_NO_ASID 0x100 |
29 | 29 | ||
30 | #ifdef CONFIG_MMU | ||
30 | #define asid_cache(cpu) (cpu_data[cpu].asid_cache) | 31 | #define asid_cache(cpu) (cpu_data[cpu].asid_cache) |
31 | #define cpu_context(cpu, mm) ((mm)->context.id[cpu]) | 32 | #define cpu_context(cpu, mm) ((mm)->context.id[cpu]) |
32 | 33 | ||
@@ -38,7 +39,6 @@ | |||
38 | */ | 39 | */ |
39 | #define MMU_VPN_MASK 0xfffff000 | 40 | #define MMU_VPN_MASK 0xfffff000 |
40 | 41 | ||
41 | #ifdef CONFIG_MMU | ||
42 | #if defined(CONFIG_SUPERH32) | 42 | #if defined(CONFIG_SUPERH32) |
43 | #include "mmu_context_32.h" | 43 | #include "mmu_context_32.h" |
44 | #else | 44 | #else |
@@ -129,6 +129,8 @@ static inline void switch_mm(struct mm_struct *prev, | |||
129 | #define destroy_context(mm) do { } while (0) | 129 | #define destroy_context(mm) do { } while (0) |
130 | #define set_asid(asid) do { } while (0) | 130 | #define set_asid(asid) do { } while (0) |
131 | #define get_asid() (0) | 131 | #define get_asid() (0) |
132 | #define cpu_asid(cpu, mm) ({ (void)cpu; 0; }) | ||
133 | #define switch_and_save_asid(asid) (0) | ||
132 | #define set_TTB(pgd) do { } while (0) | 134 | #define set_TTB(pgd) do { } while (0) |
133 | #define get_TTB() (0) | 135 | #define get_TTB() (0) |
134 | #define activate_context(mm,cpu) do { } while (0) | 136 | #define activate_context(mm,cpu) do { } while (0) |
diff --git a/include/asm-sh/mmzone.h b/include/asm-sh/mmzone.h index 7969f381dff..2969253c404 100644 --- a/include/asm-sh/mmzone.h +++ b/include/asm-sh/mmzone.h | |||
@@ -41,6 +41,8 @@ void __init plat_mem_setup(void); | |||
41 | 41 | ||
42 | /* arch/sh/kernel/setup.c */ | 42 | /* arch/sh/kernel/setup.c */ |
43 | void __init setup_bootmem_allocator(unsigned long start_pfn); | 43 | void __init setup_bootmem_allocator(unsigned long start_pfn); |
44 | void __init __add_active_range(unsigned int nid, unsigned long start_pfn, | ||
45 | unsigned long end_pfn); | ||
44 | 46 | ||
45 | #endif /* __KERNEL__ */ | 47 | #endif /* __KERNEL__ */ |
46 | #endif /* __ASM_SH_MMZONE_H */ | 48 | #endif /* __ASM_SH_MMZONE_H */ |
diff --git a/include/asm-sh/mpc1211/dma.h b/include/asm-sh/mpc1211/dma.h deleted file mode 100644 index e506d1aaa0d..00000000000 --- a/include/asm-sh/mpc1211/dma.h +++ /dev/null | |||
@@ -1,303 +0,0 @@ | |||
1 | /* $Id: dma.h,v 1.7 1992/12/14 00:29:34 root Exp root $ | ||
2 | * linux/include/asm/dma.h: Defines for using and allocating dma channels. | ||
3 | * Written by Hennus Bergman, 1992. | ||
4 | * High DMA channel support & info by Hannu Savolainen | ||
5 | * and John Boyd, Nov. 1992. | ||
6 | */ | ||
7 | |||
8 | #ifndef _ASM_MPC1211_DMA_H | ||
9 | #define _ASM_MPC1211_DMA_H | ||
10 | |||
11 | #include <linux/spinlock.h> /* And spinlocks */ | ||
12 | #include <asm/io.h> /* need byte IO */ | ||
13 | #include <linux/delay.h> | ||
14 | |||
15 | |||
16 | #ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER | ||
17 | #define dma_outb outb_p | ||
18 | #else | ||
19 | #define dma_outb outb | ||
20 | #endif | ||
21 | |||
22 | #define dma_inb inb | ||
23 | |||
24 | /* | ||
25 | * NOTES about DMA transfers: | ||
26 | * | ||
27 | * controller 1: channels 0-3, byte operations, ports 00-1F | ||
28 | * controller 2: channels 4-7, word operations, ports C0-DF | ||
29 | * | ||
30 | * - ALL registers are 8 bits only, regardless of transfer size | ||
31 | * - channel 4 is not used - cascades 1 into 2. | ||
32 | * - channels 0-3 are byte - addresses/counts are for physical bytes | ||
33 | * - channels 5-7 are word - addresses/counts are for physical words | ||
34 | * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries | ||
35 | * - transfer count loaded to registers is 1 less than actual count | ||
36 | * - controller 2 offsets are all even (2x offsets for controller 1) | ||
37 | * - page registers for 5-7 don't use data bit 0, represent 128K pages | ||
38 | * - page registers for 0-3 use bit 0, represent 64K pages | ||
39 | * | ||
40 | * DMA transfers are limited to the lower 16MB of _physical_ memory. | ||
41 | * Note that addresses loaded into registers must be _physical_ addresses, | ||
42 | * not logical addresses (which may differ if paging is active). | ||
43 | * | ||
44 | * Address mapping for channels 0-3: | ||
45 | * | ||
46 | * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses) | ||
47 | * | ... | | ... | | ... | | ||
48 | * | ... | | ... | | ... | | ||
49 | * | ... | | ... | | ... | | ||
50 | * P7 ... P0 A7 ... A0 A7 ... A0 | ||
51 | * | Page | Addr MSB | Addr LSB | (DMA registers) | ||
52 | * | ||
53 | * Address mapping for channels 5-7: | ||
54 | * | ||
55 | * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses) | ||
56 | * | ... | \ \ ... \ \ \ ... \ \ | ||
57 | * | ... | \ \ ... \ \ \ ... \ (not used) | ||
58 | * | ... | \ \ ... \ \ \ ... \ | ||
59 | * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0 | ||
60 | * | Page | Addr MSB | Addr LSB | (DMA registers) | ||
61 | * | ||
62 | * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses | ||
63 | * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at | ||
64 | * the hardware level, so odd-byte transfers aren't possible). | ||
65 | * | ||
66 | * Transfer count (_not # bytes_) is limited to 64K, represented as actual | ||
67 | * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more, | ||
68 | * and up to 128K bytes may be transferred on channels 5-7 in one operation. | ||
69 | * | ||
70 | */ | ||
71 | |||
72 | #define MAX_DMA_CHANNELS 8 | ||
73 | |||
74 | /* The maximum address that we can perform a DMA transfer to on this platform */ | ||
75 | #define MAX_DMA_ADDRESS (PAGE_OFFSET+0x10000000) | ||
76 | |||
77 | /* 8237 DMA controllers */ | ||
78 | #define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ | ||
79 | #define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */ | ||
80 | |||
81 | /* DMA controller registers */ | ||
82 | #define DMA1_CMD_REG 0x08 /* command register (w) */ | ||
83 | #define DMA1_STAT_REG 0x08 /* status register (r) */ | ||
84 | #define DMA1_REQ_REG 0x09 /* request register (w) */ | ||
85 | #define DMA1_MASK_REG 0x0A /* single-channel mask (w) */ | ||
86 | #define DMA1_MODE_REG 0x0B /* mode register (w) */ | ||
87 | #define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */ | ||
88 | #define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */ | ||
89 | #define DMA1_RESET_REG 0x0D /* Master Clear (w) */ | ||
90 | #define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */ | ||
91 | #define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */ | ||
92 | |||
93 | #define DMA2_CMD_REG 0xD0 /* command register (w) */ | ||
94 | #define DMA2_STAT_REG 0xD0 /* status register (r) */ | ||
95 | #define DMA2_REQ_REG 0xD2 /* request register (w) */ | ||
96 | #define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */ | ||
97 | #define DMA2_MODE_REG 0xD6 /* mode register (w) */ | ||
98 | #define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */ | ||
99 | #define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */ | ||
100 | #define DMA2_RESET_REG 0xDA /* Master Clear (w) */ | ||
101 | #define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */ | ||
102 | #define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */ | ||
103 | |||
104 | #define DMA_ADDR_0 0x00 /* DMA address registers */ | ||
105 | #define DMA_ADDR_1 0x02 | ||
106 | #define DMA_ADDR_2 0x04 | ||
107 | #define DMA_ADDR_3 0x06 | ||
108 | #define DMA_ADDR_4 0xC0 | ||
109 | #define DMA_ADDR_5 0xC4 | ||
110 | #define DMA_ADDR_6 0xC8 | ||
111 | #define DMA_ADDR_7 0xCC | ||
112 | |||
113 | #define DMA_CNT_0 0x01 /* DMA count registers */ | ||
114 | #define DMA_CNT_1 0x03 | ||
115 | #define DMA_CNT_2 0x05 | ||
116 | #define DMA_CNT_3 0x07 | ||
117 | #define DMA_CNT_4 0xC2 | ||
118 | #define DMA_CNT_5 0xC6 | ||
119 | #define DMA_CNT_6 0xCA | ||
120 | #define DMA_CNT_7 0xCE | ||
121 | |||
122 | #define DMA_PAGE_0 0x87 /* DMA page registers */ | ||
123 | #define DMA_PAGE_1 0x83 | ||
124 | #define DMA_PAGE_2 0x81 | ||
125 | #define DMA_PAGE_3 0x82 | ||
126 | #define DMA_PAGE_5 0x8B | ||
127 | #define DMA_PAGE_6 0x89 | ||
128 | #define DMA_PAGE_7 0x8A | ||
129 | |||
130 | #define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */ | ||
131 | #define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ | ||
132 | #define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ | ||
133 | |||
134 | #define DMA_AUTOINIT 0x10 | ||
135 | |||
136 | |||
137 | extern spinlock_t dma_spin_lock; | ||
138 | |||
139 | static __inline__ unsigned long claim_dma_lock(void) | ||
140 | { | ||
141 | unsigned long flags; | ||
142 | spin_lock_irqsave(&dma_spin_lock, flags); | ||
143 | return flags; | ||
144 | } | ||
145 | |||
146 | static __inline__ void release_dma_lock(unsigned long flags) | ||
147 | { | ||
148 | spin_unlock_irqrestore(&dma_spin_lock, flags); | ||
149 | } | ||
150 | |||
151 | /* enable/disable a specific DMA channel */ | ||
152 | static __inline__ void enable_dma(unsigned int dmanr) | ||
153 | { | ||
154 | if (dmanr<=3) | ||
155 | dma_outb(dmanr, DMA1_MASK_REG); | ||
156 | else | ||
157 | dma_outb(dmanr & 3, DMA2_MASK_REG); | ||
158 | } | ||
159 | |||
160 | static __inline__ void disable_dma(unsigned int dmanr) | ||
161 | { | ||
162 | if (dmanr<=3) | ||
163 | dma_outb(dmanr | 4, DMA1_MASK_REG); | ||
164 | else | ||
165 | dma_outb((dmanr & 3) | 4, DMA2_MASK_REG); | ||
166 | } | ||
167 | |||
168 | /* Clear the 'DMA Pointer Flip Flop'. | ||
169 | * Write 0 for LSB/MSB, 1 for MSB/LSB access. | ||
170 | * Use this once to initialize the FF to a known state. | ||
171 | * After that, keep track of it. :-) | ||
172 | * --- In order to do that, the DMA routines below should --- | ||
173 | * --- only be used while holding the DMA lock ! --- | ||
174 | */ | ||
175 | static __inline__ void clear_dma_ff(unsigned int dmanr) | ||
176 | { | ||
177 | if (dmanr<=3) | ||
178 | dma_outb(0, DMA1_CLEAR_FF_REG); | ||
179 | else | ||
180 | dma_outb(0, DMA2_CLEAR_FF_REG); | ||
181 | } | ||
182 | |||
183 | /* set mode (above) for a specific DMA channel */ | ||
184 | static __inline__ void set_dma_mode(unsigned int dmanr, char mode) | ||
185 | { | ||
186 | if (dmanr<=3) | ||
187 | dma_outb(mode | dmanr, DMA1_MODE_REG); | ||
188 | else | ||
189 | dma_outb(mode | (dmanr&3), DMA2_MODE_REG); | ||
190 | } | ||
191 | |||
192 | /* Set only the page register bits of the transfer address. | ||
193 | * This is used for successive transfers when we know the contents of | ||
194 | * the lower 16 bits of the DMA current address register, but a 64k boundary | ||
195 | * may have been crossed. | ||
196 | */ | ||
197 | static __inline__ void set_dma_page(unsigned int dmanr, unsigned int pagenr) | ||
198 | { | ||
199 | switch(dmanr) { | ||
200 | case 0: | ||
201 | dma_outb( pagenr & 0xff, DMA_PAGE_0); | ||
202 | dma_outb((pagenr >> 8) & 0xff, DMA_PAGE_0 + 0x400); | ||
203 | break; | ||
204 | case 1: | ||
205 | dma_outb( pagenr & 0xff, DMA_PAGE_1); | ||
206 | dma_outb((pagenr >> 8) & 0xff, DMA_PAGE_1 + 0x400); | ||
207 | break; | ||
208 | case 2: | ||
209 | dma_outb( pagenr & 0xff, DMA_PAGE_2); | ||
210 | dma_outb((pagenr >> 8) & 0xff, DMA_PAGE_2 + 0x400); | ||
211 | break; | ||
212 | case 3: | ||
213 | dma_outb( pagenr & 0xff, DMA_PAGE_3); | ||
214 | dma_outb((pagenr >> 8) & 0xff, DMA_PAGE_3 + 0x400); | ||
215 | break; | ||
216 | case 5: | ||
217 | dma_outb( pagenr & 0xfe, DMA_PAGE_5); | ||
218 | dma_outb((pagenr >> 8) & 0xff, DMA_PAGE_5 + 0x400); | ||
219 | break; | ||
220 | case 6: | ||
221 | dma_outb( pagenr & 0xfe, DMA_PAGE_6); | ||
222 | dma_outb((pagenr >> 8) & 0xff, DMA_PAGE_6 + 0x400); | ||
223 | break; | ||
224 | case 7: | ||
225 | dma_outb( pagenr & 0xfe, DMA_PAGE_7); | ||
226 | dma_outb((pagenr >> 8) & 0xff, DMA_PAGE_7 + 0x400); | ||
227 | break; | ||
228 | } | ||
229 | } | ||
230 | |||
231 | |||
232 | /* Set transfer address & page bits for specific DMA channel. | ||
233 | * Assumes dma flipflop is clear. | ||
234 | */ | ||
235 | static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a) | ||
236 | { | ||
237 | set_dma_page(dmanr, a>>16); | ||
238 | if (dmanr <= 3) { | ||
239 | dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); | ||
240 | dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); | ||
241 | } else { | ||
242 | dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); | ||
243 | dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | |||
248 | /* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for | ||
249 | * a specific DMA channel. | ||
250 | * You must ensure the parameters are valid. | ||
251 | * NOTE: from a manual: "the number of transfers is one more | ||
252 | * than the initial word count"! This is taken into account. | ||
253 | * Assumes dma flip-flop is clear. | ||
254 | * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7. | ||
255 | */ | ||
256 | static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) | ||
257 | { | ||
258 | count--; | ||
259 | if (dmanr <= 3) { | ||
260 | dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); | ||
261 | dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); | ||
262 | } else { | ||
263 | dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); | ||
264 | dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | |||
269 | /* Get DMA residue count. After a DMA transfer, this | ||
270 | * should return zero. Reading this while a DMA transfer is | ||
271 | * still in progress will return unpredictable results. | ||
272 | * If called before the channel has been used, it may return 1. | ||
273 | * Otherwise, it returns the number of _bytes_ left to transfer. | ||
274 | * | ||
275 | * Assumes DMA flip-flop is clear. | ||
276 | */ | ||
277 | static __inline__ int get_dma_residue(unsigned int dmanr) | ||
278 | { | ||
279 | unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE | ||
280 | : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE; | ||
281 | |||
282 | /* using short to get 16-bit wrap around */ | ||
283 | unsigned short count; | ||
284 | |||
285 | count = 1 + dma_inb(io_port); | ||
286 | count += dma_inb(io_port) << 8; | ||
287 | return (dmanr<=3)? count : (count<<1); | ||
288 | } | ||
289 | |||
290 | |||
291 | /* These are in kernel/dma.c: */ | ||
292 | extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ | ||
293 | extern void free_dma(unsigned int dmanr); /* release it again */ | ||
294 | |||
295 | /* From PCI */ | ||
296 | |||
297 | #ifdef CONFIG_PCI | ||
298 | extern int isa_dma_bridge_buggy; | ||
299 | #else | ||
300 | #define isa_dma_bridge_buggy (0) | ||
301 | #endif | ||
302 | |||
303 | #endif /* _ASM_MPC1211_DMA_H */ | ||
diff --git a/include/asm-sh/mpc1211/io.h b/include/asm-sh/mpc1211/io.h deleted file mode 100644 index 6298370bec2..00000000000 --- a/include/asm-sh/mpc1211/io.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/mpc1211/io.h | ||
3 | * | ||
4 | * Copyright 2001 Saito.K & Jeanne | ||
5 | * | ||
6 | * IO functions for an Interface MPC-1211 | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_SH_IO_MPC1211_H | ||
10 | #define _ASM_SH_IO_MPC1211_H | ||
11 | |||
12 | #include <linux/time.h> | ||
13 | |||
14 | extern int mpc1211_irq_demux(int irq); | ||
15 | |||
16 | extern void init_mpc1211_IRQ(void); | ||
17 | extern void heartbeat_mpc1211(void); | ||
18 | |||
19 | extern void mpc1211_rtc_gettimeofday(struct timeval *tv); | ||
20 | extern int mpc1211_rtc_settimeofday(const struct timeval *tv); | ||
21 | |||
22 | #endif /* _ASM_SH_IO_MPC1211_H */ | ||
diff --git a/include/asm-sh/mpc1211/keyboard.h b/include/asm-sh/mpc1211/keyboard.h deleted file mode 100644 index 9020feee7b4..00000000000 --- a/include/asm-sh/mpc1211/keyboard.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* | ||
2 | * MPC1211 specific keybord definitions | ||
3 | * Taken from the old asm-i386/keybord.h for PC/AT-style definitions | ||
4 | * created 3 Nov 1996 by Geert Uytterhoeven. | ||
5 | */ | ||
6 | |||
7 | #ifdef __KERNEL__ | ||
8 | |||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/ioport.h> | ||
11 | #include <linux/kd.h> | ||
12 | #include <linux/pm.h> | ||
13 | #include <asm/io.h> | ||
14 | |||
15 | #define KEYBOARD_IRQ 1 | ||
16 | #define DISABLE_KBD_DURING_INTERRUPTS 0 | ||
17 | |||
18 | extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); | ||
19 | extern int pckbd_getkeycode(unsigned int scancode); | ||
20 | extern int pckbd_translate(unsigned char scancode, unsigned char *keycode, | ||
21 | char raw_mode); | ||
22 | extern char pckbd_unexpected_up(unsigned char keycode); | ||
23 | extern void pckbd_leds(unsigned char leds); | ||
24 | extern void pckbd_init_hw(void); | ||
25 | extern int pckbd_pm_resume(struct pm_dev *, pm_request_t, void *); | ||
26 | extern pm_callback pm_kbd_request_override; | ||
27 | |||
28 | #define kbd_setkeycode pckbd_setkeycode | ||
29 | #define kbd_getkeycode pckbd_getkeycode | ||
30 | #define kbd_translate pckbd_translate | ||
31 | #define kbd_unexpected_up pckbd_unexpected_up | ||
32 | #define kbd_leds pckbd_leds | ||
33 | #define kbd_init_hw pckbd_init_hw | ||
34 | |||
35 | /* resource allocation */ | ||
36 | #define kbd_request_region() | ||
37 | #define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, \ | ||
38 | "keyboard", NULL) | ||
39 | |||
40 | /* How to access the keyboard macros on this platform. */ | ||
41 | #define kbd_read_input() inb(KBD_DATA_REG) | ||
42 | #define kbd_read_status() inb(KBD_STATUS_REG) | ||
43 | #define kbd_write_output(val) outb(val, KBD_DATA_REG) | ||
44 | #define kbd_write_command(val) outb(val, KBD_CNTL_REG) | ||
45 | |||
46 | /* Some stoneage hardware needs delays after some operations. */ | ||
47 | #define kbd_pause() do { } while(0) | ||
48 | |||
49 | /* | ||
50 | * Machine specific bits for the PS/2 driver | ||
51 | */ | ||
52 | |||
53 | #define AUX_IRQ 12 | ||
54 | |||
55 | #define aux_request_irq(hand, dev_id) \ | ||
56 | request_irq(AUX_IRQ, hand, IRQF_SHARED, "PS2 Mouse", dev_id) | ||
57 | |||
58 | #define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id) | ||
59 | |||
60 | #endif /* __KERNEL__ */ | ||
diff --git a/include/asm-sh/mpc1211/m1543c.h b/include/asm-sh/mpc1211/m1543c.h deleted file mode 100644 index c95d13236c3..00000000000 --- a/include/asm-sh/mpc1211/m1543c.h +++ /dev/null | |||
@@ -1,200 +0,0 @@ | |||
1 | #ifndef __ASM_SH_M1543C_H | ||
2 | #define __ASM_SH_M1543C_H | ||
3 | |||
4 | /* | ||
5 | * linux/include/asm-sh/m1543c.h | ||
6 | * Copyright (C) 2001 Nobuhiro Sakawa | ||
7 | * M1543C:PCI-ISA Bus Bridge with Super IO Chip support | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/asm-sh/smc37c93x.h | ||
12 | * | ||
13 | * Copyright (C) 2000 Kazumoto Kojima | ||
14 | * | ||
15 | * SMSC 37C93x Super IO Chip support | ||
16 | */ | ||
17 | |||
18 | /* Default base I/O address */ | ||
19 | #define FDC_PRIMARY_BASE 0x3f0 | ||
20 | #define IDE1_PRIMARY_BASE 0x1f0 | ||
21 | #define IDE1_SECONDARY_BASE 0x170 | ||
22 | #define PARPORT_PRIMARY_BASE 0x378 | ||
23 | #define COM1_PRIMARY_BASE 0x2f8 | ||
24 | #define COM2_PRIMARY_BASE 0x3f8 | ||
25 | #define COM3_PRIMARY_BASE 0x3e8 | ||
26 | #define RTC_PRIMARY_BASE 0x070 | ||
27 | #define KBC_PRIMARY_BASE 0x060 | ||
28 | #define AUXIO_PRIMARY_BASE 0x000 /* XXX */ | ||
29 | #define I8259_M_CR 0x20 | ||
30 | #define I8259_M_MR 0x21 | ||
31 | #define I8259_S_CR 0xa0 | ||
32 | #define I8259_S_MR 0xa1 | ||
33 | |||
34 | /* Logical device number */ | ||
35 | #define LDN_FDC 0 | ||
36 | #define LDN_IDE1 1 | ||
37 | #define LDN_IDE2 2 | ||
38 | #define LDN_PARPORT 3 | ||
39 | #define LDN_COM1 4 | ||
40 | #define LDN_COM2 5 | ||
41 | #define LDN_COM3 11 | ||
42 | #define LDN_RTC 6 | ||
43 | #define LDN_KBC 7 | ||
44 | |||
45 | /* Configuration port and key */ | ||
46 | #define CONFIG_PORT 0x3f0 | ||
47 | #define INDEX_PORT CONFIG_PORT | ||
48 | #define DATA_PORT 0x3f1 | ||
49 | #define CONFIG_ENTER1 0x51 | ||
50 | #define CONFIG_ENTER2 0x23 | ||
51 | #define CONFIG_EXIT 0xbb | ||
52 | |||
53 | /* Configuration index */ | ||
54 | #define CURRENT_LDN_INDEX 0x07 | ||
55 | #define POWER_CONTROL_INDEX 0x22 | ||
56 | #define ACTIVATE_INDEX 0x30 | ||
57 | #define IO_BASE_HI_INDEX 0x60 | ||
58 | #define IO_BASE_LO_INDEX 0x61 | ||
59 | #define IRQ_SELECT_INDEX 0x70 | ||
60 | #define PS2_IRQ_INDEX 0x72 | ||
61 | #define DMA_SELECT_INDEX 0x74 | ||
62 | |||
63 | /* UART stuff. Only for debugging. */ | ||
64 | /* UART Register */ | ||
65 | |||
66 | #define UART_RBR 0x0 /* Receiver Buffer Register (Read Only) */ | ||
67 | #define UART_THR 0x0 /* Transmitter Holding Register (Write Only) */ | ||
68 | #define UART_IER 0x2 /* Interrupt Enable Register */ | ||
69 | #define UART_IIR 0x4 /* Interrupt Ident Register (Read Only) */ | ||
70 | #define UART_FCR 0x4 /* FIFO Control Register (Write Only) */ | ||
71 | #define UART_LCR 0x6 /* Line Control Register */ | ||
72 | #define UART_MCR 0x8 /* MODEM Control Register */ | ||
73 | #define UART_LSR 0xa /* Line Status Register */ | ||
74 | #define UART_MSR 0xc /* MODEM Status Register */ | ||
75 | #define UART_SCR 0xe /* Scratch Register */ | ||
76 | #define UART_DLL 0x0 /* Divisor Latch (LS) */ | ||
77 | #define UART_DLM 0x2 /* Divisor Latch (MS) */ | ||
78 | |||
79 | #ifndef __ASSEMBLY__ | ||
80 | typedef struct uart_reg { | ||
81 | volatile __u16 rbr; | ||
82 | volatile __u16 ier; | ||
83 | volatile __u16 iir; | ||
84 | volatile __u16 lcr; | ||
85 | volatile __u16 mcr; | ||
86 | volatile __u16 lsr; | ||
87 | volatile __u16 msr; | ||
88 | volatile __u16 scr; | ||
89 | } uart_reg; | ||
90 | #endif /* ! __ASSEMBLY__ */ | ||
91 | |||
92 | /* Alias for Write Only Register */ | ||
93 | |||
94 | #define thr rbr | ||
95 | #define tcr iir | ||
96 | |||
97 | /* Alias for Divisor Latch Register */ | ||
98 | |||
99 | #define dll rbr | ||
100 | #define dlm ier | ||
101 | #define fcr iir | ||
102 | |||
103 | /* Interrupt Enable Register */ | ||
104 | |||
105 | #define IER_ERDAI 0x0100 /* Enable Received Data Available Interrupt */ | ||
106 | #define IER_ETHREI 0x0200 /* Enable Transmitter Holding Register Empty Interrupt */ | ||
107 | #define IER_ELSI 0x0400 /* Enable Receiver Line Status Interrupt */ | ||
108 | #define IER_EMSI 0x0800 /* Enable MODEM Status Interrupt */ | ||
109 | |||
110 | /* Interrupt Ident Register */ | ||
111 | |||
112 | #define IIR_IP 0x0100 /* "0" if Interrupt Pending */ | ||
113 | #define IIR_IIB0 0x0200 /* Interrupt ID Bit 0 */ | ||
114 | #define IIR_IIB1 0x0400 /* Interrupt ID Bit 1 */ | ||
115 | #define IIR_IIB2 0x0800 /* Interrupt ID Bit 2 */ | ||
116 | #define IIR_FIFO 0xc000 /* FIFOs enabled */ | ||
117 | |||
118 | /* FIFO Control Register */ | ||
119 | |||
120 | #define FCR_FEN 0x0100 /* FIFO enable */ | ||
121 | #define FCR_RFRES 0x0200 /* Receiver FIFO reset */ | ||
122 | #define FCR_TFRES 0x0400 /* Transmitter FIFO reset */ | ||
123 | #define FCR_DMA 0x0800 /* DMA mode select */ | ||
124 | #define FCR_RTL 0x4000 /* Receiver triger (LSB) */ | ||
125 | #define FCR_RTM 0x8000 /* Receiver triger (MSB) */ | ||
126 | |||
127 | /* Line Control Register */ | ||
128 | |||
129 | #define LCR_WLS0 0x0100 /* Word Length Select Bit 0 */ | ||
130 | #define LCR_WLS1 0x0200 /* Word Length Select Bit 1 */ | ||
131 | #define LCR_STB 0x0400 /* Number of Stop Bits */ | ||
132 | #define LCR_PEN 0x0800 /* Parity Enable */ | ||
133 | #define LCR_EPS 0x1000 /* Even Parity Select */ | ||
134 | #define LCR_SP 0x2000 /* Stick Parity */ | ||
135 | #define LCR_SB 0x4000 /* Set Break */ | ||
136 | #define LCR_DLAB 0x8000 /* Divisor Latch Access Bit */ | ||
137 | |||
138 | /* MODEM Control Register */ | ||
139 | |||
140 | #define MCR_DTR 0x0100 /* Data Terminal Ready */ | ||
141 | #define MCR_RTS 0x0200 /* Request to Send */ | ||
142 | #define MCR_OUT1 0x0400 /* Out 1 */ | ||
143 | #define MCR_IRQEN 0x0800 /* IRQ Enable */ | ||
144 | #define MCR_LOOP 0x1000 /* Loop */ | ||
145 | |||
146 | /* Line Status Register */ | ||
147 | |||
148 | #define LSR_DR 0x0100 /* Data Ready */ | ||
149 | #define LSR_OE 0x0200 /* Overrun Error */ | ||
150 | #define LSR_PE 0x0400 /* Parity Error */ | ||
151 | #define LSR_FE 0x0800 /* Framing Error */ | ||
152 | #define LSR_BI 0x1000 /* Break Interrupt */ | ||
153 | #define LSR_THRE 0x2000 /* Transmitter Holding Register Empty */ | ||
154 | #define LSR_TEMT 0x4000 /* Transmitter Empty */ | ||
155 | #define LSR_FIFOE 0x8000 /* Receiver FIFO error */ | ||
156 | |||
157 | /* MODEM Status Register */ | ||
158 | |||
159 | #define MSR_DCTS 0x0100 /* Delta Clear to Send */ | ||
160 | #define MSR_DDSR 0x0200 /* Delta Data Set Ready */ | ||
161 | #define MSR_TERI 0x0400 /* Trailing Edge Ring Indicator */ | ||
162 | #define MSR_DDCD 0x0800 /* Delta Data Carrier Detect */ | ||
163 | #define MSR_CTS 0x1000 /* Clear to Send */ | ||
164 | #define MSR_DSR 0x2000 /* Data Set Ready */ | ||
165 | #define MSR_RI 0x4000 /* Ring Indicator */ | ||
166 | #define MSR_DCD 0x8000 /* Data Carrier Detect */ | ||
167 | |||
168 | /* Baud Rate Divisor */ | ||
169 | |||
170 | #define UART_CLK (1843200) /* 1.8432 MHz */ | ||
171 | #define UART_BAUD(x) (UART_CLK / (16 * (x))) | ||
172 | |||
173 | /* RTC register definition */ | ||
174 | #define RTC_SECONDS 0 | ||
175 | #define RTC_SECONDS_ALARM 1 | ||
176 | #define RTC_MINUTES 2 | ||
177 | #define RTC_MINUTES_ALARM 3 | ||
178 | #define RTC_HOURS 4 | ||
179 | #define RTC_HOURS_ALARM 5 | ||
180 | #define RTC_DAY_OF_WEEK 6 | ||
181 | #define RTC_DAY_OF_MONTH 7 | ||
182 | #define RTC_MONTH 8 | ||
183 | #define RTC_YEAR 9 | ||
184 | #define RTC_FREQ_SELECT 10 | ||
185 | # define RTC_UIP 0x80 | ||
186 | # define RTC_DIV_CTL 0x70 | ||
187 | /* This RTC can work under 32.768KHz clock only. */ | ||
188 | # define RTC_OSC_ENABLE 0x20 | ||
189 | # define RTC_OSC_DISABLE 0x00 | ||
190 | #define RTC_CONTROL 11 | ||
191 | # define RTC_SET 0x80 | ||
192 | # define RTC_PIE 0x40 | ||
193 | # define RTC_AIE 0x20 | ||
194 | # define RTC_UIE 0x10 | ||
195 | # define RTC_SQWE 0x08 | ||
196 | # define RTC_DM_BINARY 0x04 | ||
197 | # define RTC_24H 0x02 | ||
198 | # define RTC_DST_EN 0x01 | ||
199 | |||
200 | #endif /* __ASM_SH_M1543C_H */ | ||
diff --git a/include/asm-sh/mpc1211/mc146818rtc.h b/include/asm-sh/mpc1211/mc146818rtc.h deleted file mode 100644 index e245f2a3cd7..00000000000 --- a/include/asm-sh/mpc1211/mc146818rtc.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | /* | ||
2 | * MPC1211 uses PC/AT style RTC definitions. | ||
3 | */ | ||
4 | #include <asm-x86/mc146818rtc_32.h> | ||
5 | |||
6 | |||
diff --git a/include/asm-sh/mpc1211/mpc1211.h b/include/asm-sh/mpc1211/mpc1211.h deleted file mode 100644 index fa456c3e4e0..00000000000 --- a/include/asm-sh/mpc1211/mpc1211.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #ifndef __ASM_SH_MPC1211_H | ||
2 | #define __ASM_SH_MPC1211_H | ||
3 | |||
4 | /* | ||
5 | * linux/include/asm-sh/mpc1211.h | ||
6 | * | ||
7 | * Copyright (C) 2001 Saito.K & Jeanne | ||
8 | * | ||
9 | * Interface MPC-1211 support | ||
10 | */ | ||
11 | |||
12 | #define PA_PCI_IO (0xa4000000) /* PCI I/O space */ | ||
13 | #define PA_PCI_MEM (0xb0000000) /* PCI MEM space */ | ||
14 | |||
15 | #define PCIPAR (0xa4000cf8) /* PCI Config address */ | ||
16 | #define PCIPDR (0xa4000cfc) /* PCI Config data */ | ||
17 | |||
18 | #endif /* __ASM_SH_MPC1211_H */ | ||
diff --git a/include/asm-sh/mpc1211/pci.h b/include/asm-sh/mpc1211/pci.h deleted file mode 100644 index d9162c5ed76..00000000000 --- a/include/asm-sh/mpc1211/pci.h +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | /* | ||
2 | * Low-Level PCI Support for MPC-1211 | ||
3 | * | ||
4 | * (c) 2002 Saito.K & Jeanne | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #ifndef _PCI_MPC1211_H_ | ||
9 | #define _PCI_MPC1211_H_ | ||
10 | |||
11 | #include <linux/pci.h> | ||
12 | |||
13 | /* set debug level 4=verbose...1=terse */ | ||
14 | //#define DEBUG_PCI 3 | ||
15 | #undef DEBUG_PCI | ||
16 | |||
17 | #ifdef DEBUG_PCI | ||
18 | #define PCIDBG(n, x...) { if(DEBUG_PCI>=n) printk(x); } | ||
19 | #else | ||
20 | #define PCIDBG(n, x...) | ||
21 | #endif | ||
22 | |||
23 | /* startup values */ | ||
24 | #define PCI_PROBE_BIOS 1 | ||
25 | #define PCI_PROBE_CONF1 2 | ||
26 | #define PCI_PROBE_CONF2 4 | ||
27 | #define PCI_NO_CHECKS 0x400 | ||
28 | #define PCI_ASSIGN_ROMS 0x1000 | ||
29 | #define PCI_BIOS_IRQ_SCAN 0x2000 | ||
30 | |||
31 | /* MPC-1211 Specific Values */ | ||
32 | #define PCIPAR (0xa4000cf8) /* PCI Config address */ | ||
33 | #define PCIPDR (0xa4000cfc) /* PCI Config data */ | ||
34 | |||
35 | #define PA_PCI_IO (0xa4000000) /* PCI I/O space */ | ||
36 | #define PA_PCI_MEM (0xb0000000) /* PCI MEM space */ | ||
37 | |||
38 | #endif /* _PCI_MPC1211_H_ */ | ||
diff --git a/include/asm-sh/r7780rp.h b/include/asm-sh/r7780rp.h index a33838f23a6..306f7359f7d 100644 --- a/include/asm-sh/r7780rp.h +++ b/include/asm-sh/r7780rp.h | |||
@@ -193,8 +193,6 @@ | |||
193 | #define IRQ_SCIF0 (HL_FPGA_IRQ_BASE + 15) | 193 | #define IRQ_SCIF0 (HL_FPGA_IRQ_BASE + 15) |
194 | #define IRQ_SCIF1 (HL_FPGA_IRQ_BASE + 16) | 194 | #define IRQ_SCIF1 (HL_FPGA_IRQ_BASE + 16) |
195 | 195 | ||
196 | unsigned char *highlander_init_irq_r7780mp(void); | 196 | unsigned char *highlander_plat_irq_setup(void); |
197 | unsigned char *highlander_init_irq_r7780rp(void); | ||
198 | unsigned char *highlander_init_irq_r7785rp(void); | ||
199 | 197 | ||
200 | #endif /* __ASM_SH_RENESAS_R7780RP */ | 198 | #endif /* __ASM_SH_RENESAS_R7780RP */ |
diff --git a/include/asm-sh/tlb_64.h b/include/asm-sh/tlb_64.h index 0308e05fc57..0a96f3af69e 100644 --- a/include/asm-sh/tlb_64.h +++ b/include/asm-sh/tlb_64.h | |||
@@ -56,6 +56,7 @@ static inline void __flush_tlb_slot(unsigned long long slot) | |||
56 | __asm__ __volatile__ ("putcfg %0, 0, r63\n" : : "r" (slot)); | 56 | __asm__ __volatile__ ("putcfg %0, 0, r63\n" : : "r" (slot)); |
57 | } | 57 | } |
58 | 58 | ||
59 | #ifdef CONFIG_MMU | ||
59 | /* arch/sh64/mm/tlb.c */ | 60 | /* arch/sh64/mm/tlb.c */ |
60 | int sh64_tlb_init(void); | 61 | int sh64_tlb_init(void); |
61 | unsigned long long sh64_next_free_dtlb_entry(void); | 62 | unsigned long long sh64_next_free_dtlb_entry(void); |
@@ -64,6 +65,13 @@ int sh64_put_wired_dtlb_entry(unsigned long long entry); | |||
64 | void sh64_setup_tlb_slot(unsigned long long config_addr, unsigned long eaddr, | 65 | void sh64_setup_tlb_slot(unsigned long long config_addr, unsigned long eaddr, |
65 | unsigned long asid, unsigned long paddr); | 66 | unsigned long asid, unsigned long paddr); |
66 | void sh64_teardown_tlb_slot(unsigned long long config_addr); | 67 | void sh64_teardown_tlb_slot(unsigned long long config_addr); |
67 | 68 | #else | |
69 | #define sh64_tlb_init() do { } while (0) | ||
70 | #define sh64_next_free_dtlb_entry() (0) | ||
71 | #define sh64_get_wired_dtlb_entry() (0) | ||
72 | #define sh64_put_wired_dtlb_entry(entry) do { } while (0) | ||
73 | #define sh64_setup_tlb_slot(conf, virt, asid, phys) do { } while (0) | ||
74 | #define sh64_teardown_tlb_slot(addr) do { } while (0) | ||
75 | #endif /* CONFIG_MMU */ | ||
68 | #endif /* __ASSEMBLY__ */ | 76 | #endif /* __ASSEMBLY__ */ |
69 | #endif /* __ASM_SH_TLB_64_H */ | 77 | #endif /* __ASM_SH_TLB_64_H */ |
diff --git a/include/asm-sh/topology.h b/include/asm-sh/topology.h index 34cdb28e8f4..95f0085e098 100644 --- a/include/asm-sh/topology.h +++ b/include/asm-sh/topology.h | |||
@@ -29,6 +29,17 @@ | |||
29 | .nr_balance_failed = 0, \ | 29 | .nr_balance_failed = 0, \ |
30 | } | 30 | } |
31 | 31 | ||
32 | #define cpu_to_node(cpu) ((void)(cpu),0) | ||
33 | #define parent_node(node) ((void)(node),0) | ||
34 | |||
35 | #define node_to_cpumask(node) ((void)node, cpu_online_map) | ||
36 | #define node_to_first_cpu(node) ((void)(node),0) | ||
37 | |||
38 | #define pcibus_to_node(bus) ((void)(bus), -1) | ||
39 | #define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \ | ||
40 | CPU_MASK_ALL : \ | ||
41 | node_to_cpumask(pcibus_to_node(bus)) \ | ||
42 | ) | ||
32 | #endif | 43 | #endif |
33 | 44 | ||
34 | #include <asm-generic/topology.h> | 45 | #include <asm-generic/topology.h> |
diff --git a/include/asm-sh/uaccess_64.h b/include/asm-sh/uaccess_64.h index f956b7b316c..a9b68d09484 100644 --- a/include/asm-sh/uaccess_64.h +++ b/include/asm-sh/uaccess_64.h | |||
@@ -274,7 +274,9 @@ struct exception_table_entry | |||
274 | unsigned long insn, fixup; | 274 | unsigned long insn, fixup; |
275 | }; | 275 | }; |
276 | 276 | ||
277 | #ifdef CONFIG_MMU | ||
277 | #define ARCH_HAS_SEARCH_EXTABLE | 278 | #define ARCH_HAS_SEARCH_EXTABLE |
279 | #endif | ||
278 | 280 | ||
279 | /* Returns 0 if exception not found and fixup.unit otherwise. */ | 281 | /* Returns 0 if exception not found and fixup.unit otherwise. */ |
280 | extern unsigned long search_exception_table(unsigned long addr); | 282 | extern unsigned long search_exception_table(unsigned long addr); |
diff --git a/include/asm-x86/bitops.h b/include/asm-x86/bitops.h index b81a4d4d333..ee4b3ead6a4 100644 --- a/include/asm-x86/bitops.h +++ b/include/asm-x86/bitops.h | |||
@@ -23,13 +23,10 @@ | |||
23 | #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) | 23 | #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) |
24 | /* Technically wrong, but this avoids compilation errors on some gcc | 24 | /* Technically wrong, but this avoids compilation errors on some gcc |
25 | versions. */ | 25 | versions. */ |
26 | #define ADDR "=m" (*(volatile long *)addr) | 26 | #define ADDR "=m" (*(volatile long *) addr) |
27 | #define BIT_ADDR "=m" (((volatile int *)addr)[nr >> 5]) | ||
28 | #else | 27 | #else |
29 | #define ADDR "+m" (*(volatile long *) addr) | 28 | #define ADDR "+m" (*(volatile long *) addr) |
30 | #define BIT_ADDR "+m" (((volatile int *)addr)[nr >> 5]) | ||
31 | #endif | 29 | #endif |
32 | #define BASE_ADDR "m" (*(volatile int *)addr) | ||
33 | 30 | ||
34 | /** | 31 | /** |
35 | * set_bit - Atomically set a bit in memory | 32 | * set_bit - Atomically set a bit in memory |
@@ -77,7 +74,7 @@ static inline void __set_bit(int nr, volatile void *addr) | |||
77 | */ | 74 | */ |
78 | static inline void clear_bit(int nr, volatile void *addr) | 75 | static inline void clear_bit(int nr, volatile void *addr) |
79 | { | 76 | { |
80 | asm volatile(LOCK_PREFIX "btr %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR); | 77 | asm volatile(LOCK_PREFIX "btr %1,%0" : ADDR : "Ir" (nr)); |
81 | } | 78 | } |
82 | 79 | ||
83 | /* | 80 | /* |
@@ -96,7 +93,7 @@ static inline void clear_bit_unlock(unsigned nr, volatile void *addr) | |||
96 | 93 | ||
97 | static inline void __clear_bit(int nr, volatile void *addr) | 94 | static inline void __clear_bit(int nr, volatile void *addr) |
98 | { | 95 | { |
99 | asm volatile("btr %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR); | 96 | asm volatile("btr %1,%0" : ADDR : "Ir" (nr)); |
100 | } | 97 | } |
101 | 98 | ||
102 | /* | 99 | /* |
@@ -131,7 +128,7 @@ static inline void __clear_bit_unlock(unsigned nr, volatile void *addr) | |||
131 | */ | 128 | */ |
132 | static inline void __change_bit(int nr, volatile void *addr) | 129 | static inline void __change_bit(int nr, volatile void *addr) |
133 | { | 130 | { |
134 | asm volatile("btc %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR); | 131 | asm volatile("btc %1,%0" : ADDR : "Ir" (nr)); |
135 | } | 132 | } |
136 | 133 | ||
137 | /** | 134 | /** |
@@ -145,7 +142,7 @@ static inline void __change_bit(int nr, volatile void *addr) | |||
145 | */ | 142 | */ |
146 | static inline void change_bit(int nr, volatile void *addr) | 143 | static inline void change_bit(int nr, volatile void *addr) |
147 | { | 144 | { |
148 | asm volatile(LOCK_PREFIX "btc %1,%2" : BIT_ADDR : "Ir" (nr), BASE_ADDR); | 145 | asm volatile(LOCK_PREFIX "btc %1,%0" : ADDR : "Ir" (nr)); |
149 | } | 146 | } |
150 | 147 | ||
151 | /** | 148 | /** |
@@ -191,9 +188,10 @@ static inline int __test_and_set_bit(int nr, volatile void *addr) | |||
191 | { | 188 | { |
192 | int oldbit; | 189 | int oldbit; |
193 | 190 | ||
194 | asm volatile("bts %2,%3\n\t" | 191 | asm("bts %2,%1\n\t" |
195 | "sbb %0,%0" | 192 | "sbb %0,%0" |
196 | : "=r" (oldbit), BIT_ADDR : "Ir" (nr), BASE_ADDR); | 193 | : "=r" (oldbit), ADDR |
194 | : "Ir" (nr)); | ||
197 | return oldbit; | 195 | return oldbit; |
198 | } | 196 | } |
199 | 197 | ||
@@ -229,9 +227,10 @@ static inline int __test_and_clear_bit(int nr, volatile void *addr) | |||
229 | { | 227 | { |
230 | int oldbit; | 228 | int oldbit; |
231 | 229 | ||
232 | asm volatile("btr %2,%3\n\t" | 230 | asm volatile("btr %2,%1\n\t" |
233 | "sbb %0,%0" | 231 | "sbb %0,%0" |
234 | : "=r" (oldbit), BIT_ADDR : "Ir" (nr), BASE_ADDR); | 232 | : "=r" (oldbit), ADDR |
233 | : "Ir" (nr)); | ||
235 | return oldbit; | 234 | return oldbit; |
236 | } | 235 | } |
237 | 236 | ||
@@ -240,9 +239,10 @@ static inline int __test_and_change_bit(int nr, volatile void *addr) | |||
240 | { | 239 | { |
241 | int oldbit; | 240 | int oldbit; |
242 | 241 | ||
243 | asm volatile("btc %2,%3\n\t" | 242 | asm volatile("btc %2,%1\n\t" |
244 | "sbb %0,%0" | 243 | "sbb %0,%0" |
245 | : "=r" (oldbit), BIT_ADDR : "Ir" (nr), BASE_ADDR); | 244 | : "=r" (oldbit), ADDR |
245 | : "Ir" (nr) : "memory"); | ||
246 | 246 | ||
247 | return oldbit; | 247 | return oldbit; |
248 | } | 248 | } |
@@ -276,11 +276,10 @@ static inline int variable_test_bit(int nr, volatile const void *addr) | |||
276 | { | 276 | { |
277 | int oldbit; | 277 | int oldbit; |
278 | 278 | ||
279 | asm volatile("bt %2,%3\n\t" | 279 | asm volatile("bt %2,%1\n\t" |
280 | "sbb %0,%0" | 280 | "sbb %0,%0" |
281 | : "=r" (oldbit) | 281 | : "=r" (oldbit) |
282 | : "m" (((volatile const int *)addr)[nr >> 5]), | 282 | : "m" (*(unsigned long *)addr), "Ir" (nr)); |
283 | "Ir" (nr), BASE_ADDR); | ||
284 | 283 | ||
285 | return oldbit; | 284 | return oldbit; |
286 | } | 285 | } |
@@ -397,8 +396,6 @@ static inline int fls(int x) | |||
397 | } | 396 | } |
398 | #endif /* __KERNEL__ */ | 397 | #endif /* __KERNEL__ */ |
399 | 398 | ||
400 | #undef BASE_ADDR | ||
401 | #undef BIT_ADDR | ||
402 | #undef ADDR | 399 | #undef ADDR |
403 | 400 | ||
404 | static inline void set_bit_string(unsigned long *bitmap, | 401 | static inline void set_bit_string(unsigned long *bitmap, |
diff --git a/include/asm-x86/bootparam.h b/include/asm-x86/bootparam.h index e8659909e5f..f62f4733606 100644 --- a/include/asm-x86/bootparam.h +++ b/include/asm-x86/bootparam.h | |||
@@ -14,10 +14,10 @@ | |||
14 | 14 | ||
15 | /* extensible setup data list node */ | 15 | /* extensible setup data list node */ |
16 | struct setup_data { | 16 | struct setup_data { |
17 | u64 next; | 17 | __u64 next; |
18 | u32 type; | 18 | __u32 type; |
19 | u32 len; | 19 | __u32 len; |
20 | u8 data[0]; | 20 | __u8 data[0]; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | struct setup_header { | 23 | struct setup_header { |
diff --git a/include/asm-x86/geode.h b/include/asm-x86/geode.h index 7154dc4de95..6e6458853a3 100644 --- a/include/asm-x86/geode.h +++ b/include/asm-x86/geode.h | |||
@@ -185,16 +185,14 @@ static inline int is_geode(void) | |||
185 | return (is_geode_gx() || is_geode_lx()); | 185 | return (is_geode_gx() || is_geode_lx()); |
186 | } | 186 | } |
187 | 187 | ||
188 | /* | 188 | #ifdef CONFIG_MGEODE_LX |
189 | * The VSA has virtual registers that we can query for a signature. | 189 | extern int geode_has_vsa2(void); |
190 | */ | 190 | #else |
191 | static inline int geode_has_vsa2(void) | 191 | static inline int geode_has_vsa2(void) |
192 | { | 192 | { |
193 | outw(VSA_VR_UNLOCK, VSA_VRC_INDEX); | 193 | return 0; |
194 | outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX); | ||
195 | |||
196 | return (inw(VSA_VRC_DATA) == VSA_SIG); | ||
197 | } | 194 | } |
195 | #endif | ||
198 | 196 | ||
199 | /* MFGPTs */ | 197 | /* MFGPTs */ |
200 | 198 | ||
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h index da2adb45f6e..6b722d31593 100644 --- a/include/asm-x86/i387.h +++ b/include/asm-x86/i387.h | |||
@@ -175,7 +175,15 @@ static inline int save_i387(struct _fpstate __user *buf) | |||
175 | */ | 175 | */ |
176 | static inline int restore_i387(struct _fpstate __user *buf) | 176 | static inline int restore_i387(struct _fpstate __user *buf) |
177 | { | 177 | { |
178 | set_used_math(); | 178 | struct task_struct *tsk = current; |
179 | int err; | ||
180 | |||
181 | if (!used_math()) { | ||
182 | err = init_fpu(tsk); | ||
183 | if (err) | ||
184 | return err; | ||
185 | } | ||
186 | |||
179 | if (!(task_thread_info(current)->status & TS_USEDFPU)) { | 187 | if (!(task_thread_info(current)->status & TS_USEDFPU)) { |
180 | clts(); | 188 | clts(); |
181 | task_thread_info(current)->status |= TS_USEDFPU; | 189 | task_thread_info(current)->status |= TS_USEDFPU; |
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h index 9d963cd6533..1d8cd01fa51 100644 --- a/include/asm-x86/kvm_host.h +++ b/include/asm-x86/kvm_host.h | |||
@@ -314,6 +314,9 @@ struct kvm_arch{ | |||
314 | struct page *apic_access_page; | 314 | struct page *apic_access_page; |
315 | 315 | ||
316 | gpa_t wall_clock; | 316 | gpa_t wall_clock; |
317 | |||
318 | struct page *ept_identity_pagetable; | ||
319 | bool ept_identity_pagetable_done; | ||
317 | }; | 320 | }; |
318 | 321 | ||
319 | struct kvm_vm_stat { | 322 | struct kvm_vm_stat { |
@@ -422,6 +425,7 @@ struct kvm_x86_ops { | |||
422 | struct kvm_run *run); | 425 | struct kvm_run *run); |
423 | 426 | ||
424 | int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); | 427 | int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); |
428 | int (*get_tdp_level)(void); | ||
425 | }; | 429 | }; |
426 | 430 | ||
427 | extern struct kvm_x86_ops *kvm_x86_ops; | 431 | extern struct kvm_x86_ops *kvm_x86_ops; |
@@ -433,6 +437,9 @@ void kvm_mmu_destroy(struct kvm_vcpu *vcpu); | |||
433 | int kvm_mmu_create(struct kvm_vcpu *vcpu); | 437 | int kvm_mmu_create(struct kvm_vcpu *vcpu); |
434 | int kvm_mmu_setup(struct kvm_vcpu *vcpu); | 438 | int kvm_mmu_setup(struct kvm_vcpu *vcpu); |
435 | void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte); | 439 | void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte); |
440 | void kvm_mmu_set_base_ptes(u64 base_pte); | ||
441 | void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, | ||
442 | u64 dirty_mask, u64 nx_mask, u64 x_mask); | ||
436 | 443 | ||
437 | int kvm_mmu_reset_context(struct kvm_vcpu *vcpu); | 444 | int kvm_mmu_reset_context(struct kvm_vcpu *vcpu); |
438 | void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot); | 445 | void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot); |
@@ -620,7 +627,7 @@ static inline void fx_restore(struct i387_fxsave_struct *image) | |||
620 | asm("fxrstor (%0)":: "r" (image)); | 627 | asm("fxrstor (%0)":: "r" (image)); |
621 | } | 628 | } |
622 | 629 | ||
623 | static inline void fpu_init(void) | 630 | static inline void fx_finit(void) |
624 | { | 631 | { |
625 | asm("finit"); | 632 | asm("finit"); |
626 | } | 633 | } |
@@ -644,6 +651,7 @@ static inline void kvm_inject_gp(struct kvm_vcpu *vcpu, u32 error_code) | |||
644 | #define ASM_VMX_VMWRITE_RSP_RDX ".byte 0x0f, 0x79, 0xd4" | 651 | #define ASM_VMX_VMWRITE_RSP_RDX ".byte 0x0f, 0x79, 0xd4" |
645 | #define ASM_VMX_VMXOFF ".byte 0x0f, 0x01, 0xc4" | 652 | #define ASM_VMX_VMXOFF ".byte 0x0f, 0x01, 0xc4" |
646 | #define ASM_VMX_VMXON_RAX ".byte 0xf3, 0x0f, 0xc7, 0x30" | 653 | #define ASM_VMX_VMXON_RAX ".byte 0xf3, 0x0f, 0xc7, 0x30" |
654 | #define ASM_VMX_INVEPT ".byte 0x66, 0x0f, 0x38, 0x80, 0x08" | ||
647 | #define ASM_VMX_INVVPID ".byte 0x66, 0x0f, 0x38, 0x81, 0x08" | 655 | #define ASM_VMX_INVVPID ".byte 0x66, 0x0f, 0x38, 0x81, 0x08" |
648 | 656 | ||
649 | #define MSR_IA32_TIME_STAMP_COUNTER 0x010 | 657 | #define MSR_IA32_TIME_STAMP_COUNTER 0x010 |
diff --git a/include/asm-x86/pat.h b/include/asm-x86/pat.h index 8b822b5a178..88f60cc6a22 100644 --- a/include/asm-x86/pat.h +++ b/include/asm-x86/pat.h | |||
@@ -4,7 +4,13 @@ | |||
4 | 4 | ||
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | 6 | ||
7 | #ifdef CONFIG_X86_PAT | ||
7 | extern int pat_wc_enabled; | 8 | extern int pat_wc_enabled; |
9 | extern void validate_pat_support(struct cpuinfo_x86 *c); | ||
10 | #else | ||
11 | static const int pat_wc_enabled = 0; | ||
12 | static inline void validate_pat_support(struct cpuinfo_x86 *c) { } | ||
13 | #endif | ||
8 | 14 | ||
9 | extern void pat_init(void); | 15 | extern void pat_init(void); |
10 | 16 | ||
@@ -12,5 +18,7 @@ extern int reserve_memtype(u64 start, u64 end, | |||
12 | unsigned long req_type, unsigned long *ret_type); | 18 | unsigned long req_type, unsigned long *ret_type); |
13 | extern int free_memtype(u64 start, u64 end); | 19 | extern int free_memtype(u64 start, u64 end); |
14 | 20 | ||
21 | extern void pat_disable(char *reason); | ||
22 | |||
15 | #endif | 23 | #endif |
16 | 24 | ||
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h index 577ab79c4c2..d7f0403bbec 100644 --- a/include/asm-x86/pgtable_32.h +++ b/include/asm-x86/pgtable_32.h | |||
@@ -88,14 +88,7 @@ extern unsigned long pg0[]; | |||
88 | /* To avoid harmful races, pmd_none(x) should check only the lower when PAE */ | 88 | /* To avoid harmful races, pmd_none(x) should check only the lower when PAE */ |
89 | #define pmd_none(x) (!(unsigned long)pmd_val((x))) | 89 | #define pmd_none(x) (!(unsigned long)pmd_val((x))) |
90 | #define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT) | 90 | #define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT) |
91 | 91 | #define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) | |
92 | extern int pmd_bad(pmd_t pmd); | ||
93 | |||
94 | #define pmd_bad_v1(x) \ | ||
95 | (_KERNPG_TABLE != (pmd_val((x)) & ~(PAGE_MASK | _PAGE_USER))) | ||
96 | #define pmd_bad_v2(x) \ | ||
97 | (_KERNPG_TABLE != (pmd_val((x)) & ~(PAGE_MASK | _PAGE_USER | \ | ||
98 | _PAGE_PSE | _PAGE_NX))) | ||
99 | 92 | ||
100 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) | 93 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) |
101 | 94 | ||
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h index a3bbf8766c1..efe83dcbd41 100644 --- a/include/asm-x86/pgtable_64.h +++ b/include/asm-x86/pgtable_64.h | |||
@@ -158,14 +158,12 @@ static inline unsigned long pgd_bad(pgd_t pgd) | |||
158 | 158 | ||
159 | static inline unsigned long pud_bad(pud_t pud) | 159 | static inline unsigned long pud_bad(pud_t pud) |
160 | { | 160 | { |
161 | return pud_val(pud) & | 161 | return pud_val(pud) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); |
162 | ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER | _PAGE_PSE | _PAGE_NX); | ||
163 | } | 162 | } |
164 | 163 | ||
165 | static inline unsigned long pmd_bad(pmd_t pmd) | 164 | static inline unsigned long pmd_bad(pmd_t pmd) |
166 | { | 165 | { |
167 | return pmd_val(pmd) & | 166 | return pmd_val(pmd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER); |
168 | ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER | _PAGE_PSE | _PAGE_NX); | ||
169 | } | 167 | } |
170 | 168 | ||
171 | #define pte_none(x) (!pte_val((x))) | 169 | #define pte_none(x) (!pte_val((x))) |
diff --git a/include/asm-x86/spinlock.h b/include/asm-x86/spinlock.h index bc6376f1bc5..21e89bf92f1 100644 --- a/include/asm-x86/spinlock.h +++ b/include/asm-x86/spinlock.h | |||
@@ -20,18 +20,8 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifdef CONFIG_X86_32 | 22 | #ifdef CONFIG_X86_32 |
23 | typedef char _slock_t; | ||
24 | # define LOCK_INS_DEC "decb" | ||
25 | # define LOCK_INS_XCH "xchgb" | ||
26 | # define LOCK_INS_MOV "movb" | ||
27 | # define LOCK_INS_CMP "cmpb" | ||
28 | # define LOCK_PTR_REG "a" | 23 | # define LOCK_PTR_REG "a" |
29 | #else | 24 | #else |
30 | typedef int _slock_t; | ||
31 | # define LOCK_INS_DEC "decl" | ||
32 | # define LOCK_INS_XCH "xchgl" | ||
33 | # define LOCK_INS_MOV "movl" | ||
34 | # define LOCK_INS_CMP "cmpl" | ||
35 | # define LOCK_PTR_REG "D" | 25 | # define LOCK_PTR_REG "D" |
36 | #endif | 26 | #endif |
37 | 27 | ||
@@ -66,14 +56,14 @@ typedef int _slock_t; | |||
66 | #if (NR_CPUS < 256) | 56 | #if (NR_CPUS < 256) |
67 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) | 57 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) |
68 | { | 58 | { |
69 | int tmp = *(volatile signed int *)(&(lock)->slock); | 59 | int tmp = ACCESS_ONCE(lock->slock); |
70 | 60 | ||
71 | return (((tmp >> 8) & 0xff) != (tmp & 0xff)); | 61 | return (((tmp >> 8) & 0xff) != (tmp & 0xff)); |
72 | } | 62 | } |
73 | 63 | ||
74 | static inline int __raw_spin_is_contended(raw_spinlock_t *lock) | 64 | static inline int __raw_spin_is_contended(raw_spinlock_t *lock) |
75 | { | 65 | { |
76 | int tmp = *(volatile signed int *)(&(lock)->slock); | 66 | int tmp = ACCESS_ONCE(lock->slock); |
77 | 67 | ||
78 | return (((tmp >> 8) & 0xff) - (tmp & 0xff)) > 1; | 68 | return (((tmp >> 8) & 0xff) - (tmp & 0xff)) > 1; |
79 | } | 69 | } |
@@ -130,14 +120,14 @@ static __always_inline void __raw_spin_unlock(raw_spinlock_t *lock) | |||
130 | #else | 120 | #else |
131 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) | 121 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) |
132 | { | 122 | { |
133 | int tmp = *(volatile signed int *)(&(lock)->slock); | 123 | int tmp = ACCESS_ONCE(lock->slock); |
134 | 124 | ||
135 | return (((tmp >> 16) & 0xffff) != (tmp & 0xffff)); | 125 | return (((tmp >> 16) & 0xffff) != (tmp & 0xffff)); |
136 | } | 126 | } |
137 | 127 | ||
138 | static inline int __raw_spin_is_contended(raw_spinlock_t *lock) | 128 | static inline int __raw_spin_is_contended(raw_spinlock_t *lock) |
139 | { | 129 | { |
140 | int tmp = *(volatile signed int *)(&(lock)->slock); | 130 | int tmp = ACCESS_ONCE(lock->slock); |
141 | 131 | ||
142 | return (((tmp >> 16) & 0xffff) - (tmp & 0xffff)) > 1; | 132 | return (((tmp >> 16) & 0xffff) - (tmp & 0xffff)) > 1; |
143 | } | 133 | } |
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h index 4f35a0fb4f2..dcf3f8131d6 100644 --- a/include/asm-x86/topology.h +++ b/include/asm-x86/topology.h | |||
@@ -25,6 +25,16 @@ | |||
25 | #ifndef _ASM_X86_TOPOLOGY_H | 25 | #ifndef _ASM_X86_TOPOLOGY_H |
26 | #define _ASM_X86_TOPOLOGY_H | 26 | #define _ASM_X86_TOPOLOGY_H |
27 | 27 | ||
28 | #ifdef CONFIG_X86_32 | ||
29 | # ifdef CONFIG_X86_HT | ||
30 | # define ENABLE_TOPO_DEFINES | ||
31 | # endif | ||
32 | #else | ||
33 | # ifdef CONFIG_SMP | ||
34 | # define ENABLE_TOPO_DEFINES | ||
35 | # endif | ||
36 | #endif | ||
37 | |||
28 | #ifdef CONFIG_NUMA | 38 | #ifdef CONFIG_NUMA |
29 | #include <linux/cpumask.h> | 39 | #include <linux/cpumask.h> |
30 | #include <asm/mpspec.h> | 40 | #include <asm/mpspec.h> |
@@ -130,10 +140,6 @@ extern unsigned long node_end_pfn[]; | |||
130 | extern unsigned long node_remap_size[]; | 140 | extern unsigned long node_remap_size[]; |
131 | #define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid]) | 141 | #define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid]) |
132 | 142 | ||
133 | # ifdef CONFIG_X86_HT | ||
134 | # define ENABLE_TOPO_DEFINES | ||
135 | # endif | ||
136 | |||
137 | # define SD_CACHE_NICE_TRIES 1 | 143 | # define SD_CACHE_NICE_TRIES 1 |
138 | # define SD_IDLE_IDX 1 | 144 | # define SD_IDLE_IDX 1 |
139 | # define SD_NEWIDLE_IDX 2 | 145 | # define SD_NEWIDLE_IDX 2 |
@@ -141,10 +147,6 @@ extern unsigned long node_remap_size[]; | |||
141 | 147 | ||
142 | #else | 148 | #else |
143 | 149 | ||
144 | # ifdef CONFIG_SMP | ||
145 | # define ENABLE_TOPO_DEFINES | ||
146 | # endif | ||
147 | |||
148 | # define SD_CACHE_NICE_TRIES 2 | 150 | # define SD_CACHE_NICE_TRIES 2 |
149 | # define SD_IDLE_IDX 2 | 151 | # define SD_IDLE_IDX 2 |
150 | # define SD_NEWIDLE_IDX 2 | 152 | # define SD_NEWIDLE_IDX 2 |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index dcae0c8d97e..c8bd2daf95e 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -182,4 +182,16 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
182 | # define __section(S) __attribute__ ((__section__(#S))) | 182 | # define __section(S) __attribute__ ((__section__(#S))) |
183 | #endif | 183 | #endif |
184 | 184 | ||
185 | /* | ||
186 | * Prevent the compiler from merging or refetching accesses. The compiler | ||
187 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), | ||
188 | * but only when the compiler is aware of some particular ordering. One way | ||
189 | * to make the compiler aware of ordering is to put the two invocations of | ||
190 | * ACCESS_ONCE() in different C statements. | ||
191 | * | ||
192 | * This macro does absolutely -nothing- to prevent the CPU from reordering, | ||
193 | * merging, or refetching absolutely anything at any time. | ||
194 | */ | ||
195 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) | ||
196 | |||
185 | #endif /* __LINUX_COMPILER_H */ | 197 | #endif /* __LINUX_COMPILER_H */ |
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index de8387b7ceb..f5abd130663 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h | |||
@@ -33,6 +33,19 @@ enum fid_type { | |||
33 | * 32 bit parent directory inode number. | 33 | * 32 bit parent directory inode number. |
34 | */ | 34 | */ |
35 | FILEID_INO32_GEN_PARENT = 2, | 35 | FILEID_INO32_GEN_PARENT = 2, |
36 | |||
37 | /* | ||
38 | * 32 bit block number, 16 bit partition reference, | ||
39 | * 16 bit unused, 32 bit generation number. | ||
40 | */ | ||
41 | FILEID_UDF_WITHOUT_PARENT = 0x51, | ||
42 | |||
43 | /* | ||
44 | * 32 bit block number, 16 bit partition reference, | ||
45 | * 16 bit unused, 32 bit generation number, | ||
46 | * 32 bit parent block number, 32 bit parent generation number | ||
47 | */ | ||
48 | FILEID_UDF_WITH_PARENT = 0x52, | ||
36 | }; | 49 | }; |
37 | 50 | ||
38 | struct fid { | 51 | struct fid { |
@@ -43,6 +56,14 @@ struct fid { | |||
43 | u32 parent_ino; | 56 | u32 parent_ino; |
44 | u32 parent_gen; | 57 | u32 parent_gen; |
45 | } i32; | 58 | } i32; |
59 | struct { | ||
60 | u32 block; | ||
61 | u16 partref; | ||
62 | u16 parent_partref; | ||
63 | u32 generation; | ||
64 | u32 parent_block; | ||
65 | u32 parent_generation; | ||
66 | } udf; | ||
46 | __u32 raw[0]; | 67 | __u32 raw[0]; |
47 | }; | 68 | }; |
48 | }; | 69 | }; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index a1ba005d08e..f413085f748 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1289,17 +1289,12 @@ extern ssize_t vfs_readv(struct file *, const struct iovec __user *, | |||
1289 | extern ssize_t vfs_writev(struct file *, const struct iovec __user *, | 1289 | extern ssize_t vfs_writev(struct file *, const struct iovec __user *, |
1290 | unsigned long, loff_t *); | 1290 | unsigned long, loff_t *); |
1291 | 1291 | ||
1292 | /* | ||
1293 | * NOTE: write_inode, delete_inode, clear_inode, put_inode can be called | ||
1294 | * without the big kernel lock held in all filesystems. | ||
1295 | */ | ||
1296 | struct super_operations { | 1292 | struct super_operations { |
1297 | struct inode *(*alloc_inode)(struct super_block *sb); | 1293 | struct inode *(*alloc_inode)(struct super_block *sb); |
1298 | void (*destroy_inode)(struct inode *); | 1294 | void (*destroy_inode)(struct inode *); |
1299 | 1295 | ||
1300 | void (*dirty_inode) (struct inode *); | 1296 | void (*dirty_inode) (struct inode *); |
1301 | int (*write_inode) (struct inode *, int); | 1297 | int (*write_inode) (struct inode *, int); |
1302 | void (*put_inode) (struct inode *); | ||
1303 | void (*drop_inode) (struct inode *); | 1298 | void (*drop_inode) (struct inode *); |
1304 | void (*delete_inode) (struct inode *); | 1299 | void (*delete_inode) (struct inode *); |
1305 | void (*put_super) (struct super_block *); | 1300 | void (*put_super) (struct super_block *); |
@@ -1821,7 +1816,6 @@ extern void iget_failed(struct inode *); | |||
1821 | extern void clear_inode(struct inode *); | 1816 | extern void clear_inode(struct inode *); |
1822 | extern void destroy_inode(struct inode *); | 1817 | extern void destroy_inode(struct inode *); |
1823 | extern struct inode *new_inode(struct super_block *); | 1818 | extern struct inode *new_inode(struct super_block *); |
1824 | extern int __remove_suid(struct dentry *, int); | ||
1825 | extern int should_remove_suid(struct dentry *); | 1819 | extern int should_remove_suid(struct dentry *); |
1826 | extern int remove_suid(struct dentry *); | 1820 | extern int remove_suid(struct dentry *); |
1827 | 1821 | ||
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index ecd2bf63fc8..e9874e7fcdf 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -178,17 +178,17 @@ static inline struct hd_struct *get_part(struct gendisk *gendiskp, | |||
178 | 178 | ||
179 | static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { | 179 | static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { |
180 | int i; | 180 | int i; |
181 | |||
181 | for_each_possible_cpu(i) | 182 | for_each_possible_cpu(i) |
182 | memset(per_cpu_ptr(gendiskp->dkstats, i), value, | 183 | memset(per_cpu_ptr(gendiskp->dkstats, i), value, |
183 | sizeof (struct disk_stats)); | 184 | sizeof(struct disk_stats)); |
184 | } | 185 | } |
185 | 186 | ||
186 | #define __part_stat_add(part, field, addnd) \ | 187 | #define __part_stat_add(part, field, addnd) \ |
187 | (per_cpu_ptr(part->dkstats, smp_processor_id())->field += addnd) | 188 | (per_cpu_ptr(part->dkstats, smp_processor_id())->field += addnd) |
188 | 189 | ||
189 | #define __all_stat_add(gendiskp, field, addnd, sector) \ | 190 | #define __all_stat_add(gendiskp, part, field, addnd, sector) \ |
190 | ({ \ | 191 | ({ \ |
191 | struct hd_struct *part = get_part(gendiskp, sector); \ | ||
192 | if (part) \ | 192 | if (part) \ |
193 | __part_stat_add(part, field, addnd); \ | 193 | __part_stat_add(part, field, addnd); \ |
194 | __disk_stat_add(gendiskp, field, addnd); \ | 194 | __disk_stat_add(gendiskp, field, addnd); \ |
@@ -203,11 +203,13 @@ static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { | |||
203 | res; \ | 203 | res; \ |
204 | }) | 204 | }) |
205 | 205 | ||
206 | static inline void part_stat_set_all(struct hd_struct *part, int value) { | 206 | static inline void part_stat_set_all(struct hd_struct *part, int value) |
207 | { | ||
207 | int i; | 208 | int i; |
209 | |||
208 | for_each_possible_cpu(i) | 210 | for_each_possible_cpu(i) |
209 | memset(per_cpu_ptr(part->dkstats, i), value, | 211 | memset(per_cpu_ptr(part->dkstats, i), value, |
210 | sizeof(struct disk_stats)); | 212 | sizeof(struct disk_stats)); |
211 | } | 213 | } |
212 | 214 | ||
213 | #else /* !CONFIG_SMP */ | 215 | #else /* !CONFIG_SMP */ |
@@ -223,9 +225,8 @@ static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) | |||
223 | #define __part_stat_add(part, field, addnd) \ | 225 | #define __part_stat_add(part, field, addnd) \ |
224 | (part->dkstats.field += addnd) | 226 | (part->dkstats.field += addnd) |
225 | 227 | ||
226 | #define __all_stat_add(gendiskp, field, addnd, sector) \ | 228 | #define __all_stat_add(gendiskp, part, field, addnd, sector) \ |
227 | ({ \ | 229 | ({ \ |
228 | struct hd_struct *part = get_part(gendiskp, sector); \ | ||
229 | if (part) \ | 230 | if (part) \ |
230 | part->dkstats.field += addnd; \ | 231 | part->dkstats.field += addnd; \ |
231 | __disk_stat_add(gendiskp, field, addnd); \ | 232 | __disk_stat_add(gendiskp, field, addnd); \ |
@@ -276,10 +277,10 @@ static inline void part_stat_set_all(struct hd_struct *part, int value) | |||
276 | #define part_stat_sub(gendiskp, field, subnd) \ | 277 | #define part_stat_sub(gendiskp, field, subnd) \ |
277 | part_stat_add(gendiskp, field, -subnd) | 278 | part_stat_add(gendiskp, field, -subnd) |
278 | 279 | ||
279 | #define all_stat_add(gendiskp, field, addnd, sector) \ | 280 | #define all_stat_add(gendiskp, part, field, addnd, sector) \ |
280 | do { \ | 281 | do { \ |
281 | preempt_disable(); \ | 282 | preempt_disable(); \ |
282 | __all_stat_add(gendiskp, field, addnd, sector); \ | 283 | __all_stat_add(gendiskp, part, field, addnd, sector); \ |
283 | preempt_enable(); \ | 284 | preempt_enable(); \ |
284 | } while (0) | 285 | } while (0) |
285 | 286 | ||
@@ -288,15 +289,15 @@ static inline void part_stat_set_all(struct hd_struct *part, int value) | |||
288 | #define all_stat_dec(gendiskp, field, sector) \ | 289 | #define all_stat_dec(gendiskp, field, sector) \ |
289 | all_stat_add(gendiskp, field, -1, sector) | 290 | all_stat_add(gendiskp, field, -1, sector) |
290 | 291 | ||
291 | #define __all_stat_inc(gendiskp, field, sector) \ | 292 | #define __all_stat_inc(gendiskp, part, field, sector) \ |
292 | __all_stat_add(gendiskp, field, 1, sector) | 293 | __all_stat_add(gendiskp, part, field, 1, sector) |
293 | #define all_stat_inc(gendiskp, field, sector) \ | 294 | #define all_stat_inc(gendiskp, part, field, sector) \ |
294 | all_stat_add(gendiskp, field, 1, sector) | 295 | all_stat_add(gendiskp, part, field, 1, sector) |
295 | 296 | ||
296 | #define __all_stat_sub(gendiskp, field, subnd, sector) \ | 297 | #define __all_stat_sub(gendiskp, part, field, subnd, sector) \ |
297 | __all_stat_add(gendiskp, field, -subnd, sector) | 298 | __all_stat_add(gendiskp, part, field, -subnd, sector) |
298 | #define all_stat_sub(gendiskp, field, subnd, sector) \ | 299 | #define all_stat_sub(gendiskp, part, field, subnd, sector) \ |
299 | all_stat_add(gendiskp, field, -subnd, sector) | 300 | all_stat_add(gendiskp, part, field, -subnd, sector) |
300 | 301 | ||
301 | /* Inlines to alloc and free disk stats in struct gendisk */ | 302 | /* Inlines to alloc and free disk stats in struct gendisk */ |
302 | #ifdef CONFIG_SMP | 303 | #ifdef CONFIG_SMP |
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 897f723bd22..181006cc94a 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
@@ -72,6 +72,14 @@ | |||
72 | #define in_softirq() (softirq_count()) | 72 | #define in_softirq() (softirq_count()) |
73 | #define in_interrupt() (irq_count()) | 73 | #define in_interrupt() (irq_count()) |
74 | 74 | ||
75 | #if defined(CONFIG_PREEMPT) | ||
76 | # define PREEMPT_INATOMIC_BASE kernel_locked() | ||
77 | # define PREEMPT_CHECK_OFFSET 1 | ||
78 | #else | ||
79 | # define PREEMPT_INATOMIC_BASE 0 | ||
80 | # define PREEMPT_CHECK_OFFSET 0 | ||
81 | #endif | ||
82 | |||
75 | /* | 83 | /* |
76 | * Are we running in atomic context? WARNING: this macro cannot | 84 | * Are we running in atomic context? WARNING: this macro cannot |
77 | * always detect atomic context; in particular, it cannot know about | 85 | * always detect atomic context; in particular, it cannot know about |
@@ -79,17 +87,11 @@ | |||
79 | * used in the general case to determine whether sleeping is possible. | 87 | * used in the general case to determine whether sleeping is possible. |
80 | * Do not use in_atomic() in driver code. | 88 | * Do not use in_atomic() in driver code. |
81 | */ | 89 | */ |
82 | #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) | 90 | #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_INATOMIC_BASE) |
83 | |||
84 | #ifdef CONFIG_PREEMPT | ||
85 | # define PREEMPT_CHECK_OFFSET 1 | ||
86 | #else | ||
87 | # define PREEMPT_CHECK_OFFSET 0 | ||
88 | #endif | ||
89 | 91 | ||
90 | /* | 92 | /* |
91 | * Check whether we were atomic before we did preempt_disable(): | 93 | * Check whether we were atomic before we did preempt_disable(): |
92 | * (used by the scheduler) | 94 | * (used by the scheduler, *after* releasing the kernel lock) |
93 | */ | 95 | */ |
94 | #define in_atomic_preempt_off() \ | 96 | #define in_atomic_preempt_off() \ |
95 | ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) | 97 | ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) |
diff --git a/include/linux/io.h b/include/linux/io.h index 3a03a3604cc..6c7f0ba0d5f 100644 --- a/include/linux/io.h +++ b/include/linux/io.h | |||
@@ -65,5 +65,6 @@ void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, | |||
65 | void devm_iounmap(struct device *dev, void __iomem *addr); | 65 | void devm_iounmap(struct device *dev, void __iomem *addr); |
66 | int check_signature(const volatile void __iomem *io_addr, | 66 | int check_signature(const volatile void __iomem *io_addr, |
67 | const unsigned char *signature, int length); | 67 | const unsigned char *signature, int length); |
68 | void devm_ioremap_release(struct device *dev, void *res); | ||
68 | 69 | ||
69 | #endif /* _LINUX_IO_H */ | 70 | #endif /* _LINUX_IO_H */ |
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h index 2a3bb1bb743..f98a656b17e 100644 --- a/include/linux/ioprio.h +++ b/include/linux/ioprio.h | |||
@@ -68,6 +68,20 @@ static inline int task_nice_ioprio(struct task_struct *task) | |||
68 | } | 68 | } |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * This is for the case where the task hasn't asked for a specific IO class. | ||
72 | * Check for idle and rt task process, and return appropriate IO class. | ||
73 | */ | ||
74 | static inline int task_nice_ioclass(struct task_struct *task) | ||
75 | { | ||
76 | if (task->policy == SCHED_IDLE) | ||
77 | return IOPRIO_CLASS_IDLE; | ||
78 | else if (task->policy == SCHED_FIFO || task->policy == SCHED_RR) | ||
79 | return IOPRIO_CLASS_RT; | ||
80 | else | ||
81 | return IOPRIO_CLASS_BE; | ||
82 | } | ||
83 | |||
84 | /* | ||
71 | * For inheritance, return the highest of the two given priorities | 85 | * For inheritance, return the highest of the two given priorities |
72 | */ | 86 | */ |
73 | extern int ioprio_best(unsigned short aprio, unsigned short bprio); | 87 | extern int ioprio_best(unsigned short aprio, unsigned short bprio); |
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 9757b1a6d9d..6adcc297e35 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h | |||
@@ -261,10 +261,12 @@ struct kgdb_io { | |||
261 | 261 | ||
262 | extern struct kgdb_arch arch_kgdb_ops; | 262 | extern struct kgdb_arch arch_kgdb_ops; |
263 | 263 | ||
264 | extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs); | ||
265 | |||
264 | extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); | 266 | extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); |
265 | extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); | 267 | extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); |
266 | 268 | ||
267 | extern int kgdb_hex2long(char **ptr, long *long_val); | 269 | extern int kgdb_hex2long(char **ptr, unsigned long *long_val); |
268 | extern int kgdb_mem2hex(char *mem, char *buf, int count); | 270 | extern int kgdb_mem2hex(char *mem, char *buf, int count); |
269 | extern int kgdb_hex2mem(char *buf, char *mem, int count); | 271 | extern int kgdb_hex2mem(char *buf, char *mem, int count); |
270 | 272 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index d1dfe872ee3..0f17643e0a6 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -1039,6 +1039,7 @@ extern void ata_eh_thaw_port(struct ata_port *ap); | |||
1039 | 1039 | ||
1040 | extern void ata_eh_qc_complete(struct ata_queued_cmd *qc); | 1040 | extern void ata_eh_qc_complete(struct ata_queued_cmd *qc); |
1041 | extern void ata_eh_qc_retry(struct ata_queued_cmd *qc); | 1041 | extern void ata_eh_qc_retry(struct ata_queued_cmd *qc); |
1042 | extern void ata_eh_analyze_ncq_error(struct ata_link *link); | ||
1042 | 1043 | ||
1043 | extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | 1044 | extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, |
1044 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, | 1045 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, |
@@ -1381,6 +1382,18 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host) | |||
1381 | return *(struct ata_port **)&host->hostdata[0]; | 1382 | return *(struct ata_port **)&host->hostdata[0]; |
1382 | } | 1383 | } |
1383 | 1384 | ||
1385 | static inline int ata_check_ready(u8 status) | ||
1386 | { | ||
1387 | if (!(status & ATA_BUSY)) | ||
1388 | return 1; | ||
1389 | |||
1390 | /* 0xff indicates either no device or device not ready */ | ||
1391 | if (status == 0xff) | ||
1392 | return -ENODEV; | ||
1393 | |||
1394 | return 0; | ||
1395 | } | ||
1396 | |||
1384 | 1397 | ||
1385 | /************************************************************************** | 1398 | /************************************************************************** |
1386 | * PMP - drivers/ata/libata-pmp.c | 1399 | * PMP - drivers/ata/libata-pmp.c |
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h index 30e11aa3c1c..a15cdd4a8e5 100644 --- a/include/linux/mv643xx_eth.h +++ b/include/linux/mv643xx_eth.h | |||
@@ -1,19 +1,31 @@ | |||
1 | /* | 1 | /* |
2 | * MV-643XX ethernet platform device data definition file. | 2 | * MV-643XX ethernet platform device data definition file. |
3 | */ | 3 | */ |
4 | |||
4 | #ifndef __LINUX_MV643XX_ETH_H | 5 | #ifndef __LINUX_MV643XX_ETH_H |
5 | #define __LINUX_MV643XX_ETH_H | 6 | #define __LINUX_MV643XX_ETH_H |
6 | 7 | ||
7 | #define MV643XX_ETH_SHARED_NAME "mv643xx_eth_shared" | 8 | #include <linux/mbus.h> |
8 | #define MV643XX_ETH_NAME "mv643xx_eth" | 9 | |
10 | #define MV643XX_ETH_SHARED_NAME "mv643xx_eth" | ||
11 | #define MV643XX_ETH_NAME "mv643xx_eth_port" | ||
9 | #define MV643XX_ETH_SHARED_REGS 0x2000 | 12 | #define MV643XX_ETH_SHARED_REGS 0x2000 |
10 | #define MV643XX_ETH_SHARED_REGS_SIZE 0x2000 | 13 | #define MV643XX_ETH_SHARED_REGS_SIZE 0x2000 |
11 | #define MV643XX_ETH_BAR_4 0x2220 | 14 | #define MV643XX_ETH_BAR_4 0x2220 |
12 | #define MV643XX_ETH_SIZE_REG_4 0x2224 | 15 | #define MV643XX_ETH_SIZE_REG_4 0x2224 |
13 | #define MV643XX_ETH_BASE_ADDR_ENABLE_REG 0x2290 | 16 | #define MV643XX_ETH_BASE_ADDR_ENABLE_REG 0x2290 |
14 | 17 | ||
18 | struct mv643xx_eth_shared_platform_data { | ||
19 | struct mbus_dram_target_info *dram; | ||
20 | unsigned int t_clk; | ||
21 | }; | ||
22 | |||
15 | struct mv643xx_eth_platform_data { | 23 | struct mv643xx_eth_platform_data { |
24 | struct platform_device *shared; | ||
16 | int port_number; | 25 | int port_number; |
26 | |||
27 | struct platform_device *shared_smi; | ||
28 | |||
17 | u16 force_phy_addr; /* force override if phy_addr == 0 */ | 29 | u16 force_phy_addr; /* force override if phy_addr == 0 */ |
18 | u16 phy_addr; | 30 | u16 phy_addr; |
19 | 31 | ||
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 5da04e586a3..23aa2ec6b7b 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | struct nf_ct_sip_master { | 8 | struct nf_ct_sip_master { |
9 | unsigned int register_cseq; | 9 | unsigned int register_cseq; |
10 | unsigned int invite_cseq; | ||
10 | }; | 11 | }; |
11 | 12 | ||
12 | enum sip_expectation_classes { | 13 | enum sip_expectation_classes { |
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h index 2e5a9673204..bd2a870ec29 100644 --- a/include/linux/of_i2c.h +++ b/include/linux/of_i2c.h | |||
@@ -14,11 +14,7 @@ | |||
14 | 14 | ||
15 | #include <linux/i2c.h> | 15 | #include <linux/i2c.h> |
16 | 16 | ||
17 | #ifdef CONFIG_OF_I2C | ||
18 | |||
19 | void of_register_i2c_devices(struct i2c_adapter *adap, | 17 | void of_register_i2c_devices(struct i2c_adapter *adap, |
20 | struct device_node *adap_node); | 18 | struct device_node *adap_node); |
21 | 19 | ||
22 | #endif /* CONFIG_OF_I2C */ | ||
23 | |||
24 | #endif /* __LINUX_OF_I2C_H */ | 20 | #endif /* __LINUX_OF_I2C_H */ |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 96acd0dae24..509159bcd4e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/mod_devicetable.h> | 44 | #include <linux/mod_devicetable.h> |
45 | 45 | ||
46 | #include <linux/types.h> | 46 | #include <linux/types.h> |
47 | #include <linux/init.h> | ||
47 | #include <linux/ioport.h> | 48 | #include <linux/ioport.h> |
48 | #include <linux/list.h> | 49 | #include <linux/list.h> |
49 | #include <linux/compiler.h> | 50 | #include <linux/compiler.h> |
@@ -474,7 +475,7 @@ extern struct pci_bus *pci_find_bus(int domain, int busnr); | |||
474 | void pci_bus_add_devices(struct pci_bus *bus); | 475 | void pci_bus_add_devices(struct pci_bus *bus); |
475 | struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, | 476 | struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, |
476 | struct pci_ops *ops, void *sysdata); | 477 | struct pci_ops *ops, void *sysdata); |
477 | static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, | 478 | static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, |
478 | void *sysdata) | 479 | void *sysdata) |
479 | { | 480 | { |
480 | struct pci_bus *root_bus; | 481 | struct pci_bus *root_bus; |
@@ -666,7 +667,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
666 | 667 | ||
667 | void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), | 668 | void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), |
668 | void *userdata); | 669 | void *userdata); |
669 | int pci_cfg_space_size_ext(struct pci_dev *dev, unsigned check_exp_pcix); | 670 | int pci_cfg_space_size_ext(struct pci_dev *dev); |
670 | int pci_cfg_space_size(struct pci_dev *dev); | 671 | int pci_cfg_space_size(struct pci_dev *dev); |
671 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); | 672 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); |
672 | 673 | ||
diff --git a/include/linux/phy.h b/include/linux/phy.h index 02df20f085f..7224c4099a2 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -412,6 +412,8 @@ int mdiobus_register(struct mii_bus *bus); | |||
412 | void mdiobus_unregister(struct mii_bus *bus); | 412 | void mdiobus_unregister(struct mii_bus *bus); |
413 | void phy_sanitize_settings(struct phy_device *phydev); | 413 | void phy_sanitize_settings(struct phy_device *phydev); |
414 | int phy_stop_interrupts(struct phy_device *phydev); | 414 | int phy_stop_interrupts(struct phy_device *phydev); |
415 | int phy_enable_interrupts(struct phy_device *phydev); | ||
416 | int phy_disable_interrupts(struct phy_device *phydev); | ||
415 | 417 | ||
416 | static inline int phy_read_status(struct phy_device *phydev) { | 418 | static inline int phy_read_status(struct phy_device *phydev) { |
417 | return phydev->drv->read_status(phydev); | 419 | return phydev->drv->read_status(phydev); |
@@ -447,5 +449,8 @@ int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask, | |||
447 | int (*run)(struct phy_device *)); | 449 | int (*run)(struct phy_device *)); |
448 | int phy_scan_fixups(struct phy_device *phydev); | 450 | int phy_scan_fixups(struct phy_device *phydev); |
449 | 451 | ||
452 | int __init mdio_bus_init(void); | ||
453 | void mdio_bus_exit(void); | ||
454 | |||
450 | extern struct bus_type mdio_bus_type; | 455 | extern struct bus_type mdio_bus_type; |
451 | #endif /* __PHY_H */ | 456 | #endif /* __PHY_H */ |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 8082d6587a0..d42dbec0608 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -131,18 +131,6 @@ struct rcu_head { | |||
131 | */ | 131 | */ |
132 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() | 132 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() |
133 | 133 | ||
134 | /* | ||
135 | * Prevent the compiler from merging or refetching accesses. The compiler | ||
136 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), | ||
137 | * but only when the compiler is aware of some particular ordering. One way | ||
138 | * to make the compiler aware of ordering is to put the two invocations of | ||
139 | * ACCESS_ONCE() in different C statements. | ||
140 | * | ||
141 | * This macro does absolutely -nothing- to prevent the CPU from reordering, | ||
142 | * merging, or refetching absolutely anything at any time. | ||
143 | */ | ||
144 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) | ||
145 | |||
146 | /** | 134 | /** |
147 | * rcu_dereference - fetch an RCU-protected pointer in an | 135 | * rcu_dereference - fetch an RCU-protected pointer in an |
148 | * RCU read-side critical section. This pointer may later | 136 | * RCU read-side critical section. This pointer may later |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 03c238088ae..0c35b0343a7 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -158,6 +158,8 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | |||
158 | } | 158 | } |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | extern unsigned long long time_sync_thresh; | ||
162 | |||
161 | /* | 163 | /* |
162 | * Task state bitmask. NOTE! These bits are also | 164 | * Task state bitmask. NOTE! These bits are also |
163 | * encoded in fs/proc/array.c: get_task_state(). | 165 | * encoded in fs/proc/array.c: get_task_state(). |
@@ -1551,6 +1553,35 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | |||
1551 | 1553 | ||
1552 | extern unsigned long long sched_clock(void); | 1554 | extern unsigned long long sched_clock(void); |
1553 | 1555 | ||
1556 | #ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK | ||
1557 | static inline void sched_clock_init(void) | ||
1558 | { | ||
1559 | } | ||
1560 | |||
1561 | static inline u64 sched_clock_cpu(int cpu) | ||
1562 | { | ||
1563 | return sched_clock(); | ||
1564 | } | ||
1565 | |||
1566 | static inline void sched_clock_tick(void) | ||
1567 | { | ||
1568 | } | ||
1569 | |||
1570 | static inline void sched_clock_idle_sleep_event(void) | ||
1571 | { | ||
1572 | } | ||
1573 | |||
1574 | static inline void sched_clock_idle_wakeup_event(u64 delta_ns) | ||
1575 | { | ||
1576 | } | ||
1577 | #else | ||
1578 | extern void sched_clock_init(void); | ||
1579 | extern u64 sched_clock_cpu(int cpu); | ||
1580 | extern void sched_clock_tick(void); | ||
1581 | extern void sched_clock_idle_sleep_event(void); | ||
1582 | extern void sched_clock_idle_wakeup_event(u64 delta_ns); | ||
1583 | #endif | ||
1584 | |||
1554 | /* | 1585 | /* |
1555 | * For kernel-internal use: high-speed (but slightly incorrect) per-cpu | 1586 | * For kernel-internal use: high-speed (but slightly incorrect) per-cpu |
1556 | * clock constructed from sched_clock(): | 1587 | * clock constructed from sched_clock(): |
@@ -1977,6 +2008,11 @@ static inline void clear_tsk_need_resched(struct task_struct *tsk) | |||
1977 | clear_tsk_thread_flag(tsk,TIF_NEED_RESCHED); | 2008 | clear_tsk_thread_flag(tsk,TIF_NEED_RESCHED); |
1978 | } | 2009 | } |
1979 | 2010 | ||
2011 | static inline int test_tsk_need_resched(struct task_struct *tsk) | ||
2012 | { | ||
2013 | return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED)); | ||
2014 | } | ||
2015 | |||
1980 | static inline int signal_pending(struct task_struct *p) | 2016 | static inline int signal_pending(struct task_struct *p) |
1981 | { | 2017 | { |
1982 | return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); | 2018 | return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); |
@@ -1991,7 +2027,7 @@ static inline int fatal_signal_pending(struct task_struct *p) | |||
1991 | 2027 | ||
1992 | static inline int need_resched(void) | 2028 | static inline int need_resched(void) |
1993 | { | 2029 | { |
1994 | return unlikely(test_thread_flag(TIF_NEED_RESCHED)); | 2030 | return unlikely(test_tsk_need_resched(current)); |
1995 | } | 2031 | } |
1996 | 2032 | ||
1997 | /* | 2033 | /* |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 27bad59dae7..7858eac40aa 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -196,12 +196,6 @@ static inline int sysfs_update_group(struct kobject *kobj, | |||
196 | return 0; | 196 | return 0; |
197 | } | 197 | } |
198 | 198 | ||
199 | static inline int sysfs_update_group(struct kobject *kobj, | ||
200 | const struct attribute_group *grp) | ||
201 | { | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static inline void sysfs_remove_group(struct kobject *kobj, | 199 | static inline void sysfs_remove_group(struct kobject *kobj, |
206 | const struct attribute_group *grp) | 200 | const struct attribute_group *grp) |
207 | { | 201 | { |
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h index 4d0909e5359..79b9837d9ca 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h | |||
@@ -17,6 +17,11 @@ | |||
17 | #else | 17 | #else |
18 | #define MODULE_VERMAGIC_MODULE_UNLOAD "" | 18 | #define MODULE_VERMAGIC_MODULE_UNLOAD "" |
19 | #endif | 19 | #endif |
20 | #ifdef CONFIG_MODVERSIONS | ||
21 | #define MODULE_VERMAGIC_MODVERSIONS "modversions " | ||
22 | #else | ||
23 | #define MODULE_VERMAGIC_MODVERSIONS "" | ||
24 | #endif | ||
20 | #ifndef MODULE_ARCH_VERMAGIC | 25 | #ifndef MODULE_ARCH_VERMAGIC |
21 | #define MODULE_ARCH_VERMAGIC "" | 26 | #define MODULE_ARCH_VERMAGIC "" |
22 | #endif | 27 | #endif |
@@ -24,5 +29,6 @@ | |||
24 | #define VERMAGIC_STRING \ | 29 | #define VERMAGIC_STRING \ |
25 | UTS_RELEASE " " \ | 30 | UTS_RELEASE " " \ |
26 | MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ | 31 | MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ |
27 | MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC | 32 | MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \ |
33 | MODULE_ARCH_VERMAGIC | ||
28 | 34 | ||
diff --git a/include/net/ip.h b/include/net/ip.h index 6d7bcd5e62d..3b40bc2234b 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -210,7 +210,7 @@ int ip_dont_fragment(struct sock *sk, struct dst_entry *dst) | |||
210 | { | 210 | { |
211 | return (inet_sk(sk)->pmtudisc == IP_PMTUDISC_DO || | 211 | return (inet_sk(sk)->pmtudisc == IP_PMTUDISC_DO || |
212 | (inet_sk(sk)->pmtudisc == IP_PMTUDISC_WANT && | 212 | (inet_sk(sk)->pmtudisc == IP_PMTUDISC_WANT && |
213 | !(dst_metric(dst, RTAX_LOCK)&(1<<RTAX_MTU)))); | 213 | !(dst_metric_locked(dst, RTAX_MTU)))); |
214 | } | 214 | } |
215 | 215 | ||
216 | extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); | 216 | extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index d1350bcccb0..2933d7474a7 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -648,14 +648,46 @@ extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, | |||
648 | extern void xfrm_audit_state_icvfail(struct xfrm_state *x, | 648 | extern void xfrm_audit_state_icvfail(struct xfrm_state *x, |
649 | struct sk_buff *skb, u8 proto); | 649 | struct sk_buff *skb, u8 proto); |
650 | #else | 650 | #else |
651 | #define xfrm_audit_policy_add(x, r, a, se, s) do { ; } while (0) | 651 | |
652 | #define xfrm_audit_policy_delete(x, r, a, se, s) do { ; } while (0) | 652 | static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, |
653 | #define xfrm_audit_state_add(x, r, a, se, s) do { ; } while (0) | 653 | u32 auid, u32 ses, u32 secid) |
654 | #define xfrm_audit_state_delete(x, r, a, se, s) do { ; } while (0) | 654 | { |
655 | #define xfrm_audit_state_replay_overflow(x, s) do { ; } while (0) | 655 | } |
656 | #define xfrm_audit_state_notfound_simple(s, f) do { ; } while (0) | 656 | |
657 | #define xfrm_audit_state_notfound(s, f, sp, sq) do { ; } while (0) | 657 | static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, |
658 | #define xfrm_audit_state_icvfail(x, s, p) do { ; } while (0) | 658 | u32 auid, u32 ses, u32 secid) |
659 | { | ||
660 | } | ||
661 | |||
662 | static inline void xfrm_audit_state_add(struct xfrm_state *x, int result, | ||
663 | u32 auid, u32 ses, u32 secid) | ||
664 | { | ||
665 | } | ||
666 | |||
667 | static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result, | ||
668 | u32 auid, u32 ses, u32 secid) | ||
669 | { | ||
670 | } | ||
671 | |||
672 | static inline void xfrm_audit_state_replay_overflow(struct xfrm_state *x, | ||
673 | struct sk_buff *skb) | ||
674 | { | ||
675 | } | ||
676 | |||
677 | static inline void xfrm_audit_state_notfound_simple(struct sk_buff *skb, | ||
678 | u16 family) | ||
679 | { | ||
680 | } | ||
681 | |||
682 | static inline void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, | ||
683 | __be32 net_spi, __be32 net_seq) | ||
684 | { | ||
685 | } | ||
686 | |||
687 | static inline void xfrm_audit_state_icvfail(struct xfrm_state *x, | ||
688 | struct sk_buff *skb, u8 proto) | ||
689 | { | ||
690 | } | ||
659 | #endif /* CONFIG_AUDITSYSCALL */ | 691 | #endif /* CONFIG_AUDITSYSCALL */ |
660 | 692 | ||
661 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) | 693 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) |
diff --git a/init/Kconfig b/init/Kconfig index 6a44defac3e..6135d07f31e 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -316,9 +316,16 @@ config CPUSETS | |||
316 | 316 | ||
317 | Say N if unsure. | 317 | Say N if unsure. |
318 | 318 | ||
319 | # | ||
320 | # Architectures with an unreliable sched_clock() should select this: | ||
321 | # | ||
322 | config HAVE_UNSTABLE_SCHED_CLOCK | ||
323 | bool | ||
324 | |||
319 | config GROUP_SCHED | 325 | config GROUP_SCHED |
320 | bool "Group CPU scheduler" | 326 | bool "Group CPU scheduler" |
321 | default y | 327 | depends on EXPERIMENTAL |
328 | default n | ||
322 | help | 329 | help |
323 | This feature lets CPU scheduler recognize task groups and control CPU | 330 | This feature lets CPU scheduler recognize task groups and control CPU |
324 | bandwidth allocation to such task groups. | 331 | bandwidth allocation to such task groups. |
@@ -326,7 +333,7 @@ config GROUP_SCHED | |||
326 | config FAIR_GROUP_SCHED | 333 | config FAIR_GROUP_SCHED |
327 | bool "Group scheduling for SCHED_OTHER" | 334 | bool "Group scheduling for SCHED_OTHER" |
328 | depends on GROUP_SCHED | 335 | depends on GROUP_SCHED |
329 | default y | 336 | default GROUP_SCHED |
330 | 337 | ||
331 | config RT_GROUP_SCHED | 338 | config RT_GROUP_SCHED |
332 | bool "Group scheduling for SCHED_RR/FIFO" | 339 | bool "Group scheduling for SCHED_RR/FIFO" |
@@ -627,6 +634,14 @@ config ELF_CORE | |||
627 | help | 634 | help |
628 | Enable support for generating core dumps. Disabling saves about 4k. | 635 | Enable support for generating core dumps. Disabling saves about 4k. |
629 | 636 | ||
637 | config PCSPKR_PLATFORM | ||
638 | bool "Enable PC-Speaker support" if EMBEDDED | ||
639 | depends on ALPHA || X86 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES | ||
640 | default y | ||
641 | help | ||
642 | This option allows to disable the internal PC-Speaker | ||
643 | support, saving some memory. | ||
644 | |||
630 | config COMPAT_BRK | 645 | config COMPAT_BRK |
631 | bool "Disable heap randomization" | 646 | bool "Disable heap randomization" |
632 | default y | 647 | default y |
@@ -825,6 +840,15 @@ menuconfig MODULES | |||
825 | 840 | ||
826 | If unsure, say Y. | 841 | If unsure, say Y. |
827 | 842 | ||
843 | config MODULE_FORCE_LOAD | ||
844 | bool "Forced module loading" | ||
845 | depends on MODULES | ||
846 | default n | ||
847 | help | ||
848 | Allow loading of modules without version information (ie. modprobe | ||
849 | --force). Forced module loading sets the 'F' (forced) taint flag and | ||
850 | is usually a really bad idea. | ||
851 | |||
828 | config MODULE_UNLOAD | 852 | config MODULE_UNLOAD |
829 | bool "Module unloading" | 853 | bool "Module unloading" |
830 | depends on MODULES | 854 | depends on MODULES |
diff --git a/init/main.c b/init/main.c index a87d4ca5c36..ddada7acf36 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -602,6 +602,7 @@ asmlinkage void __init start_kernel(void) | |||
602 | softirq_init(); | 602 | softirq_init(); |
603 | timekeeping_init(); | 603 | timekeeping_init(); |
604 | time_init(); | 604 | time_init(); |
605 | sched_clock_init(); | ||
605 | profile_init(); | 606 | profile_init(); |
606 | if (!irqs_disabled()) | 607 | if (!irqs_disabled()) |
607 | printk("start_kernel(): bug: interrupts were enabled early\n"); | 608 | printk("start_kernel(): bug: interrupts were enabled early\n"); |
diff --git a/kernel/Makefile b/kernel/Makefile index 188c43223f5..1c9938addb9 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -9,7 +9,7 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \ | |||
9 | rcupdate.o extable.o params.o posix-timers.o \ | 9 | rcupdate.o extable.o params.o posix-timers.o \ |
10 | kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ | 10 | kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ |
11 | hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \ | 11 | hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \ |
12 | notifier.o ksysfs.o pm_qos_params.o | 12 | notifier.o ksysfs.o pm_qos_params.o sched_clock.o |
13 | 13 | ||
14 | obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o | 14 | obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o |
15 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 15 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 8da627d3380..86ea9e34e32 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1031,11 +1031,9 @@ int current_cpuset_is_being_rebound(void) | |||
1031 | return task_cs(current) == cpuset_being_rebound; | 1031 | return task_cs(current) == cpuset_being_rebound; |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | static int update_relax_domain_level(struct cpuset *cs, char *buf) | 1034 | static int update_relax_domain_level(struct cpuset *cs, s64 val) |
1035 | { | 1035 | { |
1036 | int val = simple_strtol(buf, NULL, 10); | 1036 | if ((int)val < 0) |
1037 | |||
1038 | if (val < 0) | ||
1039 | val = -1; | 1037 | val = -1; |
1040 | 1038 | ||
1041 | if (val != cs->relax_domain_level) { | 1039 | if (val != cs->relax_domain_level) { |
@@ -1280,9 +1278,6 @@ static ssize_t cpuset_common_file_write(struct cgroup *cont, | |||
1280 | case FILE_MEMLIST: | 1278 | case FILE_MEMLIST: |
1281 | retval = update_nodemask(cs, buffer); | 1279 | retval = update_nodemask(cs, buffer); |
1282 | break; | 1280 | break; |
1283 | case FILE_SCHED_RELAX_DOMAIN_LEVEL: | ||
1284 | retval = update_relax_domain_level(cs, buffer); | ||
1285 | break; | ||
1286 | default: | 1281 | default: |
1287 | retval = -EINVAL; | 1282 | retval = -EINVAL; |
1288 | goto out2; | 1283 | goto out2; |
@@ -1348,6 +1343,30 @@ static int cpuset_write_u64(struct cgroup *cgrp, struct cftype *cft, u64 val) | |||
1348 | return retval; | 1343 | return retval; |
1349 | } | 1344 | } |
1350 | 1345 | ||
1346 | static int cpuset_write_s64(struct cgroup *cgrp, struct cftype *cft, s64 val) | ||
1347 | { | ||
1348 | int retval = 0; | ||
1349 | struct cpuset *cs = cgroup_cs(cgrp); | ||
1350 | cpuset_filetype_t type = cft->private; | ||
1351 | |||
1352 | cgroup_lock(); | ||
1353 | |||
1354 | if (cgroup_is_removed(cgrp)) { | ||
1355 | cgroup_unlock(); | ||
1356 | return -ENODEV; | ||
1357 | } | ||
1358 | switch (type) { | ||
1359 | case FILE_SCHED_RELAX_DOMAIN_LEVEL: | ||
1360 | retval = update_relax_domain_level(cs, val); | ||
1361 | break; | ||
1362 | default: | ||
1363 | retval = -EINVAL; | ||
1364 | break; | ||
1365 | } | ||
1366 | cgroup_unlock(); | ||
1367 | return retval; | ||
1368 | } | ||
1369 | |||
1351 | /* | 1370 | /* |
1352 | * These ascii lists should be read in a single call, by using a user | 1371 | * These ascii lists should be read in a single call, by using a user |
1353 | * buffer large enough to hold the entire map. If read in smaller | 1372 | * buffer large enough to hold the entire map. If read in smaller |
@@ -1406,9 +1425,6 @@ static ssize_t cpuset_common_file_read(struct cgroup *cont, | |||
1406 | case FILE_MEMLIST: | 1425 | case FILE_MEMLIST: |
1407 | s += cpuset_sprintf_memlist(s, cs); | 1426 | s += cpuset_sprintf_memlist(s, cs); |
1408 | break; | 1427 | break; |
1409 | case FILE_SCHED_RELAX_DOMAIN_LEVEL: | ||
1410 | s += sprintf(s, "%d", cs->relax_domain_level); | ||
1411 | break; | ||
1412 | default: | 1428 | default: |
1413 | retval = -EINVAL; | 1429 | retval = -EINVAL; |
1414 | goto out; | 1430 | goto out; |
@@ -1449,6 +1465,18 @@ static u64 cpuset_read_u64(struct cgroup *cont, struct cftype *cft) | |||
1449 | } | 1465 | } |
1450 | } | 1466 | } |
1451 | 1467 | ||
1468 | static s64 cpuset_read_s64(struct cgroup *cont, struct cftype *cft) | ||
1469 | { | ||
1470 | struct cpuset *cs = cgroup_cs(cont); | ||
1471 | cpuset_filetype_t type = cft->private; | ||
1472 | switch (type) { | ||
1473 | case FILE_SCHED_RELAX_DOMAIN_LEVEL: | ||
1474 | return cs->relax_domain_level; | ||
1475 | default: | ||
1476 | BUG(); | ||
1477 | } | ||
1478 | } | ||
1479 | |||
1452 | 1480 | ||
1453 | /* | 1481 | /* |
1454 | * for the common functions, 'private' gives the type of file | 1482 | * for the common functions, 'private' gives the type of file |
@@ -1499,8 +1527,8 @@ static struct cftype files[] = { | |||
1499 | 1527 | ||
1500 | { | 1528 | { |
1501 | .name = "sched_relax_domain_level", | 1529 | .name = "sched_relax_domain_level", |
1502 | .read_u64 = cpuset_read_u64, | 1530 | .read_s64 = cpuset_read_s64, |
1503 | .write_u64 = cpuset_write_u64, | 1531 | .write_s64 = cpuset_write_s64, |
1504 | .private = FILE_SCHED_RELAX_DOMAIN_LEVEL, | 1532 | .private = FILE_SCHED_RELAX_DOMAIN_LEVEL, |
1505 | }, | 1533 | }, |
1506 | 1534 | ||
diff --git a/kernel/futex.c b/kernel/futex.c index 98092c9817f..449def8074f 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -104,10 +104,6 @@ struct futex_q { | |||
104 | /* Key which the futex is hashed on: */ | 104 | /* Key which the futex is hashed on: */ |
105 | union futex_key key; | 105 | union futex_key key; |
106 | 106 | ||
107 | /* For fd, sigio sent using these: */ | ||
108 | int fd; | ||
109 | struct file *filp; | ||
110 | |||
111 | /* Optional priority inheritance state: */ | 107 | /* Optional priority inheritance state: */ |
112 | struct futex_pi_state *pi_state; | 108 | struct futex_pi_state *pi_state; |
113 | struct task_struct *task; | 109 | struct task_struct *task; |
@@ -126,9 +122,6 @@ struct futex_hash_bucket { | |||
126 | 122 | ||
127 | static struct futex_hash_bucket futex_queues[1<<FUTEX_HASHBITS]; | 123 | static struct futex_hash_bucket futex_queues[1<<FUTEX_HASHBITS]; |
128 | 124 | ||
129 | /* Futex-fs vfsmount entry: */ | ||
130 | static struct vfsmount *futex_mnt; | ||
131 | |||
132 | /* | 125 | /* |
133 | * Take mm->mmap_sem, when futex is shared | 126 | * Take mm->mmap_sem, when futex is shared |
134 | */ | 127 | */ |
@@ -610,8 +603,6 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb, | |||
610 | static void wake_futex(struct futex_q *q) | 603 | static void wake_futex(struct futex_q *q) |
611 | { | 604 | { |
612 | plist_del(&q->list, &q->list.plist); | 605 | plist_del(&q->list, &q->list.plist); |
613 | if (q->filp) | ||
614 | send_sigio(&q->filp->f_owner, q->fd, POLL_IN); | ||
615 | /* | 606 | /* |
616 | * The lock in wake_up_all() is a crucial memory barrier after the | 607 | * The lock in wake_up_all() is a crucial memory barrier after the |
617 | * plist_del() and also before assigning to q->lock_ptr. | 608 | * plist_del() and also before assigning to q->lock_ptr. |
@@ -988,14 +979,10 @@ out: | |||
988 | } | 979 | } |
989 | 980 | ||
990 | /* The key must be already stored in q->key. */ | 981 | /* The key must be already stored in q->key. */ |
991 | static inline struct futex_hash_bucket * | 982 | static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) |
992 | queue_lock(struct futex_q *q, int fd, struct file *filp) | ||
993 | { | 983 | { |
994 | struct futex_hash_bucket *hb; | 984 | struct futex_hash_bucket *hb; |
995 | 985 | ||
996 | q->fd = fd; | ||
997 | q->filp = filp; | ||
998 | |||
999 | init_waitqueue_head(&q->waiters); | 986 | init_waitqueue_head(&q->waiters); |
1000 | 987 | ||
1001 | get_futex_key_refs(&q->key); | 988 | get_futex_key_refs(&q->key); |
@@ -1006,7 +993,7 @@ queue_lock(struct futex_q *q, int fd, struct file *filp) | |||
1006 | return hb; | 993 | return hb; |
1007 | } | 994 | } |
1008 | 995 | ||
1009 | static inline void __queue_me(struct futex_q *q, struct futex_hash_bucket *hb) | 996 | static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) |
1010 | { | 997 | { |
1011 | int prio; | 998 | int prio; |
1012 | 999 | ||
@@ -1041,15 +1028,6 @@ queue_unlock(struct futex_q *q, struct futex_hash_bucket *hb) | |||
1041 | * exactly once. They are called with the hashed spinlock held. | 1028 | * exactly once. They are called with the hashed spinlock held. |
1042 | */ | 1029 | */ |
1043 | 1030 | ||
1044 | /* The key must be already stored in q->key. */ | ||
1045 | static void queue_me(struct futex_q *q, int fd, struct file *filp) | ||
1046 | { | ||
1047 | struct futex_hash_bucket *hb; | ||
1048 | |||
1049 | hb = queue_lock(q, fd, filp); | ||
1050 | __queue_me(q, hb); | ||
1051 | } | ||
1052 | |||
1053 | /* Return 1 if we were still queued (ie. 0 means we were woken) */ | 1031 | /* Return 1 if we were still queued (ie. 0 means we were woken) */ |
1054 | static int unqueue_me(struct futex_q *q) | 1032 | static int unqueue_me(struct futex_q *q) |
1055 | { | 1033 | { |
@@ -1194,7 +1172,7 @@ static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared, | |||
1194 | if (unlikely(ret != 0)) | 1172 | if (unlikely(ret != 0)) |
1195 | goto out_release_sem; | 1173 | goto out_release_sem; |
1196 | 1174 | ||
1197 | hb = queue_lock(&q, -1, NULL); | 1175 | hb = queue_lock(&q); |
1198 | 1176 | ||
1199 | /* | 1177 | /* |
1200 | * Access the page AFTER the futex is queued. | 1178 | * Access the page AFTER the futex is queued. |
@@ -1238,7 +1216,7 @@ static int futex_wait(u32 __user *uaddr, struct rw_semaphore *fshared, | |||
1238 | goto out_unlock_release_sem; | 1216 | goto out_unlock_release_sem; |
1239 | 1217 | ||
1240 | /* Only actually queue if *uaddr contained val. */ | 1218 | /* Only actually queue if *uaddr contained val. */ |
1241 | __queue_me(&q, hb); | 1219 | queue_me(&q, hb); |
1242 | 1220 | ||
1243 | /* | 1221 | /* |
1244 | * Now the futex is queued and we have checked the data, we | 1222 | * Now the futex is queued and we have checked the data, we |
@@ -1386,7 +1364,7 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared, | |||
1386 | goto out_release_sem; | 1364 | goto out_release_sem; |
1387 | 1365 | ||
1388 | retry_unlocked: | 1366 | retry_unlocked: |
1389 | hb = queue_lock(&q, -1, NULL); | 1367 | hb = queue_lock(&q); |
1390 | 1368 | ||
1391 | retry_locked: | 1369 | retry_locked: |
1392 | ret = lock_taken = 0; | 1370 | ret = lock_taken = 0; |
@@ -1499,7 +1477,7 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared, | |||
1499 | /* | 1477 | /* |
1500 | * Only actually queue now that the atomic ops are done: | 1478 | * Only actually queue now that the atomic ops are done: |
1501 | */ | 1479 | */ |
1502 | __queue_me(&q, hb); | 1480 | queue_me(&q, hb); |
1503 | 1481 | ||
1504 | /* | 1482 | /* |
1505 | * Now the futex is queued and we have checked the data, we | 1483 | * Now the futex is queued and we have checked the data, we |
@@ -1746,121 +1724,6 @@ pi_faulted: | |||
1746 | return ret; | 1724 | return ret; |
1747 | } | 1725 | } |
1748 | 1726 | ||
1749 | static int futex_close(struct inode *inode, struct file *filp) | ||
1750 | { | ||
1751 | struct futex_q *q = filp->private_data; | ||
1752 | |||
1753 | unqueue_me(q); | ||
1754 | kfree(q); | ||
1755 | |||
1756 | return 0; | ||
1757 | } | ||
1758 | |||
1759 | /* This is one-shot: once it's gone off you need a new fd */ | ||
1760 | static unsigned int futex_poll(struct file *filp, | ||
1761 | struct poll_table_struct *wait) | ||
1762 | { | ||
1763 | struct futex_q *q = filp->private_data; | ||
1764 | int ret = 0; | ||
1765 | |||
1766 | poll_wait(filp, &q->waiters, wait); | ||
1767 | |||
1768 | /* | ||
1769 | * plist_node_empty() is safe here without any lock. | ||
1770 | * q->lock_ptr != 0 is not safe, because of ordering against wakeup. | ||
1771 | */ | ||
1772 | if (plist_node_empty(&q->list)) | ||
1773 | ret = POLLIN | POLLRDNORM; | ||
1774 | |||
1775 | return ret; | ||
1776 | } | ||
1777 | |||
1778 | static const struct file_operations futex_fops = { | ||
1779 | .release = futex_close, | ||
1780 | .poll = futex_poll, | ||
1781 | }; | ||
1782 | |||
1783 | /* | ||
1784 | * Signal allows caller to avoid the race which would occur if they | ||
1785 | * set the sigio stuff up afterwards. | ||
1786 | */ | ||
1787 | static int futex_fd(u32 __user *uaddr, int signal) | ||
1788 | { | ||
1789 | struct futex_q *q; | ||
1790 | struct file *filp; | ||
1791 | int ret, err; | ||
1792 | struct rw_semaphore *fshared; | ||
1793 | static unsigned long printk_interval; | ||
1794 | |||
1795 | if (printk_timed_ratelimit(&printk_interval, 60 * 60 * 1000)) { | ||
1796 | printk(KERN_WARNING "Process `%s' used FUTEX_FD, which " | ||
1797 | "will be removed from the kernel in June 2007\n", | ||
1798 | current->comm); | ||
1799 | } | ||
1800 | |||
1801 | ret = -EINVAL; | ||
1802 | if (!valid_signal(signal)) | ||
1803 | goto out; | ||
1804 | |||
1805 | ret = get_unused_fd(); | ||
1806 | if (ret < 0) | ||
1807 | goto out; | ||
1808 | filp = get_empty_filp(); | ||
1809 | if (!filp) { | ||
1810 | put_unused_fd(ret); | ||
1811 | ret = -ENFILE; | ||
1812 | goto out; | ||
1813 | } | ||
1814 | filp->f_op = &futex_fops; | ||
1815 | filp->f_path.mnt = mntget(futex_mnt); | ||
1816 | filp->f_path.dentry = dget(futex_mnt->mnt_root); | ||
1817 | filp->f_mapping = filp->f_path.dentry->d_inode->i_mapping; | ||
1818 | |||
1819 | if (signal) { | ||
1820 | err = __f_setown(filp, task_pid(current), PIDTYPE_PID, 1); | ||
1821 | if (err < 0) { | ||
1822 | goto error; | ||
1823 | } | ||
1824 | filp->f_owner.signum = signal; | ||
1825 | } | ||
1826 | |||
1827 | q = kmalloc(sizeof(*q), GFP_KERNEL); | ||
1828 | if (!q) { | ||
1829 | err = -ENOMEM; | ||
1830 | goto error; | ||
1831 | } | ||
1832 | q->pi_state = NULL; | ||
1833 | |||
1834 | fshared = ¤t->mm->mmap_sem; | ||
1835 | down_read(fshared); | ||
1836 | err = get_futex_key(uaddr, fshared, &q->key); | ||
1837 | |||
1838 | if (unlikely(err != 0)) { | ||
1839 | up_read(fshared); | ||
1840 | kfree(q); | ||
1841 | goto error; | ||
1842 | } | ||
1843 | |||
1844 | /* | ||
1845 | * queue_me() must be called before releasing mmap_sem, because | ||
1846 | * key->shared.inode needs to be referenced while holding it. | ||
1847 | */ | ||
1848 | filp->private_data = q; | ||
1849 | |||
1850 | queue_me(q, ret, filp); | ||
1851 | up_read(fshared); | ||
1852 | |||
1853 | /* Now we map fd to filp, so userspace can access it */ | ||
1854 | fd_install(ret, filp); | ||
1855 | out: | ||
1856 | return ret; | ||
1857 | error: | ||
1858 | put_unused_fd(ret); | ||
1859 | put_filp(filp); | ||
1860 | ret = err; | ||
1861 | goto out; | ||
1862 | } | ||
1863 | |||
1864 | /* | 1727 | /* |
1865 | * Support for robust futexes: the kernel cleans up held futexes at | 1728 | * Support for robust futexes: the kernel cleans up held futexes at |
1866 | * thread exit time. | 1729 | * thread exit time. |
@@ -2092,10 +1955,6 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, | |||
2092 | case FUTEX_WAKE_BITSET: | 1955 | case FUTEX_WAKE_BITSET: |
2093 | ret = futex_wake(uaddr, fshared, val, val3); | 1956 | ret = futex_wake(uaddr, fshared, val, val3); |
2094 | break; | 1957 | break; |
2095 | case FUTEX_FD: | ||
2096 | /* non-zero val means F_SETOWN(getpid()) & F_SETSIG(val) */ | ||
2097 | ret = futex_fd(uaddr, val); | ||
2098 | break; | ||
2099 | case FUTEX_REQUEUE: | 1958 | case FUTEX_REQUEUE: |
2100 | ret = futex_requeue(uaddr, fshared, uaddr2, val, val2, NULL); | 1959 | ret = futex_requeue(uaddr, fshared, uaddr2, val, val2, NULL); |
2101 | break; | 1960 | break; |
@@ -2156,19 +2015,6 @@ asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val, | |||
2156 | return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); | 2015 | return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); |
2157 | } | 2016 | } |
2158 | 2017 | ||
2159 | static int futexfs_get_sb(struct file_system_type *fs_type, | ||
2160 | int flags, const char *dev_name, void *data, | ||
2161 | struct vfsmount *mnt) | ||
2162 | { | ||
2163 | return get_sb_pseudo(fs_type, "futex", NULL, FUTEXFS_SUPER_MAGIC, mnt); | ||
2164 | } | ||
2165 | |||
2166 | static struct file_system_type futex_fs_type = { | ||
2167 | .name = "futexfs", | ||
2168 | .get_sb = futexfs_get_sb, | ||
2169 | .kill_sb = kill_anon_super, | ||
2170 | }; | ||
2171 | |||
2172 | static int __init futex_init(void) | 2018 | static int __init futex_init(void) |
2173 | { | 2019 | { |
2174 | u32 curval; | 2020 | u32 curval; |
@@ -2193,16 +2039,6 @@ static int __init futex_init(void) | |||
2193 | spin_lock_init(&futex_queues[i].lock); | 2039 | spin_lock_init(&futex_queues[i].lock); |
2194 | } | 2040 | } |
2195 | 2041 | ||
2196 | i = register_filesystem(&futex_fs_type); | ||
2197 | if (i) | ||
2198 | return i; | ||
2199 | |||
2200 | futex_mnt = kern_mount(&futex_fs_type); | ||
2201 | if (IS_ERR(futex_mnt)) { | ||
2202 | unregister_filesystem(&futex_fs_type); | ||
2203 | return PTR_ERR(futex_mnt); | ||
2204 | } | ||
2205 | |||
2206 | return 0; | 2042 | return 0; |
2207 | } | 2043 | } |
2208 | __initcall(futex_init); | 2044 | __initcall(futex_init); |
diff --git a/kernel/kgdb.c b/kernel/kgdb.c index 1bd0ec1c80b..39e31a036f5 100644 --- a/kernel/kgdb.c +++ b/kernel/kgdb.c | |||
@@ -61,7 +61,7 @@ struct kgdb_state { | |||
61 | int err_code; | 61 | int err_code; |
62 | int cpu; | 62 | int cpu; |
63 | int pass_exception; | 63 | int pass_exception; |
64 | long threadid; | 64 | unsigned long threadid; |
65 | long kgdb_usethreadid; | 65 | long kgdb_usethreadid; |
66 | struct pt_regs *linux_regs; | 66 | struct pt_regs *linux_regs; |
67 | }; | 67 | }; |
@@ -146,7 +146,7 @@ atomic_t kgdb_cpu_doing_single_step = ATOMIC_INIT(-1); | |||
146 | * the other CPUs might interfere with your debugging context, so | 146 | * the other CPUs might interfere with your debugging context, so |
147 | * use this with care: | 147 | * use this with care: |
148 | */ | 148 | */ |
149 | int kgdb_do_roundup = 1; | 149 | static int kgdb_do_roundup = 1; |
150 | 150 | ||
151 | static int __init opt_nokgdbroundup(char *str) | 151 | static int __init opt_nokgdbroundup(char *str) |
152 | { | 152 | { |
@@ -438,7 +438,7 @@ int kgdb_hex2mem(char *buf, char *mem, int count) | |||
438 | * While we find nice hex chars, build a long_val. | 438 | * While we find nice hex chars, build a long_val. |
439 | * Return number of chars processed. | 439 | * Return number of chars processed. |
440 | */ | 440 | */ |
441 | int kgdb_hex2long(char **ptr, long *long_val) | 441 | int kgdb_hex2long(char **ptr, unsigned long *long_val) |
442 | { | 442 | { |
443 | int hex_val; | 443 | int hex_val; |
444 | int num = 0; | 444 | int num = 0; |
@@ -709,7 +709,7 @@ int kgdb_isremovedbreak(unsigned long addr) | |||
709 | return 0; | 709 | return 0; |
710 | } | 710 | } |
711 | 711 | ||
712 | int remove_all_break(void) | 712 | static int remove_all_break(void) |
713 | { | 713 | { |
714 | unsigned long addr; | 714 | unsigned long addr; |
715 | int error; | 715 | int error; |
diff --git a/kernel/module.c b/kernel/module.c index 8674a390a2e..f5e9491ef7a 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -890,6 +890,19 @@ static struct module_attribute *modinfo_attrs[] = { | |||
890 | 890 | ||
891 | static const char vermagic[] = VERMAGIC_STRING; | 891 | static const char vermagic[] = VERMAGIC_STRING; |
892 | 892 | ||
893 | static int try_to_force_load(struct module *mod, const char *symname) | ||
894 | { | ||
895 | #ifdef CONFIG_MODULE_FORCE_LOAD | ||
896 | if (!(tainted & TAINT_FORCED_MODULE)) | ||
897 | printk("%s: no version for \"%s\" found: kernel tainted.\n", | ||
898 | mod->name, symname); | ||
899 | add_taint_module(mod, TAINT_FORCED_MODULE); | ||
900 | return 0; | ||
901 | #else | ||
902 | return -ENOEXEC; | ||
903 | #endif | ||
904 | } | ||
905 | |||
893 | #ifdef CONFIG_MODVERSIONS | 906 | #ifdef CONFIG_MODVERSIONS |
894 | static int check_version(Elf_Shdr *sechdrs, | 907 | static int check_version(Elf_Shdr *sechdrs, |
895 | unsigned int versindex, | 908 | unsigned int versindex, |
@@ -904,6 +917,10 @@ static int check_version(Elf_Shdr *sechdrs, | |||
904 | if (!crc) | 917 | if (!crc) |
905 | return 1; | 918 | return 1; |
906 | 919 | ||
920 | /* No versions at all? modprobe --force does this. */ | ||
921 | if (versindex == 0) | ||
922 | return try_to_force_load(mod, symname) == 0; | ||
923 | |||
907 | versions = (void *) sechdrs[versindex].sh_addr; | 924 | versions = (void *) sechdrs[versindex].sh_addr; |
908 | num_versions = sechdrs[versindex].sh_size | 925 | num_versions = sechdrs[versindex].sh_size |
909 | / sizeof(struct modversion_info); | 926 | / sizeof(struct modversion_info); |
@@ -914,18 +931,19 @@ static int check_version(Elf_Shdr *sechdrs, | |||
914 | 931 | ||
915 | if (versions[i].crc == *crc) | 932 | if (versions[i].crc == *crc) |
916 | return 1; | 933 | return 1; |
917 | printk("%s: disagrees about version of symbol %s\n", | ||
918 | mod->name, symname); | ||
919 | DEBUGP("Found checksum %lX vs module %lX\n", | 934 | DEBUGP("Found checksum %lX vs module %lX\n", |
920 | *crc, versions[i].crc); | 935 | *crc, versions[i].crc); |
921 | return 0; | 936 | goto bad_version; |
922 | } | 937 | } |
923 | /* Not in module's version table. OK, but that taints the kernel. */ | 938 | |
924 | if (!(tainted & TAINT_FORCED_MODULE)) | 939 | printk(KERN_WARNING "%s: no symbol version for %s\n", |
925 | printk("%s: no version for \"%s\" found: kernel tainted.\n", | 940 | mod->name, symname); |
926 | mod->name, symname); | 941 | return 0; |
927 | add_taint_module(mod, TAINT_FORCED_MODULE); | 942 | |
928 | return 1; | 943 | bad_version: |
944 | printk("%s: disagrees about version of symbol %s\n", | ||
945 | mod->name, symname); | ||
946 | return 0; | ||
929 | } | 947 | } |
930 | 948 | ||
931 | static inline int check_modstruct_version(Elf_Shdr *sechdrs, | 949 | static inline int check_modstruct_version(Elf_Shdr *sechdrs, |
@@ -939,11 +957,14 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, | |||
939 | return check_version(sechdrs, versindex, "struct_module", mod, crc); | 957 | return check_version(sechdrs, versindex, "struct_module", mod, crc); |
940 | } | 958 | } |
941 | 959 | ||
942 | /* First part is kernel version, which we ignore. */ | 960 | /* First part is kernel version, which we ignore if module has crcs. */ |
943 | static inline int same_magic(const char *amagic, const char *bmagic) | 961 | static inline int same_magic(const char *amagic, const char *bmagic, |
962 | bool has_crcs) | ||
944 | { | 963 | { |
945 | amagic += strcspn(amagic, " "); | 964 | if (has_crcs) { |
946 | bmagic += strcspn(bmagic, " "); | 965 | amagic += strcspn(amagic, " "); |
966 | bmagic += strcspn(bmagic, " "); | ||
967 | } | ||
947 | return strcmp(amagic, bmagic) == 0; | 968 | return strcmp(amagic, bmagic) == 0; |
948 | } | 969 | } |
949 | #else | 970 | #else |
@@ -963,7 +984,8 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, | |||
963 | return 1; | 984 | return 1; |
964 | } | 985 | } |
965 | 986 | ||
966 | static inline int same_magic(const char *amagic, const char *bmagic) | 987 | static inline int same_magic(const char *amagic, const char *bmagic, |
988 | bool has_crcs) | ||
967 | { | 989 | { |
968 | return strcmp(amagic, bmagic) == 0; | 990 | return strcmp(amagic, bmagic) == 0; |
969 | } | 991 | } |
@@ -1853,10 +1875,10 @@ static struct module *load_module(void __user *umod, | |||
1853 | modmagic = get_modinfo(sechdrs, infoindex, "vermagic"); | 1875 | modmagic = get_modinfo(sechdrs, infoindex, "vermagic"); |
1854 | /* This is allowed: modprobe --force will invalidate it. */ | 1876 | /* This is allowed: modprobe --force will invalidate it. */ |
1855 | if (!modmagic) { | 1877 | if (!modmagic) { |
1856 | add_taint_module(mod, TAINT_FORCED_MODULE); | 1878 | err = try_to_force_load(mod, "magic"); |
1857 | printk(KERN_WARNING "%s: no version magic, tainting kernel.\n", | 1879 | if (err) |
1858 | mod->name); | 1880 | goto free_hdr; |
1859 | } else if (!same_magic(modmagic, vermagic)) { | 1881 | } else if (!same_magic(modmagic, vermagic, versindex)) { |
1860 | printk(KERN_ERR "%s: version magic '%s' should be '%s'\n", | 1882 | printk(KERN_ERR "%s: version magic '%s' should be '%s'\n", |
1861 | mod->name, modmagic, vermagic); | 1883 | mod->name, modmagic, vermagic); |
1862 | err = -ENOEXEC; | 1884 | err = -ENOEXEC; |
@@ -2006,9 +2028,10 @@ static struct module *load_module(void __user *umod, | |||
2006 | (mod->num_gpl_future_syms && !gplfuturecrcindex) || | 2028 | (mod->num_gpl_future_syms && !gplfuturecrcindex) || |
2007 | (mod->num_unused_syms && !unusedcrcindex) || | 2029 | (mod->num_unused_syms && !unusedcrcindex) || |
2008 | (mod->num_unused_gpl_syms && !unusedgplcrcindex)) { | 2030 | (mod->num_unused_gpl_syms && !unusedgplcrcindex)) { |
2009 | printk(KERN_WARNING "%s: No versions for exported symbols." | 2031 | printk(KERN_WARNING "%s: No versions for exported symbols.\n", mod->name); |
2010 | " Tainting kernel.\n", mod->name); | 2032 | err = try_to_force_load(mod, "nocrc"); |
2011 | add_taint_module(mod, TAINT_FORCED_MODULE); | 2033 | if (err) |
2034 | goto cleanup; | ||
2012 | } | 2035 | } |
2013 | #endif | 2036 | #endif |
2014 | markersindex = find_sec(hdr, sechdrs, secstrings, "__markers"); | 2037 | markersindex = find_sec(hdr, sechdrs, secstrings, "__markers"); |
diff --git a/kernel/relay.c b/kernel/relay.c index 7de644cdec4..bc24dcdc570 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -1191,7 +1191,7 @@ static ssize_t relay_file_splice_read(struct file *in, | |||
1191 | ret = 0; | 1191 | ret = 0; |
1192 | spliced = 0; | 1192 | spliced = 0; |
1193 | 1193 | ||
1194 | while (len && !spliced) { | 1194 | while (len) { |
1195 | ret = subbuf_splice_actor(in, ppos, pipe, len, flags, &nonpad_ret); | 1195 | ret = subbuf_splice_actor(in, ppos, pipe, len, flags, &nonpad_ret); |
1196 | if (ret < 0) | 1196 | if (ret < 0) |
1197 | break; | 1197 | break; |
diff --git a/kernel/sched.c b/kernel/sched.c index 34bcc5bc120..c51b6565e07 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -75,16 +75,6 @@ | |||
75 | #include <asm/irq_regs.h> | 75 | #include <asm/irq_regs.h> |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * Scheduler clock - returns current time in nanosec units. | ||
79 | * This is default implementation. | ||
80 | * Architectures and sub-architectures can override this. | ||
81 | */ | ||
82 | unsigned long long __attribute__((weak)) sched_clock(void) | ||
83 | { | ||
84 | return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ); | ||
85 | } | ||
86 | |||
87 | /* | ||
88 | * Convert user-nice values [ -20 ... 0 ... 19 ] | 78 | * Convert user-nice values [ -20 ... 0 ... 19 ] |
89 | * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ], | 79 | * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ], |
90 | * and back. | 80 | * and back. |
@@ -242,6 +232,12 @@ static void destroy_rt_bandwidth(struct rt_bandwidth *rt_b) | |||
242 | } | 232 | } |
243 | #endif | 233 | #endif |
244 | 234 | ||
235 | /* | ||
236 | * sched_domains_mutex serializes calls to arch_init_sched_domains, | ||
237 | * detach_destroy_domains and partition_sched_domains. | ||
238 | */ | ||
239 | static DEFINE_MUTEX(sched_domains_mutex); | ||
240 | |||
245 | #ifdef CONFIG_GROUP_SCHED | 241 | #ifdef CONFIG_GROUP_SCHED |
246 | 242 | ||
247 | #include <linux/cgroup.h> | 243 | #include <linux/cgroup.h> |
@@ -308,9 +304,6 @@ static DEFINE_PER_CPU(struct rt_rq, init_rt_rq) ____cacheline_aligned_in_smp; | |||
308 | */ | 304 | */ |
309 | static DEFINE_SPINLOCK(task_group_lock); | 305 | static DEFINE_SPINLOCK(task_group_lock); |
310 | 306 | ||
311 | /* doms_cur_mutex serializes access to doms_cur[] array */ | ||
312 | static DEFINE_MUTEX(doms_cur_mutex); | ||
313 | |||
314 | #ifdef CONFIG_FAIR_GROUP_SCHED | 307 | #ifdef CONFIG_FAIR_GROUP_SCHED |
315 | #ifdef CONFIG_USER_SCHED | 308 | #ifdef CONFIG_USER_SCHED |
316 | # define INIT_TASK_GROUP_LOAD (2*NICE_0_LOAD) | 309 | # define INIT_TASK_GROUP_LOAD (2*NICE_0_LOAD) |
@@ -318,7 +311,13 @@ static DEFINE_MUTEX(doms_cur_mutex); | |||
318 | # define INIT_TASK_GROUP_LOAD NICE_0_LOAD | 311 | # define INIT_TASK_GROUP_LOAD NICE_0_LOAD |
319 | #endif | 312 | #endif |
320 | 313 | ||
314 | /* | ||
315 | * A weight of 0, 1 or ULONG_MAX can cause arithmetics problems. | ||
316 | * (The default weight is 1024 - so there's no practical | ||
317 | * limitation from this.) | ||
318 | */ | ||
321 | #define MIN_SHARES 2 | 319 | #define MIN_SHARES 2 |
320 | #define MAX_SHARES (ULONG_MAX - 1) | ||
322 | 321 | ||
323 | static int init_task_group_load = INIT_TASK_GROUP_LOAD; | 322 | static int init_task_group_load = INIT_TASK_GROUP_LOAD; |
324 | #endif | 323 | #endif |
@@ -358,21 +357,9 @@ static inline void set_task_rq(struct task_struct *p, unsigned int cpu) | |||
358 | #endif | 357 | #endif |
359 | } | 358 | } |
360 | 359 | ||
361 | static inline void lock_doms_cur(void) | ||
362 | { | ||
363 | mutex_lock(&doms_cur_mutex); | ||
364 | } | ||
365 | |||
366 | static inline void unlock_doms_cur(void) | ||
367 | { | ||
368 | mutex_unlock(&doms_cur_mutex); | ||
369 | } | ||
370 | |||
371 | #else | 360 | #else |
372 | 361 | ||
373 | static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { } | 362 | static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { } |
374 | static inline void lock_doms_cur(void) { } | ||
375 | static inline void unlock_doms_cur(void) { } | ||
376 | 363 | ||
377 | #endif /* CONFIG_GROUP_SCHED */ | 364 | #endif /* CONFIG_GROUP_SCHED */ |
378 | 365 | ||
@@ -560,13 +547,7 @@ struct rq { | |||
560 | unsigned long next_balance; | 547 | unsigned long next_balance; |
561 | struct mm_struct *prev_mm; | 548 | struct mm_struct *prev_mm; |
562 | 549 | ||
563 | u64 clock, prev_clock_raw; | 550 | u64 clock; |
564 | s64 clock_max_delta; | ||
565 | |||
566 | unsigned int clock_warps, clock_overflows, clock_underflows; | ||
567 | u64 idle_clock; | ||
568 | unsigned int clock_deep_idle_events; | ||
569 | u64 tick_timestamp; | ||
570 | 551 | ||
571 | atomic_t nr_iowait; | 552 | atomic_t nr_iowait; |
572 | 553 | ||
@@ -631,82 +612,6 @@ static inline int cpu_of(struct rq *rq) | |||
631 | #endif | 612 | #endif |
632 | } | 613 | } |
633 | 614 | ||
634 | #ifdef CONFIG_NO_HZ | ||
635 | static inline bool nohz_on(int cpu) | ||
636 | { | ||
637 | return tick_get_tick_sched(cpu)->nohz_mode != NOHZ_MODE_INACTIVE; | ||
638 | } | ||
639 | |||
640 | static inline u64 max_skipped_ticks(struct rq *rq) | ||
641 | { | ||
642 | return nohz_on(cpu_of(rq)) ? jiffies - rq->last_tick_seen + 2 : 1; | ||
643 | } | ||
644 | |||
645 | static inline void update_last_tick_seen(struct rq *rq) | ||
646 | { | ||
647 | rq->last_tick_seen = jiffies; | ||
648 | } | ||
649 | #else | ||
650 | static inline u64 max_skipped_ticks(struct rq *rq) | ||
651 | { | ||
652 | return 1; | ||
653 | } | ||
654 | |||
655 | static inline void update_last_tick_seen(struct rq *rq) | ||
656 | { | ||
657 | } | ||
658 | #endif | ||
659 | |||
660 | /* | ||
661 | * Update the per-runqueue clock, as finegrained as the platform can give | ||
662 | * us, but without assuming monotonicity, etc.: | ||
663 | */ | ||
664 | static void __update_rq_clock(struct rq *rq) | ||
665 | { | ||
666 | u64 prev_raw = rq->prev_clock_raw; | ||
667 | u64 now = sched_clock(); | ||
668 | s64 delta = now - prev_raw; | ||
669 | u64 clock = rq->clock; | ||
670 | |||
671 | #ifdef CONFIG_SCHED_DEBUG | ||
672 | WARN_ON_ONCE(cpu_of(rq) != smp_processor_id()); | ||
673 | #endif | ||
674 | /* | ||
675 | * Protect against sched_clock() occasionally going backwards: | ||
676 | */ | ||
677 | if (unlikely(delta < 0)) { | ||
678 | clock++; | ||
679 | rq->clock_warps++; | ||
680 | } else { | ||
681 | /* | ||
682 | * Catch too large forward jumps too: | ||
683 | */ | ||
684 | u64 max_jump = max_skipped_ticks(rq) * TICK_NSEC; | ||
685 | u64 max_time = rq->tick_timestamp + max_jump; | ||
686 | |||
687 | if (unlikely(clock + delta > max_time)) { | ||
688 | if (clock < max_time) | ||
689 | clock = max_time; | ||
690 | else | ||
691 | clock++; | ||
692 | rq->clock_overflows++; | ||
693 | } else { | ||
694 | if (unlikely(delta > rq->clock_max_delta)) | ||
695 | rq->clock_max_delta = delta; | ||
696 | clock += delta; | ||
697 | } | ||
698 | } | ||
699 | |||
700 | rq->prev_clock_raw = now; | ||
701 | rq->clock = clock; | ||
702 | } | ||
703 | |||
704 | static void update_rq_clock(struct rq *rq) | ||
705 | { | ||
706 | if (likely(smp_processor_id() == cpu_of(rq))) | ||
707 | __update_rq_clock(rq); | ||
708 | } | ||
709 | |||
710 | /* | 615 | /* |
711 | * The domain tree (rq->sd) is protected by RCU's quiescent state transition. | 616 | * The domain tree (rq->sd) is protected by RCU's quiescent state transition. |
712 | * See detach_destroy_domains: synchronize_sched for details. | 617 | * See detach_destroy_domains: synchronize_sched for details. |
@@ -722,6 +627,11 @@ static void update_rq_clock(struct rq *rq) | |||
722 | #define task_rq(p) cpu_rq(task_cpu(p)) | 627 | #define task_rq(p) cpu_rq(task_cpu(p)) |
723 | #define cpu_curr(cpu) (cpu_rq(cpu)->curr) | 628 | #define cpu_curr(cpu) (cpu_rq(cpu)->curr) |
724 | 629 | ||
630 | static inline void update_rq_clock(struct rq *rq) | ||
631 | { | ||
632 | rq->clock = sched_clock_cpu(cpu_of(rq)); | ||
633 | } | ||
634 | |||
725 | /* | 635 | /* |
726 | * Tunables that become constants when CONFIG_SCHED_DEBUG is off: | 636 | * Tunables that become constants when CONFIG_SCHED_DEBUG is off: |
727 | */ | 637 | */ |
@@ -757,14 +667,14 @@ const_debug unsigned int sysctl_sched_features = | |||
757 | #define SCHED_FEAT(name, enabled) \ | 667 | #define SCHED_FEAT(name, enabled) \ |
758 | #name , | 668 | #name , |
759 | 669 | ||
760 | __read_mostly char *sched_feat_names[] = { | 670 | static __read_mostly char *sched_feat_names[] = { |
761 | #include "sched_features.h" | 671 | #include "sched_features.h" |
762 | NULL | 672 | NULL |
763 | }; | 673 | }; |
764 | 674 | ||
765 | #undef SCHED_FEAT | 675 | #undef SCHED_FEAT |
766 | 676 | ||
767 | int sched_feat_open(struct inode *inode, struct file *filp) | 677 | static int sched_feat_open(struct inode *inode, struct file *filp) |
768 | { | 678 | { |
769 | filp->private_data = inode->i_private; | 679 | filp->private_data = inode->i_private; |
770 | return 0; | 680 | return 0; |
@@ -899,7 +809,7 @@ static inline u64 global_rt_runtime(void) | |||
899 | return (u64)sysctl_sched_rt_runtime * NSEC_PER_USEC; | 809 | return (u64)sysctl_sched_rt_runtime * NSEC_PER_USEC; |
900 | } | 810 | } |
901 | 811 | ||
902 | static const unsigned long long time_sync_thresh = 100000; | 812 | unsigned long long time_sync_thresh = 100000; |
903 | 813 | ||
904 | static DEFINE_PER_CPU(unsigned long long, time_offset); | 814 | static DEFINE_PER_CPU(unsigned long long, time_offset); |
905 | static DEFINE_PER_CPU(unsigned long long, prev_cpu_time); | 815 | static DEFINE_PER_CPU(unsigned long long, prev_cpu_time); |
@@ -913,11 +823,14 @@ static DEFINE_PER_CPU(unsigned long long, prev_cpu_time); | |||
913 | static DEFINE_SPINLOCK(time_sync_lock); | 823 | static DEFINE_SPINLOCK(time_sync_lock); |
914 | static unsigned long long prev_global_time; | 824 | static unsigned long long prev_global_time; |
915 | 825 | ||
916 | static unsigned long long __sync_cpu_clock(cycles_t time, int cpu) | 826 | static unsigned long long __sync_cpu_clock(unsigned long long time, int cpu) |
917 | { | 827 | { |
918 | unsigned long flags; | 828 | /* |
919 | 829 | * We want this inlined, to not get tracer function calls | |
920 | spin_lock_irqsave(&time_sync_lock, flags); | 830 | * in this critical section: |
831 | */ | ||
832 | spin_acquire(&time_sync_lock.dep_map, 0, 0, _THIS_IP_); | ||
833 | __raw_spin_lock(&time_sync_lock.raw_lock); | ||
921 | 834 | ||
922 | if (time < prev_global_time) { | 835 | if (time < prev_global_time) { |
923 | per_cpu(time_offset, cpu) += prev_global_time - time; | 836 | per_cpu(time_offset, cpu) += prev_global_time - time; |
@@ -926,7 +839,8 @@ static unsigned long long __sync_cpu_clock(cycles_t time, int cpu) | |||
926 | prev_global_time = time; | 839 | prev_global_time = time; |
927 | } | 840 | } |
928 | 841 | ||
929 | spin_unlock_irqrestore(&time_sync_lock, flags); | 842 | __raw_spin_unlock(&time_sync_lock.raw_lock); |
843 | spin_release(&time_sync_lock.dep_map, 1, _THIS_IP_); | ||
930 | 844 | ||
931 | return time; | 845 | return time; |
932 | } | 846 | } |
@@ -934,8 +848,6 @@ static unsigned long long __sync_cpu_clock(cycles_t time, int cpu) | |||
934 | static unsigned long long __cpu_clock(int cpu) | 848 | static unsigned long long __cpu_clock(int cpu) |
935 | { | 849 | { |
936 | unsigned long long now; | 850 | unsigned long long now; |
937 | unsigned long flags; | ||
938 | struct rq *rq; | ||
939 | 851 | ||
940 | /* | 852 | /* |
941 | * Only call sched_clock() if the scheduler has already been | 853 | * Only call sched_clock() if the scheduler has already been |
@@ -944,11 +856,7 @@ static unsigned long long __cpu_clock(int cpu) | |||
944 | if (unlikely(!scheduler_running)) | 856 | if (unlikely(!scheduler_running)) |
945 | return 0; | 857 | return 0; |
946 | 858 | ||
947 | local_irq_save(flags); | 859 | now = sched_clock_cpu(cpu); |
948 | rq = cpu_rq(cpu); | ||
949 | update_rq_clock(rq); | ||
950 | now = rq->clock; | ||
951 | local_irq_restore(flags); | ||
952 | 860 | ||
953 | return now; | 861 | return now; |
954 | } | 862 | } |
@@ -960,13 +868,18 @@ static unsigned long long __cpu_clock(int cpu) | |||
960 | unsigned long long cpu_clock(int cpu) | 868 | unsigned long long cpu_clock(int cpu) |
961 | { | 869 | { |
962 | unsigned long long prev_cpu_time, time, delta_time; | 870 | unsigned long long prev_cpu_time, time, delta_time; |
871 | unsigned long flags; | ||
963 | 872 | ||
873 | local_irq_save(flags); | ||
964 | prev_cpu_time = per_cpu(prev_cpu_time, cpu); | 874 | prev_cpu_time = per_cpu(prev_cpu_time, cpu); |
965 | time = __cpu_clock(cpu) + per_cpu(time_offset, cpu); | 875 | time = __cpu_clock(cpu) + per_cpu(time_offset, cpu); |
966 | delta_time = time-prev_cpu_time; | 876 | delta_time = time-prev_cpu_time; |
967 | 877 | ||
968 | if (unlikely(delta_time > time_sync_thresh)) | 878 | if (unlikely(delta_time > time_sync_thresh)) { |
969 | time = __sync_cpu_clock(time, cpu); | 879 | time = __sync_cpu_clock(time, cpu); |
880 | per_cpu(prev_cpu_time, cpu) = time; | ||
881 | } | ||
882 | local_irq_restore(flags); | ||
970 | 883 | ||
971 | return time; | 884 | return time; |
972 | } | 885 | } |
@@ -1117,43 +1030,6 @@ static struct rq *this_rq_lock(void) | |||
1117 | return rq; | 1030 | return rq; |
1118 | } | 1031 | } |
1119 | 1032 | ||
1120 | /* | ||
1121 | * We are going deep-idle (irqs are disabled): | ||
1122 | */ | ||
1123 | void sched_clock_idle_sleep_event(void) | ||
1124 | { | ||
1125 | struct rq *rq = cpu_rq(smp_processor_id()); | ||
1126 | |||
1127 | spin_lock(&rq->lock); | ||
1128 | __update_rq_clock(rq); | ||
1129 | spin_unlock(&rq->lock); | ||
1130 | rq->clock_deep_idle_events++; | ||
1131 | } | ||
1132 | EXPORT_SYMBOL_GPL(sched_clock_idle_sleep_event); | ||
1133 | |||
1134 | /* | ||
1135 | * We just idled delta nanoseconds (called with irqs disabled): | ||
1136 | */ | ||
1137 | void sched_clock_idle_wakeup_event(u64 delta_ns) | ||
1138 | { | ||
1139 | struct rq *rq = cpu_rq(smp_processor_id()); | ||
1140 | u64 now = sched_clock(); | ||
1141 | |||
1142 | rq->idle_clock += delta_ns; | ||
1143 | /* | ||
1144 | * Override the previous timestamp and ignore all | ||
1145 | * sched_clock() deltas that occured while we idled, | ||
1146 | * and use the PM-provided delta_ns to advance the | ||
1147 | * rq clock: | ||
1148 | */ | ||
1149 | spin_lock(&rq->lock); | ||
1150 | rq->prev_clock_raw = now; | ||
1151 | rq->clock += delta_ns; | ||
1152 | spin_unlock(&rq->lock); | ||
1153 | touch_softlockup_watchdog(); | ||
1154 | } | ||
1155 | EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event); | ||
1156 | |||
1157 | static void __resched_task(struct task_struct *p, int tif_bit); | 1033 | static void __resched_task(struct task_struct *p, int tif_bit); |
1158 | 1034 | ||
1159 | static inline void resched_task(struct task_struct *p) | 1035 | static inline void resched_task(struct task_struct *p) |
@@ -1189,6 +1065,7 @@ static inline void resched_rq(struct rq *rq) | |||
1189 | enum { | 1065 | enum { |
1190 | HRTICK_SET, /* re-programm hrtick_timer */ | 1066 | HRTICK_SET, /* re-programm hrtick_timer */ |
1191 | HRTICK_RESET, /* not a new slice */ | 1067 | HRTICK_RESET, /* not a new slice */ |
1068 | HRTICK_BLOCK, /* stop hrtick operations */ | ||
1192 | }; | 1069 | }; |
1193 | 1070 | ||
1194 | /* | 1071 | /* |
@@ -1200,6 +1077,8 @@ static inline int hrtick_enabled(struct rq *rq) | |||
1200 | { | 1077 | { |
1201 | if (!sched_feat(HRTICK)) | 1078 | if (!sched_feat(HRTICK)) |
1202 | return 0; | 1079 | return 0; |
1080 | if (unlikely(test_bit(HRTICK_BLOCK, &rq->hrtick_flags))) | ||
1081 | return 0; | ||
1203 | return hrtimer_is_hres_active(&rq->hrtick_timer); | 1082 | return hrtimer_is_hres_active(&rq->hrtick_timer); |
1204 | } | 1083 | } |
1205 | 1084 | ||
@@ -1275,14 +1154,70 @@ static enum hrtimer_restart hrtick(struct hrtimer *timer) | |||
1275 | WARN_ON_ONCE(cpu_of(rq) != smp_processor_id()); | 1154 | WARN_ON_ONCE(cpu_of(rq) != smp_processor_id()); |
1276 | 1155 | ||
1277 | spin_lock(&rq->lock); | 1156 | spin_lock(&rq->lock); |
1278 | __update_rq_clock(rq); | 1157 | update_rq_clock(rq); |
1279 | rq->curr->sched_class->task_tick(rq, rq->curr, 1); | 1158 | rq->curr->sched_class->task_tick(rq, rq->curr, 1); |
1280 | spin_unlock(&rq->lock); | 1159 | spin_unlock(&rq->lock); |
1281 | 1160 | ||
1282 | return HRTIMER_NORESTART; | 1161 | return HRTIMER_NORESTART; |
1283 | } | 1162 | } |
1284 | 1163 | ||
1285 | static inline void init_rq_hrtick(struct rq *rq) | 1164 | static void hotplug_hrtick_disable(int cpu) |
1165 | { | ||
1166 | struct rq *rq = cpu_rq(cpu); | ||
1167 | unsigned long flags; | ||
1168 | |||
1169 | spin_lock_irqsave(&rq->lock, flags); | ||
1170 | rq->hrtick_flags = 0; | ||
1171 | __set_bit(HRTICK_BLOCK, &rq->hrtick_flags); | ||
1172 | spin_unlock_irqrestore(&rq->lock, flags); | ||
1173 | |||
1174 | hrtick_clear(rq); | ||
1175 | } | ||
1176 | |||
1177 | static void hotplug_hrtick_enable(int cpu) | ||
1178 | { | ||
1179 | struct rq *rq = cpu_rq(cpu); | ||
1180 | unsigned long flags; | ||
1181 | |||
1182 | spin_lock_irqsave(&rq->lock, flags); | ||
1183 | __clear_bit(HRTICK_BLOCK, &rq->hrtick_flags); | ||
1184 | spin_unlock_irqrestore(&rq->lock, flags); | ||
1185 | } | ||
1186 | |||
1187 | static int | ||
1188 | hotplug_hrtick(struct notifier_block *nfb, unsigned long action, void *hcpu) | ||
1189 | { | ||
1190 | int cpu = (int)(long)hcpu; | ||
1191 | |||
1192 | switch (action) { | ||
1193 | case CPU_UP_CANCELED: | ||
1194 | case CPU_UP_CANCELED_FROZEN: | ||
1195 | case CPU_DOWN_PREPARE: | ||
1196 | case CPU_DOWN_PREPARE_FROZEN: | ||
1197 | case CPU_DEAD: | ||
1198 | case CPU_DEAD_FROZEN: | ||
1199 | hotplug_hrtick_disable(cpu); | ||
1200 | return NOTIFY_OK; | ||
1201 | |||
1202 | case CPU_UP_PREPARE: | ||
1203 | case CPU_UP_PREPARE_FROZEN: | ||
1204 | case CPU_DOWN_FAILED: | ||
1205 | case CPU_DOWN_FAILED_FROZEN: | ||
1206 | case CPU_ONLINE: | ||
1207 | case CPU_ONLINE_FROZEN: | ||
1208 | hotplug_hrtick_enable(cpu); | ||
1209 | return NOTIFY_OK; | ||
1210 | } | ||
1211 | |||
1212 | return NOTIFY_DONE; | ||
1213 | } | ||
1214 | |||
1215 | static void init_hrtick(void) | ||
1216 | { | ||
1217 | hotcpu_notifier(hotplug_hrtick, 0); | ||
1218 | } | ||
1219 | |||
1220 | static void init_rq_hrtick(struct rq *rq) | ||
1286 | { | 1221 | { |
1287 | rq->hrtick_flags = 0; | 1222 | rq->hrtick_flags = 0; |
1288 | hrtimer_init(&rq->hrtick_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 1223 | hrtimer_init(&rq->hrtick_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
@@ -1319,6 +1254,10 @@ static inline void init_rq_hrtick(struct rq *rq) | |||
1319 | void hrtick_resched(void) | 1254 | void hrtick_resched(void) |
1320 | { | 1255 | { |
1321 | } | 1256 | } |
1257 | |||
1258 | static inline void init_hrtick(void) | ||
1259 | { | ||
1260 | } | ||
1322 | #endif | 1261 | #endif |
1323 | 1262 | ||
1324 | /* | 1263 | /* |
@@ -1438,8 +1377,8 @@ calc_delta_mine(unsigned long delta_exec, unsigned long weight, | |||
1438 | { | 1377 | { |
1439 | u64 tmp; | 1378 | u64 tmp; |
1440 | 1379 | ||
1441 | if (unlikely(!lw->inv_weight)) | 1380 | if (!lw->inv_weight) |
1442 | lw->inv_weight = (WMULT_CONST-lw->weight/2) / (lw->weight+1); | 1381 | lw->inv_weight = 1 + (WMULT_CONST-lw->weight/2)/(lw->weight+1); |
1443 | 1382 | ||
1444 | tmp = (u64)delta_exec * weight; | 1383 | tmp = (u64)delta_exec * weight; |
1445 | /* | 1384 | /* |
@@ -1748,6 +1687,8 @@ __update_group_shares_cpu(struct task_group *tg, struct sched_domain *sd, | |||
1748 | 1687 | ||
1749 | if (shares < MIN_SHARES) | 1688 | if (shares < MIN_SHARES) |
1750 | shares = MIN_SHARES; | 1689 | shares = MIN_SHARES; |
1690 | else if (shares > MAX_SHARES) | ||
1691 | shares = MAX_SHARES; | ||
1751 | 1692 | ||
1752 | __set_se_shares(tg->se[tcpu], shares); | 1693 | __set_se_shares(tg->se[tcpu], shares); |
1753 | } | 1694 | } |
@@ -4339,8 +4280,10 @@ void account_system_time(struct task_struct *p, int hardirq_offset, | |||
4339 | struct rq *rq = this_rq(); | 4280 | struct rq *rq = this_rq(); |
4340 | cputime64_t tmp; | 4281 | cputime64_t tmp; |
4341 | 4282 | ||
4342 | if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) | 4283 | if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) { |
4343 | return account_guest_time(p, cputime); | 4284 | account_guest_time(p, cputime); |
4285 | return; | ||
4286 | } | ||
4344 | 4287 | ||
4345 | p->stime = cputime_add(p->stime, cputime); | 4288 | p->stime = cputime_add(p->stime, cputime); |
4346 | 4289 | ||
@@ -4404,19 +4347,11 @@ void scheduler_tick(void) | |||
4404 | int cpu = smp_processor_id(); | 4347 | int cpu = smp_processor_id(); |
4405 | struct rq *rq = cpu_rq(cpu); | 4348 | struct rq *rq = cpu_rq(cpu); |
4406 | struct task_struct *curr = rq->curr; | 4349 | struct task_struct *curr = rq->curr; |
4407 | u64 next_tick = rq->tick_timestamp + TICK_NSEC; | 4350 | |
4351 | sched_clock_tick(); | ||
4408 | 4352 | ||
4409 | spin_lock(&rq->lock); | 4353 | spin_lock(&rq->lock); |
4410 | __update_rq_clock(rq); | 4354 | update_rq_clock(rq); |
4411 | /* | ||
4412 | * Let rq->clock advance by at least TICK_NSEC: | ||
4413 | */ | ||
4414 | if (unlikely(rq->clock < next_tick)) { | ||
4415 | rq->clock = next_tick; | ||
4416 | rq->clock_underflows++; | ||
4417 | } | ||
4418 | rq->tick_timestamp = rq->clock; | ||
4419 | update_last_tick_seen(rq); | ||
4420 | update_cpu_load(rq); | 4355 | update_cpu_load(rq); |
4421 | curr->sched_class->task_tick(rq, curr, 0); | 4356 | curr->sched_class->task_tick(rq, curr, 0); |
4422 | spin_unlock(&rq->lock); | 4357 | spin_unlock(&rq->lock); |
@@ -4570,7 +4505,7 @@ need_resched_nonpreemptible: | |||
4570 | * Do the rq-clock update outside the rq lock: | 4505 | * Do the rq-clock update outside the rq lock: |
4571 | */ | 4506 | */ |
4572 | local_irq_disable(); | 4507 | local_irq_disable(); |
4573 | __update_rq_clock(rq); | 4508 | update_rq_clock(rq); |
4574 | spin_lock(&rq->lock); | 4509 | spin_lock(&rq->lock); |
4575 | clear_tsk_need_resched(prev); | 4510 | clear_tsk_need_resched(prev); |
4576 | 4511 | ||
@@ -4595,9 +4530,9 @@ need_resched_nonpreemptible: | |||
4595 | prev->sched_class->put_prev_task(rq, prev); | 4530 | prev->sched_class->put_prev_task(rq, prev); |
4596 | next = pick_next_task(rq, prev); | 4531 | next = pick_next_task(rq, prev); |
4597 | 4532 | ||
4598 | sched_info_switch(prev, next); | ||
4599 | |||
4600 | if (likely(prev != next)) { | 4533 | if (likely(prev != next)) { |
4534 | sched_info_switch(prev, next); | ||
4535 | |||
4601 | rq->nr_switches++; | 4536 | rq->nr_switches++; |
4602 | rq->curr = next; | 4537 | rq->curr = next; |
4603 | ++*switch_count; | 4538 | ++*switch_count; |
@@ -4632,8 +4567,6 @@ EXPORT_SYMBOL(schedule); | |||
4632 | asmlinkage void __sched preempt_schedule(void) | 4567 | asmlinkage void __sched preempt_schedule(void) |
4633 | { | 4568 | { |
4634 | struct thread_info *ti = current_thread_info(); | 4569 | struct thread_info *ti = current_thread_info(); |
4635 | struct task_struct *task = current; | ||
4636 | int saved_lock_depth; | ||
4637 | 4570 | ||
4638 | /* | 4571 | /* |
4639 | * If there is a non-zero preempt_count or interrupts are disabled, | 4572 | * If there is a non-zero preempt_count or interrupts are disabled, |
@@ -4644,16 +4577,7 @@ asmlinkage void __sched preempt_schedule(void) | |||
4644 | 4577 | ||
4645 | do { | 4578 | do { |
4646 | add_preempt_count(PREEMPT_ACTIVE); | 4579 | add_preempt_count(PREEMPT_ACTIVE); |
4647 | |||
4648 | /* | ||
4649 | * We keep the big kernel semaphore locked, but we | ||
4650 | * clear ->lock_depth so that schedule() doesnt | ||
4651 | * auto-release the semaphore: | ||
4652 | */ | ||
4653 | saved_lock_depth = task->lock_depth; | ||
4654 | task->lock_depth = -1; | ||
4655 | schedule(); | 4580 | schedule(); |
4656 | task->lock_depth = saved_lock_depth; | ||
4657 | sub_preempt_count(PREEMPT_ACTIVE); | 4581 | sub_preempt_count(PREEMPT_ACTIVE); |
4658 | 4582 | ||
4659 | /* | 4583 | /* |
@@ -4674,26 +4598,15 @@ EXPORT_SYMBOL(preempt_schedule); | |||
4674 | asmlinkage void __sched preempt_schedule_irq(void) | 4598 | asmlinkage void __sched preempt_schedule_irq(void) |
4675 | { | 4599 | { |
4676 | struct thread_info *ti = current_thread_info(); | 4600 | struct thread_info *ti = current_thread_info(); |
4677 | struct task_struct *task = current; | ||
4678 | int saved_lock_depth; | ||
4679 | 4601 | ||
4680 | /* Catch callers which need to be fixed */ | 4602 | /* Catch callers which need to be fixed */ |
4681 | BUG_ON(ti->preempt_count || !irqs_disabled()); | 4603 | BUG_ON(ti->preempt_count || !irqs_disabled()); |
4682 | 4604 | ||
4683 | do { | 4605 | do { |
4684 | add_preempt_count(PREEMPT_ACTIVE); | 4606 | add_preempt_count(PREEMPT_ACTIVE); |
4685 | |||
4686 | /* | ||
4687 | * We keep the big kernel semaphore locked, but we | ||
4688 | * clear ->lock_depth so that schedule() doesnt | ||
4689 | * auto-release the semaphore: | ||
4690 | */ | ||
4691 | saved_lock_depth = task->lock_depth; | ||
4692 | task->lock_depth = -1; | ||
4693 | local_irq_enable(); | 4607 | local_irq_enable(); |
4694 | schedule(); | 4608 | schedule(); |
4695 | local_irq_disable(); | 4609 | local_irq_disable(); |
4696 | task->lock_depth = saved_lock_depth; | ||
4697 | sub_preempt_count(PREEMPT_ACTIVE); | 4610 | sub_preempt_count(PREEMPT_ACTIVE); |
4698 | 4611 | ||
4699 | /* | 4612 | /* |
@@ -5918,8 +5831,11 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) | |||
5918 | spin_unlock_irqrestore(&rq->lock, flags); | 5831 | spin_unlock_irqrestore(&rq->lock, flags); |
5919 | 5832 | ||
5920 | /* Set the preempt count _outside_ the spinlocks! */ | 5833 | /* Set the preempt count _outside_ the spinlocks! */ |
5834 | #if defined(CONFIG_PREEMPT) | ||
5835 | task_thread_info(idle)->preempt_count = (idle->lock_depth >= 0); | ||
5836 | #else | ||
5921 | task_thread_info(idle)->preempt_count = 0; | 5837 | task_thread_info(idle)->preempt_count = 0; |
5922 | 5838 | #endif | |
5923 | /* | 5839 | /* |
5924 | * The idle tasks have their own, simple scheduling class: | 5840 | * The idle tasks have their own, simple scheduling class: |
5925 | */ | 5841 | */ |
@@ -7755,7 +7671,7 @@ void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, | |||
7755 | { | 7671 | { |
7756 | int i, j; | 7672 | int i, j; |
7757 | 7673 | ||
7758 | lock_doms_cur(); | 7674 | mutex_lock(&sched_domains_mutex); |
7759 | 7675 | ||
7760 | /* always unregister in case we don't destroy any domains */ | 7676 | /* always unregister in case we don't destroy any domains */ |
7761 | unregister_sched_domain_sysctl(); | 7677 | unregister_sched_domain_sysctl(); |
@@ -7804,7 +7720,7 @@ match2: | |||
7804 | 7720 | ||
7805 | register_sched_domain_sysctl(); | 7721 | register_sched_domain_sysctl(); |
7806 | 7722 | ||
7807 | unlock_doms_cur(); | 7723 | mutex_unlock(&sched_domains_mutex); |
7808 | } | 7724 | } |
7809 | 7725 | ||
7810 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) | 7726 | #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) |
@@ -7813,8 +7729,10 @@ int arch_reinit_sched_domains(void) | |||
7813 | int err; | 7729 | int err; |
7814 | 7730 | ||
7815 | get_online_cpus(); | 7731 | get_online_cpus(); |
7732 | mutex_lock(&sched_domains_mutex); | ||
7816 | detach_destroy_domains(&cpu_online_map); | 7733 | detach_destroy_domains(&cpu_online_map); |
7817 | err = arch_init_sched_domains(&cpu_online_map); | 7734 | err = arch_init_sched_domains(&cpu_online_map); |
7735 | mutex_unlock(&sched_domains_mutex); | ||
7818 | put_online_cpus(); | 7736 | put_online_cpus(); |
7819 | 7737 | ||
7820 | return err; | 7738 | return err; |
@@ -7932,13 +7850,16 @@ void __init sched_init_smp(void) | |||
7932 | BUG_ON(sched_group_nodes_bycpu == NULL); | 7850 | BUG_ON(sched_group_nodes_bycpu == NULL); |
7933 | #endif | 7851 | #endif |
7934 | get_online_cpus(); | 7852 | get_online_cpus(); |
7853 | mutex_lock(&sched_domains_mutex); | ||
7935 | arch_init_sched_domains(&cpu_online_map); | 7854 | arch_init_sched_domains(&cpu_online_map); |
7936 | cpus_andnot(non_isolated_cpus, cpu_possible_map, cpu_isolated_map); | 7855 | cpus_andnot(non_isolated_cpus, cpu_possible_map, cpu_isolated_map); |
7937 | if (cpus_empty(non_isolated_cpus)) | 7856 | if (cpus_empty(non_isolated_cpus)) |
7938 | cpu_set(smp_processor_id(), non_isolated_cpus); | 7857 | cpu_set(smp_processor_id(), non_isolated_cpus); |
7858 | mutex_unlock(&sched_domains_mutex); | ||
7939 | put_online_cpus(); | 7859 | put_online_cpus(); |
7940 | /* XXX: Theoretical race here - CPU may be hotplugged now */ | 7860 | /* XXX: Theoretical race here - CPU may be hotplugged now */ |
7941 | hotcpu_notifier(update_sched_domains, 0); | 7861 | hotcpu_notifier(update_sched_domains, 0); |
7862 | init_hrtick(); | ||
7942 | 7863 | ||
7943 | /* Move init over to a non-isolated CPU */ | 7864 | /* Move init over to a non-isolated CPU */ |
7944 | if (set_cpus_allowed_ptr(current, &non_isolated_cpus) < 0) | 7865 | if (set_cpus_allowed_ptr(current, &non_isolated_cpus) < 0) |
@@ -8025,7 +7946,7 @@ static void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, | |||
8025 | 7946 | ||
8026 | se->my_q = cfs_rq; | 7947 | se->my_q = cfs_rq; |
8027 | se->load.weight = tg->shares; | 7948 | se->load.weight = tg->shares; |
8028 | se->load.inv_weight = div64_u64(1ULL<<32, se->load.weight); | 7949 | se->load.inv_weight = 0; |
8029 | se->parent = parent; | 7950 | se->parent = parent; |
8030 | } | 7951 | } |
8031 | #endif | 7952 | #endif |
@@ -8149,8 +8070,6 @@ void __init sched_init(void) | |||
8149 | spin_lock_init(&rq->lock); | 8070 | spin_lock_init(&rq->lock); |
8150 | lockdep_set_class(&rq->lock, &rq->rq_lock_key); | 8071 | lockdep_set_class(&rq->lock, &rq->rq_lock_key); |
8151 | rq->nr_running = 0; | 8072 | rq->nr_running = 0; |
8152 | rq->clock = 1; | ||
8153 | update_last_tick_seen(rq); | ||
8154 | init_cfs_rq(&rq->cfs, rq); | 8073 | init_cfs_rq(&rq->cfs, rq); |
8155 | init_rt_rq(&rq->rt, rq); | 8074 | init_rt_rq(&rq->rt, rq); |
8156 | #ifdef CONFIG_FAIR_GROUP_SCHED | 8075 | #ifdef CONFIG_FAIR_GROUP_SCHED |
@@ -8294,6 +8213,7 @@ EXPORT_SYMBOL(__might_sleep); | |||
8294 | static void normalize_task(struct rq *rq, struct task_struct *p) | 8213 | static void normalize_task(struct rq *rq, struct task_struct *p) |
8295 | { | 8214 | { |
8296 | int on_rq; | 8215 | int on_rq; |
8216 | |||
8297 | update_rq_clock(rq); | 8217 | update_rq_clock(rq); |
8298 | on_rq = p->se.on_rq; | 8218 | on_rq = p->se.on_rq; |
8299 | if (on_rq) | 8219 | if (on_rq) |
@@ -8325,7 +8245,6 @@ void normalize_rt_tasks(void) | |||
8325 | p->se.sleep_start = 0; | 8245 | p->se.sleep_start = 0; |
8326 | p->se.block_start = 0; | 8246 | p->se.block_start = 0; |
8327 | #endif | 8247 | #endif |
8328 | task_rq(p)->clock = 0; | ||
8329 | 8248 | ||
8330 | if (!rt_task(p)) { | 8249 | if (!rt_task(p)) { |
8331 | /* | 8250 | /* |
@@ -8692,7 +8611,7 @@ static void __set_se_shares(struct sched_entity *se, unsigned long shares) | |||
8692 | dequeue_entity(cfs_rq, se, 0); | 8611 | dequeue_entity(cfs_rq, se, 0); |
8693 | 8612 | ||
8694 | se->load.weight = shares; | 8613 | se->load.weight = shares; |
8695 | se->load.inv_weight = div64_u64((1ULL<<32), shares); | 8614 | se->load.inv_weight = 0; |
8696 | 8615 | ||
8697 | if (on_rq) | 8616 | if (on_rq) |
8698 | enqueue_entity(cfs_rq, se, 0); | 8617 | enqueue_entity(cfs_rq, se, 0); |
@@ -8722,13 +8641,10 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares) | |||
8722 | if (!tg->se[0]) | 8641 | if (!tg->se[0]) |
8723 | return -EINVAL; | 8642 | return -EINVAL; |
8724 | 8643 | ||
8725 | /* | ||
8726 | * A weight of 0 or 1 can cause arithmetics problems. | ||
8727 | * (The default weight is 1024 - so there's no practical | ||
8728 | * limitation from this.) | ||
8729 | */ | ||
8730 | if (shares < MIN_SHARES) | 8644 | if (shares < MIN_SHARES) |
8731 | shares = MIN_SHARES; | 8645 | shares = MIN_SHARES; |
8646 | else if (shares > MAX_SHARES) | ||
8647 | shares = MAX_SHARES; | ||
8732 | 8648 | ||
8733 | mutex_lock(&shares_mutex); | 8649 | mutex_lock(&shares_mutex); |
8734 | if (tg->shares == shares) | 8650 | if (tg->shares == shares) |
@@ -8753,7 +8669,7 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares) | |||
8753 | * force a rebalance | 8669 | * force a rebalance |
8754 | */ | 8670 | */ |
8755 | cfs_rq_set_shares(tg->cfs_rq[i], 0); | 8671 | cfs_rq_set_shares(tg->cfs_rq[i], 0); |
8756 | set_se_shares(tg->se[i], shares/nr_cpu_ids); | 8672 | set_se_shares(tg->se[i], shares); |
8757 | } | 8673 | } |
8758 | 8674 | ||
8759 | /* | 8675 | /* |
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c new file mode 100644 index 00000000000..9c597e37f7d --- /dev/null +++ b/kernel/sched_clock.c | |||
@@ -0,0 +1,236 @@ | |||
1 | /* | ||
2 | * sched_clock for unstable cpu clocks | ||
3 | * | ||
4 | * Copyright (C) 2008 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com> | ||
5 | * | ||
6 | * Based on code by: | ||
7 | * Ingo Molnar <mingo@redhat.com> | ||
8 | * Guillaume Chazarain <guichaz@gmail.com> | ||
9 | * | ||
10 | * Create a semi stable clock from a mixture of other events, including: | ||
11 | * - gtod | ||
12 | * - jiffies | ||
13 | * - sched_clock() | ||
14 | * - explicit idle events | ||
15 | * | ||
16 | * We use gtod as base and the unstable clock deltas. The deltas are filtered, | ||
17 | * making it monotonic and keeping it within an expected window. This window | ||
18 | * is set up using jiffies. | ||
19 | * | ||
20 | * Furthermore, explicit sleep and wakeup hooks allow us to account for time | ||
21 | * that is otherwise invisible (TSC gets stopped). | ||
22 | * | ||
23 | * The clock: sched_clock_cpu() is monotonic per cpu, and should be somewhat | ||
24 | * consistent between cpus (never more than 1 jiffies difference). | ||
25 | */ | ||
26 | #include <linux/sched.h> | ||
27 | #include <linux/percpu.h> | ||
28 | #include <linux/spinlock.h> | ||
29 | #include <linux/ktime.h> | ||
30 | #include <linux/module.h> | ||
31 | |||
32 | |||
33 | #ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK | ||
34 | |||
35 | struct sched_clock_data { | ||
36 | /* | ||
37 | * Raw spinlock - this is a special case: this might be called | ||
38 | * from within instrumentation code so we dont want to do any | ||
39 | * instrumentation ourselves. | ||
40 | */ | ||
41 | raw_spinlock_t lock; | ||
42 | |||
43 | unsigned long prev_jiffies; | ||
44 | u64 prev_raw; | ||
45 | u64 tick_raw; | ||
46 | u64 tick_gtod; | ||
47 | u64 clock; | ||
48 | }; | ||
49 | |||
50 | static DEFINE_PER_CPU_SHARED_ALIGNED(struct sched_clock_data, sched_clock_data); | ||
51 | |||
52 | static inline struct sched_clock_data *this_scd(void) | ||
53 | { | ||
54 | return &__get_cpu_var(sched_clock_data); | ||
55 | } | ||
56 | |||
57 | static inline struct sched_clock_data *cpu_sdc(int cpu) | ||
58 | { | ||
59 | return &per_cpu(sched_clock_data, cpu); | ||
60 | } | ||
61 | |||
62 | void sched_clock_init(void) | ||
63 | { | ||
64 | u64 ktime_now = ktime_to_ns(ktime_get()); | ||
65 | u64 now = 0; | ||
66 | int cpu; | ||
67 | |||
68 | for_each_possible_cpu(cpu) { | ||
69 | struct sched_clock_data *scd = cpu_sdc(cpu); | ||
70 | |||
71 | scd->lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED; | ||
72 | scd->prev_jiffies = jiffies; | ||
73 | scd->prev_raw = now; | ||
74 | scd->tick_raw = now; | ||
75 | scd->tick_gtod = ktime_now; | ||
76 | scd->clock = ktime_now; | ||
77 | } | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * update the percpu scd from the raw @now value | ||
82 | * | ||
83 | * - filter out backward motion | ||
84 | * - use jiffies to generate a min,max window to clip the raw values | ||
85 | */ | ||
86 | static void __update_sched_clock(struct sched_clock_data *scd, u64 now) | ||
87 | { | ||
88 | unsigned long now_jiffies = jiffies; | ||
89 | long delta_jiffies = now_jiffies - scd->prev_jiffies; | ||
90 | u64 clock = scd->clock; | ||
91 | u64 min_clock, max_clock; | ||
92 | s64 delta = now - scd->prev_raw; | ||
93 | |||
94 | WARN_ON_ONCE(!irqs_disabled()); | ||
95 | min_clock = scd->tick_gtod + delta_jiffies * TICK_NSEC; | ||
96 | |||
97 | if (unlikely(delta < 0)) { | ||
98 | clock++; | ||
99 | goto out; | ||
100 | } | ||
101 | |||
102 | max_clock = min_clock + TICK_NSEC; | ||
103 | |||
104 | if (unlikely(clock + delta > max_clock)) { | ||
105 | if (clock < max_clock) | ||
106 | clock = max_clock; | ||
107 | else | ||
108 | clock++; | ||
109 | } else { | ||
110 | clock += delta; | ||
111 | } | ||
112 | |||
113 | out: | ||
114 | if (unlikely(clock < min_clock)) | ||
115 | clock = min_clock; | ||
116 | |||
117 | scd->prev_raw = now; | ||
118 | scd->prev_jiffies = now_jiffies; | ||
119 | scd->clock = clock; | ||
120 | } | ||
121 | |||
122 | static void lock_double_clock(struct sched_clock_data *data1, | ||
123 | struct sched_clock_data *data2) | ||
124 | { | ||
125 | if (data1 < data2) { | ||
126 | __raw_spin_lock(&data1->lock); | ||
127 | __raw_spin_lock(&data2->lock); | ||
128 | } else { | ||
129 | __raw_spin_lock(&data2->lock); | ||
130 | __raw_spin_lock(&data1->lock); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | u64 sched_clock_cpu(int cpu) | ||
135 | { | ||
136 | struct sched_clock_data *scd = cpu_sdc(cpu); | ||
137 | u64 now, clock; | ||
138 | |||
139 | WARN_ON_ONCE(!irqs_disabled()); | ||
140 | now = sched_clock(); | ||
141 | |||
142 | if (cpu != raw_smp_processor_id()) { | ||
143 | /* | ||
144 | * in order to update a remote cpu's clock based on our | ||
145 | * unstable raw time rebase it against: | ||
146 | * tick_raw (offset between raw counters) | ||
147 | * tick_gotd (tick offset between cpus) | ||
148 | */ | ||
149 | struct sched_clock_data *my_scd = this_scd(); | ||
150 | |||
151 | lock_double_clock(scd, my_scd); | ||
152 | |||
153 | now -= my_scd->tick_raw; | ||
154 | now += scd->tick_raw; | ||
155 | |||
156 | now -= my_scd->tick_gtod; | ||
157 | now += scd->tick_gtod; | ||
158 | |||
159 | __raw_spin_unlock(&my_scd->lock); | ||
160 | } else { | ||
161 | __raw_spin_lock(&scd->lock); | ||
162 | } | ||
163 | |||
164 | __update_sched_clock(scd, now); | ||
165 | clock = scd->clock; | ||
166 | |||
167 | __raw_spin_unlock(&scd->lock); | ||
168 | |||
169 | return clock; | ||
170 | } | ||
171 | |||
172 | void sched_clock_tick(void) | ||
173 | { | ||
174 | struct sched_clock_data *scd = this_scd(); | ||
175 | u64 now, now_gtod; | ||
176 | |||
177 | WARN_ON_ONCE(!irqs_disabled()); | ||
178 | |||
179 | now = sched_clock(); | ||
180 | now_gtod = ktime_to_ns(ktime_get()); | ||
181 | |||
182 | __raw_spin_lock(&scd->lock); | ||
183 | __update_sched_clock(scd, now); | ||
184 | /* | ||
185 | * update tick_gtod after __update_sched_clock() because that will | ||
186 | * already observe 1 new jiffy; adding a new tick_gtod to that would | ||
187 | * increase the clock 2 jiffies. | ||
188 | */ | ||
189 | scd->tick_raw = now; | ||
190 | scd->tick_gtod = now_gtod; | ||
191 | __raw_spin_unlock(&scd->lock); | ||
192 | } | ||
193 | |||
194 | /* | ||
195 | * We are going deep-idle (irqs are disabled): | ||
196 | */ | ||
197 | void sched_clock_idle_sleep_event(void) | ||
198 | { | ||
199 | sched_clock_cpu(smp_processor_id()); | ||
200 | } | ||
201 | EXPORT_SYMBOL_GPL(sched_clock_idle_sleep_event); | ||
202 | |||
203 | /* | ||
204 | * We just idled delta nanoseconds (called with irqs disabled): | ||
205 | */ | ||
206 | void sched_clock_idle_wakeup_event(u64 delta_ns) | ||
207 | { | ||
208 | struct sched_clock_data *scd = this_scd(); | ||
209 | u64 now = sched_clock(); | ||
210 | |||
211 | /* | ||
212 | * Override the previous timestamp and ignore all | ||
213 | * sched_clock() deltas that occured while we idled, | ||
214 | * and use the PM-provided delta_ns to advance the | ||
215 | * rq clock: | ||
216 | */ | ||
217 | __raw_spin_lock(&scd->lock); | ||
218 | scd->prev_raw = now; | ||
219 | scd->clock += delta_ns; | ||
220 | __raw_spin_unlock(&scd->lock); | ||
221 | |||
222 | touch_softlockup_watchdog(); | ||
223 | } | ||
224 | EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event); | ||
225 | |||
226 | #endif | ||
227 | |||
228 | /* | ||
229 | * Scheduler clock - returns current time in nanosec units. | ||
230 | * This is default implementation. | ||
231 | * Architectures and sub-architectures can override this. | ||
232 | */ | ||
233 | unsigned long long __attribute__((weak)) sched_clock(void) | ||
234 | { | ||
235 | return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ); | ||
236 | } | ||
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c index 6b4a12558e8..5f06118fbc3 100644 --- a/kernel/sched_debug.c +++ b/kernel/sched_debug.c | |||
@@ -204,13 +204,6 @@ static void print_cpu(struct seq_file *m, int cpu) | |||
204 | PN(next_balance); | 204 | PN(next_balance); |
205 | P(curr->pid); | 205 | P(curr->pid); |
206 | PN(clock); | 206 | PN(clock); |
207 | PN(idle_clock); | ||
208 | PN(prev_clock_raw); | ||
209 | P(clock_warps); | ||
210 | P(clock_overflows); | ||
211 | P(clock_underflows); | ||
212 | P(clock_deep_idle_events); | ||
213 | PN(clock_max_delta); | ||
214 | P(cpu_load[0]); | 207 | P(cpu_load[0]); |
215 | P(cpu_load[1]); | 208 | P(cpu_load[1]); |
216 | P(cpu_load[2]); | 209 | P(cpu_load[2]); |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 89fa32b4edf..e24ecd39c4b 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -662,10 +662,15 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial) | |||
662 | if (!initial) { | 662 | if (!initial) { |
663 | /* sleeps upto a single latency don't count. */ | 663 | /* sleeps upto a single latency don't count. */ |
664 | if (sched_feat(NEW_FAIR_SLEEPERS)) { | 664 | if (sched_feat(NEW_FAIR_SLEEPERS)) { |
665 | unsigned long thresh = sysctl_sched_latency; | ||
666 | |||
667 | /* | ||
668 | * convert the sleeper threshold into virtual time | ||
669 | */ | ||
665 | if (sched_feat(NORMALIZED_SLEEPER)) | 670 | if (sched_feat(NORMALIZED_SLEEPER)) |
666 | vruntime -= calc_delta_weight(sysctl_sched_latency, se); | 671 | thresh = calc_delta_fair(thresh, se); |
667 | else | 672 | |
668 | vruntime -= sysctl_sched_latency; | 673 | vruntime -= thresh; |
669 | } | 674 | } |
670 | 675 | ||
671 | /* ensure we never gain time by being placed backwards. */ | 676 | /* ensure we never gain time by being placed backwards. */ |
@@ -682,6 +687,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup) | |||
682 | * Update run-time statistics of the 'current'. | 687 | * Update run-time statistics of the 'current'. |
683 | */ | 688 | */ |
684 | update_curr(cfs_rq); | 689 | update_curr(cfs_rq); |
690 | account_entity_enqueue(cfs_rq, se); | ||
685 | 691 | ||
686 | if (wakeup) { | 692 | if (wakeup) { |
687 | place_entity(cfs_rq, se, 0); | 693 | place_entity(cfs_rq, se, 0); |
@@ -692,7 +698,6 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup) | |||
692 | check_spread(cfs_rq, se); | 698 | check_spread(cfs_rq, se); |
693 | if (se != cfs_rq->curr) | 699 | if (se != cfs_rq->curr) |
694 | __enqueue_entity(cfs_rq, se); | 700 | __enqueue_entity(cfs_rq, se); |
695 | account_entity_enqueue(cfs_rq, se); | ||
696 | } | 701 | } |
697 | 702 | ||
698 | static void update_avg(u64 *avg, u64 sample) | 703 | static void update_avg(u64 *avg, u64 sample) |
@@ -841,8 +846,10 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) | |||
841 | * queued ticks are scheduled to match the slice, so don't bother | 846 | * queued ticks are scheduled to match the slice, so don't bother |
842 | * validating it and just reschedule. | 847 | * validating it and just reschedule. |
843 | */ | 848 | */ |
844 | if (queued) | 849 | if (queued) { |
845 | return resched_task(rq_of(cfs_rq)->curr); | 850 | resched_task(rq_of(cfs_rq)->curr); |
851 | return; | ||
852 | } | ||
846 | /* | 853 | /* |
847 | * don't let the period tick interfere with the hrtick preemption | 854 | * don't let the period tick interfere with the hrtick preemption |
848 | */ | 855 | */ |
@@ -957,7 +964,7 @@ static void yield_task_fair(struct rq *rq) | |||
957 | return; | 964 | return; |
958 | 965 | ||
959 | if (likely(!sysctl_sched_compat_yield) && curr->policy != SCHED_BATCH) { | 966 | if (likely(!sysctl_sched_compat_yield) && curr->policy != SCHED_BATCH) { |
960 | __update_rq_clock(rq); | 967 | update_rq_clock(rq); |
961 | /* | 968 | /* |
962 | * Update run-time statistics of the 'current'. | 969 | * Update run-time statistics of the 'current'. |
963 | */ | 970 | */ |
@@ -1007,7 +1014,7 @@ static int wake_idle(int cpu, struct task_struct *p) | |||
1007 | * sibling runqueue info. This will avoid the checks and cache miss | 1014 | * sibling runqueue info. This will avoid the checks and cache miss |
1008 | * penalities associated with that. | 1015 | * penalities associated with that. |
1009 | */ | 1016 | */ |
1010 | if (idle_cpu(cpu) || cpu_rq(cpu)->nr_running > 1) | 1017 | if (idle_cpu(cpu) || cpu_rq(cpu)->cfs.nr_running > 1) |
1011 | return cpu; | 1018 | return cpu; |
1012 | 1019 | ||
1013 | for_each_domain(cpu, sd) { | 1020 | for_each_domain(cpu, sd) { |
@@ -1611,30 +1618,6 @@ static const struct sched_class fair_sched_class = { | |||
1611 | }; | 1618 | }; |
1612 | 1619 | ||
1613 | #ifdef CONFIG_SCHED_DEBUG | 1620 | #ifdef CONFIG_SCHED_DEBUG |
1614 | static void | ||
1615 | print_cfs_rq_tasks(struct seq_file *m, struct cfs_rq *cfs_rq, int depth) | ||
1616 | { | ||
1617 | struct sched_entity *se; | ||
1618 | |||
1619 | if (!cfs_rq) | ||
1620 | return; | ||
1621 | |||
1622 | list_for_each_entry_rcu(se, &cfs_rq->tasks, group_node) { | ||
1623 | int i; | ||
1624 | |||
1625 | for (i = depth; i; i--) | ||
1626 | seq_puts(m, " "); | ||
1627 | |||
1628 | seq_printf(m, "%lu %s %lu\n", | ||
1629 | se->load.weight, | ||
1630 | entity_is_task(se) ? "T" : "G", | ||
1631 | calc_delta_weight(SCHED_LOAD_SCALE, se) | ||
1632 | ); | ||
1633 | if (!entity_is_task(se)) | ||
1634 | print_cfs_rq_tasks(m, group_cfs_rq(se), depth + 1); | ||
1635 | } | ||
1636 | } | ||
1637 | |||
1638 | static void print_cfs_stats(struct seq_file *m, int cpu) | 1621 | static void print_cfs_stats(struct seq_file *m, int cpu) |
1639 | { | 1622 | { |
1640 | struct cfs_rq *cfs_rq; | 1623 | struct cfs_rq *cfs_rq; |
@@ -1642,9 +1625,6 @@ static void print_cfs_stats(struct seq_file *m, int cpu) | |||
1642 | rcu_read_lock(); | 1625 | rcu_read_lock(); |
1643 | for_each_leaf_cfs_rq(cpu_rq(cpu), cfs_rq) | 1626 | for_each_leaf_cfs_rq(cpu_rq(cpu), cfs_rq) |
1644 | print_cfs_rq(m, cpu, cfs_rq); | 1627 | print_cfs_rq(m, cpu, cfs_rq); |
1645 | |||
1646 | seq_printf(m, "\nWeight tree:\n"); | ||
1647 | print_cfs_rq_tasks(m, &cpu_rq(cpu)->cfs, 1); | ||
1648 | rcu_read_unlock(); | 1628 | rcu_read_unlock(); |
1649 | } | 1629 | } |
1650 | #endif | 1630 | #endif |
diff --git a/kernel/sched_idletask.c b/kernel/sched_idletask.c index 2bcafa37563..3a4f92dbbe6 100644 --- a/kernel/sched_idletask.c +++ b/kernel/sched_idletask.c | |||
@@ -99,7 +99,7 @@ static void prio_changed_idle(struct rq *rq, struct task_struct *p, | |||
99 | /* | 99 | /* |
100 | * Simple, special scheduling class for the per-CPU idle tasks: | 100 | * Simple, special scheduling class for the per-CPU idle tasks: |
101 | */ | 101 | */ |
102 | const struct sched_class idle_sched_class = { | 102 | static const struct sched_class idle_sched_class = { |
103 | /* .next is NULL */ | 103 | /* .next is NULL */ |
104 | /* no enqueue/yield_task for idle tasks */ | 104 | /* no enqueue/yield_task for idle tasks */ |
105 | 105 | ||
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index c2730a5a4f0..060e87b0cb1 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
@@ -1098,11 +1098,14 @@ static void post_schedule_rt(struct rq *rq) | |||
1098 | } | 1098 | } |
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | 1101 | /* | |
1102 | * If we are not running and we are not going to reschedule soon, we should | ||
1103 | * try to push tasks away now | ||
1104 | */ | ||
1102 | static void task_wake_up_rt(struct rq *rq, struct task_struct *p) | 1105 | static void task_wake_up_rt(struct rq *rq, struct task_struct *p) |
1103 | { | 1106 | { |
1104 | if (!task_running(rq, p) && | 1107 | if (!task_running(rq, p) && |
1105 | (p->prio >= rq->rt.highest_prio) && | 1108 | !test_tsk_need_resched(rq->curr) && |
1106 | rq->rt.overloaded) | 1109 | rq->rt.overloaded) |
1107 | push_rt_tasks(rq); | 1110 | push_rt_tasks(rq); |
1108 | } | 1111 | } |
@@ -1309,7 +1312,7 @@ static void set_curr_task_rt(struct rq *rq) | |||
1309 | p->se.exec_start = rq->clock; | 1312 | p->se.exec_start = rq->clock; |
1310 | } | 1313 | } |
1311 | 1314 | ||
1312 | const struct sched_class rt_sched_class = { | 1315 | static const struct sched_class rt_sched_class = { |
1313 | .next = &fair_sched_class, | 1316 | .next = &fair_sched_class, |
1314 | .enqueue_task = enqueue_task_rt, | 1317 | .enqueue_task = enqueue_task_rt, |
1315 | .dequeue_task = dequeue_task_rt, | 1318 | .dequeue_task = dequeue_task_rt, |
diff --git a/lib/Kconfig.kgdb b/lib/Kconfig.kgdb index f2e01ac5ab0..a5d4b1dac2a 100644 --- a/lib/Kconfig.kgdb +++ b/lib/Kconfig.kgdb | |||
@@ -1,4 +1,10 @@ | |||
1 | 1 | ||
2 | config HAVE_ARCH_KGDB_SHADOW_INFO | ||
3 | bool | ||
4 | |||
5 | config HAVE_ARCH_KGDB | ||
6 | bool | ||
7 | |||
2 | menuconfig KGDB | 8 | menuconfig KGDB |
3 | bool "KGDB: kernel debugging with remote gdb" | 9 | bool "KGDB: kernel debugging with remote gdb" |
4 | select FRAME_POINTER | 10 | select FRAME_POINTER |
@@ -10,15 +16,10 @@ menuconfig KGDB | |||
10 | at http://kgdb.sourceforge.net as well as in DocBook form | 16 | at http://kgdb.sourceforge.net as well as in DocBook form |
11 | in Documentation/DocBook/. If unsure, say N. | 17 | in Documentation/DocBook/. If unsure, say N. |
12 | 18 | ||
13 | config HAVE_ARCH_KGDB_SHADOW_INFO | 19 | if KGDB |
14 | bool | ||
15 | |||
16 | config HAVE_ARCH_KGDB | ||
17 | bool | ||
18 | 20 | ||
19 | config KGDB_SERIAL_CONSOLE | 21 | config KGDB_SERIAL_CONSOLE |
20 | tristate "KGDB: use kgdb over the serial console" | 22 | tristate "KGDB: use kgdb over the serial console" |
21 | depends on KGDB | ||
22 | select CONSOLE_POLL | 23 | select CONSOLE_POLL |
23 | select MAGIC_SYSRQ | 24 | select MAGIC_SYSRQ |
24 | default y | 25 | default y |
@@ -28,7 +29,6 @@ config KGDB_SERIAL_CONSOLE | |||
28 | 29 | ||
29 | config KGDB_TESTS | 30 | config KGDB_TESTS |
30 | bool "KGDB: internal test suite" | 31 | bool "KGDB: internal test suite" |
31 | depends on KGDB | ||
32 | default n | 32 | default n |
33 | help | 33 | help |
34 | This is a kgdb I/O module specifically designed to test | 34 | This is a kgdb I/O module specifically designed to test |
@@ -56,3 +56,5 @@ config KGDB_TESTS_BOOT_STRING | |||
56 | boot. See the drivers/misc/kgdbts.c for detailed | 56 | boot. See the drivers/misc/kgdbts.c for detailed |
57 | information about other strings you could use beyond the | 57 | information about other strings you could use beyond the |
58 | default of V1F100. | 58 | default of V1F100. |
59 | |||
60 | endif # KGDB | ||
diff --git a/lib/devres.c b/lib/devres.c index 26c87c49d77..72c8909006d 100644 --- a/lib/devres.c +++ b/lib/devres.c | |||
@@ -2,7 +2,7 @@ | |||
2 | #include <linux/io.h> | 2 | #include <linux/io.h> |
3 | #include <linux/module.h> | 3 | #include <linux/module.h> |
4 | 4 | ||
5 | static void devm_ioremap_release(struct device *dev, void *res) | 5 | void devm_ioremap_release(struct device *dev, void *res) |
6 | { | 6 | { |
7 | iounmap(*(void __iomem **)res); | 7 | iounmap(*(void __iomem **)res); |
8 | } | 8 | } |
diff --git a/lib/kernel_lock.c b/lib/kernel_lock.c index cd3e82530b0..01a3c22c1b5 100644 --- a/lib/kernel_lock.c +++ b/lib/kernel_lock.c | |||
@@ -11,79 +11,121 @@ | |||
11 | #include <linux/semaphore.h> | 11 | #include <linux/semaphore.h> |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * The 'big kernel semaphore' | 14 | * The 'big kernel lock' |
15 | * | 15 | * |
16 | * This mutex is taken and released recursively by lock_kernel() | 16 | * This spinlock is taken and released recursively by lock_kernel() |
17 | * and unlock_kernel(). It is transparently dropped and reacquired | 17 | * and unlock_kernel(). It is transparently dropped and reacquired |
18 | * over schedule(). It is used to protect legacy code that hasn't | 18 | * over schedule(). It is used to protect legacy code that hasn't |
19 | * been migrated to a proper locking design yet. | 19 | * been migrated to a proper locking design yet. |
20 | * | 20 | * |
21 | * Note: code locked by this semaphore will only be serialized against | ||
22 | * other code using the same locking facility. The code guarantees that | ||
23 | * the task remains on the same CPU. | ||
24 | * | ||
25 | * Don't use in new code. | 21 | * Don't use in new code. |
26 | */ | 22 | */ |
27 | static DECLARE_MUTEX(kernel_sem); | 23 | static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kernel_flag); |
24 | |||
28 | 25 | ||
29 | /* | 26 | /* |
30 | * Re-acquire the kernel semaphore. | 27 | * Acquire/release the underlying lock from the scheduler. |
31 | * | 28 | * |
32 | * This function is called with preemption off. | 29 | * This is called with preemption disabled, and should |
30 | * return an error value if it cannot get the lock and | ||
31 | * TIF_NEED_RESCHED gets set. | ||
33 | * | 32 | * |
34 | * We are executing in schedule() so the code must be extremely careful | 33 | * If it successfully gets the lock, it should increment |
35 | * about recursion, both due to the down() and due to the enabling of | 34 | * the preemption count like any spinlock does. |
36 | * preemption. schedule() will re-check the preemption flag after | 35 | * |
37 | * reacquiring the semaphore. | 36 | * (This works on UP too - _raw_spin_trylock will never |
37 | * return false in that case) | ||
38 | */ | 38 | */ |
39 | int __lockfunc __reacquire_kernel_lock(void) | 39 | int __lockfunc __reacquire_kernel_lock(void) |
40 | { | 40 | { |
41 | struct task_struct *task = current; | 41 | while (!_raw_spin_trylock(&kernel_flag)) { |
42 | int saved_lock_depth = task->lock_depth; | 42 | if (test_thread_flag(TIF_NEED_RESCHED)) |
43 | 43 | return -EAGAIN; | |
44 | BUG_ON(saved_lock_depth < 0); | 44 | cpu_relax(); |
45 | 45 | } | |
46 | task->lock_depth = -1; | ||
47 | preempt_enable_no_resched(); | ||
48 | |||
49 | down(&kernel_sem); | ||
50 | |||
51 | preempt_disable(); | 46 | preempt_disable(); |
52 | task->lock_depth = saved_lock_depth; | ||
53 | |||
54 | return 0; | 47 | return 0; |
55 | } | 48 | } |
56 | 49 | ||
57 | void __lockfunc __release_kernel_lock(void) | 50 | void __lockfunc __release_kernel_lock(void) |
58 | { | 51 | { |
59 | up(&kernel_sem); | 52 | _raw_spin_unlock(&kernel_flag); |
53 | preempt_enable_no_resched(); | ||
60 | } | 54 | } |
61 | 55 | ||
62 | /* | 56 | /* |
63 | * Getting the big kernel semaphore. | 57 | * These are the BKL spinlocks - we try to be polite about preemption. |
58 | * If SMP is not on (ie UP preemption), this all goes away because the | ||
59 | * _raw_spin_trylock() will always succeed. | ||
64 | */ | 60 | */ |
65 | void __lockfunc lock_kernel(void) | 61 | #ifdef CONFIG_PREEMPT |
62 | static inline void __lock_kernel(void) | ||
66 | { | 63 | { |
67 | struct task_struct *task = current; | 64 | preempt_disable(); |
68 | int depth = task->lock_depth + 1; | 65 | if (unlikely(!_raw_spin_trylock(&kernel_flag))) { |
66 | /* | ||
67 | * If preemption was disabled even before this | ||
68 | * was called, there's nothing we can be polite | ||
69 | * about - just spin. | ||
70 | */ | ||
71 | if (preempt_count() > 1) { | ||
72 | _raw_spin_lock(&kernel_flag); | ||
73 | return; | ||
74 | } | ||
69 | 75 | ||
70 | if (likely(!depth)) | ||
71 | /* | 76 | /* |
72 | * No recursion worries - we set up lock_depth _after_ | 77 | * Otherwise, let's wait for the kernel lock |
78 | * with preemption enabled.. | ||
73 | */ | 79 | */ |
74 | down(&kernel_sem); | 80 | do { |
81 | preempt_enable(); | ||
82 | while (spin_is_locked(&kernel_flag)) | ||
83 | cpu_relax(); | ||
84 | preempt_disable(); | ||
85 | } while (!_raw_spin_trylock(&kernel_flag)); | ||
86 | } | ||
87 | } | ||
75 | 88 | ||
76 | task->lock_depth = depth; | 89 | #else |
90 | |||
91 | /* | ||
92 | * Non-preemption case - just get the spinlock | ||
93 | */ | ||
94 | static inline void __lock_kernel(void) | ||
95 | { | ||
96 | _raw_spin_lock(&kernel_flag); | ||
77 | } | 97 | } |
98 | #endif | ||
78 | 99 | ||
79 | void __lockfunc unlock_kernel(void) | 100 | static inline void __unlock_kernel(void) |
80 | { | 101 | { |
81 | struct task_struct *task = current; | 102 | /* |
103 | * the BKL is not covered by lockdep, so we open-code the | ||
104 | * unlocking sequence (and thus avoid the dep-chain ops): | ||
105 | */ | ||
106 | _raw_spin_unlock(&kernel_flag); | ||
107 | preempt_enable(); | ||
108 | } | ||
82 | 109 | ||
83 | BUG_ON(task->lock_depth < 0); | 110 | /* |
111 | * Getting the big kernel lock. | ||
112 | * | ||
113 | * This cannot happen asynchronously, so we only need to | ||
114 | * worry about other CPU's. | ||
115 | */ | ||
116 | void __lockfunc lock_kernel(void) | ||
117 | { | ||
118 | int depth = current->lock_depth+1; | ||
119 | if (likely(!depth)) | ||
120 | __lock_kernel(); | ||
121 | current->lock_depth = depth; | ||
122 | } | ||
84 | 123 | ||
85 | if (likely(--task->lock_depth < 0)) | 124 | void __lockfunc unlock_kernel(void) |
86 | up(&kernel_sem); | 125 | { |
126 | BUG_ON(current->lock_depth < 0); | ||
127 | if (likely(--current->lock_depth < 0)) | ||
128 | __unlock_kernel(); | ||
87 | } | 129 | } |
88 | 130 | ||
89 | EXPORT_SYMBOL(lock_kernel); | 131 | EXPORT_SYMBOL(lock_kernel); |
diff --git a/mm/filemap.c b/mm/filemap.c index 239d36163bb..2dead9adf8b 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1655,7 +1655,7 @@ int should_remove_suid(struct dentry *dentry) | |||
1655 | } | 1655 | } |
1656 | EXPORT_SYMBOL(should_remove_suid); | 1656 | EXPORT_SYMBOL(should_remove_suid); |
1657 | 1657 | ||
1658 | int __remove_suid(struct dentry *dentry, int kill) | 1658 | static int __remove_suid(struct dentry *dentry, int kill) |
1659 | { | 1659 | { |
1660 | struct iattr newattrs; | 1660 | struct iattr newattrs; |
1661 | 1661 | ||
diff --git a/mm/memory.c b/mm/memory.c index bbab1e37055..48c122d42ed 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -969,7 +969,7 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, | |||
969 | goto no_page_table; | 969 | goto no_page_table; |
970 | 970 | ||
971 | pmd = pmd_offset(pud, address); | 971 | pmd = pmd_offset(pud, address); |
972 | if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd))) | 972 | if (pmd_none(*pmd)) |
973 | goto no_page_table; | 973 | goto no_page_table; |
974 | 974 | ||
975 | if (pmd_huge(*pmd)) { | 975 | if (pmd_huge(*pmd)) { |
@@ -978,6 +978,9 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, | |||
978 | goto out; | 978 | goto out; |
979 | } | 979 | } |
980 | 980 | ||
981 | if (unlikely(pmd_bad(*pmd))) | ||
982 | goto no_page_table; | ||
983 | |||
981 | ptep = pte_offset_map_lock(mm, pmd, address, &ptl); | 984 | ptep = pte_offset_map_lock(mm, pmd, address, &ptl); |
982 | if (!ptep) | 985 | if (!ptep) |
983 | goto out; | 986 | goto out; |
@@ -3762,7 +3762,7 @@ static int any_slab_objects(struct kmem_cache *s) | |||
3762 | if (!n) | 3762 | if (!n) |
3763 | continue; | 3763 | continue; |
3764 | 3764 | ||
3765 | if (atomic_read(&n->total_objects)) | 3765 | if (atomic_long_read(&n->total_objects)) |
3766 | return 1; | 3766 | return 1; |
3767 | } | 3767 | } |
3768 | return 0; | 3768 | return 0; |
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index 1b228065e74..9d52ebfc196 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
@@ -346,9 +346,9 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb) | |||
346 | /* skb==NULL means VCC is being destroyed */ | 346 | /* skb==NULL means VCC is being destroyed */ |
347 | br2684_close_vcc(brvcc); | 347 | br2684_close_vcc(brvcc); |
348 | if (list_empty(&brdev->brvccs)) { | 348 | if (list_empty(&brdev->brvccs)) { |
349 | read_lock(&devs_lock); | 349 | write_lock_irq(&devs_lock); |
350 | list_del(&brdev->br2684_devs); | 350 | list_del(&brdev->br2684_devs); |
351 | read_unlock(&devs_lock); | 351 | write_unlock_irq(&devs_lock); |
352 | unregister_netdev(net_dev); | 352 | unregister_netdev(net_dev); |
353 | free_netdev(net_dev); | 353 | free_netdev(net_dev); |
354 | } | 354 | } |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 77a981a1ee5..c2397f503b0 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -273,15 +273,13 @@ int br_add_bridge(const char *name) | |||
273 | rtnl_lock(); | 273 | rtnl_lock(); |
274 | if (strchr(dev->name, '%')) { | 274 | if (strchr(dev->name, '%')) { |
275 | ret = dev_alloc_name(dev, dev->name); | 275 | ret = dev_alloc_name(dev, dev->name); |
276 | if (ret < 0) { | 276 | if (ret < 0) |
277 | free_netdev(dev); | 277 | goto out_free; |
278 | goto out; | ||
279 | } | ||
280 | } | 278 | } |
281 | 279 | ||
282 | ret = register_netdevice(dev); | 280 | ret = register_netdevice(dev); |
283 | if (ret) | 281 | if (ret) |
284 | goto out; | 282 | goto out_free; |
285 | 283 | ||
286 | ret = br_sysfs_addbr(dev); | 284 | ret = br_sysfs_addbr(dev); |
287 | if (ret) | 285 | if (ret) |
@@ -289,6 +287,10 @@ int br_add_bridge(const char *name) | |||
289 | out: | 287 | out: |
290 | rtnl_unlock(); | 288 | rtnl_unlock(); |
291 | return ret; | 289 | return ret; |
290 | |||
291 | out_free: | ||
292 | free_netdev(dev); | ||
293 | goto out; | ||
292 | } | 294 | } |
293 | 295 | ||
294 | int br_del_bridge(const char *name) | 296 | int br_del_bridge(const char *name) |
diff --git a/net/can/af_can.c b/net/can/af_can.c index 2759b76f731..7e8ca283645 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -208,6 +208,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol) | |||
208 | */ | 208 | */ |
209 | int can_send(struct sk_buff *skb, int loop) | 209 | int can_send(struct sk_buff *skb, int loop) |
210 | { | 210 | { |
211 | struct sk_buff *newskb = NULL; | ||
211 | int err; | 212 | int err; |
212 | 213 | ||
213 | if (skb->dev->type != ARPHRD_CAN) { | 214 | if (skb->dev->type != ARPHRD_CAN) { |
@@ -244,8 +245,7 @@ int can_send(struct sk_buff *skb, int loop) | |||
244 | * If the interface is not capable to do loopback | 245 | * If the interface is not capable to do loopback |
245 | * itself, we do it here. | 246 | * itself, we do it here. |
246 | */ | 247 | */ |
247 | struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); | 248 | newskb = skb_clone(skb, GFP_ATOMIC); |
248 | |||
249 | if (!newskb) { | 249 | if (!newskb) { |
250 | kfree_skb(skb); | 250 | kfree_skb(skb); |
251 | return -ENOMEM; | 251 | return -ENOMEM; |
@@ -254,7 +254,6 @@ int can_send(struct sk_buff *skb, int loop) | |||
254 | newskb->sk = skb->sk; | 254 | newskb->sk = skb->sk; |
255 | newskb->ip_summed = CHECKSUM_UNNECESSARY; | 255 | newskb->ip_summed = CHECKSUM_UNNECESSARY; |
256 | newskb->pkt_type = PACKET_BROADCAST; | 256 | newskb->pkt_type = PACKET_BROADCAST; |
257 | netif_rx(newskb); | ||
258 | } | 257 | } |
259 | } else { | 258 | } else { |
260 | /* indication for the CAN driver: no loopback required */ | 259 | /* indication for the CAN driver: no loopback required */ |
@@ -266,11 +265,20 @@ int can_send(struct sk_buff *skb, int loop) | |||
266 | if (err > 0) | 265 | if (err > 0) |
267 | err = net_xmit_errno(err); | 266 | err = net_xmit_errno(err); |
268 | 267 | ||
268 | if (err) { | ||
269 | if (newskb) | ||
270 | kfree_skb(newskb); | ||
271 | return err; | ||
272 | } | ||
273 | |||
274 | if (newskb) | ||
275 | netif_rx(newskb); | ||
276 | |||
269 | /* update statistics */ | 277 | /* update statistics */ |
270 | can_stats.tx_frames++; | 278 | can_stats.tx_frames++; |
271 | can_stats.tx_frames_delta++; | 279 | can_stats.tx_frames_delta++; |
272 | 280 | ||
273 | return err; | 281 | return 0; |
274 | } | 282 | } |
275 | EXPORT_SYMBOL(can_send); | 283 | EXPORT_SYMBOL(can_send); |
276 | 284 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index d334446a8ea..a1607bc0cd4 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -994,6 +994,8 @@ int dev_open(struct net_device *dev) | |||
994 | { | 994 | { |
995 | int ret = 0; | 995 | int ret = 0; |
996 | 996 | ||
997 | ASSERT_RTNL(); | ||
998 | |||
997 | /* | 999 | /* |
998 | * Is it already up? | 1000 | * Is it already up? |
999 | */ | 1001 | */ |
@@ -1060,6 +1062,8 @@ int dev_open(struct net_device *dev) | |||
1060 | */ | 1062 | */ |
1061 | int dev_close(struct net_device *dev) | 1063 | int dev_close(struct net_device *dev) |
1062 | { | 1064 | { |
1065 | ASSERT_RTNL(); | ||
1066 | |||
1063 | might_sleep(); | 1067 | might_sleep(); |
1064 | 1068 | ||
1065 | if (!(dev->flags & IFF_UP)) | 1069 | if (!(dev->flags & IFF_UP)) |
@@ -4480,17 +4484,19 @@ static void __net_exit default_device_exit(struct net *net) | |||
4480 | rtnl_lock(); | 4484 | rtnl_lock(); |
4481 | for_each_netdev_safe(net, dev, next) { | 4485 | for_each_netdev_safe(net, dev, next) { |
4482 | int err; | 4486 | int err; |
4487 | char fb_name[IFNAMSIZ]; | ||
4483 | 4488 | ||
4484 | /* Ignore unmoveable devices (i.e. loopback) */ | 4489 | /* Ignore unmoveable devices (i.e. loopback) */ |
4485 | if (dev->features & NETIF_F_NETNS_LOCAL) | 4490 | if (dev->features & NETIF_F_NETNS_LOCAL) |
4486 | continue; | 4491 | continue; |
4487 | 4492 | ||
4488 | /* Push remaing network devices to init_net */ | 4493 | /* Push remaing network devices to init_net */ |
4489 | err = dev_change_net_namespace(dev, &init_net, "dev%d"); | 4494 | snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); |
4495 | err = dev_change_net_namespace(dev, &init_net, fb_name); | ||
4490 | if (err) { | 4496 | if (err) { |
4491 | printk(KERN_WARNING "%s: failed to move %s to init_net: %d\n", | 4497 | printk(KERN_EMERG "%s: failed to move %s to init_net: %d\n", |
4492 | __func__, dev->name, err); | 4498 | __func__, dev->name, err); |
4493 | unregister_netdevice(dev); | 4499 | BUG(); |
4494 | } | 4500 | } |
4495 | } | 4501 | } |
4496 | rtnl_unlock(); | 4502 | rtnl_unlock(); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 4fe605fa6f8..5c459f2b798 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -200,7 +200,9 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, | |||
200 | goto nodata; | 200 | goto nodata; |
201 | 201 | ||
202 | /* | 202 | /* |
203 | * See comment in sk_buff definition, just before the 'tail' member | 203 | * Only clear those fields we need to clear, not those that we will |
204 | * actually initialise below. Hence, don't put any more fields after | ||
205 | * the tail pointer in struct sk_buff! | ||
204 | */ | 206 | */ |
205 | memset(skb, 0, offsetof(struct sk_buff, tail)); | 207 | memset(skb, 0, offsetof(struct sk_buff, tail)); |
206 | skb->truesize = size + sizeof(struct sk_buff); | 208 | skb->truesize = size + sizeof(struct sk_buff); |
diff --git a/net/dccp/feat.c b/net/dccp/feat.c index 4a4f6ce4498..933a0ecf8d4 100644 --- a/net/dccp/feat.c +++ b/net/dccp/feat.c | |||
@@ -32,7 +32,7 @@ int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature, | |||
32 | 32 | ||
33 | if (len > 3) { | 33 | if (len > 3) { |
34 | DCCP_WARN("invalid length %d\n", len); | 34 | DCCP_WARN("invalid length %d\n", len); |
35 | return 1; | 35 | return -EINVAL; |
36 | } | 36 | } |
37 | /* XXX add further sanity checks */ | 37 | /* XXX add further sanity checks */ |
38 | 38 | ||
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 2f665a51647..f50e88bf266 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -235,14 +235,14 @@ static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu) | |||
235 | else | 235 | else |
236 | min_mtu -= 21; | 236 | min_mtu -= 21; |
237 | 237 | ||
238 | if (dst->metrics[RTAX_MTU-1] > mtu && mtu >= min_mtu) { | 238 | if (dst_metric(dst, RTAX_MTU) > mtu && mtu >= min_mtu) { |
239 | if (!(dst_metric_locked(dst, RTAX_MTU))) { | 239 | if (!(dst_metric_locked(dst, RTAX_MTU))) { |
240 | dst->metrics[RTAX_MTU-1] = mtu; | 240 | dst->metrics[RTAX_MTU-1] = mtu; |
241 | dst_set_expires(dst, dn_rt_mtu_expires); | 241 | dst_set_expires(dst, dn_rt_mtu_expires); |
242 | } | 242 | } |
243 | if (!(dst_metric_locked(dst, RTAX_ADVMSS))) { | 243 | if (!(dst_metric_locked(dst, RTAX_ADVMSS))) { |
244 | u32 mss = mtu - DN_MAX_NSP_DATA_HEADER; | 244 | u32 mss = mtu - DN_MAX_NSP_DATA_HEADER; |
245 | if (dst->metrics[RTAX_ADVMSS-1] > mss) | 245 | if (dst_metric(dst, RTAX_ADVMSS) > mss) |
246 | dst->metrics[RTAX_ADVMSS-1] = mss; | 246 | dst->metrics[RTAX_ADVMSS-1] = mss; |
247 | } | 247 | } |
248 | } | 248 | } |
@@ -805,12 +805,12 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) | |||
805 | rt->u.dst.neighbour = n; | 805 | rt->u.dst.neighbour = n; |
806 | } | 806 | } |
807 | 807 | ||
808 | if (rt->u.dst.metrics[RTAX_MTU-1] == 0 || | 808 | if (dst_metric(&rt->u.dst, RTAX_MTU) == 0 || |
809 | rt->u.dst.metrics[RTAX_MTU-1] > rt->u.dst.dev->mtu) | 809 | dst_metric(&rt->u.dst, RTAX_MTU) > rt->u.dst.dev->mtu) |
810 | rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu; | 810 | rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu; |
811 | mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->u.dst)); | 811 | mss = dn_mss_from_pmtu(dev, dst_mtu(&rt->u.dst)); |
812 | if (rt->u.dst.metrics[RTAX_ADVMSS-1] == 0 || | 812 | if (dst_metric(&rt->u.dst, RTAX_ADVMSS) == 0 || |
813 | rt->u.dst.metrics[RTAX_ADVMSS-1] > mss) | 813 | dst_metric(&rt->u.dst, RTAX_ADVMSS) > mss) |
814 | rt->u.dst.metrics[RTAX_ADVMSS-1] = mss; | 814 | rt->u.dst.metrics[RTAX_ADVMSS-1] = mss; |
815 | return 0; | 815 | return 0; |
816 | } | 816 | } |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 7b4bad6d572..ff77a4a7f9e 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -397,7 +397,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, | |||
397 | iph = ip_hdr(skb); | 397 | iph = ip_hdr(skb); |
398 | 398 | ||
399 | /* | 399 | /* |
400 | * RFC1122: 3.1.2.2 MUST silently discard any IP frame that fails the checksum. | 400 | * RFC1122: 3.2.1.2 MUST silently discard any IP frame that fails the checksum. |
401 | * | 401 | * |
402 | * Is the datagram acceptable? | 402 | * Is the datagram acceptable? |
403 | * | 403 | * |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 5e3685c5c40..92f90ae46f4 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1468,14 +1468,14 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | |||
1468 | 1468 | ||
1469 | /* BSD 4.2 compatibility hack :-( */ | 1469 | /* BSD 4.2 compatibility hack :-( */ |
1470 | if (mtu == 0 && | 1470 | if (mtu == 0 && |
1471 | old_mtu >= rth->u.dst.metrics[RTAX_MTU-1] && | 1471 | old_mtu >= dst_metric(&rth->u.dst, RTAX_MTU) && |
1472 | old_mtu >= 68 + (iph->ihl << 2)) | 1472 | old_mtu >= 68 + (iph->ihl << 2)) |
1473 | old_mtu -= iph->ihl << 2; | 1473 | old_mtu -= iph->ihl << 2; |
1474 | 1474 | ||
1475 | mtu = guess_mtu(old_mtu); | 1475 | mtu = guess_mtu(old_mtu); |
1476 | } | 1476 | } |
1477 | if (mtu <= rth->u.dst.metrics[RTAX_MTU-1]) { | 1477 | if (mtu <= dst_metric(&rth->u.dst, RTAX_MTU)) { |
1478 | if (mtu < rth->u.dst.metrics[RTAX_MTU-1]) { | 1478 | if (mtu < dst_metric(&rth->u.dst, RTAX_MTU)) { |
1479 | dst_confirm(&rth->u.dst); | 1479 | dst_confirm(&rth->u.dst); |
1480 | if (mtu < ip_rt_min_pmtu) { | 1480 | if (mtu < ip_rt_min_pmtu) { |
1481 | mtu = ip_rt_min_pmtu; | 1481 | mtu = ip_rt_min_pmtu; |
@@ -1497,7 +1497,7 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | |||
1497 | 1497 | ||
1498 | static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) | 1498 | static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) |
1499 | { | 1499 | { |
1500 | if (dst->metrics[RTAX_MTU-1] > mtu && mtu >= 68 && | 1500 | if (dst_metric(dst, RTAX_MTU) > mtu && mtu >= 68 && |
1501 | !(dst_metric_locked(dst, RTAX_MTU))) { | 1501 | !(dst_metric_locked(dst, RTAX_MTU))) { |
1502 | if (mtu < ip_rt_min_pmtu) { | 1502 | if (mtu < ip_rt_min_pmtu) { |
1503 | mtu = ip_rt_min_pmtu; | 1503 | mtu = ip_rt_min_pmtu; |
@@ -1613,7 +1613,7 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) | |||
1613 | sizeof(rt->u.dst.metrics)); | 1613 | sizeof(rt->u.dst.metrics)); |
1614 | if (fi->fib_mtu == 0) { | 1614 | if (fi->fib_mtu == 0) { |
1615 | rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu; | 1615 | rt->u.dst.metrics[RTAX_MTU-1] = rt->u.dst.dev->mtu; |
1616 | if (rt->u.dst.metrics[RTAX_LOCK-1] & (1 << RTAX_MTU) && | 1616 | if (dst_metric_locked(&rt->u.dst, RTAX_MTU) && |
1617 | rt->rt_gateway != rt->rt_dst && | 1617 | rt->rt_gateway != rt->rt_dst && |
1618 | rt->u.dst.dev->mtu > 576) | 1618 | rt->u.dst.dev->mtu > 576) |
1619 | rt->u.dst.metrics[RTAX_MTU-1] = 576; | 1619 | rt->u.dst.metrics[RTAX_MTU-1] = 576; |
@@ -1624,14 +1624,14 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag) | |||
1624 | } else | 1624 | } else |
1625 | rt->u.dst.metrics[RTAX_MTU-1]= rt->u.dst.dev->mtu; | 1625 | rt->u.dst.metrics[RTAX_MTU-1]= rt->u.dst.dev->mtu; |
1626 | 1626 | ||
1627 | if (rt->u.dst.metrics[RTAX_HOPLIMIT-1] == 0) | 1627 | if (dst_metric(&rt->u.dst, RTAX_HOPLIMIT) == 0) |
1628 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = sysctl_ip_default_ttl; | 1628 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = sysctl_ip_default_ttl; |
1629 | if (rt->u.dst.metrics[RTAX_MTU-1] > IP_MAX_MTU) | 1629 | if (dst_metric(&rt->u.dst, RTAX_MTU) > IP_MAX_MTU) |
1630 | rt->u.dst.metrics[RTAX_MTU-1] = IP_MAX_MTU; | 1630 | rt->u.dst.metrics[RTAX_MTU-1] = IP_MAX_MTU; |
1631 | if (rt->u.dst.metrics[RTAX_ADVMSS-1] == 0) | 1631 | if (dst_metric(&rt->u.dst, RTAX_ADVMSS) == 0) |
1632 | rt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, rt->u.dst.dev->mtu - 40, | 1632 | rt->u.dst.metrics[RTAX_ADVMSS-1] = max_t(unsigned int, rt->u.dst.dev->mtu - 40, |
1633 | ip_rt_min_advmss); | 1633 | ip_rt_min_advmss); |
1634 | if (rt->u.dst.metrics[RTAX_ADVMSS-1] > 65535 - 40) | 1634 | if (dst_metric(&rt->u.dst, RTAX_ADVMSS) > 65535 - 40) |
1635 | rt->u.dst.metrics[RTAX_ADVMSS-1] = 65535 - 40; | 1635 | rt->u.dst.metrics[RTAX_ADVMSS-1] = 65535 - 40; |
1636 | 1636 | ||
1637 | #ifdef CONFIG_NET_CLS_ROUTE | 1637 | #ifdef CONFIG_NET_CLS_ROUTE |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index eda4f4a233f..26c936930e9 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <linux/mm.h> | 66 | #include <linux/mm.h> |
67 | #include <linux/module.h> | 67 | #include <linux/module.h> |
68 | #include <linux/sysctl.h> | 68 | #include <linux/sysctl.h> |
69 | #include <net/dst.h> | ||
69 | #include <net/tcp.h> | 70 | #include <net/tcp.h> |
70 | #include <net/inet_common.h> | 71 | #include <net/inet_common.h> |
71 | #include <linux/ipsec.h> | 72 | #include <linux/ipsec.h> |
@@ -113,8 +114,6 @@ int sysctl_tcp_abc __read_mostly; | |||
113 | #define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED) | 114 | #define FLAG_FORWARD_PROGRESS (FLAG_ACKED|FLAG_DATA_SACKED) |
114 | #define FLAG_ANY_PROGRESS (FLAG_FORWARD_PROGRESS|FLAG_SND_UNA_ADVANCED) | 115 | #define FLAG_ANY_PROGRESS (FLAG_FORWARD_PROGRESS|FLAG_SND_UNA_ADVANCED) |
115 | 116 | ||
116 | #define IsSackFrto() (sysctl_tcp_frto == 0x2) | ||
117 | |||
118 | #define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH) | 117 | #define TCP_REMNANT (TCP_FLAG_FIN|TCP_FLAG_URG|TCP_FLAG_SYN|TCP_FLAG_PSH) |
119 | #define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH)) | 118 | #define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH)) |
120 | 119 | ||
@@ -605,7 +604,7 @@ static u32 tcp_rto_min(struct sock *sk) | |||
605 | u32 rto_min = TCP_RTO_MIN; | 604 | u32 rto_min = TCP_RTO_MIN; |
606 | 605 | ||
607 | if (dst && dst_metric_locked(dst, RTAX_RTO_MIN)) | 606 | if (dst && dst_metric_locked(dst, RTAX_RTO_MIN)) |
608 | rto_min = dst->metrics[RTAX_RTO_MIN - 1]; | 607 | rto_min = dst_metric(dst, RTAX_RTO_MIN); |
609 | return rto_min; | 608 | return rto_min; |
610 | } | 609 | } |
611 | 610 | ||
@@ -769,7 +768,7 @@ void tcp_update_metrics(struct sock *sk) | |||
769 | dst->metrics[RTAX_RTTVAR - 1] = m; | 768 | dst->metrics[RTAX_RTTVAR - 1] = m; |
770 | else | 769 | else |
771 | dst->metrics[RTAX_RTTVAR-1] -= | 770 | dst->metrics[RTAX_RTTVAR-1] -= |
772 | (dst->metrics[RTAX_RTTVAR-1] - m)>>2; | 771 | (dst_metric(dst, RTAX_RTTVAR) - m)>>2; |
773 | } | 772 | } |
774 | 773 | ||
775 | if (tp->snd_ssthresh >= 0xFFFF) { | 774 | if (tp->snd_ssthresh >= 0xFFFF) { |
@@ -788,21 +787,21 @@ void tcp_update_metrics(struct sock *sk) | |||
788 | dst->metrics[RTAX_SSTHRESH-1] = | 787 | dst->metrics[RTAX_SSTHRESH-1] = |
789 | max(tp->snd_cwnd >> 1, tp->snd_ssthresh); | 788 | max(tp->snd_cwnd >> 1, tp->snd_ssthresh); |
790 | if (!dst_metric_locked(dst, RTAX_CWND)) | 789 | if (!dst_metric_locked(dst, RTAX_CWND)) |
791 | dst->metrics[RTAX_CWND-1] = (dst->metrics[RTAX_CWND-1] + tp->snd_cwnd) >> 1; | 790 | dst->metrics[RTAX_CWND-1] = (dst_metric(dst, RTAX_CWND) + tp->snd_cwnd) >> 1; |
792 | } else { | 791 | } else { |
793 | /* Else slow start did not finish, cwnd is non-sense, | 792 | /* Else slow start did not finish, cwnd is non-sense, |
794 | ssthresh may be also invalid. | 793 | ssthresh may be also invalid. |
795 | */ | 794 | */ |
796 | if (!dst_metric_locked(dst, RTAX_CWND)) | 795 | if (!dst_metric_locked(dst, RTAX_CWND)) |
797 | dst->metrics[RTAX_CWND-1] = (dst->metrics[RTAX_CWND-1] + tp->snd_ssthresh) >> 1; | 796 | dst->metrics[RTAX_CWND-1] = (dst_metric(dst, RTAX_CWND) + tp->snd_ssthresh) >> 1; |
798 | if (dst->metrics[RTAX_SSTHRESH-1] && | 797 | if (dst_metric(dst, RTAX_SSTHRESH) && |
799 | !dst_metric_locked(dst, RTAX_SSTHRESH) && | 798 | !dst_metric_locked(dst, RTAX_SSTHRESH) && |
800 | tp->snd_ssthresh > dst->metrics[RTAX_SSTHRESH-1]) | 799 | tp->snd_ssthresh > dst_metric(dst, RTAX_SSTHRESH)) |
801 | dst->metrics[RTAX_SSTHRESH-1] = tp->snd_ssthresh; | 800 | dst->metrics[RTAX_SSTHRESH-1] = tp->snd_ssthresh; |
802 | } | 801 | } |
803 | 802 | ||
804 | if (!dst_metric_locked(dst, RTAX_REORDERING)) { | 803 | if (!dst_metric_locked(dst, RTAX_REORDERING)) { |
805 | if (dst->metrics[RTAX_REORDERING-1] < tp->reordering && | 804 | if (dst_metric(dst, RTAX_REORDERING) < tp->reordering && |
806 | tp->reordering != sysctl_tcp_reordering) | 805 | tp->reordering != sysctl_tcp_reordering) |
807 | dst->metrics[RTAX_REORDERING-1] = tp->reordering; | 806 | dst->metrics[RTAX_REORDERING-1] = tp->reordering; |
808 | } | 807 | } |
@@ -1685,6 +1684,11 @@ static inline void tcp_reset_reno_sack(struct tcp_sock *tp) | |||
1685 | tp->sacked_out = 0; | 1684 | tp->sacked_out = 0; |
1686 | } | 1685 | } |
1687 | 1686 | ||
1687 | static int tcp_is_sackfrto(const struct tcp_sock *tp) | ||
1688 | { | ||
1689 | return (sysctl_tcp_frto == 0x2) && !tcp_is_reno(tp); | ||
1690 | } | ||
1691 | |||
1688 | /* F-RTO can only be used if TCP has never retransmitted anything other than | 1692 | /* F-RTO can only be used if TCP has never retransmitted anything other than |
1689 | * head (SACK enhanced variant from Appendix B of RFC4138 is more robust here) | 1693 | * head (SACK enhanced variant from Appendix B of RFC4138 is more robust here) |
1690 | */ | 1694 | */ |
@@ -1701,7 +1705,7 @@ int tcp_use_frto(struct sock *sk) | |||
1701 | if (icsk->icsk_mtup.probe_size) | 1705 | if (icsk->icsk_mtup.probe_size) |
1702 | return 0; | 1706 | return 0; |
1703 | 1707 | ||
1704 | if (IsSackFrto()) | 1708 | if (tcp_is_sackfrto(tp)) |
1705 | return 1; | 1709 | return 1; |
1706 | 1710 | ||
1707 | /* Avoid expensive walking of rexmit queue if possible */ | 1711 | /* Avoid expensive walking of rexmit queue if possible */ |
@@ -1791,7 +1795,7 @@ void tcp_enter_frto(struct sock *sk) | |||
1791 | /* Earlier loss recovery underway (see RFC4138; Appendix B). | 1795 | /* Earlier loss recovery underway (see RFC4138; Appendix B). |
1792 | * The last condition is necessary at least in tp->frto_counter case. | 1796 | * The last condition is necessary at least in tp->frto_counter case. |
1793 | */ | 1797 | */ |
1794 | if (IsSackFrto() && (tp->frto_counter || | 1798 | if (tcp_is_sackfrto(tp) && (tp->frto_counter || |
1795 | ((1 << icsk->icsk_ca_state) & (TCPF_CA_Recovery|TCPF_CA_Loss))) && | 1799 | ((1 << icsk->icsk_ca_state) & (TCPF_CA_Recovery|TCPF_CA_Loss))) && |
1796 | after(tp->high_seq, tp->snd_una)) { | 1800 | after(tp->high_seq, tp->snd_una)) { |
1797 | tp->frto_highmark = tp->high_seq; | 1801 | tp->frto_highmark = tp->high_seq; |
@@ -3123,7 +3127,7 @@ static int tcp_process_frto(struct sock *sk, int flag) | |||
3123 | return 1; | 3127 | return 1; |
3124 | } | 3128 | } |
3125 | 3129 | ||
3126 | if (!IsSackFrto() || tcp_is_reno(tp)) { | 3130 | if (!tcp_is_sackfrto(tp)) { |
3127 | /* RFC4138 shortcoming in step 2; should also have case c): | 3131 | /* RFC4138 shortcoming in step 2; should also have case c): |
3128 | * ACK isn't duplicate nor advances window, e.g., opposite dir | 3132 | * ACK isn't duplicate nor advances window, e.g., opposite dir |
3129 | * data, winupdate | 3133 | * data, winupdate |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index a493ad9b891..12bba088034 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1243,11 +1243,11 @@ install_route: | |||
1243 | } | 1243 | } |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | if (rt->u.dst.metrics[RTAX_HOPLIMIT-1] == 0) | 1246 | if (dst_metric(&rt->u.dst, RTAX_HOPLIMIT) == 0) |
1247 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = -1; | 1247 | rt->u.dst.metrics[RTAX_HOPLIMIT-1] = -1; |
1248 | if (!rt->u.dst.metrics[RTAX_MTU-1]) | 1248 | if (!dst_metric(&rt->u.dst, RTAX_MTU)) |
1249 | rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev); | 1249 | rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(dev); |
1250 | if (!rt->u.dst.metrics[RTAX_ADVMSS-1]) | 1250 | if (!dst_metric(&rt->u.dst, RTAX_ADVMSS)) |
1251 | rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(net, dst_mtu(&rt->u.dst)); | 1251 | rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(net, dst_mtu(&rt->u.dst)); |
1252 | rt->u.dst.dev = dev; | 1252 | rt->u.dst.dev = dev; |
1253 | rt->rt6i_idev = idev; | 1253 | rt->rt6i_idev = idev; |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 4b2f1033994..5a6fab95569 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -596,9 +596,9 @@ static int ipip6_rcv(struct sk_buff *skb) | |||
596 | } | 596 | } |
597 | 597 | ||
598 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); | 598 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); |
599 | kfree_skb(skb); | ||
600 | read_unlock(&ipip6_lock); | 599 | read_unlock(&ipip6_lock); |
601 | out: | 600 | out: |
601 | kfree_skb(skb); | ||
602 | return 0; | 602 | return 0; |
603 | } | 603 | } |
604 | 604 | ||
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 9ad4e3631b6..915afadb060 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -1766,6 +1766,7 @@ fail_wep: | |||
1766 | fail_rate: | 1766 | fail_rate: |
1767 | ieee80211_debugfs_remove_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); | 1767 | ieee80211_debugfs_remove_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); |
1768 | unregister_netdevice(local->mdev); | 1768 | unregister_netdevice(local->mdev); |
1769 | local->mdev = NULL; | ||
1769 | fail_dev: | 1770 | fail_dev: |
1770 | rtnl_unlock(); | 1771 | rtnl_unlock(); |
1771 | sta_info_stop(local); | 1772 | sta_info_stop(local); |
@@ -1773,8 +1774,10 @@ fail_sta_info: | |||
1773 | debugfs_hw_del(local); | 1774 | debugfs_hw_del(local); |
1774 | destroy_workqueue(local->hw.workqueue); | 1775 | destroy_workqueue(local->hw.workqueue); |
1775 | fail_workqueue: | 1776 | fail_workqueue: |
1776 | ieee80211_if_free(local->mdev); | 1777 | if (local->mdev != NULL) { |
1777 | local->mdev = NULL; | 1778 | ieee80211_if_free(local->mdev); |
1779 | local->mdev = NULL; | ||
1780 | } | ||
1778 | fail_mdev_alloc: | 1781 | fail_mdev_alloc: |
1779 | wiphy_unregister(local->hw.wiphy); | 1782 | wiphy_unregister(local->hw.wiphy); |
1780 | return result; | 1783 | return result; |
diff --git a/net/mac80211/rc80211_pid_debugfs.c b/net/mac80211/rc80211_pid_debugfs.c index ae75d417873..ff5c380f3c1 100644 --- a/net/mac80211/rc80211_pid_debugfs.c +++ b/net/mac80211/rc80211_pid_debugfs.c | |||
@@ -85,7 +85,7 @@ static int rate_control_pid_events_open(struct inode *inode, struct file *file) | |||
85 | struct rc_pid_sta_info *sinfo = inode->i_private; | 85 | struct rc_pid_sta_info *sinfo = inode->i_private; |
86 | struct rc_pid_event_buffer *events = &sinfo->events; | 86 | struct rc_pid_event_buffer *events = &sinfo->events; |
87 | struct rc_pid_events_file_info *file_info; | 87 | struct rc_pid_events_file_info *file_info; |
88 | unsigned int status; | 88 | unsigned long status; |
89 | 89 | ||
90 | /* Allocate a state struct */ | 90 | /* Allocate a state struct */ |
91 | file_info = kmalloc(sizeof(*file_info), GFP_KERNEL); | 91 | file_info = kmalloc(sizeof(*file_info), GFP_KERNEL); |
@@ -135,7 +135,7 @@ static ssize_t rate_control_pid_events_read(struct file *file, char __user *buf, | |||
135 | char pb[RC_PID_PRINT_BUF_SIZE]; | 135 | char pb[RC_PID_PRINT_BUF_SIZE]; |
136 | int ret; | 136 | int ret; |
137 | int p; | 137 | int p; |
138 | unsigned int status; | 138 | unsigned long status; |
139 | 139 | ||
140 | /* Check if there is something to read. */ | 140 | /* Check if there is something to read. */ |
141 | if (events->next_entry == file_info->next_entry) { | 141 | if (events->next_entry == file_info->next_entry) { |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index c1fc0f1a641..aa8d80c35e2 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -90,6 +90,7 @@ config NF_CT_PROTO_DCCP | |||
90 | tristate 'DCCP protocol connection tracking support (EXPERIMENTAL)' | 90 | tristate 'DCCP protocol connection tracking support (EXPERIMENTAL)' |
91 | depends on EXPERIMENTAL && NF_CONNTRACK | 91 | depends on EXPERIMENTAL && NF_CONNTRACK |
92 | depends on NETFILTER_ADVANCED | 92 | depends on NETFILTER_ADVANCED |
93 | default IP_DCCP | ||
93 | help | 94 | help |
94 | With this option enabled, the layer 3 independent connection | 95 | With this option enabled, the layer 3 independent connection |
95 | tracking code will be able to do state tracking on DCCP connections. | 96 | tracking code will be able to do state tracking on DCCP connections. |
@@ -104,6 +105,7 @@ config NF_CT_PROTO_SCTP | |||
104 | tristate 'SCTP protocol connection tracking support (EXPERIMENTAL)' | 105 | tristate 'SCTP protocol connection tracking support (EXPERIMENTAL)' |
105 | depends on EXPERIMENTAL && NF_CONNTRACK | 106 | depends on EXPERIMENTAL && NF_CONNTRACK |
106 | depends on NETFILTER_ADVANCED | 107 | depends on NETFILTER_ADVANCED |
108 | default IP_SCTP | ||
107 | help | 109 | help |
108 | With this option enabled, the layer 3 independent connection | 110 | With this option enabled, the layer 3 independent connection |
109 | tracking code will be able to do state tracking on SCTP connections. | 111 | tracking code will be able to do state tracking on SCTP connections. |
@@ -532,6 +534,7 @@ config NETFILTER_XT_MATCH_DCCP | |||
532 | tristate '"dccp" protocol match support' | 534 | tristate '"dccp" protocol match support' |
533 | depends on NETFILTER_XTABLES | 535 | depends on NETFILTER_XTABLES |
534 | depends on NETFILTER_ADVANCED | 536 | depends on NETFILTER_ADVANCED |
537 | default IP_DCCP | ||
535 | help | 538 | help |
536 | With this option enabled, you will be able to use the iptables | 539 | With this option enabled, you will be able to use the iptables |
537 | `dccp' match in order to match on DCCP source/destination ports | 540 | `dccp' match in order to match on DCCP source/destination ports |
@@ -725,6 +728,7 @@ config NETFILTER_XT_MATCH_SCTP | |||
725 | tristate '"sctp" protocol match support (EXPERIMENTAL)' | 728 | tristate '"sctp" protocol match support (EXPERIMENTAL)' |
726 | depends on NETFILTER_XTABLES && EXPERIMENTAL | 729 | depends on NETFILTER_XTABLES && EXPERIMENTAL |
727 | depends on NETFILTER_ADVANCED | 730 | depends on NETFILTER_ADVANCED |
731 | default IP_SCTP | ||
728 | help | 732 | help |
729 | With this option enabled, you will be able to use the | 733 | With this option enabled, you will be able to use the |
730 | `sctp' match in order to match on SCTP source/destination ports | 734 | `sctp' match in order to match on SCTP source/destination ports |
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c index 9f490006956..2f9bbc058b4 100644 --- a/net/netfilter/nf_conntrack_sip.c +++ b/net/netfilter/nf_conntrack_sip.c | |||
@@ -870,6 +870,7 @@ static int process_sdp(struct sk_buff *skb, | |||
870 | { | 870 | { |
871 | enum ip_conntrack_info ctinfo; | 871 | enum ip_conntrack_info ctinfo; |
872 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); | 872 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); |
873 | struct nf_conn_help *help = nfct_help(ct); | ||
873 | unsigned int matchoff, matchlen; | 874 | unsigned int matchoff, matchlen; |
874 | unsigned int mediaoff, medialen; | 875 | unsigned int mediaoff, medialen; |
875 | unsigned int sdpoff; | 876 | unsigned int sdpoff; |
@@ -959,6 +960,9 @@ static int process_sdp(struct sk_buff *skb, | |||
959 | if (nf_nat_sdp_session && ct->status & IPS_NAT_MASK) | 960 | if (nf_nat_sdp_session && ct->status & IPS_NAT_MASK) |
960 | ret = nf_nat_sdp_session(skb, dptr, sdpoff, datalen, &rtp_addr); | 961 | ret = nf_nat_sdp_session(skb, dptr, sdpoff, datalen, &rtp_addr); |
961 | 962 | ||
963 | if (ret == NF_ACCEPT && i > 0) | ||
964 | help->help.ct_sip_info.invite_cseq = cseq; | ||
965 | |||
962 | return ret; | 966 | return ret; |
963 | } | 967 | } |
964 | static int process_invite_response(struct sk_buff *skb, | 968 | static int process_invite_response(struct sk_buff *skb, |
@@ -967,14 +971,14 @@ static int process_invite_response(struct sk_buff *skb, | |||
967 | { | 971 | { |
968 | enum ip_conntrack_info ctinfo; | 972 | enum ip_conntrack_info ctinfo; |
969 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); | 973 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); |
974 | struct nf_conn_help *help = nfct_help(ct); | ||
970 | 975 | ||
971 | if ((code >= 100 && code <= 199) || | 976 | if ((code >= 100 && code <= 199) || |
972 | (code >= 200 && code <= 299)) | 977 | (code >= 200 && code <= 299)) |
973 | return process_sdp(skb, dptr, datalen, cseq); | 978 | return process_sdp(skb, dptr, datalen, cseq); |
974 | else { | 979 | else if (help->help.ct_sip_info.invite_cseq == cseq) |
975 | flush_expectations(ct, true); | 980 | flush_expectations(ct, true); |
976 | return NF_ACCEPT; | 981 | return NF_ACCEPT; |
977 | } | ||
978 | } | 982 | } |
979 | 983 | ||
980 | static int process_update_response(struct sk_buff *skb, | 984 | static int process_update_response(struct sk_buff *skb, |
@@ -983,14 +987,14 @@ static int process_update_response(struct sk_buff *skb, | |||
983 | { | 987 | { |
984 | enum ip_conntrack_info ctinfo; | 988 | enum ip_conntrack_info ctinfo; |
985 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); | 989 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); |
990 | struct nf_conn_help *help = nfct_help(ct); | ||
986 | 991 | ||
987 | if ((code >= 100 && code <= 199) || | 992 | if ((code >= 100 && code <= 199) || |
988 | (code >= 200 && code <= 299)) | 993 | (code >= 200 && code <= 299)) |
989 | return process_sdp(skb, dptr, datalen, cseq); | 994 | return process_sdp(skb, dptr, datalen, cseq); |
990 | else { | 995 | else if (help->help.ct_sip_info.invite_cseq == cseq) |
991 | flush_expectations(ct, true); | 996 | flush_expectations(ct, true); |
992 | return NF_ACCEPT; | 997 | return NF_ACCEPT; |
993 | } | ||
994 | } | 998 | } |
995 | 999 | ||
996 | static int process_prack_response(struct sk_buff *skb, | 1000 | static int process_prack_response(struct sk_buff *skb, |
@@ -999,14 +1003,14 @@ static int process_prack_response(struct sk_buff *skb, | |||
999 | { | 1003 | { |
1000 | enum ip_conntrack_info ctinfo; | 1004 | enum ip_conntrack_info ctinfo; |
1001 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); | 1005 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); |
1006 | struct nf_conn_help *help = nfct_help(ct); | ||
1002 | 1007 | ||
1003 | if ((code >= 100 && code <= 199) || | 1008 | if ((code >= 100 && code <= 199) || |
1004 | (code >= 200 && code <= 299)) | 1009 | (code >= 200 && code <= 299)) |
1005 | return process_sdp(skb, dptr, datalen, cseq); | 1010 | return process_sdp(skb, dptr, datalen, cseq); |
1006 | else { | 1011 | else if (help->help.ct_sip_info.invite_cseq == cseq) |
1007 | flush_expectations(ct, true); | 1012 | flush_expectations(ct, true); |
1008 | return NF_ACCEPT; | 1013 | return NF_ACCEPT; |
1009 | } | ||
1010 | } | 1014 | } |
1011 | 1015 | ||
1012 | static int process_bye_request(struct sk_buff *skb, | 1016 | static int process_bye_request(struct sk_buff *skb, |
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 64b2d136c78..1d421d059ca 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * as published by the Free Software Foundation; either version | 6 | * as published by the Free Software Foundation; either version |
7 | * 2 of the License, or (at your option) any later version. | 7 | * 2 of the License, or (at your option) any later version. |
8 | * | 8 | * |
9 | * Authors: Jamal Hadi Salim (2005) | 9 | * Authors: Jamal Hadi Salim (2005-8) |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
@@ -34,6 +34,7 @@ static struct tcf_hashinfo simp_hash_info = { | |||
34 | .lock = &simp_lock, | 34 | .lock = &simp_lock, |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #define SIMP_MAX_DATA 32 | ||
37 | static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res) | 38 | static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res) |
38 | { | 39 | { |
39 | struct tcf_defact *d = a->priv; | 40 | struct tcf_defact *d = a->priv; |
@@ -69,23 +70,28 @@ static int tcf_simp_release(struct tcf_defact *d, int bind) | |||
69 | return ret; | 70 | return ret; |
70 | } | 71 | } |
71 | 72 | ||
72 | static int alloc_defdata(struct tcf_defact *d, u32 datalen, void *defdata) | 73 | static int alloc_defdata(struct tcf_defact *d, char *defdata) |
73 | { | 74 | { |
74 | d->tcfd_defdata = kmemdup(defdata, datalen, GFP_KERNEL); | 75 | d->tcfd_defdata = kstrndup(defdata, SIMP_MAX_DATA, GFP_KERNEL); |
75 | if (unlikely(!d->tcfd_defdata)) | 76 | if (unlikely(!d->tcfd_defdata)) |
76 | return -ENOMEM; | 77 | return -ENOMEM; |
77 | d->tcfd_datalen = datalen; | 78 | |
78 | return 0; | 79 | return 0; |
79 | } | 80 | } |
80 | 81 | ||
81 | static int realloc_defdata(struct tcf_defact *d, u32 datalen, void *defdata) | 82 | static void reset_policy(struct tcf_defact *d, char *defdata, |
83 | struct tc_defact *p) | ||
82 | { | 84 | { |
83 | kfree(d->tcfd_defdata); | 85 | spin_lock_bh(&d->tcf_lock); |
84 | return alloc_defdata(d, datalen, defdata); | 86 | d->tcf_action = p->action; |
87 | memset(d->tcfd_defdata, 0, SIMP_MAX_DATA); | ||
88 | strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA); | ||
89 | spin_unlock_bh(&d->tcf_lock); | ||
85 | } | 90 | } |
86 | 91 | ||
87 | static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = { | 92 | static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = { |
88 | [TCA_DEF_PARMS] = { .len = sizeof(struct tc_defact) }, | 93 | [TCA_DEF_PARMS] = { .len = sizeof(struct tc_defact) }, |
94 | [TCA_DEF_DATA] = { .type = NLA_STRING, .len = SIMP_MAX_DATA }, | ||
89 | }; | 95 | }; |
90 | 96 | ||
91 | static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, | 97 | static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, |
@@ -95,28 +101,24 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, | |||
95 | struct tc_defact *parm; | 101 | struct tc_defact *parm; |
96 | struct tcf_defact *d; | 102 | struct tcf_defact *d; |
97 | struct tcf_common *pc; | 103 | struct tcf_common *pc; |
98 | void *defdata; | 104 | char *defdata; |
99 | u32 datalen = 0; | ||
100 | int ret = 0, err; | 105 | int ret = 0, err; |
101 | 106 | ||
102 | if (nla == NULL) | 107 | if (nla == NULL) |
103 | return -EINVAL; | 108 | return -EINVAL; |
104 | 109 | ||
105 | err = nla_parse_nested(tb, TCA_DEF_MAX, nla, NULL); | 110 | err = nla_parse_nested(tb, TCA_DEF_MAX, nla, simple_policy); |
106 | if (err < 0) | 111 | if (err < 0) |
107 | return err; | 112 | return err; |
108 | 113 | ||
109 | if (tb[TCA_DEF_PARMS] == NULL) | 114 | if (tb[TCA_DEF_PARMS] == NULL) |
110 | return -EINVAL; | 115 | return -EINVAL; |
111 | 116 | ||
112 | parm = nla_data(tb[TCA_DEF_PARMS]); | 117 | if (tb[TCA_DEF_DATA] == NULL) |
113 | defdata = nla_data(tb[TCA_DEF_DATA]); | ||
114 | if (defdata == NULL) | ||
115 | return -EINVAL; | 118 | return -EINVAL; |
116 | 119 | ||
117 | datalen = nla_len(tb[TCA_DEF_DATA]); | 120 | parm = nla_data(tb[TCA_DEF_PARMS]); |
118 | if (datalen == 0) | 121 | defdata = nla_data(tb[TCA_DEF_DATA]); |
119 | return -EINVAL; | ||
120 | 122 | ||
121 | pc = tcf_hash_check(parm->index, a, bind, &simp_hash_info); | 123 | pc = tcf_hash_check(parm->index, a, bind, &simp_hash_info); |
122 | if (!pc) { | 124 | if (!pc) { |
@@ -126,11 +128,12 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, | |||
126 | return -ENOMEM; | 128 | return -ENOMEM; |
127 | 129 | ||
128 | d = to_defact(pc); | 130 | d = to_defact(pc); |
129 | ret = alloc_defdata(d, datalen, defdata); | 131 | ret = alloc_defdata(d, defdata); |
130 | if (ret < 0) { | 132 | if (ret < 0) { |
131 | kfree(pc); | 133 | kfree(pc); |
132 | return ret; | 134 | return ret; |
133 | } | 135 | } |
136 | d->tcf_action = parm->action; | ||
134 | ret = ACT_P_CREATED; | 137 | ret = ACT_P_CREATED; |
135 | } else { | 138 | } else { |
136 | d = to_defact(pc); | 139 | d = to_defact(pc); |
@@ -138,13 +141,9 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, | |||
138 | tcf_simp_release(d, bind); | 141 | tcf_simp_release(d, bind); |
139 | return -EEXIST; | 142 | return -EEXIST; |
140 | } | 143 | } |
141 | realloc_defdata(d, datalen, defdata); | 144 | reset_policy(d, defdata, parm); |
142 | } | 145 | } |
143 | 146 | ||
144 | spin_lock_bh(&d->tcf_lock); | ||
145 | d->tcf_action = parm->action; | ||
146 | spin_unlock_bh(&d->tcf_lock); | ||
147 | |||
148 | if (ret == ACT_P_CREATED) | 147 | if (ret == ACT_P_CREATED) |
149 | tcf_hash_insert(pc, &simp_hash_info); | 148 | tcf_hash_insert(pc, &simp_hash_info); |
150 | return ret; | 149 | return ret; |
@@ -172,7 +171,7 @@ static inline int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a, | |||
172 | opt.bindcnt = d->tcf_bindcnt - bind; | 171 | opt.bindcnt = d->tcf_bindcnt - bind; |
173 | opt.action = d->tcf_action; | 172 | opt.action = d->tcf_action; |
174 | NLA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); | 173 | NLA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt); |
175 | NLA_PUT(skb, TCA_DEF_DATA, d->tcfd_datalen, d->tcfd_defdata); | 174 | NLA_PUT_STRING(skb, TCA_DEF_DATA, d->tcfd_defdata); |
176 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); | 175 | t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install); |
177 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); | 176 | t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse); |
178 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); | 177 | t.expires = jiffies_to_clock_t(d->tcf_tm.expires); |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 66148cc4759..5bc1ed49018 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1197,12 +1197,16 @@ static inline int htb_parent_last_child(struct htb_class *cl) | |||
1197 | return 1; | 1197 | return 1; |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | static void htb_parent_to_leaf(struct htb_class *cl, struct Qdisc *new_q) | 1200 | static void htb_parent_to_leaf(struct htb_sched *q, struct htb_class *cl, |
1201 | struct Qdisc *new_q) | ||
1201 | { | 1202 | { |
1202 | struct htb_class *parent = cl->parent; | 1203 | struct htb_class *parent = cl->parent; |
1203 | 1204 | ||
1204 | BUG_TRAP(!cl->level && cl->un.leaf.q && !cl->prio_activity); | 1205 | BUG_TRAP(!cl->level && cl->un.leaf.q && !cl->prio_activity); |
1205 | 1206 | ||
1207 | if (parent->cmode != HTB_CAN_SEND) | ||
1208 | htb_safe_rb_erase(&parent->pq_node, q->wait_pq + parent->level); | ||
1209 | |||
1206 | parent->level = 0; | 1210 | parent->level = 0; |
1207 | memset(&parent->un.inner, 0, sizeof(parent->un.inner)); | 1211 | memset(&parent->un.inner, 0, sizeof(parent->un.inner)); |
1208 | INIT_LIST_HEAD(&parent->un.leaf.drop_list); | 1212 | INIT_LIST_HEAD(&parent->un.leaf.drop_list); |
@@ -1300,7 +1304,7 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg) | |||
1300 | htb_deactivate(q, cl); | 1304 | htb_deactivate(q, cl); |
1301 | 1305 | ||
1302 | if (last_child) | 1306 | if (last_child) |
1303 | htb_parent_to_leaf(cl, new_q); | 1307 | htb_parent_to_leaf(q, cl, new_q); |
1304 | 1308 | ||
1305 | if (--cl->refcnt == 0) | 1309 | if (--cl->refcnt == 0) |
1306 | htb_destroy_class(sch, cl); | 1310 | htb_destroy_class(sch, cl); |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index d74c2d26953..01c7e311b90 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/sched.h> | ||
22 | 21 | ||
23 | #include <linux/sunrpc/types.h> | 22 | #include <linux/sunrpc/types.h> |
24 | #include <linux/sunrpc/xdr.h> | 23 | #include <linux/sunrpc/xdr.h> |
diff --git a/net/tipc/core.h b/net/tipc/core.h index 325404fd4eb..5a0e4878d3b 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -279,15 +279,14 @@ static inline void k_term_timer(struct timer_list *timer) | |||
279 | /* | 279 | /* |
280 | * TIPC message buffer code | 280 | * TIPC message buffer code |
281 | * | 281 | * |
282 | * TIPC message buffer headroom reserves space for a link-level header | 282 | * TIPC message buffer headroom reserves space for the worst-case |
283 | * (in case the message is sent off-node), | 283 | * link-level device header (in case the message is sent off-node). |
284 | * while ensuring TIPC header is word aligned for quicker access | ||
285 | * | 284 | * |
286 | * The largest header currently supported is 18 bytes, which is used when | 285 | * Note: Headroom should be a multiple of 4 to ensure the TIPC header fields |
287 | * the standard 14 byte Ethernet header has 4 added bytes for VLAN info | 286 | * are word aligned for quicker access |
288 | */ | 287 | */ |
289 | 288 | ||
290 | #define BUF_HEADROOM 20u | 289 | #define BUF_HEADROOM LL_MAX_HEADER |
291 | 290 | ||
292 | struct tipc_skb_cb { | 291 | struct tipc_skb_cb { |
293 | void *handle; | 292 | void *handle; |
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 4bc68f20a73..96521cb087e 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -11,9 +11,9 @@ | |||
11 | #ifndef KBUILD_NO_NLS | 11 | #ifndef KBUILD_NO_NLS |
12 | # include <libintl.h> | 12 | # include <libintl.h> |
13 | #else | 13 | #else |
14 | # define gettext(Msgid) ((const char *) (Msgid)) | 14 | static inline const char *gettext(const char *txt) { return txt; } |
15 | # define textdomain(Domainname) ((const char *) (Domainname)) | 15 | static inline void textdomain(const char *domainname) {} |
16 | # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) | 16 | static inline void bindtextdomain(const char *name, const char *dir) {} |
17 | #endif | 17 | #endif |
18 | 18 | ||
19 | #ifdef __cplusplus | 19 | #ifdef __cplusplus |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 734cf4f3131..6841e95c098 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -773,7 +773,7 @@ static void conf_string(struct menu *menu) | |||
773 | 773 | ||
774 | while (1) { | 774 | while (1) { |
775 | int res; | 775 | int res; |
776 | char *heading; | 776 | const char *heading; |
777 | 777 | ||
778 | switch (sym_get_type(menu->sym)) { | 778 | switch (sym_get_type(menu->sym)) { |
779 | case S_INT: | 779 | case S_INT: |
@@ -925,3 +925,4 @@ int main(int ac, char **av) | |||
925 | 925 | ||
926 | return 0; | 926 | return 0; |
927 | } | 927 | } |
928 | |||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index e04c4218cb5..cea4a790e1e 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -51,6 +51,15 @@ do { \ | |||
51 | sprintf(str + strlen(str), "*"); \ | 51 | sprintf(str + strlen(str), "*"); \ |
52 | } while(0) | 52 | } while(0) |
53 | 53 | ||
54 | /* Always end in a wildcard, for future extension */ | ||
55 | static inline void add_wildcard(char *str) | ||
56 | { | ||
57 | int len = strlen(str); | ||
58 | |||
59 | if (str[len - 1] != '*') | ||
60 | strcat(str + len, "*"); | ||
61 | } | ||
62 | |||
54 | unsigned int cross_build = 0; | 63 | unsigned int cross_build = 0; |
55 | /** | 64 | /** |
56 | * Check that sizeof(device_id type) are consistent with size of section | 65 | * Check that sizeof(device_id type) are consistent with size of section |
@@ -133,9 +142,7 @@ static void do_usb_entry(struct usb_device_id *id, | |||
133 | id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL, | 142 | id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL, |
134 | id->bInterfaceProtocol); | 143 | id->bInterfaceProtocol); |
135 | 144 | ||
136 | /* Always end in a wildcard, for future extension */ | 145 | add_wildcard(alias); |
137 | if (alias[strlen(alias)-1] != '*') | ||
138 | strcat(alias, "*"); | ||
139 | buf_printf(&mod->dev_table_buf, | 146 | buf_printf(&mod->dev_table_buf, |
140 | "MODULE_ALIAS(\"%s\");\n", alias); | 147 | "MODULE_ALIAS(\"%s\");\n", alias); |
141 | } | 148 | } |
@@ -219,6 +226,7 @@ static int do_ieee1394_entry(const char *filename, | |||
219 | ADD(alias, "ver", id->match_flags & IEEE1394_MATCH_VERSION, | 226 | ADD(alias, "ver", id->match_flags & IEEE1394_MATCH_VERSION, |
220 | id->version); | 227 | id->version); |
221 | 228 | ||
229 | add_wildcard(alias); | ||
222 | return 1; | 230 | return 1; |
223 | } | 231 | } |
224 | 232 | ||
@@ -261,6 +269,7 @@ static int do_pci_entry(const char *filename, | |||
261 | ADD(alias, "bc", baseclass_mask == 0xFF, baseclass); | 269 | ADD(alias, "bc", baseclass_mask == 0xFF, baseclass); |
262 | ADD(alias, "sc", subclass_mask == 0xFF, subclass); | 270 | ADD(alias, "sc", subclass_mask == 0xFF, subclass); |
263 | ADD(alias, "i", interface_mask == 0xFF, interface); | 271 | ADD(alias, "i", interface_mask == 0xFF, interface); |
272 | add_wildcard(alias); | ||
264 | return 1; | 273 | return 1; |
265 | } | 274 | } |
266 | 275 | ||
@@ -283,6 +292,7 @@ static int do_ccw_entry(const char *filename, | |||
283 | id->dev_type); | 292 | id->dev_type); |
284 | ADD(alias, "dm", id->match_flags&CCW_DEVICE_ID_MATCH_DEVICE_MODEL, | 293 | ADD(alias, "dm", id->match_flags&CCW_DEVICE_ID_MATCH_DEVICE_MODEL, |
285 | id->dev_model); | 294 | id->dev_model); |
295 | add_wildcard(alias); | ||
286 | return 1; | 296 | return 1; |
287 | } | 297 | } |
288 | 298 | ||
@@ -290,7 +300,7 @@ static int do_ccw_entry(const char *filename, | |||
290 | static int do_ap_entry(const char *filename, | 300 | static int do_ap_entry(const char *filename, |
291 | struct ap_device_id *id, char *alias) | 301 | struct ap_device_id *id, char *alias) |
292 | { | 302 | { |
293 | sprintf(alias, "ap:t%02X", id->dev_type); | 303 | sprintf(alias, "ap:t%02X*", id->dev_type); |
294 | return 1; | 304 | return 1; |
295 | } | 305 | } |
296 | 306 | ||
@@ -309,6 +319,7 @@ static int do_serio_entry(const char *filename, | |||
309 | ADD(alias, "id", id->id != SERIO_ANY, id->id); | 319 | ADD(alias, "id", id->id != SERIO_ANY, id->id); |
310 | ADD(alias, "ex", id->extra != SERIO_ANY, id->extra); | 320 | ADD(alias, "ex", id->extra != SERIO_ANY, id->extra); |
311 | 321 | ||
322 | add_wildcard(alias); | ||
312 | return 1; | 323 | return 1; |
313 | } | 324 | } |
314 | 325 | ||
@@ -316,7 +327,7 @@ static int do_serio_entry(const char *filename, | |||
316 | static int do_acpi_entry(const char *filename, | 327 | static int do_acpi_entry(const char *filename, |
317 | struct acpi_device_id *id, char *alias) | 328 | struct acpi_device_id *id, char *alias) |
318 | { | 329 | { |
319 | sprintf(alias, "acpi*:%s:", id->id); | 330 | sprintf(alias, "acpi*:%s:*", id->id); |
320 | return 1; | 331 | return 1; |
321 | } | 332 | } |
322 | 333 | ||
@@ -324,7 +335,7 @@ static int do_acpi_entry(const char *filename, | |||
324 | static int do_pnp_entry(const char *filename, | 335 | static int do_pnp_entry(const char *filename, |
325 | struct pnp_device_id *id, char *alias) | 336 | struct pnp_device_id *id, char *alias) |
326 | { | 337 | { |
327 | sprintf(alias, "pnp:d%s", id->id); | 338 | sprintf(alias, "pnp:d%s*", id->id); |
328 | return 1; | 339 | return 1; |
329 | } | 340 | } |
330 | 341 | ||
@@ -409,6 +420,7 @@ static int do_pcmcia_entry(const char *filename, | |||
409 | ADD(alias, "pc", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, id->prod_id_hash[2]); | 420 | ADD(alias, "pc", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, id->prod_id_hash[2]); |
410 | ADD(alias, "pd", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, id->prod_id_hash[3]); | 421 | ADD(alias, "pd", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, id->prod_id_hash[3]); |
411 | 422 | ||
423 | add_wildcard(alias); | ||
412 | return 1; | 424 | return 1; |
413 | } | 425 | } |
414 | 426 | ||
@@ -432,6 +444,7 @@ static int do_of_entry (const char *filename, struct of_device_id *of, char *ali | |||
432 | if (isspace (*tmp)) | 444 | if (isspace (*tmp)) |
433 | *tmp = '_'; | 445 | *tmp = '_'; |
434 | 446 | ||
447 | add_wildcard(alias); | ||
435 | return 1; | 448 | return 1; |
436 | } | 449 | } |
437 | 450 | ||
@@ -448,6 +461,7 @@ static int do_vio_entry(const char *filename, struct vio_device_id *vio, | |||
448 | if (isspace (*tmp)) | 461 | if (isspace (*tmp)) |
449 | *tmp = '_'; | 462 | *tmp = '_'; |
450 | 463 | ||
464 | add_wildcard(alias); | ||
451 | return 1; | 465 | return 1; |
452 | } | 466 | } |
453 | 467 | ||
@@ -511,6 +525,8 @@ static int do_eisa_entry(const char *filename, struct eisa_device_id *eisa, | |||
511 | { | 525 | { |
512 | if (eisa->sig[0]) | 526 | if (eisa->sig[0]) |
513 | sprintf(alias, EISA_DEVICE_MODALIAS_FMT "*", eisa->sig); | 527 | sprintf(alias, EISA_DEVICE_MODALIAS_FMT "*", eisa->sig); |
528 | else | ||
529 | strcat(alias, "*"); | ||
514 | return 1; | 530 | return 1; |
515 | } | 531 | } |
516 | 532 | ||
@@ -529,6 +545,7 @@ static int do_parisc_entry(const char *filename, struct parisc_device_id *id, | |||
529 | ADD(alias, "rev", id->hversion_rev != PA_HVERSION_REV_ANY_ID, id->hversion_rev); | 545 | ADD(alias, "rev", id->hversion_rev != PA_HVERSION_REV_ANY_ID, id->hversion_rev); |
530 | ADD(alias, "sv", id->sversion != PA_SVERSION_ANY_ID, id->sversion); | 546 | ADD(alias, "sv", id->sversion != PA_SVERSION_ANY_ID, id->sversion); |
531 | 547 | ||
548 | add_wildcard(alias); | ||
532 | return 1; | 549 | return 1; |
533 | } | 550 | } |
534 | 551 | ||
@@ -544,6 +561,7 @@ static int do_sdio_entry(const char *filename, | |||
544 | ADD(alias, "c", id->class != (__u8)SDIO_ANY_ID, id->class); | 561 | ADD(alias, "c", id->class != (__u8)SDIO_ANY_ID, id->class); |
545 | ADD(alias, "v", id->vendor != (__u16)SDIO_ANY_ID, id->vendor); | 562 | ADD(alias, "v", id->vendor != (__u16)SDIO_ANY_ID, id->vendor); |
546 | ADD(alias, "d", id->device != (__u16)SDIO_ANY_ID, id->device); | 563 | ADD(alias, "d", id->device != (__u16)SDIO_ANY_ID, id->device); |
564 | add_wildcard(alias); | ||
547 | return 1; | 565 | return 1; |
548 | } | 566 | } |
549 | 567 | ||
@@ -559,6 +577,7 @@ static int do_ssb_entry(const char *filename, | |||
559 | ADD(alias, "v", id->vendor != SSB_ANY_VENDOR, id->vendor); | 577 | ADD(alias, "v", id->vendor != SSB_ANY_VENDOR, id->vendor); |
560 | ADD(alias, "id", id->coreid != SSB_ANY_ID, id->coreid); | 578 | ADD(alias, "id", id->coreid != SSB_ANY_ID, id->coreid); |
561 | ADD(alias, "rev", id->revision != SSB_ANY_REV, id->revision); | 579 | ADD(alias, "rev", id->revision != SSB_ANY_REV, id->revision); |
580 | add_wildcard(alias); | ||
562 | return 1; | 581 | return 1; |
563 | } | 582 | } |
564 | 583 | ||
@@ -573,6 +592,7 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id, | |||
573 | ADD(alias, "d", 1, id->device); | 592 | ADD(alias, "d", 1, id->device); |
574 | ADD(alias, "v", id->vendor != VIRTIO_DEV_ANY_ID, id->vendor); | 593 | ADD(alias, "v", id->vendor != VIRTIO_DEV_ANY_ID, id->vendor); |
575 | 594 | ||
595 | add_wildcard(alias); | ||
576 | return 1; | 596 | return 1; |
577 | } | 597 | } |
578 | 598 | ||
@@ -612,9 +632,6 @@ static void do_table(void *symval, unsigned long size, | |||
612 | 632 | ||
613 | for (i = 0; i < size; i += id_size) { | 633 | for (i = 0; i < size; i += id_size) { |
614 | if (do_entry(mod->name, symval+i, alias)) { | 634 | if (do_entry(mod->name, symval+i, alias)) { |
615 | /* Always end in a wildcard, for future extension */ | ||
616 | if (alias[strlen(alias)-1] != '*') | ||
617 | strcat(alias, "*"); | ||
618 | buf_printf(&mod->dev_table_buf, | 635 | buf_printf(&mod->dev_table_buf, |
619 | "MODULE_ALIAS(\"%s\");\n", alias); | 636 | "MODULE_ALIAS(\"%s\");\n", alias); |
620 | } | 637 | } |
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig index a78a8d04517..379bcb07446 100644 --- a/sound/drivers/Kconfig +++ b/sound/drivers/Kconfig | |||
@@ -5,8 +5,8 @@ menu "Generic devices" | |||
5 | 5 | ||
6 | 6 | ||
7 | config SND_PCSP | 7 | config SND_PCSP |
8 | tristate "Internal PC speaker support" | 8 | tristate "PC-Speaker support" |
9 | depends on X86_PC && HIGH_RES_TIMERS | 9 | depends on PCSPKR_PLATFORM && X86_PC && HIGH_RES_TIMERS |
10 | depends on INPUT | 10 | depends on INPUT |
11 | depends on SND | 11 | depends on SND |
12 | select SND_PCM | 12 | select SND_PCM |
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c index 59203511e77..54a1f9036c6 100644 --- a/sound/drivers/pcsp/pcsp.c +++ b/sound/drivers/pcsp/pcsp.c | |||
@@ -194,6 +194,7 @@ static void pcsp_stop_beep(struct snd_pcsp *chip) | |||
194 | spin_unlock_irq(&chip->substream_lock); | 194 | spin_unlock_irq(&chip->substream_lock); |
195 | } | 195 | } |
196 | 196 | ||
197 | #ifdef CONFIG_PM | ||
197 | static int pcsp_suspend(struct platform_device *dev, pm_message_t state) | 198 | static int pcsp_suspend(struct platform_device *dev, pm_message_t state) |
198 | { | 199 | { |
199 | struct snd_pcsp *chip = platform_get_drvdata(dev); | 200 | struct snd_pcsp *chip = platform_get_drvdata(dev); |
@@ -201,6 +202,9 @@ static int pcsp_suspend(struct platform_device *dev, pm_message_t state) | |||
201 | snd_pcm_suspend_all(chip->pcm); | 202 | snd_pcm_suspend_all(chip->pcm); |
202 | return 0; | 203 | return 0; |
203 | } | 204 | } |
205 | #else | ||
206 | #define pcsp_suspend NULL | ||
207 | #endif /* CONFIG_PM */ | ||
204 | 208 | ||
205 | static void pcsp_shutdown(struct platform_device *dev) | 209 | static void pcsp_shutdown(struct platform_device *dev) |
206 | { | 210 | { |
diff --git a/sound/oss/kahlua.c b/sound/oss/kahlua.c index dfe670f12e6..eb9bc365530 100644 --- a/sound/oss/kahlua.c +++ b/sound/oss/kahlua.c | |||
@@ -67,7 +67,7 @@ static int __devinit probe_one(struct pci_dev *pdev, const struct pci_device_id | |||
67 | return 1; | 67 | return 1; |
68 | 68 | ||
69 | mem = ioremap(base, 128); | 69 | mem = ioremap(base, 128); |
70 | if(mem == 0UL) | 70 | if (!mem) |
71 | return 1; | 71 | return 1; |
72 | map = readw(mem + 0x18); /* Read the SMI enables */ | 72 | map = readw(mem + 0x18); /* Read the SMI enables */ |
73 | iounmap(mem); | 73 | iounmap(mem); |
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 581debf37dc..7e474210957 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig | |||
@@ -515,19 +515,16 @@ config SND_FM801 | |||
515 | config SND_FM801_TEA575X_BOOL | 515 | config SND_FM801_TEA575X_BOOL |
516 | bool "ForteMedia FM801 + TEA5757 tuner" | 516 | bool "ForteMedia FM801 + TEA5757 tuner" |
517 | depends on SND_FM801 | 517 | depends on SND_FM801 |
518 | depends on VIDEO_V4L1=y || VIDEO_V4L1=SND_FM801 | ||
518 | help | 519 | help |
519 | Say Y here to include support for soundcards based on the ForteMedia | 520 | Say Y here to include support for soundcards based on the ForteMedia |
520 | FM801 chip with a TEA5757 tuner connected to GPIO1-3 pins (Media | 521 | FM801 chip with a TEA5757 tuner connected to GPIO1-3 pins (Media |
521 | Forte SF256-PCS-02) into the snd-fm801 driver. | 522 | Forte SF256-PCS-02) into the snd-fm801 driver. |
522 | 523 | ||
523 | This will enable support for the old V4L1 API. | ||
524 | |||
525 | config SND_FM801_TEA575X | 524 | config SND_FM801_TEA575X |
526 | tristate | 525 | tristate |
527 | depends on SND_FM801_TEA575X_BOOL | 526 | depends on SND_FM801_TEA575X_BOOL |
528 | default SND_FM801 | 527 | default SND_FM801 |
529 | select VIDEO_V4L1 | ||
530 | select VIDEO_DEV | ||
531 | 528 | ||
532 | config SND_HDA_INTEL | 529 | config SND_HDA_INTEL |
533 | tristate "Intel HD Audio" | 530 | tristate "Intel HD Audio" |
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 39198e505b1..2da89810ca1 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -3446,6 +3446,7 @@ static const struct snd_kcontrol_new snd_ac97_controls_vt1617a[] = { | |||
3446 | int patch_vt1617a(struct snd_ac97 * ac97) | 3446 | int patch_vt1617a(struct snd_ac97 * ac97) |
3447 | { | 3447 | { |
3448 | int err = 0; | 3448 | int err = 0; |
3449 | int val; | ||
3449 | 3450 | ||
3450 | /* we choose to not fail out at this point, but we tell the | 3451 | /* we choose to not fail out at this point, but we tell the |
3451 | caller when we return */ | 3452 | caller when we return */ |
@@ -3456,7 +3457,13 @@ int patch_vt1617a(struct snd_ac97 * ac97) | |||
3456 | /* bring analog power consumption to normal by turning off the | 3457 | /* bring analog power consumption to normal by turning off the |
3457 | * headphone amplifier, like WinXP driver for EPIA SP | 3458 | * headphone amplifier, like WinXP driver for EPIA SP |
3458 | */ | 3459 | */ |
3459 | snd_ac97_write_cache(ac97, 0x5c, 0x20); | 3460 | /* We need to check the bit before writing it. |
3461 | * On some (many?) hardwares, setting bit actually clears it! | ||
3462 | */ | ||
3463 | val = snd_ac97_read(ac97, 0x5c); | ||
3464 | if (!(val & 0x20)) | ||
3465 | snd_ac97_write_cache(ac97, 0x5c, 0x20); | ||
3466 | |||
3460 | ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ | 3467 | ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ |
3461 | ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; | 3468 | ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; |
3462 | ac97->build_ops = &patch_vt1616_ops; | 3469 | ac97->build_ops = &patch_vt1616_ops; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d9783a4263e..6d4df45e81e 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -11902,7 +11902,10 @@ static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, | |||
11902 | hda_nid_t nid, | 11902 | hda_nid_t nid, |
11903 | int pin_type, int dac_idx) | 11903 | int pin_type, int dac_idx) |
11904 | { | 11904 | { |
11905 | alc_set_pin_output(codec, nid, pin_type); | 11905 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
11906 | pin_type); | ||
11907 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
11908 | AMP_OUT_UNMUTE); | ||
11906 | } | 11909 | } |
11907 | 11910 | ||
11908 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | 11911 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index b3a15d61687..393f7fd2b1b 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -4289,6 +4289,8 @@ struct hda_codec_preset snd_hda_preset_sigmatel[] = { | |||
4289 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, | 4289 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, |
4290 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, | 4290 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, |
4291 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, | 4291 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, |
4292 | { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x }, | ||
4293 | { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x }, | ||
4292 | /* The following does not take into account .id=0x83847661 when subsys = | 4294 | /* The following does not take into account .id=0x83847661 when subsys = |
4293 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are | 4295 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are |
4294 | * currently not fully supported. | 4296 | * currently not fully supported. |
diff --git a/sound/soc/at91/at91-pcm.c b/sound/soc/at91/at91-pcm.c index 67c88e322fb..ccac6bd2889 100644 --- a/sound/soc/at91/at91-pcm.c +++ b/sound/soc/at91/at91-pcm.c | |||
@@ -103,7 +103,8 @@ static void at91_pcm_dma_irq(u32 ssc_sr, | |||
103 | if (prtd->period_ptr >= prtd->dma_buffer_end) { | 103 | if (prtd->period_ptr >= prtd->dma_buffer_end) { |
104 | prtd->period_ptr = prtd->dma_buffer; | 104 | prtd->period_ptr = prtd->dma_buffer; |
105 | } | 105 | } |
106 | at91_ssc_write(params->ssc_base + params->pdc->xnpr, prtd->period_ptr); | 106 | at91_ssc_write(params->ssc_base + params->pdc->xnpr, |
107 | prtd->period_ptr); | ||
107 | at91_ssc_write(params->ssc_base + params->pdc->xncr, | 108 | at91_ssc_write(params->ssc_base + params->pdc->xncr, |
108 | prtd->period_size / params->pdc_xfer_size); | 109 | prtd->period_size / params->pdc_xfer_size); |
109 | } | 110 | } |
@@ -191,10 +192,12 @@ static int at91_pcm_trigger(struct snd_pcm_substream *substream, | |||
191 | at91_ssc_write(params->ssc_base + AT91_SSC_IER, | 192 | at91_ssc_write(params->ssc_base + AT91_SSC_IER, |
192 | params->mask->ssc_endx | params->mask->ssc_endbuf); | 193 | params->mask->ssc_endx | params->mask->ssc_endbuf); |
193 | 194 | ||
194 | at91_ssc_write(params->ssc_base + ATMEL_PDC_PTCR, params->mask->pdc_enable); | 195 | at91_ssc_write(params->ssc_base + ATMEL_PDC_PTCR, |
196 | params->mask->pdc_enable); | ||
195 | 197 | ||
196 | DBG("sr=%lx imr=%lx\n", at91_ssc_read(params->ssc_base + AT91_SSC_SR), | 198 | DBG("sr=%lx imr=%lx\n", |
197 | at91_ssc_read(params->ssc_base + AT91_SSC_IER)); | 199 | at91_ssc_read(params->ssc_base + AT91_SSC_SR), |
200 | at91_ssc_read(params->ssc_base + AT91_SSC_IMR)); | ||
198 | break; | 201 | break; |
199 | 202 | ||
200 | case SNDRV_PCM_TRIGGER_STOP: | 203 | case SNDRV_PCM_TRIGGER_STOP: |
diff --git a/sound/soc/at91/at91-ssc.c b/sound/soc/at91/at91-ssc.c index f642d2dd4ec..bc35d00a38f 100644 --- a/sound/soc/at91/at91-ssc.c +++ b/sound/soc/at91/at91-ssc.c | |||
@@ -590,7 +590,7 @@ static int at91_ssc_hw_params(struct snd_pcm_substream *substream, | |||
590 | printk(KERN_WARNING "at91-ssc: request_irq failure\n"); | 590 | printk(KERN_WARNING "at91-ssc: request_irq failure\n"); |
591 | 591 | ||
592 | DBG("Stopping pid %d clock\n", ssc_p->ssc.pid); | 592 | DBG("Stopping pid %d clock\n", ssc_p->ssc.pid); |
593 | at91_sys_write(AT91_PMC_PCER, 1<<ssc_p->ssc.pid); | 593 | at91_sys_write(AT91_PMC_PCDR, 1<<ssc_p->ssc.pid); |
594 | return ret; | 594 | return ret; |
595 | } | 595 | } |
596 | 596 | ||
diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c index 4ebcd6a8bf2..1ed6afd4545 100644 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c | |||
@@ -224,6 +224,7 @@ static int s3c24xx_i2s_set_fmt(struct snd_soc_cpu_dai *cpu_dai, | |||
224 | iismod |= S3C2410_IISMOD_SLAVE; | 224 | iismod |= S3C2410_IISMOD_SLAVE; |
225 | break; | 225 | break; |
226 | case SND_SOC_DAIFMT_CBS_CFS: | 226 | case SND_SOC_DAIFMT_CBS_CFS: |
227 | iismod &= ~S3C2410_IISMOD_SLAVE; | ||
227 | break; | 228 | break; |
228 | default: | 229 | default: |
229 | return -EINVAL; | 230 | return -EINVAL; |
@@ -234,6 +235,7 @@ static int s3c24xx_i2s_set_fmt(struct snd_soc_cpu_dai *cpu_dai, | |||
234 | iismod |= S3C2410_IISMOD_MSB; | 235 | iismod |= S3C2410_IISMOD_MSB; |
235 | break; | 236 | break; |
236 | case SND_SOC_DAIFMT_I2S: | 237 | case SND_SOC_DAIFMT_I2S: |
238 | iismod &= ~S3C2410_IISMOD_MSB; | ||
237 | break; | 239 | break; |
238 | default: | 240 | default: |
239 | return -EINVAL; | 241 | return -EINVAL; |
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c index 6c70a81c730..7806ae61461 100644 --- a/sound/soc/s3c24xx/s3c24xx-pcm.c +++ b/sound/soc/s3c24xx/s3c24xx-pcm.c | |||
@@ -171,7 +171,7 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
171 | ret = s3c2410_dma_request(prtd->params->channel, | 171 | ret = s3c2410_dma_request(prtd->params->channel, |
172 | prtd->params->client, NULL); | 172 | prtd->params->client, NULL); |
173 | 173 | ||
174 | if (ret) { | 174 | if (ret < 0) { |
175 | DBG(KERN_ERR "failed to get dma channel\n"); | 175 | DBG(KERN_ERR "failed to get dma channel\n"); |
176 | return ret; | 176 | return ret; |
177 | } | 177 | } |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index e89338e2b04..f7ba099049e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -522,6 +522,7 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn) | |||
522 | return bad_hva(); | 522 | return bad_hva(); |
523 | return (slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE); | 523 | return (slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE); |
524 | } | 524 | } |
525 | EXPORT_SYMBOL_GPL(gfn_to_hva); | ||
525 | 526 | ||
526 | /* | 527 | /* |
527 | * Requires current->mm->mmap_sem to be held | 528 | * Requires current->mm->mmap_sem to be held |